[Xquartz-changes] xserver: Branch 'master' - 3 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Mon Mar 26 10:23:35 PDT 2012
hw/xquartz/X11Application.m | 3 --
hw/xquartz/darwin.c | 56 ++++++++++++++++++++++++++------------------
hw/xquartz/darwinEvents.c | 49 +++++++++++++++-----------------------
hw/xquartz/darwinEvents.h | 4 ---
4 files changed, 56 insertions(+), 56 deletions(-)
New commits:
commit 31646d8fa9524adca1d7bc2cd2db90d47c2eb96e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Mar 25 23:33:54 2012 -0700
XQuartz: Use scrolling valuators
This lets use send more accurate data to Xi clients and uses dix
for legacy scroll buttons rather than reinventing the wheel.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index e9c3feb..a203f78 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1656,8 +1656,7 @@ handle_mouse:
deltaY *= -1;
}
#endif
- DarwinSendScrollEvents(deltaX, deltaY, location.x, location.y,
- pressure, tilt.x, tilt.y);
+ DarwinSendScrollEvents(deltaX, deltaY);
break;
}
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5fbfa4d..2e0bfe6 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -308,10 +308,10 @@ DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
static int
DarwinMouseProc(DeviceIntPtr pPointer, int what)
{
-#define NBUTTONS 7
-#define NAXES 2
- // 7 buttons: left, right, middle, then four scroll wheel "buttons"
- CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+#define NBUTTONS 3
+#define NAXES 4
+ // 3 buttons: left, middle, right
+ CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3};
Atom btn_labels[NBUTTONS] = { 0 };
Atom axes_labels[NAXES] = { 0 };
@@ -322,13 +322,11 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
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);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
+ axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
// Set button map.
InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
@@ -336,12 +334,21 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), NAXES,
axes_labels);
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], NO_AXIS_LIMITS,
- NO_AXIS_LIMITS, 1, 0, 1,
- Relative);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], NO_AXIS_LIMITS,
- NO_AXIS_LIMITS, 1, 0, 1,
- Relative);
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
+ InitValuatorAxisStruct(pPointer, 3, axes_labels[3],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
+
+ SetScrollValuator(pPointer, 2, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
+ SetScrollValuator(pPointer, 3, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
break;
case DEVICE_ON:
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 44f0639..c62dd44 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -653,42 +653,33 @@ DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, double pointer_x,
/* Send the appropriate number of button clicks to emulate scroll wheel */
void
-DarwinSendScrollEvents(double scroll_x, double scroll_y,
- double pointer_x, double pointer_y,
- double pressure, double tilt_x, double tilt_y)
-{
- int sign_x, sign_y;
+DarwinSendScrollEvents(double scroll_x, double scroll_y) {
+ ScreenPtr screen;
+ ValuatorMask valuators;
+
if (!darwinEvents) {
DEBUG_LOG(
"DarwinSendScrollEvents called before darwinEvents was initialized\n");
return;
}
- sign_x = scroll_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
- sign_y = scroll_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
- scroll_x = fabs(scroll_x);
- scroll_y = fabs(scroll_y);
-
- while ((scroll_x > 0.0f) || (scroll_y > 0.0f)) {
- if (scroll_x > 0.0f) {
- DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x,
- pointer_x, pointer_y, pressure, tilt_x,
- tilt_y);
- DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x,
- pointer_x, pointer_y, pressure, tilt_x,
- tilt_y);
- scroll_x = scroll_x - 1.0f;
- }
- if (scroll_y > 0.0f) {
- DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y,
- pointer_x, pointer_y, pressure, tilt_x,
- tilt_y);
- DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y,
- pointer_x, pointer_y, pressure, tilt_x,
- tilt_y);
- scroll_y = scroll_y - 1.0f;
- }
+ screen = miPointerGetScreen(darwinPointer);
+ if (!screen) {
+ DEBUG_LOG(
+ "DarwinSendScrollEvents called before screen was initialized\n");
+ return;
}
+
+ valuator_mask_zero(&valuators);
+ valuator_mask_set_double(&valuators, 2, scroll_y);
+ valuator_mask_set_double(&valuators, 3, scroll_x);
+
+ darwinEvents_lock();
+ {
+ QueuePointerEvents(darwinPointer, MotionNotify, 0,
+ POINTER_RELATIVE, &valuators);
+ DarwinPokeEQ();
+ } darwinEvents_unlock();
}
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 3868dc6..61ace6e 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -55,9 +55,7 @@ DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, double pointer_x,
void
DarwinSendKeyboardEvents(int ev_type, int keycode);
void
-DarwinSendScrollEvents(double scroll_x, double scroll_y, double pointer_x,
- double pointer_y, double pressure, double tilt_x,
- double tilt_y);
+DarwinSendScrollEvents(double scroll_x, double scroll_y);
void
DarwinUpdateModKeys(int flags);
void
commit 7790dc86384cc451ac44663737fde84dd81ad4e1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Mar 25 22:30:55 2012 -0700
XQuartz: Use AllocDevicePair to allocate our keyboard and mouse at the same time
Also correct isMaster to FALSE while we're here.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index d826ebf..5fbfa4d 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -512,11 +512,13 @@ InitInput(int argc, char **argv)
.rules = "base", .model = "empty", .layout = "empty",
.variant = NULL, .options = NULL
};
+
/* We need to really have rules... or something... */
XkbSetRulesDflts(&rmlvo);
- darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
- darwinKeyboard->name = strdup("keyboard");
+ assert(Success == AllocDevicePair(serverClient, "xquartz virtual",
+ &darwinPointer, &darwinKeyboard,
+ DarwinMouseProc, DarwinKeybdProc, FALSE));
/* here's the snippet from the current gdk sources:
if (!strcmp (tmp_name, "pointer"))
@@ -532,16 +534,16 @@ InitInput(int argc, char **argv)
gdkdev->info.source = GDK_SOURCE_PEN;
*/
- darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
- darwinPointer->name = strdup("pointer");
-
- darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+ assert(darwinTabletStylus);
darwinTabletStylus->name = strdup("pen");
- darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+ assert(darwinTabletCursor);
darwinTabletCursor->name = strdup("cursor");
- darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+ assert(darwinTabletEraser);
darwinTabletEraser->name = strdup("eraser");
DarwinEQInit();
commit 74fb534bf15687610367248071341fe4bfd1d8bf
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Mar 25 22:16:22 2012 -0700
XQuartz: Call update_desktop_dimensions() after updating our screen coordinates
Fixes: http://xquartz.macosforge.org/trac/ticket/555
Regression from: 8bebb4b4896d8b6ba3309b5b28fce883bb9f8a96
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 96c171a..d826ebf 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -606,6 +606,9 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
pScreenInfo->screens[i]->y);
}
}
+
+ /* Update screenInfo.x/y */
+ update_desktop_dimensions();
}
/*
More information about the Xquartz-changes
mailing list