[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    how to get button press event on window manager ?
From:       "=?gb18030?B?yq/X0A==?=" <406643764 () qq ! com>
Date:       2018-04-10 16:01:02
Message-ID: tencent_09C452F064E9464B17A6E167B8D9AEB4BA09 () qq ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

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;
}


[Attachment #5 (text/html)]

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 :<br><br>#include \
&lt;X11/Xlib.h&gt;<br>int main(void)<br>{<br>&nbsp;&nbsp;&nbsp; Display \
*display=XOpenDisplay(NULL);<br>&nbsp;&nbsp;&nbsp; XSelectInput(display, \
DefaultRootWindow(display), \
SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|OwnerGrabButtonMask);<br>&nbsp;&nbsp;&nbsp; \
XEvent event;<br>&nbsp;&nbsp;&nbsp; while(1)<br>&nbsp;&nbsp;&nbsp; \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XNextEvent(display, \
&amp;event);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
switch(event.type)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case \
ButtonPress :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
XRaiseWindow(display, \
event.xbutton.window);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
XSetInputFocus(display, event.xbutton.window, RevertToPointerRoot, \
CurrentTime);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case \
ConfigureRequest :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
/* ... */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case \
MapRequest :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
XMapWindow(display, event.xmaprequest.window);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; \
}<br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><br>


[Attachment #6 (text/plain)]

_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic