comparison src/xterm.c @ 7602:136819b017fc

(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.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 May 1994 05:36:07 +0000
parents a15923bc982d
children 1569a13efdcd
comparison
equal deleted inserted replaced
7601:c5927c75b2b5 7602:136819b017fc
92 #endif /* USE_X_TOOLKIT */ 92 #endif /* USE_X_TOOLKIT */
93 93
94 #ifndef USE_X_TOOLKIT 94 #ifndef USE_X_TOOLKIT
95 #define x_any_window_to_frame x_window_to_frame 95 #define x_any_window_to_frame x_window_to_frame
96 #define x_top_window_to_frame x_window_to_frame 96 #define x_top_window_to_frame x_window_to_frame
97 #endif
98
99 #ifdef USE_X_TOOLKIT
100 #ifndef XtNinitialState
101 #define XtNinitialState "initialState"
102 #endif
97 #endif 103 #endif
98 104
99 #ifdef HAVE_X11 105 #ifdef HAVE_X11
100 #define XMapWindow XMapRaised /* Raise them when mapping. */ 106 #define XMapWindow XMapRaised /* Raise them when mapping. */
101 #else /* ! defined (HAVE_X11) */ 107 #else /* ! defined (HAVE_X11) */
5503 5509
5504 x_make_frame_invisible (f) 5510 x_make_frame_invisible (f)
5505 struct frame *f; 5511 struct frame *f;
5506 { 5512 {
5507 int mask; 5513 int mask;
5514 Window window;
5515
5516 #ifdef USE_X_TOOLKIT
5517 /* Use the frame's outermost window, not the one we normally draw on. */
5518 window = XtWindow (f->display.x->widget);
5519 #else /* not USE_X_TOOLKIT */
5520 window = FRAME_X_WINDOW (f);
5521 #endif /* not USE_X_TOOLKIT */
5508 5522
5509 /* Don't keep the highlight on an invisible frame. */ 5523 /* Don't keep the highlight on an invisible frame. */
5510 if (x_highlight_frame == f) 5524 if (x_highlight_frame == f)
5511 x_highlight_frame = 0; 5525 x_highlight_frame = 0;
5512 5526
5524 by hand again (they have already done that once for this window.) */ 5538 by hand again (they have already done that once for this window.) */
5525 x_wm_set_size_hint (f, 0, 1); 5539 x_wm_set_size_hint (f, 0, 1);
5526 5540
5527 #ifdef HAVE_X11R4 5541 #ifdef HAVE_X11R4
5528 5542
5529 #ifdef USE_X_TOOLKIT 5543 if (! XWithdrawWindow (x_current_display, window,
5530 if (! XWithdrawWindow (x_current_display, XtWindow (f->display.x->widget),
5531 DefaultScreen (x_current_display))) 5544 DefaultScreen (x_current_display)))
5532 #else /* not USE_X_TOOLKIT */
5533 if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f),
5534 DefaultScreen (x_current_display)))
5535 { 5545 {
5536 UNBLOCK_INPUT_RESIGNAL; 5546 UNBLOCK_INPUT_RESIGNAL;
5537 error ("can't notify window manager of window withdrawal"); 5547 error ("Can't notify window manager of window withdrawal");
5538 } 5548 }
5539 #endif /* not USE_X_TOOLKIT */
5540
5541 #else /* ! defined (HAVE_X11R4) */ 5549 #else /* ! defined (HAVE_X11R4) */
5542 #ifdef HAVE_X11 5550 #ifdef HAVE_X11
5543 5551
5544 /* Tell the window manager what we're going to do. */ 5552 /* Tell the window manager what we're going to do. */
5545 if (! EQ (Vx_no_window_manager, Qt)) 5553 if (! EQ (Vx_no_window_manager, Qt))
5546 { 5554 {
5547 XEvent unmap; 5555 XEvent unmap;
5548 5556
5549 unmap.xunmap.type = UnmapNotify; 5557 unmap.xunmap.type = UnmapNotify;
5550 #ifdef USE_X_TOOLKIT 5558 unmap.xunmap.window = window;
5551 unmap.xunmap.window = XtWindow (f->display.x->widget);
5552 #else /* not USE_X_TOOLKIT */
5553 unmap.xunmap.window = FRAME_X_WINDOW (f);
5554 #endif /* not USE_X_TOOLKIT */
5555 unmap.xunmap.event = DefaultRootWindow (x_current_display); 5559 unmap.xunmap.event = DefaultRootWindow (x_current_display);
5556 unmap.xunmap.from_configure = False; 5560 unmap.xunmap.from_configure = False;
5557 if (! XSendEvent (x_current_display, 5561 if (! XSendEvent (x_current_display,
5558 DefaultRootWindow (x_current_display), 5562 DefaultRootWindow (x_current_display),
5559 False, 5563 False,
5560 SubstructureRedirectMask|SubstructureNotifyMask, 5564 SubstructureRedirectMask|SubstructureNotifyMask,
5561 &unmap)) 5565 &unmap))
5562 { 5566 {
5563 UNBLOCK_INPUT_RESIGNAL; 5567 UNBLOCK_INPUT_RESIGNAL;
5564 error ("can't notify window manager of withdrawal"); 5568 error ("Can't notify window manager of withdrawal");
5565 } 5569 }
5566 } 5570 }
5567 5571
5568 /* Unmap the window ourselves. Cheeky! */ 5572 /* Unmap the window ourselves. Cheeky! */
5569 #ifdef USE_X_TOOLKIT 5573 XUnmapWindow (x_current_display, window);
5570 XUnmapWindow (x_current_display, XtWindow (f->display.x->widget));
5571 #else /* not USE_X_TOOLKIT */
5572 XUnmapWindow (x_current_display, FRAME_X_WINDOW (f));
5573 #endif /* not USE_X_TOOLKIT */
5574 #else /* ! defined (HAVE_X11) */ 5574 #else /* ! defined (HAVE_X11) */
5575 5575
5576 XUnmapWindow (FRAME_X_WINDOW (f)); 5576 XUnmapWindow (FRAME_X_WINDOW (f));
5577 if (f->display.x->icon_desc != 0) 5577 if (f->display.x->icon_desc != 0)
5578 XUnmapWindow (f->display.x->icon_desc); 5578 XUnmapWindow (f->display.x->icon_desc);
5610 if (f->async_iconified) 5610 if (f->async_iconified)
5611 return; 5611 return;
5612 5612
5613 #ifdef USE_X_TOOLKIT 5613 #ifdef USE_X_TOOLKIT
5614 BLOCK_INPUT; 5614 BLOCK_INPUT;
5615
5616 if (! FRAME_VISIBLE_P (f))
5617 {
5618 if (! EQ (Vx_no_window_manager, Qt))
5619 x_wm_set_window_state (f, IconicState);
5620 /* This was XtPopup, but that did nothing for an iconified frame. */
5621 XtMapWidget (f->display.x->widget);
5622 UNBLOCK_INPUT;
5623 return;
5624 }
5625
5615 result = XIconifyWindow (x_current_display, 5626 result = XIconifyWindow (x_current_display,
5616 XtWindow (f->display.x->widget), 5627 XtWindow (f->display.x->widget),
5617 DefaultScreen (x_current_display)); 5628 DefaultScreen (x_current_display));
5618 UNBLOCK_INPUT; 5629 UNBLOCK_INPUT;
5619 5630
5620 if (!result) 5631 if (!result)
5621 error ("Can't notify window manager of iconification."); 5632 error ("Can't notify window manager of iconification");
5622 5633
5623 f->async_iconified = 1; 5634 f->async_iconified = 1;
5624 5635
5625 BLOCK_INPUT; 5636 BLOCK_INPUT;
5626 XFlushQueue (); 5637 XFlushQueue ();
5649 False, 5660 False,
5650 SubstructureRedirectMask | SubstructureNotifyMask, 5661 SubstructureRedirectMask | SubstructureNotifyMask,
5651 &message)) 5662 &message))
5652 { 5663 {
5653 UNBLOCK_INPUT_RESIGNAL; 5664 UNBLOCK_INPUT_RESIGNAL;
5654 error ("Can't notify window manager of iconification."); 5665 error ("Can't notify window manager of iconification");
5655 } 5666 }
5656 } 5667 }
5657 5668
5658 /* X11R3: set the initial_state field of the window manager hints to 5669 /* X11R3: set the initial_state field of the window manager hints to
5659 IconicState. */ 5670 IconicState. */
5925 x_wm_set_window_state (f, state) 5936 x_wm_set_window_state (f, state)
5926 struct frame *f; 5937 struct frame *f;
5927 int state; 5938 int state;
5928 { 5939 {
5929 #ifdef USE_X_TOOLKIT 5940 #ifdef USE_X_TOOLKIT
5930 Window window = XtWindow (f->display.x->widget); 5941 Arg al[1];
5942
5943 XtSetArg (al[0], XtNinitialState, state);
5944 XtSetValues (f->display.x->widget, al, 1);
5931 #else /* not USE_X_TOOLKIT */ 5945 #else /* not USE_X_TOOLKIT */
5932 Window window = FRAME_X_WINDOW (f); 5946 Window window = FRAME_X_WINDOW (f);
5933 #endif /* not USE_X_TOOLKIT */
5934 5947
5935 f->display.x->wm_hints.flags |= StateHint; 5948 f->display.x->wm_hints.flags |= StateHint;
5936 f->display.x->wm_hints.initial_state = state; 5949 f->display.x->wm_hints.initial_state = state;
5937 5950
5938 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); 5951 XSetWMHints (x_current_display, window, &f->display.x->wm_hints);
5952 #endif /* not USE_X_TOOLKIT */
5939 } 5953 }
5940 5954
5941 x_wm_set_icon_pixmap (f, icon_pixmap) 5955 x_wm_set_icon_pixmap (f, icon_pixmap)
5942 struct frame *f; 5956 struct frame *f;
5943 Pixmap icon_pixmap; 5957 Pixmap icon_pixmap;