From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: NS port cleanups Date: Wed, 20 Oct 2021 21:12:49 +0100 Message-ID: References: <87czo3bxog.fsf.ref@yahoo.com> <87czo3bxog.fsf@yahoo.com> <8735ox9wtu.fsf_-_@yahoo.com> <87mtn4edf7.fsf@yahoo.com> <8735owcmrl.fsf@yahoo.com> <87bl3jc1bz.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40443"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs-Devel devel To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 20 22:15:07 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdHzO-000AJJ-Oi for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 22:15:07 +0200 Original-Received: from localhost ([::1]:40042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdHzN-0001bj-Jo for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 16:15:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdHxM-0000Zb-PO for emacs-devel@gnu.org; Wed, 20 Oct 2021 16:13:00 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:33309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdHxJ-0000xA-O2 for emacs-devel@gnu.org; Wed, 20 Oct 2021 16:13:00 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id D6E92187; Wed, 20 Oct 2021 20:12:54 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1634760774; bh=jURRmfw5ShDkHUDCb2ukRaeIgDCHxvpdqzwcm4ca0FE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dcZBMEpOpSaknSxjxw8Wh/0vnSWinQDWIys1p/FFB5LisucKTuYvaimiAihtkozE3 QkjptGFcD9SHRjIiEiZ7E07ODxBbIF9HSnbwN5PixDLFLnlDSFfnP7vj3XsxVevzdU +sPB/YyebVVts4e3i5xIzua4vpzIvW2Ps5U0tgKasl4mUpDE2MOCXY4rbromBZ95/z aj3IETgYwlHjxbr2gUE9G14NsR71OkMioVP05alGpE4ShgGmDrGEAal7POLEl47eFf 4dV3umbl4skdgfEFk26ni0uIQzL5gKLjLS9CUT1943Xswu7TPWTfQS1Bux/xp07Ckw xaOxSW3NVGnoA== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95-RC2) (envelope-from ) id 1mdHxB-000bsG-W5; Wed, 20 Oct 2021 21:12:50 +0100 Mail-Followup-To: Alan Third , Po Lu , Emacs-Devel devel Content-Disposition: inline In-Reply-To: <87bl3jc1bz.fsf@yahoo.com> Received-SPF: pass client-ip=116.202.126.228; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277471 Archived-At: On Wed, Oct 20, 2021 at 08:44:48PM +0800, Po Lu wrote: > Po Lu writes: > > > Here is an updated patch that fixes this, and also fixes a few crashes > > with the context menu. (Again, totally untested on macOS) > > And here's a new patch with some other problems fixed (such as broken > mouse face display, tab bar grab reporting and some crashes in nsmenu). > And hopefully a working though ugly solution for fixing the tool bar > height on GNUstep. Thanks. Looks better, thanks! I think I would prefer if you split this along the lines you outlined in the previous email. It's quite a large patch at the moment doing a number of apparently unrelated things. > @@ -1074,15 +1074,25 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) > [view lockFocus]; > } > > + NSGraphicsContext *ctx = [NSGraphicsContext currentContext]; > + [ctx saveGraphicsState]; > + gsaved++; > + Can I ask why you're saving the context every time ns_focus is called? It shouldn't be necessary unless we're making a change, like calling NSRectClip. Any deeper functions that make changes save and restore the context locally. > /* clipping */ > if (r) > { > - [[NSGraphicsContext currentContext] saveGraphicsState]; > if (n == 2) > NSRectClipList (r, 2); > else > NSRectClip (*r); > - gsaved = YES; > +#ifdef NS_IMPL_GNUSTEP > + DPSrectclip (ctx, NSMinX (*r), NSMinY (*r), > + NSWidth (*r), NSHeight (*r)); > + > + if (n == 2) > + DPSrectclip (ctx, NSMinX (r[1]), NSMinY (r[1]), > + NSWidth (r[1]), NSHeight (r[1])); > +#endif > } > } Is this DPS clipping for font drawing? > - /* We draw the cursor (with NSRectFill), then draw the glyph on top > - (other terminals do it the other way round). We must set > - w->phys_cursor_width to the cursor width. For bar cursors, that > - is CURSOR_WIDTH; for box cursors, it is the glyph width. */ > get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); I didn't actually mean for you to get rid of the whole comment as apart from the first sentence it refers to the action that immediately follows. Or do you think it's redundant? > > @@ -9867,7 +9873,11 @@ Convert an X font name (XLFD) to an NS font name. > \n\ > Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ > If `none', the key is ignored by Emacs and retains its standard meaning."); > +#ifdef NS_IMPL_GNUSTEP > + ns_alternate_modifier = Qalt; > +#else > ns_alternate_modifier = Qmeta; > +#endif > > DEFVAR_LISP ("ns-right-alternate-modifier", ns_right_alternate_modifier, > "This variable describes the behavior of the right alternate or option key.\n\ > @@ -9888,7 +9898,11 @@ Convert an X font name (XLFD) to an NS font name. > \n\ > Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ > If `none', the key is ignored by Emacs and retains its standard meaning."); > +#ifdef NS_IMPL_GNUSTEP > + ns_command_modifier = Qmeta; > +#else > ns_command_modifier = Qsuper; > +#endif I don't think these changes are right: By default, GNUstep uses Control_L (left Ctrl) and Control_R (right Ctrl) as CONTROL, Alt_L (left alt) as COMMAND, and Alt_R (right alt, sometimes called AltGr) as ALTERNATE. As a special exception, if Alt_R is not bound to any key on your keyboard, GNUstep will try to use Mode_switch for ALTERNATE instead. Some X server map AltGr onto ISO_Level3_Shift. To allow for this the second code ALTERNATE may be bound to this key. http://www.gnustep.org/resources/documentation/User/Gui/KeyboardSetup.html We have command bound to super so the default Openstep shortcuts work, like cmd-q to quit, and alt bound to meta, because that's pretty standard in Emacs. Now, it seems to me that right alt does NOT work as alt under GNUstep, but instead still acts as normal altGr, but I don't think that's anything to do with how we bind it in Emacs. And weirdly the windows key is bound to Hyper by default... I kind of suspect the GNUstep standards for keyboards are quite out of date, but we should probably try to stick to them. -- Alan Third