node-ewmh icon indicating copy to clipboard operation
node-ewmh copied to clipboard

Error: Could not set SubstructureRedirect to root window event_mask

Open RossComputerGuy opened this issue 5 years ago • 25 comments

Error
    at XClient.req_proxy [as ChangeWindowAttributes] (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/xcore.js:189:30)
    at /home/spaceboyross/RDE/src/panel/node_modules/ewmh/lib/ewmh.js:16:15
    at ReadFixedRequest.callback (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/xcore.js:545:21)
    at ReadFixedRequest.execute (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:41:10)
    at UnpackStream.resume (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:165:30)
    at UnpackStream.write (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:102:10)
    at Socket.<anonymous> (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/xcore.js:88:21)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:250:12)
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: Could not set SubstructureRedirect to root window event_mask
    at /home/spaceboyross/RDE/src/panel/node_modules/ewmh/lib/ewmh.js:19:29
    at ReadFixedRequest.callback (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/xcore.js:490:39)
    at ReadFixedRequest.execute (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:41:10)
    at UnpackStream.resume (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:165:30)
    at UnpackStream.write (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/unpackstream.js:102:10)
    at Socket.<anonymous> (/home/spaceboyross/RDE/src/panel/node_modules/x11/lib/xcore.js:88:21)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:250:12)
    at readableAddChunk (_stream_readable.js:237:11)

RossComputerGuy avatar Nov 06 '18 15:11 RossComputerGuy

Hey, can you post sample code that reproduces the issue?

santigimeno avatar Nov 06 '18 15:11 santigimeno

NTK is used.

		ntk.createClient((err,app) => {
			if(err) throw err;
			this[SYMS["app"]] = app;
			this[SYMS["win"]] = app.createWindow({ width: this.width, height: this.height, x: this.x, y: this.y, title: "RDE Panel" });
			this[SYMS["win"]].map();
			this[SYMS["ewmh"]] = new EWMH(app.X,app.display.screen[this[SYMS["opts"]].screen].root);
			this[SYMS["ewmh"]].set_class(this[SYMS["win"]].id,["panel"],err => {
				if(err) throw err;
			});
		});

RossComputerGuy avatar Nov 06 '18 15:11 RossComputerGuy

Is another WM already running in the same xserver?

santigimeno avatar Nov 06 '18 15:11 santigimeno

Yes, I'm running OpenBox

RossComputerGuy avatar Nov 06 '18 15:11 RossComputerGuy

That seems to be the problem. I don't know exactly what are you trying to accomplish but only one X11 client can set SubstructureRedirect mask in a specific window, and I guess openbox has set the mask in the root window. /cc @sidorares

santigimeno avatar Nov 06 '18 16:11 santigimeno

I'm trying to make a panel/dock.

RossComputerGuy avatar Nov 06 '18 16:11 RossComputerGuy

yes, only one client can own SubstructureRedirect. If somebody already started WM you'll need to make it quit before you start new one. There is a "polite way to do that" ( this is what some wm's offer under --replace command line key ). To do that, you try to request selection for WM_S0 ( 0 screen number ) and other wm should notice it's lost selection and quit

https://github.com/bbidulock/icewm/blob/77196178450accf0a959155c94ec8c1c401633a8/src/wmapp.cc#L98-L105

sidorares avatar Nov 06 '18 22:11 sidorares

The replace key didn't fix it.

RossComputerGuy avatar Nov 07 '18 03:11 RossComputerGuy

There is no "replace" key built in to node-x11 or node-ewmh library

You need to kill your WM or follow standard "hey other WM please let me replace you" protocol, that is you need to create a window and acquire WM_S0 selection to that window.

sidorares avatar Nov 07 '18 03:11 sidorares

The replace key in my window manager, that's what I was meaning.

RossComputerGuy avatar Nov 07 '18 03:11 RossComputerGuy

But you are launching your script after some other WM already started, right? So it's your script responsibility to try to replace wm, not that other WM

sidorares avatar Nov 07 '18 03:11 sidorares

Yeah, after OpenBox has started because my DE is RDE. Killing my WM stops the DE which stops X.

RossComputerGuy avatar Nov 07 '18 03:11 RossComputerGuy

You can't have both OpenBox running and request SubstructureRedirect for root window

sidorares avatar Nov 07 '18 03:11 sidorares

Is there a way to bypass the SubstructureRedirect request?

RossComputerGuy avatar Nov 07 '18 03:11 RossComputerGuy

Is there a way to bypass the SubstructureRedirect request?

Not sure what do you mean by bypassing. SubstructureRedirect is what gives WM full control over child windows position/mapping etc. Without doing that you can't do real wm.

On the other hand if what you doing is not full wm (panel or something similer) you don't need SubstructureRedirect

sidorares avatar Nov 07 '18 03:11 sidorares

I was meaning like an option to disable SubstructureRedirect because I'm using this in RDE's toolkit and panel.

RossComputerGuy avatar Nov 07 '18 04:11 RossComputerGuy

Still not clear to me. Which code tries to get SubstructureRedirect ?

sidorares avatar Nov 07 '18 04:11 sidorares

None or new EWMH(app.X,app.display.screen[this[SYMS["opts"]].screen].root)

RossComputerGuy avatar Nov 07 '18 04:11 RossComputerGuy

can you show panel source code?

sidorares avatar Nov 07 '18 06:11 sidorares

Okay, I think I now remember. It's been a long time without using this module. node-ewmh as it is now, it's meant to help implementing the Extended Window Manager Hints to a window manager implementation. So one of the first things it does is trying to set the SubstructureRedirect in the root window. So yes, to use this module you have to avoid any other x11 client to have that mask value set.

santigimeno avatar Nov 07 '18 08:11 santigimeno

https://github.com/Ross-Technologies/RDE-Panel

RossComputerGuy avatar Nov 07 '18 14:11 RossComputerGuy

Why do you need node-ewmh? If it's only to set the WM_CLASS property in a window, then use https://github.com/santigimeno/node-x11-prop#set-property and avoid all the problems.

santigimeno avatar Nov 07 '18 14:11 santigimeno

Well, that's how far I got when I started getting the error, I dunno what else I should have node-ewmh do.

RossComputerGuy avatar Nov 07 '18 15:11 RossComputerGuy

I would say if you're not implementing a window manager which you're not, I would not use node-ewmh.

santigimeno avatar Nov 07 '18 15:11 santigimeno

Or you can always modify it so it suits your use case.

santigimeno avatar Nov 07 '18 15:11 santigimeno