File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,6 +130,28 @@ message_loop(void)
130130 while (GetMessage (& msg , NULL , 0 , 0 ) > 0 ) {
131131 TranslateMessage (& msg );
132132 DispatchMessageW (& msg );
133+
134+ /*
135+ * HACK: under Wine, mouse scroll messages are buffered until mouse movement (cause unknown).
136+ * Posting a mouse movement message does not work as a workaround, and neither does sending
137+ * a 0-pixel raw input (maybe optimized out by Wine).
138+ * What DOES work is sending two net-zero mouse moves. There is not jitter and the
139+ * scrolling is processed immediately. ¯\_(ツ)_/¯
140+ */
141+ if (msg .message == WM_MOUSEWHEEL || msg .message == WM_MOUSEHWHEEL ) {
142+ INPUT in [2 ] = {0 };
143+ /* one pixel move left */
144+ in [0 ].type = INPUT_MOUSE ;
145+ in [0 ].mi .dx = 1 ;
146+ in [0 ].mi .dy = 0 ;
147+ in [0 ].mi .dwFlags = MOUSEEVENTF_MOVE ;
148+ //
149+ in [1 ].type = INPUT_MOUSE ;
150+ in [1 ].mi .dx = -1 ;
151+ in [1 ].mi .dy = 0 ;
152+ in [1 ].mi .dwFlags = MOUSEEVENTF_MOVE ;
153+ SendInput (2 , in , sizeof (INPUT ));
154+ }
133155 }
134156}
135157
You can’t perform that action at this time.
0 commit comments