summaryrefslogtreecommitdiff
path: root/wayland/Wayland/Server/System.hsc
diff options
context:
space:
mode:
Diffstat (limited to 'wayland/Wayland/Server/System.hsc')
-rw-r--r--wayland/Wayland/Server/System.hsc30
1 files changed, 17 insertions, 13 deletions
diff --git a/wayland/Wayland/Server/System.hsc b/wayland/Wayland/Server/System.hsc
index d86f59a..60940ce 100644
--- a/wayland/Wayland/Server/System.hsc
+++ b/wayland/Wayland/Server/System.hsc
@@ -1,20 +1,11 @@
{-# LANGUAGE ForeignFunctionInterface #-}
-module Wayland.Server.System
- ( WLMessage(..)
- , WLInterface(..)
- , WLDisplay(WLDisplay)
- , wlDisplayCreate
- , wlDisplayDestroy
- , wlDisplayAddSocketAuto
- , wlDisplayRun
- , wlDisplayTerminate
- ) where
+module Wayland.Server.System where
#include <wayland-server.h>
-import Foreign (Ptr, Storable(..))
-import Foreign.C (CString, CInt)
+import Foreign (FunPtr, Ptr, Storable(..))
+import Foreign.C (CString, CInt(..))
data WLMessage
= WLMessage { msgName :: CString
@@ -31,7 +22,14 @@ data WLInterface
, ifEvents :: Ptr WLMessage
}
-newtype WLDisplay = WLDisplay (Ptr WLDisplay)
+newtype WLDisplay = WLDisplay (Ptr WLDisplay)
+newtype WLEventLoop = WLEventLoop (Ptr WLEventLoop)
+newtype WLEventSource = WLEventSource (Ptr WLEventSource)
+
+type WLEventLoopSignalFunc = CInt -> Ptr () -> IO CInt
+
+foreign import ccall "wrapper"
+ wrapWLEventLoopSignalFunc :: WLEventLoopSignalFunc -> IO (FunPtr WLEventLoopSignalFunc)
foreign import ccall "wl_display_create"
wlDisplayCreate :: IO WLDisplay
@@ -48,6 +46,12 @@ foreign import ccall "wl_display_run"
foreign import ccall "wl_display_terminate"
wlDisplayTerminate :: WLDisplay -> IO ()
+foreign import ccall "wl_display_get_event_loop"
+ wlDisplayGetEventLoop :: WLDisplay -> IO WLEventLoop
+
+foreign import ccall "wl_event_loop_add_signal"
+ wlEventLoopAddSignal :: WLEventLoop -> CInt -> FunPtr WLEventLoopSignalFunc -> Ptr () -> IO WLEventSource
+
instance Storable WLMessage where
sizeOf _ = #{size struct wl_message}
alignment _ = #{alignment struct wl_message}