XQuartz: Made X11Application.m a little more tidy.
(cherry picked from commit 3520386261b838196a8918e8bee16bdccbc9781d)
This commit is contained in:
parent
e917806fc5
commit
3c12483264
|
@ -70,6 +70,10 @@ X11Application *X11App;
|
||||||
|
|
||||||
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
||||||
|
|
||||||
|
@interface X11Application (Private)
|
||||||
|
- (void) sendX11NSEvent:(NSEvent *)e;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation X11Application
|
@implementation X11Application
|
||||||
|
|
||||||
typedef struct message_struct message;
|
typedef struct message_struct message;
|
||||||
|
@ -81,8 +85,6 @@ struct message_struct {
|
||||||
|
|
||||||
static mach_port_t _port;
|
static mach_port_t _port;
|
||||||
|
|
||||||
static void send_nsevent(NSEvent *e);
|
|
||||||
|
|
||||||
/* Quartz mode initialization routine. This is often dynamically loaded
|
/* Quartz mode initialization routine. This is often dynamically loaded
|
||||||
but is statically linked into this X server. */
|
but is statically linked into this X server. */
|
||||||
Bool QuartzModeBundleInit(void);
|
Bool QuartzModeBundleInit(void);
|
||||||
|
@ -195,11 +197,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) sendEvent:(NSEvent *)e {
|
- (void) sendEvent:(NSEvent *)e {
|
||||||
NSEventType type;
|
|
||||||
OSX_BOOL for_appkit, for_x;
|
OSX_BOOL for_appkit, for_x;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -322,7 +321,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
|
|
||||||
if (for_appkit) [super sendEvent:e];
|
if (for_appkit) [super sendEvent:e];
|
||||||
|
|
||||||
if (for_x) send_nsevent(e);
|
if (for_x) [self sendX11NSEvent:e];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_window_menu:(NSArray *)list {
|
- (void) set_window_menu:(NSArray *)list {
|
||||||
|
@ -862,27 +861,10 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
/* not reached */
|
/* not reached */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* event conversion */
|
@implementation X11Application (Private)
|
||||||
|
|
||||||
static inline unsigned short
|
|
||||||
convert_flags (unsigned int nsflags) {
|
|
||||||
unsigned int xflags = 0;
|
|
||||||
|
|
||||||
if (nsflags == ~0) return 0xffff;
|
|
||||||
|
|
||||||
if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask;
|
|
||||||
if (nsflags & NSShiftKeyMask) xflags |= ShiftMask;
|
|
||||||
if (nsflags & NSControlKeyMask) xflags |= ControlMask;
|
|
||||||
if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask;
|
|
||||||
if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask;
|
|
||||||
/* FIXME: secondaryfn? */
|
|
||||||
|
|
||||||
return xflags;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int darwin_modifier_flags; // darwinEvents.c
|
extern int darwin_modifier_flags; // darwinEvents.c
|
||||||
|
|
||||||
static void send_nsevent(NSEvent *e) {
|
- (void) sendX11NSEvent:(NSEvent *)e {
|
||||||
NSRect screen;
|
NSRect screen;
|
||||||
NSPoint location;
|
NSPoint location;
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
|
@ -1047,3 +1029,4 @@ static void send_nsevent(NSEvent *e) {
|
||||||
default: break; /* for gcc */
|
default: break; /* for gcc */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue