summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2019-02-23 21:40:34 +0800
committerMark Hung <marklh9@gmail.com>2019-02-24 00:52:28 +0100
commita798926550ab3ea8613f28a7be2672ebe9e7dfbe (patch)
treedf7027b7bf7918ff01e1b739a6555b62eb3b7719 /avmedia
parentecdcc847cd5d9b1370801d42b740bd616c475477 (diff)
tdf#123653 pass WM messages to the parent window.
Use cbWndExtra so that MediaPlayerWndProc can get the Window pointer. Do not handle mouse event WM messages in MediaPlayerWndProc and pass them to parent window because Slideshow handles the message themselvs. Change-Id: Ie790e06eb3813bc3b63f78f25cf6e1640c58dee2 Reviewed-on: https://gerrit.libreoffice.org/68242 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/win/window.cxx57
-rw-r--r--avmedia/source/win/window.hxx1
2 files changed, 3 insertions, 55 deletions
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 9b90787d728b..dcc13eae7421 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -59,60 +59,7 @@ static LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, L
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
- {
- awt::MouseEvent aUNOEvt;
- POINT aWinPoint;
-
- if( !::GetCursorPos( &aWinPoint ) || !::ScreenToClient( hWnd, &aWinPoint ) )
- {
- aWinPoint.x = GET_X_LPARAM( nPar2 );
- aWinPoint.y = GET_Y_LPARAM( nPar2 );
- }
- aUNOEvt.Modifiers = 0;
- aUNOEvt.Buttons = 0;
- aUNOEvt.X = aWinPoint.x;
- aUNOEvt.Y = aWinPoint.y;
- aUNOEvt.PopupTrigger = false;
-
- // Modifiers
- if( nPar1 & MK_SHIFT )
- aUNOEvt.Modifiers |= awt::KeyModifier::SHIFT;
-
- if( nPar1 & MK_CONTROL )
- aUNOEvt.Modifiers |= awt::KeyModifier::MOD1;
-
- // Buttons
- if( WM_LBUTTONDOWN == nMsg || WM_LBUTTONUP == nMsg )
- aUNOEvt.Buttons |= awt::MouseButton::LEFT;
-
- if( WM_MBUTTONDOWN == nMsg || WM_MBUTTONUP == nMsg )
- aUNOEvt.Buttons |= awt::MouseButton::MIDDLE;
-
- if( WM_RBUTTONDOWN == nMsg || WM_RBUTTONUP == nMsg )
- aUNOEvt.Buttons |= awt::MouseButton::RIGHT;
-
- // event type
- if( WM_LBUTTONDOWN == nMsg ||
- WM_MBUTTONDOWN == nMsg ||
- WM_RBUTTONDOWN == nMsg )
- {
- aUNOEvt.ClickCount = 1;
- pWindow->fireMousePressedEvent( aUNOEvt );
- }
- else if( WM_LBUTTONUP == nMsg ||
- WM_MBUTTONUP == nMsg ||
- WM_RBUTTONUP == nMsg )
- {
- aUNOEvt.ClickCount = 1;
- pWindow->fireMouseReleasedEvent( aUNOEvt );
- }
- else if( WM_MOUSEMOVE == nMsg )
- {
- aUNOEvt.ClickCount = 0;
- pWindow->fireMouseMovedEvent( aUNOEvt );
- pWindow->updatePointer();
- }
- }
+ PostMessage(pWindow->getParentWnd(), nMsg, nPar1, nPar2);
break;
case WM_SETFOCUS:
@@ -139,7 +86,7 @@ static WNDCLASSW* lcl_getWndClass()
memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
s_pWndClass->hInstance = GetModuleHandleW( nullptr );
- s_pWndClass->cbWndExtra = sizeof( DWORD );
+ s_pWndClass->cbWndExtra = sizeof( DWORD_PTR );
s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
s_pWndClass->lpszClassName = L"com_sun_star_media_PlayerWnd";
s_pWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx
index 7f7da597ccd8..32ae3504f6d5 100644
--- a/avmedia/source/win/window.hxx
+++ b/avmedia/source/win/window.hxx
@@ -93,6 +93,7 @@ public:
void fireKeyPressedEvent( const css::awt::KeyEvent& rEvt );
void fireKeyReleasedEvent( const css::awt::KeyEvent& rEvt );
void fireSetFocusEvent( const css::awt::FocusEvent& rEvt );
+ HWND getParentWnd() const { return mnParentWnd; }
private: