# HG changeset patch # User Richard M. Stallman # Date 769498567 0 # Node ID 136819b017fca9ed338833e651423acd90f5da9c # Parent c5927c75b2b547302c77c4d72a575d84cf358b86 (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. diff -r c5927c75b2b5 -r 136819b017fc src/xterm.c --- a/src/xterm.c Sat May 21 02:28:15 1994 +0000 +++ b/src/xterm.c Sat May 21 05:36:07 1994 +0000 @@ -96,6 +96,12 @@ #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 @@ 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 @@ #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 @@ 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 @@ &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 @@ #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 @@ &message)) { UNBLOCK_INPUT_RESIGNAL; - error ("Can't notify window manager of iconification."); + error ("Can't notify window manager of iconification"); } } @@ -5927,15 +5938,18 @@ 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)