X(INT, NONE, erase_to_scrollback) \
X(INT, NONE, compose_key) \
X(INT, NONE, ctrlaltkeys) \
+ X(INT, NONE, osx_option_meta) \
+ X(INT, NONE, osx_command_meta) \
X(STR, NONE, wintitle) /* initial window title */ \
/* Terminal options */ \
X(INT, NONE, savelines) \
write_setting_i(sesskey, "AltOnly", conf_get_int(conf, CONF_alt_only));
write_setting_i(sesskey, "ComposeKey", conf_get_int(conf, CONF_compose_key));
write_setting_i(sesskey, "CtrlAltKeys", conf_get_int(conf, CONF_ctrlaltkeys));
+#ifdef OSX_META_KEY_CONFIG
+ write_setting_i(sesskey, "OSXOptionMeta", conf_get_int(conf, CONF_osx_option_meta));
+ write_setting_i(sesskey, "OSXCommandMeta", conf_get_int(conf, CONF_osx_command_meta));
+#endif
write_setting_i(sesskey, "TelnetKey", conf_get_int(conf, CONF_telnet_keyboard));
write_setting_i(sesskey, "TelnetRet", conf_get_int(conf, CONF_telnet_newline));
write_setting_i(sesskey, "LocalEcho", conf_get_int(conf, CONF_localecho));
gppi(sesskey, "AltOnly", 0, conf, CONF_alt_only);
gppi(sesskey, "ComposeKey", 0, conf, CONF_compose_key);
gppi(sesskey, "CtrlAltKeys", 1, conf, CONF_ctrlaltkeys);
+#ifdef OSX_META_KEY_CONFIG
+ gppi(sesskey, "OSXOptionMeta", 1, conf, CONF_osx_option_meta);
+ gppi(sesskey, "OSXCommandMeta", 0, conf, CONF_osx_command_meta);
+#endif
gppi(sesskey, "TelnetKey", 0, conf, CONF_telnet_keyboard);
gppi(sesskey, "TelnetRet", 1, conf, CONF_telnet_newline);
gppi(sesskey, "LocalEcho", AUTO, conf, CONF_localecho);
conf_checkbox_handler,
I(CONF_utf8_override));
+#ifdef OSX_META_KEY_CONFIG
+ /*
+ * On OS X, there are multiple reasonable opinions about whether
+ * Option or Command (or both, or neither) should act as a Meta
+ * key, or whether they should have their normal OS functions.
+ */
+ s = ctrl_getset(b, "Terminal/Keyboard", "meta",
+ "Choose the Meta key:");
+ ctrl_checkbox(s, "Option key acts as Meta", 'p',
+ HELPCTX(no_help),
+ conf_checkbox_handler, I(CONF_osx_option_meta));
+ ctrl_checkbox(s, "Command key acts as Meta", 'm',
+ HELPCTX(no_help),
+ conf_checkbox_handler, I(CONF_osx_command_meta));
+#endif
+
if (!midsession) {
/*
* Allow the user to specify the window class as part of the saved
int window_border;
int cursor_type;
int drawtype;
+ int meta_mod_mask;
};
static void cache_conf_values(struct gui_data *inst)
inst->bold_style = conf_get_int(inst->conf, CONF_bold_style);
inst->window_border = conf_get_int(inst->conf, CONF_window_border);
inst->cursor_type = conf_get_int(inst->conf, CONF_cursor_type);
+#ifdef OSX_META_KEY_CONFIG
+ inst->meta_mod_mask = 0;
+ if (conf_get_int(inst->conf, CONF_osx_option_meta))
+ inst->meta_mod_mask |= GDK_MOD1_MASK;
+ if (conf_get_int(inst->conf, CONF_osx_command_meta))
+ inst->meta_mod_mask |= GDK_MOD2_MASK;
+#else
+ inst->meta_mod_mask = GDK_MOD1_MASK;
+#endif
}
struct draw_ctx {
}
/*
- * If we're seeing a numberpad key press with Mod1 down,
+ * If we're seeing a numberpad key press with Meta down,
* consider adding it to alt_keycode if that's sensible.
- * Anything _else_ with Mod1 down cancels any possibility
+ * Anything _else_ with Meta down cancels any possibility
* of an ALT keycode: we set alt_keycode to -2.
*/
- if ((event->state & GDK_MOD1_MASK) && inst->alt_keycode != -2) {
+ if ((event->state & inst->meta_mod_mask) && inst->alt_keycode != -2) {
int digit = -1;
switch (event->keyval) {
case GDK_KEY_KP_0: case GDK_KEY_KP_Insert: digit = 0; break;
output[lenof(output)-1] = '\0';
end = strlen(output);
}
- if (event->state & GDK_MOD1_MASK) {
+ if (event->state & inst->meta_mod_mask) {
start = 0;
if (end == 1) end = 0;
} else
shift = state & GDK_SHIFT_MASK;
ctrl = state & GDK_CONTROL_MASK;
- alt = state & GDK_MOD1_MASK;
+ alt = state & inst->meta_mod_mask;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_int(inst->conf,
shift = event->state & GDK_SHIFT_MASK;
ctrl = event->state & GDK_CONTROL_MASK;
- alt = event->state & GDK_MOD1_MASK;
+ alt = event->state & inst->meta_mod_mask;
if (event->state & GDK_BUTTON1_MASK)
button = MBT_LEFT;
else if (event->state & GDK_BUTTON2_MASK)
#define NOT_X_WINDOWS /* of course, all the X11 stuff should be disabled */
#define NO_PTY_PRE_INIT /* OS X gets very huffy if we try to set[ug]id */
#define SET_NONBLOCK_VIA_OPENPT /* work around missing fcntl functionality */
+#define OSX_META_KEY_CONFIG /* two possible Meta keys to choose from */
#endif
struct Filename {