mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
root: Try to preserve relative positions of floating containers
This makes the behavior of floating containers more consistent with i3. The coordinates of the container are scaled when the size of the workspace it is on changes or when the container is moved between workspaces on different outputs. For scratchpad containers, add a new state that preserves the dimensions of the last output the window appeared on. This is necessary because after a container is hidden in the scratchpad, we expect it to be in the same relative position on the output when it reappears. We can't just use the container's attached workspace because that workspace's dimensions might have been changed or the workspace as a whole could have been destroyed.
This commit is contained in:
parent
ebeed7e303
commit
90c2d631e2
5 changed files with 68 additions and 15 deletions
|
|
@ -113,6 +113,11 @@ struct sway_container {
|
|||
// Hidden scratchpad containers have a NULL parent.
|
||||
bool scratchpad;
|
||||
|
||||
// Stores last output size and position for adjusting coordinates of
|
||||
// scratchpad windows.
|
||||
// Unused for non-scratchpad windows.
|
||||
struct wlr_box transform;
|
||||
|
||||
float alpha;
|
||||
|
||||
struct wlr_texture *title_focused;
|
||||
|
|
@ -196,6 +201,9 @@ size_t container_titlebar_height(void);
|
|||
void floating_calculate_constraints(int *min_width, int *max_width,
|
||||
int *min_height, int *max_height);
|
||||
|
||||
void floating_fix_coordinates(struct sway_container *con,
|
||||
struct wlr_box *old, struct wlr_box *new);
|
||||
|
||||
void container_floating_resize_and_center(struct sway_container *con);
|
||||
|
||||
void container_floating_set_default_size(struct sway_container *con);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue