pop up windows

Uli Schlachter psychon at znc.in
Fri Feb 14 16:27:39 UTC 2025


Am 14.02.25 um 11:14 schrieb Steven J Abner:
> On Fri, Feb 14 2025 at 08:25:30 AM +0000, Uli Schlachter 
> <psychon at znc.in> wrote:
>> The demo opens a white window white window in i3 that... does nothing?
> 
> Sorry, just click in content area of white window for pop up. click 
> anywhere outside of pop up to close pop up. Basically a left button 
> context menu with internal pop up content doing nothing.
> When parent loses focus, first click won't create pop up, just focus. A 
> focused parent allows content pop up. Haven't tried title bar content 
> pop up. My guess its a denied service not by X but by a WM.

Well... what this does is when I click on it is to print out:

        8388608, SBIT_RELEASE_IGNORE set.
        8388609, SBIT_FOCUS_CLICK set.
        8388608, SBIT_FOCUS_CLICK reset.
        8388608, SBIT_RELEASE_IGNORE reset.

Looking at it with xtrace...
Ah, well. Opening a white window ontop of a white window is a bit hard 
to notice. I made this a bit more noticable:

> --- xpop.c.orig	2025-02-14 17:14:46.749846662 +0100
> +++ xpop.c	2025-02-14 17:15:09.565476109 +0100
> @@ -458,12 +458,13 @@
>  xcb_window_t
>  ui_dropdown_create(PhxRectangle configure, xcb_window_t transient_for_window) {
>  
> -  uint32_t values[] = {  true  };
> +  xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
> +  uint32_t values[] = { screen->black_pixel, true  };
>    xcb_window_t window = _window_create(configure);
>    if (window == 0)  return 0;
>  
>    xcb_change_window_attributes(connection, window,
> -                               XCB_CW_OVERRIDE_REDIRECT, values);
> +                              XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT, values);
>  
>    xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window,
>                               XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,

With that change, I can confirm that this actually behaves the way you 
say it behaves for me.

I would expect that this kind of popup windows usually use a mouse grab, 
e.g. tracking the opening of the "File" menu on GVim actually.... uhm... 
actually uses the XInput extension for the grab:

> 19.106 000:>:02d7: Event Generic(35) XInputExtension(131) ButtonPress(4) deviceid=0x02 time=0x005cbbda detail=0x00000001 root=0x00000480 event=0x00800003 child=0x00000000 root_x=29.000000 root_y=39.000000 event_x=29.000000 event_y=9.000000 sourceid=0x0007 flags=0x00000000 mods={base_mods=0x00000000 latched_mods=0x00000000 locked_mods=0x00000000 effective_mods=0x00000000}; group={base_group=0x00 latched_group=0x00 locked_group=0x00 effective_group=0x00}; buttons=0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000; valuators=0x00000004,0x00000000; axisvalues=0.00000000000;
[...]
> 19.108 000:<:02d9: 32: XInputExtension-Request(131,51): XIGrabDevice grab_window=0x00800003 time=0x00000000 cursor=0x00000000 device=2 grab_mode=Asynchronous(0x01) paired_device_mode=Asynchronous(0x01) owner_events=true(0x01) masks=0xf80001f0,0x00000001;
[...]
> 19.109 000:<:02db: 32: XInputExtension-Request(131,51): XIGrabDevice grab_window=0x00800003 time=0x00000000 cursor=0x00000000 device=3 grab_mode=Asynchronous(0x01) paired_device_mode=Asynchronous(0x01) owner_events=true(0x01) masks=0x000007fc,0x00000000;

Since I guess you do not care about the differences between different 
input devices, you could just use a GrabPointer request for that.

What does GrabPointer do? The short version is: You and no one else get 
all pointer events until UngrabPointer.

The long version is in [1] and something like [2]. [2] is not actually 
saying directly what I want to link to. This is more about "a grab 
decides which window a button press is sent to" and the text in [2] 
talks about "no active pointer grab", thus allowing you to bypass this.

Does that help?

Cheers,
Uli

[1]: 
https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GrabPointer
[2]: https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#Events

P.S.: And in case you wonder what xtrace is: No, not that thing from 
glibc with the same name. I mean e.g.:
  https://tracker.debian.org/pkg/xtrace

-- 
"For saving the Earth.. and eating cheesecake!"


More information about the Xcb mailing list