flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
25.12k stars 1.61k forks source link

Scaling do not work correctly when taking screenshot in Plasma6/Wayland #3614

Open dhay3 opened 6 months ago

dhay3 commented 6 months ago

Flameshot Version

Flameshot v12.1.0 (-)
Compiled with Qt 5.15.10
linux: 6.9.0-1-MANJARO
manjaro: unknown

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Installed via pacman.

Operating System type and version

6.9.0-1-MANJARO

Description

In KDE Plasma5/Wayland, flameshot works without any unexpected behaviors when scaling is enabled that is not the default. But after updating to KDE Plasma6/Wayland, flameshot seems do not obey the scaling when taking screenshots. It leaves the screen to be taken as floating in the black background(zoom out), while the selection region with the normal action and size, same as the saved pictures.

Things I have tried:

  1. Use command env QT_AUTO_SCREEN_SCALE_FACTOR="1.25" QT_SCREEN_SCALE_FACTORS="" flameshot gui, not work.
  2. Use command env QT_SCREEN_SCALE_FACTORS="1;1" flameshot gui, not work.
  3. Use command env XDG_SESSION_TYPE=x11 flameshot gui, works, but keystrokes will never be read when Legacy X11 App Support is set to Never.
  4. Use command env QT_QPA_PLATFORM=xcb flameshot gui, works, same as X11.
  5. Set Kwin rules follow the instruction of issue#3073 , not work.
  6. Set display scaling to 100%, works.
  7. Use appimage version, not work.

It seems like a duplicate of #3566, but no resolutions yet.

For the temporary using, I make flameshot starts as an X11 app.

Steps to reproduce

  1. Set the display scaling to 125% or 150%.
  2. Run flameshot gui or click the take screenshot button in GUI.

Screenshots or screen recordings

The following screenshot was taken by Spectacle when flameshot gui is activated.

image

And the output of flameshot gui in konsole.(Not for sure, those errors will be taken in count.)

QFont::fromString: Invalid description 'Hack Nerd Font,12,-1,5,900,0,0,0,0,0,0,0,0,0,0,1,Regular'
QFont::fromString: Invalid description 'Hack Nerd Font,12,-1,5,900,0,0,0,0,0,0,0,0,0,0,1,Regular'
QFont::fromString: Invalid description 'Hack Nerd Font,12,-1,5,900,0,0,0,0,0,0,0,0,0,0,1,Regular'
QFont::fromString: Invalid description 'Hack Nerd Font,12,-1,5,900,0,0,0,0,0,0,0,0,0,0,1,Regular'
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: Screenshot aborted.

Also here is a video if the picture do not describe the question clearly.

https://github.com/flameshot-org/flameshot/assets/62749885/a27e6af8-34c9-416c-9eed-94be7b768fb1

System Information

Display Configuration:

image

Hardware & Display Server:

$ inxi -xxG
Graphics:
  Device-1: NVIDIA AD107M [GeForce RTX 4060 Max-Q / Mobile]
    vendor: Micro-Star MSI driver: nvidia v: 550.78 arch: Lovelace pcie:
    speed: 2.5 GT/s lanes: 2 ports: active: none empty: DP-1, DP-2, HDMI-A-1,
    eDP-1 bus-ID: 01:00.0 chip-ID: 10de:28a0
  Device-2: AMD Raphael vendor: Micro-Star MSI driver: amdgpu v: kernel
    arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports: active: eDP-2 empty: DP-3,
    DP-4, DP-5, Writeback-1 bus-ID: 06:00.0 chip-ID: 1002:164e temp: 46.0 C
  Device-3: Bison HD Webcam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 bus-ID: 5-1.1:3 chip-ID: 5986:211c
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 23.2.6
    compositor: kwin_wayland driver: X: loaded: amdgpu,nvidia dri: radeonsi
    gpu: nvidia,amdgpu display-ID: 0
  Monitor-1: eDP-2 res: 2048x1152 size: N/A
  API: EGL v: 1.5 platforms: device: 0 drv: nvidia device: 2 drv: radeonsi
    device: 3 drv: swrast gbm: drv: nvidia surfaceless: drv: nvidia wayland:
    drv: radeonsi x11: drv: radeonsi inactive: device-1
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 24.0.6-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon Graphics (radeonsi
    raphael_mendocino LLVM 17.0.6 DRM 3.57 6.9.0-1-MANJARO)
    device-ID: 1002:164e display-ID: :1.0
  API: Vulkan v: 1.3.279 surfaces: xcb,xlib,wayland device: 0
    type: discrete-gpu driver: nvidia device-ID: 10de:28a0 device: 1
    type: integrated-gpu driver: mesa radv device-ID: 1002:164e

DE Version:

$ pacman -Qs plasma-desktop
local/plasma-desktop 6.0.4-1 (plasma)
    KDE Plasma Desktop
jack9603301 commented 6 months ago

Flameshot Version

Flameshot v12.1.0 (-) Compiled with Qt 5.15.10 linux: 6.9.0-1-MANJARO manjaro: unknown

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

6.9.0-1-MANJARO

Description

In KDE Plasma5/Wayland, flameshot works without any unexpect behaviors when scalling is enabled that is not the default. But after updating to KDE Plasma6/Wayland, flameshot seems do not obey the scalling when taking screenhosts.

Things I tried:

1. env QT_AUTO_SCREEN_SCALE_FACTOR="1.25" QT_SCREEN_SCALE_FACTORS=""
   flameshot gui, not work.
2. env QT_SCREEN_SCALE_FACTORS="1;1" flameshot gui, not work.
3. env XDG_SESSION_TYPE=x11 flameshot gui, works.
4. Set display scaling to 100%, works.

Steps to reproduce

1. run flameshot gui

Screenshots or screen recordings

[1]https://github.com/flameshot-org/flameshot/assets/62749885/a27e6af8-34c9-416c-9eed-94be7b768fb1

System Information

$ inxi -G Graphics: Device-1: NVIDIA AD107M [GeForce RTX 4060 Max-Q / Mobile] driver: nvidia v: 550.78 Device-2: AMD Raphael driver: amdgpu v: kernel Device-3: Bison HD Webcam driver: uvcvideo type: USB Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 23.2.6 compositor: kwin_wayland driver: X: loaded: amdgpu,nvidia dri: radeonsi gpu: nvidia,amdgpu resolution: 2048x1152 API: EGL v: 1.5 drivers: nvidia,radeonsi,swrast platforms: gbm,wayland,x11,surfaceless,device API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 24.0.6-manjaro1.1 renderer: AMD Radeon Graphics (radeonsi raphael_mendocino LLVM 17.0.6 DRM 3.57 6.9.0-1-MANJARO) API: Vulkan v: 1.3.279 drivers: nvidia,radv surfaces: xcb,xlib,wayland

— Reply to this email directly, [2]view it on GitHub, or [3]unsubscribe. You are receiving this because you are subscribed to this thread.[4][IMG]Message ID: @.***>

Links:

  1. https://github.com/flameshot-org/flameshot/assets/62749885/a27e6af8-34c9-416c-9eed-94be7b768fb1
  2. https://github.com/flameshot-org/flameshot/issues/3614
  3. https://github.com/notifications/unsubscribe-auth/ACFAZDGEV6N346UYXZH6PMLZDGB6RAVCNFSM6AAAAABH7BU7SWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYDKMJRGIYDONI
  4. Image: https://github.com/notifications/beacon/ACFAZDCA7N32WBAPWBSV2KTZDGB6RA5CNFSM6AAAAABH7BU7SWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHISZJYBM.gif

What is your wayland environment? Is it KDE? It seems so, but I don't understand why?

dhay3 commented 6 months ago

@jack9603301 Yes my DE is KDE Plasma6 ship with Wayland 1.22.0

jack9603301 commented 6 months ago

@jack9603301 Yes my DE is KDE Plasma6 ship with Wayland 1.22.0

Flameshot's screenshot actually comes from the image returned by the operating system's screenshot protocol. Why is it incorrect?

dhay3 commented 6 months ago

@jack9603301 Yes my DE is KDE Plasma6 ship with Wayland 1.22.0

Flameshot's screenshot actually comes from the image returned by the operating system's screenshot protocol. Why is it incorrect?

@jack9603301 I update the OP with more information. Is there a way to debug it, if that is a protocol. It will be highly appreciated if some hints.

sr1canskhsia commented 4 months ago

Exactly the same issue here. Distro is Arch. By screenshot protocol I assume it's xdg-desktop-portal-kde? But Spectacle (which is KDE's own screenshot app) works just fine on wayland

mmahmoudian commented 4 months ago

@dhay3 I have a hunch that this is because of the combination of Wayland and multiple monitor. Would it be possible for you to try this with only one single monitor and see if the issue persists, and if it is, is it behaving the same or or slightly different. My guess is that those black regions around the screenshot should be gone when using a single monitor.

@sr1canskhsia

But Spectacle (which is KDE's own screenshot app) works just fine on wayland

It might be that Spectacle is using a private Kwin API to give them more information about the system. I'm not sure about that though, but I have also seen that Spectacle in KDE works in many edge cases that Flameshot fails. We (Flameshot) need to improve our Wayland compatibility for sure.

dhay3 commented 4 months ago

@mmahmoudian Thanks for the reply. There is one monitor only which I've pasted the information under System Information section in the OP, and The issue persists on plasma 6.0.5. If you need more information I'm glad to.

FQQD commented 4 months ago

I do have the same problem on Debian 12, with KDE Plasma 5.27.5 and Wayland.

dolores-dei commented 3 months ago

Same issue here, running Arch. KDE Plasma version 6.1.3 Wayland, when running 150% scaling ( or any fractional option really ).

dante-e-v commented 2 months ago

This Flameshot issue effects me as well. Running KDE Plasma 6.1.5-1 on Arch. I test it and turning the scaling to just 100% does make it behave normally.

It still works fine if you shrink it such as to 75%. But increase the scaling even by a bit such as 105% and the zoom out effect is the same.

I'm wondering if this is happening on any other environments such as GNOME or any window managers. I can't test it right now but if anyone can it would be good to know if this is a KDE Plasma specific issue or not.

I didn't see any of the others posts mention testing different environments but at least we know it's not an Arch specific thing since at least Debian has the same issue.

Edit: Tried out running QT_AUTO_SCREEN_SCALE_FACTOR=1.0 QT_SCREEN_SCALE_FACTORS="" flameshot gui but it still had the same issue. Only changing things in the settings works.

geodesius commented 2 months ago

@dhay3 I have a hunch that this is because of the combination of Wayland and multiple monitor. Would it be possible for you to try this with only one single monitor and see if the issue persists, and if it is, is it behaving the same or or slightly different. My guess is that those black regions around the screenshot should be gone when using a single monitor.

EndeavourOS (Arch) KDE Plasma6.1.5

Single monitor Wayland - The screen gets offset to the side and only part of the content is visible in flameshot gui. Also there is a brief lag in between launching flameshot gui and it actually appearing. Double monitor Wayland - The screen gets the black bar and only the content on the main monitor is available for selection in flameshot gui, if I move my mouse to the other monitor on the right I can still use the PC, flameshot does not work on it. Also there is a brief lag in between launching flameshot gui and it actually appearing.

Single monitor X11 - Works as intended Double monitor X11 - Broken, the screenshot area gets offset, content that is on the right side screen appears on the main monitor during flameshot gui, the main monitor content gets moved off the screen to the left

It might not be a wayland issue but something related to KDE

I'm wondering if this is happening on any other environments such as GNOME or any window managers. I can't test it right now but if anyone can it would be good to know if this is a KDE Plasma specific issue or not.

I've been using gnome with EndeavourOS back when this issue was first posted and had no issues with up to 4 monitors. A friend of mine is running EndeavourOS as well but with xfce x11 with 2 monitors, I mentioned this bug to him and he said it works fine for him.

Additionally, I am not sure if that is related but if I use dual monitor wayland and open OBS it seems to have the exact same size black bars as flameshot gui does. In video settings there isn't even an option to choose my actual monitor's resolution for the canvas size in the dropdown (3840x2160). By default it selected 4388x2468. After I inputted the correct resolution for the canvas manually the black bars were gone.

andyspectre commented 1 week ago

Same here with any fractional scaling. With 100% scaling, no issues. Fedora 41 (Silverblue), GNOME 47, Wayland.

chaugi commented 5 days ago

I have the same issue on clean default installation of Fedora 42 with Gnome and native Wayland session (flameshot installed from rpm v12.1.0, flameshot-12.1.0-7.fc41.src.rpm). The problem is visible on two monitor setup. As soon as in Settings -> Displays -> Build-in display -> Scale, I set to 150%, then screenshot becomes offset from the original area I have selected. Note: an issue is on both display, even when I have 100% scale for primary external monitor.

gabriel-batistuta commented 5 days ago

Same issue here using Arch Linux and KDE Plasma 6.2.3