#define x_top_window_to_frame x_window_to_frame
#endif
+#ifdef USE_X_TOOLKIT
+#ifndef XtNinitialState
+#define XtNinitialState "initialState"
+#endif
+#endif
+
#ifdef HAVE_X11
#define XMapWindow XMapRaised /* Raise them when mapping. */
#else /* ! defined (HAVE_X11) */
struct frame *f;
{
int mask;
+ Window window;
+
+#ifdef USE_X_TOOLKIT
+ /* Use the frame's outermost window, not the one we normally draw on. */
+ window = XtWindow (f->display.x->widget);
+#else /* not USE_X_TOOLKIT */
+ window = FRAME_X_WINDOW (f);
+#endif /* not USE_X_TOOLKIT */
/* Don't keep the highlight on an invisible frame. */
if (x_highlight_frame == f)
#ifdef HAVE_X11R4
-#ifdef USE_X_TOOLKIT
- if (! XWithdrawWindow (x_current_display, XtWindow (f->display.x->widget),
- DefaultScreen (x_current_display)))
-#else /* not USE_X_TOOLKIT */
- if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f),
+ if (! XWithdrawWindow (x_current_display, window,
DefaultScreen (x_current_display)))
{
UNBLOCK_INPUT_RESIGNAL;
- error ("can't notify window manager of window withdrawal");
+ error ("Can't notify window manager of window withdrawal");
}
-#endif /* not USE_X_TOOLKIT */
-
#else /* ! defined (HAVE_X11R4) */
#ifdef HAVE_X11
XEvent unmap;
unmap.xunmap.type = UnmapNotify;
-#ifdef USE_X_TOOLKIT
- unmap.xunmap.window = XtWindow (f->display.x->widget);
-#else /* not USE_X_TOOLKIT */
- unmap.xunmap.window = FRAME_X_WINDOW (f);
-#endif /* not USE_X_TOOLKIT */
+ unmap.xunmap.window = window;
unmap.xunmap.event = DefaultRootWindow (x_current_display);
unmap.xunmap.from_configure = False;
if (! XSendEvent (x_current_display,
&unmap))
{
UNBLOCK_INPUT_RESIGNAL;
- error ("can't notify window manager of withdrawal");
+ error ("Can't notify window manager of withdrawal");
}
}
/* Unmap the window ourselves. Cheeky! */
-#ifdef USE_X_TOOLKIT
- XUnmapWindow (x_current_display, XtWindow (f->display.x->widget));
-#else /* not USE_X_TOOLKIT */
- XUnmapWindow (x_current_display, FRAME_X_WINDOW (f));
-#endif /* not USE_X_TOOLKIT */
+ XUnmapWindow (x_current_display, window);
#else /* ! defined (HAVE_X11) */
XUnmapWindow (FRAME_X_WINDOW (f));
#ifdef USE_X_TOOLKIT
BLOCK_INPUT;
+
+ if (! FRAME_VISIBLE_P (f))
+ {
+ if (! EQ (Vx_no_window_manager, Qt))
+ x_wm_set_window_state (f, IconicState);
+ /* This was XtPopup, but that did nothing for an iconified frame. */
+ XtMapWidget (f->display.x->widget);
+ UNBLOCK_INPUT;
+ return;
+ }
+
result = XIconifyWindow (x_current_display,
XtWindow (f->display.x->widget),
DefaultScreen (x_current_display));
UNBLOCK_INPUT;
if (!result)
- error ("Can't notify window manager of iconification.");
+ error ("Can't notify window manager of iconification");
f->async_iconified = 1;
&message))
{
UNBLOCK_INPUT_RESIGNAL;
- error ("Can't notify window manager of iconification.");
+ error ("Can't notify window manager of iconification");
}
}
int state;
{
#ifdef USE_X_TOOLKIT
- Window window = XtWindow (f->display.x->widget);
+ Arg al[1];
+
+ XtSetArg (al[0], XtNinitialState, state);
+ XtSetValues (f->display.x->widget, al, 1);
#else /* not USE_X_TOOLKIT */
Window window = FRAME_X_WINDOW (f);
-#endif /* not USE_X_TOOLKIT */
f->display.x->wm_hints.flags |= StateHint;
f->display.x->wm_hints.initial_state = state;
XSetWMHints (x_current_display, window, &f->display.x->wm_hints);
+#endif /* not USE_X_TOOLKIT */
}
x_wm_set_icon_pixmap (f, icon_pixmap)