diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-15 11:10:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-15 11:17:27 +0000 |
commit | 508c020cf5f7999f0c23d972133f9b6bf85de245 (patch) | |
tree | 9f3b7164d450040eff9353fbb2da01ed25800539 | |
parent | 313d7125eaf87f7af2af6bc1a6d1bac8fc7b2f0e (diff) |
Resolves: fdo#32664 pass keyboard media keys through to the OS
if we didn't make use of them.
Change-Id: Iee1c2fef5966a614b068c832bf8c6b51973b4c8a
-rw-r--r-- | include/vcl/cmdevt.hxx | 28 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod1.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 4 | ||||
-rw-r--r-- | vcl/osx/salinst.cxx | 3 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 11 |
6 files changed, 39 insertions, 22 deletions
diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx index bd4df39d234d..6e85c1ef8360 100644 --- a/include/vcl/cmdevt.hxx +++ b/include/vcl/cmdevt.hxx @@ -270,10 +270,7 @@ class VCL_DLLPUBLIC CommandDialogData int GetDialogId() const { return m_nDialogId; } }; - // Media Commands - - #define MEDIA_COMMAND_CHANNEL_DOWN ((sal_Int16)1) // Decrement the channel value, for example, for a TV or radio tuner. #define MEDIA_COMMAND_CHANNEL_UP ((sal_Int16)2) // Increment the channel value, for example, for a TV or radio tuner. #define MEDIA_COMMAND_NEXTTRACK ((sal_Int16)3) // Go to next media track/slide. @@ -297,11 +294,22 @@ class VCL_DLLPUBLIC CommandDialogData #define MEDIA_COMMAND_NEXTTRACK_HOLD ((sal_Int16)21)// Button Right holding pressed. #define MEDIA_COMMAND_PREVIOUSTRACK_HOLD ((sal_Int16)22)// Button Left holding pressed. - +class VCL_DLLPUBLIC CommandMediaData +{ + sal_Int16 m_nMediaId; + bool m_bPassThroughToOS; +public: + CommandMediaData(sal_Int16 nMediaId) + : m_nMediaId(nMediaId) + , m_bPassThroughToOS(true) + { + } + sal_Int16 GetMediaId() const { return m_nMediaId; } + void SetPassThroughToOS(bool bPassThroughToOS) { m_bPassThroughToOS = bPassThroughToOS; } + bool GetPassThroughToOS() const { return m_bPassThroughToOS; } +}; // - CommandSelectionChangeData - - - class VCL_DLLPUBLIC CommandSelectionChangeData { private: @@ -377,7 +385,7 @@ public: const CommandScrollData* GetAutoScrollData() const; const CommandModKeyData* GetModKeyData() const; const CommandDialogData* GetDialogData() const; - sal_Int16 GetMediaCommand() const; + CommandMediaData* GetMediaData() const; const CommandSelectionChangeData* GetSelectionChangeData() const; }; @@ -445,12 +453,12 @@ inline const CommandDialogData* CommandEvent::GetDialogData() const return NULL; } -inline sal_Int16 CommandEvent::GetMediaCommand() const +inline CommandMediaData* CommandEvent::GetMediaData() const { if( mnCommand == COMMAND_MEDIA ) - return *(const sal_Int16*)(mpData); + return (CommandMediaData*)(mpData); else - return 0; + return NULL; } inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() const diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 672ccdd17879..cba122f4c784 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -428,7 +428,9 @@ IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent ) if( rEvent.GetCommand() == COMMAND_MEDIA ) { - switch( rEvent.GetMediaCommand() ) + CommandMediaData* pMediaData = rEvent.GetMediaData(); + pMediaData->SetPassThroughToOS(false); + switch (pMediaData->GetMediaId()) { case MEDIA_COMMAND_PLAY: { @@ -441,10 +443,10 @@ IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent ) if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ) pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION ); } - } break; - + } default: + pMediaData->SetPassThroughToOS(true); break; } } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 38a0351771f7..861d783b9e9b 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2001,7 +2001,9 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent ) if( rEvent.GetCommand() == COMMAND_MEDIA ) { - switch( rEvent.GetMediaCommand() ) + CommandMediaData* pMediaData = rEvent.GetMediaData(); + pMediaData->SetPassThroughToOS(false); + switch (pMediaData->GetMediaId()) { #if defined( MACOSX ) case MEDIA_COMMAND_MENU: @@ -2057,6 +2059,9 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent ) } endPresentation(); break; + default: + pMediaData->SetPassThroughToOS(true); + break; } } } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 61d1093871a1..7001bf040ae6 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5383,8 +5383,8 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) break; case COMMAND_MODKEYCHANGE : { - const CommandModKeyData* pCommandData = static_cast<const CommandModKeyData*>(rCEvt.GetEventData()); - if(pCommandData->IsMod1() && !pCommandData->IsMod2()) + const CommandModKeyData* pCommandData = rCEvt.GetModKeyData(); + if (pCommandData->IsMod1() && !pCommandData->IsMod2()) { sal_uInt16 nSlot = 0; if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift()) diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index ed420914638e..f89917be0601 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -524,7 +524,8 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) if( pWindow ) { const Point aPoint; - CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &nCommand ); + CommandMediaData aMediaData(nCommand); + CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &aMediaData ); NotifyEvent aNCmdEvt( MouseNotifyEvent::COMMAND, pWindow, &aCEvt ); if ( !ImplCallPreNotify( aNCmdEvt ) ) diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index cdffe0fe4c9d..eb8f548f97ac 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -5178,7 +5178,7 @@ static bool ImplHandleIMEEndComposition( HWND hWnd ) return bDef; } -static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) +static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam, LRESULT & nRet ) { sal_Int16 nCommand = 0; switch( GET_APPCOMMAND_LPARAM(lParam) ) @@ -5210,13 +5210,15 @@ static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) if( pWindow ) { const Point aPoint; - CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &nCommand ); + CommandMediaData aMediaData(nCommand); + CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &aMediaData ); NotifyEvent aNCmdEvt( MouseNotifyEvent::COMMAND, pWindow, &aCEvt ); if ( !ImplCallPreNotify( aNCmdEvt ) ) { pWindow->Command( aCEvt ); - return true; + nRet = 1; + return !aMediaData.GetPassThroughToOS(); } } @@ -5844,10 +5846,9 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP break; case WM_APPCOMMAND: - if( ImplHandleAppCommand( hWnd, lParam ) ) + if( ImplHandleAppCommand( hWnd, lParam, nRet ) ) { rDef = false; - nRet = 1; } break; case WM_IME_REQUEST: |