aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winmouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winmouse.c')
-rw-r--r--xorg-server/hw/xwin/winmouse.c70
1 files changed, 59 insertions, 11 deletions
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index be2b66a08..b537d3213 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -38,6 +38,8 @@
#if defined(XFree86Server)
#include "inputstr.h"
+#include "exevents.h" /* for button/axes labels */
+#include "xserver-properties.h"
/* Peek the internal button mapping */
static CARD8 const *g_winMouseButtonMap = NULL;
@@ -70,6 +72,8 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
int lngWheelEvents = 2;
CARD8 *map;
DevicePtr pDevice = (DevicePtr) pDeviceInt;
+ Atom *btn_labels;
+ Atom axes_labels[2];
switch (iState)
{
@@ -97,14 +101,27 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
map[0] = 0;
for (i=1; i <= lngMouseButtons + lngWheelEvents; i++)
map[i] = i;
+
+ btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
InitPointerDeviceStruct (pDevice,
map,
lngMouseButtons + lngWheelEvents,
- GetMotionHistory,
+ btn_labels,
winMouseCtrl,
GetMotionHistorySize(),
- 2);
+ 2,
+ axes_labels);
free(map);
+ free(btn_labels);
#if defined(XFree86Server)
g_winMouseButtonMap = pDeviceInt->button->map;
@@ -221,19 +238,25 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
void
winMouseButtonsSendEvent (int iEventType, int iButton)
{
- xEvent xCurrentEvent;
+ EventListPtr events;
+ int i, nevents;
- /* Load an xEvent and enqueue the event */
- xCurrentEvent.u.u.type = iEventType;
#if defined(XFree86Server)
if (g_winMouseButtonMap)
- xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
- else
+ iButton = g_winMouseButtonMap[iButton];
+#endif
+
+ GetEventList(&events);
+ nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton,
+ POINTER_RELATIVE, 0, 0, NULL);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(g_pwinPointer, events[i].event);
+
+#if CYGDEBUG
+ ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n",
+ iEventType, iButton, nevents);
#endif
- xCurrentEvent.u.u.detail = iButton;
- xCurrentEvent.u.keyButtonPointer.time
- = g_c32LastInputEventTime = GetTickCount ();
- mieqEnqueue (&xCurrentEvent);
}
@@ -339,3 +362,28 @@ winMouseButtonsHandle (ScreenPtr pScreen,
return 0;
}
+
+/**
+ * Enqueue a motion event.
+ *
+ * XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer)
+ *
+ */
+void winEnqueueMotion(int x, int y)
+{
+ miPointerSetPosition(g_pwinPointer, &x, &y);
+
+ int i, nevents;
+ int valuators[2];
+
+ EventListPtr events;
+ GetEventList(&events);
+
+ valuators[0] = x;
+ valuators[1] = y;
+ nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(g_pwinPointer, events[i].event);
+}