summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-05-05 01:30:30 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2017-05-05 11:27:33 +0200
commitfe0451259d2fb93c809c1bfa3baf5abd90019c58 (patch)
treebf9739d56ffbe6e8b291ea5ee399d2cf315faa2b /vcl/unx/gtk
parente3a44cbb1d01a1fe5e6321b29e215f4a13ddee6a (diff)
tdf#103158 ctrl+shift should work on key up
Under gtk/gtk3 we send CommandEventId::ModKeyChange on key down, to support the auto-accelerator feature. But at least the handler in SwEditWin::Command must get it on key up, in order to not interfere with other ctrl+shift+X shortcuts, which work on key down. To achieve that, we need: - On key up pass the key that was just released, instead of the current state of nothing being pressed. - Have a flag of whether it's a key down or up event, so it can be checked by the application code. Change-Id: If188d6ccdc3b214a2c3ed20aad291d74d46b358f Reviewed-on: https://gerrit.libreoffice.org/37275 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx32
1 files changed, 9 insertions, 23 deletions
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 07d81cd39751..f97a429af72f 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -970,7 +970,6 @@ void GtkSalFrame::InitCommon()
m_bSpanMonitorsWhenFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
m_nVisibility = GDK_VISIBILITY_FULLY_OBSCURED;
- m_bSendModChangeOnRelease = false;
m_pIMHandler = nullptr;
m_pRegion = nullptr;
m_ePointerStyle = static_cast<PointerStyle>(0xffff);
@@ -2980,10 +2979,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
pSalInstance->updatePrinterUpdate();
if( !pEvent->in )
- {
pThis->m_nKeyModifiers = ModKeyFlags::NONE;
- pThis->m_bSendModChangeOnRelease = false;
- }
if( pThis->m_pIMHandler )
pThis->m_pIMHandler->focusChanged( pEvent->in );
@@ -3096,20 +3092,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
pEvent->keyval == GDK_KEY_Meta_L || pEvent->keyval == GDK_KEY_Meta_R ||
pEvent->keyval == GDK_KEY_Super_L || pEvent->keyval == GDK_KEY_Super_R )
{
- SalKeyModEvent aModEvt;
-
sal_uInt16 nModCode = GetKeyModCode( pEvent->state );
-
- 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 &&
- pThis->m_bSendModChangeOnRelease )
- {
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
- }
-
ModKeyFlags nExtModMask = ModKeyFlags::NONE;
sal_uInt16 nModMask = 0;
// pressing just the ctrl key leads to a keysym of XK_Control but
@@ -3155,8 +3138,15 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
nModMask = KEY_MOD3;
break;
}
+
+ SalKeyModEvent aModEvt;
+ aModEvt.mbDown = pEvent->type == GDK_KEY_PRESS;
+ aModEvt.mnTime = pEvent->time;
+ aModEvt.mnCode = nModCode;
+
if( pEvent->type == GDK_KEY_RELEASE )
{
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
nModCode &= ~nModMask;
pThis->m_nKeyModifiers &= ~nExtModMask;
}
@@ -3164,14 +3154,10 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
{
nModCode |= nModMask;
pThis->m_nKeyModifiers |= nExtModMask;
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
}
- aModEvt.mnCode = nModCode;
- aModEvt.mnTime = pEvent->time;
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
-
pThis->CallCallback( SalEvent::KeyModChange, &aModEvt );
-
}
else
{
@@ -3184,7 +3170,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
(pEvent->type == GDK_KEY_PRESS),
false );
if( ! aDel.isDeleted() )
- pThis->m_bSendModChangeOnRelease = false;
+ pThis->m_nKeyModifiers = ModKeyFlags::NONE;
}
if( !aDel.isDeleted() && pThis->m_pIMHandler )