瀏覽代碼

Fixes for media keys on windows

Tobias Hieta 8 年之前
父節點
當前提交
d9b88754b2
共有 1 個文件被更改,包括 11 次插入3 次删除
  1. 11 3
      src/ui/EventFilter.cpp

+ 11 - 3
src/ui/EventFilter.cpp

@@ -30,15 +30,23 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
     // the host yet. We just want to handle some specific keyboard
     // events.
     //
-    if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
+    if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease || event->type() == QEvent::ShortcutOverride)
     {
       QKeyEvent* key = dynamic_cast<QKeyEvent*>(event);
-      if (key && key->spontaneous())
+
+      if (key)
       {
+        InputBase::InputkeyState keystatus;
+
+        if (event->type() == QEvent::KeyPress)
+          keystatus = InputBase::KeyDown;
+        else
+          keystatus = InputBase::KeyUp;
+
         QKeySequence seq(key->key() | (key->modifiers() &= ~Qt::KeypadModifier));
         if (desktopWhiteListedKeys.contains(seq.toString()))
         {
-          InputKeyboard::Get().keyPress(seq, InputBase::KeyPressed);
+          InputKeyboard::Get().keyPress(seq, keystatus);
           return true;
         }
       }