summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mi/mieq.c2
-rw-r--r--xkb/Makefile.am1
-rw-r--r--xkb/ddxDevBtn.c26
-rw-r--r--xkb/ddxFakeBtn.c59
-rw-r--r--xkb/xkbActions.c13
-rw-r--r--xkb/xkbEvents.c6
6 files changed, 34 insertions, 73 deletions
diff --git a/mi/mieq.c b/mi/mieq.c
index 062dede06..986e3a1e0 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -274,7 +274,7 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
* @param master The event after being copied
* @param count Number of events in original.
*/
-static void
+void
CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
xEvent** master, int count)
{
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
index 5b594c130..5967f42ff 100644
--- a/xkb/Makefile.am
+++ b/xkb/Makefile.am
@@ -6,7 +6,6 @@ AM_CFLAGS = $(DIX_CFLAGS) \
DDX_SRCS = \
ddxBeep.c \
ddxCtrls.c \
- ddxFakeBtn.c \
ddxFakeMtn.c \
ddxInit.c \
ddxKeyClick.c \
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index e812e0be6..b68a28b2a 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -47,11 +47,13 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
int * devVal;
INT32 * evVal;
-xEvent events[2];
+xEvent events[2],
+ *m_events = NULL; /* master dev */
deviceKeyButtonPointer *btn;
deviceValuator * val;
int x,y;
int nAxes, i, count;
+DeviceIntPtr master = NULL;
if (dev == inputInfo.pointer || !dev->public.on)
return;
@@ -95,6 +97,28 @@ int nAxes, i, count;
count= 1+((nAxes+5)/6);
}
+ /* XXX: This is obnoxious. ProcessOtherEvent updates the DIX device state,
+ * but may not do anything if the device state is invalid. This happens if
+ * we post a mouse event from a pure keyboard device. So we need to hack
+ * around that by getting the master, then posting the event for the
+ * pointer paired with the master.
+ *
+ * Note:the DeviceButtonEvent on the SD itself will do nothing in most
+ * cases, unless dev is both a keyboard and a mouse.
+ */
+ if (!dev->isMaster && dev->u.master) {
+ master = dev->u.master;
+ if (!IsPointerDevice(master))
+ master = GetPairedDevice(dev->u.master);
+
+ CopyGetMasterEvent(master, &events, &m_events, count);
+ }
+
(*dev->public.processInputProc)((xEventPtr)btn, dev, count);
+
+ if (master) {
+ (*master->public.processInputProc)(m_events, master, count);
+ xfree(m_events);
+ }
return;
}
diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c
deleted file mode 100644
index f9dcbf79d..000000000
--- a/xkb/ddxFakeBtn.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#define NEED_EVENTS 1
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include <xkbsrv.h>
-#include <X11/extensions/XI.h>
-
-void
-XkbDDXFakePointerButton(int event,int button)
-{
-xEvent ev;
-int x,y;
-DevicePtr ptr;
-
- if ((ptr = (DevicePtr)inputInfo.pointer)==NULL)
- return;
- GetSpritePosition(inputInfo.pointer, &x,&y);
- ev.u.u.type = event;
- ev.u.u.detail = button;
- ev.u.keyButtonPointer.time = GetTimeInMillis();
- ev.u.keyButtonPointer.rootX = x;
- ev.u.keyButtonPointer.rootY = y;
- (*ptr->processInputProc)( &ev, (DeviceIntPtr)ptr, 1 );
- return;
-}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 35938a960..94420cf68 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -595,9 +595,6 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
unsigned keycode,
XkbAction * pAction)
{
- if (xkbi->device == inputInfo.keyboard)
- return 0;
-
if (filter->keycode==0) { /* initial press */
int button= pAction->btn.button;
@@ -617,7 +614,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
((pAction->btn.flags&XkbSA_LockNoLock)==0)) {
xkbi->lockedPtrButtons|= (1<<button);
AccessXCancelRepeatKey(xkbi,keycode);
- XkbDDXFakePointerButton(ButtonPress,button);
+ XkbDDXFakeDeviceButton(xkbi->device, 1, button);
filter->upAction.type= XkbSA_NoAction;
}
break;
@@ -628,12 +625,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
if (pAction->btn.count>0) {
nClicks= pAction->btn.count;
for (i=0;i<nClicks;i++) {
- XkbDDXFakePointerButton(ButtonPress,button);
- XkbDDXFakePointerButton(ButtonRelease,button);
+ XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, button);
}
filter->upAction.type= XkbSA_NoAction;
}
- else XkbDDXFakePointerButton(ButtonPress,button);
+ else XkbDDXFakeDeviceButton(xkbi->device, 1, button);
}
break;
case XkbSA_SetPtrDflt:
@@ -689,7 +686,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
}
xkbi->lockedPtrButtons&= ~(1<<button);
case XkbSA_PtrBtn:
- XkbDDXFakePointerButton(ButtonRelease,button);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, button);
break;
}
filter->active = 0;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 047efcdfb..335620baa 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -870,7 +870,7 @@ XkbSrvInfoPtr xkbi;
* Faking a release of the button here solves the problem.
*/
DebugF("[xkb] Faking release of button %d\n", xE[0].u.u.detail);
- XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, xE[0].u.u.detail);
}
}
else {
@@ -923,12 +923,12 @@ XkbSrvInfoPtr xkbi;
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
DebugF("[xkb] Faking release of button %d\n", xE[i].u.u.detail);
- XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, xE[i].u.u.detail);
} else if (type == DeviceButtonPress &&
((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
- XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, ((deviceKeyButtonPointer*)&xE[i])->state);
}
}
}