[bug #14155] 4.6.1: mouse wheel strangeness
Pavel Tsekov
ptsekov at gmx.net
Fri Aug 26 08:40:58 UTC 2005
Hello,
On Thu, 25 Aug 2005, Leonard den Ottolander wrote:
> Must be my problem as well. Sorry for the mix up. I'll fix it once you
> mail the change log entry. Plus I'll have a closer look to find the
> second patch ;) .
The two patches can be found in the section 'Attached files' at the bottom
of the bugreport page. Attaching to this mail for your convinience.
Now to the details ...
mc-xterm-mouse-wheel-fix.patch - This patch fixes the problem reported by
John Pye here:
https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=14155
When the mouse wheel is scrolled events could be delivered too fast to
MC so that it would think that double click occured. This is why John
complains about MC changing directories. The patch fixes the problem by
resetting the `clicks' variable each time a mouse wheel event is
delivered. The `clicks' variable is used to track the number of button
press events which occured in a row and the time interval between too
adjacent events is less than `double_click_speed'. It is obviously wrong
to fire double click event on fast mouse wheel scrolling. So I think this
patch is good.
mc-xterm-mouse-enable-drag.patch - This patch enables xterm's
'Button-event tracking' mouse reporting and adds support for
generating GPM_DRAG events to xmouse_get_event()
[...]
Button-event tracking is essentially the same as normal tracking, but
xterm also reports button-motion events. Motion events are reported only
if the mouse pointer has moved to a different character cell. It is
enabled by specifying parameter 1002 to DECSET. On button press or
release, xterm sends the same codes used by normal tracking mode. On
button-motion events, xterm adds 32 to the event code ...
[...]
As a consequence we get some fine features under xterm terminals which
were missing before:
Dragging the mouse in the editor to select a block of text now
highlights the block immediatley and not after the mouse button
is released.
Dragging the mouse in a panel containing file listing highlights the
entry under the mouse cursor.
...
Changelog entries for the patches ...
mc-xterm-mouse-wheel-fix.patch:
2005-08-25 Pavel Tsekov <ptsekov at gmx.net>
* key.c (xmouse_get_event): Disable double-click tracking for
mouse wheel events.
mc-xterm-mouse-enable-drag.patch
2005-08-24 Pavel Tsekov <ptseko at gmx.net>
* mouse.c (enable_mouse): Use xterm's 'Button-event mouse
tracking' instead of 'Normal tracking'.
* key.c (xmouse_get_event): Add support for generating GPM_DRAG
events.
-------------- next part --------------
Index: src/key.c
===================================================================
RCS file: /cvsroot/mc/mc/src/key.c,v
retrieving revision 1.83
diff -u -p -r1.83 key.c
--- src/key.c 20 Jul 2005 20:29:08 -0000 1.83
+++ src/key.c 24 Aug 2005 14:07:02 -0000
@@ -532,9 +532,11 @@ xmouse_get_event (Gpm_Event *ev)
break;
case 64:
ev->buttons = GPM_B_UP;
+ clicks = 0;
break;
case 65:
ev->buttons = GPM_B_DOWN;
+ clicks = 0;
break;
default:
/* Nothing */
-------------- next part --------------
Index: src/key.c
===================================================================
RCS file: /cvsroot/mc/mc/src/key.c,v
retrieving revision 1.83
diff -u -p -r1.83 key.c
--- src/key.c 20 Jul 2005 20:29:08 -0000 1.83
+++ src/key.c 25 Aug 2005 12:12:27 -0000
@@ -512,7 +512,12 @@ xmouse_get_event (Gpm_Event *ev)
ev->type = 0;
}
} else {
- ev->type = GPM_DOWN;
+ if (btn >= 32 && btn <= 34) {
+ btn -= 32;
+ ev->type = GPM_DRAG;
+ } else
+ ev->type = GPM_DOWN;
+
GET_TIME (tv2);
if (tv1.tv_sec && (DIF_TIME (tv1,tv2) < double_click_speed)){
clicks++;
Index: src/mouse.c
===================================================================
RCS file: /cvsroot/mc/mc/src/mouse.c,v
retrieving revision 1.15
diff -u -p -r1.15 mouse.c
--- src/mouse.c 27 May 2005 03:35:15 -0000 1.15
+++ src/mouse.c 25 Aug 2005 12:12:27 -0000
@@ -91,7 +91,7 @@ void enable_mouse (void)
printf(ESC_STR "[?1001s");
/* enable mouse tracking */
- printf(ESC_STR "[?1000h");
+ printf(ESC_STR "[?1002h");
fflush (stdout);
mouse_enabled = 1;
@@ -117,7 +117,7 @@ void disable_mouse (void)
#endif
case MOUSE_XTERM:
/* disable mouse tracking */
- printf(ESC_STR "[?1000l");
+ printf(ESC_STR "[?1002l");
/* restore old highlight mouse tracking */
printf(ESC_STR "[?1001r");
More information about the mc-devel
mailing list