[vlc-commits] ActiveX, npapi: fixed not popping of control panel in fullscreen mode.

Sergey Radionov git at videolan.org
Thu Nov 17 10:38:20 CET 2011


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Thu Nov 17 11:32:44 2011 +0700| [5891386e6135963eda86d34c39f79c891b2ccdea] | committer: Jean-Baptiste Kempf

ActiveX, npapi: fixed not popping of control panel in fullscreen mode.

(was broken by "ActiveX, NpApi: DVD Menu control for VIDEO_TS")

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=5891386e6135963eda86d34c39f79c891b2ccdea
---

 common/win32_fullscreen.cpp |   70 ++++++++++++++++++++++++------------------
 common/win32_fullscreen.h   |   13 +++++--
 2 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp
index ef90bd0..5967a1d 100644
--- a/common/win32_fullscreen.cpp
+++ b/common/win32_fullscreen.cpp
@@ -36,8 +36,8 @@ ATOM VLCHolderWnd::_holder_wndclass_atom = 0;
 
 enum{
     WM_TRY_SET_MOUSE_HOOK = WM_USER+1,
-    WM_LBUTTONDBLCLK_NOTIFY = WM_APP+1,
-    WM_LBUTTONDBLCLK_NOTIFY_SUCCESS = 0xFF
+    WM_MOUSE_EVENT_NOTIFY = WM_APP+1,
+    WM_MOUSE_EVENT_NOTIFY_SUCCESS = 0xFF
 };
 
 void VLCHolderWnd::RegisterWndClassName(HINSTANCE hInstance)
@@ -130,10 +130,9 @@ LRESULT CALLBACK VLCHolderWnd::VLCHolderClassWndProc(HWND hWnd, UINT uMsg, WPARA
             }
             break;
         }
-        case WM_LBUTTONDBLCLK_NOTIFY:{
-            h_data->_WindowsManager->ToggleFullScreen();
-            return WM_LBUTTONDBLCLK_NOTIFY_SUCCESS;
-            break;
+        case WM_MOUSE_EVENT_NOTIFY:{
+            h_data->_WindowsManager->OnMouseEvent(wParam);
+            return WM_MOUSE_EVENT_NOTIFY_SUCCESS;
         }
         default:
             return DefWindowProc(hWnd, uMsg, wParam, lParam);
@@ -151,18 +150,24 @@ void VLCHolderWnd::DestroyWindow()
 LRESULT CALLBACK VLCHolderWnd::MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
 {
     bool AllowReceiveMessage = true;
-    if(nCode >= 0 && WM_LBUTTONDBLCLK == wParam){
-        MOUSEHOOKSTRUCT* mhs = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam);
-
-        //try find HolderWnd and notify it
-        HWND hNotifyWnd = mhs->hwnd;
-        LRESULT SMRes = ::SendMessage(hNotifyWnd, WM_LBUTTONDBLCLK_NOTIFY, 0, 0);
-        while( hNotifyWnd && WM_LBUTTONDBLCLK_NOTIFY_SUCCESS != SMRes){
-            hNotifyWnd = GetParent(hNotifyWnd);
-            SMRes = ::SendMessage(hNotifyWnd, WM_LBUTTONDBLCLK_NOTIFY, 0, 0);
-        }
+    if(nCode >= 0){
+        switch(wParam){
+            case WM_MOUSEMOVE:
+            case WM_LBUTTONDBLCLK:{
+                MOUSEHOOKSTRUCT* mhs = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam);
+
+                //try find HolderWnd and notify it
+                HWND hNotifyWnd = mhs->hwnd;
+                LRESULT SMRes = ::SendMessage(hNotifyWnd, WM_MOUSE_EVENT_NOTIFY, wParam, 0);
+                while( hNotifyWnd && WM_MOUSE_EVENT_NOTIFY_SUCCESS != SMRes){
+                    hNotifyWnd = GetParent(hNotifyWnd);
+                    SMRes = ::SendMessage(hNotifyWnd, WM_MOUSE_EVENT_NOTIFY, wParam, 0);
+                }
 
-        AllowReceiveMessage = (WM_LBUTTONDBLCLK_NOTIFY_SUCCESS != SMRes);
+                AllowReceiveMessage = WM_MOUSEMOVE==wParam || (WM_MOUSE_EVENT_NOTIFY_SUCCESS != SMRes);
+                break;
+            }
+        }
     }
 
     LRESULT NHRes = CallNextHookEx(NULL, nCode, wParam, lParam);
@@ -328,13 +333,6 @@ LRESULT CALLBACK VLCFullScreenWnd::FSWndWindowProc(HWND hWnd, UINT uMsg, WPARAM
             delete fs_data;
             SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
             break;
-        case WM_MOUSEMOVE:{
-            if(fs_data->Last_WM_MOUSEMOVE_lParam!=lParam){
-                fs_data->Last_WM_MOUSEMOVE_lParam = lParam;
-                fs_data->NeedShowControls();
-            }
-            break;
-        }
         case WM_SHOWWINDOW:{
             if(FALSE==wParam){ //hidding
                 fs_data->UnRegisterEvents();
@@ -471,11 +469,6 @@ LRESULT CALLBACK VLCFullScreenWnd::FSControlsWndWindowProc(HWND hWnd, UINT uMsg,
 
             break;
         }
-        case WM_MOUSEMOVE:{
-            fs_data->Last_WM_MOUSEMOVE_lParam = lParam;
-            fs_data->NeedShowControls();//not allow close controll window while mouse within
-            break;
-        }
         case WM_LBUTTONUP:{
             POINT BtnUpPoint = {LOWORD(lParam), HIWORD(lParam)};
             RECT VideoPosRect;
@@ -911,7 +904,8 @@ void VLCFullScreenWnd::UnRegisterEvents()
 //VLCWindowsManager
 ///////////////////////
 VLCWindowsManager::VLCWindowsManager(HMODULE hModule)
-    :_hModule(hModule), _hWindowedParentWnd(0), _HolderWnd(0), _FSWnd(0), _b_new_messages_flag(false)
+    :_hModule(hModule), _hWindowedParentWnd(0), _HolderWnd(0), _FSWnd(0),
+    _b_new_messages_flag(false), Last_WM_MOUSEMOVE_Pos(0)
 {
     VLCHolderWnd::RegisterWndClassName(hModule);
     VLCFullScreenWnd::RegisterWndClassName(hModule);
@@ -1019,3 +1013,19 @@ bool VLCWindowsManager::IsFullScreen()
     return 0!=_FSWnd && 0!=_HolderWnd && GetParent(_HolderWnd->getHWND())==_FSWnd->getHWND();
 }
 
+void VLCWindowsManager::OnMouseEvent(UINT uMouseMsg)
+{
+    switch(uMouseMsg){
+        case WM_LBUTTONDBLCLK:
+            ToggleFullScreen();
+            break;
+        case WM_MOUSEMOVE:{
+            DWORD MsgPos = GetMessagePos();
+            if(Last_WM_MOUSEMOVE_Pos != MsgPos){
+                Last_WM_MOUSEMOVE_Pos = MsgPos;
+                if(IsFullScreen()) _FSWnd->NeedShowControls();
+            }
+            break;
+        }
+    }
+}
diff --git a/common/win32_fullscreen.h b/common/win32_fullscreen.h
index 3f913a0..43a5009 100644
--- a/common/win32_fullscreen.h
+++ b/common/win32_fullscreen.h
@@ -98,7 +98,7 @@ private:
 
 private:
     VLCFullScreenWnd(HWND hWnd, VLCWindowsManager* WM)
-        : Last_WM_MOUSEMOVE_lParam(0),_WindowsManager(WM), hControlsWnd(0), hToolTipWnd(0),
+        : _WindowsManager(WM), hControlsWnd(0), hToolTipWnd(0),
          hNewMessageBitmap(0), hFSButtonBitmap(0), hFSButton(0),
          hPauseBitmap(0), hPlayBitmap(0), hPlayPauseButton(0), hVideoPosScroll(0),
          hVolumeBitmap(0), hVolumeMutedBitmap(0),hMuteButton(0),
@@ -130,14 +130,14 @@ private:
     void SyncVolumeSliderWithVLCVolume();
     void SetVLCVolumeBySliderPos(int CurScrollPos);
 
+public:
     void NeedShowControls();
-    void NeedHideControls();
 
 private:
-    void CreateToolTip();
+    void NeedHideControls();
 
 private:
-    LPARAM Last_WM_MOUSEMOVE_lParam;
+    void CreateToolTip();
 
 private:
     VLCWindowsManager* _WindowsManager;
@@ -207,6 +207,8 @@ public:
         {_b_new_messages_flag = Yes;};
     bool getNewMessageFlag() const
         {return _b_new_messages_flag;};
+public:
+    void OnMouseEvent(UINT uMouseMsg);
 
 private:
     HMODULE _hModule;
@@ -216,6 +218,9 @@ private:
     VLCFullScreenWnd* _FSWnd;
 
     bool _b_new_messages_flag;
+
+private:
+    DWORD Last_WM_MOUSEMOVE_Pos;
 };
 
 #endif //_WIN32



More information about the vlc-commits mailing list