Xlib difference between _NET_ACTIVE_WINDOW and XGetInputFocus

What is the difference between _NET_ACTIVE_WINDOW and XGetInputFocus ()? Do they always point to one window? When used one over the other?

Thank.

+3


source to share


2 answers


No, they don't always point to the same thing.

_NET_ACTIVE_WINDOW - WM thing. It will not point to a non-WM controlled window.



The input focus doesn't know or care about WM (other than being set mainly by WM). It can be installed by any program at any time to any window: internal, overridden-redirection, or even an unlinked managed window (although these are few programs).

Which one you want to use very heavily depends on your specific needs. Regular applications are unlikely to be used either. If you want to dispatch keyboard events use XGetInputFocus. In most other cases, you probably want _NET_ACTIVE_WINDOW.

+2


source


The main difference in setting is greater than when receiving. When setting focus (activating windows), you prefer an atom over the xlib function, because then the window manager can handle your request differently - for example, if you want to activate a window with a modal dialog up at that time, WM can focus that dialog instead of itself windows or if the user has disabled focus steal, the WM can simply highlight the window rather than focus it.

There are a few small differences in getting too based on the same idea, although I don't know exactly what all the differences are, I think it might be application specific. With the programs I have written, getting property and focus return the same window. However, with Firefox, it returns two different windows - the active one is the window we expect, but the focus is on the hidden window. I don't know why this is, but it is.



_NET_ACTIVE_WINDOW insulates you from this application implementation data better than XGetInputFocus. Something like a window manager or keyboard grabber might be interested in specific details, but an application asking if it was active (or asking to become active) had to use an atom.

Read some more here too: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304

+2


source







All Articles