ksnip / ksnip

ksnip the cross-platform screenshot and annotation tool
GNU General Public License v3.0
2k stars 156 forks source link

HiDPI issue with multiple screen on Windows #668

Open gabriele-v opened 3 years ago

gabriele-v commented 3 years ago

Describe the bug I have a 15" laptop with 4K screen (200% scaling) with an external 27" 4K screen (150% scaling). When I capture a rectangular area (tried on both monitors), if both screens are on, the image is zoomed and it's impossible to capture properly. If I disconnect the external screen and use only the laptop one, everything is working properly.

To Reproduce Steps to reproduce the behavior:

  1. Capture rectangular area

Expected behavior It should behave in the same way as when only laptop screen is used

Screenshots Difficult to grab, anyway it's like all the window is zoomed.

Desktop (please complete the following information):

DamirPorobic commented 3 years ago

Hello, you're probably facing this known issue https://github.com/ksnip/ksnip/issues/276.

Out of curiosity, do you get the same issue when both have 200% scaling?

stethos commented 3 years ago

I might have a similar issue. This is that last build which works fine for me: Version: 1.8.0, Build: 1578-d84ec1a

Also on Win 10 20H2 and just tested 1.9.1-continous.

Screen 2 is the 4K one operating 150%, the other screens just are at 100% scaling.

screen
gabriele-v commented 3 years ago

Hello, you're probably facing this known issue #276.

Out of curiosity, do you get the same issue when both have 200% scaling?

Yes, both at 200% I still have the issue. Let me try with 1.8.0 as suggested above

DamirPorobic commented 3 years ago

If it's working with 1.8.0 it might a different issue because that one is older.

gabriele-v commented 3 years ago

I confirm the same, 1.8.0 is the last one working. Then 1.8.1, 1.8.2, 1.9.0 and continuous are broken

gabriele-v commented 3 years ago

Maybe related to this? https://github.com/ksnip/ksnip/commit/7036cddad36cd4dc00108d9b858cd38f677273da

DamirPorobic commented 3 years ago

@gabriele-v Would be strange if that change had an impact on dual monitor setups but not on single monitor setups.

gabriele-v commented 3 years ago

If you could provide me a 1.9.0 Windows build without that settings, I'll give a try. Or anyway I'm at your disposal for any test

stethos commented 3 years ago

I confirm the same, 1.8.0 is the last one working. Then 1.8.1, 1.8.2, 1.9.0 and continuous are broken

At least you see the same that 1.8.0 is working for you as well.

@Damir: I'm also at your disposal for any test

DamirPorobic commented 3 years ago

I'll try to look into this this week.

DamirPorobic commented 3 years ago

@gabriele-v the issue is indeed ben triggered by the AA_EnableHighDpiScaling option. I'm looking for a fix.

DamirPorobic commented 3 years ago

I have pushed a fix that should resolve the issue.

stethos commented 3 years ago

Fix works for me, tx so much - good job!

gabriele-v commented 3 years ago

If this https://github.com/ksnip/ksnip/releases/tag/continuous should contain the fix, unfortunately it's not working for me

DamirPorobic commented 3 years ago

What arrangement of monitors are you using?

gabriele-v commented 3 years ago

15" laptop with 4K screen (200% scaling) with an external 27" 4K screen (150% scaling)

DamirPorobic commented 3 years ago

What are positions of those monitors and which one is main?

DamirPorobic commented 3 years ago

Nevermind, I can reproduce with scaling on both monitors. Will look into it again.

gabriele-v commented 3 years ago

What are positions of those monitors and which one is main?

15" (main) bottom , 27" (secondary) vertically above

DamirPorobic commented 3 years ago

This is indeed an ugly behavior from Qt side. The Widgets behave differently when one or multiple screens have scaling so I have added two hacks that might fix them (though I'm not sure about anything anymore in regards to HiDPI and Qt). It might be that your use case requires a third hack, multiple scaled screens ordered vertically. Though you can, just for testing, try to order your screens horizontally but keep the screen scaling and see if that is working at least. I'll have a look into the vertical screens think in next couple of days, I'm done for today.

gabriele-v commented 3 years ago

FYI with latest continuous build I have the same issue also with only laptop 4K screen at 200%. Thanks

DamirPorobic commented 2 years ago

@gabriele-v I've pushed another fix, can you give it another try? The CI needs ~20min to build the package.

DamirPorobic commented 2 years ago

@gabriele-v can you please test latest continuous build?

gabriele-v commented 2 years ago

Tested 1.10.0-continuous build 1-0be25a5

Still not working even on only one 4K screen with 200%

stethos commented 2 years ago

Still works for me, ksnip-log.txt reports (if it helps): Screen Count: 4; Resolution: x=-1920 y=0 w=8040 h=2407 ´Version seems to be higher compared to gabriele-v one: 1.10.0 1-76e65c7

DamirPorobic commented 2 years ago

Really puzzling what Windows is doing. I have another user with a similar issue just happening when one screen is turned off, same setup, same binaries, he has the issue and I cannot reproduce it.

ihipop commented 2 years ago

Maybe related? https://github.com/flameshot-org/flameshot/issues/1386#issuecomment-895674965

But spectacle works well, which also use QT

DamirPorobic commented 2 years ago

@ihipop Yeah, could be same issue, we have a similar issue on Linux https://github.com/ksnip/ksnip/issues/276 Problem is that I cannot reproduce this on my machine. If you issue is Linux related maybe better to switch to the other issue and provide Distro info so I can try to reproduce.

Spectacle is different, it's closely coupled with kWin and it gets it's screenshots from there, not by utilizing Qt like we do. We cannot do that as we run in cross platform environments.

DamirPorobic commented 2 years ago

@gabriele-v is for you the image still incorrectly scaled or just incorrectly positioned? If it's just the position, you can now configure an offset for the snipping area positioning, Options > Settings > ImageGrabber > SnippingArea, if you want to give it a try.

vincenzocaselli commented 1 month ago

Hi, I am using Linux Mint 22 (Cinnamon), no HiDPI, but have 3 monitors all set to 125% fractional scaling. I got the similar big problems in capturing rectangular areas, with version 1.10.1. Reading messages in this issue, I tried version 1.8.0 and this version has no the above problems! Hope this can help in resolving the problem in next versions. Available to provide details if helpful. Thank you

viharm commented 3 weeks ago

How do you install a specific version?

vincenzocaselli commented 3 weeks ago

How do you install a specific version?

E.g. you want to install 1.8.0 => go to https://github.com/ksnip/ksnip/releases/tag/v1.8.0 and download the package depending on your distro