emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frame ordering


From: David Reitter
Subject: Re: Frame ordering
Date: Mon, 14 Jun 2010 23:54:29 -0400

Letting the window manager decide works fine.  `next-frame' switches back to 
the previously selected frame, so, when repeated, it'll cycle between just two 
frames.  `previous-frame' lets users cycle through all frames.  I feel like it 
should be the other way round.

Thoughts?  How do other window managers do this?


--------

diff --git a/src/frame.c b/src/frame.c
index d73d4d6..2bbcbc8 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1076,6 +1076,7 @@ next_frame (frame, minibuf)
      Lisp_Object frame;
      Lisp_Object minibuf;
 {
+  Lisp_Object frame_list;
   Lisp_Object tail;
   int passed = 0;
 
@@ -1086,9 +1087,16 @@ next_frame (frame, minibuf)
   /* If this frame is dead, it won't be in Vframe_list, and we'll loop
      forever.  Forestall that.  */
   CHECK_LIVE_FRAME (frame);
+ 
+#if HAVE_NS
+    frame_list = ns_frame_list();
+#else
+    frame_list = Vframe_list; 
+#endif
 
   while (1)
-    for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+
+    for (tail = frame_list; CONSP (tail); tail = XCDR (tail))
       {
        Lisp_Object f;
 
@@ -1164,11 +1172,17 @@ prev_frame (frame, minibuf)
     abort ();
 
   prev = Qnil;
-  for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+
+#if HAVE_NS
+  tail = ns_frame_list();
+#else
+  tail = Vframe_list; 
+#endif
+  for (;CONSP (tail); tail = XCDR (tail))
     {
       Lisp_Object f;
 
       f = XCAR (+
       if (!FRAMEP (f))
        abort ();
 
diff --git a/src/nsterm.h b/src/nsterm.h
index e2d42c5..89641ff 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -779,6 +779,8 @@ extern unsigned long ns_get_rgb_color (struct frame *f,
                                        float r, float g, float b, float a);
 extern NSPoint last_mouse_motion_position;
 
+extern Lisp_Object ns_frame_list (void);  /* needed by frame.c */
+
 #ifdef NS_IMPL_GNUSTEP
 extern char gnustep_base_version[];  /* version tracking */
 #endif
diff --git a/src/nsterm.m b/src/nsterm.m
index 85f2a26..d61528e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -911,6 +911,32 @@ ns_set_terminal_modes (struct terminal *terminal)
    ========================================================================== 
*/
 
 
+Lisp_Object
+ns_frame_list ()
+{
+  Lisp_Object frame_list = Qnil;
+
+  NSEnumerator *e = [[NSApp orderedWindows] reverseObjectEnumerator];
+  NSWindow *win;
+  Lisp_Object frame;
+  struct frame *f;
+
+  while (win = [e nextObject]) {
+    if (! [win isKindOfClass:[EmacsWindow class]])
+      continue;
+
+    f = ((EmacsView *) [((EmacsWindow *) win) delegate])->emacsframe;
+ 
+    XSETFRAME (frame, f);
+
+    if (!FRAMEP (frame))
+      abort ();
+    frame_list = Fcons (frame, frame_list);
+  }
+  return frame_list;
+}
+
+
 static void
 ns_raise_frame (struct frame *f)
 /* --------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]