From xemacs-m  Sat May 31 19:08:55 1997
Received: from crystal.WonderWorks.COM (crystal.WonderWorks.com [192.203.206.1])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id TAA17011
	for <xemacs-beta@xemacs.org>; Sat, 31 May 1997 19:08:54 -0500 (CDT)
Received: by crystal.WonderWorks.COM 
	id QQcrzc00937; Sat, 31 May 1997 20:08:55 -0400 (EDT)
Date: Sat, 31 May 1997 20:08:55 -0400 (EDT)
Message-Id: <QQcrzc00937.199706010008@crystal.WonderWorks.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Kyle Jones <kyle_jones@wonderworks.com>
To: xemacs-beta@xemacs.org
Subject: [PATCH] 20.3-b3: new tty frame selected too soon
X-Mailer: VM 6.32 under 20.3 XEmacs Lucid (beta3)
X-Face: /cA45WHG7jWq>(O3&Z57Y<"WsX5ddc,4c#w0F*zrV#=M
        0@~@,s;b,aMtR5Sqs"+nU.z^CSFQ9t`z2>W,S,]:[+2^
        Nbf6v4g>!&,7R4Ot4Wg{&tm=WX7P["9%a)_da48-^tGy
        ,qz]Z,Zz\{E.,]'EO+F)@$KtF&V

xemacs -nw

(eq (make-frame) (selected-frame))

returns t.  It should return nil.  find-file-other-frame splits
the root window in the new frame because of this.

Sat May 31 19:59:49 1997  Kyle Jones  <kyle_jones@wonderworks.com>

	* src/frame-tty.c (tty_init_frame_3:
	  Defer selection of the newly created frame until 
	  an event is read.


--- 1.1	1997/05/31 00:47:29
+++ src/frame-tty.c	1997/06/01 00:01:59
@@ -31,6 +31,8 @@
 #include "console-tty.h"
 #include "frame.h"
 
+#include "events.h"
+
 #ifdef HAVE_GPM
 #include <gpm.h>
 #endif
@@ -44,6 +46,7 @@
 
 static void tty_make_frame_visible (struct frame *);
 static void tty_make_frame_invisible (struct frame *);
+static void tty_schedule_frame_focus (struct frame *);
 
 
 static void
@@ -65,17 +68,16 @@
 static void
 tty_init_frame_3 (struct frame *f)
 {
-  struct device *d = XDEVICE (FRAME_DEVICE (f));
-  Lisp_Object tail = DEVICE_FRAME_LIST (d);
+  tty_schedule_frame_focus (f);
+}
+
+static void
+tty_schedule_frame_focus (struct frame *f)
+{
+  Lisp_Object frame;
 
-  while (CONSP (tail))
-    {
-      tty_make_frame_invisible (decode_frame (XCAR (tail)));
-      tail = XCDR (tail);
-    }
-  select_frame_2 (make_frame (f));
-  SET_FRAME_CLEAR (f);
-  tty_make_frame_visible (f);
+  XSETFRAME (frame, f);
+  enqueue_magic_eval_event (select_frame_1, frame);
 }
 
 static void

