|
24 | 24 |
|
25 | 25 | static uint32_t global_serial_counter = 0; |
26 | 26 |
|
| 27 | +static gboolean |
| 28 | +is_window_size_fixed (MetaWindow *window) |
| 29 | +{ |
| 30 | + if (meta_window_is_fullscreen (window)) |
| 31 | + return TRUE; |
| 32 | + |
| 33 | + if (meta_window_get_maximized (window) | |
| 34 | + (META_MAXIMIZE_VERTICAL | META_MAXIMIZE_VERTICAL)) |
| 35 | + return TRUE; |
| 36 | + |
| 37 | + if (meta_window_get_tile_mode (window) != META_TILE_NONE) |
| 38 | + return TRUE; |
| 39 | + |
| 40 | + return FALSE; |
| 41 | +} |
| 42 | + |
27 | 43 | MetaWaylandWindowConfiguration * |
28 | | -meta_wayland_window_configuration_new (int x, |
29 | | - int y, |
30 | | - int width, |
31 | | - int height, |
32 | | - int scale, |
33 | | - MetaMoveResizeFlags flags, |
34 | | - MetaGravity gravity) |
| 44 | +meta_wayland_window_configuration_new (MetaWindow *window, |
| 45 | + MetaRectangle rect, |
| 46 | + int bounds_width, |
| 47 | + int bounds_height, |
| 48 | + int scale, |
| 49 | + MetaMoveResizeFlags flags, |
| 50 | + MetaGravity gravity) |
35 | 51 | { |
36 | 52 | MetaWaylandWindowConfiguration *configuration; |
37 | 53 |
|
38 | 54 | configuration = g_new0 (MetaWaylandWindowConfiguration, 1); |
39 | 55 | *configuration = (MetaWaylandWindowConfiguration) { |
40 | 56 | .serial = ++global_serial_counter, |
41 | 57 |
|
42 | | - .has_position = TRUE, |
43 | | - .x = x, |
44 | | - .y = y, |
45 | | - |
46 | | - .has_size = TRUE, |
47 | | - .width = width, |
48 | | - .height = height, |
| 58 | + .bounds_height = bounds_height, |
| 59 | + .bounds_width = bounds_width, |
49 | 60 |
|
50 | 61 | .scale = scale, |
51 | 62 | .gravity = gravity, |
52 | 63 | .flags = flags, |
53 | 64 | }; |
54 | 65 |
|
| 66 | + if (flags & META_MOVE_RESIZE_MOVE_ACTION || |
| 67 | + window->rect.x != rect.x || |
| 68 | + window->rect.y != rect.y) |
| 69 | + { |
| 70 | + configuration->has_position = TRUE; |
| 71 | + configuration->x = rect.x; |
| 72 | + configuration->y = rect.y; |
| 73 | + } |
| 74 | + |
| 75 | + if (flags & META_MOVE_RESIZE_RESIZE_ACTION || |
| 76 | + is_window_size_fixed (window) || |
| 77 | + window->rect.width != rect.width || |
| 78 | + window->rect.height != rect.height) |
| 79 | + { |
| 80 | + configuration->has_size = TRUE; |
| 81 | + configuration->width = rect.width; |
| 82 | + configuration->height = rect.height; |
| 83 | + } |
| 84 | + |
55 | 85 | return configuration; |
56 | 86 | } |
57 | 87 |
|
@@ -83,14 +113,17 @@ meta_wayland_window_configuration_new_relative (int rel_x, |
83 | 113 | } |
84 | 114 |
|
85 | 115 | MetaWaylandWindowConfiguration * |
86 | | -meta_wayland_window_configuration_new_empty (void) |
| 116 | +meta_wayland_window_configuration_new_empty (int bounds_width, |
| 117 | + int bounds_height) |
87 | 118 | { |
88 | 119 | MetaWaylandWindowConfiguration *configuration; |
89 | 120 |
|
90 | 121 | configuration = g_new0 (MetaWaylandWindowConfiguration, 1); |
91 | 122 | *configuration = (MetaWaylandWindowConfiguration) { |
92 | 123 | .serial = ++global_serial_counter, |
93 | 124 | .scale = 1, |
| 125 | + .bounds_width = bounds_width, |
| 126 | + .bounds_height = bounds_height, |
94 | 127 | }; |
95 | 128 |
|
96 | 129 | return configuration; |
|
0 commit comments