changeset 17963:b77c13e71ba3

(XTread_socket) <UnmapNotify>: Don't make an inconify_event when frame was made invisible. (x_make_frame_visible): Put the call to x_set_offset back as it was. Near the end, instead call XMoveWindow, but only if original positions were not negative.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 May 1997 03:09:37 +0000
parents 8621a73a8890
children 160c3be66a71
files src/xterm.c
diffstat 1 files changed, 44 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue May 27 02:46:14 1997 +0000
+++ b/src/xterm.c	Tue May 27 03:09:37 1997 +0000
@@ -4012,15 +4012,19 @@
 		  /* We can't distinguish, from the event, whether the window
 		     has become iconified or invisible.  So assume, if it
 		     was previously visible, than now it is iconified.
-		     We depend on x_make_frame_invisible to mark it invisible.  */
+		     But x_make_frame_invisible clears both
+		     the visible flag and the iconified flag;
+		     and that way, we know the window is not iconified now.  */
 		  if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
-		    f->async_iconified = 1;
-
-		  bufp->kind = iconify_event;
-		  XSETFRAME (bufp->frame_or_window, f);
-		  bufp++;
-		  count++;
-		  numchars--;
+		    {
+		      f->async_iconified = 1;
+
+		      bufp->kind = iconify_event;
+		      XSETFRAME (bufp->frame_or_window, f);
+		      bufp++;
+		      count++;
+		      numchars--;
+		    }
 		}
 	      goto OTHER;
 
@@ -5619,6 +5623,8 @@
 {
   int mask;
   Lisp_Object type;
+  int starting_flags = f->output_data.x->size_hint_flags;
+  int original_top, original_left;
 
   BLOCK_INPUT;
 
@@ -5628,6 +5634,16 @@
 
   if (! FRAME_VISIBLE_P (f))
     {
+      /* We test FRAME_GARBAGED_P here to make sure we don't
+	 call x_set_offset a second time
+	 if we get to x_make_frame_visible a second time
+	 before the window gets really visible.  */
+      if (! FRAME_ICONIFIED_P (f)
+	  && ! f->output_data.x->asked_for_visible)
+	x_set_offset (f, f->output_data.x->left_pos, f->output_data.x->top_pos, 0);
+
+      f->output_data.x->asked_for_visible = 1;
+
       if (! EQ (Vx_no_window_manager, Qt))
 	x_wm_set_window_state (f, NormalState);
 #ifdef USE_X_TOOLKIT
@@ -5652,21 +5668,30 @@
   {
     Lisp_Object frame;
     int count = input_signal_count;
-    int orig_left = f->output_data.x->left_pos;
-    int orig_top = f->output_data.x->top_pos;
+
+    original_left = f->output_data.x->left_pos;
+    original_top = f->output_data.x->top_pos;
 
     /* This must come after we set COUNT.  */
     UNBLOCK_INPUT;
 
-    /* We test asked_for_visible here to make sure we don't
-       call x_set_offset a second time
-       if we get to x_make_frame_visible a second time
-       before the window gets really visible.  */
-    if (! FRAME_ICONIFIED_P (f)
-	&& ! f->output_data.x->asked_for_visible)
-      x_set_offset (f, orig_left, orig_top, 0);
-
-    f->output_data.x->asked_for_visible = 1;
+    /* Arriving X events are processed here.  */
+
+    /* Now move the window back to where it was "supposed to be".  */
+
+    if (! (starting_flags & (XNegative | YNegative)))
+      {
+	BLOCK_INPUT;
+
+#ifdef USE_X_TOOLKIT
+	XMoveWindow (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget),
+		     original_left, original_top);
+#else /* not USE_X_TOOLKIT */
+	XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+		     original_left, original_top);
+#endif /* not USE_X_TOOLKIT */
+	UNBLOCK_INPUT;
+      }
 
     XSETFRAME (frame, f);