summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2017-06-21 13:30:22 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2018-01-11 11:03:04 +0100
commit5f05112b9a66d6e12877d15db589acf4624ce4a6 (patch)
treedbb87b77e9967d485d7ea94d6784ad2381bb5bc4
parent6cf7d2d47fb0263cd056f91bfc96020af95b1b4b (diff)
downloadmutter-5f05112b9a66d6e12877d15db589acf4624ce4a6.tar.gz
wayland: update location prior to maximize
When maximizing a window, the previous location is saved so that un-maximize would restore the same original window location. However, if a Wayland client starts with a window maximized, the previous location will be 0x0, so if we have to force placement in xdg_toplevel_set_maximized(), we should update the location as well so that the window is placed on the right monitor when un-maximizing. For that purpose, add a new flag to force the update of the window location, and use that flag from xdg_toplevel_set_maximized(). https://bugzilla.gnome.org/show_bug.cgi?id=783901
-rw-r--r--src/core/window-private.h4
-rw-r--r--src/core/window.c19
-rw-r--r--src/wayland/meta-wayland-xdg-shell.c5
-rw-r--r--src/wayland/meta-window-wayland.c8
4 files changed, 27 insertions, 9 deletions
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 05c309eb0..9545dfc3c 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -80,6 +80,7 @@ typedef enum
META_MOVE_RESIZE_WAYLAND_RESIZE = 1 << 4,
META_MOVE_RESIZE_STATE_CHANGED = 1 << 5,
META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6,
+ META_MOVE_RESIZE_FORCE_MOVE = 1 << 7,
} MetaMoveResizeFlags;
typedef enum
@@ -792,7 +793,8 @@ void meta_window_emit_size_changed (MetaWindow *window);
MetaPlacementRule *meta_window_get_placement_rule (MetaWindow *window);
-void meta_window_force_placement (MetaWindow *window);
+void meta_window_force_placement (MetaWindow *window,
+ gboolean force_move);
void meta_window_force_restore_shortcuts (MetaWindow *window,
ClutterInputDevice *source);
diff --git a/src/core/window.c b/src/core/window.c
index 673887fa7..62dc5a7bb 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1713,7 +1713,7 @@ implement_showing (MetaWindow *window,
* see #751887
*/
if (!window->placed && client_window_should_be_mapped (window))
- meta_window_force_placement (window);
+ meta_window_force_placement (window, FALSE);
meta_window_hide (window);
}
@@ -2294,8 +2294,11 @@ window_would_be_covered (const MetaWindow *newbie)
}
void
-meta_window_force_placement (MetaWindow *window)
+meta_window_force_placement (MetaWindow *window,
+ gboolean force_move)
{
+ MetaMoveResizeFlags flags;
+
if (window->placed)
return;
@@ -2308,7 +2311,15 @@ meta_window_force_placement (MetaWindow *window)
* show the window.
*/
window->calc_placement = TRUE;
- meta_window_move_resize_now (window);
+
+ flags = META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION;
+ if (force_move)
+ flags |= META_MOVE_RESIZE_FORCE_MOVE;
+
+ meta_window_move_resize_internal (window,
+ flags,
+ NorthWestGravity,
+ window->unconstrained_rect);
window->calc_placement = FALSE;
/* don't ever do the initial position constraint thing again.
@@ -2387,7 +2398,7 @@ meta_window_show (MetaWindow *window)
window->maximize_vertically_after_placement = TRUE;
}
}
- meta_window_force_placement (window);
+ meta_window_force_placement (window, FALSE);
}
if (needs_stacking_adjustment)
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index 6d9a0d5cc..43b49231a 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -347,9 +347,10 @@ xdg_toplevel_set_maximized (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
+ MetaWindow *window = surface->window;
- meta_window_force_placement (surface->window);
- meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
+ meta_window_force_placement (window, TRUE);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
}
static void
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index 5e451ca58..4d9aadbbb 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -232,7 +232,11 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
* it can be for maximized or fullscreen.
*/
- if (flags & META_MOVE_RESIZE_WAYLAND_RESIZE)
+ if (flags & META_MOVE_RESIZE_FORCE_MOVE)
+ {
+ can_move_now = TRUE;
+ }
+ else if (flags & META_MOVE_RESIZE_WAYLAND_RESIZE)
{
/* This is a call to wl_surface_commit(), ignore the constrained_rect and
* update the real client size to match the buffer size.
@@ -762,7 +766,7 @@ meta_window_place_with_placement_rule (MetaWindow *window,
window->unconstrained_rect.width = placement_rule->width;
window->unconstrained_rect.height = placement_rule->height;
- meta_window_force_placement (window);
+ meta_window_force_placement (window, FALSE);
}
void