Closed dark-penguin closed 1 year ago
Yes, we agree, restoring the window to a different position is annoying. However, we don't know why this happens. Feel free to inspect the code and point out the fault: Basically all that happens is that when you miminise, the window is completely hidden, so the (Windows speak) taskbar button disappears: https://github.com/Betterbird/thunderbird-patches/blob/0bf4c840c54461d1b158b8d5c33f23cac12e32fc/115/features/13-feature-linux-minimise-to-tray.patch#L434
When restoring, this is reverted: https://github.com/Betterbird/thunderbird-patches/blob/0bf4c840c54461d1b158b8d5c33f23cac12e32fc/115/features/13-feature-linux-minimise-to-tray.patch#L321 This is followed by "presenting" the window with a GTK call: https://github.com/Betterbird/thunderbird-patches/blob/0bf4c840c54461d1b158b8d5c33f23cac12e32fc/115/features/13-feature-linux-minimise-to-tray.patch#L331 and focussing it: https://github.com/Betterbird/thunderbird-patches/blob/0bf4c840c54461d1b158b8d5c33f23cac12e32fc/115/features/13-feature-linux-minimise-to-tray.patch#L332
We can't see that is would be in the responsibility of the application to tell the desktop where to show the window, the desktop should restore it where it was. Note that instead of gtk_window_present()
we had also used gtk_window_deiconify()
(see "take 4", https://github.com/Betterbird/thunderbird-patches/issues/111#issuecomment-1694683944 which doesn't work, https://github.com/Betterbird/thunderbird-patches/issues/111#issuecomment-1694713263).
So if you have any good idea, please let us know. Maybe it's necessary to get the windows position and dimension when hiding the window and restore those when unhiding it.
OK, we added this code restore-size.patch.txt but it doesn't work. If you run it from the terminal window you can see that it doesn't restore to where it was, or sometimes it thinks it restored correctly (according to the output), but in fact it didn't. Here's a version with this patch for you to try, maybe it works better on your desktop: https://www.betterbird.eu/downloads/115-Preview/betterbird-115.2.0-bb10-refresh-resize.en-US.linux-x86_64.tar.bz2
We could also try to use native GTK calls to achieve this: https://docs.gtk.org/gtk3/method.Window.move.html https://docs.gtk.org/gtk3/method.Window.resize.html
We could also try to use native GTK calls to achieve this
AFAIK this is the right way to do it - at least that's what's recommended for Qt, and what I do.
Let's try that patch (thank you for providing a build ready for testing!!)... Yes, that works! (on MATE)
Using native calls works beautifully when the Mozilla calls didn't. Give us 30 min to finalise.
OK, this should also work on Mate, works better than the first version on Xfce (Gotta love Linux for all the diversion 😢): https://www.betterbird.eu/downloads/115-Preview/betterbird-115.2.0-bb10-refresh-resize-native.en-US.linux-x86_64.tar.bz2
@felixoi @Zahrun: You were interested in this feature, explicit complaint about not restoring well in https://github.com/Betterbird/thunderbird-patches/issues/111#issuecomment-1694666421, so please give the "resize native" version a whirl before we'll ship it officially in 115.2.1 next Tuesday, 12th of September 2023.
Works "better" now. It shows at the default position for a second and then moves to the correct one. Not sure if this is fixable.
A second?? Wow, not for me, it pops back to the correct position immediately. Sure, there are separate calls, but there shouldn't be a second between them.
I believe that's the German for "one moment". :)
I believe that's the German for "one moment". :)
haha yeah 😄
Actually I just tried to reproduce again and now it's also immediately the correct position. Dunno what influenced it in the first place.
The only thing left for perfection on Gnome is now that you currently have to double click. It seems like that's intended by GNOME tho. Other apps like Jetbrains Toolbox also need to be double clicked from tray.
Well, the German should learn some English, 😉 - It's "split second" in English. The double-click appears to be a Gnome-ism. We'll add it to the documentation.
Works well in KDE :)
One more nicety would be to store the window position before minimizing, and restore the window to that position. Currently, it restores to the "default position for a new window".
This is something I would see as a big improvement (at least for my workflow) - unless it's unreasonably hard to implement.