Translate saved max-layout geometry between monitors
ca81fdcc90a56f9a44141b44c77b9087d4ff4521
1 parent
d83cb3fa
swm.c
+4 -0
| 5421 | 5421 | if (!c || !oldmon || !newmon || oldmon == newmon) |
|
| 5422 | 5422 | return; |
|
| 5423 | 5423 | geom = c->is_fullscreen ? &c->prev : &c->geom; |
|
| 5424 | 5424 | geom->x += newmon->m.x - oldmon->m.x; |
|
| 5425 | 5425 | geom->y += newmon->m.y - oldmon->m.y; |
|
| 5426 | + | if (c->is_max_stacked) { |
|
| 5427 | + | c->maxstack_prev.x += newmon->m.x - oldmon->m.x; |
|
| 5428 | + | c->maxstack_prev.y += newmon->m.y - oldmon->m.y; |
|
| 5429 | + | } |
|
| 5426 | 5430 | } |
|
| 5427 | 5431 | ||
| 5428 | 5432 | /* Fit a window to the display it was just moved to. */ |
|
| 5429 | 5433 | void client_place(client_t *c) { |
|
| 5430 | 5434 | /* An initial commit may assign a monitor before map_notify() creates the |
test/unit.c
+14 -0
| 413 | 413 | assert(client.geom.x == 2020 && client.geom.y == 150); |
|
| 414 | 414 | ||
| 415 | 415 | client.is_fullscreen = true; |
|
| 416 | 416 | client_translate_monitor(&client, &newmon, &oldmon); |
|
| 417 | 417 | assert(client.prev.x == -1720 && client.prev.y == -25); |
|
| 418 | + | ||
| 419 | + | client.is_fullscreen = false; |
|
| 420 | + | client.is_max_stacked = true; |
|
| 421 | + | client.geom = oldmon.m; |
|
| 422 | + | client.maxstack_prev = (struct wlr_box){ 100, 50, 640, 480 }; |
|
| 423 | + | client_translate_monitor(&client, &oldmon, &newmon); |
|
| 424 | + | assert(client.geom.x == 1920 && client.geom.y == 100); |
|
| 425 | + | assert_box(*(struct swm_box *)&client.maxstack_prev, 2020, 150, 640, 480); |
|
| 426 | + | ||
| 427 | + | client.is_fullscreen = true; |
|
| 428 | + | client.prev = client.geom; |
|
| 429 | + | client_translate_monitor(&client, &newmon, &oldmon); |
|
| 430 | + | assert(client.prev.x == 0 && client.prev.y == 0); |
|
| 431 | + | assert_box(*(struct swm_box *)&client.maxstack_prev, 100, 50, 640, 480); |
|
| 418 | 432 | } |
|
| 419 | 433 | ||
| 420 | 434 | /* Verify matching rules update client state and workspace assignment. */ |
|
| 421 | 435 | static void test_rule_application(void) { |
|
| 422 | 436 | client_t client; |