xserver: Branch 'xorg-server-1.4-apple' - 4 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Tue Sep 30 13:54:38 PDT 2008
hw/xquartz/X11Application.m | 35 ++++++++++++++++++++++-------------
hw/xquartz/darwin.c | 39 +++++++++++++++++++++++++--------------
hw/xquartz/darwinEvents.c | 30 +++++++++++++-----------------
hw/xquartz/darwinEvents.h | 9 ++++++---
4 files changed, 66 insertions(+), 47 deletions(-)
New commits:
commit 00ca0f4d839abf47e9573a1552473e039cf787e6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Sep 30 13:54:08 2008 -0700
XQuartz: Use "pointer" and "pen" for device names to please GDK.
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index a1135af..8189e0d 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -471,15 +471,29 @@ void InitInput( int argc, char **argv )
{
darwinKeyboard = AddInputDevice(DarwinKeybdProc, TRUE);
RegisterKeyboardDevice( darwinKeyboard );
- darwinKeyboard->name = strdup("Quartz Keyboard");
+ darwinKeyboard->name = strdup("keyboard");
+
+ /* here's the snippet from the current gdk sources:
+ if (!strcmp (tmp_name, "pointer"))
+ gdkdev->info.source = GDK_SOURCE_MOUSE;
+ else if (!strcmp (tmp_name, "wacom") ||
+ !strcmp (tmp_name, "pen"))
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ else if (!strcmp (tmp_name, "eraser"))
+ gdkdev->info.source = GDK_SOURCE_ERASER;
+ else if (!strcmp (tmp_name, "cursor"))
+ gdkdev->info.source = GDK_SOURCE_CURSOR;
+ else
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ */
darwinPointer = AddInputDevice(DarwinMouseProc, TRUE);
RegisterPointerDevice( darwinPointer );
- darwinPointer->name = strdup("Quartz Pointing Device");
+ darwinPointer->name = strdup("pointer");
darwinTabletStylus = AddInputDevice(DarwinTabletProc, TRUE);
RegisterPointerDevice( darwinTabletStylus );
- darwinTabletStylus->name = strdup("stylus");
+ darwinTabletStylus->name = strdup("pen");
darwinTabletCursor = AddInputDevice(DarwinTabletProc, TRUE);
RegisterPointerDevice( darwinTabletCursor );
commit 9a91d770a6411dd876187e64a8bda1f0745169ae
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Sep 30 11:10:58 2008 -0700
XQuartz: Workaround for initial pressure/tilt being sent as 0 with motion during the proximity event
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 9f57199..ef3f26f 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -907,14 +907,7 @@ extern int darwin_modifier_flags; // darwinEvents.c
handle_mouse:
pDev = darwinPointer;
- if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
- pressure = [e pressure];
- tilt_x = [e tilt].x;
- tilt_y = [e tilt].y;
-
- pDev = darwinTabletCurrent;
- }
-
+
if([e subtype] == NSTabletProximityEventSubtype) {
switch([e pointingDeviceType]) {
case NSEraserPointingDevice:
@@ -930,8 +923,25 @@ extern int darwin_modifier_flags; // darwinEvents.c
break;
}
+ /* NSTabletProximityEventSubtype doesn't encode pressure ant tilt
+ * So we just pretend the motion was caused by the mouse. Hopefully
+ * we'll have a better solution for this in the future (like maybe
+ * NSTabletProximityEventSubtype will come from NSTabletPoint
+ * rather than NSMouseMoved.
+ pressure = [e pressure];
+ tilt_x = [e tilt].x;
+ tilt_y = [e tilt].y;
+ pDev = darwinTabletCurrent;
+ */
+
DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
pointer_x, pointer_y);
+ }
+
+ if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
+ pressure = [e pressure];
+ tilt_x = [e tilt].x;
+ tilt_y = [e tilt].y;
pDev = darwinTabletCurrent;
}
commit d79ccb45f68b65d65718b5b77efe2fae6eeda762
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Sep 30 08:46:08 2008 -0700
XQuartz: Using absolute ranges for pointer location to increase resolution and better support tablets.
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index eba5482..9f57199 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -861,8 +861,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
NSRect screen;
NSPoint location;
NSWindow *window;
- int pointer_x, pointer_y, ev_button, ev_type;
- float pressure, tilt_x, tilt_y;
+ int ev_button, ev_type;
+ float pointer_x, pointer_y, pressure, tilt_x, tilt_y;
DeviceIntPtr pDev;
/* convert location to be relative to top-left of primary display */
@@ -880,7 +880,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
pointer_y = (screen.origin.y + screen.size.height) - location.y;
}
- pressure = 0; // for tablets
+ /* Setup our valuators. These will range from 0 to 1 */
+ pressure = 0;
tilt_x = 0;
tilt_y = 0;
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5a2d58c..a1135af 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -342,6 +342,8 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
GetMotionHistorySize(), 2);
InitAbsoluteClassDeviceStruct(pPointer);
pPointer->valuator->mode = Absolute; // Relative
+ InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
break;
case DEVICE_ON:
pPointer->public.on = TRUE;
@@ -373,17 +375,12 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
InitProximityClassDeviceStruct(pPointer);
InitAbsoluteClassDeviceStruct(pPointer);
-// InitValuatorAxisStruct(pPointer, 0, 0, 1440, 1, 0, 1);
-// InitValuatorAxisStruct(pPointer, 1, 0, 900, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 2, 0, 1023, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 3, -64, 64, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 4, -64, 64, 1, 0, 1);
-// InitValuatorAxisStruct(pPointer, 2, 0, 240, 49999, 49999, 49999);
-// InitValuatorAxisStruct(pPointer, 3, -64, 63, 128, 128, 128);
-// InitValuatorAxisStruct(pPointer, 4, -64, 63, 128, 128, 128);
-// InitValuatorAxisStruct(pPointer, 5, 0, 1023, 128, 128, 128);
-
-// pPointer->use = IsXExtensionDevice;
+ InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 2, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 3, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 4, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+// pPointer->use = IsXExtensionDevice;
break;
case DEVICE_ON:
pPointer->public.on = TRUE;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index de78265..9819618 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -68,10 +68,6 @@ in this Software without prior written authorization from The Open Group.
#define SCROLLWHEELLEFTFAKE 6
#define SCROLLWHEELRIGHTFAKE 7
-/* These values were chosen to match the output of xinput under Linux */
-#define SCALEFACTOR_TILT 64.0
-#define SCALEFACTOR_PRESSURE 1023.0
-
#define _APPLEWM_SERVER_
#include "applewmExt.h"
#include <X11/extensions/applewm.h>
@@ -391,31 +387,31 @@ static void DarwinPokeEQ(void) {
* display.
*/
static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
- int pointer_x, int pointer_y,
+ float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y) {
/* Fix offset between darwin and X screens */
pointer_x -= darwinMainScreenX + dixScreenOrigins[screen->myNum].x;
pointer_y -= darwinMainScreenY + dixScreenOrigins[screen->myNum].y;
/* Setup our array of values */
- valuators[0] = pointer_x;
- valuators[1] = pointer_y;
- valuators[2] = pressure * SCALEFACTOR_PRESSURE;
- valuators[3] = tilt_x * SCALEFACTOR_TILT;
- valuators[4] = tilt_y * SCALEFACTOR_TILT;
+ valuators[0] = pointer_x * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->width;
+ valuators[1] = pointer_y * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->height;
+ valuators[2] = pressure * XQUARTZ_VALUATOR_LIMIT;
+ valuators[3] = tilt_x * XQUARTZ_VALUATOR_LIMIT;
+ valuators[4] = tilt_y * XQUARTZ_VALUATOR_LIMIT;
-// DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n",
-// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
+ DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n",
+ valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
}
-void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, int pointer_x, int pointer_y,
+void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y) {
static int darwinFakeMouseButtonDown = 0;
int i, num_events;
ScreenPtr screen;
int valuators[5];
-// DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
if(!darwinEvents) {
DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n");
@@ -484,13 +480,13 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
} darwinEvents_unlock();
}
-void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y) {
+void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
int i, num_events;
ScreenPtr screen;
DeviceIntPtr dev = darwinTabletCurrent;
int valuators[5];
- DEBUG_LOG("DarwinSendProximityEvents(%d, %d, %d)\n", ev_type, pointer_x, pointer_y);
+ DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y);
if(!darwinEvents) {
DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
@@ -515,7 +511,7 @@ void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y) {
/* Send the appropriate number of button clicks to emulate scroll wheel */
void DarwinSendScrollEvents(float count_x, float count_y,
- int pointer_x, int pointer_y,
+ float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y) {
if(!darwinEvents) {
DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n");
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 003f5fa..2f1d9ff 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -28,15 +28,18 @@
#ifndef _DARWIN_EVENTS_H
#define _DARWIN_EVENTS_H
+/* For extra precision of our cursor and other valuators */
+#define XQUARTZ_VALUATOR_LIMIT (1 << 16)
+
Bool DarwinEQInit(void);
void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
-void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, int pointer_x, int pointer_y,
+void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y);
-void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y);
+void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int pointer_y,
+void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinUpdateModKeys(int flags);
void DarwinListenOnOpenFD(int fd);
commit 8ed5faf058ac7b0782a9cc13a2c58b80168358d2
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Mon Sep 29 22:33:02 2008 -0700
XQuartz: Removed resolved comment about localization.
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 6cf0db1..eba5482 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -783,8 +783,6 @@ static void check_xinitrc (void) {
if (access (buf, F_OK) != 0)
goto done;
- /* FIXME: put localized strings into Resources/English.lproj */
-
msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\
Windows displayed by X11 applications may not have titlebars, or may look \
different to windows displayed by native applications.\n\n\
More information about the xorg-commit
mailing list