<div dir="ltr">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!<div><br></div><div>Cheers,</div><div><br></div><div>Nick</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 29, 2020 at 5:02 PM Uli Schlachter <<a href="mailto:psychon@znc.in">psychon@znc.in</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Nicholas,<br>
<br>
On 28.04.20 21:01, Nicholas Allen wrote:<br>
> It seems as though the X server is sending it to the plug-in child window<br>
> that wants key events and is current under the mouse cursor. We would like<br>
> to just always get the key events to our window as the plug-in APIs have<br>
> ways of dispatching key press and release events to the plugins.<br>
<br>
Here is the relevant part of the protocol specification that describes<br>
how events are delivered:<br>
<br>
> The source of the event is the window the pointer is in. The window the<br>
> event is reported with respect to is called the event window. The event<br>
> window is found by starting with the source window and looking up the<br>
> hierarchy for the first window on which any client has selected interest<br>
> in the event. [...] The actual window used for reporting can be modified> by active grabs [...]<br>
<br>
<a href="https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#events:input" rel="noreferrer" target="_blank">https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#events:input</a><br>
<br>
So, basically, the answer is a combination of "no" and "you need an<br>
active grab".<br>
<br>
One approach to get such a grab, but only when the pointer is inside of<br>
your window, is to use EnterNotify and LeaveNotify event for grabbing<br>
and ungrabbing. See the GrabPointer request.<br>
I guess something similar is possible with FocusIn and FocusOut events<br>
and the GrabKeyboard request. However, this means that all WM key<br>
combinations would then stop working.<br>
<br>
Cheers,<br>
Uli<br>
-- <br>
“I’m Olaf and I like warm hugs.”<br>
</blockquote></div>