From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29552: 27.0.50; [PATCH]: improved xterm mouse support Date: Sat, 09 Dec 2017 12:06:54 +0200 Message-ID: <83a7ysuse9.fsf@gnu.org> References: <874lp75pe3.fsf@aol.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1512814092 1610 195.159.176.226 (9 Dec 2017 10:08:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Dec 2017 10:08:12 +0000 (UTC) Cc: 29552@debbugs.gnu.org To: Olaf Rogalsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 09 11:08:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNc3A-0000Cy-P0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Dec 2017 11:08:04 +0100 Original-Received: from localhost ([::1]:40698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNc3I-0002Fc-3F for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Dec 2017 05:08:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNc3C-0002Ag-GS for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2017 05:08:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNc38-00014p-DB for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2017 05:08:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44463) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNc38-000144-8s for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2017 05:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eNc38-0001a3-0n for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2017 05:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Dec 2017 10:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29552 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 29552-submit@debbugs.gnu.org id=B29552.15128140456029 (code B ref 29552); Sat, 09 Dec 2017 10:08:01 +0000 Original-Received: (at 29552) by debbugs.gnu.org; 9 Dec 2017 10:07:25 +0000 Original-Received: from localhost ([127.0.0.1]:53144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNc2X-0001ZB-92 for submit@debbugs.gnu.org; Sat, 09 Dec 2017 05:07:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43578) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNc2V-0001Yy-6n for 29552@debbugs.gnu.org; Sat, 09 Dec 2017 05:07:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNc2L-0007vZ-OA for 29552@debbugs.gnu.org; Sat, 09 Dec 2017 05:07:17 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNc2L-0007vL-Kd; Sat, 09 Dec 2017 05:07:13 -0500 Original-Received: from [176.228.60.248] (port=4286 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eNc2K-00080z-AG; Sat, 09 Dec 2017 05:07:12 -0500 In-reply-to: <874lp75pe3.fsf@aol.de> (message from Olaf Rogalsky on Mon, 04 Dec 2017 01:08:01 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140851 Archived-At: > From: Olaf Rogalsky > Date: Mon, 04 Dec 2017 01:08:01 +0100 > > as a follow up to bug#29104, I try to improve on the following two > limitations of xterm-mouse-mode. > > 1. Clicks on the menubar only work partialy: they open up the > left-most menu-bar item. After that one has to use the keyboard > controls in order to navigate through the menus. > > 2. There is no highlighting of text with mouse-face property, when the > mouse pointer is moved over those texts. > > With this patch selection of menus with the mouse and highlighting of > text with mouse-face properties work as expected. For a demonstration > of the new features, please follow this URL: > https://youtu.be/1pp85OshsoA. Thanks for working on this, Olaf. > 1. menu-bar.el @@ -2460,6 +2460,31 > > The new function `tty-menu-bar-open-with-mouse' takes a mouse event > parameter and opens the menu-bar menu at the corresponding > postion. The similar function `menu-bar-open' has no event > parameter as argument and is therefore not suitable for mouse > clicks. This has an unfortunate consequence of adding yet another way of opening a menu-bar menu. Is there any reasonable way of doing the same like GPM, the w32 console, and the non-toolkit builds do it, i.e. generate a MOUSE_CLICK event and get it handled as we do in keyboard.c around line 5620? I'd prefer not to add yet another subtle handling of these events if that can be avoided. > 8. term.c @@ -793,8 +793,6 > term.c @@ -851,7 +849,6 > term.c @@ -2371,9 +2368,7 > term.c @@ -2387,7 +2382,7 > term.c @@ -2421,6 +2416,7 > xdisp.c @@ -29568,9 +29568,7 > > Since this patch makes use of `tty_write_glyphs_with_face' and > `tty_draw_row_with_mouse_face', which are otherwise only used by > GPM, I make them generally available by taking them out of > '#ifdef HAVE_GPM'. The w32 and the MSDOS terminals have their own versions of these functions, so defining them unconditionally will cause compilation errors on those platforms, because they also compile term.c. Also, this hunk: > diff --git a/src/xdisp.c b/src/xdisp.c > index 016e7044ca..96fba761a6 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -29568,9 +29568,7 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, > return; > } > #endif > -#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT) > tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); > -#endif > } will now be in effect for NS, for example. Do all the platforms we support have everything that tty_draw_row_with_mouse_face uses? And I see frame.c calls term_mouse_moveto, but you left it conditioned on GPM. Why? > +DEFUN ("note-mouse-highlight", Fnote_mouse_highlight, Snote_mouse_highlight, > + 3, 3, 0, > + doc: /* Take proper action when the mouse has moved to position > +X, Y on frame F with regards to highlighting portions of display that > +have mouse-face properties. Also de-highlight portions of display > +where the mouse was before, set the mouse pointer shape as appropriate > +for the mouse coordinates, and activate help echo (tooltips). X and Y > +can be negative or out of range. */) What is perhaps appropriate for a code comment is not necessarily appropriate for a Lisp-level doc string, so this needs to be reworked. For starters, the first sentence should fit on a single screen line. Next, the frame parameter's name is FRAME, not F. Finally, some of what the text says describes the internal working of the function and shouldn't appear in the doc string. I would also prefer this function to be internal, so let's call it something like tty--note-mouse-highlight-internal, and let's say in the doc string that it's for internal use only. > + CHECK_FRAME(frame); > + CHECK_NUMBER(x); > + CHECK_NUMBER(y); Please leave one blank between the name of the function/macro and the opening parenthesis. > + /* silently do nothing, if frame is not on a terminal */ Comments should be full sentences: started with a capital letter, and ending with a period. Also, please leave 2 blanks between the last period and the closing "*/" of the comment. > + if (XFRAME(frame)->output_method != output_termcap && > + XFRAME(frame)->output_method != output_msdos_raw) Please use FRAME_TERMCAP_P and FRAME_MSDOS_P here. > + note_mouse_highlight(XFRAME(frame), XINT(x), XINT(y)); > + fflush_unlocked(FRAME_TTY(XFRAME(frame))->output); Please compute XFRAME (frame) only once and then reuse the value. Last, but not least: the user-visible functionality introduced by this should be mentioned in NEWS. Thanks again for working on these issues.