[Xcb] Finding which screen has focus in multi-head mode

Uli Schlachter psychon at znc.in
Fri Nov 13 05:15:51 PST 2015


Hi,

Am 05.11.2015 um 09:32 schrieb Baron:
[...]
> I am frequently getting "PointerRoot" as the returned value and there is 
> disagreement between the KWin maintainer and me as to exactly what that means 
> when you have two separate screens.
> 
> He says that "the value is simply unspecific" and tells you nothing about 
> which screen has the focus.
> 
> I, on the other hand, read the man page for "XGetInputFocus" which says "if 
> focus is PointerRoot, the focus window is dynamically taken to be the root 
> window of whatever screen the pointer is on at each keyboard event".
> If that is the case then I can call "xcb_query_pointer" and ask it which 
> screen it is on.
> 
> Now I don't mind which, if either, of us is right but I really would like to 
> know what a focus of "PointerRoot" should or does mean in this context.
> Alternatively, if anyone has a different way to find which screen has focus 
> then I'd love to hear about it.
[...]

Let's take a look at the X11 protocol manual:

  This request returns the current focus state.

http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GetInputFocus

Well, that didn't really help... However, the docs for SetInputFocus help:

  If PointerRoot is specified as the focus, the focus window is dynamically
  taken to be the root window of whatever screen the pointer is on at each
  keyboard event. In this case, the revert-to argument is ignored.

http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:SetInputFocus

But you already know this. So yes, this really does mean "focus follows the
pointer". What more do you need?

Cheers,
Uli

P.S.: This question is more about the X11 protocol than XCB...
-- 
- Buck, when, exactly, did you lose your mind?
- Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her.


More information about the Xcb mailing list