From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.devel Subject: Re: Frame ordering Date: Mon, 14 Jun 2010 23:54:29 -0400 Message-ID: <1437ECA1-253E-46DA-AD1F-ABFDB062E6C3@gmail.com> References: <8F18E079-3351-4398-B76B-6CF9169ACE9E@gmail.com> <4C123889.5060801@gmx.at> <597D28BE-ABE3-4FFF-84B1-1FBF9931293C@gmail.com> <4C126EA5.1050509@gmx.at> <4DF4317D-522E-4948-9C19-ED1252BF36B2@gmail.com> <4C133EDF.8070407@gmx.at> <77C00490-801D-47B9-83BC-32D786F1F684@gmail.com> <1F24A2FE-EF86-4E03-84CF-69748A482C64@gmail.com> <2E617238-2118-408D-8939-80C50A2CB9FB@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1276574088 371 80.91.229.12 (15 Jun 2010 03:54:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Jun 2010 03:54:48 +0000 (UTC) Cc: martin rudalics , Lennart Borgman , YAMAMOTO Mitsuharu , Emacs-Devel devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 15 05:54:46 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OONEb-0002pB-MG for ged-emacs-devel@m.gmane.org; Tue, 15 Jun 2010 05:54:46 +0200 Original-Received: from localhost ([127.0.0.1]:40727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OONEa-0000Iw-S1 for ged-emacs-devel@m.gmane.org; Mon, 14 Jun 2010 23:54:44 -0400 Original-Received: from [140.186.70.92] (port=39540 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OONER-0000HW-0j for emacs-devel@gnu.org; Mon, 14 Jun 2010 23:54:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OONEP-0006jg-T9 for emacs-devel@gnu.org; Mon, 14 Jun 2010 23:54:34 -0400 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:61698) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OONEP-0006jW-Q8 for emacs-devel@gnu.org; Mon, 14 Jun 2010 23:54:33 -0400 Original-Received: by qyk4 with SMTP id 4so412108qyk.0 for ; Mon, 14 Jun 2010 20:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=od1MPWerZ3/DrkT3dZI/6CgBuU9IS2x0hWKFLl0+XBs=; b=jdfNpxmek0r11ZF8npBDgUy52HfztlK4fPJoc86lOOU/vC8gmQxcQ9GAXEMKKwhm4s XW0AVT9j5qD+98W6tkxWYdoeANqBGcmyfbbROVzNlW2AjLo+qH/xp3LBje96YeI4YcII 1UIx2T99bgpXlK6lzlMUNDt+bY2nPK9PzO74I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=TInljKixaCLmpc9L7HAOA+nb7yMKScwlhOVxu6W7Po8pUrKM5yQAz/7AOH+2E8QWh/ LoHgrn41IPLv/lbSOt8TeWUJWyUpKcMLEhm55kLzwRJ09cMJynMYz5kj81biF5Pfflnl K4MKqCeruouu1fIlidfUG4XVClLRNVIH10Jdg= Original-Received: by 10.224.57.198 with SMTP id d6mr2747000qah.331.1276574072439; Mon, 14 Jun 2010 20:54:32 -0700 (PDT) Original-Received: from [192.168.1.17] (pool-96-235-7-98.pitbpa.east.verizon.net [96.235.7.98]) by mx.google.com with ESMTPS id j28sm17037410qck.34.2010.06.14.20.54.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Jun 2010 20:54:31 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1078) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125945 Archived-At: 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 =3D 0; =20 @@ -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); +=20 +#if HAVE_NS + frame_list =3D ns_frame_list(); +#else + frame_list =3D Vframe_list;=20 +#endif =20 while (1) - for (tail =3D Vframe_list; CONSP (tail); tail =3D XCDR (tail)) + + for (tail =3D frame_list; CONSP (tail); tail =3D XCDR (tail)) { Lisp_Object f; =20 @@ -1164,11 +1172,17 @@ prev_frame (frame, minibuf) abort (); =20 prev =3D Qnil; - for (tail =3D Vframe_list; CONSP (tail); tail =3D XCDR (tail)) + +#if HAVE_NS + tail =3D ns_frame_list(); +#else + tail =3D Vframe_list;=20 +#endif + for (;CONSP (tail); tail =3D XCDR (tail)) { Lisp_Object f; =20 f =3D XCAR (+ if (!FRAMEP (f)) abort (); =20 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; =20 +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) = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = */ =20 =20 +Lisp_Object +ns_frame_list () +{ + Lisp_Object frame_list =3D Qnil; + + NSEnumerator *e =3D [[NSApp orderedWindows] reverseObjectEnumerator]; + NSWindow *win; + Lisp_Object frame; + struct frame *f; + + while (win =3D [e nextObject]) { + if (! [win isKindOfClass:[EmacsWindow class]]) + continue; + + f =3D ((EmacsView *) [((EmacsWindow *) win) delegate])->emacsframe; +=20 + XSETFRAME (frame, f); + + if (!FRAMEP (frame)) + abort (); + frame_list =3D Fcons (frame, frame_list); + } + return frame_list; +} + + static void ns_raise_frame (struct frame *f) /* = --------------------------------------------------------------------------=