mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-08 03:40:13 +01:00
XQuartz: Made X11Application.m a little more tidy.
This commit is contained in:
parent
fcdc9f8b5a
commit
3520386261
1 changed files with 8 additions and 25 deletions
|
|
@ -66,6 +66,10 @@ X11Application *X11App;
|
|||
|
||||
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
||||
|
||||
@interface X11Application (Private)
|
||||
- (void) sendX11NSEvent:(NSEvent *)e;
|
||||
@end
|
||||
|
||||
@implementation X11Application
|
||||
|
||||
typedef struct message_struct message;
|
||||
|
|
@ -77,8 +81,6 @@ struct message_struct {
|
|||
|
||||
static mach_port_t _port;
|
||||
|
||||
static void send_nsevent(NSEvent *e);
|
||||
|
||||
/* Quartz mode initialization routine. This is often dynamically loaded
|
||||
but is statically linked into this X server. */
|
||||
Bool QuartzModeBundleInit(void);
|
||||
|
|
@ -192,11 +194,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
}
|
||||
|
||||
- (void) sendEvent:(NSEvent *)e {
|
||||
NSEventType type;
|
||||
OSX_BOOL for_appkit, for_x;
|
||||
|
||||
type = [e type];
|
||||
|
||||
/* By default pass down the responder chain and to X. */
|
||||
for_appkit = YES;
|
||||
for_x = YES;
|
||||
|
|
@ -302,7 +301,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
|
||||
if (for_appkit) [super sendEvent:e];
|
||||
|
||||
if (for_x) send_nsevent(e);
|
||||
if (for_x) [self sendX11NSEvent:e];
|
||||
}
|
||||
|
||||
- (void) set_window_menu:(NSArray *)list {
|
||||
|
|
@ -841,27 +840,10 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
|||
/* not reached */
|
||||
}
|
||||
|
||||
/* event conversion */
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@implementation X11Application (Private)
|
||||
extern int darwin_modifier_flags; // darwinEvents.c
|
||||
|
||||
static void send_nsevent(NSEvent *e) {
|
||||
- (void) sendX11NSEvent:(NSEvent *)e {
|
||||
NSRect screen;
|
||||
NSPoint location;
|
||||
NSWindow *window;
|
||||
|
|
@ -938,3 +920,4 @@ static void send_nsevent(NSEvent *e) {
|
|||
default: break; /* for gcc */
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue