aboutsummaryrefslogtreecommitdiff
path: root/plug/src/Montis
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-05 01:17:30 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-05 01:17:30 -0700
commitf6497f43b02e8b0351d0bbf0446c037161cda430 (patch)
treee22df1dc0d053444c8129a596a6fe2f4e7f68a92 /plug/src/Montis
parent34e0354bb2d07ce0ad8a6e83e226370cfb9904da (diff)
downloadmontis-f6497f43b02e8b0351d0bbf0446c037161cda430.tar.gz
montis-f6497f43b02e8b0351d0bbf0446c037161cda430.tar.bz2
montis-f6497f43b02e8b0351d0bbf0446c037161cda430.zip
[fix] issue where dragging doesn't work on native.
Diffstat (limited to 'plug/src/Montis')
-rw-r--r--plug/src/Montis/Core/Internal/Foreign/Export.hs56
1 files changed, 36 insertions, 20 deletions
diff --git a/plug/src/Montis/Core/Internal/Foreign/Export.hs b/plug/src/Montis/Core/Internal/Foreign/Export.hs
index 132273a..faa1964 100644
--- a/plug/src/Montis/Core/Internal/Foreign/Export.hs
+++ b/plug/src/Montis/Core/Internal/Foreign/Export.hs
@@ -17,20 +17,18 @@ import Foreign
mallocBytes,
newStablePtr,
)
-import Foreign.C (CChar, CDouble(..), CInt (..))
+import Foreign.C (CChar, CDouble (..), CInt (..))
import Foreign.Ptr (castPtr)
import Montis.Base.Foreign.WlRoots.Types
( ForeignSurface (toSurface),
ForeignWlrInputDevice,
ForeignWlrPointer,
- ForeignWlrPointerMotionAbsoluteEvent,
ForeignWlrXWaylandSurface,
ForeignWlrXdgSurface,
WlrEventKeyboardKey,
WlrInputDevice (WlrInputDevice),
WlrPointer (WlrPointer),
WlrPointerButtonEvent,
- WlrPointerMotionAbsoluteEvent,
)
import Montis.Core
import Montis.Core.State
@@ -156,27 +154,45 @@ pluginHandleKeybinding inputDevicePtr eventPtr mods sym cp =
-- Motion handler
foreign export ccall "plugin_handle_motion"
- pluginHandleMotion :: Ptr WlrPointerMotionAbsoluteEvent -> Word32 -> CDouble -> CDouble -> OpqStT -> IO OpqStT
+ pluginHandleMotion :: Ptr Void -> Word32 -> Word32 -> CDouble -> CDouble -> OpqStT -> IO OpqStT
-pluginHandleMotion :: Ptr WlrPointerMotionAbsoluteEvent -> Word32 -> CDouble -> CDouble -> OpqStT -> IO OpqStT
-pluginHandleMotion eventPtr modifiers lx ly =
+pluginHandleMotion :: Ptr Void -> Word32 -> Word32 -> CDouble -> CDouble -> OpqStT -> IO OpqStT
+pluginHandleMotion eventPtr modifiers isAbsolute lx ly =
runForeign $ do
s <- gets currentHooks
event <- liftIO $
- runDemarshal (castPtr eventPtr) $ do
- -- After time_msec, wlroots pads to 8-byte alignment for doubles.
- pointerPtr <- demarshal :: Demarshal (Ptr ForeignWlrPointer)
- tMs <- demarshal
- _ <- demarshal :: Demarshal Word32
- rawX <- demarshal
- rawY <- demarshal
- return $
- MotionEvent
- (WlrPointer pointerPtr)
- tMs
- modifiers
- (realToFrac lx, realToFrac ly)
- (rawX, rawY)
+ if isAbsolute == 0
+ then
+ runDemarshal (castPtr eventPtr) $ do
+ pointerPtr <- demarshal :: Demarshal (Ptr ForeignWlrPointer)
+ tMs <- demarshal
+ _ <- demarshal :: Demarshal Word32
+ _ <- demarshal :: Demarshal Double
+ _ <- demarshal :: Demarshal Double
+ _ <- demarshal :: Demarshal Double
+ _ <- demarshal :: Demarshal Double
+ return $
+ MotionEvent
+ (WlrPointer pointerPtr)
+ tMs
+ modifiers
+ (realToFrac lx, realToFrac ly)
+ (0, 0)
+ else
+ runDemarshal (castPtr eventPtr) $ do
+ -- After time_msec, wlroots pads to 8-byte alignment for doubles.
+ pointerPtr <- demarshal :: Demarshal (Ptr ForeignWlrPointer)
+ tMs <- demarshal
+ _ <- demarshal :: Demarshal Word32
+ rawX <- demarshal
+ rawY <- demarshal
+ return $
+ MotionEvent
+ (WlrPointer pointerPtr)
+ tMs
+ modifiers
+ (realToFrac lx, realToFrac ly)
+ (rawX, rawY)
motionHook s event