This implements a usability feature that GTK 3 removed a long time ago: the ability to scroll over tabs. Other toolkits and software _(GTK2, Qt apps, MATE apps, Chromium, Firefox)_ support this, so it would feel natural for Geany to support too.
Addresses #872. Not "fixes/closes" as this is only reinstated for document tabs. If one knows where to look, it is probably trivial to add the event for other tabs too (sidebar, message window, preferences).
_Based on this commit for MATE Caja: https://github.com/mate-desktop/caja/commit/0b4c7a6b8c25afb987d08bfd2c4c9be5... (GPLv2)_ You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3134
-- Commit Summary --
* Add ability to scroll over document tabs
-- File Changes --
M src/notebook.c (32)
-- Patch Links --
https://github.com/geany/geany/pull/3134.patch https://github.com/geany/geany/pull/3134.diff
Seems to be requested quite often. I think I'll merge this.
Looks good and works.
@lah7 could you fix the following compiler warnings? ``` notebook.c: In function ‘notebook_tab_bar_scroll_cb’: notebook.c:556:9: warning: enumeration value ‘GDK_SCROLL_SMOOTH’ not handled in switch [-Wswitch] 556 | switch (event->direction) | ^~~~~~ notebook.c:550:43: warning: unused variable ‘action_widget’ [-Wunused-variable] 550 | GtkWidget *child, *event_widget, *action_widget; | ^~~~~~~~~~~~~ notebook.c:550:28: warning: unused variable ‘event_widget’ [-Wunused-variable] 550 | GtkWidget *child, *event_widget, *action_widget; | ^~~~~~~~~~~~ ```
@lah7 pushed 1 commit.
417dd007255b2fbe1307b698c3f5c39d9de5eda3 Add ability to scroll over document tabs
Yep, [those warnings were fixed](https://github.com/geany/geany/compare/2dbd30732dc5ab443576218070af1612b9c46...) and force pushed.
Merged #3134 into master.
Thanks for this, however, you forgot the close button, where scrolling suddenly stops. Fix:
~~~ @@ -745,10 +745,12 @@ gint notebook_new_tab(GeanyDocument *this)
align = gtk_alignment_new(1.0, 0.5, 0.0, 0.0); gtk_container_add(GTK_CONTAINER(align), btn); gtk_box_pack_start(GTK_BOX(hbox), align, TRUE, TRUE, 0);
+ gtk_widget_add_events(btn, GDK_SCROLL_MASK); + g_signal_connect(btn, "clicked", G_CALLBACK(notebook_tab_close_clicked_cb), this); /* button overrides event box, so make middle click on button also close tab */ g_signal_connect(btn, "button-press-event", G_CALLBACK(notebook_tab_click), this); /* handle style modification to keep button small as possible even when theme change */ g_signal_connect(btn, "style-set", G_CALLBACK(notebook_tab_close_button_style_set), NULL);
~~~
github-comments@lists.geany.org