GdkEvent subtypes trigger assert in Gtk4
GdkEvents are now a fundamental type in Gtk4 rather than a boxed type.
Those subtypes set value_table
to NULL
, which triggers an assertion in
gi/fundamental.cpp. Here's a simple reproducer:
imports.gi.versions.Gtk = '4.0';
const { GObject, Gtk } = imports.gi;
const MyApp = GObject.registerClass(
class MyApp extends Gtk.Application {
_init() {
super._init({
application_id: 'org.gnome.fmuellner.ClickTest',
});
}
vfunc_activate() {
let { activeWindow } = this;
if (!activeWindow)
activeWindow = new MyWindow({ application: this });
activeWindow.present();
}
});
const MyWindow = GObject.registerClass(
class MyWindow extends Gtk.ApplicationWindow {
_init(params) {
super._init({
...params,
defaultWidth: 500,
defaultHeight: 400,
});
this.child = new Gtk.Label({
label: 'Click Me!',
});
const clickGesture = new Gtk.GestureClick();
clickGesture.connect('released',
() => log(clickGesture.get_current_event()));
this.child.add_controller(clickGesture);
}
});
new MyApp().run(null);
I'm not sure whether this is an issue in gjs, or gobject-introspection (g_object_info_get_*_function() not chaining up) or gtk/gdk, but as the immediate problem is an assertion in gjs, this appears to be a good starting point.