[Gd-chatter] r10714 - in trunk/fundev/sources: deuce/duim duim/win32

andreas at gwydiondylan.org andreas at gwydiondylan.org
Fri May 5 14:09:00 CEST 2006


Author: andreas
Date: Fri May  5 14:08:57 2006
New Revision: 10714

Modified:
   trunk/fundev/sources/deuce/duim/pane.dylan
   trunk/fundev/sources/duim/win32/wevents.dylan
Log:
bug: 5384

Implementation of mousewheel scrolling in DUIM, plus some hack to make it work with Deuce panes.

Modified: trunk/fundev/sources/deuce/duim/pane.dylan
==============================================================================
--- trunk/fundev/sources/deuce/duim/pane.dylan	(original)
+++ trunk/fundev/sources/deuce/duim/pane.dylan	Fri May  5 14:08:57 2006
@@ -274,7 +274,8 @@
   gadget-value-changing-callback(vscroll) := scroll-window-vertically;
   gadget-client(vscroll) := window;
   // Now make DUIM think that the scroll bar is just plain gone
-  sheet-vertical-scroll-bar(viewport) := #f
+  // WTF??
+  // sheet-vertical-scroll-bar(viewport) := #f
 end method initialize-scrolling;
 
 define method sheet-scrolls-vertically?

Modified: trunk/fundev/sources/duim/win32/wevents.dylan
==============================================================================
--- trunk/fundev/sources/duim/win32/wevents.dylan	(original)
+++ trunk/fundev/sources/duim/win32/wevents.dylan	Fri May  5 14:08:57 2006
@@ -565,9 +565,41 @@
 define sealed method handle-wm-mousewheel
     (sheet :: <sheet>, wParam :: <wparam-type>, lParam :: <lparam-type>)
  => (handled? :: <boolean>)
-  let distance = HIWORD(wParam);
-  // figure out where to send mousewheel events
-  #f
+  warn("Ignored WM_MOUSEWHEEL event for non-scrolling window %s",
+       sheet);
+end method handle-wm-mousewheel;
+    
+/* This implementation has several bugs:
+
+   * HIWORD is supposed to return a signed value, not an unsigned value
+   * It should query SPI_GETWHEELSCROLLLINES to figure out how many lines
+     to scroll
+   * It should use the GET_WHEEL_DELTA_PARAM macro to compute number of increments
+   * It should support freely-rotating wheels
+   * It should scroll three lines at once, not line per line
+
+At the moment, we scroll three lines per event we get, and forget about the proper
+computation. FIXME. 
+
+--andreas, 20060504 */
+define sealed method handle-wm-mousewheel
+    (sheet :: <scrolling-sheet-mixin>, wParam :: <wparam-type>, lParam :: <lparam-type>)
+ => (handled? :: <boolean>)
+  if (sheet.sheet-vertical-scroll-bar)
+    let distance = HIWORD(wParam);
+    if (distance > 32768)
+      scroll-down-line(sheet.sheet-vertical-scroll-bar);
+      scroll-down-line(sheet.sheet-vertical-scroll-bar);
+      scroll-down-line(sheet.sheet-vertical-scroll-bar);
+    else
+      scroll-up-line(sheet.sheet-vertical-scroll-bar);
+      scroll-up-line(sheet.sheet-vertical-scroll-bar);
+      scroll-up-line(sheet.sheet-vertical-scroll-bar);
+    end;
+    #t
+  else
+    #f
+  end
 end method handle-wm-mousewheel;
     
 define method handle-command



More information about the chatter mailing list