From 493b7b73be668175bd0c5fdd71e536c25d112860 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Mon, 27 Jul 2026 23:17:54 +0900 Subject: [PATCH 1/4] Fix build failing when defining signals with Gdk.ScrollEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I suspect this is a bug of Vala. It tries to call gdk_value_get_event() which does not exist and fails to build with the following error message: ../src/Widgets/DisplayWidget.vala: In function ‘g_cclosure_user_marshal_VOID__GDK_EVENT’: ../src/Widgets/DisplayWidget.vala:18:19: error: implicit declaration of function ‘gdk_value_get_event’; did you mean ‘g_value_get_uint’? [-Wimplicit-function-declaration] 18 | public class Sound.DisplayWidget : Gtk.Box { | ^~~~~~~~~~~~~~~~~~~ | g_value_get_uint ../src/Widgets/DisplayWidget.vala:18:19: error: passing argument 2 of ‘callback’ makes pointer from integer without a cast [-Wint-conversion] 18 | public class Sound.DisplayWidget : Gtk.Box { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int This commit resolves the above build error by wrapping Gdk.ScrollEvent with GLib.Value. --- src/Indicator.vala | 12 ++++++++---- src/Widgets/DisplayWidget.vala | 14 ++++++++++---- src/Widgets/Scale.vala | 8 ++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index f572e625..dc9a6f37 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -328,14 +328,16 @@ public class Sound.Indicator : Wingpanel.Indicator { display_widget.icon_name = get_volume_icon (volume_control.volume.volume); } - private void on_volume_icon_scroll_event (Gdk.ScrollEvent e) { + private void on_volume_icon_scroll_event (Value event_boxed) { + unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); } } - private void on_mic_icon_scroll_event (Gdk.ScrollEvent e) { + private void on_mic_icon_scroll_event (Value event_boxed) { + unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -420,7 +422,8 @@ public class Sound.Indicator : Wingpanel.Indicator { volume_control.mic_volume = mic_adjustment.get_value (); }); - mic_scale.scroll_event.connect_after ((e) => { + mic_scale.scroll_event.connect_after ((event_boxed) => { + unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -443,7 +446,8 @@ public class Sound.Indicator : Wingpanel.Indicator { volume_scale.slider_dropped.connect (play_volume_change_sound); - volume_scale.scroll_event.connect_after ((e) => { + volume_scale.scroll_event.connect_after ((event_boxed) => { + unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 67815bb7..94602b5f 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -23,8 +23,10 @@ public class Sound.DisplayWidget : Gtk.Box { public bool mic_muted { get; set; } public string icon_name { get; set; } - public signal void volume_scroll_event (Gdk.ScrollEvent e); - public signal void mic_scroll_event (Gdk.ScrollEvent e); + // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter + // resulsts build error with valac 0.56.18 + public signal void volume_scroll_event (Value event_boxed); + public signal void mic_scroll_event (Value event_boxed); construct { var volume_icon = new Gtk.Image () { @@ -50,7 +52,9 @@ public class Sound.DisplayWidget : Gtk.Box { return Gdk.EVENT_PROPAGATE; } - mic_scroll_event ((Gdk.ScrollEvent) e); + var event_boxed = Value (typeof (Gdk.ScrollEvent)); + event_boxed.set_boxed (e); + mic_scroll_event (event_boxed); return Gdk.EVENT_STOP; }); @@ -60,7 +64,9 @@ public class Sound.DisplayWidget : Gtk.Box { return Gdk.EVENT_PROPAGATE; } - volume_scroll_event ((Gdk.ScrollEvent) e); + var event_boxed = Value (typeof (Gdk.ScrollEvent)); + event_boxed.set_boxed (e); + volume_scroll_event (event_boxed); return Gdk.EVENT_STOP; }); diff --git a/src/Widgets/Scale.vala b/src/Widgets/Scale.vala index f3259128..24307fba 100644 --- a/src/Widgets/Scale.vala +++ b/src/Widgets/Scale.vala @@ -4,7 +4,9 @@ */ public class Sound.Widgets.Scale : Granite.Bin { - public signal void scroll_event (Gdk.ScrollEvent e); + // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter + // resulsts build error with valac 0.56.18 + public signal void scroll_event (Value event_boxed); public signal void slider_dropped (); public Gtk.Adjustment adjustment { get; construct; } @@ -52,7 +54,9 @@ public class Sound.Widgets.Scale : Granite.Bin { return Gdk.EVENT_PROPAGATE; } - scroll_event ((Gdk.ScrollEvent) e); + var event_boxed = Value (typeof (Gdk.ScrollEvent)); + event_boxed.set_boxed (e); + scroll_event (event_boxed); return Gdk.EVENT_STOP; }); From 6dabd76545532ddf9478c11f1d47630e07a295e5 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Tue, 28 Jul 2026 21:56:01 +0900 Subject: [PATCH 2/4] Make sure scroll works --- src/Indicator.vala | 8 ++++---- src/Widgets/DisplayWidget.vala | 4 ++-- src/Widgets/Scale.vala | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index dc9a6f37..6b86af4a 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -329,7 +329,7 @@ public class Sound.Indicator : Wingpanel.Indicator { } private void on_volume_icon_scroll_event (Value event_boxed) { - unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); + unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); @@ -337,7 +337,7 @@ public class Sound.Indicator : Wingpanel.Indicator { } private void on_mic_icon_scroll_event (Value event_boxed) { - unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); + unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -423,7 +423,7 @@ public class Sound.Indicator : Wingpanel.Indicator { }); mic_scale.scroll_event.connect_after ((event_boxed) => { - unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); + unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -447,7 +447,7 @@ public class Sound.Indicator : Wingpanel.Indicator { volume_scale.slider_dropped.connect (play_volume_change_sound); volume_scale.scroll_event.connect_after ((event_boxed) => { - unowned var e = (Gdk.ScrollEvent) event_boxed.get_boxed (); + unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 94602b5f..31c1ee1e 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -53,7 +53,7 @@ public class Sound.DisplayWidget : Gtk.Box { } var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_boxed (e); + event_boxed.set_instance (e); mic_scroll_event (event_boxed); return Gdk.EVENT_STOP; }); @@ -65,7 +65,7 @@ public class Sound.DisplayWidget : Gtk.Box { } var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_boxed (e); + event_boxed.set_instance (e); volume_scroll_event (event_boxed); return Gdk.EVENT_STOP; }); diff --git a/src/Widgets/Scale.vala b/src/Widgets/Scale.vala index 24307fba..cdbde49e 100644 --- a/src/Widgets/Scale.vala +++ b/src/Widgets/Scale.vala @@ -55,7 +55,7 @@ public class Sound.Widgets.Scale : Granite.Bin { } var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_boxed (e); + event_boxed.set_instance (e); scroll_event (event_boxed); return Gdk.EVENT_STOP; From 5bf628a301180eaf3e14d49d4d7a637dfebbf1d1 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Tue, 28 Jul 2026 22:16:59 +0900 Subject: [PATCH 3/4] Review variable name --- src/Indicator.vala | 16 ++++++++-------- src/Widgets/DisplayWidget.vala | 16 ++++++++-------- src/Widgets/Scale.vala | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index 6b86af4a..86787edb 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -328,16 +328,16 @@ public class Sound.Indicator : Wingpanel.Indicator { display_widget.icon_name = get_volume_icon (volume_control.volume.volume); } - private void on_volume_icon_scroll_event (Value event_boxed) { - unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); + private void on_volume_icon_scroll_event (Value event_value) { + unowned var e = (Gdk.ScrollEvent) event_value.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); } } - private void on_mic_icon_scroll_event (Value event_boxed) { - unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); + private void on_mic_icon_scroll_event (Value event_value) { + unowned var e = (Gdk.ScrollEvent) event_value.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -422,8 +422,8 @@ public class Sound.Indicator : Wingpanel.Indicator { volume_control.mic_volume = mic_adjustment.get_value (); }); - mic_scale.scroll_event.connect_after ((event_boxed) => { - unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); + mic_scale.scroll_event.connect_after ((event_value) => { + unowned var e = (Gdk.ScrollEvent) event_value.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, true); @@ -446,8 +446,8 @@ public class Sound.Indicator : Wingpanel.Indicator { volume_scale.slider_dropped.connect (play_volume_change_sound); - volume_scale.scroll_event.connect_after ((event_boxed) => { - unowned var e = (Gdk.ScrollEvent) event_boxed.peek_pointer (); + volume_scale.scroll_event.connect_after ((event_value) => { + unowned var e = (Gdk.ScrollEvent) event_value.peek_pointer (); double dir = 0.0; if (handle_scroll_event (e, out dir)) { handle_change (dir, false); diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 31c1ee1e..6ed7e188 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -25,8 +25,8 @@ public class Sound.DisplayWidget : Gtk.Box { // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter // resulsts build error with valac 0.56.18 - public signal void volume_scroll_event (Value event_boxed); - public signal void mic_scroll_event (Value event_boxed); + public signal void volume_scroll_event (Value event_value); + public signal void mic_scroll_event (Value event_value); construct { var volume_icon = new Gtk.Image () { @@ -52,9 +52,9 @@ public class Sound.DisplayWidget : Gtk.Box { return Gdk.EVENT_PROPAGATE; } - var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_instance (e); - mic_scroll_event (event_boxed); + var event_value = Value (typeof (Gdk.ScrollEvent)); + event_value.set_instance (e); + mic_scroll_event (event_value); return Gdk.EVENT_STOP; }); @@ -64,9 +64,9 @@ public class Sound.DisplayWidget : Gtk.Box { return Gdk.EVENT_PROPAGATE; } - var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_instance (e); - volume_scroll_event (event_boxed); + var event_value = Value (typeof (Gdk.ScrollEvent)); + event_value.set_instance (e); + volume_scroll_event (event_value); return Gdk.EVENT_STOP; }); diff --git a/src/Widgets/Scale.vala b/src/Widgets/Scale.vala index cdbde49e..a7804c06 100644 --- a/src/Widgets/Scale.vala +++ b/src/Widgets/Scale.vala @@ -6,7 +6,7 @@ public class Sound.Widgets.Scale : Granite.Bin { // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter // resulsts build error with valac 0.56.18 - public signal void scroll_event (Value event_boxed); + public signal void scroll_event (Value event_value); public signal void slider_dropped (); public Gtk.Adjustment adjustment { get; construct; } @@ -54,9 +54,9 @@ public class Sound.Widgets.Scale : Granite.Bin { return Gdk.EVENT_PROPAGATE; } - var event_boxed = Value (typeof (Gdk.ScrollEvent)); - event_boxed.set_instance (e); - scroll_event (event_boxed); + var event_value = Value (typeof (Gdk.ScrollEvent)); + event_value.set_instance (e); + scroll_event (event_value); return Gdk.EVENT_STOP; }); From 0c8ac4aa8d827ab8530ba7ece1dd679066d5e18c Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Tue, 28 Jul 2026 22:23:08 +0900 Subject: [PATCH 4/4] Improve comment --- src/Widgets/DisplayWidget.vala | 1 + src/Widgets/Scale.vala | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 6ed7e188..56c13a46 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -25,6 +25,7 @@ public class Sound.DisplayWidget : Gtk.Box { // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter // resulsts build error with valac 0.56.18 + // See https://gitlab.gnome.org/GNOME/vala/-/work_items/1671 public signal void volume_scroll_event (Value event_value); public signal void mic_scroll_event (Value event_value); diff --git a/src/Widgets/Scale.vala b/src/Widgets/Scale.vala index a7804c06..e490b076 100644 --- a/src/Widgets/Scale.vala +++ b/src/Widgets/Scale.vala @@ -6,6 +6,7 @@ public class Sound.Widgets.Scale : Granite.Bin { // HACK: Using Gdk.ScrollEvent instead of Value as the type of the parameter // resulsts build error with valac 0.56.18 + // See https://gitlab.gnome.org/GNOME/vala/-/work_items/1671 public signal void scroll_event (Value event_value); public signal void slider_dropped ();