Received: from eggs.gnu.org ([2001:4830:134:3::10]:41684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yu4sq-0005BH-0h for qemu-devel@nongnu.org; Sun, 17 May 2015 16:10:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yu4sm-0000iZ-0N for qemu-devel@nongnu.org; Sun, 17 May 2015 16:09:59 -0400 Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]:36510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yu4sl-0000iT-RN for qemu-devel@nongnu.org; Sun, 17 May 2015 16:09:55 -0400 Received: by qkgw4 with SMTP id w4so58255919qkg.3 for ; Sun, 17 May 2015 13:09:54 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: Date: Sun, 17 May 2015 16:09:50 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <147B24E3-803E-4F49-9172-51FE4CA499F8@gmail.com> References: <30C61AFC-7A08-4F94-A7B1-0DAAA58DC017@gmail.com> Subject: Re: [Qemu-devel] [patch v5] ui/cocoa.m: Adds console items to the View menu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel qemu-devel On May 16, 2015, at 5:45 PM, Peter Maydell wrote: > On 11 May 2015 at 16:18, Programmingkid = wrote: >> Adds any console that is available to the current emulator as a menu = item under the View menu. >>=20 >> Signed-off-by: John Arbuckle >=20 > Thanks; I think this version looks pretty good. A minor > improvement: >=20 >> +static void create_view_menu() >> +{ >> + NSMenu * menu; >> + NSMenuItem * menuItem; >> + int index =3D 0; >> + >> + menu =3D [[NSMenu alloc] initWithTitle:@"View"]; >> + [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter = Fullscreen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"] = autorelease]]; // Fullscreen >> + [menu addItem:[NSMenuItem separatorItem]]; //Separator >> + >> + // Give each console its own menu item in the View menu >> + while(qemu_console_lookup_by_index(index) !=3D NULL) { >> + menuItem =3D [[[NSMenuItem alloc] initWithTitle: = getConsoleName(qemu_console_lookup_by_index(index)) >> + action: = @selector(displayConsole:) keyEquivalent: @""] autorelease]; >> + [menuItem setTag: index]; >> + [menu addItem: menuItem]; >> + index++; >> + } >> + >> + menuItem =3D [[[NSMenuItem alloc] initWithTitle:@"View" = action:nil keyEquivalent:@""] autorelease]; >> + [menuItem setSubmenu:menu]; >> + [[NSApp mainMenu] insertItem: menuItem atIndex: 1]; // insert = View menu after Application menu >> +} >=20 > Rather than creating the whole menu here, and then having to > use awkward hard-coded indexes to decide where to put it in > the menubar, I think it would be nicer to leave the creation > of the menu (and its fixed entries) where it is and just do > the addition of new items here. You can get the View menu with: >=20 > menu =3D [[[NSApp mainMenu] itemWithTitle:@"View"] submenu]; >=20 > and then just [menu addItem ... ] the new items to it. >=20 > I also had to tweak the patch a bit to get it to apply on top > of the fullscreen patches, so I went ahead and made that > change, and applied the resulting patch to my cocoa.next > branch in > https://git.linaro.org/people/peter.maydell/qemu-arm.git >=20 > Let me know if you'd rather do something else. >=20 > thanks > -- PMM What you did looks good.=20 You know how there's a "Zoom To Fit" menu item. What if we added a = mutually exclusive menu item called "Resize To Fit"? This menu item = would instead adjust the host screen's resolution to match that of the = guest screen's resolution. It can be implemented in its own patch if you = like the idea.=