diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2018-04-15 22:28:32 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 17:29:12 +0200 |
commit | 599ab0f82ebcb29a5205d77daed72b842e839800 (patch) | |
tree | 6f11001e122cf404e516d01abb06922d2616594a | |
parent | fe3ddff71af9298cc389ce05f6c1474bc0aeb715 (diff) |
tdf#117017 Make modifier keys not trigger the InputChanged handler
(cherry picked from commit a860c94f0da22065074cc36e8ddda73261641533)
sc: Fix menubar auto-accelerator behavior under gtk2
... when the focus is in the input field of the formula bar.
Regression of commit d90dcf3554a84b5600800ee6deb3cde879c62b8d
("tdf#113894 release ctrl of ctrl+v in input line should strip
formatting").
(cherry picked from commit baddcc38dee7b286cc73c1eaeb6f78d10b911a8e)
tdf#117017 Pasting into the formula bar shouldn't retain formatting
This is (kind of) regression from the previous commit
a860c94f0da22065074cc36e8ddda73261641533 ("tdf#117017 Make modifier
keys not trigger the InputChanged handler").
Reset of formatting when pasting into the formula bar via a keyboard
shortcut, was actually a side effect of the gtk auto-accelerator
work. In particual, bibisect (of the 5.2 cycle) points to commit
8d53d01f38b856f177aca3ed4d3cba3db10f24a5 ("tdf#96739: Send Ctrl-Left/
RightShift events to correct window"). The behavior was later changed
back with commit 0321dbb9be72f92c02919457cdc3c4e76cfbd11d
("Resolves: tdf#99324 let sidebar toggle auto-mnemonics on/off with
alt"), but introduced again upon request of tdf#113894, with commit
d90dcf3554a84b5600800ee6deb3cde879c62b8d ("tdf#113894 release ctrl of
ctrl+v in input line should strip formatting"). Now it's broken again
with the previous commit of this bug.
However, even if not retaining formatting is the desired behavior,
triggering it on a modifier key release isn't a good idea. So keep
the previous commit, and implement tdf#113894 differently. In
addition, make sure to get identical behavior regardless of the
pasting method, be it via a keyboard shortcut, a toolbar button or a
menu/context menu command. And users can still override this behavior
with the usual paste special dialog, or the toolbar dropdown.
(cherry picked from commit 632bc11ce8fab1c4046ab24810b90a7ce9ac5914)
Change-Id: Ib05883688ef4143c0b53871c4336920dde6f91cc
Reviewed-on: https://gerrit.libreoffice.org/53144
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 12 |
3 files changed, 21 insertions, 2 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 94f3464c783f..da4be2812150 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3397,9 +3397,15 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false { if (pTableView) { + EVControlBits nControl = pTableView->GetControlWord(); + if (pTopView) + pTableView->SetControlWord(nControl | EVControlBits::SINGLELINEPASTE); + vcl::Window* pFrameWin = pActiveViewSh ? pActiveViewSh->GetFrameWin() : nullptr; if ( pTableView->PostKeyEvent( rKEvt, pFrameWin ) ) bUsed = true; + + pTableView->SetControlWord(nControl); } if (pTopView) if ( pTopView->PostKeyEvent( rKEvt ) ) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 6572e0b01d95..4a8ea6ea7ff6 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1425,6 +1425,11 @@ void ScTextWnd::Command( const CommandEvent& rCEvt ) { //don't call InputChanged for CommandEventId::Swipe } + else if ( nCommand == CommandEventId::ModKeyChange ) + { + //pass alt press/release to parent impl + Window::Command(rCEvt); + } else SC_MOD()->InputChanged( mpEditView.get() ); } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 9cbac20a0fc8..235e9773660c 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -229,10 +229,18 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_PASTE: - pTableView->PasteSpecial(); + { + EVControlBits nControl = pTableView->GetControlWord(); if (pTopView) + { pTopView->Paste(); - break; + pTableView->SetControlWord(nControl | EVControlBits::SINGLELINEPASTE); + } + + pTableView->PasteSpecial(); + pTableView->SetControlWord(nControl); + } + break; case SID_DELETE: pTableView->DeleteSelected(); |