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