+ widget_value* wv = 0;
+
+ /* First get the items if they have changed since this is a
+ structural change. As such it will nuke all added values so we
+ need to update most other things after the items have changed.*/
+ if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
+ {
+ Lisp_Object image_instance;
+
+ XSETIMAGE_INSTANCE (image_instance, p);
+ wv = gui_items_to_widget_values
+ (image_instance, IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p),
+ /* #### this is not right; we need to keep track of which widgets
+ want accelerators and which don't */ 0);
+ wv->change = STRUCTURAL_CHANGE;
+ }
+ else
+ {
+ /* Assume the lotus position, breath deeply and chant to
+ yourself lwlibsux, lwlibsux ... lw_get_all_values returns a
+ reference to the real values rather than a copy thus any
+ changes we make to the values we get back will look like they
+ have already been applied. If we rebuild the widget tree then
+ we may lose properties. */
+ wv = copy_widget_value_tree (lw_get_all_values
+ (IMAGE_INSTANCE_X_WIDGET_LWID (p)),
+ NO_CHANGE);
+ }
+
+ /* Possibly update the colors and font */
+ if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
+ ||
+ /* #### This is not sufficient because it will not cope with widgets
+ that are not currently visible. Once redisplay has done the
+ visible ones it will clear this flag so that when new ones
+ become visible they will not be updated. */
+ XFRAME (IMAGE_INSTANCE_FRAME (p))->faces_changed
+ ||
+ XFRAME (IMAGE_INSTANCE_FRAME (p))->frame_changed
+ ||
+ IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
+ {
+ update_widget_face (wv, p, IMAGE_INSTANCE_FRAME (p));
+ }
+
+ /* Possibly update the text. */
+ if (IMAGE_INSTANCE_TEXT_CHANGED (p))
+ {
+ char* str;
+ Lisp_Object val = IMAGE_INSTANCE_WIDGET_TEXT (p);
+ LISP_STRING_TO_EXTERNAL (val, str, Qnative);
+ wv->value = str;
+ }
+
+ /* Possibly update the size. */
+ if (IMAGE_INSTANCE_SIZE_CHANGED (p)
+ ||
+ IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)
+ ||
+ IMAGE_INSTANCE_TEXT_CHANGED (p))