how to get button press event on window manager ?
石仔
406643764 at qq.com
Tue Apr 10 16:01:02 UTC 2018
Hi all.I would like to be able to raise the clicked window to the top of the stack on my window manager. But it fail because only one client can SelectInput on Button events at one time. How can I realize my goal? Here is my code :
#include <X11/Xlib.h>
int main(void)
{
Display *display=XOpenDisplay(NULL);
XSelectInput(display, DefaultRootWindow(display), SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|OwnerGrabButtonMask);
XEvent event;
while(1)
{
XNextEvent(display, &event);
switch(event.type)
{
case ButtonPress :
XRaiseWindow(display, event.xbutton.window);
XSetInputFocus(display, event.xbutton.window, RevertToPointerRoot, CurrentTime);
break;
case ConfigureRequest :
/* ... */
break;
case MapRequest :
XMapWindow(display, event.xmaprequest.window);
break;
}
}
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20180411/3586fd72/attachment.html>
More information about the xorg
mailing list