]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #3563 from CyberShadow/doc-mark-todo
authorIngo Bürk <admin@airblader.de>
Sun, 16 Dec 2018 08:36:02 +0000 (09:36 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Dec 2018 08:36:02 +0000 (09:36 +0100)
userguide: Un-hide a TODO block completed in 2011

docs/userguide
include/tree.h
src/floating.c
src/handlers.c
src/x.c
testcases/t/219-ipc-window-focus.t

index 073ffdf1a8eb97e26d69833bf2ec35d0f3930566..1f94748475ca7591b36935709fb0a8f6aab106ea 100644 (file)
@@ -2416,8 +2416,9 @@ this mark or add it otherwise. Note that you may need to use this in
 combination with +--add+ (see below) as any other marks will otherwise be
 removed.
 
-By default, a window can only have one mark. You can use the +--add+ flag to
-put more than one mark on a window.
+The +--replace+ flag causes i3 to remove any existing marks, which is also the
+default behavior. You can use the +--add+ flag to put more than one mark on a
+window.
 
 Refer to <<show_marks>> if you don't want marks to be shown in the window decoration.
 
index 41a630366bfca43411f7934e696b57be975a81ab..12170f94c23bb643db5321021cce0e47086a650d 100644 (file)
@@ -73,10 +73,6 @@ void tree_next(char way, orientation_t orientation);
  * The dont_kill_parent flag is specified when the function calls itself
  * recursively while deleting a containers children.
  *
- * The force_set_focus flag is specified in the case of killing a floating
- * window: tree_close_internal() will be invoked for the CT_FLOATINGCON (the parent
- * container) and focus should be set there.
- *
  */
 bool tree_close_internal(Con *con, kill_window_t kill_window, bool dont_kill_parent);
 
index f5c61782ae7b6bd2585d750120d010c3694576cb..79f1d3d311f223f9989089cb29c8b0dc9cbdb5bf 100644 (file)
@@ -955,8 +955,7 @@ bool floating_reposition(Con *con, Rect newrect) {
 
     /* Workspace change will already result in a tree_render. */
     if (!reassigned) {
-        render_con(con);
-        x_push_node(con);
+        tree_render();
     }
     return true;
 }
index 5a79ffe174e6c025b35c09cfb85a1238ba23ea33..ae42b82e546142b84440ffbee9bb6ccf46e32d86 100644 (file)
@@ -981,8 +981,7 @@ static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t stat
         Con *floating = con_inside_floating(con);
         if (floating) {
             floating_check_size(con, false);
-            render_con(con);
-            x_push_changes(croot);
+            tree_render();
         }
     }
 
diff --git a/src/x.c b/src/x.c
index 82c19d3022b3e7ad68f64b72224b33dccc15e215..f643a9b33def33b99b6255aecb8b7d79899ba886 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -276,7 +276,12 @@ static void _x_con_kill(Con *con) {
     free(state);
 
     /* Invalidate focused_id to correctly focus new windows with the same ID */
-    focused_id = last_focused = XCB_NONE;
+    if (con->frame.id == focused_id) {
+        focused_id = XCB_NONE;
+    }
+    if (con->frame.id == last_focused) {
+        last_focused = XCB_NONE;
+    }
 }
 
 /*
@@ -1320,6 +1325,7 @@ void x_push_changes(Con *con) {
         change_ewmh_focus(XCB_WINDOW_NONE, last_focused);
 
         focused_id = ewmh_window;
+        last_focused = XCB_NONE;
     }
 
     xcb_flush(conn);
index b1c8ba1836148b377a706da4848143d040a2b951..696fc7b2ffab05735a7b4e6cd7030fe443bb5700 100644 (file)
 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
 #   (unless you are already familiar with Perl)
 
-use i3test;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+# fake-1 under fake-0 to not interfere with left/right wraping
+fake-outputs 1024x768+0+0,1024x768+0+1024
+workspace X output fake-1
+EOT
 
 ################################
 # Window focus event
 ################################
 
-cmd 'split h';
-
+my $ws = fresh_workspace(output => 0);
 my $win0 = open_window;
 my $win1 = open_window;
 my $win2 = open_window;
@@ -44,11 +50,52 @@ sub focus_subtest {
     is($events[0]->{container}->{name}, $name, "$name focused");
 }
 
+sub kill_subtest {
+    my ($cmd, $name) = @_;
+
+    my $focus = AnyEvent->condvar;
+
+    my @events = events_for(
+       sub { cmd $cmd },
+       'window');
+
+    is(scalar @events, 1, 'Received 1 event');
+    is($events[0]->{change}, 'close', 'Close event received');
+    is($events[0]->{container}->{name}, $name, "$name closed");
+}
+
 subtest 'focus left (1)', \&focus_subtest, 'focus left', $win1->name;
 subtest 'focus left (2)', \&focus_subtest, 'focus left', $win0->name;
 subtest 'focus right (1)', \&focus_subtest, 'focus right', $win1->name;
 subtest 'focus right (2)', \&focus_subtest, 'focus right', $win2->name;
 subtest 'focus right (3)', \&focus_subtest, 'focus right', $win0->name;
 subtest 'focus left', \&focus_subtest, 'focus left', $win2->name;
+subtest 'kill doesn\'t produce focus event', \&kill_subtest, '[id=' . $win1->id . '] kill', $win1->name;
+
+# See issue #3562. We need to switch to an existing workspace on the second
+# output to trigger the bug.
+cmd 'workspace X';
+subtest 'workspace focus', \&focus_subtest, "workspace $ws", $win2->name;
+
+sub scratchpad_subtest {
+    my ($cmd, $name) = @_;
+
+    my $focus = AnyEvent->condvar;
+
+    my @events = events_for(
+       sub { cmd $cmd },
+       'window');
+
+    is(scalar @events, 2, 'Received 2 events');
+    is($events[0]->{change}, 'move', 'Move event received');
+    is($events[0]->{container}->{nodes}->[0]->{name}, $name, "$name moved");
+    is($events[1]->{change}, 'focus', 'Focus event received');
+    is($events[1]->{container}->{name}, $name, "$name focused");
+}
+
+fresh_workspace;
+my $win = open_window;
+cmd 'move scratchpad';
+subtest 'scratchpad', \&scratchpad_subtest, '[id=' . $win->id . '] scratchpad show', $win->name;
 
 done_testing;