xserver: Branch 'xorg-server-1.2-apple'
Ben Byer
bbyer at kemper.freedesktop.org
Fri Nov 30 19:22:30 PST 2007
hw/darwin/darwin.h | 1
hw/darwin/darwinEvents.c | 26 ----------------------
hw/darwin/quartz/X11Application.m | 44 +++++++++++++++++++++++++++++++-------
3 files changed, 36 insertions(+), 35 deletions(-)
New commits:
commit d1a9f616f27992f7788e99faed95ee10c25e12b7
Author: Ben Byer <bbyer at bbyer.apple.com>
Date: Fri Nov 30 19:22:26 2007 -0800
Removed redundant scroll wheel event code, and added
support for buttons 6 and 7 (horizontal scrolling)
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index 468cb6e..8a48440 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -124,7 +124,6 @@ enum {
kXDarwinUpdateModifiers // update all modifier keys
= LASTEvent+1, // (from X.h list of event names)
kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
- kXDarwinScrollWheel, // scroll wheel event
/*
* Quartz-specific events -- not used in IOKit mode
*/
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index db715d7..8a4e1c9 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -53,10 +53,6 @@ in this Software without prior written authorization from The Open Group.
#include <unistd.h>
#include <IOKit/hidsystem/IOLLEvent.h>
-/* Fake button press/release for scroll wheel move. */
-#define SCROLLWHEELUPFAKE 4
-#define SCROLLWHEELDOWNFAKE 5
-
#define QUEUE_SIZE 256
typedef struct _Event {
@@ -576,28 +572,6 @@ void ProcessInputEvents(void)
break;
}
- case kXDarwinScrollWheel:
- {
- short count = xe.u.clientMessage.u.s.shorts0;
-
- if (count > 0) {
- xe.u.u.detail = SCROLLWHEELUPFAKE;
- } else {
- xe.u.u.detail = SCROLLWHEELDOWNFAKE;
- count = -count;
- }
-
- for (; count; --count) {
- xe.u.u.type = ButtonPress;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- xe.u.u.type = ButtonRelease;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
- break;
- }
-
case kXDarwinDeactivate:
DEBUG_LOG("kxDarwinDeactivate\n");
DarwinReleaseModifiers();
diff --git a/hw/darwin/quartz/X11Application.m b/hw/darwin/quartz/X11Application.m
index 5c27e45..36b9c23 100644
--- a/hw/darwin/quartz/X11Application.m
+++ b/hw/darwin/quartz/X11Application.m
@@ -55,6 +55,12 @@ WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
+/* Fake button press/release for scroll wheel move. */
+#define SCROLLWHEELUPFAKE 4
+#define SCROLLWHEELDOWNFAKE 5
+#define SCROLLWHEELLEFTFAKE 6
+#define SCROLLWHEELRIGHTFAKE 7
+
int X11EnableKeyEquivalents = TRUE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
@@ -878,8 +884,9 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
xe.u.keyButtonPointer.rootY = pointer_y;
switch (type) {
- float count;
-
+ float countX, countY;
+ int signX, signY;
+
case NSLeftMouseDown:
xe.u.u.type = ButtonPress;
xe.u.u.detail = 1;
@@ -947,16 +954,37 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
xe.u.u.detail = [e keyCode];
goto do_event;
- case NSScrollWheel:
- xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
- count = [e deltaY];
- xe.u.u.detail = count > 0.0f ? 4 : 5;
- for (count = fabs(count); count > 0.0; count = count - 1.0f) {
+ case NSScrollWheel:
+// xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
+ countY = [e deltaY];
+ countX = [e deltaX];
+ signY = countY > 0.0f ?
+ SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
+ signX = countX > 0.0f ?
+ SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
+
+ countX = fabs(countX);
+ countY = fabs(countY);
+
+ while ((countX > 0.0f) || (countY > 0.0f)) {
+ if (countX > 0.0f) {
+ xe.u.u.detail = signX;
xe.u.u.type = ButtonPress;
DarwinEQEnqueue(&xe);
xe.u.u.type = ButtonRelease;
DarwinEQEnqueue(&xe);
- }
+ countX = countX - 1.0f;
+ }
+
+ if (countY > 0.0f) {
+ xe.u.u.detail = signY;
+ xe.u.u.type = ButtonPress;
+ DarwinEQEnqueue(&xe);
+ xe.u.u.type = ButtonRelease;
+ DarwinEQEnqueue(&xe);
+ countY = countY - 1.0f;
+ }
+ }
xe.u.u.type = 0;
break;
More information about the xorg-commit
mailing list