Bug 431278 - Selection box is laggy while selecting an area to screenshot
Summary: Selection box is laggy while selecting an area to screenshot
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 20.12.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-01-07 19:39 UTC by jasoncarrete5
Modified: 2022-12-07 11:47 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 23.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jasoncarrete5 2021-01-07 19:39:44 UTC
SUMMARY
Selection box is laggy while selecting an area to screenshot.

STEPS TO REPRODUCE
1. Run Spectacle
2. Select "Rectangular Area" capture mode
3. Take a new screenshot
4. Select an area to screenshot

OBSERVED RESULT
The selection box displayed while the user is making the selection is laggy i.e. not smoothly following the user's cursor.

EXPECTED RESULT
The selection box displayed while the user is making the selection should be smooth and follow the user's cursor closely.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux - kernel 5.10.4-arch2-1
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Here is a video I recorded to provide a clearer description of the issue I am having: https://www.dropbox.com/s/mwvtl31rl1lodnk/laggy-selection-box.mp4?dl=0

Notice where my cursor is versus where the selection box is in the video.
Comment 1 Matt 2021-06-28 04:21:50 UTC
Same here - possibly even slightly worse. The selection box is very laggy to the point I have to sort of guess where my cursor will end up and wait a few seconds for it to update. This is with two 4k monitors on Wayland.

SOFTWARE/OS VERSIONS
Distro: Arch Linux - Clear Linux kernel 5.12.13-1050.native
KDE Plasma Version: 5.22.2
KDE Framworks Version: 5.83.0
QT Version: 5.15.2

Running on an i5-8250u.
Comment 2 Nate Graham 2021-06-28 10:42:33 UTC
Super smooth for me with a single 4k monitor on Wayland with everything from git master.

Méven, was this fixed recently un unreleased software?
Comment 3 Méven Car 2021-07-01 09:46:01 UTC
(In reply to Nate Graham from comment #2)
> Super smooth for me with a single 4k monitor on Wayland with everything from
> git master.
> 
> Méven, was this fixed recently un unreleased software?

You are thinking about https://bugs.kde.org/show_bug.cgi?id=433776, this was shipped:
The spectacle part was in KDE Gear 21.04
https://invent.kde.org/graphics/spectacle/-/merge_requests/54

kwin part was in plasma 5.22
https://invent.kde.org/plasma/kwin/-/merge_requests/759

This issue is not the same.
Here it is about the drawing on screen of the selection area.
The rendering code in spectacle for this is suboptimal, so on a 2x 4k setup this can show, especially on X11.
I am not sure this is a regression even, the rendering code was not really changed with latest spectacle changes, but rather the first users with 2x4K screens facing the shortcomings of the current implementation.

I don't have two 4k screens but I experience it somewhat with a 4k and a 2560x1440.

The solution for this bug is to rewrite the paintEvent of spectacle QuickEditor https://invent.kde.org/graphics/spectacle/-/blob/master/src/QuickEditor/QuickEditor.cpp#L642 to be more efficient.
Around that subject we have also need to redo that painting to be per-screen, to fix the mix dpr wayland case where the rendering gets blurry.

For those affected, Matt and Jason, do you experience the issue in a Wayland session, or is it better or worse?
Comment 4 Matt 2021-07-01 09:54:07 UTC
(In reply to Méven Car from comment #3)
> For those affected, Matt and Jason, do you experience the issue in a Wayland
> session, or is it better or worse?

I'm only using Wayland now and it affects me and I (think) it affected me on X too. I don't use X anymore due to scaling problems though.

Not sure if this is helpful at all but I'm happy to to try any test builds or document anything that may help :)
Comment 5 jasoncarrete5 2021-07-01 16:22:15 UTC
(In reply to Méven Car from comment #3)
> For those affected, Matt and Jason, do you experience the issue in a Wayland
> session, or is it better or worse?

I use X11 for the most part but tried using a wayland session and have the same issue. This lag appears to be slightly better using wayland than X11. I mainly use a single 4k monitor and sometimes I turn on a second 1080p monitor. The problem persists for me whether I use the single 4k monitor, 1080p monitor, or both monitors together.
Comment 6 Nate Graham 2021-07-01 16:44:25 UTC
Hmm, it's fine for me on X11 too with my 4k screen.
Comment 7 Méven Car 2021-07-02 07:39:34 UTC
(In reply to jasoncarrete5 from comment #5)
> (In reply to Méven Car from comment #3)
> > For those affected, Matt and Jason, do you experience the issue in a Wayland
> > session, or is it better or worse?
> 
> I use X11 for the most part but tried using a wayland session and have the
> same issue. This lag appears to be slightly better using wayland than X11.

That's what I expected.

> I mainly use a single 4k monitor and sometimes I turn on a second 1080p
> monitor. The problem persists for me whether I use the single 4k monitor,
> 1080p monitor, or both monitors together.

What is your GPU Jason ?

Regardless https://bugs.kde.org/show_bug.cgi?id=431278#c3 explains what needs to happen to fix this issue.
Comment 8 Méven Car 2021-07-02 07:40:47 UTC
(In reply to Matt from comment #4)
> (In reply to Méven Car from comment #3)
> > For those affected, Matt and Jason, do you experience the issue in a Wayland
> > session, or is it better or worse?
> 
> I'm only using Wayland now and it affects me and I (think) it affected me on
> X too. I don't use X anymore due to scaling problems though.
> 
> Not sure if this is helpful at all but I'm happy to to try any test builds
> or document anything that may help :)

I can reproduce it myself, the issue is finding the time to do the work...
Comment 9 jasoncarrete5 2021-07-02 19:24:59 UTC
(In reply to Méven Car from comment #7)
> What is your GPU Jason ?

I'm using an AMD Radeon RX 5700.
Comment 10 indecisiveautomator 2022-02-08 02:04:29 UTC
I'd just like to chime in here and say that I'm experiencing this too on Wayland. Using four displays, three 1080p and one 4k with 150% scaling to 1440p. I didn't realise this was an issue until on my laptop, the selection was silky smooth. My desktop has an RX 5700XT GPU and my laptop has a Ryzen 4700U.
Comment 11 Noah Davis 2022-12-07 11:47:26 UTC
Git commit 9d4ffdf70e5a29fa9105cbf8c4f7e1ddca9e377a by Noah Davis.
Committed on 07/12/2022 at 11:46.
Pushed by ndavis into branch 'master'.

Port and rework UI for Qt Quick/QML

There are still some parts that use Qt Widgets, such as the settings dialog, font dialog, color dialog, print dialog and popup menus. The Qt Quick port is needed for a future patch where screen recording will be added and it also allows more animations to be used. The UI was redesigned, partly because the old UI couldn't be ported nicely to QML and partly to improve the appearance of the UI.

There are 2 window classes for the main UIs. CaptureWindow is used for the rectangle capture mode and ViewerWindow is used for the other modes and viewing accepted regions from the rectangle capture mode. Both UIs support adding annotations.

Fullscreen Capture UI:

The UI is a lot like the old UI, but there are floating toolbars that expose more functionality.

- Annotations, saving, copying and taking a new snapshot can be done directly.
- Export, Options and Help menus can be accessed directly.
- Info box no longer covers or overlaps with selection handles.
- Antialiasing for selection handles is fixed.
- Each screen now has its own fullscreen window, which fixes some issues on Wayland and X11.

Image Viewer UI (appears after a screenshot has been taken):

- Main controls are consolidated into a single top toolbar: Save, Save As, Copy, Export (opens popup menu), Show Annotation Tools, Configure (opens settings dialog), Help (opens popup menu)
- There is a right sidebar for selecting capture modes and related options that were in the old UI.
- The whole UI doesn't completely transform when annotation controls are shown anymore. Instead, a vertical left side toolbar (tools) and a bottom toolbar (tool options) are added and the right sidebar slides away. Undo and Redo are added to the top toolbar.
- It should be easier to understand the annotation UI now.
- Annotations done in the Fullscreen Capture UI can still be undone/redone in the Image Viewer UI.

No screenshot taken UI (appears when configured to start without taking a screenshot):

- Has buttons for each capture mode on the left
- Has all the other options that were in the Image Viewer UI sidebar and the old UI on the right
- Has buttons for opening the settings dialog and showing the help menu below the options.
- The heading can be used to drag the window just to make moving the dialog around a bit more convenient.

The kImageAnnotator library was replaced by a custom annotation system because kImageAnnotator only worked with Qt Widgets and can't work in the rectangle capture mode since it has its own UI.

There is some unused code in this patch that is meant for the upcoming video recording feature.
Related: bug 407843, bug 425311, bug 425853, bug 427117, bug 429141, bug 437495, bug 451838, bug 456399, bug 458956, bug 460689, bug 462521
FIXED-IN: 23.04

---

| Fullscreen Capture UI |
|-----------------------|
| ![Screenshot_20221207_052432](/uploads/0a1a94987c80f831ef8ce65e29258797/Screenshot_20221207_052432.png) |

| Image Viewer UI |
|-----------------|
| ![Screenshot_20221207_052647](/uploads/05b9e19702c030228c21fb816af08ee4/Screenshot_20221207_052647.png) |

| No Screenshot UI |
|-----------------|
| ![Screenshot_20221207_053432](/uploads/9d97d6642d050ad84a14bf39f5a914db/Screenshot_20221207_053432.png) |

| Image Viewer Annotations |
|--------------------------|
| ![Screenshot_20221207_052825](/uploads/a8a7ffb4844fa0556eeeee4a979e85dd/Screenshot_20221207_052825.png) |

| Export Menu |
|-------------|
| ![Screenshot_20220823_141330](/uploads/3117057d424b66ae84f84648030912a8/Screenshot_20220823_141330.png) |

| Options Menu |
|--------------|
| ![Screenshot_20220823_141058](/uploads/05f0589b01ae61a90540d1dd6ba154ae/Screenshot_20220823_141058.png) |

| Help Menu |
|-----------|
| ![Screenshot_20220823_141353](/uploads/2f8173dd31cc0ef5c6c598ae6f5bb088/Screenshot_20220823_141353.png) |

| Annotation Options (sections are hidden based on what the active tool can use) |
|--------------------|
| ![Screenshot_20221207_053046](/uploads/ded7a02e8f68d659377abb5d9dc43b11/Screenshot_20221207_053046.png)![Screenshot_20221207_053136](/uploads/c11b21ce6762a7d287ae3e421762bb10/Screenshot_20221207_053136.png) |

M  +5    -18   CMakeLists.txt
A  +33   -0    resources.qrc
M  +20   -31   src/CMakeLists.txt
A  +139  -0    src/CaptureModeModel.cpp     [License: LGPL(v2.0+)]
A  +60   -0    src/CaptureModeModel.h     [License: LGPL(v2.0+)]
M  +10   -10   src/ExportManager.cpp
M  +6    -5    src/ExportManager.h
A  +38   -0    src/Gui/AnimatedLoader.qml     [License: LGPL(v2.0+)]
A  +287  -0    src/Gui/AnnotationOptionsToolBarContents.qml     [License: LGPL(v2.0+)]
A  +1406 -0    src/Gui/Annotations/AnnotationDocument.cpp     [License: LGPL(v2.0+)]
A  +288  -0    src/Gui/Annotations/AnnotationDocument.h     [License: LGPL(v2.0+)]
A  +43   -0    src/Gui/Annotations/AnnotationEditor.qml     [License: LGPL(v2.0+)]
A  +254  -0    src/Gui/Annotations/AnnotationViewport.cpp     [License: LGPL(v2.0+)]
A  +66   -0    src/Gui/Annotations/AnnotationViewport.h     [License: LGPL(v2.0+)]
A  +919  -0    src/Gui/Annotations/EditAction.cpp     [License: LGPL(v2.0+)]
A  +256  -0    src/Gui/Annotations/EditAction.h     [License: LGPL(v2.0+)]
A  +282  -0    src/Gui/Annotations/ResizeHandles.qml     [License: LGPL(v2.0+)]
A  +45   -0    src/Gui/Annotations/SelectionBackground.qml     [License: LGPL(v2.0+)]
A  +207  -0    src/Gui/Annotations/TextTool.qml     [License: LGPL(v2.0+)]
A  +86   -0    src/Gui/Annotations/Utils.cpp     [License: LGPL(v2.0+)]
A  +13   -0    src/Gui/Annotations/Utils.h     [License: LGPL(v2.0+)]
A  +152  -0    src/Gui/AnnotationsToolBarContents.qml     [License: LGPL(v2.0+)]
A  +101  -0    src/Gui/ButtonGrid.qml     [License: LGPL(v2.0+)]
D  +0    -176  src/Gui/CaptureAreaComboBox.cpp
D  +0    -55   src/Gui/CaptureAreaComboBox.h
A  +133  -0    src/Gui/CaptureOptionsSidebarContents.qml     [License: LGPL(v2.0+)]
A  +236  -0    src/Gui/CaptureWindow.cpp     [License: LGPL(v2.0+)]
A  +58   -0    src/Gui/CaptureWindow.h     [License: LGPL(v2.0+)]
A  +27   -0    src/Gui/CopiedMessage.qml     [License: LGPL(v2.0+)]
A  +138  -0    src/Gui/DelaySpinBox.qml     [License: LGPL(v2.0+)]
A  +232  -0    src/Gui/DialogPage.qml     [License: LGPL(v2.0+)]
A  +23   -0    src/Gui/EmptyPage.qml     [License: LGPL(v2.0+)]
M  +84   -16   src/Gui/ExportMenu.cpp
M  +7    -9    src/Gui/ExportMenu.h
A  +13   -0    src/Gui/FloatingBackground.qml     [License: LGPL(v2.0+)]
A  +40   -0    src/Gui/FloatingToolBar.qml     [License: LGPL(v2.0+)]
A  +72   -0    src/Gui/HelpMenu.cpp     [License: LGPL(v2.0+)]
A  +25   -0    src/Gui/HelpMenu.h     [License: LGPL(v2.0+)]
A  +420  -0    src/Gui/ImageCaptureOverlay.qml     [License: LGPL(v2.0+)]
A  +495  -0    src/Gui/ImageView.qml     [License: LGPL(v2.0+)]
A  +21   -0    src/Gui/InlineMessage.qml     [License: LGPL(v2.0+)]
D  +0    -86   src/Gui/KSImageWidget.cpp
D  +0    -44   src/Gui/KSImageWidget.h
D  +0    -714  src/Gui/KSMainWindow.cpp
D  +0    -116  src/Gui/KSMainWindow.h
D  +0    -363  src/Gui/KSWidget.cpp
D  +0    -105  src/Gui/KSWidget.h
A  +67   -0    src/Gui/Magnifier.qml     [License: LGPL(v2.0+)]
A  +158  -0    src/Gui/MainToolBarContents.qml     [License: LGPL(v2.0+)]
A  +269  -0    src/Gui/OptionsMenu.cpp     [License: LGPL(v2.0+)]
A  +62   -0    src/Gui/OptionsMenu.h     [License: LGPL(v2.0+)]
D  +0    -61   src/Gui/ProgressButton.cpp
D  +0    -29   src/Gui/ProgressButton.h
A  +10   -0    src/Gui/SavedAndCopiedMessage.qml     [License: LGPL(v2.0+)]
A  +10   -0    src/Gui/SavedAndLocationCopied.qml     [License: LGPL(v2.0+)]
A  +31   -0    src/Gui/SavedMessage.qml     [License: LGPL(v2.0+)]
A  +21   -0    src/Gui/ScreenshotFailedMessage.qml     [License: LGPL(v2.0+)]
A  +303  -0    src/Gui/Selection.cpp     [License: LGPL(v2.0+)]
A  +134  -0    src/Gui/Selection.h     [License: LGPL(v2.0+)]
A  +918  -0    src/Gui/SelectionEditor.cpp     [License: LGPL(v2.0+)]
A  +131  -0    src/Gui/SelectionEditor.h     [License: LGPL(v2.0+)]
M  +2    -2    src/Gui/SettingsDialog/GeneralOptions.ui
M  +5    -5    src/Gui/SettingsDialog/SaveOptionsPage.cpp
M  +9    -0    src/Gui/SettingsDialog/SettingsDialog.cpp
M  +1    -0    src/Gui/SettingsDialog/SettingsDialog.h
M  +3    -3    src/Gui/SettingsDialog/settings.kcfgc
M  +108  -22   src/Gui/SettingsDialog/spectacle.kcfg
A  +22   -0    src/Gui/ShareErrorMessage.qml     [License: LGPL(v2.0+)]
A  +29   -0    src/Gui/SharedMessage.qml     [License: LGPL(v2.0+)]
A  +99   -0    src/Gui/ShortcutsTextBox.qml     [License: LGPL(v2.0+)]
A  +29   -0    src/Gui/SizeLabel.qml     [License: LGPL(v2.0+)]
A  +70   -0    src/Gui/SpectacleImageProvider.cpp     [License: LGPL(v2.0+)]
A  +18   -0    src/Gui/SpectacleImageProvider.h     [License: LGPL(v2.0+)]
A  +42   -0    src/Gui/SpectacleMenu.cpp     [License: LGPL(v2.0+)]
A  +32   -0    src/Gui/SpectacleMenu.h     [License: LGPL(v2.0+)]
A  +499  -0    src/Gui/SpectacleWindow.cpp     [License: LGPL(v2.0+)]
A  +121  -0    src/Gui/SpectacleWindow.h     [License: LGPL(v2.0+)]
A  +57   -0    src/Gui/UndoRedoGroup.qml     [License: LGPL(v2.0+)]
A  +204  -0    src/Gui/ViewerWindow.cpp     [License: LGPL(v2.0+)]
A  +65   -0    src/Gui/ViewerWindow.h     [License: LGPL(v2.0+)]
M  +5    -5    src/Main.cpp
M  +14   -9    src/Platforms/Platform.h
M  +38   -13   src/Platforms/PlatformKWinWayland.cpp
M  +5    -0    src/Platforms/PlatformKWinWayland.h
M  +28   -7    src/Platforms/PlatformKWinWayland2.cpp
M  +4    -0    src/Platforms/PlatformKWinWayland2.h
M  +28   -13   src/Platforms/PlatformXcb.cpp
M  +4    -3    src/Platforms/PlatformXcb.h
D  +0    -29   src/QuickEditor/ComparableQPoint.h
D  +0    -1042 src/QuickEditor/QuickEditor.cpp
D  +0    -140  src/QuickEditor/QuickEditor.h
A  +15   -0    src/ScreenImage.h     [License: LGPL(v2.0+)]
D  +0    -20   src/SpectacleCommon.h
M  +541  -303  src/SpectacleCore.cpp
M  +93   -41   src/SpectacleCore.h
M  +5    -6    src/SpectacleDBusAdapter.cpp
M  +3    -1    tests/CMakeLists.txt
M  +5    -5    tests/FilenameTest.cpp

https://invent.kde.org/graphics/spectacle/commit/9d4ffdf70e5a29fa9105cbf8c4f7e1ddca9e377a