Fixing no keyup events while command is pressed on mac
This commit is contained in:
parent
b280722b1c
commit
91cc66a52a
|
@ -701,7 +701,14 @@ mac_toggle_fullscreen(void){
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidChangeBackingProperties{
|
- (void)viewDidChangBackingProperties{
|
||||||
|
NSWindow* window = self.window;
|
||||||
|
f32 max_dpi = [window screen].backingScaleFactor;
|
||||||
|
mac_vars.screen_scale_factor = max_dpi;
|
||||||
|
|
||||||
|
// TODO(PS): we want to call try_modify_face here for all active faces
|
||||||
|
// try_modify_face(app, face_id, &description);
|
||||||
|
|
||||||
// TODO(yuval): If the screen scale factor changed, modify the current face to use the new screen scale factor.
|
// TODO(yuval): If the screen scale factor changed, modify the current face to use the new screen scale factor.
|
||||||
mac_resize(mac_vars.window);
|
mac_resize(mac_vars.window);
|
||||||
}
|
}
|
||||||
|
@ -1209,22 +1216,6 @@ mac_toggle_fullscreen(void){
|
||||||
} else {
|
} else {
|
||||||
mac_vars.active_key_stroke = 0;
|
mac_vars.active_key_stroke = 0;
|
||||||
mac_vars.active_text_input = 0;
|
mac_vars.active_text_input = 0;
|
||||||
|
|
||||||
if (key != 0){
|
|
||||||
// NOTE(PS): when releasing the command key, assume all keys being pressed
|
|
||||||
// are released
|
|
||||||
if (key == KeyCode_Command) {
|
|
||||||
mods->count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Input_Event *event = push_input_event(&mac_vars.frame_arena, &mac_vars.input_chunk.trans.event_list);
|
|
||||||
event->kind = InputEventKind_KeyRelease;
|
|
||||||
event->key.code = key;
|
|
||||||
event->key.modifiers = copy_modifier_set(&mac_vars.frame_arena, mods);
|
|
||||||
|
|
||||||
remove_modifier(mods, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
system_signal_step(0);
|
system_signal_step(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1261,6 +1252,15 @@ main(int arg_count, char **args){
|
||||||
FCoder_App_Delegate *app_delegate = [[FCoder_App_Delegate alloc] init];
|
FCoder_App_Delegate *app_delegate = [[FCoder_App_Delegate alloc] init];
|
||||||
[NSApp setDelegate:app_delegate];
|
[NSApp setDelegate:app_delegate];
|
||||||
|
|
||||||
|
// workaround for "no key-up sent while Cmd is pressed" taken from GLFW:
|
||||||
|
NSEvent* (^keyup_monitor)(NSEvent*) = ^NSEvent* (NSEvent* event) {
|
||||||
|
if ([event modifierFlags] & NSEventModifierFlagCommand) {
|
||||||
|
[[NSApp keyWindow] sendEvent:event];
|
||||||
|
}
|
||||||
|
return event;
|
||||||
|
};
|
||||||
|
id keyup_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp handler:keyup_monitor];
|
||||||
|
|
||||||
mac_init_recursive_mutex(&memory_tracker_mutex);
|
mac_init_recursive_mutex(&memory_tracker_mutex);
|
||||||
|
|
||||||
// NOTE(yuval): Context setup
|
// NOTE(yuval): Context setup
|
||||||
|
|
Loading…
Reference in New Issue