diff src/xterm.c @ 6883:77ceede38423

(x_make_frame_visible): Don't call XMapSubwindows. (x_iconify_frame): Likewise. (pending_autoraise_frame): New variable. (x_new_focus_frame): Don't autoraise here; just set that var. (XTread_socket): Raise that frame here. (x_destroy_window): Call clear_mouse_face if necessary. (x_new_font): Always call x_set_window_size. (x_wm_set_size_hint): If PROMPTING is 0, copy the old win_gravity field. If USPosition is set, don't set PWinGravity. (x_wm_set_size_hint): If change_gravity is 0, just don't set the gravity.
author Richard M. Stallman <rms@gnu.org>
date Thu, 14 Apr 1994 17:31:06 +0000
parents 7036e4fd549f
children e0ab4f59004e
line wrap: on
line diff
--- a/src/xterm.c	Thu Apr 14 17:21:38 1994 +0000
+++ b/src/xterm.c	Thu Apr 14 17:31:06 1994 +0000
@@ -193,6 +193,9 @@
    x_focus_event_frame.  */
 struct frame *x_focus_frame;
 
+/* This is a frame waiting to be autoraised, within XTread_socket.  */
+struct frame *pending_autoraise_frame;
+
 /* The last frame mentioned in a FocusIn or FocusOut event.  This is
    separate from x_focus_frame, because whether or not LeaveNotify
    events cause us to lose focus depends on whether or not we have
@@ -1717,7 +1720,9 @@
 #endif /* ! 0 */
 
       if (x_focus_frame && x_focus_frame->auto_raise)
-	x_raise_frame (x_focus_frame);
+	pending_autoraise_frame = x_focus_frame;
+      else
+	pending_autoraise_frame = 0;
     }
 
   XTframe_rehighlight ();
@@ -4302,6 +4307,16 @@
     x_do_pending_expose ();
 #endif
 
+  /* If the focus was just given to an autoraising frame,
+     raise it now.  */
+#ifdef HAVE_X11
+  if (pending_autoraise_frame)
+    {
+      x_raise_frame (pending_autoraise_frame);
+      pending_autoraise_frame = 0;
+    }
+#endif
+
   UNBLOCK_INPUT;
   return count;
 }
@@ -5082,6 +5097,7 @@
 		f->display.x->font->fid);
 
       frame_update_line_height (f);
+      x_set_window_size (f, 0, f->width, f->height);
     }
   else
     /* If we are setting a new frame's font for the first time,
@@ -5397,8 +5413,12 @@
 #else /* not USE_X_TOOLKIT */
       XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
 #endif /* not USE_X_TOOLKIT */
+#if 0 /* This seems to bring back scroll bars in the wrong places
+	 if the window configuration has changed.  They seem
+	 to come back ok without this.  */
       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
 	XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
+#endif
 #else /* ! defined (HAVE_X11) */
       XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
       if (f->display.x->icon_desc != 0)
@@ -5563,8 +5583,10 @@
     {
       /* If the frame was withdrawn, before, we must map it.  */
       XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
+#if 0 /* We don't have subwindows in the icon.  */
       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
 	XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
+#endif
     }
 
   f->async_iconified = 1;
@@ -5609,6 +5631,9 @@
   if (f == x_highlight_frame)
     x_highlight_frame = 0;
 
+  if (f == mouse_face_mouse_frame)
+    clear_mouse_face ();
+
   UNBLOCK_INPUT;
 }
 
@@ -5690,13 +5715,12 @@
 
 #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.
    If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y
-   and leave the gravity unchanged.  */
+   and leave the gravity unchanged.
+
+   CHANGE_GRAVITY is nonzero when PROMPTING is nonzero.  */
 
 x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y)
      struct frame *f;
@@ -5733,42 +5757,36 @@
 #endif /* not USE_X_TOOLKIT */
   size_hints.width_inc = FONT_WIDTH (f->display.x->font);
   size_hints.height_inc = f->display.x->line_height;
-#if 0
-  size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0);
-  size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0);
-#endif    
+
   {
     int base_width, base_height;
+    int min_rows = 0, min_cols = 0;
 
     base_width = CHAR_TO_PIXEL_WIDTH (f, 0);
     base_height = CHAR_TO_PIXEL_HEIGHT (f, 0);
 
-    {
-      int min_rows = 0, min_cols = 0;
-      check_frame_size (f, &min_rows, &min_cols);
-
-      /* The window manager uses the base width hints to calculate the
-	 current number of rows and columns in the frame while
-	 resizing; min_width and min_height aren't useful for this
-	 purpose, since they might not give the dimensions for a
-	 zero-row, zero-column frame.
-
-	 We use the base_width and base_height members if we have
-	 them; otherwise, we set the min_width and min_height members
-	 to the size for a zero x zero frame.  */
+    check_frame_size (f, &min_rows, &min_cols);
+
+    /* The window manager uses the base width hints to calculate the
+       current number of rows and columns in the frame while
+       resizing; min_width and min_height aren't useful for this
+       purpose, since they might not give the dimensions for a
+       zero-row, zero-column frame.
+       
+       We use the base_width and base_height members if we have
+       them; otherwise, we set the min_width and min_height members
+       to the size for a zero x zero frame.  */
 
 #ifdef HAVE_X11R4
-      size_hints.flags |= PBaseSize;
-      size_hints.base_width = base_width;
-      size_hints.base_height = base_height;
-      size_hints.min_width  = base_width + min_cols * size_hints.width_inc;
-      size_hints.min_height = base_height + min_rows * size_hints.height_inc;
+    size_hints.flags |= PBaseSize;
+    size_hints.base_width = base_width;
+    size_hints.base_height = base_height;
+    size_hints.min_width  = base_width + min_cols * size_hints.width_inc;
+    size_hints.min_height = base_height + min_rows * size_hints.height_inc;
 #else
-      size_hints.min_width = base_width;
-      size_hints.min_height = base_height;
+    size_hints.min_width = base_width;
+    size_hints.min_height = base_height;
 #endif
-    }
-
   }
 
   if (prompting)
@@ -5787,7 +5805,9 @@
 	size_hints.flags |= USPosition;
       if (hints.flags & USSize)
 	size_hints.flags |= USSize;
+      size_hints.win_gravity = hints.win_gravity;
     }
+
 #if defined (PWinGravity)
   if (change_gravity)
     {
@@ -5797,21 +5817,18 @@
 	  size_hints.win_gravity = NorthWestGravity;
 	  break;
 	case 1:
-	  size_hints.win_gravity = NorthEastGravity;
+	  size_hints.win_gravity = SouthWestGravity;
 	  break;
 	case 2:
-	  size_hints.win_gravity = SouthWestGravity;
+	  size_hints.win_gravity = NorthEastGravity;
 	  break;
 	case 3:
 	  size_hints.win_gravity = SouthEastGravity;
 	  break;
 	}
-      previous_gravity = size_hints.win_gravity;
+      if (! (size_hints.flags & USPosition))
+	size_hints.flags |= PWinGravity;
     }
-  else
-    size_hints.win_gravity = previous_gravity;
-
-  size_hints.flags |= PWinGravity;
 #endif /* PWinGravity */
 
 #ifdef HAVE_X11R4