Re: [vdagent-linux 2/2] randr: handle XRRScreenChangeNotifyEvent

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

 



self-nack, I am sending a better version of this patch


On Wed, Aug 27, 2014 at 7:22 PM, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> wrote:
From: Marc-Andre Lureau <marcandre.lureau@xxxxxxxxxx>

Make sure vdagent follows the current monitor configuration.  This
solves a number of issue where the pointer input is off, because the
uinput tablet isn't reconfigured.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
---
 src/vdagent-x11-priv.h  | 1 +
 src/vdagent-x11-randr.c | 6 +++++-
 src/vdagent-x11.c       | 9 ++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
index 38f852e..197f891 100644
--- a/src/vdagent-x11-priv.h
+++ b/src/vdagent-x11-priv.h
@@ -95,6 +95,7 @@ struct vdagent_x11 {
     int height[MAX_SCREENS];
     int has_xfixes;
     int xfixes_event_base;
+    int xrandr_event_base;
     int max_prop_size;
     int expected_targets_notifies[256];
     int clipboard_owner[256];
diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 5faaee6..f7c1248 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -132,12 +132,14 @@ void vdagent_x11_randr_init(struct vdagent_x11 *x11)
         return;
     }

-    if (XRRQueryExtension(x11->display, &i, &i)) {
+    if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {
         XRRQueryVersion(x11->display, &x11->xrandr_major, &x11->xrandr_minor);
         if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)
             x11->has_xrandr = 1;
     }

+    XRRSelectInput (x11->display, x11->root_window[0], RRScreenChangeNotifyMask);
+
     if (x11->has_xrandr) {
         update_randr_res(x11, 0);
     } else {
@@ -466,6 +468,8 @@ static int set_screen_to_best_size(struct vdagent_x11 *x11, int width, int heigh
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
     int screen, int width, int height)
 {
+    update_randr_res(x11, 0);
+
     if (width == x11->width[screen] && height == x11->height[screen]) {
         return;
     }
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
index 752b337..c5c0176 100644
--- a/src/vdagent-x11.c
+++ b/src/vdagent-x11.c
@@ -503,9 +503,16 @@ static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
         return;
     }

+    if (event.type == x11->xrandr_event_base) {
+        XRRScreenChangeNotifyEvent *sce = (XRRScreenChangeNotifyEvent *) &event;
+
+        vdagent_x11_randr_handle_root_size_change(x11, 0,
+                sce->width, sce->height);
+        return;
+    }
+
     switch (event.type) {
     case ConfigureNotify:
-        // TODO: handle CrtcConfigureNotify, OutputConfigureNotify can be ignored.
         for (i = 0; i < x11->screen_count; i++)
             if (event.xconfigure.window == x11->root_window[i])
                 break;
--
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel



--
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]