I have an application where several gtkdatabox's are "stacked" with one horizontal axis. If the user zooms in on one of them, I want the others to all zoom (X-only) to the same part of the scale. I'm doing this by hooking into the "zoomed" signal and calling gtk_databox_set_visible_limits on all the others.
What actually happens is that the other graphs all shift left rather than zooming. I have spent considerable time debugging this and it's clear that my code is passing the correct request but gtk_databox_set_visible_limits is not setting the limits correctly. This is odd, as there's nothing obviously wrong with the library code (v0.9.3.0).
The conclusion I've reached is that the problem occurs because of the gtk_adjustment_set_value call at line 1879 of gtkdatabox.c invoking the signal callback to gtk_databox_adjustment_value_changed at line 1591, which calls gtk_databox_calculate_visible_limits, which overwrites my requested visible_right at line 1910.
I'm still pondering the best fix.
OK, this patch seems to fix the issue. Since the code in gtk_databox_set_visible_limits calls gtk_adjustment_set_xxx to sync from the updated private data to the adjustments, it should suspend the callback action that syncs the other way while it's doing so.
Hi, I tried a simpler solution, see if it works for you too.
I'll check that out when I get a chance. My understanding is that g_signal_handlers_block_by_func essentially should do exactly what my patch did. The devs on the GTKmm mailing list certainly gave me both versions as being "equivalent" for a similar problem a while back.