When the user drags the message window or the sidebar window too much towards the edge of the main window, it may become too hard or even impossible to drag them back as towards the edge of the main window the cursor resizes the main window and doesn't allow dragging the sidebar separator. The only workaround in this case is to manually edit the Geany config file which is annoying.
This patch does two things: 1. When the sidebar/msgwindow divider is dragged to the edge of the window, at the 10px distance from the window border it "snaps" completely to the edge and toggles sidebar/msgwindow visibility. 2. When sidebar/msgwindow is toggled to be shown again, if its previous distance from the edge of the window is less than 10px, its size is restored to some reasonable size (300px for the sidebar, 200px for the message window)
This patch has been tested with all the sidebar/msgwindow location settings and should work correctly in all the configurations.
Fixes #4017. Fixes #1753. Fixes #3329. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/4023
-- Commit Summary --
* Improve sidebar and message window resizing behavior
-- File Changes --
M data/geany.glade (2) M src/callbacks.c (37) M src/msgwindow.c (15) M src/ui_utils.c (13)
-- Patch Links --
https://github.com/geany/geany/pull/4023.patch https://github.com/geany/geany/pull/4023.diff
Looks very good.
Two minor remarks: - maybe we could add a short comment in https://github.com/geany/geany/pull/4023/files#diff-42b5b46e89c71a2aee5d52ad... and https://github.com/geany/geany/pull/4023/files#diff-8396dc9c2232193e29aaeddb... to explain why we are doing this - I noticed if the panes are restored after they have been set to < 10px, the message window pane takes some more space than before (relative to the default window size). This is probably no big issue because most users will *not* use the default window size as it is way too small and we can never know what the correct size will be. And after all, this is probably also dependent on the GTK theme. We could use a dynamic ratio based on parent widget allocation but then again, this probably won't fit the users preference. So it is probably fine as is.
Fresh config: ![geany_default_pane_positions](https://github.com/user-attachments/assets/e28e545c-30e2-4393-809c-8c7d116d6...) After panes have been set to <10px and restored: ![geany_restored_pane_positions](https://github.com/user-attachments/assets/eff3a8a6-ca3d-4dcd-9723-6df744344...)
**After all, I think this is a very good addition to help users to easily restore the panes after they have been (maybe accidentally) hidden by setting the size too small.**
@eht16 also note all the discussion on #4017 and the addition options.
> @eht16 also note all the discussion on #4017 and the addition options.
Be patient with me :). I was posting there while you posted here.
@techee pushed 2 commits.
0fba3e9301f5303f01b16085630a9f991c505890 Make re-shown message window smaller 0f70372c031e62c5a22c22d930ff5f70559170bb Add comments
> maybe we could add a short comment in https://github.com/geany/geany/pull/4023/files#diff-42b5b46e89c71a2aee5d52ad... and https://github.com/geany/geany/pull/4023/files#diff-8396dc9c2232193e29aaeddb... to explain why we are doing this
Done, also at the other places.
> I noticed if the panes are restored after they have been set to < 10px, the message window pane takes some more space than before (relative to the default window size). This is probably no big issue because most users will not use the default window size as it is way too small and we can never know what the correct size will be. And after all, this is probably also dependent on the GTK theme. We could use a dynamic ratio based on parent widget allocation but then again, this probably won't fit the users preference. So it is probably fine as is.
I made it smaller so it's roughly equal to the default value (there seems to be some more complicated way of determining the default value in https://github.com/geany/geany/blob/6ffe16b104e306ec50548bcf032a558ac5b380e0... but I don't think it's worth it for this case)
> After all, I think this is a very good addition to help users to easily restore the panes after they have been (maybe accidentally) hidden by setting the size too small.
Thanks, I have a powerful ally against @elextr :-)
@eht16 approved this pull request.
I didn't check everything but I think I have remarks, I'll try and make them soon™
github-comments@lists.geany.org