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.
*/
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);
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)
{
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);
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);
}
/*