1

First question so please forgive me if I am neglecting a requirement here.

I am attempting to build a window manager for arch linux. Currently, I am adding grab events before mapping a window.

I have the following:

XGrabButton(display, Button1, 0, window, false, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None);

When Button1 is pressed I run this:

XRaiseWindow(display, frame);

The issue is now I cannot click anything in the window. Only the ButtonPressed callback function is being run. How could I go about (1) making sure the ButtonPress event is also received by the window and (2) only running the XRaiseWindow function if the window is not currently the top window (I assume stack_mode can be used here)?

Edit: I have solved (1) with the following (found here).

Change pointer_mode to GrabModeSync and use

XAllowEvents(display, ReplayPointer, event.time);
XSync(display, 0);

in the ButtonPressed callback to pass on the click event.

Still looking for (2), though. From what I can tell stack_mode is going to be difficult to use and XQueryTree does not seem to return what I want (although, there is a higher chance I am doing it incorrectly)

Eshy
  • 51
  • 3

0 Answers0