changeset 960:17986889d3b6

* dispnew.c (Fredraw_frame): Call clear_frame_records before calling update_end, so that x_display_box_cursor can rely on the contents of f->current_glyphs. * dispnew.c (change_frame_size): Call check_frame_size here, rather than writing out its code. Don't declare newheight and newwidth to be register variables, since we take their address. * dispnew.c (in_display): Variable deleted; it's only ever used as an unofficial parameter to change_frame_size. (change_frame_size): New argument, DELAY, which when non-zero indicates to delay the size change until later. This should be passed as one from signal handlers. (window_change_signal): Call change_frame_size with a DELAY of 1. (do_pending_window_change): Call change_frame_size with DELAY of 0. * dispnew.c, frame.c, frame.h, keyboard.c, scroll.c, term.c, window.c, xdisp.c, xfns.c xterm.c (FRAME_IS_TERMCAP, FRAME_IS_X, FRAME_HAS_MINIBUF): Renamed these to FRAME_TERMCAP_P, FRAME_X_P, and FRAME_HAS_MINIBUF_P, for consistency with the rest of the frame macros.
author Jim Blandy <jimb@redhat.com>
date Wed, 12 Aug 1992 13:36:49 +0000
parents c1fc76b79275
children 8d2cbfd93066
files src/dispnew.c
diffstat 1 files changed, 50 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Wed Aug 12 13:30:54 1992 +0000
+++ b/src/dispnew.c	Wed Aug 12 13:36:49 1992 +0000
@@ -131,8 +131,6 @@
 
 extern short ospeed;	/* Output speed (from sg_ospeed) */
 
-int in_display;		/* 1 if in redisplay: can't handle SIGWINCH now.  */
-
 int delayed_size_change;  /* 1 means SIGWINCH happened when not safe.  */
 
 #ifdef MULTI_FRAME
@@ -149,9 +147,9 @@
   update_begin (f);
   /*  set_terminal_modes (); */
   clear_frame ();
+  clear_frame_records (f);
   update_end (f);
   fflush (stdout);
-  clear_frame_records (f);
   windows_or_buffers_changed++;
   /* Mark all windows as INaccurate,
      so that every window will have its redisplay done.  */
@@ -226,7 +224,7 @@
   new->bufp = (int *) xmalloc (height * sizeof (int));
 
 #ifdef HAVE_X_WINDOWS
-  if (FRAME_IS_X (frame))
+  if (FRAME_X_P (frame))
     {
       new->nruns = (int *) xmalloc (height * sizeof (int));
       new->face_list
@@ -275,7 +273,7 @@
   free (glyphs->bufp);
 
 #ifdef HAVE_X_WINDOWS
-  if (FRAME_IS_X (frame))
+  if (FRAME_X_P (frame))
     {
       free (glyphs->nruns);
       free (glyphs->face_list);
@@ -625,7 +623,7 @@
 		  (end - from) * sizeof current_frame->bufp[0]);
 
 #ifdef HAVE_X_WINDOWS
-      if (FRAME_IS_X (frame))
+      if (FRAME_X_P (frame))
 	{
 	  safe_bcopy (current_frame->nruns + from,
 		      current_frame->nruns + from + amount,
@@ -697,7 +695,7 @@
 		  (end - from) * sizeof current_frame->bufp[0]);
 
 #ifdef HAVE_X_WINDOWS
-      if (FRAME_IS_X (frame))
+      if (FRAME_X_P (frame))
 	{
 	  safe_bcopy (current_frame->nruns + from,
 		      current_frame->nruns + from + amount,
@@ -982,7 +980,7 @@
     update_line (f, FRAME_HEIGHT (f) - 1);
 
 #ifdef HAVE_X_WINDOWS
-  if (FRAME_IS_X (f))
+  if (FRAME_X_P (f))
     {
       leftmost = downto = f->display.x->internal_border_width;
       if (desired_frame->enable[0])
@@ -1002,7 +1000,7 @@
     {
       if (desired_frame->enable[i])
 	{
-	  if (FRAME_IS_TERMCAP (f))
+	  if (FRAME_TERMCAP_P (f))
 	    {
 	      /* Flush out every so many lines.
 		 Also flush out if likely to have more than 1k buffered
@@ -1031,7 +1029,7 @@
 
 	  update_line (f, i);
 #ifdef HAVE_X_WINDOWS
-	  if (FRAME_IS_X (f))
+	  if (FRAME_X_P (f))
 	    {
 	      current_frame->top_left_y[i] = downto;
 	      current_frame->top_left_x[i] = leftmost;
@@ -1040,7 +1038,7 @@
 	}
 
 #ifdef HAVE_X_WINDOWS
-      if (FRAME_IS_X (f))
+      if (FRAME_X_P (f))
 	downto += LINE_HEIGHT(f, i);
 #endif
     }
@@ -1303,7 +1301,7 @@
   current_frame->bufp[vpos] = desired_frame->bufp[vpos];
 
 #ifdef HAVE_X_WINDOWS
-  if (FRAME_IS_X (frame))
+  if (FRAME_X_P (frame))
     {
       current_frame->pix_width[vpos]
 	= current_frame->used[vpos]
@@ -1599,11 +1597,9 @@
 
     FOR_EACH_FRAME (tail, f)
       {
-	if (FRAME_IS_TERMCAP (f))
+	if (FRAME_TERMCAP_P (f))
 	  {
-	    ++in_display;
-	    change_frame_size (f, height, width, 0);
-	    --in_display;
+	    change_frame_size (f, height, width, 0, 1);
 	    break;
 	  }
       }
@@ -1636,23 +1632,28 @@
 	  FRAME_NEW_WIDTH (f) = 0;
 
 	  if (height != 0)
-	    change_frame_size (f, height, width, 0);
+	    change_frame_size (f, height, width, 0, 0);
 	}
     }
 }
 
 
 /* Change the frame height and/or width.  Values may be given as zero to
-   indicate no change is to take place. */
+   indicate no change is to take place. 
 
-change_frame_size (frame, newlength, newwidth, pretend)
+   If DELAY is non-zero, then assume we're being called from a signal
+   handler, and queue the change for later - perhaps the next
+   redisplay.  Since this tries to resize windows, we can't call it
+   from a signal handler.  */
+
+change_frame_size (frame, newheight, newwidth, pretend, delay)
      register FRAME_PTR frame;
-     register int newlength, newwidth, pretend;
+     int newheight, newwidth, pretend;
 {
   /* If we can't deal with the change now, queue it for later.  */
-  if (in_display)
+  if (delay)
     {
-      FRAME_NEW_HEIGHT (frame) = newlength;
+      FRAME_NEW_HEIGHT (frame) = newheight;
       FRAME_NEW_WIDTH (frame) = newwidth;
       delayed_size_change = 1;
       return;
@@ -1660,49 +1661,56 @@
 
   /* This size-change overrides any pending one for this frame.  */
   FRAME_NEW_HEIGHT (frame) = 0;
-  FRAME_NEW_WIDTH (frame) = 0;
+  FRAME_NEW_WIDTH  (frame) = 0;
+
+  /* If an arguments is zero, set it to the current value.  */
+  newheight || (newheight = FRAME_HEIGHT (frame));
+  newwidth  || (newwidth  = FRAME_WIDTH  (frame));
 
-  if ((newlength == 0 || newlength == FRAME_HEIGHT (frame))
-      && (newwidth == 0 || newwidth == FRAME_WIDTH (frame)))
+  /* Round up to the smallest acceptable size.  */
+  check_frame_size (frame, &newheight, &newwidth);
+
+  /* If we're not changing the frame size, quit now.  */
+  if (newheight == FRAME_HEIGHT (frame)
+      && newwidth == FRAME_WIDTH (frame))
     return;
 
-  if (newlength && newlength != FRAME_HEIGHT (frame))
+  if (newheight != FRAME_HEIGHT (frame))
     {
-      if (FRAME_HAS_MINIBUF (frame)
+      if (FRAME_HAS_MINIBUF_P (frame)
 	  && ! FRAME_MINIBUF_ONLY_P (frame))
 	{
 	  /* Frame has both root and minibuffer.  */
 	  set_window_height (FRAME_ROOT_WINDOW (frame),
-			     newlength - 1, 0);
+			     newheight - 1, 0);
 	  XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (frame))->top)
-	    = newlength - 1;
+	    = newheight - 1;
 	  set_window_height (FRAME_MINIBUF_WINDOW (frame), 1, 0);
 	}
       else
 	/* Frame has just one top-level window.  */
-	set_window_height (FRAME_ROOT_WINDOW (frame), newlength, 0);
-	
-      if (FRAME_IS_TERMCAP (frame) && !pretend)
-	FrameRows = newlength;
+	set_window_height (FRAME_ROOT_WINDOW (frame), newheight, 0);
+
+      if (FRAME_TERMCAP_P (frame) && !pretend)
+	FrameRows = newheight;
 
 #if 0
       if (frame->output_method == output_termcap)
 	{
-	  frame_height = newlength;
+	  frame_height = newheight;
 	  if (!pretend)
-	    FrameRows = newlength;
+	    FrameRows = newheight;
 	}
 #endif
     }
 
-  if (newwidth && newwidth != FRAME_WIDTH (frame))
+  if (newwidth != FRAME_WIDTH (frame))
     {
       set_window_width (FRAME_ROOT_WINDOW (frame), newwidth, 0);
-      if (FRAME_HAS_MINIBUF (frame))
+      if (FRAME_HAS_MINIBUF_P (frame))
 	set_window_width (FRAME_MINIBUF_WINDOW (frame), newwidth, 0);
-      FRAME_WIDTH (frame) = newwidth;
 
-      if (FRAME_IS_TERMCAP (frame) && !pretend)
+      if (FRAME_TERMCAP_P (frame) && !pretend)
 	FrameCols = newwidth;
 #if 0
       if (frame->output_method == output_termcap)
@@ -1714,9 +1722,9 @@
 #endif
     }
 
-  if (newlength)
-    FRAME_HEIGHT (frame) = newlength;
-
+  FRAME_HEIGHT (frame) = newheight;
+  FRAME_WIDTH (frame)  = newwidth;
+	
   remake_frame_glyphs (frame);
   calculate_costs (frame);
 }