Update ewmh focused only when new focus is different (#3496)
Fixes #3495.
This commit is contained in:
parent
a0105dd2f2
commit
dc16df439e
4
src/x.c
4
src/x.c
|
@ -105,6 +105,10 @@ static con_state *state_for_frame(xcb_window_t window) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void change_ewmh_focus(xcb_window_t new_focus, xcb_window_t old_focus) {
|
static void change_ewmh_focus(xcb_window_t new_focus, xcb_window_t old_focus) {
|
||||||
|
if (new_focus == old_focus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ewmh_update_active_window(new_focus);
|
ewmh_update_active_window(new_focus);
|
||||||
|
|
||||||
if (new_focus != XCB_WINDOW_NONE) {
|
if (new_focus != XCB_WINDOW_NONE) {
|
||||||
|
|
|
@ -23,15 +23,17 @@ my ($windowA, $windowB);
|
||||||
|
|
||||||
fresh_workspace;
|
fresh_workspace;
|
||||||
$windowA = open_window;
|
$windowA = open_window;
|
||||||
|
|
||||||
ok(is_net_wm_state_focused($windowA), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
|
ok(is_net_wm_state_focused($windowA), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
|
||||||
|
|
||||||
$windowB = open_window;
|
$windowB = open_window;
|
||||||
|
|
||||||
ok(!is_net_wm_state_focused($windowA), 'when a another window is focused, the old window should not have _NET_WM_STATE_FOCUSED set');
|
ok(!is_net_wm_state_focused($windowA), 'when a another window is focused, the old window should not have _NET_WM_STATE_FOCUSED set');
|
||||||
|
ok(is_net_wm_state_focused($windowB), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
|
||||||
|
|
||||||
|
# See issue #3495.
|
||||||
|
cmd 'kill';
|
||||||
|
ok(is_net_wm_state_focused($windowA), 'when the second window is closed, the first window should have _NET_WM_STATE_FOCUSED set');
|
||||||
|
|
||||||
fresh_workspace;
|
fresh_workspace;
|
||||||
|
ok(!is_net_wm_state_focused($windowA), 'when focus moves to the ewmh support window, no window should have _NET_WM_STATE_FOCUSED set');
|
||||||
ok(!is_net_wm_state_focused($windowB), 'when focus moves to the ewmh support window, neither window should have _NET_WM_STATE_FOCUSED set');
|
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue