Re: Preventing the X server from sending key events to a child window that is under the mouse

Nicholas Allen <[email protected]> Thu, 30 Apr 2020 09:07:24 +0200
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <CA+a1iEGcGzTUFe0PYvoJsKxzx1PuHC7qOtiOqe5TxsVhosuATQ@mail.gmail.com>
Thanks for your response. I've also been searching further and it seems the
correct thing to do is to support the XEmbed protocol. For the keyboard
input they suggest making an invisible child input only window 1x1 at -1,1
so that it is invisible and then calling xcb_set_input_focus on that child
window when focus in event happens on our window. The X server will not
send key events to the plugin window as it is not a child of the invisible
input window. This seems to solve the problem!

Cheers,

Nick

On Wed, Apr 29, 2020 at 5:02 PM Uli Schlachter <[email protected]> wrote:

> Hi Nicholas,
>
> On 28.04.20 21:01, Nicholas Allen wrote:
> > It seems as though the X server is sending it to the plug-in child window
> > that wants key events and is current under the mouse cursor. We would
> like
> > to just always get the key events to our window as the plug-in APIs have
> > ways of dispatching key press and release events to the plugins.
>
> Here is the relevant part of the protocol specification that describes
> how events are delivered:
>
> > The source of the event is the window the pointer is in. The window the
> > event is reported with respect to is called the event window. The event
> > window is found by starting with the source window and looking up the
> > hierarchy for the first window on which any client has selected interest
> > in the event. [...] The actual window used for reporting can be
> modified> by active grabs [...]
>
> https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#events:input
>
> So, basically, the answer is a combination of "no" and "you need an
> active grab".
>
> One approach to get such a grab, but only when the pointer is inside of
> your window, is to use EnterNotify and LeaveNotify event for grabbing
> and ungrabbing. See the GrabPointer request.
> I guess something similar is possible with FocusIn and FocusOut events
> and the GrabKeyboard request. However, this means that all WM key
> combinations would then stop working.
>
> Cheers,
> Uli
> --
> ā€œI’m Olaf and I like warm hugs.ā€
>

_______________________________________________
Xcb mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xcb