+ /* Retrieve the gui item information. This is easy if we have been
+ provided with a vector, more difficult if we have just been given
+ keywords.
+
+ #### This is inconsistent with instantiation in that you have to
+ have the :descriptor keyword for updates in order to recognise
+ changes. */
+ if (VECTORP (desc))
+ {
+ descriptor_item = gui_parse_item_keywords_no_errors (desc);
+ }
+ else
+ {
+ /* Since we are updating the instantiator could be incomplete
+ and hence the gui item descriptor not well formed. We
+ therefore try updating and discard the results if nothing
+ changed. */
+ descriptor_item = copy_gui_item (IMAGE_INSTANCE_WIDGET_ITEM (ii));
+ if (!update_gui_item_keywords (descriptor_item, instantiator))
+ descriptor_item = Qnil;
+ }
+
+ /* Record new items for update. *_redisplay will do the
+ rest. */
+ if (!EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)
+ &&
+ !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout))
+ {
+ if (!NILP (items))
+ {
+ if (NILP (descriptor_item))
+ descriptor_item = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+
+ check_valid_item_list (items);
+#ifdef DEBUG_WIDGET_OUTPUT
+ stderr_out ("items for widget %p updated\n",
+ IMAGE_INSTANCE_SUBWINDOW_ID (ii));
+#endif
+ /* Don't set the actual items since we might decide not to use
+ the new ones (because nothing has really changed). If we did
+ set them and didn't use them then we would get into whole
+ heaps of trouble when the old items get GC'd. */
+ descriptor_item = Fcons (descriptor_item, parse_gui_item_tree_children (items));
+ }
+ /* If the descriptor was updated but not the items we need to fill
+ in the `new' items. */
+ else if (!NILP (descriptor_item)
+ &&
+ CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
+ {
+ descriptor_item = Fcons
+ (descriptor_item,
+ copy_gui_item_tree (XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))));
+ }
+ }
+
+ if (!NILP (descriptor_item))
+ {
+ IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = descriptor_item;
+ IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 1;
+ }
+
+ UNGCPRO;
+