* Ed Avis:
René Kyllingstad <listmailxemacs(a)kyllingstad.com>
>>my mouse wheel does nothing
>Do you have scrollbars enabled? It seems the scroll wheel is
>just sending page-down events to the scrollbars, so it's just
>silently ignored when they're not displayed.
Yes, that was exactly it. When I display the scrollbars the wheel
works.
So the bug report is really that the mouse wheel doesn't do something
sensible when scrollbars are not displayed. Perhaps they could be
active but invisible, or something.
The below patch generates button{4,5}up events when the scrollbars are not
showing¹, so you can use the mwheel package Norbert mentioned:
(mwheel-install)
(setq mwheel-follow-mouse t)
It works for me, but I'm not familiar with win32 programming (or XEmacs
internals), so try at your own risk. Thanks for prodding me to look into
this btw, it's been annoying me a while.
-- René
¹ more accurately: if mswindows_handle_mousewheel_event doesn't handle the event.
---
src/event-msw.c.org 2003-07-30 22:11:54.000000000 +0200
+++ src/event-msw.c 2003-07-30 22:24:42.000000000 +0200
@@ -981,6 +981,9 @@
int downp = (msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN ||
msg == WM_RBUTTONDOWN);
+ /* Wheel rotation amount: positive is away from user, negative towards user */
+ int delta = (short) HIWORD (mods);
+
/* We always use last message time, because mouse button
events may get delayed, and XEmacs double click
recognition will fail */
@@ -993,7 +996,9 @@
event->timestamp = when;
event->event.button.button =
(msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 :
- ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2);
+ (msg==WM_MBUTTONDOWN || msg==WM_MBUTTONUP) ? 2 :
+ (msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 :
+ (msg==WM_MOUSEWHEEL && delta>0) ? 4 : 5;
event->event.button.x = where.x;
event->event.button.y = where.y;
event->event.button.modifiers = mswindows_modifier_state (NULL, mods, 0);
@@ -2950,13 +2955,18 @@
int keys = LOWORD (wParam); /* Modifier key flags */
int delta = (short) HIWORD (wParam); /* Wheel rotation amount */
- if (mswindows_handle_mousewheel_event (mswindows_find_frame (hwnd),
+ /* enqueue button4/5 events if mswindows_handle_mousewheel_event
+ doesn't handle the event, such as when the scrollbars are not
+ displayed */
+ if (!mswindows_handle_mousewheel_event (mswindows_find_frame (hwnd),
keys, delta,
MAKEPOINTS (lParam)))
- /* We are not in a modal loop so no pumping is necessary. */
- break;
- else
- goto defproc;
+ mswindows_enqueue_mouse_button_event (hwnd, message_,
+ MAKEPOINTS (lParam),
+ wParam,
+ GetMessageTime());
+ /* We are not in a modal loop so no pumping is necessary. */
+ break;
}
#endif