From 4b386610243b1a30db7e4cdb89cb43012198407d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 16 Dec 2011 12:41:08 +1000 Subject: [PATCH 1/6] dix: button state must show the logical buttons, not physical buttons If the device is mapped 3 2 1, a click on physical button 1 sends a button 3 press, but the state was set for button 1. Fix this, the state must be set for that button's logical mapping. https://bugzilla.gnome.org/show_bug.cgi?id=655928 Signed-off-by: Peter Hutterer (cherry picked from commit 9567d21e85b99febe805263a4d93b15fd1f7ab42) Conflicts: dix/inpututils.c --- Xi/exevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index dcb496fd4..9d43564f8 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -927,7 +927,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) if (BitIsOn(mouse->button->down, i)) - SetBit(event->buttons, i); + SetBit(event->buttons, mouse->button->map[i]); if (kbd && kbd->key) { From cf296f2eeffe4b438e9378268f84a1f63c555e52 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Nov 2011 15:31:10 +1000 Subject: [PATCH 2/6] Xext: don't swap CARD8 in SProcSELinuxQueryVersion xselinux_ext.c: In function 'SELinuxSendItemsToClient': xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable] xselinux_ext.c: In function 'SProcSELinuxQueryVersion': xselinux_ext.c:532:62: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap xselinux_ext.c:533:62: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap Signed-off-by: Peter Hutterer Reviewed-by: Julien Cristau (cherry picked from commit bb4aa1f263ad38c175bfda3b7e6c325260ce3f28) Conflicts: Xext/xselinux_ext.c --- Xext/xselinux_ext.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 374571c4b..85ca2dc8e 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -528,12 +528,6 @@ ProcSELinuxDispatch(ClientPtr client) static int SProcSELinuxQueryVersion(ClientPtr client) { - REQUEST(SELinuxQueryVersionReq); - int n; - - REQUEST_SIZE_MATCH(SELinuxQueryVersionReq); - swaps(&stuff->client_major, n); - swaps(&stuff->client_minor, n); return ProcSELinuxQueryVersion(client); } From 20efd3c15829d8fbb3610d5af41b67a627e63d21 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Nov 2011 16:15:37 +1000 Subject: [PATCH 3/6] Xi: when removing a device, reset ClientPointers where needed if a client had the to-be-removed device as ClientPointer, reset to NULL. Fixes #43165 Signed-off-by: Peter Hutterer Reviewed-by: Jeremy Huddleston (cherry picked from commit d2ebbcdaf6b13d70eee704b1764ff349e1be22a0) --- Xi/xichangehierarchy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index 96ead6fcd..dfcd52fd0 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -202,6 +202,19 @@ unwind: return rc; } +static int +disable_clientpointer(DeviceIntPtr dev) +{ + int i; + + for (i = 0; i < currentMaxClients; i++) + { + ClientPtr client = clients[i]; + if (client && client->clientPtr == dev) + client->clientPtr = NULL; + } +} + static int remove_master(ClientPtr client, xXIRemoveMasterInfo *r, int flags[MAXDEVICES]) @@ -252,6 +265,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r, if (rc != Success) goto unwind; + disable_clientpointer(ptr); + /* Disabling sends the devices floating, reattach them if * desired. */ if (r->return_mode == XIAttachToMaster) From ae4272a5742119b10074a542d0dcd4c493cb83e4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 30 Nov 2011 09:06:06 +1000 Subject: [PATCH 4/6] xfixes: don't dereference a NULL cursor If the new cursor is the NULL cursor, don't dereference it and use zeros instead. Signed-off-by: Peter Hutterer Reviewed-by: Jeremy Huddleston (cherry picked from commit 1ab50be938524dcd4a9e56d27e3b96a27c2db2c0) --- xfixes/cursor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xfixes/cursor.c b/xfixes/cursor.c index ecbed4016..7b01c8b52 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -179,9 +179,9 @@ CursorDisplayCursor (DeviceIntPtr pDev, ev.type = XFixesEventBase + XFixesCursorNotify; ev.subtype = XFixesDisplayCursorNotify; ev.window = e->pWindow->drawable.id; - ev.cursorSerial = pCursor->serialNumber; + ev.cursorSerial = pCursor ? pCursor->serialNumber : 0; ev.timestamp = currentTime.milliseconds; - ev.name = pCursor->name; + ev.name = pCursor ? pCursor->name : None; WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); } } From 8c73f6bcbdc04380cc41d9f6dc7e849c7c4f9298 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 8 Dec 2011 21:52:07 -0800 Subject: [PATCH 5/6] Change disable_clientpointer return type to void It doesn't return anything, nor does it's caller expect it to. Fixes Solaris Studio compiler error: "xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer Signed-off-by: Alan Coopersmith Reviewed-by: Peter Hutterer Signed-off-by: Keith Packard (cherry picked from commit 372a6f10dc2d74d2d179e8b92449e9b8636a99ef) --- Xi/xichangehierarchy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index dfcd52fd0..3facadd92 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -202,7 +202,7 @@ unwind: return rc; } -static int +static void disable_clientpointer(DeviceIntPtr dev) { int i; From 4e4bb319a4f9510277557f65676948cd1db10e93 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 13 Dec 2011 15:41:23 +0100 Subject: [PATCH 6/6] Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs CreateGrab() expects the keyboard mode to be stored in grab_mode, and the pointer mode in other_device_mode, so respect this in passive XI2 grabs, and switch modes if needed. Signed-off-by: Carlos Garnacho Signed-off-by: Peter Hutterer Reviewed-by: Chase Douglas (cherry picked from commit 5b169cb695bd450d7f64e3800f00c9237ee67f96) --- Xi/xipassivegrab.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 5cdd8aca6..af46282c8 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -140,11 +140,17 @@ ProcXIPassiveGrabDevice(ClientPtr client) memset(¶m, 0, sizeof(param)); param.grabtype = GRABTYPE_XI2; param.ownerEvents = stuff->owner_events; - param.this_device_mode = stuff->grab_mode; - param.other_devices_mode = stuff->paired_device_mode; param.grabWindow = stuff->grab_window; param.cursor = stuff->cursor; + if (IsKeyboardDevice(dev)) { + param.this_device_mode = stuff->grab_mode; + param.other_devices_mode = stuff->paired_device_mode; + } else { + param.this_device_mode = stuff->paired_device_mode; + param.other_devices_mode = stuff->grab_mode; + } + if (stuff->cursor != None) { status = dixLookupResourceByType(&tmp, stuff->cursor,