[mutter] wayland: Keep track of configured position



commit 817911d9d325045ed60be9ff97596b80020da2cf
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Jul 1 15:14:12 2016 +0800

    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

 src/wayland/meta-wayland-surface.c   |    9 +++++++++
 src/wayland/meta-wayland-surface.h   |    4 ++++
 src/wayland/meta-wayland-wl-shell.c  |    2 ++
 src/wayland/meta-wayland-xdg-shell.c |    4 ++++
 src/wayland/meta-window-wayland.c    |   13 +++++++++++++
 5 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index eaa63d3..e671491 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -154,6 +154,8 @@ meta_wayland_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role);
 
 static void
 meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                                                   int                                 new_x,
+                                                   int                                 new_y,
                                                    int                                 new_width,
                                                    int                                 new_height,
                                                    MetaWaylandSerial                  *sent_serial);
@@ -1577,6 +1579,8 @@ meta_wayland_shell_init (MetaWaylandCompositor *compositor)
 
 void
 meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
+                                       int                 new_x,
+                                       int                 new_y,
                                        int                 new_width,
                                        int                 new_height,
                                        MetaWaylandSerial  *sent_serial)
@@ -1587,6 +1591,7 @@ meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
   g_signal_emit (surface, surface_signals[SURFACE_CONFIGURE], 0);
 
   meta_wayland_surface_role_shell_surface_configure (shell_surface_role,
+                                                     new_x, new_y,
                                                      new_width, new_height,
                                                      sent_serial);
 }
@@ -1923,6 +1928,8 @@ meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role)
 
 static void
 meta_wayland_surface_role_shell_surface_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                                                   int                                 new_x,
+                                                   int                                 new_y,
                                                    int                                 new_width,
                                                    int                                 new_height,
                                                    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);
 
   shell_surface_role_class->configure (shell_surface_role,
+                                       new_x,
+                                       new_y,
                                        new_width,
                                        new_height,
                                        sent_serial);
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 98fe1fd..f20e226 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -92,6 +92,8 @@ struct _MetaWaylandSurfaceRoleShellSurfaceClass
   MetaWaylandSurfaceRoleActorSurfaceClass parent_class;
 
   void (*configure) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                     int                                 new_x,
+                     int                                 new_y,
                      int                                 new_width,
                      int                                 new_height,
                      MetaWaylandSerial                  *sent_serial);
@@ -253,6 +255,8 @@ void                meta_wayland_surface_set_window (MetaWaylandSurface *surface
                                                      MetaWindow         *window);
 
 void                meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
+                                                           int                 new_x,
+                                                           int                 new_y,
                                                            int                 width,
                                                            int                 height,
                                                            MetaWaylandSerial  *sent_serial);
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
index 927c593..0b00309 100644
--- a/src/wayland/meta-wayland-wl-shell.c
+++ b/src/wayland/meta-wayland-wl-shell.c
@@ -617,6 +617,8 @@ wl_shell_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
 
 static void
 wl_shell_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                                 int                                 new_x,
+                                 int                                 new_y,
                                  int                                 new_width,
                                  int                                 new_height,
                                  MetaWaylandSerial                  *sent_serial)
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index 643147f..a3e0896 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -477,6 +477,8 @@ xdg_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
 
 static void
 xdg_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                            int                                 new_x,
+                            int                                 new_y,
                             int                                 new_width,
                             int                                 new_height,
                             MetaWaylandSerial                  *sent_serial)
@@ -621,6 +623,8 @@ xdg_popup_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
 
 static void
 xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
+                          int                                 new_x,
+                          int                                 new_y,
                           int                                 new_width,
                           int                                 new_height,
                           MetaWaylandSerial                  *sent_serial)
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index 43ffe69..f24fa25 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -46,6 +46,8 @@ struct _MetaWindowWayland
   int pending_move_x;
   int pending_move_y;
 
+  int last_sent_x;
+  int last_sent_y;
   int last_sent_width;
   int last_sent_height;
 };
@@ -149,6 +151,8 @@ surface_state_changed (MetaWindow *window)
     return;
 
   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_height,
                                          &wl_window->pending_configure_serial);
@@ -184,6 +188,8 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
 {
   MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
   gboolean can_move_now;
+  int configured_x;
+  int configured_y;
   int configured_width;
   int configured_height;
   int monitor_scale;
@@ -194,6 +200,9 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
   if (window->unmanaging)
     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
    * 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
@@ -256,6 +265,8 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
             return;
 
           meta_wayland_surface_configure_notify (window->surface,
+                                                 configured_x,
+                                                 configured_y,
                                                  configured_width,
                                                  configured_height,
                                                  &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_height = configured_height;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]