slang-users mailing list

[2013 Date Index] [2013 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Mouse-wheel under Windows


Hi list.

I've added support for MOUSE_WHEEL support to Slang-2.2.4 under
Windows. I actually did this in 2005 but my patch got lost. So redoing this
was non-trivial until I figured how Slang processes event internally.

Anyway, the patch is quite simple:

--- orig/slw32tty.c       2011-04-11 02:37:07 +0000
+++ slw32tty.c       2013-11-25 16:30:56 +0000
@@ -108,6 +108,17 @@
    if (Process_Mouse_Events == 0)
      return -1;

+   if (m->dwEventFlags & MOUSE_WHEELED) {
+      short steps = m->dwButtonState >> 16;
+      char  scan = steps > 0 ? 0x48 : 0x50;
+
+      buf[0] = 0; buf[1] = scan;
+      buf[2] = 0; buf[3] = scan;
+      buf[4] = 0; buf[5] = scan;
+      SLang_buffer_keystring ((unsigned char*)buf, 6);
+      return 0;
+   }
+
    if (m->dwEventFlags)
      return -1;                               /* double click or movement event */

-------

Since the mouse-wheel is not very sensitive (in console-mode only?), I simply 
insert 3 down or up-arrow codes into the Slang input-buffer. 

It's real handy for me to use the mouse-wheel in e.g. most. It just need a call to
  "SLtt_set_mouse_mode (1,1)" in most.c. 

--gv



[2013 date index] [2013 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]