Giter VIP home page Giter VIP logo

Comments (13)

louiscklaw avatar louiscklaw commented on June 10, 2024 2

I face similar issue than mapleroyal

Q: Desktop Environment (Gnome? KDE? Xfce?)
A: Gnome 44.3

Q: Display Server (XOrg? Wayland?)
A: Wayland

Q: NormCap installation method (AppImage? FlatPak? Pip? AUR?)
A: just follow the install instructions from README.md and i am using fedora.

$ sudo dnf install tesseract wl-clipboard
$ pip install normcap
$ ./normcap

Here i am using 3840x2160 display with scall 200%.

Thanks for help in advance.

from normcap.

travisfw avatar travisfw commented on June 10, 2024 1

running gsettings get org.gnome.mutter experimental-features returns @as []

After enabling fractional scaling as suggested, gsettings get now returns ['scale-monitor-framebuffer']

But NormCap still zooms to the upper left corner of the screenshot and I can't discover any way to access the right edge of the window.

Edit: after reboot, NormCap now sizes to the screen so that I can select anything on the screen. But the scaling for the rest of the OS is messed up. My cursor is huge, for instance. So I can't keep it this way.

I am on Fedora Linux 38 (Workstation Edition).
Display server: Wayland
install method: Flatpak

from normcap.

mapleroyal avatar mapleroyal commented on June 10, 2024 1

Hey, sorry I haven’t been able to contribute to this, I no longer have that machine. I’m pretty confident that I was using normcap installed by appimage; I just checked back at my system configuration notes and they show normcap as being installed via appimage.

from normcap.

dynobo avatar dynobo commented on June 10, 2024 1

Thanks for testing, @travisfw ! Yeah, fractional scaling behaves different in other ways, too, so NormCap should work with both. But your confirmation, that NormCap is scaling correctly with fractional scaling activated, confirms my hypothesis that this is the root cause, so I might be able to provide a fix.

For everyone one interested, some additional background:

In the Wayland philosophy, the compositor has full control over the size and position of the application's windows. Wayland supports displaying windows in full-screen mode, but only for the screen they are currently on. There is no easy way to cover all monitors full screen. (With OpenGL this would be easily doable, but other things would get much harder, especially for a cross-platform application like NormCap).

NormCap, at least as it is currently implemented, requires full-screen coverage of all available screens. For Wayland, this is implemented with a "hacky" workaround: NormCap tries to read dimensions and positions of all screens, creates a (non-full-screen) window for each screen, resizes it to the screen's dimension, and moves it to the screen's position. This mimics multi-display fullscreens, so to speak. Since Wayland ultimately has full control over window positions and sizes, there is no guarantee that this will work on all setups and in future versions, but so far it has worked quite well.

Now, when screen scaling comes into play (which can even be set differently for each screen), this becomes even more difficult: window sizes and positions must be adjusted to match the scaling. NormCap does this by reading the scaling and dimension information of each screen via QTs API (the UI Framework, NormCap builds upon). What is new to me is that this information provided by QT seems to be different when fractional scaling is enabled or not, even when it is not used: The same setup, with the same displays and the same scaling factors (e.g. 200%) results in different scaling information from QT when fractional scaling is enabled or not.

The current NormCap issue should be fixable, e.g. by trying to guess if fractional scaling is enabled or not and considering this when resizing / repositioning the windows. It might not be super easy, and makes the hacky workaround even more hacky, but I'll give it a try.

For reference:

Other QT-based applications with similar requirements as NormCap are also struggling with those issues under Wayland. E.g. I'm following:

from normcap.

mapleroyal avatar mapleroyal commented on June 10, 2024 1

Also, the error for me would have been on GNOME on vanilla arch, using Wayland, on a “high res” laptop.

from normcap.

travisfw avatar travisfw commented on June 10, 2024 1

The scaling seems okay now! But the selected area seems to be off by the same scale. I just selected a blank area of the screen, and it extracted text from a smaller area up and to the left.

from normcap.

dynobo avatar dynobo commented on June 10, 2024

Hi @mapleroyal , I definitely strive for supporting different scalings with NormCap, so thanks for reporting this issue!

To be able to fix it, I'd need some more information to reproduce the issue:

  1. Desktop Environment (Gnome? KDE? Xfce?)
  2. Display Server (XOrg? Wayland?)
  3. NormCap installation method (AppImage? FlatPak? Pip? AUR?)

That would help me a lot!

from normcap.

dynobo avatar dynobo commented on June 10, 2024

Hi @louiscklaw, I'm having trouble to reproduce this, despite having the same setup like you, just Arch instead of Fedora.

Could you please run NormCap with it's debug flag, and share the output here?

./normcap -v debug

from normcap.

dynobo avatar dynobo commented on June 10, 2024

Today I was able to reproduce this is issue in a VM. To me, it seems like it is related to the "Fractional scaling" (125%, 150%,...) mode, which some distros seem to have enabled by default, other haven't. So far, I was only testing with Fractional Scaling mode, and that's what NormCap currently seem to support. The "Normal" scaling mode (200%, 300%) seems to behave totally different, even if the scaling value is the same:

The way a 200% scaling is received by a Qt application on e.g. a 1920x1080 display:

  • "Normal" Scaling: QScreen.size is 1920x1080, QScreen.DevicePixelRatio is 2
  • Fractional Scaling enabled: QScreen.size is 960x540, QScreen.DevicePixelRatio is 2

I'll try to come up with a solution that works for both displays.

In the meanwhile, could someone with this issue please confirm my hypothesis? That would help me a lot!

  1. What does gsettings get org.gnome.mutter experimental-features output for you?
  2. If you enable fractional scaling via gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']", does this fix the issue with NormCap?
    (You can easily revert the fractional scaling setting afterwards by running gsettings set org.gnome.mutter experimental-features "<Whatever output you had in 1.)>")

from normcap.

dynobo avatar dynobo commented on June 10, 2024

A potential fix for the scaling issues is ready for testing in v0.5.0-beta1.
Would be great if you could try it, and report back if it helped! 🙂

from normcap.

dynobo avatar dynobo commented on June 10, 2024

thanks for the feedback, @travisfw !
Some more questions:

  1. Do you have fractional scaling enabled? Like do you see 125%, 150% etc. in the settings? (Even if you don't use it and only have eg 200% configured it makes a difference.
  2. Do you have 1 or more displays/monitors? If so: same experience on both?

from normcap.

dynobo avatar dynobo commented on June 10, 2024

This problem should be fixed with the latest release. Could you please confirm?

from normcap.

dynobo avatar dynobo commented on June 10, 2024

Closing for now, please feel free to re-open or create a new issue, if the issue persists.

from normcap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.