-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Can't shrink window #69
Comments
This is a Pick bug, but it's caused because I don't know how to make a Gtk window be a certain size at my request but still allow it to be resized smaller. The code currently uses |
https://developer.gnome.org/pygtk/stable/class-gtkwindow.html#method-gtkwindow--set-default-size suggests changing from |
Sadly, using |
Yeah - looks like set_size_request is the wrong thing. From the set_default_size info:
So you could maybe try using the resize() method? |
If you remove the formatters combobox I bet you'll find it shrinks a lot more. That's the element that is setting the minimum width, even when it's hidden. |
(obviously that's not a solution, but should help you figure out where the limiting factor is) |
You would think, wouldn't you? However, doing
It doesn't, I'm afraid. The formatters dropdown is a fixed size; it certainly enforces something of a minimum size on the window, but it does not grow with the window. If you increase the size of the Pick window, close Pick, and then re-open it, the size of the formatters dropdown doesn't change, and doesn't take up the full width of the window... and the window cannot be resized any smaller than it currently is. Using |
There is some sort of weird reason why calling window.resize doesn't work on startup. Maybe there's some other event that needs waiting for? Anyway, now we resize and move the window after a short timeout, and that seems to fix issue #69. Not hugely happy with this fix, but ho hum; let's hope it's OK for now, and if someone cleverer at Gtk can explain which event I ought to be waiting for so that window.resize() is not sometimes ignored, then I'll start paying attention to that instead rather than using hacky timeouts.
Hmm, you're right. I'm sure it was behaving differently yesterday. Anyway, I think this exposes another bug. Pick saves window width and height as a proportion of the screen width/height to ~/.cache/colour-picker.json and attempts to restore them (so removing that file would've been a quick fix). @popey I wonder if you ran pick last time when your laptop wasn't docked, and so the screen size was small. After you docked, the screen size is much bigger, but pick was still using the same proportions for restoring so the window size became massive. |
It does (and screen position, too). This is to avoid the issue where a saved position is off the edge of, or larger than, the screen it's being restored onto; it does have the problem you mention, where Pick saving its size on a small screen and then restoring onto a big one makes it large, but it's at least guaranteed to be within the screen, rather than being partially off it (which is very hard to fix unless you're the sort of power user who knows about alt+dragging to move a window, or alt+space to get at the window menu). I'm not sure this is fixable -- as far as I'm aware, you either have one problem or the other -- and so I went for the one that causes fewer problems for non-expert users, but I'm happy to hear suggestions for alternate ways it should work. ("The desktop remembers for you and restores windows spatially to where they were last, for every application" is a better solution but that battle was lost many years ago, and I think that Pick always coming up in the same place for a user is valuable enough that I implemented it inside the app and plan to keep it doing that, somehow.) |
You could save the old screen resolution and compare, then if they're different either try to be clever about it (likely to fail on non-rectangular composite screens like Popey's and mine), or just don't bother about restoring the size/position in that likely rare case. |
Did you look any closer at set_geometry_hints() as a way of setting a sensible minimum first? |
I didn't, 'cos the above commit works -- I think what I was doing before was trying to resize too early, perhaps before the window was properly realised, so the actual fix here is to work out what I need to wait for and then set the size based on that. Maybe set_geometry_hints would help to set the size before then, although that's what set_size_request is for (it just has the awful side effect of setting a minimum size as well). |
Somehow I have managed to make the pick window large and am unable to make it smaller again. It occupies a huge amount of my desktop (3 screens) and can't be made smaller.
The text was updated successfully, but these errors were encountered: