https://bugs.kde.org/show_bug.cgi?id=528519
Bug ID: 528519
Summary: Accepting a screenshot: double-click is unreliable,
and with auto-save enabled the viewer window still
opens
Classification: Applications
Product: Spectacle
Version First unspecified
Reported In:
Platform: Ubuntu
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: General
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
Created attachment 198208
--> https://bugs.kde.org/attachment.cgi?id=198208&action=edit
Patch: accept-and-quit + double-click fixes (3 files, ~30 lines)
Environment:
- Spectacle 6.6.6 (Ubuntu package 4:6.6.6-0ubuntu0.1)
- Plasma 6.6.6, Wayland session, single screen
Setup: "Save automatically" and the clipboard export are enabled, and "Quit
after save or copy" is enabled as well. The expected workflow is: press
PrintScreen, drag a region, then press the checkmark / Enter / double-click,
and Spectacle saves the image, copies it to the clipboard and exits.
Actual behaviour:
1. Pressing the checkmark or Enter saves and copies the image, but Spectacle
stays open and shows the ViewerWindow. The "Quit after save or copy" option has
no effect on the automatic export path.
2. Double-clicking inside the selection (before annotating) does nothing at
all; the selection is not accepted.
3. After drawing an annotation (e.g. a rectangle), double-click does nothing
either.
Causes, verified in the 6.6.6 source:
1. In SpectacleCore::onSelectionAccepted() the quit decision is
willQuit = exportActions.testAnyFlags(AnyAction)
&& exportActions.testFlag(UserAction)
&& Settings::quitAfterSaveCopyExport();
but actions coming from the automatic save / clipboard export do not carry
ExportManager::UserAction, so m_returnToViewer stays true and the viewer window
is always shown. The same assumption appears in the imageExported handler.
2. SelectionEditor::mouseDoubleClickEvent() only accepts the selection when
d->selection->contains(d->mousePos)
and d->mousePos is only refreshed in hoverMoveEvent(). A double-click
without prior mouse movement therefore works on stale coordinates and
contains() fails.
3. Even with (2) fixed, double-click does not work once annotations exist: the
event filter is installed on the capture window's root QML item
(CaptureWindow::rootObject()), and a Qt item-level event filter only receives
events whose *target* is that item. As soon as AnnotationViewport becomes the
target of the mouse events, the double-click never reaches SelectionEditor. An
additional filter on the window is needed, guarded by selection->contains(pos)
so that double-clicking toolbar buttons doesn't accept the screenshot.
Proposed fix (~30 lines across 3 files, patch attached):
- treat a successful automatic save as a user action for the quit decision, and
delete the windows in the imageExported handler;
- make double-click inside the selection unconditional (no dependency on the
cached mouse position);
- add a window-level event filter that accepts a double-click only when it
lands inside the selection.
Verified locally by patching and rebuilding the Ubuntu source package: with the
patch, the checkmark, Enter and double-click all save + copy + exit, both
before and after annotating, and double-clicking the toolbar no longer triggers
anything.
I'm happy to submit this as a merge request if the approach is acceptable.
--
You are receiving this mail because:
You are watching all bug changes.