Merge remote-tracking branch 'vanilla/next' into gaps-next
Ingo Bürk
3 years ago
51 | 51 |
• fix Xorg memory leak with i3bar
|
52 | 52 |
• fix named workspace assignments on output changes
|
53 | 53 |
• fix named workspace assignment precedence on workspace renames
|
|
54 |
• fix windows getting swallowed more than once
|
494 | 494 |
/* Time when the window became managed. Used to determine whether a window
|
495 | 495 |
* should be swallowed after initial management. */
|
496 | 496 |
time_t managed_since;
|
|
497 |
|
|
498 |
/* The window has been swallowed. */
|
|
499 |
bool swallowed;
|
497 | 500 |
};
|
498 | 501 |
|
499 | 502 |
/**
|
269 | 269 |
DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
|
270 | 270 |
|
271 | 271 |
/* See if any container swallows this new window */
|
|
272 |
cwindow->swallowed = false;
|
272 | 273 |
Match *match = NULL;
|
273 | 274 |
Con *nc = con_for_window(search_at, cwindow, &match);
|
274 | 275 |
const bool match_from_restart_mode = (match && match->restart_mode);
|
|
357 | 358 |
match_free(match);
|
358 | 359 |
FREE(match);
|
359 | 360 |
}
|
|
361 |
|
|
362 |
cwindow->swallowed = true;
|
360 | 363 |
}
|
361 | 364 |
|
362 | 365 |
DLOG("new container = %p\n", nc);
|
|
694 | 697 |
*
|
695 | 698 |
*/
|
696 | 699 |
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 |
}
|
697 | 705 |
Match *match;
|
698 | 706 |
Con *nc = con_for_window(croot, con->window, &match);
|
699 | 707 |
if (nc == NULL || nc->window == NULL || nc->window == con->window) {
|
|
739 | 747 |
ewmh_update_wm_desktop();
|
740 | 748 |
}
|
741 | 749 |
|
|
750 |
nc->window->swallowed = true;
|
742 | 751 |
return nc;
|
743 | 752 |
}
|
82 | 82 |
|
83 | 83 |
close($fh);
|
84 | 84 |
|
|
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 |
|
85 | 151 |
done_testing;
|