]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #1684 from acrisci/bug/focus-without-input-hint
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 26 Apr 2015 10:15:38 +0000 (12:15 +0200)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 26 Apr 2015 10:15:38 +0000 (12:15 +0200)
Ignore InputHint when not in WM_HINTS

src/window.c
testcases/t/158-wm_take_focus.t

index 3ffffa3bc3f1981a8851ca7ee224bd50734cb43c..29cd11eb599ddd68abce6b1932d839bb95ed9319 100644 (file)
@@ -271,8 +271,10 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
         return;
     }
 
-    win->doesnt_accept_focus = !hints.input;
-    LOG("WM_HINTS.input changed to \"%d\"\n", hints.input);
+    if (hints.flags & XCB_ICCCM_WM_HINT_INPUT) {
+        win->doesnt_accept_focus = !hints.input;
+        LOG("WM_HINTS.input changed to \"%d\"\n", hints.input);
+    }
 
     if (urgency_hint != NULL)
         *urgency_hint = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
index 050e11623f95e250b4bfe6e7fe0e15e4c1261a47..b8dae3b1b1d0b6e84f19bd6b4bc9ea170860e0e1 100644 (file)
@@ -50,12 +50,15 @@ sub recv_take_focus {
 }
 
 subtest 'Window without WM_TAKE_FOCUS', sub {
-    fresh_workspace;
+    my $ws = fresh_workspace;
 
     my $window = open_window;
 
     ok(!recv_take_focus($window), 'did not receive ClientMessage');
 
+    my $con = shift get_ws_content($ws);
+    ok($con->{focused}, 'con is focused');
+
     done_testing;
 };
 
@@ -72,7 +75,7 @@ subtest 'Window without WM_TAKE_FOCUS', sub {
 # list), the window cannot accept input focus, so we should not try to focus
 # the window at all.
 subtest 'Window with WM_TAKE_FOCUS and without InputHint', sub {
-    fresh_workspace;
+    my $ws = fresh_workspace;
 
     my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS');
 
@@ -88,6 +91,9 @@ subtest 'Window with WM_TAKE_FOCUS and without InputHint', sub {
 
     ok(!recv_take_focus($window), 'did not receive ClientMessage');
 
+    my $con = shift get_ws_content($ws);
+    ok($con->{focused}, 'con is focused');
+
     done_testing;
 };
 
@@ -97,7 +103,7 @@ subtest 'Window with WM_TAKE_FOCUS and without InputHint', sub {
 # nearly identical presently, so this is currently used also as a proxy test
 # for the latter case.
 subtest 'Window with WM_TAKE_FOCUS and unspecified InputHint', sub {
-    fresh_workspace;
+    my $ws = fresh_workspace;
 
     my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS');
 
@@ -105,6 +111,9 @@ subtest 'Window with WM_TAKE_FOCUS and unspecified InputHint', sub {
 
     ok(!recv_take_focus($window), 'did not receive ClientMessage');
 
+    my $con = shift get_ws_content($ws);
+    ok($con->{focused}, 'con is focused');
+
     done_testing;
 };