mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 14:34:07 +01:00
Merge pull request #2694 from RyanDwyer/fix-sticky-jumping-on-switch
Prevent sticky containers from jumping on workspace switch
This commit is contained in:
commit
4bc327a021
@ -186,6 +186,7 @@ void arrange_workspace(struct sway_workspace *workspace) {
|
|||||||
area->width, area->height, area->x, area->y);
|
area->width, area->height, area->x, area->y);
|
||||||
workspace_remove_gaps(workspace);
|
workspace_remove_gaps(workspace);
|
||||||
|
|
||||||
|
bool first_arrange = workspace->width == 0 && workspace->height == 0;
|
||||||
double prev_x = workspace->x;
|
double prev_x = workspace->x;
|
||||||
double prev_y = workspace->y;
|
double prev_y = workspace->y;
|
||||||
workspace->width = area->width;
|
workspace->width = area->width;
|
||||||
@ -196,7 +197,7 @@ void arrange_workspace(struct sway_workspace *workspace) {
|
|||||||
// Adjust any floating containers
|
// Adjust any floating containers
|
||||||
double diff_x = workspace->x - prev_x;
|
double diff_x = workspace->x - prev_x;
|
||||||
double diff_y = workspace->y - prev_y;
|
double diff_y = workspace->y - prev_y;
|
||||||
if (diff_x != 0 || diff_y != 0) {
|
if (!first_arrange && (diff_x != 0 || diff_y != 0)) {
|
||||||
for (int i = 0; i < workspace->floating->length; ++i) {
|
for (int i = 0; i < workspace->floating->length; ++i) {
|
||||||
struct sway_container *floater = workspace->floating->items[i];
|
struct sway_container *floater = workspace->floating->items[i];
|
||||||
container_floating_translate(floater, diff_x, diff_y);
|
container_floating_translate(floater, diff_x, diff_y);
|
||||||
|
@ -54,10 +54,6 @@ struct sway_workspace *workspace_create(struct sway_output *output,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
node_init(&ws->node, N_WORKSPACE, ws);
|
node_init(&ws->node, N_WORKSPACE, ws);
|
||||||
ws->x = output->lx;
|
|
||||||
ws->y = output->ly;
|
|
||||||
ws->width = output->width;
|
|
||||||
ws->height = output->height;
|
|
||||||
ws->name = name ? strdup(name) : NULL;
|
ws->name = name ? strdup(name) : NULL;
|
||||||
ws->prev_split_layout = L_NONE;
|
ws->prev_split_layout = L_NONE;
|
||||||
ws->layout = output_get_default_layout(output);
|
ws->layout = output_get_default_layout(output);
|
||||||
|
Loading…
Reference in New Issue
Block a user