From xemacs-m  Mon Mar  3 03:37:58 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id DAA17597
	for <xemacs-beta@xemacs.org>; Mon, 3 Mar 1997 03:37:57 -0600 (CST)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.5/8.8.5) id BAA16293;
	Mon, 3 Mar 1997 01:49:32 -0800
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: Re: vm-scroll-forward doesn't [VM 6.16 as in XEmacs 19.15 b96]
References: <199703030817.JAA05280@rubens.esat.kuleuven.ac.be> <QQcfgf24059.199703030920@crystal.WonderWorks.COM>
X-Url: http://www.miranova.com/%7Esteve/
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
In-Reply-To: Kyle Jones's message of Mon, 3 Mar 1997 04:20:15 -0500 (EST)
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: text/plain; charset=US-ASCII
Date: 03 Mar 1997 01:49:31 -0800
Message-ID: <m2209xtidw.fsf@altair.xemacs.org>
Lines: 137
X-Mailer: Gnus v5.4.17/XEmacs 20.1

Kyle Jones writes:

> Maurizio Vitale writes:
>> Articles are not scrolled.

> frame-totally-visible-p is broken again.  It works sometimes, but
> sometimes returns nil when there's nothing overlapping the frame.

> Can we just agree that virtual desktops are an abomination before
> the Lord and go back to the old frame visibility model?

No.  I can't live on a single screen, and I don't expect anyone else
to either.

Darrell's patch to fix this did not get into beta96 wholly through an
oversight on my part.  Sorry.

Please apply this patch which will be in the next v19 beta (and should
have been in b96):

Index: event-Xt.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-19.15/src/event-Xt.c,v
retrieving revision 1.8
diff -u -r1.8 event-Xt.c
--- event-Xt.c	1997/03/02 03:44:21	1.8
+++ event-Xt.c	1997/03/03 02:22:01
@@ -992,6 +992,37 @@
   handle_focus_event_1 (f, event->type == FocusIn);
 }
 
+/* both MapNotify and VisibilityNotify can cause this */
+static void
+change_frame_visibility (struct frame *f, int is_visible)
+{
+  Lisp_Object frame = Qnil;
+
+  XSETFRAME (frame, f);
+
+  if (!FRAME_VISIBLE_P (f) && is_visible)
+    {
+      FRAME_VISIBLE_P (f) = 1;
+      /* This improves the double flicker when uniconifying a frame
+	 some.  A lot of it is not showing a buffer which has changed
+	 while the frame was iconified.  To fix it further requires
+	 the good 'ol double redisplay structure. */
+      MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
+      va_run_hook_with_args (Qmap_frame_hook, 1, frame);
+#ifdef EPOCH
+      dispatch_epoch_event (f, event, Qx_map);
+#endif
+    }
+  else if (FRAME_VISIBLE_P (f) && !is_visible) 
+    {
+      FRAME_VISIBLE_P (f) = 0;
+      va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
+#ifdef EPOCH
+      dispatch_epoch_event (f, event, Qx_unmap);
+#endif
+    }
+}
+
 static void
 handle_map_event (struct frame *f, XEvent *event)
 {
@@ -1048,34 +1079,14 @@
 	 rather than consulting some internal (and likely
 	 inaccurate) state flag.  Therefore, ignoring the MapNotify
 	 is correct. */
-      if (!f->visible && NILP (Fframe_iconified_p (frame)))
-#endif
-      if (!f->visible)
-	{
-	  f->visible = 1;
-	  /* This improves the double flicker when uniconifying a frame
-	     some.  A lot of it is not showing a buffer which has changed
-	     while the frame was iconified.  To fix it further requires
-	     the good 'ol double redisplay structure. */
-	  MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
-	  va_run_hook_with_args (Qmap_frame_hook, 1, frame);
-#ifdef EPOCH
-	  dispatch_epoch_event (f, event, Qx_map);
+      if (!FRAME_VISIBLE_P (f) && NILP (Fframe_iconified_p (frame)))
 #endif
-	}
+      change_frame_visibility (f, 1);
     }
   else
     {
       FRAME_X_TOTALLY_VISIBLE_P (f) = 0;
-      if (f->visible)
-	{
-	  f->visible = 0;
-	  va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
-#ifdef EPOCH
-	  dispatch_epoch_event (f, event, Qx_unmap);
-#endif
-	}
-
+      change_frame_visibility (f, 0);
       /* Calling Fframe_iconified_p is the only way we have to
          correctly update FRAME_ICONIFIED_P */
       Fframe_iconified_p (frame);
@@ -1221,19 +1232,20 @@
       break;
       
     case VisibilityNotify: /* window visiblity has changed */
-#if 0 /* This causes all kinds of strange behavior I don't like. -sb */
+      if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f)))
 	{
-	  /* Note that the fvwm pager only sends VisibilityNotify when
-	     changing pages. Is this all we need to do ? JV */
-	  FRAME_VISIBLE_P (f) =
-	    ( event->xvisibility.state != VisibilityFullyObscured);
 	  FRAME_X_TOTALLY_VISIBLE_P (f) =
 	    (event->xvisibility.state == VisibilityUnobscured);
+	  /* Note that the fvwm pager only sends VisibilityNotify when
+	     changing pages. Is this all we need to do ? JV */
+	  /* Nope.  We must at least trigger a redisplay here.  
+             Since this case seems similar to MapNotify, I've 
+             factored out some code to change_frame_visibility(). 
+	     This triggers the necessary redisplay and runs
+	     (un)map-frame-hook.  - dkindred@cs.cmu.edu */
+	  change_frame_visibility (f, (event->xvisibility.state
+				       != VisibilityFullyObscured));
 	}
-#else
-        FRAME_X_TOTALLY_VISIBLE_P (f) =
-	  (event->xvisibility.state == VisibilityUnobscured);
-#endif
       break;
       
     case ConfigureNotify:

-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.

