Notify signal and underscore vs hyphen

Recently I noticed that notify signals like “notify::cursor-position” are not supported for the gintro NIm bindings, so I just tried to fix that.

Funny fact is that for most signals undescores and hyphen works, but for latest GTK4 underscore as in “notify::cursor_position” does not work. And unfortunately the gintro bindings do replace always ‘-’ with ‘_’ for signal names, so it was not working at the beginning. But seems that I have now fixed that.

Google told me, see

Re: g_connect_signal events. underscore vs dash

Is that documented somewhere, and is there a reason for that. Luckily that was my first and only guess, so I lost not much time with it, really only a few minutes :slight_smile:

Signal and property names are normalised internally:

The detail of a signal is a free-form string that gets converted into a quark (an integer identifier in a 1:1 map with the exact string):

While the detail argument is typically used to pass an object property name (as with “notify”), no specific format is mandated for the detail string, other than that it must be non-empty.

The detail cannot be normalised, because otherwise it would break existing code. Your binding must ensure that you always connect to the name of the property as specified in the code that defined that property.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.