+void
+x_set_title (f, name)
+ struct frame *f;
+ Lisp_Object name;
+{
+ /* Don't change the title if it's already NAME. */
+ if (EQ (name, f->title))
+ return;
+
+ update_mode_lines = 1;
+
+ f->title = name;
+
+ if (NILP (name))
+ name = f->name;
+
+ if (FRAME_X_WINDOW (f))
+ {
+ BLOCK_INPUT;
+#ifdef HAVE_X11R4
+ {
+ XTextProperty text, icon;
+ Lisp_Object icon_name;
+
+ text.value = XSTRING (name)->data;
+ text.encoding = XA_STRING;
+ text.format = 8;
+ text.nitems = XSTRING (name)->size;
+
+ icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
+
+ icon.value = XSTRING (icon_name)->data;
+ icon.encoding = XA_STRING;
+ icon.format = 8;
+ icon.nitems = XSTRING (icon_name)->size;
+#ifdef USE_X_TOOLKIT
+ XSetWMName (FRAME_X_DISPLAY (f),
+ XtWindow (f->output_data.x->widget), &text);
+ XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget),
+ &icon);
+#else /* not USE_X_TOOLKIT */
+ XSetWMName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &text);
+ XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon);
+#endif /* not USE_X_TOOLKIT */
+ }
+#else /* not HAVE_X11R4 */
+ XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ XSTRING (name)->data);
+ XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ XSTRING (name)->data);
+#endif /* not HAVE_X11R4 */
+ UNBLOCK_INPUT;
+ }
+}
+\f