Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial window size does not work with scaling >100% #127

Open
onno74 opened this issue Sep 21, 2024 · 5 comments
Open

Initial window size does not work with scaling >100% #127

onno74 opened this issue Sep 21, 2024 · 5 comments

Comments

@onno74
Copy link

onno74 commented Sep 21, 2024

Environment: Linux Mint 22 with Cinnamon
Not tested on other distributions or on Windows

Steps to reproduce:

  1. Set screen scaling to a value larger than 100%, e.g. 150% or 200% in your window manager control.
  2. Open an image that is larger than the screen

Expected outcome:
Cropgui window including menu bar should fit on the screen.
The image should be scaled down appropriately.

Actual outcome:
Menu bar (Crop button, resolutions, …) are missing
Portions of the image are not shown.

Suspected cause:
I think cropgui might read the original screen size in pixels and omits to divide it by the scaling factor.
The size of the window that cropgui tries to open is automatically scaled by the scaling factor. Hence it is larger than the monitor.
The window manager limits the size to the screen size, cropping the contents of the window.

@onno74
Copy link
Author

onno74 commented Sep 21, 2024

Also, in case of several monitors, winfo_screenwidth and winfo_screenheight get the dimensions of the combined monitor. We need the dimension of the current monitor.

@onno74
Copy link
Author

onno74 commented Sep 21, 2024

Suspected cause:
I think cropgui might read the original screen size in pixels and omits to divide it by the scaling factor.
The size of the window that cropgui tries to open is automatically scaled by the scaling factor. Hence it is larger than the monitor.
The window manager limits the size to the screen size, cropping the contents of the window.

Seems to be more difficult than that. Sometimes I also get too small images when scaling of the window manager is >100%. In this case the image thumbnail seems not to be displayed in the size it has.

@jepler
Copy link
Owner

jepler commented Sep 24, 2024

I'd love some help in fixing this, especially as I don't use non-default scaling.

@Ndolam
Copy link
Contributor

Ndolam commented Sep 24, 2024

I don't use cropgui, nor do I scale my monitor (aside: I really think that is the wrong solution to the problem).
However, if you are open to using cropgtk.py, you might try adding with
(untested!!)

monitor = display.get_monitor(0)
scale_factor = monitor.get_scale_factor()

after the line
display = gdk.Display().get_default()
and see if you can use the scaling information to divide the number of pixels by your scaling factor.

If you are only interested in cropgui.py, perhaps you can hunt for some tkinter function which returns the information. (I took a 3-minute look but didn't see it, sorry I can't help more.)

@onno74
Copy link
Author

onno74 commented Sep 24, 2024

Thank you for your hints. I might consider to try to fix it in future. But unfortunately I will we very busy over the next months.

Also what I found so far is quite confusing. Seems that the DragManagerBase renders the image in a size different from its actual size (i.e. the size of the thumbnail that has been set in DraManager) if a scaling is present in the window manager. And this different size is sometimes smaller and sometimes larger than the actual size. To make things worse, I have two monitors with different scaling, and it seems kind of random on which of them CropGUI opens. I've tried to debug, but another problem is that actually I've never learned python properly. My native language is C++. I do python mostly by mocking the syntax I see.

As a workaround, I get acceptable results by hardcoding max_h and max_w and disabling monitor scaling when using CropGUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants