From bbd3412b02e54c611d6e660e94179e22d0ff4338 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 3 Nov 2023 15:44:01 +0100 Subject: src/menubar.vala: Add scroll signalling --- src/menubar.vala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/menubar.vala b/src/menubar.vala index 6dd802b..03d15e1 100644 --- a/src/menubar.vala +++ b/src/menubar.vala @@ -33,6 +33,8 @@ private class IndicatorMenuItem : Gtk.MenuItem this.hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 3); this.add (this.hbox); this.hbox.show (); + this.add_events (Gdk.EventMask.SCROLL_MASK); + this.scroll_event.connect (this.scrolled_cb); if (entry.label != null) { @@ -65,6 +67,14 @@ private class IndicatorMenuItem : Gtk.MenuItem { visible = has_visible_child (); } + + public bool scrolled_cb (Gtk.Widget pWidget, Gdk.EventScroll pEvent) + { + Indicator.Object pObject = pWidget.get_data ("indicator-object"); + GLib.Signal.emit_by_name (pObject, "entry-scrolled", 1, pEvent.direction); + + return false; + } } public class MenuBar : Gtk.MenuBar @@ -449,6 +459,7 @@ public class MenuBar : Gtk.MenuBar debug ("Adding indicator object %p at position %d", entry, pos); var menuitem = new IndicatorMenuItem (entry); + menuitem.set_data ("indicator-object", object); insert (menuitem, pos); } -- cgit v1.2.3