mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Change global shortcuts on Mac to be eaten.
Update issue #722 Fixed on Mac.
This commit is contained in:
parent
c65a687678
commit
4570d891f2
@ -44,7 +44,7 @@ protected:
|
||||
void DoUnregister();
|
||||
|
||||
private:
|
||||
void KeyPressed(const QKeySequence& sequence);
|
||||
bool KeyPressed(const QKeySequence& sequence);
|
||||
|
||||
QMap<QKeySequence, QAction*> shortcuts_;
|
||||
|
||||
|
@ -49,8 +49,8 @@ class MacGlobalShortcutBackendPrivate : boost::noncopyable {
|
||||
}];
|
||||
local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask
|
||||
handler:^(NSEvent* event) {
|
||||
HandleKeyEvent(event);
|
||||
return event;
|
||||
// Filter event if we handle it as a global shortcut.
|
||||
return HandleKeyEvent(event) ? nil : event;
|
||||
}];
|
||||
return true;
|
||||
#else
|
||||
@ -108,9 +108,9 @@ class MacGlobalShortcutBackendPrivate : boost::noncopyable {
|
||||
return QKeySequence(key);
|
||||
}
|
||||
|
||||
void HandleKeyEvent(NSEvent* event) {
|
||||
bool HandleKeyEvent(NSEvent* event) {
|
||||
QKeySequence sequence = GetSequence(event);
|
||||
backend_->KeyPressed(sequence);
|
||||
return backend_->KeyPressed(sequence);
|
||||
}
|
||||
|
||||
static int MapFunctionKey(int keycode) {
|
||||
@ -218,14 +218,16 @@ void MacGlobalShortcutBackend::MacMediaKeyPressed(int key) {
|
||||
}
|
||||
}
|
||||
|
||||
void MacGlobalShortcutBackend::KeyPressed(const QKeySequence& sequence) {
|
||||
bool MacGlobalShortcutBackend::KeyPressed(const QKeySequence& sequence) {
|
||||
if (sequence.isEmpty()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
QAction* action = shortcuts_[sequence];
|
||||
if (action) {
|
||||
action->trigger();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user