How can I get an "XCB_MAP_REQUEST" for a window I am trying to map?

67 Views Asked by At

I am writing a window manager similar to AwesomeWM whereby it will be written in C, and have an extension api through lua. In other words, you can imagine I'm trying to create a window manager "platform" whereby other developers can use the lua api to create whatever type of window manager they want.

Additionally, I want this window manager to be made up of two parts: the "window manager" part, and the "client" part. The intention is that the "window manager part" would take care of window manager tasks, whereas the "client" part would be a system with which the user would be able to write their own widgets and applications in lua.

In essence, what I would like to do is have the "window manager" part listen to XCB_MAP_REQUEST events, and from there on, decide which window to map, how to manage them, etc. On the "client part", I would like to be able to just use xcb_map_window as a regular client would, and get the XCB_MAP_REQUEST event on my "window manager part". However, this does not work for me.

Finally, my question is: how would I be able to use xcb_map_window in my "client part" of the window manager, and get an XCB_MAP_REQUEST in my "window manager part"?

1

There are 1 best solutions below

1
On BEST ANSWER

how would I be able to use xcb_map_window in my "client part" of the window manager, and get an XCB_MAP_REQUEST in my "window manager part"?

Two options come to my mind:

  1. Use two separate X11 connections (and then try to fix / work-around all of the synchronisation issues that result).
  2. Don't use xcb_map_window(), but instead use xcb_send_event() to send a XCB_MAP_REQUEST to the root window (but the event you receive from that will have the high bit of the event code set - dunno if that matters to you).

From my favorite document about X11:

https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#requests:MapWindow

If the override-redirect attribute of the window is False and some other client has selected SubstructureRedirect on the parent, then a MapRequest event is generated, but the window remains unmapped. Otherwise, the window is mapped, and a MapNotify event is generated.

Notice that this says "some other client".