mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
src/ssd: fix tiling via keybind when maximized
The previous PR introduced an issue with tiling based actions like SnapToEdge and SnapToRegion using outdated SSD margin values when called via keybind while maximized. That resulted in wrong offsets for the tiled windows. This commit restores the functionality by forcing a re-calculation of the SSD margin when changing the maximized state. Thanks to @Flrian for reporting the issue via IRC.
This commit is contained in:
parent
f42f5f41c5
commit
72936ccb3e
3 changed files with 21 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ struct wlr_scene_node;
|
|||
*/
|
||||
struct ssd *ssd_create(struct view *view, bool active);
|
||||
struct border ssd_get_margin(const struct ssd *ssd);
|
||||
void ssd_update_margin(struct ssd *ssd);
|
||||
void ssd_set_active(struct ssd *ssd, bool active);
|
||||
void ssd_update_title(struct ssd *ssd);
|
||||
void ssd_update_geometry(struct ssd *ssd);
|
||||
|
|
|
|||
|
|
@ -195,6 +195,15 @@ ssd_get_margin(const struct ssd *ssd)
|
|||
return ssd ? ssd->margin : (struct border){ 0 };
|
||||
}
|
||||
|
||||
void
|
||||
ssd_update_margin(struct ssd *ssd)
|
||||
{
|
||||
if (!ssd) {
|
||||
return;
|
||||
}
|
||||
ssd->margin = ssd_thickness(ssd->view);
|
||||
}
|
||||
|
||||
void
|
||||
ssd_update_geometry(struct ssd *ssd)
|
||||
{
|
||||
|
|
@ -210,6 +219,10 @@ ssd_update_geometry(struct ssd *ssd)
|
|||
ssd_extents_update(ssd);
|
||||
ssd->state.geometry = current;
|
||||
}
|
||||
if (ssd->state.squared_corners != ssd->view->maximized) {
|
||||
ssd_border_update(ssd);
|
||||
ssd_titlebar_update(ssd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
ssd_extents_update(ssd);
|
||||
|
|
|
|||
|
|
@ -648,6 +648,13 @@ set_maximized(struct view *view, bool maximized)
|
|||
view->toplevel.handle, maximized);
|
||||
}
|
||||
view->maximized = maximized;
|
||||
|
||||
/*
|
||||
* Ensure that follow-up actions like SnapToEdge / SnapToRegion
|
||||
* use up-to-date SSD margin information. Otherwise we will end
|
||||
* up using an outdated ssd->margin to calculate offsets.
|
||||
*/
|
||||
ssd_update_margin(view->ssd);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue