diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-05 01:30:30 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-05 11:27:33 +0200 |
commit | fe0451259d2fb93c809c1bfa3baf5abd90019c58 (patch) | |
tree | bf9739d56ffbe6e8b291ea5ee399d2cf315faa2b /vcl/unx/gtk3/gtk3gtkframe.cxx | |
parent | e3a44cbb1d01a1fe5e6321b29e215f4a13ddee6a (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/gtk3/gtk3gtkframe.cxx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 4de9d457fe60..5a8b5e89a74c 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -1077,7 +1077,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_pDropTarget = nullptr; @@ -2982,10 +2981,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 ); @@ -3049,20 +3045,7 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe 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 @@ -3108,8 +3091,15 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe 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; } @@ -3117,14 +3107,10 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe { nModCode |= nModMask; pThis->m_nKeyModifiers |= nExtModMask; + aModEvt.mnModKeyCode = pThis->m_nKeyModifiers; } - aModEvt.mnCode = nModCode; - aModEvt.mnTime = pEvent->time; - aModEvt.mnModKeyCode = pThis->m_nKeyModifiers; - pThis->CallCallbackExc( SalEvent::KeyModChange, &aModEvt ); - } else { @@ -3137,7 +3123,7 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe (pEvent->type == GDK_KEY_PRESS), false ); if( ! aDel.isDeleted() ) - pThis->m_bSendModChangeOnRelease = false; + pThis->m_nKeyModifiers = ModKeyFlags::NONE; } if( !aDel.isDeleted() && pThis->m_pIMHandler ) |