Blame SOURCES/0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch

70130e
From 4587f79c2b5b191d450a97c8951771e98f237316 Mon Sep 17 00:00:00 2001
70130e
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
70130e
Date: Mon, 16 Sep 2013 12:05:19 -0700
70130e
Subject: [PATCH 30/39] xwayland: Use a per-screen private key for cursor
70130e
 privates
70130e
70130e
The cursor is a per-display object, so we need to set private data on it
70130e
using a per-screen private key to avoid stepping on privates from other
70130e
screens.
70130e
---
70130e
 hw/xfree86/xwayland/xwayland-cursor.c  | 15 +++++++++------
70130e
 hw/xfree86/xwayland/xwayland-private.h |  2 ++
70130e
 2 files changed, 11 insertions(+), 6 deletions(-)
70130e
70130e
diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c
70130e
index 1cd6457..2cdd248 100644
70130e
--- a/hw/xfree86/xwayland/xwayland-cursor.c
70130e
+++ b/hw/xfree86/xwayland/xwayland-cursor.c
70130e
@@ -40,8 +40,6 @@
70130e
 #include "xwayland-private.h"
70130e
 #include "xserver-client-protocol.h"
70130e
 
70130e
-static DevPrivateKeyRec xwl_cursor_private_key;
70130e
-
70130e
 static void
70130e
 expand_source_and_mask(CursorPtr cursor, void *data)
70130e
 {
70130e
@@ -129,7 +127,8 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
70130e
 				  WL_SHM_FORMAT_ARGB8888);
70130e
     wl_shm_pool_destroy(pool);
70130e
 
70130e
-    dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer);
70130e
+    dixSetPrivate(&cursor->devPrivates,
70130e
+                  &xwl_screen->cursor_private_key, buffer);
70130e
 
70130e
     return TRUE;
70130e
 }
70130e
@@ -139,8 +138,11 @@ xwl_unrealize_cursor(DeviceIntPtr device,
70130e
 			ScreenPtr screen, CursorPtr cursor)
70130e
 {
70130e
     struct wl_buffer *buffer;
70130e
+    struct xwl_screen *xwl_screen;
70130e
 
70130e
-    buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
70130e
+    xwl_screen = xwl_screen_get(screen);
70130e
+    buffer = dixGetPrivate(&cursor->devPrivates,
70130e
+                           &xwl_screen->cursor_private_key);
70130e
     wl_buffer_destroy(buffer);
70130e
 
70130e
     return TRUE;
70130e
@@ -155,7 +157,7 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
70130e
         return;
70130e
 
70130e
     buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates,
70130e
-                           &xwl_cursor_private_key);
70130e
+                           &xwl_seat->xwl_screen->cursor_private_key);
70130e
 
70130e
     wl_pointer_set_cursor(xwl_seat->wl_pointer,
70130e
 			  xwl_seat->pointer_enter_serial,
70130e
@@ -229,7 +231,8 @@ xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen)
70130e
 {
70130e
     miPointerScreenPtr pointer_priv;
70130e
 
70130e
-    if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0))
70130e
+    if (!dixRegisterPrivateKey(&xwl_screen->cursor_private_key,
70130e
+                               PRIVATE_CURSOR, 0))
70130e
 	return BadAlloc;
70130e
 
70130e
     pointer_priv = dixLookupPrivate(&screen->devPrivates, miPointerScreenKey);
70130e
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
70130e
index b0b2201..aa9fc03 100644
70130e
--- a/hw/xfree86/xwayland/xwayland-private.h
70130e
+++ b/hw/xfree86/xwayland/xwayland-private.h
70130e
@@ -65,6 +65,8 @@ struct xwl_screen {
70130e
     uint32_t			 serial;
70130e
     Bool                         outputs_initialized;
70130e
 
70130e
+    DevPrivateKeyRec             cursor_private_key;
70130e
+
70130e
     CreateWindowProcPtr		 CreateWindow;
70130e
     DestroyWindowProcPtr	 DestroyWindow;
70130e
     RealizeWindowProcPtr	 RealizeWindow;
70130e
-- 
70130e
1.8.3.1
70130e