unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Po Lu <luangruo@yahoo.com>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: NS port cleanups
Date: Wed, 20 Oct 2021 21:12:49 +0100	[thread overview]
Message-ID: <YXB4QdgdKtJIwF9O@idiocy.org> (raw)
In-Reply-To: <87bl3jc1bz.fsf@yahoo.com>

On Wed, Oct 20, 2021 at 08:44:48PM +0800, Po Lu wrote:
> Po Lu <luangruo@yahoo.com> 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



  reply	other threads:[~2021-10-20 20:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87czo3bxog.fsf.ref@yahoo.com>
     [not found] ` <87czo3bxog.fsf@yahoo.com>
2021-10-17 19:00   ` bug#51251: 29.0.50; Moving cursor on top of raised box leaves artifacts around in NS port Alan Third
2021-10-19  9:40     ` NS port cleanups Po Lu
2021-10-19 20:22       ` Alan Third
2021-10-20  0:40         ` Po Lu
2021-10-20  5:01           ` Po Lu
2021-10-20 12:44             ` Po Lu
2021-10-20 20:12               ` Alan Third [this message]
2021-10-21  0:17                 ` Po Lu
2021-10-23  8:58                   ` Alan Third
2021-10-23 11:19                     ` Po Lu
2021-10-23  9:09                   ` Alan Third
2021-10-23 11:20                     ` Po Lu
2021-10-23 12:00                       ` Po Lu
2021-10-23 19:31         ` Carlos Pita
2021-10-25 11:33           ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXB4QdgdKtJIwF9O@idiocy.org \
    --to=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).