diff src/console.c @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 28f395d8dc7a
children 3d6bfa290dbd
line wrap: on
line diff
--- a/src/console.c	Mon Aug 13 09:42:28 2007 +0200
+++ b/src/console.c	Mon Aug 13 09:43:35 2007 +0200
@@ -268,12 +268,23 @@
 */
        (console))
 {
+  Lisp_Object device;
+
   CHECK_LIVE_CONSOLE (console);
 
-  /* select the console's selected frame's selected window.  This will call
-     selected_frame_1(). */
-  if (!NILP (CONSOLE_SELECTED_DEVICE (XCONSOLE (console))))
-    Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (CONSOLE_SELECTED_DEVICE (XCONSOLE (console)))))));
+  device = CONSOLE_SELECTED_DEVICE (XCONSOLE (console));
+  if (!NILP (device))
+    {
+      struct device *d = XDEVICE (device);
+      Lisp_Object frame = DEVICE_SELECTED_FRAME (d);
+      if (!NILP (frame))
+	{
+	  struct frame *f = XFRAME(frame);
+	  Fselect_window (FRAME_SELECTED_WINDOW (f));
+	}
+      else
+	error ("Can't select console with no frames.");
+    }
   else
     error ("Can't select a console with no devices");
   return Qnil;