Add option to auto-accept box selection on mouse release
ClosedPublic

Authored by nrother on Mar 4 2019, 8:28 PM.

Details

Summary

FEATURE: 404829
Adds the option to have spectacle accept the selected region as soon
as the mouse button is released, similar to how other screenshot tools
allow it (eg. scrot -s).

Test Plan

To enable the option go to
Configure -> General -> Rectangular Region -> Accept region on mouse release
then set the Capture mode to Rectangular Region and take a new screenshot.

Behaviour should be the following:

-When selecting a new region, without a previously saved region available,
 click->drag->release should immediately capture the selected region.
-When a previously saved region is shown, the saved region can be
 manipulated further and saving this region requires manual confirmation
 (Enter/Double LMB).
-Clicking and dragging outside of the previously saved region
 captures the newly selected region immediately.

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nrother created this revision.Mar 4 2019, 8:28 PM
Restricted Application added a project: Spectacle. · View Herald TranscriptMar 4 2019, 8:28 PM
Restricted Application added a subscriber: Spectacle. · View Herald Transcript
nrother requested review of this revision.Mar 4 2019, 8:28 PM
nrother edited the test plan for this revision. (Show Details)Mar 4 2019, 8:30 PM
nrother added a reviewer: Spectacle.
nrother edited the test plan for this revision. (Show Details)Mar 4 2019, 8:34 PM
ngraham requested changes to this revision.Mar 4 2019, 9:48 PM
ngraham added a subscriber: ngraham.

Sweet, that was fast!

Let's make sure to update the explanatory text appropriately when this mode is being used--including in conjunction with remembered regions.

src/Gui/SettingsDialog/GeneralOptionsPage.cpp
77

Not everybody has a mouse. In fact my only machine is a laptop that I use with its built-in touchpad. I bet we can come up with a more universally appropriate string. Maybe Accept immediately? Accept on click-and-release?

This revision now requires changes to proceed.Mar 4 2019, 9:48 PM

Sweet, that was fast!

Let's make sure to update the explanatory text appropriately when this mode is being used--including in conjunction with remembered regions.

Accept on Click-and-release sounds good to me, however I'm not sure what exactly I could add to the help text to make this functionality clear in a concise manner,
especially considering the current functionality of being able to drag and expand an existing region is only explained through visual cues (grab-handles on the region, changing cursor).
Maybe I'm misunderstanding which help text you mean, I assume you are talking about the key-bindings overlay (aka mBottomHelpText)?

Maybe I'm misunderstanding which help text you mean, I assume you are talking about the key-bindings overlay (aka mBottomHelpText)?

Yep, that one. When accept-on-click-and-release is being used, and one of the "remember the region" modes is NOT being used, we should make the text just say something like "Click and drag to select the desired region", because everything else pertains to manipulating the region. But when accept-on-click-and-release and one of the "remember the region" modes IS being used, then we should just change "Enter, double-click:" to "Click and drag, Enter, double-click:"

Does that make sense?

Yep, that one. When accept-on-click-and-release is being used, and one of the "remember the region" modes is NOT being used, we should make the text just say something like "Click and drag to select the desired region", because everything else pertains to manipulating the region. But when accept-on-click-and-release and one of the "remember the region" modes IS being used, then we should just change "Enter, double-click:" to "Click and drag, Enter, double-click:"

Does that make sense?

Gotcha, that seems reasonable, will work on that tomorrow.

Thanks so much!

Okay, here's the new option text:

and the three different help-text variants that can show, depending on which options are enabled:

  1. Release-to-capture disabled (Unchanged):

  1. Release-to-capture enabled but saving disabled or no previously saved region available:

  1. Release-to-capture enabled and saving enabled with a previous region displayed:

A couple of notes:
I dislike the way the help text box looks a bit off-center in variant 3) because of the longer first line.
Should I add a line-break to the keybind-section? Should it align at the bottom:

     Click and drag, 
Enter, double-click: Take screenshot
              Shift: Hold to toggle magnifier

or top:

Click and drag, Enter: Take screenshot
         double-click
                Shift: Hold to toggle magnifier

Another thing I've noticed while testing this is that the arrow keys can still modify the rectangle while in the middle of drawing it,
but further movement of the mouse resets the area back to the cursor, so they're pretty useless at that point. This happens
regardless of if release-to-capture is enabled or not. Should I just disable the arrow keys completely while the left mouse button is held and
remove the option from the help text in variant 2)?

I dislike the way the help text box looks a bit off-center in variant 3) because of the longer first line.

Yeah, agreed.

Should I add a line-break to the keybind-section? Should it align at the bottom:

     Click and drag, 
Enter, double-click: Take screenshot
              Shift: Hold to toggle magnifier

Cool, I think this one could work.

Another thing I've noticed while testing this is that the arrow keys can still modify the rectangle while in the middle of drawing it,
but further movement of the mouse resets the area back to the cursor, so they're pretty useless at that point. This happens
regardless of if release-to-capture is enabled or not. Should I just disable the arrow keys completely while the left mouse button is held and
remove the option from the help text in variant 2)?

Yes, that makes sense!

nrother updated this revision to Diff 53300.Mar 6 2019, 4:54 PM

Adjust help-text to be more contextual and improve the new settings' description

Alright, the help text for variant 3 now has a line break to make the first
line not stand out so much. The help text for variant 2 has been adjusted
to not include the arrow key bindings, which are now disabled while
click-and-dragging. Additionally the text for the shift key in
this mode has been shortened from
"Hold to toggle magnifier while dragging selection handles"
to just
"Hold to toggle magnifier",
since you are already holding the selection handles when you are in this mode.
The text for the option in the settings menu has also been adjusted.

ngraham accepted this revision.Mar 6 2019, 5:47 PM

Lovely. This is awesome stuff!

This revision is now accepted and ready to land.Mar 6 2019, 5:47 PM
This revision was automatically updated to reflect the committed changes.

Since I know you use a dual screen setup, for your next trick would you like to have a crack at https://bugs.kde.org/show_bug.cgi?id=385885?

Since I know you use a dual screen setup, for your next trick would you like to have a crack at https://bugs.kde.org/show_bug.cgi?id=385885?

That one might be a tad more complicated but I'll give it my best shot.

Feel free to check out any of the other Spectacle bugs too if you're interested in continuing with Spectacle: https://bugs.kde.org/buglist.cgi?component=General&list_id=1594330&product=Spectacle&resolution=---

https://bugs.kde.org/show_bug.cgi?id=390856 looks like another possibility.