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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-02-08 12:24:39 +02:00
parent eb1352bb40
commit 20915bcbf4
4 changed files with 29 additions and 33 deletions

View File

@ -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;

View File

@ -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

View File

@ -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,

View File

@ -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;