emacs-devel
[Top][All Lists]
Advanced

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

Re: Tab bar tabs landed on master


From: Juri Linkov
Subject: Re: Tab bar tabs landed on master
Date: Sun, 12 Jan 2020 01:57:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)

>> > It is possible that we will need to force reset of up_modifier bit
>> > from the event modifiers inside tty_handle_tab_bar_click, I'm not
>> > sure.  If you get error messages when clicking on the tab bar saying
>> > something like "<tab-bar> <up-current-tab> is undefined", this is the
>> > reason.
>>
>> Today I tried your patch, and observe the following behavior -
>> typing on a tab displays in the each area:
>>
>>   tab-bar up-current-tab-
>>
>> and waits for reading the next event.
>
> I think this is a sign that the up_modifier needs to be reset from the
> event modifiers inside tty_handle_tab_bar_click, as I envisioned.  Can
> you try that?

Finally I got a chance to test this on a GPM-capable console
(there was a problem that the <Ctrl> key on my keyboard is broken
that is not a problem on X where it's remapped to <CapsLock>,
but on the console only the <Meta> key has an alternative <ESC>,
not <Ctrl>, and using such replacements as 'ESC x next-line RET'
is too cumbersome, ISTR there was some support for key remapping,
and I used it long ago on console, but already forgot all details,
so I had to find a keyboard with a functional <Ctrl> key.)

Anyway, here is the tested patch that indeed needed to reset up_modifier.
Sorry for the delay.

diff --git a/src/term.c b/src/term.c
index 871734318c..a3aef31ec2 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2568,6 +2568,14 @@ handle_one_term_event (struct tty_display_info *tty, 
Gpm_Event *event,
   else {
     f->mouse_moved = 0;
     term_mouse_click (&ie, event, f);
+    if (tty_handle_tab_bar_click (f, event->x, event->y,
+                                 (ie.modifiers & down_modifier) != 0, &ie))
+      {
+       /* tty_handle_tab_bar_click stores 2 events in the event
+          queue, so we are done here.  */
+       count += 2;
+       return count;
+      }
   }
 
  done:
diff --git a/src/xdisp.c b/src/xdisp.c
index 53300928d7..516013ce4b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13516,6 +13516,10 @@ tty_handle_tab_bar_click (struct frame *f, int x, int 
y, bool down_p,
     f->last_tab_bar_item = prop_idx;
   else
     {
+      /* Force reset of up_modifier bit from the event modifiers.  */
+      if (event->modifiers & up_modifier)
+        event->modifiers &= ~up_modifier;
+
       /* Generate a TAB_BAR_EVENT event.  */
       Lisp_Object frame;
       Lisp_Object key = AREF (f->tab_bar_items,



reply via email to

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