cocoa: Don't report trackpad mouse events as synthesized touches.
Fixes Bugzilla #4690, sort of. I guess.
parent
d2058b45ae
commit
d2d06f4443
|
@ -38,6 +38,8 @@
|
||||||
#define DLog(...) do { } while (0)
|
#define DLog(...) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TRACKPAD_REPORTS_TOUCH_MOUSEID 0
|
||||||
|
|
||||||
@implementation NSCursor (InvisibleCursor)
|
@implementation NSCursor (InvisibleCursor)
|
||||||
+ (NSCursor *)invisibleCursor
|
+ (NSCursor *)invisibleCursor
|
||||||
{
|
{
|
||||||
|
@ -379,6 +381,7 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_MouseID mouseID = mouse ? mouse->mouseID : 0;
|
SDL_MouseID mouseID = mouse ? mouse->mouseID : 0;
|
||||||
|
#if TRACKPAD_REPORTS_TOUCH_MOUSEID
|
||||||
if ([event subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
if ([event subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
||||||
if (mouse->touch_mouse_events) {
|
if (mouse->touch_mouse_events) {
|
||||||
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
||||||
|
@ -386,6 +389,7 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
|
||||||
return; /* no hint set, drop this one. */
|
return; /* no hint set, drop this one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const SDL_bool seenWarp = driverdata->seenWarp;
|
const SDL_bool seenWarp = driverdata->seenWarp;
|
||||||
driverdata->seenWarp = NO;
|
driverdata->seenWarp = NO;
|
||||||
|
@ -432,6 +436,7 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_MouseID mouseID = mouse->mouseID;
|
SDL_MouseID mouseID = mouse->mouseID;
|
||||||
|
#if TRACKPAD_REPORTS_TOUCH_MOUSEID
|
||||||
if ([event subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
if ([event subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
||||||
if (mouse->touch_mouse_events) {
|
if (mouse->touch_mouse_events) {
|
||||||
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
||||||
|
@ -439,6 +444,7 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
|
||||||
return; /* no hint set, drop this one. */
|
return; /* no hint set, drop this one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CGFloat x = -[event deltaX];
|
CGFloat x = -[event deltaX];
|
||||||
CGFloat y = [event deltaY];
|
CGFloat y = [event deltaY];
|
||||||
|
|
|
@ -922,6 +922,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
int button;
|
int button;
|
||||||
int clicks;
|
int clicks;
|
||||||
|
|
||||||
|
#if TRACKPAD_REPORTS_TOUCH_MOUSEID
|
||||||
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
||||||
if (mouse->touch_mouse_events) {
|
if (mouse->touch_mouse_events) {
|
||||||
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
||||||
|
@ -929,6 +930,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
return; /* no hint set, drop this one. */
|
return; /* no hint set, drop this one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Ignore events that aren't inside the client area (i.e. title bar.) */
|
/* Ignore events that aren't inside the client area (i.e. title bar.) */
|
||||||
if ([theEvent window]) {
|
if ([theEvent window]) {
|
||||||
|
@ -991,6 +993,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
int button;
|
int button;
|
||||||
int clicks;
|
int clicks;
|
||||||
|
|
||||||
|
#if TRACKPAD_REPORTS_TOUCH_MOUSEID
|
||||||
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
||||||
if (mouse->touch_mouse_events) {
|
if (mouse->touch_mouse_events) {
|
||||||
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
||||||
|
@ -998,6 +1001,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
return; /* no hint set, drop this one. */
|
return; /* no hint set, drop this one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ([self processHitTest:theEvent]) {
|
if ([self processHitTest:theEvent]) {
|
||||||
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
|
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
|
||||||
|
@ -1051,6 +1055,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
NSPoint point;
|
NSPoint point;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
#if TRACKPAD_REPORTS_TOUCH_MOUSEID
|
||||||
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
if ([theEvent subtype] == NSEventSubtypeTouch) { /* this is a synthetic from the OS */
|
||||||
if (mouse->touch_mouse_events) {
|
if (mouse->touch_mouse_events) {
|
||||||
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
mouseID = SDL_TOUCH_MOUSEID; /* Hint is set */
|
||||||
|
@ -1058,6 +1063,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
return; /* no hint set, drop this one. */
|
return; /* no hint set, drop this one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ([self processHitTest:theEvent]) {
|
if ([self processHitTest:theEvent]) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
|
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue