GtkAdjustment property notifications are extremely spammy
At least in GTK+ 3 *
, a GtkAdjustment
does little to nothing to stop spurious notifications for its properties (I think only the set_page_size()
method makes a token effort, really), meaning that lots of signals get fired when there is no need/point, especially when set via gtk_adjustment_configure()
, as done e.g. by GtkRange
and subclasses.
An example of this being far too chatty, at least in GTK+ 3, is connecting to notify::page-size
in order to assess whether things need moved if a GtkWindow
containing a GtkScrolledWindow
is resized: it basically looks like notify::page-size
gets fired for every ::size-allocate
, so multiple times as a window animates between backdrop and foreground states, whenever you hover over a child widget or click a button, or etc. This results in a lot of extra work being done for no good reason (unless we track manually whether the size really changed).
This can be observed in the Inspector; just open a window with a scrollbar and start recording the number of calls to ::changed
as you hover over children, change the window stacking, etc.
*
In master
, Timm's done a lot of cleanups to how properties are handled, and either that or other changes (maybe to ::size-allocate
?) have reduced the severity of this: I can't immediately see any problem there.
I didn't check yet but presume that using explicit notification could avoid all the redundant emissions, but I figured I'd better check whether there's some reason this isn't already done? I also am not sure this can be changed in GTK+ 3, just in case someone somehow relies on the extreme chattiness it currently exhibits there. It doesn't look there's much to change in master
anyway.