Bug 343763

Summary: Enter, + and - shortcuts do not work when cursor is outside of canvas
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: UsabilityAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 2.9 Beta   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tyson Tan 2015-02-04 07:56:22 UTC
Some keyboard shortcuts do not work when cursor is outside of canvas. For example:
[Enter] to apply when using Transformation Tool or Crop Tool.
[+]/[-] zooming.

This can be very confusing sometimes.

Reproducible: Always

Steps to Reproduce:
1. Put cursor over the Dockers;
2. Try use +/- to zoom;
3. Use Transformation Tool or Crop Tool, put cursor over the Tool options Docker (we do that a lot);
4. Try use Enter to apply changes.

Actual Results:  
These shortcuts does not work when cursor is outside of canvas.

Expected Results:  
These shortcuts works no matter where the cursor is.
Comment 1 Halla Rempt 2015-02-04 13:40:59 UTC
Confirmed. We'll have to look deeper into focus handling after 2.9 -- the tab key in dockers being broken is another example of focus issues.
Comment 2 wolthera 2016-04-25 12:00:06 UTC
*** Bug 362217 has been marked as a duplicate of this bug. ***
Comment 3 Dmitry Kazakov 2016-04-27 17:39:09 UTC
Git commit d64d85fb10a58b6ed3b9451abeb1927576052e4d by Dmitry Kazakov.
Committed on 27/04/2016 at 17:38.
Pushed by dkazakov into branch 'master'.

Fix shortcuts when the cursor is outside the canvas

This patch needs testing on Windows, OSX and all the variations
of DE on Linux!

Before today the focus was automatically transferred to the canvas
when the cursor was hovering over it. That caused all input boxes
in the dockers work only when you keep the cursor over them. That
was hardly convenient.

Now the focus can be transferred in a semi-automatic way.

* if you move the cursor outside the canvas without clicking anywhere
  the focus is kept on the canvas and you can still use the shortcuts

* if you click in any input box outside the canvas, the focus will be
  transferred to that input box. Therefore the shortcuts will not work.

* to return input focus to the canvas you should do one of the following:
    - just start a stroke on it
    - keep your cursor *moving* over the canvas for 2 seconds and
      the focus will be transferred automatically. "Moving" condition is
      needed for a case when you drop your mouse or a stylus in a fixed
      position on a canvas and move your hands to the keyboard to fill
      in input boxes in the dockers. If you do this "dropping" quick
      enough (< 2 sec), the focus will be kept on your input box :)

To implement such behavior I had to create a special class
KisTimedSignalThreshold which uses almost the same interface as
KisSignalsCompressor, but does what we need: emit the signal if the
flow of events is strong enough.

Fixes T2346
Related: bug 362217
CC:kimageshop@kde.org

M  +1    -0    libs/image/CMakeLists.txt
A  +82   -0    libs/image/kis_timed_signal_threshold.cpp     [License: GPL (v2+)]
A  +71   -0    libs/image/kis_timed_signal_threshold.h     [License: GPL (v2+)]
M  +3    -15   libs/ui/input/kis_input_manager.cpp
M  +39   -5    libs/ui/input/kis_input_manager_p.cpp
M  +8    -1    libs/ui/input/kis_input_manager_p.h
M  +5    -1    libs/ui/input/kis_shortcut_matcher.cpp

http://commits.kde.org/krita/d64d85fb10a58b6ed3b9451abeb1927576052e4d