unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Alan Third <alan@idiocy.org>
Cc: Eason Huang <aqua0210@foxmail.com>, 53276@debbugs.gnu.org
Subject: bug#53276: The blink-cursor-mode not work after startup on macOS
Date: Sat, 15 Jan 2022 21:05:38 +0800	[thread overview]
Message-ID: <877db1b13x.fsf@yahoo.com> (raw)
In-Reply-To: <YeK/QnqQl4n3yCZ3@idiocy.org> (Alan Third's message of "Sat, 15 Jan 2022 12:34:10 +0000")

Alan Third <alan@idiocy.org> writes:

> On Sat, Jan 15, 2022 at 03:04:35PM +0800, Po Lu wrote:
>> Eason Huang <aqua0210@foxmail.com> writes:
>> 
>> > When Emacs is started at the first time, the blink-cursor-mode does
>> > not work, and the focus needs to be switched to another
>> > application, and then switching back again, it will work properly.
>> 
>> blink-cursor-mode will only start the idle timer that actually blinks
>> the cursor if at least one frame is focused, but no FOCUS_IN_EVENT is
>> sent until windowDidBecomeKey is called a second time, as emacs_event is
>> NULL when windowDidBecomeKey is first called.  This is both on GNUstep
>> and macOS.  (Perhaps storing the FOCUS_IN_EVENT into the keyboard buffer
>> would be an option.)
>> 
>> Alan, do you have any idea as to why this is?  I'm afraid I don't really
>> understand the NS event loop code.
>
> No, I don't know why it's done this way. There are a number of other
> bugs that have the same root cause, where emacs_event is null because
> the code is being called outside the run loop and therefore the event
> never reaches Emacs.

I think the right solution is to store events directly into the keyboard
buffer instead of using emacs_event, but I don't know if there's a
reason the NS port was not developed that way.

> My assumption is that there is a reason why it's done this way, but I
> can't work it out.

Basically, it fits well into the pselect-read-XPending-XNextEvent model
that most X-Windows applications are designed around.  The other ports
are then designed around this X model.

> I had a look at some of the other terms and they *kind of* work in a
> similar fashion, in that there's one function that scoops up all the
> events and passes them to Emacs (like ns_read_socket does) but they
> differ in that the events are queued up by the system before they're
> read in.

Does NS not queue unread events until they're read?  That seems like odd
design to me.

> So given that I wonder if the NS port is just copying that style from
> other terms, but it doesn't actually work right.

That style is reasonable (think of it like `read', except it reads
events from a display server connection into the keyboard buffer), but
what I don't understand here is why callback methods like
windowDidBecomeKey can't just call kbd_buffer_store_event, instead going
through all the trouble to allocate a temporary buffer and using that to
hold the events.

Thanks in advance.

> (I sometimes think it would be nice if we had git history for the NS
> port from before it was merged in, because a lot of these design
> decisions are ancient and it's unclear why they were made.)

I agree.





  reply	other threads:[~2022-01-15 13:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15  4:41 bug#53276: The blink-cursor-mode not work after startup on macOS Eason Huang
2022-01-15  7:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 12:34   ` Alan Third
2022-01-15 13:05     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-01-15 13:11       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-21  1:19         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-21 11:38           ` Eason Huang
2022-01-21 11:41             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-27 15:06             ` Robert Pluim
2022-01-27 16:43               ` Eli Zaretskii
2022-01-27 17:02                 ` Robert Pluim
2022-01-27 17:07                   ` Eli Zaretskii
2022-01-27 17:15                     ` Robert Pluim
2022-01-28  0:38               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=877db1b13x.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=53276@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=aqua0210@foxmail.com \
    --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).