aboutsummaryrefslogtreecommitdiff
path: root/src/Wetterhorn/FFI.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wetterhorn/FFI.hs')
-rw-r--r--src/Wetterhorn/FFI.hs42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/Wetterhorn/FFI.hs b/src/Wetterhorn/FFI.hs
index 4be7189..6173291 100644
--- a/src/Wetterhorn/FFI.hs
+++ b/src/Wetterhorn/FFI.hs
@@ -17,10 +17,9 @@ import Foreign
newStablePtr,
)
import Foreign.C (CChar, CInt (..))
-import System.Posix.Types (CIno)
import Wetterhorn.Core
import Wetterhorn.Core.ForeignInterface
-import Wetterhorn.WlRoots (WlrEventKeyboardKey, WlrInputDevice)
+import Wetterhorn.WlRoots
runForeign :: (WConfig -> W ()) -> Wetterhorn -> IO Wetterhorn
runForeign fn stblptr = do
@@ -123,23 +122,22 @@ pluginHandleKeybinding inputDevicePtr eventPtr mods sym cp =
inputDevicePtr
(\b -> if b then 1 else 0) <$> keybindingHandler config event
-foreign export ccall "plugin_handle_surface_map"
- pluginHandleSurfaceMap ::
- Ptr () -> Wetterhorn -> IO Wetterhorn
-
-pluginHandleSurfaceMap :: Ptr () -> Wetterhorn -> IO Wetterhorn
-pluginHandleSurfaceMap p = runForeign (\c -> surfaceHandler c Map p)
-
-foreign export ccall "plugin_handle_surface_unmap"
- pluginHandleSurfaceUnmap ::
- Ptr () -> Wetterhorn -> IO Wetterhorn
-
-pluginHandleSurfaceUnmap :: Ptr () -> Wetterhorn -> IO Wetterhorn
-pluginHandleSurfaceUnmap p = runForeign (\c -> surfaceHandler c Unmap p)
-
-foreign export ccall "plugin_handle_surface_destroy"
- pluginHandleSurfaceDestroy ::
- Ptr () -> Wetterhorn -> IO Wetterhorn
-
-pluginHandleSurfaceDestroy :: Ptr () -> Wetterhorn -> IO Wetterhorn
-pluginHandleSurfaceDestroy p = runForeign (\c -> surfaceHandler c Destroy p)
+-- | Function exported to the harness to handle the mapping/unmapping/deletion
+-- of an XDG surface.
+foreign export ccall "plugin_handle_surface"
+ pluginHandleSurface ::
+ Ptr WlrXdgSurface -> CInt -> Wetterhorn -> IO Wetterhorn
+
+pluginHandleSurface :: Ptr WlrXdgSurface -> CInt -> Wetterhorn -> IO Wetterhorn
+pluginHandleSurface p t =
+ runForeign (\c -> surfaceHandler c (toEnum $ fromIntegral t) (toSurface p))
+
+-- | Function exported to the harness to handle the mapping/unmapping/deletion
+-- of an XWayland surface.
+foreign export ccall "plugin_handle_xwayland_surface"
+ pluginHandleXWaylandSurface ::
+ Ptr WlrXWaylandSurface -> CInt -> Wetterhorn -> IO Wetterhorn
+
+pluginHandleXWaylandSurface :: Ptr WlrXWaylandSurface -> CInt -> Wetterhorn -> IO Wetterhorn
+pluginHandleXWaylandSurface p t =
+ runForeign (\c -> surfaceHandler c (toEnum $ fromIntegral t) (toSurface p))