Initial window size does not work with scaling >100%
Environment: Linux Mint 22 with Cinnamon Not tested on other distributions or on Windows
Steps to reproduce:
- Set screen scaling to a value larger than 100%, e.g. 150% or 200% in your window manager control.
- 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.
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.
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.
I'd love some help in fixing this, especially as I don't use non-default scaling.
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.)
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.