diff 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
line wrap: on
line diff
--- a/src/xterm.c	Mon Feb 07 08:25:51 1994 +0000
+++ b/src/xterm.c	Mon Feb 07 18:25:41 1994 +0000
@@ -38,8 +38,7 @@
 #include <config.h>
 
 /* Need syssignal.h for various externs and definitions that may be required
- * by some configurations for calls to signal() later in this source file.
- */
+   by some configurations for calls to signal later in this source file.  */
 #include "syssignal.h"
 
 #ifdef HAVE_X_WINDOWS
@@ -920,9 +919,9 @@
 /* Make audible bell.  */
 
 #ifdef HAVE_X11
-#define XRINGBELL XBell(x_current_display, 0)
+#define XRINGBELL XBell (x_current_display, 0)
 #else /* ! defined (HAVE_X11) */
-#define XRINGBELL XFeep(0);
+#define XRINGBELL XFeep (0);
 #endif /* ! defined (HAVE_X11) */
 
 XTring_bell ()
@@ -2002,7 +2001,7 @@
 	   ! GC_NILP (bar) || (bar = condemned,
 			       condemned = Qnil,
 			       ! GC_NILP (bar));
-	   bar = XSCROLL_BAR(bar)->next)
+	   bar = XSCROLL_BAR (bar)->next)
 	if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id)
 	  return XSCROLL_BAR (bar);
     }
@@ -4218,7 +4217,7 @@
 
    Calling x_uncatch_errors resumes the normal error handling.  */
 
-void x_catch_errors(), x_check_errors (), x_uncatch_errors ();
+void x_catch_errors (), x_check_errors (), x_uncatch_errors ();
 
 void
 x_catch_errors ()
@@ -4404,7 +4403,7 @@
       XSetFont (x_current_display, f->display.x->cursor_gc,
 		f->display.x->font->fid);
 
-      x_set_window_size (f, f->width, f->height);
+      x_set_window_size (f, 0, f->width, f->height);
     }
 
   {
@@ -4436,7 +4435,7 @@
   f->display.x->font = temp;
 
   if (FRAME_X_WINDOW (f) != 0)
-    x_set_window_size (f, f->width, f->height);
+    x_set_window_size (f, 0, f->width, f->height);
 
   return 0;
 }
@@ -4514,15 +4513,19 @@
 	       f->display.x->left_pos, f->display.x->top_pos);
 #endif /* not USE_X_TOOLKIT */
 #ifdef HAVE_X11
-  x_wm_set_size_hint (f, 0, xoff, yoff);
+  x_wm_set_size_hint (f, 0, 1, xoff, yoff);
 #endif /* ! defined (HAVE_X11) */
   UNBLOCK_INPUT;
 }
 
-/* Call this to change the size of frame F's x-window. */
-
-x_set_window_size (f, cols, rows)
+/* Call this to change the size of frame F's x-window.
+   If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity
+   for this size change and subsequent size changes.
+   Otherwise we leave the window gravity unchanged.  */
+
+x_set_window_size (f, change_gravity, cols, rows)
      struct frame *f;
+     int change_gravity;
      int cols, rows;
 {
   int pixelwidth, pixelheight;
@@ -4546,7 +4549,7 @@
   pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
 
 #ifdef HAVE_X11
-  x_wm_set_size_hint (f, 0, 0, 0);
+  x_wm_set_size_hint (f, 0, change_gravity, 0, 0);
 #endif /* ! defined (HAVE_X11) */
   XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight);
 
@@ -4749,8 +4752,13 @@
 
 #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),
 			 DefaultScreen (x_current_display)))
+#endif /* not USE_X_TOOLKIT */
     {
       UNBLOCK_INPUT_RESIGNAL;
       error ("can't notify window manager of window withdrawal");
@@ -4765,7 +4773,11 @@
       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.event = DefaultRootWindow (x_current_display);
       unmap.xunmap.from_configure = False;
       if (! XSendEvent (x_current_display,
@@ -4780,8 +4792,11 @@
     }
 
   /* 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 */
 #else /* ! defined (HAVE_X11) */
 
   XUnmapWindow (FRAME_X_WINDOW (f));
@@ -4814,7 +4829,7 @@
 #ifdef USE_X_TOOLKIT
   BLOCK_INPUT;
   result = XIconifyWindow (x_current_display,
-			   XtWindow(f->display.x->widget),
+			   XtWindow (f->display.x->widget),
 			   DefaultScreen (x_current_display));
   UNBLOCK_INPUT;
 
@@ -4990,18 +5005,24 @@
 
 #ifdef HAVE_X11
 
+/* Record the gravity used previously, in case CHANGE_GRAVITY is 0.  */
+static int previous_gravity;
+
 /* SPEC_X and SPEC_Y are the specified positions.
-   We look only at their sign, to decide the gravity.  */
-
-x_wm_set_size_hint (f, prompting, spec_x, spec_y)
+   We look only at their sign, to decide the gravity.
+   If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y
+   and leave the gravity unchanged.  */
+
+x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
      struct frame *f;
      long prompting;
+     int change_gravity;
      int spec_x, spec_y;
 {
   XSizeHints size_hints;
 
 #ifdef USE_X_TOOLKIT
-  Window window = XtWindow(f->display.x->widget);
+  Window window = XtWindow (f->display.x->widget);
 #else /* not USE_X_TOOLKIT */
   Window window = FRAME_X_WINDOW (f);
 #endif /* not USE_X_TOOLKIT */
@@ -5072,21 +5093,28 @@
 	size_hints.flags |= USSize;
     }
 #if defined (PWinGravity)
-  switch (((spec_x < 0) << 1) + (spec_y < 0))
+  if (change_gravity)
     {
-    case 0:
-      size_hints.win_gravity = NorthWestGravity;
-      break;
-    case 1:
-      size_hints.win_gravity = NorthEastGravity;
-      break;
-    case 2:
-      size_hints.win_gravity = SouthWestGravity;
-      break;
-    case 3:
-      size_hints.win_gravity = SouthEastGravity;
-      break;
+      switch (((spec_x < 0) << 1) + (spec_y < 0))
+	{
+	case 0:
+	  size_hints.win_gravity = NorthWestGravity;
+	  break;
+	case 1:
+	  size_hints.win_gravity = NorthEastGravity;
+	  break;
+	case 2:
+	  size_hints.win_gravity = SouthWestGravity;
+	  break;
+	case 3:
+	  size_hints.win_gravity = SouthEastGravity;
+	  break;
+	}
+      previous_gravity = size_hints.win_gravity;
     }
+  else
+    size_hints.win_gravity = previous_gravity;
+
   size_hints.flags |= PWinGravity;
 #endif /* PWinGravity */
 
@@ -5103,7 +5131,7 @@
      int state;
 {
 #ifdef USE_X_TOOLKIT
-  Window window = XtWindow(f->display.x->widget);
+  Window window = XtWindow (f->display.x->widget);
 #else /* not USE_X_TOOLKIT */
   Window window = FRAME_X_WINDOW (f);
 #endif /* not USE_X_TOOLKIT */
@@ -5189,7 +5217,7 @@
   argv [2] = display_name;
   argc = 3;
   Xt_app_shell = XtAppInitialize (&Xt_app_con, "Emacs",
-				  emacs_options, XtNumber(emacs_options),
+				  emacs_options, XtNumber (emacs_options),
 				  &argc, argv,
 				  NULL, NULL, 0);
   XtFree (argv);