[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/osx vcl/source vcl/unx vcl/win
Noel Grandin
noel at peralex.com
Wed May 11 07:55:09 UTC 2016
vcl/headless/svpframe.cxx | 2 +-
vcl/inc/headless/svpframe.hxx | 2 +-
vcl/inc/osx/salframe.h | 2 +-
vcl/inc/salframe.hxx | 17 ++++++++++++-----
vcl/inc/unx/gtk/gtkframe.hxx | 2 +-
vcl/inc/unx/salframe.h | 2 +-
vcl/inc/win/salframe.h | 2 +-
vcl/osx/salframe.cxx | 6 +++---
vcl/osx/salframeview.mm | 2 +-
vcl/source/window/mouse.cxx | 2 +-
vcl/source/window/stacking.cxx | 10 +++++-----
vcl/unx/generic/window/salframe.cxx | 12 ++++++------
vcl/unx/gtk/gtksalframe.cxx | 6 +++---
vcl/unx/gtk3/gtk3gtkframe.cxx | 6 +++---
vcl/win/window/salframe.cxx | 14 +++++++-------
15 files changed, 47 insertions(+), 40 deletions(-)
New commits:
commit 10cc455580b2349e99ac48732cc451f7e2126953
Author: Noel Grandin <noel at peralex.com>
Date: Tue May 10 12:54:24 2016 +0200
convert SAL_FRAME_TOTOP to scoped enum
Change-Id: Id996e1e6fc29f6323bd4e82785386de26d075cae
Reviewed-on: https://gerrit.libreoffice.org/24834
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index f8b29f6..7a6add2 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -364,7 +364,7 @@ void SvpSalFrame::SetAlwaysOnTop( bool )
{
}
-void SvpSalFrame::ToTop( sal_uInt16 )
+void SvpSalFrame::ToTop( SalFrameToTop )
{
GetFocus();
}
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index 4b0be15..bcf504e 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -90,7 +90,7 @@ public:
virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
virtual void StartPresentation( bool bStart ) override;
virtual void SetAlwaysOnTop( bool bOnTop ) override;
- virtual void ToTop( sal_uInt16 nFlags ) override;
+ virtual void ToTop( SalFrameToTop nFlags ) override;
virtual void SetPointer( PointerStyle ePointerStyle ) override;
virtual void CaptureMouse( bool bMouse ) override;
virtual void SetPointerPos( long nX, long nY ) override;
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index f6520d4..d2593d9 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -125,7 +125,7 @@ public:
virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
virtual void StartPresentation( bool bStart ) override;
virtual void SetAlwaysOnTop( bool bOnTop ) override;
- virtual void ToTop( sal_uInt16 nFlags ) override;
+ virtual void ToTop( SalFrameToTop nFlags ) override;
virtual void SetPointer( PointerStyle ePointerStyle ) override;
virtual void CaptureMouse( bool bMouse ) override;
virtual void SetPointerPos( long nX, long nY ) override;
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 8bf79f35..16a8f85 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -26,6 +26,7 @@
#include <vcl/help.hxx>
#include <vcl/window.hxx>
+#include <o3tl/typed_flags_set.hxx>
// complete vcl::Window for SalFrame::CallCallback under -fsanitize=function
@@ -39,10 +40,16 @@ struct SalInputContext;
struct SystemEnvData;
// SalFrame types
-#define SAL_FRAME_TOTOP_RESTOREWHENMIN ((sal_uInt16)0x0001)
-#define SAL_FRAME_TOTOP_FOREGROUNDTASK ((sal_uInt16)0x0002)
-#define SAL_FRAME_TOTOP_GRABFOCUS ((sal_uInt16)0x0004)
-#define SAL_FRAME_TOTOP_GRABFOCUS_ONLY ((sal_uInt16)0x0008)
+enum class SalFrameToTop {
+ NONE = 0x00,
+ RestoreWhenMin = 0x01,
+ ForegroundTask = 0x02,
+ GrabFocus = 0x04,
+ GrabFocusOnly = 0x08
+};
+namespace o3tl {
+ template<> struct typed_flags<SalFrameToTop> : is_typed_flags<SalFrameToTop, 0x0f> {};
+};
// SalFrame styles
enum class SalFrameStyleFlags
@@ -160,7 +167,7 @@ public:
virtual void SetAlwaysOnTop( bool bOnTop ) = 0;
// Window to top and grab focus
- virtual void ToTop( sal_uInt16 nFlags ) = 0;
+ virtual void ToTop( SalFrameToTop nFlags ) = 0;
// this function can call with the same
// pointer style
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 6e08818..38b6c1b 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -461,7 +461,7 @@ public:
virtual void SetAlwaysOnTop( bool bOnTop ) override;
// Window to top and grab focus
- virtual void ToTop( sal_uInt16 nFlags ) override;
+ virtual void ToTop( SalFrameToTop nFlags ) override;
// this function can call with the same
// pointer style
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 036e7f2..f5773c0 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -228,7 +228,7 @@ public:
virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nMonitor ) override;
virtual void StartPresentation( bool bStart ) override;
virtual void SetAlwaysOnTop( bool bOnTop ) override;
- virtual void ToTop( sal_uInt16 nFlags ) override;
+ virtual void ToTop( SalFrameToTop nFlags ) override;
virtual void SetPointer( PointerStyle ePointerStyle ) override;
virtual void CaptureMouse( bool bMouse ) override;
virtual void SetPointerPos( long nX, long nY ) override;
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 5b8edcb..2d19ccf 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -106,7 +106,7 @@ public:
virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override;
virtual void StartPresentation( bool bStart ) override;
virtual void SetAlwaysOnTop( bool bOnTop ) override;
- virtual void ToTop( sal_uInt16 nFlags ) override;
+ virtual void ToTop( SalFrameToTop nFlags ) override;
virtual void SetPointer( PointerStyle ePointerStyle ) override;
virtual void CaptureMouse( bool bMouse ) override;
virtual void SetPointerPos( long nX, long nY ) override;
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index ff25e34..dae0aef 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -797,7 +797,7 @@ void AquaSalFrame::SetAlwaysOnTop( bool )
{
}
-void AquaSalFrame::ToTop(sal_uInt16 nFlags)
+void AquaSalFrame::ToTop(SalFrameToTop nFlags)
{
if ( !mpNSWindow )
return;
@@ -805,12 +805,12 @@ void AquaSalFrame::ToTop(sal_uInt16 nFlags)
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
- if( ! (nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN) )
+ if( ! (nFlags & SalFrameToTop::RestoreWhenMin) )
{
if( ! [mpNSWindow isVisible] || [mpNSWindow isMiniaturized] )
return;
}
- if( nFlags & SAL_FRAME_TOTOP_GRABFOCUS )
+ if( nFlags & SalFrameToTop::GrabFocus )
[mpNSWindow makeKeyAndOrderFront: NSApp];
else
[mpNSWindow orderFront: NSApp];
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 0da1737..219c681 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -394,7 +394,7 @@ static AquaSalFrame* getMouseContainerFrame()
SolarMutexGuard aGuard;
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
- mpFrame->ToTop( SAL_FRAME_TOTOP_RESTOREWHENMIN | SAL_FRAME_TOTOP_GRABFOCUS );
+ mpFrame->ToTop( SalFrameToTop::RestoreWhenMin | SalFrameToTop::GrabFocus );
}
-(css::uno::Reference < css::accessibility::XAccessibleContext >)accessibleContext
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 4782c15..516b6ed 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -305,7 +305,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
{
// here we already switch focus as ToTop()
// should not give focus to another window
- mpWindowImpl->mpFrame->ToTop( SAL_FRAME_TOTOP_GRABFOCUS | SAL_FRAME_TOTOP_GRABFOCUS_ONLY );
+ mpWindowImpl->mpFrame->ToTop( SalFrameToTop::GrabFocus | SalFrameToTop::GrabFocusOnly );
return;
}
}
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index 8418919..cb51c6d 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -252,13 +252,13 @@ void Window::ImplToTop( ToTopFlags nFlags )
// do not bring floating windows on the client to top
if( !ImplGetClientWindow() || !(ImplGetClientWindow()->GetStyle() & WB_SYSTEMFLOATWIN) )
{
- sal_uInt16 nSysFlags = 0;
+ SalFrameToTop nSysFlags = SalFrameToTop::NONE;
if ( nFlags & ToTopFlags::RestoreWhenMin )
- nSysFlags |= SAL_FRAME_TOTOP_RESTOREWHENMIN;
+ nSysFlags |= SalFrameToTop::RestoreWhenMin;
if ( nFlags & ToTopFlags::ForegroundTask )
- nSysFlags |= SAL_FRAME_TOTOP_FOREGROUNDTASK;
+ nSysFlags |= SalFrameToTop::ForegroundTask;
if ( nFlags & ToTopFlags::GrabFocusOnly )
- nSysFlags |= SAL_FRAME_TOTOP_GRABFOCUS_ONLY;
+ nSysFlags |= SalFrameToTop::GrabFocusOnly;
mpWindowImpl->mpFrame->ToTop( nSysFlags );
}
}
@@ -985,7 +985,7 @@ void Window::SetParent( vcl::Window* pNewParent )
mpWindowImpl->mpFrameData->mpFocusWin = Application::GetFocusWindow();
if ( !mpWindowImpl->mpFrameData->mbHasFocus )
{
- mpWindowImpl->mpFrame->ToTop( 0 );
+ mpWindowImpl->mpFrame->ToTop( SalFrameToTop::NONE );
}
}
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 947ca79..0b10f17 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1359,9 +1359,9 @@ void X11SalFrame::Show( bool bVisible, bool bNoActivate )
}
}
-void X11SalFrame::ToTop( sal_uInt16 nFlags )
+void X11SalFrame::ToTop( SalFrameToTop nFlags )
{
- if( ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ if( ( nFlags & SalFrameToTop::RestoreWhenMin )
&& ! ( nStyle_ & SalFrameStyleFlags::FLOAT )
&& nShowState_ != SHOWSTATE_HIDDEN
&& nShowState_ != SHOWSTATE_UNKNOWN
@@ -1374,16 +1374,16 @@ void X11SalFrame::ToTop( sal_uInt16 nFlags )
}
::Window aToTopWindow = IsSysChildWindow() ? GetWindow() : GetShellWindow();
- if( ! (nFlags & SAL_FRAME_TOTOP_GRABFOCUS_ONLY) )
+ if( ! (nFlags & SalFrameToTop::GrabFocusOnly) )
{
XRaiseWindow( GetXDisplay(), aToTopWindow );
if( ! GetDisplay()->getWMAdaptor()->isTransientBehaviourAsExpected() )
for( std::list< X11SalFrame* >::const_iterator it = maChildren.begin();
it != maChildren.end(); ++it )
- (*it)->ToTop( nFlags & ~SAL_FRAME_TOTOP_GRABFOCUS );
+ (*it)->ToTop( nFlags & ~SalFrameToTop::GrabFocus );
}
- if( ( ( nFlags & SAL_FRAME_TOTOP_GRABFOCUS ) || ( nFlags & SAL_FRAME_TOTOP_GRABFOCUS_ONLY ) )
+ if( ( ( nFlags & SalFrameToTop::GrabFocus ) || ( nFlags & SalFrameToTop::GrabFocusOnly ) )
&& bMapped_ )
{
if( m_bXEmbed )
@@ -3565,7 +3565,7 @@ long X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent )
IMPL_LINK_NOARG_TYPED(X11SalFrame, HandleAlwaysOnTopRaise, Timer *, void)
{
if( bMapped_ )
- ToTop( 0 );
+ ToTop( SalFrameToTop::NONE );
}
long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index daf064d..7e118f0 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2164,7 +2164,7 @@ void GtkSalFrame::SetAlwaysOnTop( bool bOnTop )
gtk_window_set_keep_above( GTK_WINDOW( m_pWindow ), bOnTop );
}
-void GtkSalFrame::ToTop( sal_uInt16 nFlags )
+void GtkSalFrame::ToTop( SalFrameToTop nFlags )
{
if( m_pWindow )
{
@@ -2172,7 +2172,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
gtk_widget_grab_focus( m_pWindow );
else if( IS_WIDGET_MAPPED( m_pWindow ) )
{
- if( ! (nFlags & SAL_FRAME_TOTOP_GRABFOCUS_ONLY) )
+ if( ! (nFlags & SalFrameToTop::GrabFocusOnly) )
gtk_window_present( GTK_WINDOW(m_pWindow) );
else
{
@@ -2197,7 +2197,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
}
else
{
- if( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ if( nFlags & SalFrameToTop::RestoreWhenMin )
gtk_window_present( GTK_WINDOW(m_pWindow) );
}
}
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index b6352c6..ada90e7 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1999,7 +1999,7 @@ void GtkSalFrame::SetAlwaysOnTop( bool bOnTop )
gtk_window_set_keep_above( GTK_WINDOW( m_pWindow ), bOnTop );
}
-void GtkSalFrame::ToTop( sal_uInt16 nFlags )
+void GtkSalFrame::ToTop( SalFrameToTop nFlags )
{
if( m_pWindow )
{
@@ -2007,7 +2007,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
gtk_widget_grab_focus( m_pWindow );
else if( IS_WIDGET_MAPPED( m_pWindow ) )
{
- if( ! (nFlags & SAL_FRAME_TOTOP_GRABFOCUS_ONLY) )
+ if( ! (nFlags & SalFrameToTop::GrabFocusOnly) )
gtk_window_present( GTK_WINDOW(m_pWindow) );
else
{
@@ -2017,7 +2017,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
}
else
{
- if( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ if( nFlags & SalFrameToTop::RestoreWhenMin )
gtk_window_present( GTK_WINDOW(m_pWindow) );
}
}
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 5ac0cbd..fd5d207 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1960,13 +1960,13 @@ void WinSalFrame::SetAlwaysOnTop( bool bOnTop )
SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
}
-static void ImplSalToTop( HWND hWnd, sal_uInt16 nFlags )
+static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
{
WinSalFrame* pToTopFrame = GetWindowPtr( hWnd );
if( pToTopFrame && (pToTopFrame->mnStyle & SalFrameStyleFlags::SYSTEMCHILD) )
BringWindowToTop( hWnd );
- if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK )
+ if ( nFlags & SalFrameToTop::ForegroundTask )
{
// This magic code is necessary to connect the input focus of the
// current window thread and the thread which owns the window that
@@ -1979,7 +1979,7 @@ static void ImplSalToTop( HWND hWnd, sal_uInt16 nFlags )
AttachThreadInput(myThreadID,currThreadID,FALSE);
}
- if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ if ( nFlags & SalFrameToTop::RestoreWhenMin )
{
HWND hIconicWnd = hWnd;
while ( hIconicWnd )
@@ -2013,15 +2013,15 @@ static void ImplSalToTop( HWND hWnd, sal_uInt16 nFlags )
}
}
-void WinSalFrame::ToTop( sal_uInt16 nFlags )
+void WinSalFrame::ToTop( SalFrameToTop nFlags )
{
- nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32
+ nFlags &= ~SalFrameToTop::GrabFocus; // this flag is not needed on win32
// Post this Message to the window, because this only works
// in the thread of the window, which has create this window.
// We post this message to avoid deadlocks
if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() )
{
- BOOL const ret = PostMessageW( mhWnd, SAL_MSG_TOTOP, nFlags, 0 );
+ BOOL const ret = PostMessageW( mhWnd, SAL_MSG_TOTOP, (WPARAM)nFlags, 0 );
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
}
else
@@ -5782,7 +5782,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
rDef = FALSE;
break;
case SAL_MSG_TOTOP:
- ImplSalToTop( hWnd, (sal_uInt16)wParam );
+ ImplSalToTop( hWnd, (SalFrameToTop)wParam );
rDef = FALSE;
break;
case SAL_MSG_SHOW:
More information about the Libreoffice-commits
mailing list