comparison src/xterm.c @ 5825:b1f35db748d8

(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
author Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
date Mon, 07 Feb 1994 18:25:41 +0000
parents eb44ecad5557
children 6389c826f847
comparison
equal deleted inserted replaced
5824:afd275dcec54 5825:b1f35db748d8
36 #include <signal.h> 36 #include <signal.h>
37 37
38 #include <config.h> 38 #include <config.h>
39 39
40 /* Need syssignal.h for various externs and definitions that may be required 40 /* Need syssignal.h for various externs and definitions that may be required
41 * by some configurations for calls to signal() later in this source file. 41 by some configurations for calls to signal later in this source file. */
42 */
43 #include "syssignal.h" 42 #include "syssignal.h"
44 43
45 #ifdef HAVE_X_WINDOWS 44 #ifdef HAVE_X_WINDOWS
46 45
47 #include "lisp.h" 46 #include "lisp.h"
918 917
919 918
920 /* Make audible bell. */ 919 /* Make audible bell. */
921 920
922 #ifdef HAVE_X11 921 #ifdef HAVE_X11
923 #define XRINGBELL XBell(x_current_display, 0) 922 #define XRINGBELL XBell (x_current_display, 0)
924 #else /* ! defined (HAVE_X11) */ 923 #else /* ! defined (HAVE_X11) */
925 #define XRINGBELL XFeep(0); 924 #define XRINGBELL XFeep (0);
926 #endif /* ! defined (HAVE_X11) */ 925 #endif /* ! defined (HAVE_X11) */
927 926
928 XTring_bell () 927 XTring_bell ()
929 { 928 {
930 if (x_current_display == 0) 929 if (x_current_display == 0)
2000 /* This trick allows us to search both the ordinary and 1999 /* This trick allows us to search both the ordinary and
2001 condemned scroll bar lists with one loop. */ 2000 condemned scroll bar lists with one loop. */
2002 ! GC_NILP (bar) || (bar = condemned, 2001 ! GC_NILP (bar) || (bar = condemned,
2003 condemned = Qnil, 2002 condemned = Qnil,
2004 ! GC_NILP (bar)); 2003 ! GC_NILP (bar));
2005 bar = XSCROLL_BAR(bar)->next) 2004 bar = XSCROLL_BAR (bar)->next)
2006 if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id) 2005 if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id)
2007 return XSCROLL_BAR (bar); 2006 return XSCROLL_BAR (bar);
2008 } 2007 }
2009 2008
2010 return 0; 2009 return 0;
4216 Calling x_check_errors signals an Emacs error if an X error has 4215 Calling x_check_errors signals an Emacs error if an X error has
4217 occurred since the last call to x_catch_errors or x_check_errors. 4216 occurred since the last call to x_catch_errors or x_check_errors.
4218 4217
4219 Calling x_uncatch_errors resumes the normal error handling. */ 4218 Calling x_uncatch_errors resumes the normal error handling. */
4220 4219
4221 void x_catch_errors(), x_check_errors (), x_uncatch_errors (); 4220 void x_catch_errors (), x_check_errors (), x_uncatch_errors ();
4222 4221
4223 void 4222 void
4224 x_catch_errors () 4223 x_catch_errors ()
4225 { 4224 {
4226 /* Make sure any errors from previous requests have been dealt with. */ 4225 /* Make sure any errors from previous requests have been dealt with. */
4402 XSetFont (x_current_display, f->display.x->reverse_gc, 4401 XSetFont (x_current_display, f->display.x->reverse_gc,
4403 f->display.x->font->fid); 4402 f->display.x->font->fid);
4404 XSetFont (x_current_display, f->display.x->cursor_gc, 4403 XSetFont (x_current_display, f->display.x->cursor_gc,
4405 f->display.x->font->fid); 4404 f->display.x->font->fid);
4406 4405
4407 x_set_window_size (f, f->width, f->height); 4406 x_set_window_size (f, 0, f->width, f->height);
4408 } 4407 }
4409 4408
4410 { 4409 {
4411 Lisp_Object lispy_name = build_string (fontname); 4410 Lisp_Object lispy_name = build_string (fontname);
4412 4411
4434 XLoseFont (f->display.x->font); 4433 XLoseFont (f->display.x->font);
4435 4434
4436 f->display.x->font = temp; 4435 f->display.x->font = temp;
4437 4436
4438 if (FRAME_X_WINDOW (f) != 0) 4437 if (FRAME_X_WINDOW (f) != 0)
4439 x_set_window_size (f, f->width, f->height); 4438 x_set_window_size (f, 0, f->width, f->height);
4440 4439
4441 return 0; 4440 return 0;
4442 } 4441 }
4443 #endif /* ! defined (HAVE_X11) */ 4442 #endif /* ! defined (HAVE_X11) */
4444 4443
4512 #else /* not USE_X_TOOLKIT */ 4511 #else /* not USE_X_TOOLKIT */
4513 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), 4512 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f),
4514 f->display.x->left_pos, f->display.x->top_pos); 4513 f->display.x->left_pos, f->display.x->top_pos);
4515 #endif /* not USE_X_TOOLKIT */ 4514 #endif /* not USE_X_TOOLKIT */
4516 #ifdef HAVE_X11 4515 #ifdef HAVE_X11
4517 x_wm_set_size_hint (f, 0, xoff, yoff); 4516 x_wm_set_size_hint (f, 0, 1, xoff, yoff);
4518 #endif /* ! defined (HAVE_X11) */ 4517 #endif /* ! defined (HAVE_X11) */
4519 UNBLOCK_INPUT; 4518 UNBLOCK_INPUT;
4520 } 4519 }
4521 4520
4522 /* Call this to change the size of frame F's x-window. */ 4521 /* Call this to change the size of frame F's x-window.
4523 4522 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity
4524 x_set_window_size (f, cols, rows) 4523 for this size change and subsequent size changes.
4524 Otherwise we leave the window gravity unchanged. */
4525
4526 x_set_window_size (f, change_gravity, cols, rows)
4525 struct frame *f; 4527 struct frame *f;
4528 int change_gravity;
4526 int cols, rows; 4529 int cols, rows;
4527 { 4530 {
4528 int pixelwidth, pixelheight; 4531 int pixelwidth, pixelheight;
4529 int mask; 4532 int mask;
4530 4533
4544 : 0); 4547 : 0);
4545 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 4548 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
4546 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 4549 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
4547 4550
4548 #ifdef HAVE_X11 4551 #ifdef HAVE_X11
4549 x_wm_set_size_hint (f, 0, 0, 0); 4552 x_wm_set_size_hint (f, 0, change_gravity, 0, 0);
4550 #endif /* ! defined (HAVE_X11) */ 4553 #endif /* ! defined (HAVE_X11) */
4551 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); 4554 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight);
4552 4555
4553 /* Now, strictly speaking, we can't be sure that this is accurate, 4556 /* Now, strictly speaking, we can't be sure that this is accurate,
4554 but the window manager will get around to dealing with the size 4557 but the window manager will get around to dealing with the size
4747 4750
4748 BLOCK_INPUT; 4751 BLOCK_INPUT;
4749 4752
4750 #ifdef HAVE_X11R4 4753 #ifdef HAVE_X11R4
4751 4754
4755 #ifdef USE_X_TOOLKIT
4756 if (! XWithdrawWindow (x_current_display, XtWindow (f->display.x->widget),
4757 DefaultScreen (x_current_display)))
4758 #else /* not USE_X_TOOLKIT */
4752 if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), 4759 if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f),
4753 DefaultScreen (x_current_display))) 4760 DefaultScreen (x_current_display)))
4761 #endif /* not USE_X_TOOLKIT */
4754 { 4762 {
4755 UNBLOCK_INPUT_RESIGNAL; 4763 UNBLOCK_INPUT_RESIGNAL;
4756 error ("can't notify window manager of window withdrawal"); 4764 error ("can't notify window manager of window withdrawal");
4757 } 4765 }
4758 4766
4763 if (! EQ (Vx_no_window_manager, Qt)) 4771 if (! EQ (Vx_no_window_manager, Qt))
4764 { 4772 {
4765 XEvent unmap; 4773 XEvent unmap;
4766 4774
4767 unmap.xunmap.type = UnmapNotify; 4775 unmap.xunmap.type = UnmapNotify;
4776 #ifdef USE_X_TOOLKIT
4777 unmap.xunmap.window = XtWindow (f->display.x->widget);
4778 #else /* not USE_X_TOOLKIT */
4768 unmap.xunmap.window = FRAME_X_WINDOW (f); 4779 unmap.xunmap.window = FRAME_X_WINDOW (f);
4780 #endif /* not USE_X_TOOLKIT */
4769 unmap.xunmap.event = DefaultRootWindow (x_current_display); 4781 unmap.xunmap.event = DefaultRootWindow (x_current_display);
4770 unmap.xunmap.from_configure = False; 4782 unmap.xunmap.from_configure = False;
4771 if (! XSendEvent (x_current_display, 4783 if (! XSendEvent (x_current_display,
4772 DefaultRootWindow (x_current_display), 4784 DefaultRootWindow (x_current_display),
4773 False, 4785 False,
4778 error ("can't notify window manager of withdrawal"); 4790 error ("can't notify window manager of withdrawal");
4779 } 4791 }
4780 } 4792 }
4781 4793
4782 /* Unmap the window ourselves. Cheeky! */ 4794 /* Unmap the window ourselves. Cheeky! */
4795 #ifdef USE_X_TOOLKIT
4796 XUnmapWindow (x_current_display, XtWindow (f->display.x->widget));
4797 #else /* not USE_X_TOOLKIT */
4783 XUnmapWindow (x_current_display, FRAME_X_WINDOW (f)); 4798 XUnmapWindow (x_current_display, FRAME_X_WINDOW (f));
4784 4799 #endif /* not USE_X_TOOLKIT */
4785 #else /* ! defined (HAVE_X11) */ 4800 #else /* ! defined (HAVE_X11) */
4786 4801
4787 XUnmapWindow (FRAME_X_WINDOW (f)); 4802 XUnmapWindow (FRAME_X_WINDOW (f));
4788 f->async_visible = 0; /* Handled by the UnMap event for X11 */ 4803 f->async_visible = 0; /* Handled by the UnMap event for X11 */
4789 if (f->display.x->icon_desc != 0) 4804 if (f->display.x->icon_desc != 0)
4812 return; 4827 return;
4813 4828
4814 #ifdef USE_X_TOOLKIT 4829 #ifdef USE_X_TOOLKIT
4815 BLOCK_INPUT; 4830 BLOCK_INPUT;
4816 result = XIconifyWindow (x_current_display, 4831 result = XIconifyWindow (x_current_display,
4817 XtWindow(f->display.x->widget), 4832 XtWindow (f->display.x->widget),
4818 DefaultScreen (x_current_display)); 4833 DefaultScreen (x_current_display));
4819 UNBLOCK_INPUT; 4834 UNBLOCK_INPUT;
4820 4835
4821 if (!result) 4836 if (!result)
4822 error ("Can't notify window manager of iconification."); 4837 error ("Can't notify window manager of iconification.");
4988 5003
4989 /* Setting window manager hints. */ 5004 /* Setting window manager hints. */
4990 5005
4991 #ifdef HAVE_X11 5006 #ifdef HAVE_X11
4992 5007
5008 /* Record the gravity used previously, in case CHANGE_GRAVITY is 0. */
5009 static int previous_gravity;
5010
4993 /* SPEC_X and SPEC_Y are the specified positions. 5011 /* SPEC_X and SPEC_Y are the specified positions.
4994 We look only at their sign, to decide the gravity. */ 5012 We look only at their sign, to decide the gravity.
4995 5013 If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y
4996 x_wm_set_size_hint (f, prompting, spec_x, spec_y) 5014 and leave the gravity unchanged. */
5015
5016 x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
4997 struct frame *f; 5017 struct frame *f;
4998 long prompting; 5018 long prompting;
5019 int change_gravity;
4999 int spec_x, spec_y; 5020 int spec_x, spec_y;
5000 { 5021 {
5001 XSizeHints size_hints; 5022 XSizeHints size_hints;
5002 5023
5003 #ifdef USE_X_TOOLKIT 5024 #ifdef USE_X_TOOLKIT
5004 Window window = XtWindow(f->display.x->widget); 5025 Window window = XtWindow (f->display.x->widget);
5005 #else /* not USE_X_TOOLKIT */ 5026 #else /* not USE_X_TOOLKIT */
5006 Window window = FRAME_X_WINDOW (f); 5027 Window window = FRAME_X_WINDOW (f);
5007 #endif /* not USE_X_TOOLKIT */ 5028 #endif /* not USE_X_TOOLKIT */
5008 5029
5009 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; 5030 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;
5070 size_hints.flags |= USPosition; 5091 size_hints.flags |= USPosition;
5071 if (hints.flags & USSize) 5092 if (hints.flags & USSize)
5072 size_hints.flags |= USSize; 5093 size_hints.flags |= USSize;
5073 } 5094 }
5074 #if defined (PWinGravity) 5095 #if defined (PWinGravity)
5075 switch (((spec_x < 0) << 1) + (spec_y < 0)) 5096 if (change_gravity)
5076 { 5097 {
5077 case 0: 5098 switch (((spec_x < 0) << 1) + (spec_y < 0))
5078 size_hints.win_gravity = NorthWestGravity; 5099 {
5079 break; 5100 case 0:
5080 case 1: 5101 size_hints.win_gravity = NorthWestGravity;
5081 size_hints.win_gravity = NorthEastGravity; 5102 break;
5082 break; 5103 case 1:
5083 case 2: 5104 size_hints.win_gravity = NorthEastGravity;
5084 size_hints.win_gravity = SouthWestGravity; 5105 break;
5085 break; 5106 case 2:
5086 case 3: 5107 size_hints.win_gravity = SouthWestGravity;
5087 size_hints.win_gravity = SouthEastGravity; 5108 break;
5088 break; 5109 case 3:
5089 } 5110 size_hints.win_gravity = SouthEastGravity;
5111 break;
5112 }
5113 previous_gravity = size_hints.win_gravity;
5114 }
5115 else
5116 size_hints.win_gravity = previous_gravity;
5117
5090 size_hints.flags |= PWinGravity; 5118 size_hints.flags |= PWinGravity;
5091 #endif /* PWinGravity */ 5119 #endif /* PWinGravity */
5092 5120
5093 #ifdef HAVE_X11R4 5121 #ifdef HAVE_X11R4
5094 XSetWMNormalHints (x_current_display, window, &size_hints); 5122 XSetWMNormalHints (x_current_display, window, &size_hints);
5101 x_wm_set_window_state (f, state) 5129 x_wm_set_window_state (f, state)
5102 struct frame *f; 5130 struct frame *f;
5103 int state; 5131 int state;
5104 { 5132 {
5105 #ifdef USE_X_TOOLKIT 5133 #ifdef USE_X_TOOLKIT
5106 Window window = XtWindow(f->display.x->widget); 5134 Window window = XtWindow (f->display.x->widget);
5107 #else /* not USE_X_TOOLKIT */ 5135 #else /* not USE_X_TOOLKIT */
5108 Window window = FRAME_X_WINDOW (f); 5136 Window window = FRAME_X_WINDOW (f);
5109 #endif /* not USE_X_TOOLKIT */ 5137 #endif /* not USE_X_TOOLKIT */
5110 5138
5111 f->display.x->wm_hints.flags |= StateHint; 5139 f->display.x->wm_hints.flags |= StateHint;
5187 argv [0] = ""; 5215 argv [0] = "";
5188 argv [1] = "-display"; 5216 argv [1] = "-display";
5189 argv [2] = display_name; 5217 argv [2] = display_name;
5190 argc = 3; 5218 argc = 3;
5191 Xt_app_shell = XtAppInitialize (&Xt_app_con, "Emacs", 5219 Xt_app_shell = XtAppInitialize (&Xt_app_con, "Emacs",
5192 emacs_options, XtNumber(emacs_options), 5220 emacs_options, XtNumber (emacs_options),
5193 &argc, argv, 5221 &argc, argv,
5194 NULL, NULL, 0); 5222 NULL, NULL, 0);
5195 XtFree (argv); 5223 XtFree (argv);
5196 x_current_display = XtDisplay (Xt_app_shell); 5224 x_current_display = XtDisplay (Xt_app_shell);
5197 5225