[Libreoffice-commits] core.git: vcl/inc vcl/unx

Noel Grandin noel.grandin at collabora.co.uk
Wed Feb 8 12:37:10 UTC 2017


 vcl/inc/unx/salframe.h              |   13 ++++++++++++-
 vcl/inc/unx/wmadaptor.hxx           |   15 +--------------
 vcl/unx/generic/app/wmadaptor.cxx   |   20 +++++++++-----------
 vcl/unx/generic/window/salframe.cxx |   14 +++++++-------
 4 files changed, 29 insertions(+), 33 deletions(-)

New commits:
commit 20915bcbf45b4b0b4bc8c68c7df9eb6b13abbe06
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 8 12:24:39 2017 +0200

    convert WMWindowType to scoped enum
    
    and drop read-only ModalDialog enumerator
    
    Change-Id: Ie295e4863381401c73bd2a4151b94ad529c261fd
    Reviewed-on: https://gerrit.libreoffice.org/34023
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 16efb89..510ebd1 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -50,6 +50,17 @@ namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; }
 #define SHOWSTATE_NORMAL        1
 #define SHOWSTATE_HIDDEN        2
 
+enum class WMWindowType
+{
+    Normal,
+    ModalDialogue,
+    ModelessDialogue,
+    Utility,
+    Splash,
+    Toolbar,
+    Dock
+};
+
 class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public NativeWindowHandleProvider
 {
     friend class vcl_sal::WMAdaptor;
@@ -103,7 +114,7 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public NativeWindowHandl
     Timer           maAlwaysOnTopRaiseTimer;
 
     // data for WMAdaptor
-    int             meWindowType;
+    WMWindowType    meWindowType;
     int             mnDecorationFlags;
     bool            mbMaximizedVert;
     bool            mbMaximizedHorz;
diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx
index 817cea4..fbd87f9 100644
--- a/vcl/inc/unx/wmadaptor.hxx
+++ b/vcl/inc/unx/wmadaptor.hxx
@@ -27,6 +27,7 @@
 #include <X11/Xutil.h>
 
 #include <vclpluginapi.h>
+#include "salframe.h"
 #include <vector>
 
 class SalDisplay;
@@ -124,20 +125,6 @@ public:
     static const int decoration_CloseBtn        = 0x00000020;
     static const int decoration_All         = 0x10000000;
 
-    /*
-     *  window type
-     */
-    enum WMWindowType
-    {
-        windowType_Normal,
-        windowType_ModalDialogue,
-        windowType_ModelessDialogue,
-        windowType_Utility,
-        windowType_Splash,
-        windowType_Toolbar,
-        windowType_Dock
-    };
-
 protected:
     SalDisplay*             m_pSalDisplay;      // Display to use
     Display*                m_pDisplay;         // X Display of SalDisplay
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 6652bda..c8dfecb 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -1068,7 +1068,7 @@ void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const
 
         // set NET_WM_STATE_MODAL
         if( m_aWMAtoms[ NET_WM_STATE_MODAL ]
-            && pFrame->meWindowType == windowType_ModalDialogue )
+            && pFrame->meWindowType == WMWindowType::ModalDialogue )
         {
             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MODAL ];
             /*
@@ -1090,7 +1090,7 @@ void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const
             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
         if( pFrame->mbFullScreen && m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ];
-        if( pFrame->meWindowType == windowType_Utility && m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ] )
+        if( pFrame->meWindowType == WMWindowType::Utility && m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ] )
             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ];
 
         if( nStateAtoms )
@@ -1325,7 +1325,7 @@ void WMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eTy
         // evaluate window type
         switch( eType )
         {
-            case windowType_ModalDialogue:
+            case WMWindowType::ModalDialogue:
                 aHint.input_mode = 1;
                 break;
             default:
@@ -1383,24 +1383,23 @@ void NetWMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType
         int nWindowTypes = 0;
         switch( eType )
         {
-            case windowType_Utility:
+            case WMWindowType::Utility:
                 aWindowTypes[nWindowTypes++] =
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_UTILITY ] ?
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_UTILITY ] :
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DIALOG ];
                 break;
-            case windowType_ModelessDialogue:
-            case windowType_ModalDialogue:
+            case WMWindowType::ModelessDialogue:
                 aWindowTypes[nWindowTypes++] =
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DIALOG ];
                 break;
-            case windowType_Splash:
+            case WMWindowType::Splash:
                 aWindowTypes[nWindowTypes++] =
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_SPLASH ] ?
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_SPLASH ] :
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL ];
                 break;
-            case windowType_Toolbar:
+            case WMWindowType::Toolbar:
                 if( m_aWMAtoms[ KDE_NET_WM_WINDOW_TYPE_OVERRIDE ] )
                     aWindowTypes[nWindowTypes++] = m_aWMAtoms[ KDE_NET_WM_WINDOW_TYPE_OVERRIDE ];
                 aWindowTypes[nWindowTypes++] =
@@ -1408,7 +1407,7 @@ void NetWMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_TOOLBAR ] :
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL];
                 break;
-            case windowType_Dock:
+            case WMWindowType::Dock:
                 aWindowTypes[nWindowTypes++] =
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DOCK ] ?
                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DOCK ] :
@@ -1427,8 +1426,7 @@ void NetWMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType
                          reinterpret_cast<unsigned char*>(aWindowTypes),
                          nWindowTypes );
     }
-    if( ( eType == windowType_ModalDialogue ||
-          eType == windowType_ModelessDialogue )
+    if( ( eType == WMWindowType::ModelessDialogue )
         && ! pReferenceFrame )
     {
         XSetTransientForHint( m_pDisplay,
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 96b63e2..c6de508 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -713,18 +713,18 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen
                 nDecoFlags |= WMAdaptor::decoration_Title;
         }
 
-        WMAdaptor::WMWindowType eType = WMAdaptor::windowType_Normal;
+        WMWindowType eType = WMWindowType::Normal;
         if( nStyle_ & SalFrameStyleFlags::INTRO )
-            eType = WMAdaptor::windowType_Splash;
+            eType = WMWindowType::Splash;
         if( (nStyle_ & SalFrameStyleFlags::DIALOG) && hPresentationWindow == None )
-            eType = WMAdaptor::windowType_ModelessDialogue;
+            eType = WMWindowType::ModelessDialogue;
         if( nStyle_ & SalFrameStyleFlags::TOOLWINDOW )
-            eType = WMAdaptor::windowType_Utility;
+            eType = WMWindowType::Utility;
         if( nStyle_ & SalFrameStyleFlags::OWNERDRAWDECORATION )
-            eType = WMAdaptor::windowType_Toolbar;
+            eType = WMWindowType::Toolbar;
         if(    (nStyle_ & SalFrameStyleFlags::PARTIAL_FULLSCREEN)
             && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
-            eType = WMAdaptor::windowType_Dock;
+            eType = WMWindowType::Dock;
 
         GetDisplay()->getWMAdaptor()->
             setFrameTypeAndDecoration( this,
@@ -811,7 +811,7 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, SalFrameStyleFlags nSalFrameStyle,
     maAlwaysOnTopRaiseTimer.SetTimeout( 100 );
     maAlwaysOnTopRaiseTimer.SetDebugName( "vcl::X11SalFrame maAlwaysOnTopRaiseTimer" );
 
-    meWindowType                = WMAdaptor::windowType_Normal;
+    meWindowType                = WMWindowType::Normal;
     mnDecorationFlags           = WMAdaptor::decoration_All;
     mbMaximizedVert             = false;
     mbMaximizedHorz             = false;


More information about the Libreoffice-commits mailing list