[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - include/vcl sd/source vcl/osx vcl/win

Caolán McNamara caolanm at redhat.com
Mon Jan 19 08:26:08 PST 2015


 include/vcl/cmdevt.hxx                   |   28 ++++++++++++++++++----------
 sd/source/ui/app/sdmod1.cxx              |    8 +++++---
 sd/source/ui/slideshow/slideshowimpl.cxx |    7 ++++++-
 vcl/osx/salinst.cxx                      |    3 ++-
 vcl/win/source/window/salframe.cxx       |   13 +++++++------
 5 files changed, 38 insertions(+), 21 deletions(-)

New commits:
commit 45cf94410091478a09cc1eadc1b5510a5548ad15
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 15 11:10:03 2015 +0000

    Resolves: fdo#32664 pass keyboard media keys through to the OS
    
    if we didn't make use of them.
    
    (cherry picked from commit 508c020cf5f7999f0c23d972133f9b6bf85de245)
    
    Conflicts:
    	sw/source/uibase/docvw/edtwin.cxx
    	vcl/osx/salinst.cxx
    	vcl/win/source/window/salframe.cxx
    
    Change-Id: Iee1c2fef5966a614b068c832bf8c6b51973b4c8a
    Reviewed-on: https://gerrit.libreoffice.org/13993
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx
index 439e969..623356b 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 a4aff4d..9f18bf5 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 40c62cf..1566a82 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/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 8ee4351..164011e 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( EVENT_COMMAND, pWindow, &aCEvt );
 
             if ( !ImplCallPreNotify( aNCmdEvt ) )
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index e7cc293..b62d805 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -5181,7 +5181,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) )
@@ -5213,13 +5213,15 @@ static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam )
     if( pWindow )
     {
         const Point aPoint;
-        CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &nCommand );
-        NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt );
+        CommandMediaData aMediaData(nCommand);
+        CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &aMediaData );
+        NotifyEvent aNCmdEvt( VENT_COMMAND, pWindow, &aCEvt );
 
         if ( !ImplCallPreNotify( aNCmdEvt ) )
         {
             pWindow->Command( aCEvt );
-            return true;
+            nRet = 1;
+            return !aMediaData.GetPassThroughToOS();
         }
     }
 
@@ -5847,10 +5849,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:


More information about the Libreoffice-commits mailing list