pop up windows

Bart Massey bart at cs.pdx.edu
Sun Feb 16 05:31:07 UTC 2025


Note that in the xcb_grab_pointer() call you are passing an extensive event
mask, whereas with XGrabPointer() you pass only a few events. The big event
mask includes events that are not allowed according to the protocol
specification: I do not know whether XCB or the server care though. You
might want to try
     XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_POINTER_MOTION
instead of  0xFFFE.

More importantly, the grab is not complete until the reply to the
xcb_grab_pointer() request has been received. That means you need to get
that reply before going on. I ended up with code like this: it may not be
quite what you want, but may be better than what you have.

  xcb_grab_pointer_cookie_t grab_cookie;

  xcb_grab_pointer_reply_t *grab_reply;

  xcb_generic_error_t *grab_error;


...

    puts("grab pointer");

    grab_cookie = xcb_grab_pointer(

        connection,

        1,

        iface->window,

        XCB_EVENT_MASK_BUTTON_PRESS |

          XCB_EVENT_MASK_BUTTON_RELEASE |

          XCB_EVENT_MASK_POINTER_MOTION,

        XCB_GRAB_MODE_ASYNC,

        XCB_GRAB_MODE_ASYNC,

        XCB_NONE,

        XCB_NONE,

        XCB_CURRENT_TIME

    );

    grab_reply = xcb_grab_pointer_reply(connection, grab_cookie,
&grab_error);
    if (!grab_reply || grab_reply->status != XCB_GRAB_STATUS_SUCCESS) {

      printf("grab failed");

      return false;

    }

The grab seemed to succeed on my box, so I guess things are good. Try that
and let us know how it goes.

Thanks for sharing this journey with us!


On Sat, Feb 15, 2025 at 2:57 AM Steven J Abner <pheonix.sja at att.net> wrote:

> On Fri, Feb 14 2025 at 11:13:56 PM +0000, Steven J Abner
> <pheonix.sja at att.net> wrote:
> > Solution... don't use xcb_grab_pointer()
>
> So happy! just clickin' away :)
>
> But felt there is one lose end. I believe xcb_grab_pointer() reads
> nearly as XGrabPointer(). If they're not suppose to be the same, maybe
> a documentation update? If it's suppose to be the same, well....
>
> Not sure if this suffices as a bug notice or where it gets reported if
> it is a bug.
> Thank you.. click, click
> Steve
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20250215/c9259ce8/attachment.htm>


More information about the Xcb mailing list