Commit Graph

13 Commits (c42de09b1b0b0bcf96342d662f4bef3011b8ce5d)

Author SHA1 Message Date
Tony Crisci c42de09b1b Support _NET_WM_STATE_FOCUSED
_NET_WM_STATE_FOCUSED is set on _NET_WM_STATE to indicate that the
window is focused. It must be set when the window is newly focused and
removed once the window no longer has focus.

> _NET_WM_STATE_FOCUSED indicates whether the window's decorations are
> drawn in an active state. Clients MUST regard it as a read-only hint.
> It cannot be set at map time or changed via a _NET_WM_STATE client
> message.

For example, this is used by GTK applications to show the decoration in
an active or inactive state. This change can be tested by opening a GTK
application (like evince), focusing the window and unfocusing the
window, and observing a change in the window decorations.

Fixes #2273
2018-03-23 14:30:57 +02:00
Michael Stapelberg 7ad32fd2d1 tests: replace http:// with https:// where appropriate
This was done automatically using:

% sed -i 's,http://build.i3wm.org,https://build.i3wm.org,g' testcases/t/*.t
2017-09-24 10:19:50 +02:00
Michael Stapelberg 8f9138fbad t/158-wm_take_focus.t: avoid shift on scalars
This feature is forbidden in Perl ≥ 5.24:

  Experimental shift on scalar is now forbidden at
  ./t/158-wm_take_focus.t line 94, near ");"
2016-09-26 20:42:51 +02:00
Tony Crisci 6cbe349774 Ignore InputHint when not in WM_HINTS
When InputHint is not in WM_HINTS (i.e., the flag is not set), treat the window
as if the InputHint was set (the default behavior). This means that i3 will
focus the window when it becomes managed.

fixes #1676
2015-04-25 22:43:46 -04:00
Tony Crisci 8a618e4b00 bugfix: don't set input focus if not accepted
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

> Clients using the Globally Active model can only use a SetInputFocus request
> to acquire the input focus when they do not already have it on receipt of one
> of the following events:
> * ButtonPress
> * ButtonRelease
> * Passive-grabbed KeyPress
> * Passive-grabbed KeyRelease

Since managing a window happens on a MapNotify (which is absent from this
list), the window cannot accept input focus, so we should not try to focus
the window at all.

Fixes an issue with xfce4-notifyd which (correctly) declines focus when
we send WM_TAKE_FOCUS, which puts i3 in a state where i3 focus and X
focus are different when a notification appears.
2014-06-19 11:55:28 +02:00
Tony Crisci 05f0585817 Dont set input focus and send WM_TAKE_FOCUS
If input focus is set by the window manager, it is not necessary to send
WM_TAKE_FOCUS because it has already taken focus.

http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

> The goal is to support window managers that want to assign the input
> focus to a top-level window in such a way that the top-level window
> either can assign it to one of its subwindows or can decline the offer
> of the focus. For example, a clock or a text editor with no currently
> open frames might not want to take focus even though the window
> manager generally believes that clients should take the input focus
> after being deiconified or raised.

Both setting input focus and sending WM_TAKE_FOCUS is effectively
setting focus on the window twice which is certainly against the spirit
of the spec, if not the letter.

fixes #1167
2014-04-15 17:46:08 +02:00
Michael Stapelberg e84fa22bb8 Fix t/158-wm_take_focus, it was not properly verifying events (Thanks TonyC)
See also http://cr.i3wm.org/patch/500 for TonyC’s patch. This version
reduces code duplication.
2014-04-09 21:47:32 +02:00
Michael Stapelberg 338199913b add boilerplate to all testcases with documentation references 2012-09-10 14:09:01 +02:00
Michael Stapelberg d085e88d02 t/158-wm_take_focus: use sync_with_i3 instead of a timeout 2012-02-21 14:37:55 +01:00
Maik Fischer fce7570f96 testcases: drop open_window()s $x parameter, use global one instead 2011-11-21 23:51:04 +00:00
Maik Fischer db6de84d0b testcases: use global $x in wait_for_event, drop $x parameter 2011-11-21 23:50:48 +00:00
Maik Fischer 30ea33decb testcases: let i3test.pm export $x, adapt testcases 2011-11-21 23:50:43 +00:00
Michael Stapelberg ae1ab9eb27 tests: rename files (00x-*.t is basic stuff, >=100-*.t are tests using IPC) 2011-10-08 14:38:50 +01:00