Skip to content

overlay-split-view: Add sidebar resizing via drag gestures

This MR adds the ability to resize the sidebar via dragging. Both touch and pointer gestures are supported.

I expect that this will mostly be useful for desktop applications that need to implement the utility pane pattern but use / require manual resizing. Two examples that immediately come to mind are cambalache and gnome-builder. Admittedly, manually resizing a sidebar is "busy work" that would be better if the user did not have to do at all, but sometimes it is unavoidable or expected for a better user experience.

Benefits:

  • I think this would obviate the need for a great deal of libpanel, easing the burden of maintainership on @chergert. gnome-builder would have to be adapted to use OverlaySplitViews and an AdwDialog or AdwBottomSheet for the bottom utility pane, but this would allow gnome-builder to be fully adaptable and stay up-to-date with libadwaita widgets/features/theming. (edit: see comments, would be difficult to remove PanelDock and libpanel interdependencies from builder).
  • It could potentially solve issues like this (nautilus#3010) by adding a setting to enable resizing.
  • Applications that want or need a resizable sidebar can (potentially) use libadwaita instead of libpanel or something like GtkPaned which would be nice!
  • libpanel wouldn't need (as many?) style updates to maintain compatibility with libadwaita.

Drawbacks:

  • More code to maintain.
  • ???

Things to note about the implementation / behavior:

  • The property (enable-drag-resize) is FALSE by default.
  • The width set via drag is constrained by the min-sidebar-width and max-sidebar-width properties, and it cannot exceed the width of the OverlaySplitView.
  • Resizing (changing the width) of the OverlaySplitView will cause the sidebar to not use the width set via drag and revert to using its other properties like min-sidebar-width and max-sidebar-width to adjust its size. This preserves its adaptability. Setting enable-drag-resize to FALSE will do the same.
  • The drag width is not constrained by the width of the content and if set too large may cause allocation errors as the content no longer has space to layout. If enable-drag-resizeis set to TRUE it would be wise to ensure that max-sidebar-width leaves enough space for the content. This could be changed.

Note: much of this was shamelessly taken and adapted from GtkPaned.

Edited by Caleb Gartner

Merge request reports

Loading