formatting cleanup for X11Application.m (no code changes)
(cherry picked from commit eb083d3f68f459d90417558da1ed00729b749950)
This commit is contained in:
parent
e9e2d88436
commit
15b0084f1a
|
@ -166,171 +166,170 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
static TSMDocumentID x11_document;
|
static TSMDocumentID x11_document;
|
||||||
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
|
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
|
||||||
if (state) {
|
if (state) {
|
||||||
DarwinSendDDXEvent(kXquartzActivate, 0);
|
DarwinSendDDXEvent(kXquartzActivate, 0);
|
||||||
|
|
||||||
if (!_x_active) {
|
if (!_x_active) {
|
||||||
if (x11_document == 0 && darwinKeymapFile == NULL) {
|
if (x11_document == 0 && darwinKeymapFile == NULL) {
|
||||||
OSType types[1];
|
OSType types[1];
|
||||||
types[0] = kUnicodeDocument;
|
types[0] = kUnicodeDocument;
|
||||||
NewTSMDocument (1, types, &x11_document, 0);
|
NewTSMDocument (1, types, &x11_document, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x11_document != 0) ActivateTSMDocument (x11_document);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DarwinSendDDXEvent(kXquartzDeactivate, 0);
|
||||||
|
|
||||||
|
if (_x_active && x11_document != 0)
|
||||||
|
DeactivateTSMDocument (x11_document);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x11_document != 0) ActivateTSMDocument (x11_document);
|
_x_active = state;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DarwinSendDDXEvent(kXquartzDeactivate, 0);
|
|
||||||
|
|
||||||
if (_x_active && x11_document != 0)
|
|
||||||
DeactivateTSMDocument (x11_document);
|
|
||||||
}
|
|
||||||
|
|
||||||
_x_active = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) became_key:(NSWindow *)win {
|
- (void) became_key:(NSWindow *)win {
|
||||||
[self activateX:NO];
|
[self activateX:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) sendEvent:(NSEvent *)e {
|
- (void) sendEvent:(NSEvent *)e {
|
||||||
NSEventType type;
|
NSEventType type;
|
||||||
BOOL for_appkit, for_x;
|
BOOL for_appkit, for_x;
|
||||||
|
|
||||||
type = [e type];
|
type = [e type];
|
||||||
|
|
||||||
/* By default pass down the responder chain and to X. */
|
/* By default pass down the responder chain and to X. */
|
||||||
for_appkit = YES;
|
for_appkit = YES;
|
||||||
for_x = YES;
|
for_x = YES;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
|
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
|
||||||
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
|
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
|
||||||
if ([e window] != nil) {
|
if ([e window] != nil) {
|
||||||
/* Pointer event has an (AppKit) window. Probably something for the kit. */
|
/* Pointer event has an (AppKit) window. Probably something for the kit. */
|
||||||
for_x = NO;
|
for_x = NO;
|
||||||
if (_x_active) [self activateX:NO];
|
if (_x_active) [self activateX:NO];
|
||||||
} else if ([self modalWindow] == nil) {
|
} else if ([self modalWindow] == nil) {
|
||||||
/* Must be an X window. Tell appkit it doesn't have focus. */
|
/* Must be an X window. Tell appkit it doesn't have focus. */
|
||||||
WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
|
WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
|
||||||
if (pWin) RootlessReorderWindow(pWin);
|
if (pWin) RootlessReorderWindow(pWin);
|
||||||
for_appkit = NO;
|
for_appkit = NO;
|
||||||
|
|
||||||
if ([self isActive]) {
|
if ([self isActive]) {
|
||||||
[self deactivate];
|
[self deactivate];
|
||||||
|
if (!_x_active && quartzProcs->IsX11Window([e window],
|
||||||
|
[e windowNumber]))
|
||||||
|
[self activateX:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if (!_x_active && quartzProcs->IsX11Window([e window],
|
case NSKeyDown: case NSKeyUp:
|
||||||
[e windowNumber]))
|
if (_x_active) {
|
||||||
[self activateX:YES];
|
static int swallow_up;
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NSKeyDown: case NSKeyUp:
|
/* No kit window is focused, so send it to X. */
|
||||||
if (_x_active) {
|
for_appkit = NO;
|
||||||
static int swallow_up;
|
if (type == NSKeyDown) {
|
||||||
|
/* Before that though, see if there are any global
|
||||||
|
shortcuts bound to it. */
|
||||||
|
|
||||||
/* No kit window is focused, so send it to X. */
|
if (X11EnableKeyEquivalents
|
||||||
for_appkit = NO;
|
&& [[self mainMenu] performKeyEquivalent:e]) {
|
||||||
if (type == NSKeyDown) {
|
swallow_up = [e keyCode];
|
||||||
/* Before that though, see if there are any global
|
for_x = NO;
|
||||||
shortcuts bound to it. */
|
} else if (!quartzEnableRootless
|
||||||
|
&& ([e modifierFlags] & ALL_KEY_MASKS)
|
||||||
if (X11EnableKeyEquivalents
|
== (NSCommandKeyMask | NSAlternateKeyMask)
|
||||||
&& [[self mainMenu] performKeyEquivalent:e]) {
|
&& ([e keyCode] == 0 /*a*/
|
||||||
swallow_up = [e keyCode];
|
|| [e keyCode] == 53 /*Esc*/)) {
|
||||||
for_x = NO;
|
swallow_up = 0;
|
||||||
} else if (!quartzEnableRootless
|
for_x = NO;
|
||||||
&& ([e modifierFlags] & ALL_KEY_MASKS)
|
|
||||||
== (NSCommandKeyMask | NSAlternateKeyMask)
|
|
||||||
&& ([e keyCode] == 0 /*a*/
|
|
||||||
|| [e keyCode] == 53 /*Esc*/)) {
|
|
||||||
swallow_up = 0;
|
|
||||||
for_x = NO;
|
|
||||||
#ifdef DARWIN_DDX_MISSING
|
#ifdef DARWIN_DDX_MISSING
|
||||||
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
|
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* If we saw a key equivalent on the down, don't pass
|
||||||
|
the up through to X. */
|
||||||
|
|
||||||
|
if (swallow_up != 0 && [e keyCode] == swallow_up) {
|
||||||
|
swallow_up = 0;
|
||||||
|
for_x = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else for_x = NO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSFlagsChanged:
|
||||||
|
/* For the l33t X users who remap modifier keys to normal keysyms. */
|
||||||
|
if (!_x_active) for_x = NO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSAppKitDefined:
|
||||||
|
switch ([e subtype]) {
|
||||||
|
case NSApplicationActivatedEventType:
|
||||||
|
for_x = NO;
|
||||||
|
if ([self modalWindow] == nil) {
|
||||||
|
for_appkit = NO;
|
||||||
|
|
||||||
|
/* FIXME: hack to avoid having to pass the event to appkit,
|
||||||
|
which would cause it to raise one of its windows. */
|
||||||
|
_appFlags._active = YES;
|
||||||
|
|
||||||
|
[self activateX:YES];
|
||||||
|
if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 18: /* ApplicationDidReactivate */
|
||||||
|
if (quartzHasRoot) for_appkit = NO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSApplicationDeactivatedEventType:
|
||||||
|
for_x = NO;
|
||||||
|
[self activateX:NO];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: break; /* for gcc */
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* If we saw a key equivalent on the down, don't pass
|
|
||||||
the up through to X. */
|
|
||||||
|
|
||||||
if (swallow_up != 0 && [e keyCode] == swallow_up) {
|
if (for_appkit) [super sendEvent:e];
|
||||||
swallow_up = 0;
|
|
||||||
for_x = NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else for_x = NO;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NSFlagsChanged:
|
if (for_x) send_nsevent (type, e);
|
||||||
/* For the l33t X users who remap modifier keys to normal keysyms. */
|
|
||||||
if (!_x_active) for_x = NO;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NSAppKitDefined:
|
|
||||||
switch ([e subtype]) {
|
|
||||||
case NSApplicationActivatedEventType:
|
|
||||||
for_x = NO;
|
|
||||||
if ([self modalWindow] == nil) {
|
|
||||||
for_appkit = NO;
|
|
||||||
|
|
||||||
/* FIXME: hack to avoid having to pass the event to appkit,
|
|
||||||
which would cause it to raise one of its windows. */
|
|
||||||
_appFlags._active = YES;
|
|
||||||
|
|
||||||
[self activateX:YES];
|
|
||||||
if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 18: /* ApplicationDidReactivate */
|
|
||||||
if (quartzHasRoot) for_appkit = NO;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NSApplicationDeactivatedEventType:
|
|
||||||
for_x = NO;
|
|
||||||
[self activateX:NO];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break; /* for gcc */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (for_appkit) [super sendEvent:e];
|
|
||||||
|
|
||||||
if (for_x) send_nsevent (type, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_window_menu:(NSArray *)list {
|
- (void) set_window_menu:(NSArray *)list {
|
||||||
[_controller set_window_menu:list];
|
[_controller set_window_menu:list];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_window_menu_check:(NSNumber *)n {
|
- (void) set_window_menu_check:(NSNumber *)n {
|
||||||
[_controller set_window_menu_check:n];
|
[_controller set_window_menu_check:n];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_apps_menu:(NSArray *)list {
|
- (void) set_apps_menu:(NSArray *)list {
|
||||||
[_controller set_apps_menu:list];
|
[_controller set_apps_menu:list];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_front_process:unused {
|
- (void) set_front_process:unused {
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
|
|
||||||
if ([self modalWindow] == nil)
|
if ([self modalWindow] == nil)
|
||||||
[self activateX:YES];
|
[self activateX:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_can_quit:(NSNumber *)state {
|
- (void) set_can_quit:(NSNumber *)state {
|
||||||
[_controller set_can_quit:[state boolValue]];
|
[_controller set_can_quit:[state boolValue]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) server_ready:unused {
|
- (void) server_ready:unused {
|
||||||
[_controller server_ready];
|
[_controller server_ready];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) show_hide_menubar:(NSNumber *)state {
|
- (void) show_hide_menubar:(NSNumber *)state {
|
||||||
if ([state boolValue]) ShowMenuBar ();
|
if ([state boolValue]) ShowMenuBar ();
|
||||||
else HideMenuBar ();
|
else HideMenuBar ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,57 +347,57 @@ static void cfrelease (CFAllocatorRef a, const void *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
|
static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
|
||||||
CFMutableArrayRef out;
|
CFMutableArrayRef out;
|
||||||
CFArrayCallBacks cb;
|
CFArrayCallBacks cb;
|
||||||
NSObject *ns;
|
NSObject *ns;
|
||||||
const CFTypeRef *cf;
|
const CFTypeRef *cf;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
memset (&cb, 0, sizeof (cb));
|
memset (&cb, 0, sizeof (cb));
|
||||||
cb.version = 0;
|
cb.version = 0;
|
||||||
cb.retain = cfretain;
|
cb.retain = cfretain;
|
||||||
cb.release = cfrelease;
|
cb.release = cfrelease;
|
||||||
|
|
||||||
count = [in count];
|
count = [in count];
|
||||||
out = CFArrayCreateMutable (NULL, count, &cb);
|
out = CFArrayCreateMutable (NULL, count, &cb);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ns = [in objectAtIndex:i];
|
ns = [in objectAtIndex:i];
|
||||||
|
|
||||||
if ([ns isKindOfClass:[NSArray class]])
|
if ([ns isKindOfClass:[NSArray class]])
|
||||||
cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
|
cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
|
||||||
else
|
else
|
||||||
cf = CFRetain ((CFTypeRef) ns);
|
cf = CFRetain ((CFTypeRef) ns);
|
||||||
|
|
||||||
CFArrayAppendValue (out, cf);
|
CFArrayAppendValue (out, cf);
|
||||||
CFRelease (cf);
|
CFRelease (cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
NSMutableArray *out;
|
NSMutableArray *out;
|
||||||
const CFTypeRef *cf;
|
const CFTypeRef *cf;
|
||||||
NSObject *ns;
|
NSObject *ns;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
count = CFArrayGetCount (in);
|
count = CFArrayGetCount (in);
|
||||||
out = [[NSMutableArray alloc] initWithCapacity:count];
|
out = [[NSMutableArray alloc] initWithCapacity:count];
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
cf = CFArrayGetValueAtIndex (in, i);
|
cf = CFArrayGetValueAtIndex (in, i);
|
||||||
|
|
||||||
if (CFGetTypeID (cf) == CFArrayGetTypeID ())
|
if (CFGetTypeID (cf) == CFArrayGetTypeID ())
|
||||||
ns = cfarray_to_nsarray ((CFArrayRef) cf);
|
ns = cfarray_to_nsarray ((CFArrayRef) cf);
|
||||||
else
|
else
|
||||||
ns = [(id)cf retain];
|
ns = [(id)cf retain];
|
||||||
|
|
||||||
[out addObject:ns];
|
[out addObject:ns];
|
||||||
[ns release];
|
[ns release];
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CFPropertyListRef) prefs_get:(NSString *)key {
|
- (CFPropertyListRef) prefs_get:(NSString *)key {
|
||||||
|
@ -855,86 +854,68 @@ convert_flags (unsigned int nsflags) {
|
||||||
return xflags;
|
return xflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This code should probably be merged with that in XDarwin's XServer.m - BB
|
|
||||||
static void send_nsevent (NSEventType type, NSEvent *e) {
|
static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
// static unsigned int button_state = 0;
|
NSRect screen;
|
||||||
NSRect screen;
|
NSPoint location;
|
||||||
NSPoint location;
|
NSWindow *window;
|
||||||
NSWindow *window;
|
int pointer_x, pointer_y, ev_button, ev_type;
|
||||||
int pointer_x, pointer_y, ev_button, ev_type;
|
float pressure, tilt_x, tilt_y;
|
||||||
float pressure, tilt_x, tilt_y;
|
|
||||||
|
|
||||||
// int num_events=0, i=0, state;
|
/* convert location to global top-left coordinates */
|
||||||
// xEvent xe;
|
location = [e locationInWindow];
|
||||||
|
window = [e window];
|
||||||
/* convert location to global top-left coordinates */
|
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||||
location = [e locationInWindow];
|
|
||||||
window = [e window];
|
|
||||||
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
|
||||||
|
|
||||||
if (window != nil) {
|
if (window != nil) {
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
pointer_x = location.x + frame.origin.x;
|
pointer_x = location.x + frame.origin.x;
|
||||||
pointer_y = (((screen.origin.y + screen.size.height)
|
pointer_y = (((screen.origin.y + screen.size.height)
|
||||||
- location.y) - frame.origin.y);
|
- location.y) - frame.origin.y);
|
||||||
} else {
|
} else {
|
||||||
pointer_x = location.x;
|
pointer_x = location.x;
|
||||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
||||||
}
|
|
||||||
|
|
||||||
pointer_y -= aquaMenuBarHeight;
|
|
||||||
// state = convert_flags ([e modifierFlags]);
|
|
||||||
|
|
||||||
pressure = 0; // for tablets
|
|
||||||
tilt_x = 0;
|
|
||||||
tilt_y = 0;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
|
|
||||||
case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
|
|
||||||
case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
|
|
||||||
case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
|
|
||||||
case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
|
|
||||||
case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
|
|
||||||
case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
|
|
||||||
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
|
|
||||||
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
|
|
||||||
case NSTabletPoint:
|
|
||||||
pressure = [e pressure];
|
|
||||||
tilt_x = [e tilt].x;
|
|
||||||
tilt_y = [e tilt].y; // fall through
|
|
||||||
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
|
||||||
handle_mouse:
|
|
||||||
|
|
||||||
/* I'm not sure the below code is necessary or useful (-bb)
|
|
||||||
if(ev_type==ButtonPress) {
|
|
||||||
if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
|
|
||||||
fprintf(stderr, "Dropping event because it's not a window\n");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
button_state |= (1 << ev_button);
|
|
||||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
|
|
||||||
} else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure];
|
pointer_y -= aquaMenuBarHeight;
|
||||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
|
|
||||||
pressure, tilt_x, tilt_y);
|
|
||||||
break;
|
|
||||||
case NSScrollWheel:
|
|
||||||
DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
|
|
||||||
pressure, tilt_x, tilt_y);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NSKeyDown: // do we need to translate these keyCodes?
|
pressure = 0; // for tablets
|
||||||
case NSKeyUp:
|
tilt_x = 0;
|
||||||
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
tilt_y = 0;
|
||||||
break;
|
|
||||||
|
|
||||||
case NSFlagsChanged:
|
switch (type) {
|
||||||
DarwinUpdateModKeys([e modifierFlags]);
|
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
|
||||||
break;
|
case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
|
||||||
default: break; /* for gcc */
|
case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
|
||||||
}
|
case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
|
||||||
|
case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
|
||||||
|
case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
|
||||||
|
case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
|
||||||
|
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
|
||||||
|
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
|
||||||
|
case NSTabletPoint:
|
||||||
|
pressure = [e pressure];
|
||||||
|
tilt_x = [e tilt].x;
|
||||||
|
tilt_y = [e tilt].y; // fall through
|
||||||
|
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
||||||
|
handle_mouse:
|
||||||
|
|
||||||
|
// if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure];
|
||||||
|
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
|
||||||
|
pressure, tilt_x, tilt_y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSScrollWheel:
|
||||||
|
DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
|
||||||
|
pressure, tilt_x, tilt_y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSKeyDown: case NSKeyUp:
|
||||||
|
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSFlagsChanged:
|
||||||
|
DarwinUpdateModKeys([e modifierFlags]);
|
||||||
|
break;
|
||||||
|
default: break; /* for gcc */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue