summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2020-01-09 11:00:36 +0100
committerHans de Goede <hdegoede@redhat.com>2020-02-23 18:05:05 +0100
commit10df0437a2b142e61c4d84ffffa9592ac6846ef1 (patch)
tree9fa46c0fac9ee4eacee27bcfc36c23cd5ffee823 /hw
parent4fc107460a349a1a46f0e5251e6fd2a31f4c0428 (diff)
xwayland: Also hook screen's MoveWindow method
Not only hook the ResizeWindow method of the screen (which really is MoveAndResize) but also hook the MoveWindow method for checking if we need to setup a viewport for resolution change emulation. Our resolution change emulation check if the windows origin matches the monitors origin and the windows origin can also be changed by just a move without being resized. Also checking on a move becomes esp. important when we move to checking on changes to the top-level non-window-manager client (X11)Window instead of on changes to the xwl_window later on in this patch series. Acked-by: Olivier Fourdan <ofourdan@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xwayland/xwayland-screen.c3
-rw-r--r--hw/xwayland/xwayland-screen.h1
-rw-r--r--hw/xwayland/xwayland-window.c22
-rw-r--r--hw/xwayland/xwayland-window.h5
4 files changed, 31 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 91de40c2d..551efb9f0 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -644,6 +644,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->ResizeWindow = pScreen->ResizeWindow;
pScreen->ResizeWindow = xwl_resize_window;
+ xwl_screen->MoveWindow = pScreen->MoveWindow;
+ pScreen->MoveWindow = xwl_move_window;
+
if (xwl_screen->rootless) {
xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
pScreen->SetWindowPixmap = xwl_window_set_window_pixmap;
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index fb87ddb30..abfbc9f1b 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -65,6 +65,7 @@ struct xwl_screen {
SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
struct xorg_list output_list;
struct xorg_list seat_list;
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 4dc6f2486..085d26cbe 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -693,6 +693,28 @@ xwl_resize_window(WindowPtr window,
xwl_window_check_resolution_change_emulation(xwl_window);
}
+void
+xwl_move_window(WindowPtr window,
+ int x, int y,
+ WindowPtr next_sib,
+ VTKind kind)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+
+ xwl_screen = xwl_screen_get(screen);
+ xwl_window = xwl_window_from_window(window);
+
+ screen->MoveWindow = xwl_screen->MoveWindow;
+ (*screen->MoveWindow) (window, x, y, next_sib, kind);
+ xwl_screen->MoveWindow = screen->MoveWindow;
+ screen->MoveWindow = xwl_move_window;
+
+ if (xwl_window && (xwl_window_get(window) || xwl_window_is_toplevel(window)))
+ xwl_window_check_resolution_change_emulation(xwl_window);
+}
+
static void
frame_callback(void *data,
struct wl_callback *callback,
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
index 550edb28c..86292e930 100644
--- a/hw/xwayland/xwayland-window.h
+++ b/hw/xwayland/xwayland-window.h
@@ -33,6 +33,7 @@
#include <X11/X.h>
#include <dix.h>
#include <propertyst.h>
+#include <validate.h>
#include "xwayland-types.h"
@@ -73,6 +74,10 @@ void xwl_resize_window(WindowPtr window,
int x, int y,
unsigned int width, unsigned int height,
WindowPtr sib);
+void xwl_move_window(WindowPtr window,
+ int x, int y,
+ WindowPtr next_sib,
+ VTKind kind);
Bool xwl_destroy_window(WindowPtr window);
void xwl_window_post_damage(struct xwl_window *xwl_window);
void xwl_window_create_frame_callback(struct xwl_window *xwl_window);