XQuartz: Only call DarwinUpdateModKeys when needed
Previously, we were calling it on almost every itteration through sendX11Event
(cherry picked from commit 6461729647
)
This commit is contained in:
parent
1c88a68bed
commit
3e02b987cc
|
@ -65,6 +65,7 @@ extern BOOL xpbproxy_init (void);
|
||||||
|
|
||||||
/* Stuck modifier / button state... force release when we context switch */
|
/* Stuck modifier / button state... force release when we context switch */
|
||||||
static NSEventType keyState[NUM_KEYCODES];
|
static NSEventType keyState[NUM_KEYCODES];
|
||||||
|
static int modifierFlagsMask;
|
||||||
|
|
||||||
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
|
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
|
||||||
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
||||||
|
@ -200,7 +201,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DarwinUpdateModKeys(0);
|
if(darwin_modifier_flags)
|
||||||
|
DarwinUpdateModKeys(0);
|
||||||
for(i=0; i < NUM_KEYCODES; i++) {
|
for(i=0; i < NUM_KEYCODES; i++) {
|
||||||
if(keyState[i] == NSKeyDown) {
|
if(keyState[i] == NSKeyDown) {
|
||||||
DarwinSendKeyboardEvents(KeyRelease, i);
|
DarwinSendKeyboardEvents(KeyRelease, i);
|
||||||
|
@ -872,6 +874,7 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
|
||||||
|
|
||||||
void X11ApplicationMain (int argc, char **argv, char **envp) {
|
void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
int *p;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
|
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
|
||||||
|
@ -916,6 +919,10 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
|
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(p=darwin_modifier_mask_list, modifierFlagsMask=0; *p; p++) {
|
||||||
|
modifierFlagsMask |= *p;
|
||||||
|
}
|
||||||
|
|
||||||
/* Tell the server thread that it can proceed */
|
/* Tell the server thread that it can proceed */
|
||||||
QuartzInitServer(argc, argv, envp);
|
QuartzInitServer(argc, argv, envp);
|
||||||
|
|
||||||
|
@ -932,7 +939,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation X11Application (Private)
|
@implementation X11Application (Private)
|
||||||
extern int darwin_modifier_flags; // darwinEvents.c
|
|
||||||
|
|
||||||
#ifdef NX_DEVICELCMDKEYMASK
|
#ifdef NX_DEVICELCMDKEYMASK
|
||||||
/* This is to workaround a bug in the VNC server where we sometimes see the L
|
/* This is to workaround a bug in the VNC server where we sometimes see the L
|
||||||
|
@ -987,6 +993,8 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
|
||||||
modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
|
modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
modifierFlags &= modifierFlagsMask;
|
||||||
|
|
||||||
/* We don't receive modifier key events while out of focus, and 3button
|
/* We don't receive modifier key events while out of focus, and 3button
|
||||||
* emulation mucks this up, so we need to check our modifier flag state
|
* emulation mucks this up, so we need to check our modifier flag state
|
||||||
* on every event... ugg
|
* on every event... ugg
|
||||||
|
|
|
@ -146,7 +146,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
|
||||||
* Send events to update the modifier state.
|
* Send events to update the modifier state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int modifier_mask_list[] = {
|
int darwin_modifier_mask_list[] = {
|
||||||
#ifdef NX_DEVICELCMDKEYMASK
|
#ifdef NX_DEVICELCMDKEYMASK
|
||||||
NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK,
|
NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK,
|
||||||
NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK,
|
NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK,
|
||||||
|
@ -173,7 +173,7 @@ static void DarwinUpdateModifiers(
|
||||||
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
|
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(f=modifier_mask_list; *f; f++)
|
for(f=darwin_modifier_mask_list; *f; f++)
|
||||||
if(*f & flags) {
|
if(*f & flags) {
|
||||||
key = DarwinModifierNXMaskToNXKey(*f);
|
key = DarwinModifierNXMaskToNXKey(*f);
|
||||||
if(key == -1)
|
if(key == -1)
|
||||||
|
|
|
@ -78,4 +78,7 @@ enum {
|
||||||
/* Send one of the above events to the server thread. */
|
/* Send one of the above events to the server thread. */
|
||||||
void DarwinSendDDXEvent(int type, int argc, ...);
|
void DarwinSendDDXEvent(int type, int argc, ...);
|
||||||
|
|
||||||
|
extern int darwin_modifier_mask_list[];
|
||||||
|
extern int darwin_modifier_flags;
|
||||||
|
|
||||||
#endif /* _DARWIN_EVENTS_H */
|
#endif /* _DARWIN_EVENTS_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user