GNOME Bugzilla – Bug 562405
No gui way to reset a GtkPaned to auto mode
Last modified: 2018-05-02 14:37:22 UTC
Once the slider in a GtkPaned has been used, it cannot be returned to "auto" mode. Double-clicking seems like a nice way to perform that action. This code (from Gnumeric) might be inspirational: static gboolean cb_paned_button_press (GtkWidget *widget, GdkEventButton *event) { GtkPaned *paned = (GtkPaned *)widget; if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { /* Cancel the drag that the first click started. */ GTK_WIDGET_GET_CLASS(paned)->button_release_event (widget, event); /* Then turn off set position that was set. */ gtk_paned_set_position (paned, -1); signal_paned_repartition (paned); return TRUE; } return FALSE; }
Don't forget to add some keynav equivalent
Created attachment 124001 [details] [review] Double click resets pane position This change implements the double click behaviour. I have no idea how one would expect to do this with a keyboard, though.
Created attachment 124041 [details] [review] Double click resets paned #2 Corrected patch, the original one didn't check the gdk window and therefore caused double clicks in any child of the paned to reset the pane.
See bug 311733 for some discussion of double-clicking on small targets, and for an alternative proposal for what to use double-click on a paned handle for.
Review of attachment 124041 [details] [review]: This would presumably need done in a different way now that GtkPaned in GTK+ 3/4 uses gestures. Also, I second that this would need a way to do the same thing by keyboard. ::: gtk/gtkpaned.c @@ +1211,3 @@ GtkPaned *paned = GTK_PANED (widget); + if (event->window != paned->handle || event->button != 1) Aside from that, 1 should be changed to GDK_BUTTON_PRIMARY.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/305.