mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -05:00
OS X: pass Command key back to GTK if it's not being Meta.
This fixes the problem I'd previously noticed, that if you don't configure the "Command key acts as Meta" setting, then keystrokes like Command-Q which _ought_ to function as accelerators for the application menu bar don't. Turns out that this was for the totally obvious reason: the keyboard event was still being processed by gtkwin.c's key_event() and translated via the GTK IM into ordinary keyboard input. If instead I return FALSE from key_event on detecting that a key event has a non-Meta-configured Command modifier, then it will go to the next- level key-event handler inside GTK itself which implements the menu accelerator behaviour. Another problem ticked off the OS X checklist.
This commit is contained in:
@ -168,6 +168,9 @@ struct gui_data {
|
||||
int cursor_type;
|
||||
int drawtype;
|
||||
int meta_mod_mask;
|
||||
#ifdef OSX_META_KEY_CONFIG
|
||||
int system_mod_mask;
|
||||
#endif
|
||||
};
|
||||
|
||||
static void cache_conf_values(struct gui_data *inst)
|
||||
@ -181,6 +184,7 @@ static void cache_conf_values(struct gui_data *inst)
|
||||
inst->meta_mod_mask |= GDK_MOD1_MASK;
|
||||
if (conf_get_int(inst->conf, CONF_osx_command_meta))
|
||||
inst->meta_mod_mask |= GDK_MOD2_MASK;
|
||||
inst->system_mod_mask = GDK_MOD2_MASK & ~inst->meta_mod_mask;
|
||||
#else
|
||||
inst->meta_mod_mask = GDK_MOD1_MASK;
|
||||
#endif
|
||||
@ -780,6 +784,11 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
int ucsval, start, end, special, output_charset, use_ucsoutput;
|
||||
int nethack_mode, app_keypad_mode;
|
||||
|
||||
#ifdef OSX_META_KEY_CONFIG
|
||||
if (event->state & inst->system_mod_mask)
|
||||
return FALSE; /* let GTK process OS X Command key */
|
||||
#endif
|
||||
|
||||
/* Remember the timestamp. */
|
||||
inst->input_event_time = event->time;
|
||||
|
||||
|
Reference in New Issue
Block a user