From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: mouse-face and help echo support for xterm mouse Date: Wed, 04 Nov 2020 10:56:55 -0500 Message-ID: References: <31ff05295c806c4596c54fdcc8994a5f@finder.org> <3e7e0f6d1e272d03913e97254b2eabff@finder.org> <83imalazw7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28220"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: jared@finder.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 04 16:57:54 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kaLAX-0007Bi-JY for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Nov 2020 16:57:53 +0100 Original-Received: from localhost ([::1]:41136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaLAW-0005yL-N5 for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Nov 2020 10:57:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaL9h-0005Q4-My for emacs-devel@gnu.org; Wed, 04 Nov 2020 10:57:01 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaL9f-0004ko-6e; Wed, 04 Nov 2020 10:57:00 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6F84780F25; Wed, 4 Nov 2020 10:56:57 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 02D4D80662; Wed, 4 Nov 2020 10:56:56 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1604505416; bh=c6vS0LWcrAG4aa2H9h2N0h0HUZBhha9xOfrQ+8v/1Jo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UlXy+gF4NpQfOPGZRSzxwPzgw+XK5rdddSKsu7pudefFJFsTVmOcDRB5LmUc+DUPP j/aGMi5xe3pqvDSH0PqySIWLa9ixfe7KsXYZtQezkrkbJsJ/wdEqv95Zi59gW+hn6v OvCSR3IYqi8N5j0DG76ZkrSFLm/eDo9TKoBzG5vrvmcJ5RyX+OgJuJG4w7dAS2dDCy MhPki7TB0WYa0If3OQxtTADHCev/9kXrs0Y6LYPYGgDNTIGa4bEEvf+zJvKMJFAP2T pIrKr9JGd9NPpKdFPaVx2rO9AzzzozYsISna5SnVV/QOZKG3OWoZKUgVkYAboECaR5 yyw3WGBaOoj3w== Original-Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C772A1202F7; Wed, 4 Nov 2020 10:56:55 -0500 (EST) In-Reply-To: <83imalazw7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 04 Nov 2020 17:46:16 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/04 09:13:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258683 Archived-At: >> In the patch below I slightly tweaked the code > What patch? Hmm... *the* patch, of course. Stefan diff --git a/src/term.c b/src/term.c index ff1aabfed2..a03a246415 100644 --- a/src/term.c +++ b/src/term.c @@ -2562,7 +2562,8 @@ ie.kind = NO_EVENT; ie.arg = Qnil; - if (event->type & (GPM_MOVE | GPM_DRAG)) { + if (event->type & (GPM_MOVE | GPM_DRAG)) + { previous_help_echo_string = help_echo_string; help_echo_string = Qnil; @@ -2577,29 +2578,45 @@ || !NILP (previous_help_echo_string)) do_help = 1; - goto done; + eassert (ie.kind == NO_EVENT); } - else { + else + { f->mouse_moved = 0; + eassert (ie.kind == NO_EVENT); term_mouse_click (&ie, event, f); + eassert (ie.kind == GPM_CLICK_EVENT); if (tty_handle_tab_bar_click (f, event->x, event->y, (ie.modifiers & down_modifier) != 0, &ie)) { + eassert (ie.kind == GPM_CLICK_EVENT + || ie.kind == TAB_BAR_EVENT); /* tty_handle_tab_bar_click stores 2 events in the event queue, so we are done here. */ + /* FIXME: Actually, `tty_handle_tab_bar_click` returns true + without storing any events, when + (ie.modifiers & down_modifier) != 0 */ count += 2; return count; } + eassert (ie.kind == GPM_CLICK_EVENT); } - done: - if (ie.kind != NO_EVENT) + if (ie.kind != NO_EVENT) /* FIXME: We retest the previous if's condition! */ { + /* FIXME: `hold_quit` could already hold a previous event, + so it risks crushing that previous event. + What am I missing? */ kbd_buffer_store_event_hold (&ie, hold_quit); count++; } if (do_help + /* FIXME: `hold_quit` is never NULL?! */ + /* FIXME: Why do we test `hold_quit->kind != NO_EVENT` here? + This either comes from `ie` (via kbd_buffer_store_event_hold above) + or from an earlier call to us (tty_read_avail_input calls us in a + loop with the same `hold_quit` struct). */ && !(hold_quit && hold_quit->kind != NO_EVENT)) { Lisp_Object frame;