mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-22 03:20:05 +01:00
Removed redundant scroll wheel event code, and added
support for buttons 6 and 7 (horizontal scrolling)
This commit is contained in:
parent
7e8515715f
commit
d1a9f616f2
3 changed files with 36 additions and 35 deletions
|
|
@ -124,7 +124,6 @@ enum {
|
||||||
kXDarwinUpdateModifiers // update all modifier keys
|
kXDarwinUpdateModifiers // update all modifier keys
|
||||||
= LASTEvent+1, // (from X.h list of event names)
|
= LASTEvent+1, // (from X.h list of event names)
|
||||||
kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
|
kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
|
||||||
kXDarwinScrollWheel, // scroll wheel event
|
|
||||||
/*
|
/*
|
||||||
* Quartz-specific events -- not used in IOKit mode
|
* Quartz-specific events -- not used in IOKit mode
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <IOKit/hidsystem/IOLLEvent.h>
|
#include <IOKit/hidsystem/IOLLEvent.h>
|
||||||
|
|
||||||
/* Fake button press/release for scroll wheel move. */
|
|
||||||
#define SCROLLWHEELUPFAKE 4
|
|
||||||
#define SCROLLWHEELDOWNFAKE 5
|
|
||||||
|
|
||||||
#define QUEUE_SIZE 256
|
#define QUEUE_SIZE 256
|
||||||
|
|
||||||
typedef struct _Event {
|
typedef struct _Event {
|
||||||
|
|
@ -576,28 +572,6 @@ void ProcessInputEvents(void)
|
||||||
break;
|
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:
|
case kXDarwinDeactivate:
|
||||||
DEBUG_LOG("kxDarwinDeactivate\n");
|
DEBUG_LOG("kxDarwinDeactivate\n");
|
||||||
DarwinReleaseModifiers();
|
DarwinReleaseModifiers();
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,12 @@ WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c
|
||||||
|
|
||||||
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
|
#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 X11EnableKeyEquivalents = TRUE;
|
||||||
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
||||||
|
|
||||||
|
|
@ -878,8 +884,9 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
xe.u.keyButtonPointer.rootY = pointer_y;
|
xe.u.keyButtonPointer.rootY = pointer_y;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
float count;
|
float countX, countY;
|
||||||
|
int signX, signY;
|
||||||
|
|
||||||
case NSLeftMouseDown:
|
case NSLeftMouseDown:
|
||||||
xe.u.u.type = ButtonPress;
|
xe.u.u.type = ButtonPress;
|
||||||
xe.u.u.detail = 1;
|
xe.u.u.detail = 1;
|
||||||
|
|
@ -947,16 +954,37 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
xe.u.u.detail = [e keyCode];
|
xe.u.u.detail = [e keyCode];
|
||||||
goto do_event;
|
goto do_event;
|
||||||
|
|
||||||
case NSScrollWheel:
|
case NSScrollWheel:
|
||||||
xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
|
// xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
|
||||||
count = [e deltaY];
|
countY = [e deltaY];
|
||||||
xe.u.u.detail = count > 0.0f ? 4 : 5;
|
countX = [e deltaX];
|
||||||
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
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;
|
xe.u.u.type = ButtonPress;
|
||||||
DarwinEQEnqueue(&xe);
|
DarwinEQEnqueue(&xe);
|
||||||
xe.u.u.type = ButtonRelease;
|
xe.u.u.type = ButtonRelease;
|
||||||
DarwinEQEnqueue(&xe);
|
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;
|
xe.u.u.type = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue