Fix deprecated macOS key modifiers
This commit is contained in:
parent
a33e6c03e4
commit
16edc52bae
|
@ -392,16 +392,16 @@ QKeySequence KeySequenceFromNSEvent(NSEvent* event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifiers & NSShiftKeyMask) {
|
if (modifiers & NSEventModifierFlagShift) {
|
||||||
key += Qt::SHIFT;
|
key += Qt::SHIFT;
|
||||||
}
|
}
|
||||||
if (modifiers & NSControlKeyMask) {
|
if (modifiers & NSEventModifierFlagControl) {
|
||||||
key += Qt::META;
|
key += Qt::META;
|
||||||
}
|
}
|
||||||
if (modifiers & NSAlternateKeyMask) {
|
if (modifiers & NSEventModifierFlagOption) {
|
||||||
key += Qt::ALT;
|
key += Qt::ALT;
|
||||||
}
|
}
|
||||||
if (modifiers & NSCommandKeyMask) {
|
if (modifiers & NSEventModifierFlagCommand) {
|
||||||
key += Qt::CTRL;
|
key += Qt::CTRL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,10 @@ class GlobalShortcutBackendMacOSPrivate : boost::noncopyable {
|
||||||
: global_monitor_(nil), local_monitor_(nil), backend_(backend) {}
|
: global_monitor_(nil), local_monitor_(nil), backend_(backend) {}
|
||||||
|
|
||||||
bool Register() {
|
bool Register() {
|
||||||
global_monitor_ = [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent* event) {
|
global_monitor_ = [NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent* event) {
|
||||||
HandleKeyEvent(event);
|
HandleKeyEvent(event);
|
||||||
} ];
|
} ];
|
||||||
local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent* event) {
|
local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent* event) {
|
||||||
// Filter event if we handle it as a global shortcut.
|
// Filter event if we handle it as a global shortcut.
|
||||||
return HandleKeyEvent(event) ? nil : event;
|
return HandleKeyEvent(event) ? nil : event;
|
||||||
} ];
|
} ];
|
||||||
|
|
|
@ -53,7 +53,7 @@ bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutGrabber::SetupMacEventHandler() {
|
void GlobalShortcutGrabber::SetupMacEventHandler() {
|
||||||
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSKeyDownMask handler:^(NSEvent* event) {
|
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSEventMaskKeyDown handler:^(NSEvent* event) {
|
||||||
return HandleMacEvent(event) ? event : nil;
|
return HandleMacEvent(event) ? event : nil;
|
||||||
}];
|
}];
|
||||||
wrapper_ = new MacMonitorWrapper(monitor);
|
wrapper_ = new MacMonitorWrapper(monitor);
|
||||||
|
|
Loading…
Reference in New Issue