From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53276: The blink-cursor-mode not work after startup on macOS Date: Sat, 15 Jan 2022 21:05:38 +0800 Message-ID: <877db1b13x.fsf@yahoo.com> References: <871r19eayk.fsf@yahoo.com> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26544"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: Eason Huang , 53276@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 15 14:08:37 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1n8inN-0006lf-37 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 14:08:37 +0100 Original-Received: from localhost ([::1]:50786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8inL-0006jL-MG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 08:08:35 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8ikt-0004EX-Cm for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 08:06:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8iks-0007vb-NL for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 08:06:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8iks-0004Ts-GH for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 08:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jan 2022 13:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53276 X-GNU-PR-Package: emacs Original-Received: via spool by 53276-submit@debbugs.gnu.org id=B53276.164225195517205 (code B ref 53276); Sat, 15 Jan 2022 13:06:02 +0000 Original-Received: (at 53276) by debbugs.gnu.org; 15 Jan 2022 13:05:55 +0000 Original-Received: from localhost ([127.0.0.1]:39362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8ikk-0004TQ-ME for submit@debbugs.gnu.org; Sat, 15 Jan 2022 08:05:54 -0500 Original-Received: from sonic316-20.consmr.mail.ne1.yahoo.com ([66.163.187.146]:37755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8ikh-0004T9-SO for 53276@debbugs.gnu.org; Sat, 15 Jan 2022 08:05:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1642251945; bh=dC0OyIJfytdfqU4WSq4BaOZEoeJgHGKHB0VnfVMCK+Q=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=PlDS4UgkK9NQCFp5nbDQ4FHkrDT9TIiN8O5rCCpBJ3E3C/AOtbicOIp7j+8CuELjdiX4E4JYvZMOEoVBkgr0LfUnhCqgFR/8kVWuKz4/lCX65Y+jtBZZx4GVBnqoipTDn0djEhsd6AH3FXlBd48TJn2xD3MNygStwutTZ5VvnJAlZ3fvlpY7pEW1Dh25ts6GnIgODaFnXaWMXmOdl5ennWr0cxPs9s9i7ZiIR3AN5Y43B++rYtAl8wEQL86J7D9z4PlLrK2bYDNX4XGYegmZJcNa1IQzsiAlxfQjeMuohE5UVay/YuVyE/1shv5BFVqCwFm8oOEPeg5E65E59Yjtag== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1642251945; bh=yoWATvSaf/zlcGDHzpB4UUwA25QkoJMGErH3vmK1Din=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=BwxwOHVJ/FYkGUGV/oFzsOJN8PrCaXrPrs5fnTl9pYVcdsU/Srftnkv3CnFwWV9b/NnxW8uvGUke76UNXrQ3t5fLceDiQiI7CIkrQDrzidIrarPPspHL/QuzAUswy1sdpMF9pFRdUNZL8+JTgLuNG0en9w/05EuIVFSEUaBkNtgWIVLsWkrwtUAvVpEB+YYIoTWo0ImcTXjXExsci8i6f5CeXxJSDxuWp/ap82iwxcxOf1NWK0tkJCZH0qMV5uAxiFudiv9JwNGJT2wVIybRfGbLziKE5d0sWjlgW3laJmMvLl7zel7AhwsffqyufY7uEEkkl1T2aVAWsI+6fE79yQ== X-YMail-OSG: 0xLyYfIVM1kShmOBasRwn7bgHIehlU0Vu_eIfonFkWOt.dId4aXbhmA1ws.wRsg X0MnWdX_hhVrV59psTr0i5fnEOAC9oayRFBG2CPDSiS6OZLFlBrospt4ft.NU8pdaqNN_pLK9lMj 5.BdooEOrTONf25HcuH1gpsd8A2BMrVBBImh9adfR8Gi84PMu92oNFXKc_QxxwWg97BhcI8Cnpuv 1X.R5yCe8PPZ97rI4FyrawvrA26LWii6k22bt72Zfy.8vY_BedQ83his2_OJNBFKVxQ8U_Q9M0.D VBBkA3VCxh2xxdyEfNBfrFe4sN6eJC_VVTR0B.yB7wzfNoL.YZ.J_wz0LzTXEyJVlr3I2hP6A5mm qQMcvvcaBY8uQKP6TvGEj5xgBOOHNUYifXUbdtheZwVoVr6T51oYdTdKNkHYACGiMQpVdMTRsnnA PX4P2J4wDb4uPn54JKsb4Tea2QVexXn1TdATBsqcrayODnpmgMRRaEICNoG7vmCNu3fwY1s6zbeK cfkAc46Adi1Cn45.yOxktAtWD7Dm5nZtwkYsANrxUqnnxPvEQnrLvnr.1VU9PxLpaezNbkBUODkN LzURbBqHbe_012mlF7MQo3Ro61UdsLvkq9UMlXZFZPwZ.useIs3mm6M1iH8G0OnJ7OmSK.4YmWjS gJ47dvpTlH5e76RZhsryZdaEp1VMzBYEzoY_atR5LPM4oPtlJN2MRK.OwP0MOg57WuE.ssNLCVvB Au4uAPyjCXuw4ShQ9ow2jT34BSYy3dxxekALIbUgsOLXiCrHcq33._9tMQFt8cYd6BAVyBAHMqdE jveTqI_6oMgGX9j5s5M_TYbLS0Wi1feWD8CSRJhUPS X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Sat, 15 Jan 2022 13:05:45 +0000 Original-Received: by kubenode513.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 769c744a121398bf17330d99fc391343; Sat, 15 Jan 2022 13:05:42 +0000 (UTC) In-Reply-To: (Alan Third's message of "Sat, 15 Jan 2022 12:34:10 +0000") X-Mailer: WebService/1.1.19594 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:224302 Archived-At: Alan Third writes: > On Sat, Jan 15, 2022 at 03:04:35PM +0800, Po Lu wrote: >> Eason Huang 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.