wayland: Keep track of configured position

Besides the configured dimension, also keep track of the configured
position. This will later be used by popup position feedback.

https://bugzilla.gnome.org/show_bug.cgi?id=769936
This commit is contained in:
Jonas Ådahl 2016-07-01 15:14:12 +08:00
parent a8d86b4876
commit 817911d9d3
5 changed files with 32 additions and 0 deletions

View File

@ -154,6 +154,8 @@ meta_wayland_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role);
static void static void
meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial); MetaWaylandSerial *sent_serial);
@ -1577,6 +1579,8 @@ meta_wayland_shell_init (MetaWaylandCompositor *compositor)
void void
meta_wayland_surface_configure_notify (MetaWaylandSurface *surface, meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial) MetaWaylandSerial *sent_serial)
@ -1587,6 +1591,7 @@ meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
g_signal_emit (surface, surface_signals[SURFACE_CONFIGURE], 0); g_signal_emit (surface, surface_signals[SURFACE_CONFIGURE], 0);
meta_wayland_surface_role_shell_surface_configure (shell_surface_role, meta_wayland_surface_role_shell_surface_configure (shell_surface_role,
new_x, new_y,
new_width, new_height, new_width, new_height,
sent_serial); sent_serial);
} }
@ -1923,6 +1928,8 @@ meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role)
static void static void
meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial) MetaWaylandSerial *sent_serial)
@ -1931,6 +1938,8 @@ meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSu
META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_GET_CLASS (shell_surface_role); META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_GET_CLASS (shell_surface_role);
shell_surface_role_class->configure (shell_surface_role, shell_surface_role_class->configure (shell_surface_role,
new_x,
new_y,
new_width, new_width,
new_height, new_height,
sent_serial); sent_serial);

View File

@ -92,6 +92,8 @@ struct _MetaWaylandSurfaceRoleShellSurfaceClass
MetaWaylandSurfaceRoleActorSurfaceClass parent_class; MetaWaylandSurfaceRoleActorSurfaceClass parent_class;
void (*configure) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, void (*configure) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial); MetaWaylandSerial *sent_serial);
@ -253,6 +255,8 @@ void meta_wayland_surface_set_window (MetaWaylandSurface *surface
MetaWindow *window); MetaWindow *window);
void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface, void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
int new_x,
int new_y,
int width, int width,
int height, int height,
MetaWaylandSerial *sent_serial); MetaWaylandSerial *sent_serial);

View File

@ -617,6 +617,8 @@ wl_shell_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
static void static void
wl_shell_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, wl_shell_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial) MetaWaylandSerial *sent_serial)

View File

@ -477,6 +477,8 @@ xdg_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
static void static void
xdg_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, xdg_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial) MetaWaylandSerial *sent_serial)
@ -621,6 +623,8 @@ xdg_popup_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
static void static void
xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_x,
int new_y,
int new_width, int new_width,
int new_height, int new_height,
MetaWaylandSerial *sent_serial) MetaWaylandSerial *sent_serial)

View File

@ -46,6 +46,8 @@ struct _MetaWindowWayland
int pending_move_x; int pending_move_x;
int pending_move_y; int pending_move_y;
int last_sent_x;
int last_sent_y;
int last_sent_width; int last_sent_width;
int last_sent_height; int last_sent_height;
}; };
@ -149,6 +151,8 @@ surface_state_changed (MetaWindow *window)
return; return;
meta_wayland_surface_configure_notify (window->surface, meta_wayland_surface_configure_notify (window->surface,
wl_window->last_sent_x,
wl_window->last_sent_y,
wl_window->last_sent_width, wl_window->last_sent_width,
wl_window->last_sent_height, wl_window->last_sent_height,
&wl_window->pending_configure_serial); &wl_window->pending_configure_serial);
@ -184,6 +188,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
{ {
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
gboolean can_move_now; gboolean can_move_now;
int configured_x;
int configured_y;
int configured_width; int configured_width;
int configured_height; int configured_height;
int monitor_scale; int monitor_scale;
@ -194,6 +200,9 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
if (window->unmanaging) if (window->unmanaging)
return; return;
configured_x = constrained_rect.x;
configured_y = constrained_rect.y;
/* The scale the window is drawn in might change depending on what monitor it /* The scale the window is drawn in might change depending on what monitor it
* is mainly on. Scale the configured rectangle to be in logical pixel * is mainly on. Scale the configured rectangle to be in logical pixel
* coordinate space so that we can have a scale independent size to pass * coordinate space so that we can have a scale independent size to pass
@ -256,6 +265,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
return; return;
meta_wayland_surface_configure_notify (window->surface, meta_wayland_surface_configure_notify (window->surface,
configured_x,
configured_y,
configured_width, configured_width,
configured_height, configured_height,
&wl_window->pending_configure_serial); &wl_window->pending_configure_serial);
@ -271,6 +282,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
} }
} }
wl_window->last_sent_x = configured_x;
wl_window->last_sent_y = configured_y;
wl_window->last_sent_width = configured_width; wl_window->last_sent_width = configured_width;
wl_window->last_sent_height = configured_height; wl_window->last_sent_height = configured_height;