瀏覽代碼

OSX: restore moude hiding hack on playback start

This is most likely the VTDecompressionSessionCreate issue again (it
doesn't reproduce if hardware decoding is disabled). We had something
quite similar before, but removed it recently. This commit adds it back,
in a slightly "better" way.

Reproduction steps:
- move mouse cursor to dock
- start PMP (in fullscreen mode)
- use keyboard to start playback (hw decoding on)
- mouse cursor will become visible and stay visible

The bad part is that it "flickers" slightly on start. I'm hoping nobody
minds.
Vincent Lang 8 年之前
父節點
當前提交
db8cccdd6b
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 1 0
      src/system/SystemComponent.h
  2. 13 0
      src/ui/KonvergoWindow.cpp

+ 1 - 0
src/system/SystemComponent.h

@@ -82,6 +82,7 @@ public:
   bool isWebClientConnected() const { return !m_webClientVersion.isEmpty(); }
 
   inline QString authenticationToken() { return m_authenticationToken; }
+  inline bool cursorVisible() { return m_cursorVisible; }
 
   Q_INVOKABLE void crashApp();
 

+ 13 - 0
src/ui/KonvergoWindow.cpp

@@ -295,6 +295,19 @@ void KonvergoWindow::playerWindowVisible(bool visible)
   QQuickItem *web = findChild<QQuickItem *>("web");
   if (web)
     web->setProperty("backgroundColor", visible ? "transparent" : "#111111");
+
+#ifdef Q_OS_MAC
+  // On OSX, initializing VideoTooolbox (hardware decoder API) will mysteriously
+  // show the hidden mouse pointer again. The VTDecompressionSessionCreate API
+  // function does this, and we have no influence over its behavior.
+  if (visible && !SystemComponent::Get().cursorVisible())
+  {
+    // "Refresh" it. (There doesn't seem to be a nicer way, and we have to do
+    // this on the Cocoa level too.)
+    SystemComponent::Get().setCursorVisibility(true);
+    SystemComponent::Get().setCursorVisibility(false);
+  }
+#endif
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////