emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] On the nasty "ghost key" problem on NS


From: Kai Ma
Subject: Re: [PATCH] On the nasty "ghost key" problem on NS
Date: Fri, 4 Nov 2022 16:53:34 +0800


> On Nov 4, 2022, at 15:16, Po Lu <luangruo@yahoo.com> wrote:
> 
> Kai Ma <justksqsf@gmail.com> writes:
> 
>> I’ve narrowed the problem further to [firstRectForCharRange].
> 
> I'm either blind, or there is no method by that name...

firstRectForCharacterRange.

> 
>> Some calls never return. Activating an input method makes Emacs issue
>> excessive calls to this method. Specifically, the following code gets
>> stuck somewhere.
>> 
>>  if (WINDOWP (echo_area_window) && ! NILP (call0 (intern 
>> ("ns-in-echo-area"))))
>>    win = XWINDOW (echo_area_window);
>>  else
>>    win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
> 
> So Emacs completely locks up in that function (ns-in-echo-area)?


Yes and no. Emacs still responds to new key events, but a previous call is 
stuck and does not return. Presumably in another thread. To be more clear: 
changing that code to be

  static int enter_cnt, leave_cnt;
  enter_cnt++;
  [referenced piece of code]
  leave_cnt++;
  /* (Or just count the return/leave counts of (ns-in-echo-area).) */

leave_cnt can be less than enter_cnt. I’ve confirmed re-entrance to 
[firstRectForCharacterRange] leads to the problem.

Pardon my ignorance, is there any reason to special-case the echo area? Simply 
let win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)) and the problem is gone.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]