mirror of
https://github.com/labwc/labwc.git
synced 2025-11-30 06:59:52 -05:00
view: less hacky support for minimize-before-map
The previous "minimal fix" (5148c2aa31) worked but was a bit of a
hack, as it basically un-minimized and then immediately minimized the
view again at map. It's not actually too difficult to make the map
handlers aware of minimized views, eliminating the need for the hack.
Note: this depends on the previous commit ("xwayland: connect commit
and surface_destroy handlers together") otherwise the xwayland map
handler registers the commit handler twice, leading to a crash.
This commit is contained in:
parent
b6f7bacdde
commit
79fbb611e0
5 changed files with 26 additions and 20 deletions
16
src/xdg.c
16
src/xdg.c
|
|
@ -781,8 +781,6 @@ xdg_toplevel_view_map(struct view *view)
|
|||
return;
|
||||
}
|
||||
|
||||
view->mapped = true;
|
||||
|
||||
/*
|
||||
* An output should have been chosen when the surface was first
|
||||
* created, but take one more opportunity to assign an output if not.
|
||||
|
|
@ -790,8 +788,16 @@ xdg_toplevel_view_map(struct view *view)
|
|||
if (!view->output) {
|
||||
view_set_output(view, output_nearest_to_cursor(view->server));
|
||||
}
|
||||
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
|
||||
wlr_scene_node_set_enabled(&view->scene_tree->node, true);
|
||||
|
||||
/*
|
||||
* For initially minimized views, we do not set view->mapped
|
||||
* nor enable the scene node. All other map logic (positioning,
|
||||
* creating foreign toplevel, etc.) happens as normal.
|
||||
*/
|
||||
if (!view->minimized) {
|
||||
view->mapped = true;
|
||||
wlr_scene_node_set_enabled(&view->scene_tree->node, true);
|
||||
}
|
||||
|
||||
if (!view->foreign_toplevel) {
|
||||
init_foreign_toplevel(view);
|
||||
|
|
@ -813,6 +819,8 @@ xdg_toplevel_view_map(struct view *view)
|
|||
* dimensions remain zero until handle_commit().
|
||||
*/
|
||||
if (wlr_box_empty(&view->pending)) {
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
xdg_surface_from_view(view);
|
||||
view->pending.width = xdg_surface->geometry.width;
|
||||
view->pending.height = xdg_surface->geometry.height;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue