summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-24 12:07:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-25 07:03:08 +0000
commit63a6de2cab00e949751fcb35f4814844fc4ec71e (patch)
treec745e6d946e076f75ebaa31849ef2a77bd81b868 /vcl
parentdaf9156c76049873583f1f7c5de96524d7eba68a (diff)
convert MODKEY constants to o3tl::typed_flags
Change-Id: I53a6f6f6b12e0fb299e7d76e8e8f354ef3afbbb3 Reviewed-on: https://gerrit.libreoffice.org/31152 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/salwtype.hxx3
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx2
-rw-r--r--vcl/inc/unx/salframe.h2
-rw-r--r--vcl/source/window/commandevent.cxx2
-rw-r--r--vcl/unx/generic/window/salframe.cxx28
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx26
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx26
-rw-r--r--vcl/win/window/salframe.cxx32
8 files changed, 61 insertions, 60 deletions
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index b7f803eee86e..4b27a3e99c6b 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -33,6 +33,7 @@ enum class InputContextFlags;
enum class WindowStateMask;
enum class WindowStateState;
enum class ExtTextInputAttr;
+enum class ModKeyFlags;
enum class SalEvent {
NONE,
@@ -123,7 +124,7 @@ struct SalKeyModEvent
{
sal_uInt64 mnTime; // Time in ms, when event is created
sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2)
- sal_uInt16 mnModKeyCode; // extended Modifier (MODKEY_LEFT,MODKEY_RIGHT,MODKEY_PRESS,MODKEY_RELEASE)
+ ModKeyFlags mnModKeyCode; // extended Modifier (MODKEY_LEFT,MODKEY_RIGHT,MODKEY_PRESS,MODKEY_RELEASE)
};
struct SalPaintEvent
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 0f22d4661373..5d61c5a57b06 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -186,7 +186,7 @@ class GtkSalFrame : public SalFrame
SystemEnvData m_aSystemData;
GtkSalGraphics *m_pGraphics;
bool m_bGraphics;
- sal_uInt16 m_nKeyModifiers;
+ ModKeyFlags m_nKeyModifiers;
GdkCursor *m_pCurrentCursor;
GdkVisibilityState m_nVisibility;
PointerStyle m_ePointerStyle;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 2c0be07f4b82..16efb896e8cf 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -79,7 +79,7 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public NativeWindowHandl
sal_uInt16 nKeyCode_; // last key code
sal_uInt16 nKeyState_; // last key state
bool mbSendExtKeyModChange;
- sal_uInt16 mnExtKeyMod;
+ ModKeyFlags mnExtKeyMod;
int nShowState_; // show state
int nWidth_; // client width
diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx
index e7f7dcd8569d..6a1f140287fd 100644
--- a/vcl/source/window/commandevent.cxx
+++ b/vcl/source/window/commandevent.cxx
@@ -100,7 +100,7 @@ CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY )
mnDeltaY = nDeltaY;
}
-CommandModKeyData::CommandModKeyData( sal_uInt16 nCode )
+CommandModKeyData::CommandModKeyData( ModKeyFlags nCode )
{
mnCode = nCode;
}
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index ab8ad79d553c..ba4c190e5f36 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -779,7 +779,7 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, SalFrameStyleFlags nSalFrameStyle,
nKeyCode_ = 0;
nKeyState_ = 0;
mbSendExtKeyModChange = false;
- mnExtKeyMod = 0;
+ mnExtKeyMod = ModKeyFlags::NONE;
nShowState_ = SHOWSTATE_UNKNOWN;
nWidth_ = 0;
@@ -3036,57 +3036,57 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
|| nKeySym == XK_Super_L || nKeySym == XK_Super_R )
{
SalKeyModEvent aModEvt;
- aModEvt.mnModKeyCode = 0;
- if( pEvent->type == KeyPress && mnExtKeyMod == 0 )
+ aModEvt.mnModKeyCode = ModKeyFlags::NONE;
+ if( pEvent->type == KeyPress && mnExtKeyMod == ModKeyFlags::NONE )
mbSendExtKeyModChange = true;
else if( pEvent->type == KeyRelease && mbSendExtKeyModChange )
{
aModEvt.mnModKeyCode = mnExtKeyMod;
- mnExtKeyMod = 0;
+ mnExtKeyMod = ModKeyFlags::NONE;
}
// pressing just the ctrl key leads to a keysym of XK_Control but
// the event state does not contain ControlMask. In the release
// event it's the other way round: it does contain the Control mask.
// The modifier mode therefore has to be adapted manually.
- sal_uInt16 nExtModMask = 0;
+ ModKeyFlags nExtModMask = ModKeyFlags::NONE;
sal_uInt16 nModMask = 0;
switch( nKeySym )
{
case XK_Control_L:
- nExtModMask = MODKEY_LMOD1;
+ nExtModMask = ModKeyFlags::LeftMod1;
nModMask = KEY_MOD1;
break;
case XK_Control_R:
- nExtModMask = MODKEY_RMOD1;
+ nExtModMask = ModKeyFlags::RightMod1;
nModMask = KEY_MOD1;
break;
case XK_Alt_L:
- nExtModMask = MODKEY_LMOD2;
+ nExtModMask = ModKeyFlags::LeftMod2;
nModMask = KEY_MOD2;
break;
case XK_Alt_R:
- nExtModMask = MODKEY_RMOD2;
+ nExtModMask = ModKeyFlags::RightMod2;
nModMask = KEY_MOD2;
break;
case XK_Shift_L:
- nExtModMask = MODKEY_LSHIFT;
+ nExtModMask = ModKeyFlags::LeftShift;
nModMask = KEY_SHIFT;
break;
case XK_Shift_R:
- nExtModMask = MODKEY_RSHIFT;
+ nExtModMask = ModKeyFlags::RightShift;
nModMask = KEY_SHIFT;
break;
// Map Meta/Super keys to MOD3 modifier on all Unix systems
// except Mac OS X
case XK_Meta_L:
case XK_Super_L:
- nExtModMask = MODKEY_LMOD3;
+ nExtModMask = ModKeyFlags::LeftMod3;
nModMask = KEY_MOD3;
break;
case XK_Meta_R:
case XK_Super_R:
- nExtModMask = MODKEY_RMOD3;
+ nExtModMask = ModKeyFlags::RightMod3;
nModMask = KEY_MOD3;
break;
}
@@ -3319,7 +3319,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
{
mbInputFocus = False;
mbSendExtKeyModChange = false;
- mnExtKeyMod = 0;
+ mnExtKeyMod = ModKeyFlags::NONE;
return CallCallback( SalEvent::LoseFocus, nullptr );
}
}
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index d83ebe48e7a6..c5cac3813e91 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -964,7 +964,7 @@ void GtkSalFrame::InitCommon()
// init members
m_pCurrentCursor = nullptr;
- m_nKeyModifiers = 0;
+ m_nKeyModifiers = ModKeyFlags::NONE;
m_bFullscreen = false;
m_bSpanMonitorsWhenFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
@@ -2986,7 +2986,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
if( !pEvent->in )
{
- pThis->m_nKeyModifiers = 0;
+ pThis->m_nKeyModifiers = ModKeyFlags::NONE;
pThis->m_bSendModChangeOnRelease = false;
}
@@ -3105,8 +3105,8 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
sal_uInt16 nModCode = GetKeyModCode( pEvent->state );
- aModEvt.mnModKeyCode = 0; // emit no MODKEYCHANGE events
- if( pEvent->type == GDK_KEY_PRESS && !pThis->m_nKeyModifiers )
+ aModEvt.mnModKeyCode = ModKeyFlags::NONE; // emit no MODKEYCHANGE events
+ if( pEvent->type == GDK_KEY_PRESS && pThis->m_nKeyModifiers == ModKeyFlags::NONE )
pThis->m_bSendModChangeOnRelease = true;
else if( pEvent->type == GDK_KEY_RELEASE &&
@@ -3115,7 +3115,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
}
- sal_uInt16 nExtModMask = 0;
+ ModKeyFlags nExtModMask = ModKeyFlags::NONE;
sal_uInt16 nModMask = 0;
// pressing just the ctrl key leads to a keysym of XK_Control but
// the event state does not contain ControlMask. In the release
@@ -3124,39 +3124,39 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
switch( pEvent->keyval )
{
case GDK_KEY_Control_L:
- nExtModMask = MODKEY_LMOD1;
+ nExtModMask = ModKeyFlags::LeftMod1;
nModMask = KEY_MOD1;
break;
case GDK_KEY_Control_R:
- nExtModMask = MODKEY_RMOD1;
+ nExtModMask = ModKeyFlags::RightMod1;
nModMask = KEY_MOD1;
break;
case GDK_KEY_Alt_L:
- nExtModMask = MODKEY_LMOD2;
+ nExtModMask = ModKeyFlags::LeftMod2;
nModMask = KEY_MOD2;
break;
case GDK_KEY_Alt_R:
- nExtModMask = MODKEY_RMOD2;
+ nExtModMask = ModKeyFlags::RightMod2;
nModMask = KEY_MOD2;
break;
case GDK_KEY_Shift_L:
- nExtModMask = MODKEY_LSHIFT;
+ nExtModMask = ModKeyFlags::LeftShift;
nModMask = KEY_SHIFT;
break;
case GDK_KEY_Shift_R:
- nExtModMask = MODKEY_RSHIFT;
+ nExtModMask = ModKeyFlags::RightShift;
nModMask = KEY_SHIFT;
break;
// Map Meta/Super to MOD3 modifier on all Unix systems
// except Mac OS X
case GDK_KEY_Meta_L:
case GDK_KEY_Super_L:
- nExtModMask = MODKEY_LMOD3;
+ nExtModMask = ModKeyFlags::LeftMod3;
nModMask = KEY_MOD3;
break;
case GDK_KEY_Meta_R:
case GDK_KEY_Super_R:
- nExtModMask = MODKEY_RMOD3;
+ nExtModMask = ModKeyFlags::RightMod3;
nModMask = KEY_MOD3;
break;
}
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 645f80076b5b..8702c62031b0 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1066,7 +1066,7 @@ void GtkSalFrame::InitCommon()
// init members
m_pCurrentCursor = nullptr;
- m_nKeyModifiers = 0;
+ m_nKeyModifiers = ModKeyFlags::NONE;
m_bFullscreen = false;
m_bSpanMonitorsWhenFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
@@ -2960,7 +2960,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
if( !pEvent->in )
{
- pThis->m_nKeyModifiers = 0;
+ pThis->m_nKeyModifiers = ModKeyFlags::NONE;
pThis->m_bSendModChangeOnRelease = false;
}
@@ -3030,8 +3030,8 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
sal_uInt16 nModCode = GetKeyModCode( pEvent->state );
- aModEvt.mnModKeyCode = 0; // emit no MODKEYCHANGE events
- if( pEvent->type == GDK_KEY_PRESS && !pThis->m_nKeyModifiers )
+ aModEvt.mnModKeyCode = ModKeyFlags::NONE; // emit no MODKEYCHANGE events
+ if( pEvent->type == GDK_KEY_PRESS && pThis->m_nKeyModifiers == ModKeyFlags::NONE )
pThis->m_bSendModChangeOnRelease = true;
else if( pEvent->type == GDK_KEY_RELEASE &&
@@ -3040,7 +3040,7 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
}
- sal_uInt16 nExtModMask = 0;
+ ModKeyFlags nExtModMask = ModKeyFlags::NONE;
sal_uInt16 nModMask = 0;
// pressing just the ctrl key leads to a keysym of XK_Control but
// the event state does not contain ControlMask. In the release
@@ -3049,39 +3049,39 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
switch( pEvent->keyval )
{
case GDK_KEY_Control_L:
- nExtModMask = MODKEY_LMOD1;
+ nExtModMask = ModKeyFlags::LeftMod1;
nModMask = KEY_MOD1;
break;
case GDK_KEY_Control_R:
- nExtModMask = MODKEY_RMOD1;
+ nExtModMask = ModKeyFlags::RightMod1;
nModMask = KEY_MOD1;
break;
case GDK_KEY_Alt_L:
- nExtModMask = MODKEY_LMOD2;
+ nExtModMask = ModKeyFlags::LeftMod2;
nModMask = KEY_MOD2;
break;
case GDK_KEY_Alt_R:
- nExtModMask = MODKEY_RMOD2;
+ nExtModMask = ModKeyFlags::RightMod2;
nModMask = KEY_MOD2;
break;
case GDK_KEY_Shift_L:
- nExtModMask = MODKEY_LSHIFT;
+ nExtModMask = ModKeyFlags::LeftShift;
nModMask = KEY_SHIFT;
break;
case GDK_KEY_Shift_R:
- nExtModMask = MODKEY_RSHIFT;
+ nExtModMask = ModKeyFlags::RightShift;
nModMask = KEY_SHIFT;
break;
// Map Meta/Super to MOD3 modifier on all Unix systems
// except Mac OS X
case GDK_KEY_Meta_L:
case GDK_KEY_Super_L:
- nExtModMask = MODKEY_LMOD3;
+ nExtModMask = ModKeyFlags::LeftMod3;
nModMask = KEY_MOD3;
break;
case GDK_KEY_Meta_R:
case GDK_KEY_Super_R:
- nExtModMask = MODKEY_RMOD3;
+ nExtModMask = ModKeyFlags::RightMod3;
nModMask = KEY_MOD3;
break;
}
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 42baae8ef715..424e58807cd9 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3341,12 +3341,12 @@ bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangT
static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
WPARAM wParam, LPARAM lParam, LRESULT& rResult )
{
- static bool bIgnoreCharMsg = FALSE;
- static WPARAM nDeadChar = 0;
- static WPARAM nLastVKChar = 0;
+ static bool bIgnoreCharMsg = FALSE;
+ static WPARAM nDeadChar = 0;
+ static WPARAM nLastVKChar = 0;
static sal_uInt16 nLastChar = 0;
- static sal_uInt16 nLastModKeyCode = 0;
- static bool bWaitForModKeyRelease = false;
+ static ModKeyFlags nLastModKeyCode = ModKeyFlags::NONE;
+ static bool bWaitForModKeyRelease = false;
sal_uInt16 nRepeat = LOWORD( lParam )-1;
sal_uInt16 nModCode = 0;
@@ -3479,26 +3479,26 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
SalKeyModEvent aModEvt;
aModEvt.mnTime = GetMessageTime();
aModEvt.mnCode = nModCode;
- aModEvt.mnModKeyCode = 0; // no command events will be sent if this member is 0
+ aModEvt.mnModKeyCode = ModKeyFlags::NONE; // no command events will be sent if this member is 0
- sal_uInt16 tmpCode = 0;
+ ModKeyFlags tmpCode = ModKeyFlags::NONE;
if( GetKeyState( VK_LSHIFT ) & 0x8000 )
- tmpCode |= MODKEY_LSHIFT;
+ tmpCode |= ModKeyFlags::LeftShift;
if( GetKeyState( VK_RSHIFT ) & 0x8000 )
- tmpCode |= MODKEY_RSHIFT;
+ tmpCode |= ModKeyFlags::RightShift;
if( GetKeyState( VK_LCONTROL ) & 0x8000 )
- tmpCode |= MODKEY_LMOD1;
+ tmpCode |= ModKeyFlags::LeftMod1;
if( GetKeyState( VK_RCONTROL ) & 0x8000 )
- tmpCode |= MODKEY_RMOD1;
+ tmpCode |= ModKeyFlags::RightMod1;
if( GetKeyState( VK_LMENU ) & 0x8000 )
- tmpCode |= MODKEY_LMOD2;
+ tmpCode |= ModKeyFlags::LeftMod2;
if( GetKeyState( VK_RMENU ) & 0x8000 )
- tmpCode |= MODKEY_RMOD2;
+ tmpCode |= ModKeyFlags::RightMod2;
if( tmpCode < nLastModKeyCode )
{
aModEvt.mnModKeyCode = nLastModKeyCode;
- nLastModKeyCode = 0;
+ nLastModKeyCode = ModKeyFlags::NONE;
bWaitForModKeyRelease = true;
}
else
@@ -3507,7 +3507,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
nLastModKeyCode = tmpCode;
}
- if( !tmpCode )
+ if( tmpCode == ModKeyFlags::NONE )
bWaitForModKeyRelease = false;
return pFrame->CallCallback( SalEvent::KeyModChange, &aModEvt );
@@ -3521,7 +3521,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
UINT nCharMsg = WM_CHAR;
bool bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
- nLastModKeyCode = 0; // make sure no modkey messages are sent if they belong to a hotkey (see above)
+ nLastModKeyCode = ModKeyFlags::NONE; // make sure no modkey messages are sent if they belong to a hotkey (see above)
aKeyEvt.mnCharCode = 0;
aKeyEvt.mnCode = 0;