Every window containing some property editor widgets has to process the kernel
property hooks and call the
prop_sync function to update the editor
value. This lowers the memory usage – one hook is set for all property editor
widgets in a window. The editor widget itself handles its value changes
and modifies the kernel property values accordingly. The editor value for
real numbers is multiplied by the unit multiplier.
The value in the editor is always synchronized to show the current kernel values (multiplied by unit multipliers). The kernel values do not have to be equal to values that the user has set; for example, if he tries to change the start point coordinates of a geometrically dependent curve, the kernel values remain unchanged and the editor returns to the kernel values.
Not every editor value change is written to kernel – first, the kernel value is compared with the one in the editor and if they differ a little, the values are considered equal (up to rounding changes) and the kernel value remains unchanged. This, too, prevents cycling such as this:
This does not in fact cause an infinite cycle, because the property value is locked in kernel during a property change hook call and any attempt to change the value again causes an error. So, the problem must be detected anyway; we do it by comparing the values.
The editor widgets usually use the following value-change callback:
void prop_value_changed( GtkWidget * w UNUSED, struct prop_item * pi );
which extracts the value from the widget according to the property type and subtype, compares the old and new values and changes the kernel value if needed. The widget values are updated by
void prop_sync( struct prop_item * pi ); void prop_sync_prop( struct prop_item * pi, struct prop * prop );
(the former one finds the kernel property value according to the property
key identifier stored in
pi and calls the latter).