Commit 79d45585 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Add registry settings to make Option keys send Alt rather than…

winemac: Add registry settings to make Option keys send Alt rather than accessing additional characters from the keyboard layout.
parent 05e3d0e5
......@@ -117,6 +117,24 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
*modifiers &= ~NX_ALTERNATEMASK;
}
static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modifiers)
{
fix_device_modifiers_by_generic(&modifiers);
if (left_option_is_alt && (modifiers & NX_DEVICELALTKEYMASK))
{
modifiers |= NX_DEVICELCMDKEYMASK;
modifiers &= ~NX_DEVICELALTKEYMASK;
}
if (right_option_is_alt && (modifiers & NX_DEVICERALTKEYMASK))
{
modifiers |= NX_DEVICERCMDKEYMASK;
modifiers &= ~NX_DEVICERALTKEYMASK;
}
fix_generic_modifiers_by_device(&modifiers);
return modifiers;
}
@interface WineContentView : NSView <NSTextInputClient>
{
......@@ -1253,7 +1271,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[self flagsChanged:theEvent];
[self postKey:[theEvent keyCode]
pressed:[theEvent type] == NSKeyDown
modifiers:[theEvent modifierFlags]
modifiers:adjusted_modifiers_for_option_behavior([theEvent modifierFlags])
event:theEvent];
}
......@@ -1416,7 +1434,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{ NX_DEVICERCMDKEYMASK, kVK_RightCommand },
};
NSUInteger modifierFlags = [theEvent modifierFlags];
NSUInteger modifierFlags = adjusted_modifiers_for_option_behavior([theEvent modifierFlags]);
NSUInteger changed;
int i, last_changed;
......
......@@ -143,6 +143,8 @@ struct macdrv_display {
extern int macdrv_err_on;
extern int topmost_float_inactive DECLSPEC_HIDDEN;
extern int capture_displays_for_fullscreen DECLSPEC_HIDDEN;
extern int left_option_is_alt DECLSPEC_HIDDEN;
extern int right_option_is_alt DECLSPEC_HIDDEN;
extern int macdrv_start_cocoa_app(unsigned long long tickcount) DECLSPEC_HIDDEN;
extern void macdrv_window_rejected_focus(const struct macdrv_event *event) DECLSPEC_HIDDEN;
......
......@@ -50,6 +50,8 @@ int capture_displays_for_fullscreen = 0;
BOOL skip_single_buffer_flushes = FALSE;
BOOL allow_vsync = TRUE;
BOOL allow_set_gamma = TRUE;
int left_option_is_alt = 0;
int right_option_is_alt = 0;
/**************************************************************************
......@@ -168,6 +170,11 @@ static void setup_options(void)
if (!get_config_key(hkey, appkey, "AllowSetGamma", buffer, sizeof(buffer)))
allow_set_gamma = IS_OPTION_TRUE(buffer[0]);
if (!get_config_key(hkey, appkey, "LeftOptionIsAlt", buffer, sizeof(buffer)))
left_option_is_alt = IS_OPTION_TRUE(buffer[0]);
if (!get_config_key(hkey, appkey, "RightOptionIsAlt", buffer, sizeof(buffer)))
right_option_is_alt = IS_OPTION_TRUE(buffer[0]);
if (appkey) RegCloseKey(appkey);
if (hkey) RegCloseKey(hkey);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment