diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-20 15:17:41 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-22 17:51:29 +0000 |
commit | a0ac522f6b9850c478c28bb54cafe82fed95a389 (patch) | |
tree | 47371efd15b8f93d03f0e48158d2407da2e8eca0 /vcl | |
parent | 835de2917eb2941150edc38285e41488380323e0 (diff) |
Convert SetType to scoped enum
Change-Id: I1f724340a990ce8a811fa84e1f5fc54fad54ae81
Reviewed-on: https://gerrit.libreoffice.org/25198
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalframe.cxx | 28 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 28 |
3 files changed, 26 insertions, 35 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 7c0803bac568..14a9818d09b3 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -342,7 +342,10 @@ class GtkSalFrame : public SalFrame void TriggerPaintEvent(); void updateWMClass(); - void SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize = nullptr ); + + enum class SetType { RetainSize, Fullscreen, UnFullscreen }; + + void SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize = nullptr ); public: #if GTK_CHECK_VERSION(3,0,0) diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 83e8836dff49..0c6e315f9a41 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -1935,18 +1935,12 @@ bool GtkSalFrame::GetWindowState( SalFrameState* pState ) return true; } -typedef enum { - SET_RETAIN_SIZE, - SET_FULLSCREEN, - SET_UN_FULLSCREEN -} SetType; - -void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize ) +void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize ) { if( !m_pWindow ) return; - if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SET_RETAIN_SIZE) + if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SetType::RetainSize) return; GdkScreen *pScreen = nullptr; @@ -2011,7 +2005,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz if( bVisible ) Show( false ); - if( eType == SET_FULLSCREEN ) + if( eType == SetType::Fullscreen ) { maGeometry.nX = aNewMonitor.x; maGeometry.nY = aNewMonitor.y; @@ -2026,7 +2020,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz m_aMaxSize.Height() = aNewMonitor.height; } - if( pSize && eType == SET_UN_FULLSCREEN ) + if( pSize && eType == SetType::UnFullscreen ) { maGeometry.nX = pSize->Left(); maGeometry.nY = pSize->Top(); @@ -2053,13 +2047,13 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { - if( eType == SET_FULLSCREEN ) + if( eType == SetType::Fullscreen ) gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); - else if( eType == SET_UN_FULLSCREEN ) + else if( eType == SetType::UnFullscreen ) gtk_window_unfullscreen( GTK_WINDOW( m_pWindow ) ); } - if( eType == SET_UN_FULLSCREEN && + if( eType == SetType::UnFullscreen && !(m_nStyle & SalFrameStyleFlags::SIZEABLE) ) gtk_window_set_resizable( GTK_WINDOW( m_pWindow ), FALSE ); @@ -2068,7 +2062,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz SetParent( nullptr ); std::list< GtkSalFrame* > aChildren = m_aChildren; for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it ) - (*it)->SetScreen( nNewScreen, SET_RETAIN_SIZE ); + (*it)->SetScreen( nNewScreen, SetType::RetainSize ); m_bDefaultPos = m_bDefaultSize = false; updateScreenNumber(); @@ -2080,7 +2074,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) { - SetScreen( nNewScreen, SET_RETAIN_SIZE ); + SetScreen( nNewScreen, SetType::RetainSize ); } void GtkSalFrame::updateWMClass() @@ -2131,11 +2125,11 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) { m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ), Size( maGeometry.nWidth, maGeometry.nHeight ) ); - SetScreen( nScreen, SET_FULLSCREEN ); + SetScreen( nScreen, SetType::Fullscreen ); } else { - SetScreen( nScreen, SET_UN_FULLSCREEN, + SetScreen( nScreen, SetType::UnFullscreen, !m_aRestorePosSize.IsEmpty() ? &m_aRestorePosSize : nullptr ); m_aRestorePosSize = Rectangle(); } diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 7eaa53cd1b2b..0bb9bf740416 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -1786,18 +1786,12 @@ bool GtkSalFrame::GetWindowState( SalFrameState* pState ) return true; } -typedef enum { - SET_RETAIN_SIZE, - SET_FULLSCREEN, - SET_UN_FULLSCREEN -} SetType; - -void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize ) +void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize ) { if( !m_pWindow ) return; - if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SET_RETAIN_SIZE) + if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SetType::RetainSize) return; int nX = maGeometry.nX, nY = maGeometry.nY, @@ -1864,7 +1858,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz if( bVisible ) Show( false ); - if( eType == SET_FULLSCREEN ) + if( eType == SetType::Fullscreen ) { nX = aNewMonitor.x; nY = aNewMonitor.y; @@ -1879,7 +1873,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz m_aMaxSize.Height() = aNewMonitor.height; } - if( pSize && eType == SET_UN_FULLSCREEN ) + if( pSize && eType == SetType::UnFullscreen ) { nX = pSize->Left(); nY = pSize->Top(); @@ -1903,12 +1897,12 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz gdk_window_set_fullscreen_mode( widget_get_window(m_pWindow), m_bSpanMonitorsWhenFullscreen ? GDK_FULLSCREEN_ON_ALL_MONITORS : GDK_FULLSCREEN_ON_CURRENT_MONITOR ); #endif - if( eType == SET_FULLSCREEN ) + if( eType == SetType::Fullscreen ) gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); - else if( eType == SET_UN_FULLSCREEN ) + else if( eType == SetType::UnFullscreen ) gtk_window_unfullscreen( GTK_WINDOW( m_pWindow ) ); - if( eType == SET_UN_FULLSCREEN && + if( eType == SetType::UnFullscreen && !(m_nStyle & SalFrameStyleFlags::SIZEABLE) ) gtk_window_set_resizable( GTK_WINDOW( m_pWindow ), FALSE ); @@ -1917,7 +1911,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz SetParent( nullptr ); std::list< GtkSalFrame* > aChildren = m_aChildren; for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it ) - (*it)->SetScreen( nNewScreen, SET_RETAIN_SIZE ); + (*it)->SetScreen( nNewScreen, SetType::RetainSize ); m_bDefaultPos = m_bDefaultSize = false; updateScreenNumber(); @@ -1928,7 +1922,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) { - SetScreen( nNewScreen, SET_RETAIN_SIZE ); + SetScreen( nNewScreen, SetType::RetainSize ); } void GtkSalFrame::updateWMClass() @@ -1978,11 +1972,11 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) if( bFullScreen ) { m_aRestorePosSize = GetPosAndSize(GTK_WINDOW(m_pWindow)); - SetScreen( nScreen, SET_FULLSCREEN ); + SetScreen( nScreen, SetType::Fullscreen ); } else { - SetScreen( nScreen, SET_UN_FULLSCREEN, + SetScreen( nScreen, SetType::UnFullscreen, !m_aRestorePosSize.IsEmpty() ? &m_aRestorePosSize : nullptr ); m_aRestorePosSize = Rectangle(); } |