Codebase list i3-gaps / 50b4c3b
Merge remote-tracking branch 'vanilla/next' into gaps-next Ingo Bürk 3 years ago
4 changed file(s) with 79 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
5151 • fix Xorg memory leak with i3bar
5252 • fix named workspace assignments on output changes
5353 • fix named workspace assignment precedence on workspace renames
54 • fix windows getting swallowed more than once
494494 /* Time when the window became managed. Used to determine whether a window
495495 * should be swallowed after initial management. */
496496 time_t managed_since;
497
498 /* The window has been swallowed. */
499 bool swallowed;
497500 };
498501
499502 /**
269269 DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
270270
271271 /* See if any container swallows this new window */
272 cwindow->swallowed = false;
272273 Match *match = NULL;
273274 Con *nc = con_for_window(search_at, cwindow, &match);
274275 const bool match_from_restart_mode = (match && match->restart_mode);
357358 match_free(match);
358359 FREE(match);
359360 }
361
362 cwindow->swallowed = true;
360363 }
361364
362365 DLOG("new container = %p\n", nc);
694697 *
695698 */
696699 Con *remanage_window(Con *con) {
700 /* Make sure this windows hasn't already been swallowed. */
701 if (con->window->swallowed) {
702 run_assignments(con->window);
703 return con;
704 }
697705 Match *match;
698706 Con *nc = con_for_window(croot, con->window, &match);
699707 if (nc == NULL || nc->window == NULL || nc->window == con->window) {
739747 ewmh_update_wm_desktop();
740748 }
741749
750 nc->window->swallowed = true;
742751 return nc;
743752 }
8282
8383 close($fh);
8484
85 ############################################################
86 # Make sure window only gets swallowed once
87 ############################################################
88 # Regression, issue #3888
89 $ws = fresh_workspace;
90
91 ($fh, $filename) = tempfile(UNLINK => 1);
92 print $fh <<'EOT';
93 // vim:ts=4:sw=4:et
94 {
95 // splith split container with 2 children
96 "layout": "splith",
97 "type": "con",
98 "nodes": [
99 {
100 "type": "con",
101 "swallows": [
102 {
103 "class": "^foo$"
104 }
105 ]
106 },
107 {
108 // splitv split container with 2 children
109 "layout": "splitv",
110 "type": "con",
111 "nodes": [
112 {
113 "type": "con",
114 "swallows": [
115 {
116 "class": "^foo$"
117 }
118 ]
119 },
120 {
121 "type": "con",
122 "swallows": [
123 {
124 "class": "^foo$"
125 }
126 ]
127 }
128 ]
129 }
130 ]
131 }
132 EOT
133 $fh->flush;
134 cmd "append_layout $filename";
135
136 $window = open_window wm_class => 'foo';
137
138 # Changing an unrelated window property originally resulted in the window
139 # getting remanaged and swallowd by a different placeholder, even though the
140 # matching property (class for the layout above) didn't change.
141 change_window_title($window, "different_title");
142
143 @content = @{get_ws_content($ws)};
144
145 subtest 'regression test that window gets only swallowed once', sub {
146 is($content[0]->{nodes}[0]->{window}, $window->id, 'first placeholder swallowed window');
147 isnt($content[0]->{nodes}[1]->{nodes}[0]->{window}, $window->id, 'second placeholder did not swallow window');
148 isnt($content[0]->{nodes}[1]->{nodes}[1]->{window}, $window->id, 'thid placeholder did not swallow window');
149 };
150
85151 done_testing;