]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.backend.windows: support horizontal scroll wheel
authorAlexander Ilin <alex.ilin@protonmail.com>
Sun, 25 Feb 2024 14:39:25 +0000 (15:39 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 25 Feb 2024 17:24:44 +0000 (09:24 -0800)
basis/ui/backend/windows/windows.factor
basis/windows/messages/messages.factor

index 0d6d31bd7a4e3bfe41b9ed05efd911ca4083f61b..9dba6fed9295848eb153a0bbf2bb72f9ab7590c3 100644 (file)
@@ -439,6 +439,9 @@ SYMBOL: nc-buttons
 : mouse-scroll ( wParam -- array )
     >lo-hi [ -80 /f ] map ;
 
+: mouse-horizontal-scroll ( wParam -- direction )
+    hi-word 80 /f 0 2array ;
+
 : mouse-event>gesture ( uMsg -- button )
     key-modifiers swap message>button
     [ <button-down> ] [ <button-up> ] if ;
@@ -495,8 +498,14 @@ SYMBOL: nc-buttons
     TrackMouseEvent win32-error=0/f
     >lo-hi swap window move-hand fire-motion ;
 
+: (handle-mousewheel) ( direction hWnd -- )
+    hand-loc get-global swap window send-scroll ; inline
+
 :: handle-wm-mousewheel ( hWnd uMsg wParam lParam -- )
-    wParam mouse-scroll hand-loc get-global hWnd window send-scroll ;
+    wParam mouse-scroll hWnd (handle-mousewheel) ;
+
+:: handle-wm-mousehwheel ( hWnd uMsg wParam lParam -- )
+    wParam mouse-horizontal-scroll hWnd (handle-mousewheel) ;
 
 : handle-wm-cancelmode ( hWnd uMsg wParam lParam -- )
     ! message sent if windows needs application to stop dragging
@@ -567,6 +576,7 @@ wm-handlers [
 
         ${ WM_MOUSEMOVE [ handle-wm-mousemove 0 ] }
         ${ WM_MOUSEWHEEL [ handle-wm-mousewheel 0 ] }
+        ${ WM_MOUSEHWHEEL [ handle-wm-mousehwheel 0 ] }
         ${ WM_CANCELMODE [ handle-wm-cancelmode 0 ] }
         ${ WM_MOUSELEAVE [ handle-wm-mouseleave 0 ] }
     } expand-keys-set-at
index c92afd9b431f6f23ec7778894c0fa76b9f05bdb2..1715c5ae88b8f6a42ca614034d2c0d7f774b4d80 100644 (file)
@@ -169,6 +169,7 @@ CONSTANT: WM_XBUTTONUP 0x020C
 CONSTANT: WM_XBUTTONDBLCLK 0x020D
 CONSTANT: WM_MOUSELAST_5 0x020D
 CONSTANT: WM_MOUSELAST_4 0x020A
+CONSTANT: WM_MOUSEHWHEEL 0x020E
 CONSTANT: WM_MOUSELAST_PRE_4 0x0209
 CONSTANT: WM_PARENTNOTIFY 0x0210
 CONSTANT: WM_ENTERMENULOOP 0x0211