Commit 546e6d5b authored by Richard M. Stallman's avatar Richard M. Stallman

(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.

(x_iconify_frame) [USE_X_TOOLKIT]: New code for invisible window case.
(XtNinitialState) [USE_X_TOOLKIT]: New #define.
(x_make_frame_invisible): Mostly combine toolkit/non-toolkit cases,
in the process fixing a dumb bug.

(x_iconify_frame): Fix error messages.
parent 574efc83
......@@ -96,6 +96,12 @@ extern void _XEditResCheckMessages ();
#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) */
......@@ -5505,6 +5511,14 @@ x_make_frame_invisible (f)
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)
......@@ -5526,18 +5540,12 @@ x_make_frame_invisible (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
......@@ -5547,11 +5555,7 @@ x_make_frame_invisible (f)
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,
......@@ -5561,16 +5565,12 @@ x_make_frame_invisible (f)
&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));
......@@ -5612,13 +5612,24 @@ x_iconify_frame (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;
......@@ -5651,7 +5662,7 @@ x_iconify_frame (f)
&message))
{
UNBLOCK_INPUT_RESIGNAL;
error ("Can't notify window manager of iconification.");
error ("Can't notify window manager of iconification");
}
}
......@@ -5927,15 +5938,18 @@ x_wm_set_window_state (f, state)
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment