summaryrefslogtreecommitdiff
path: root/wayland/Wayland/Server/Display.hs
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2024-08-14 21:00:55 +0200
committerHannes Schulze <haschu0103@outlook.de>2024-08-14 21:00:55 +0200
commit53c274ad747bfbac34e979bee5f0841f9568c89f (patch)
treee6712c05aba55600534816d5984b7f102c616e7a /wayland/Wayland/Server/Display.hs
parentf4f93ad6e9289d499e1f4c6cf7f9581e622f2d26 (diff)
finish codegen
Diffstat (limited to 'wayland/Wayland/Server/Display.hs')
-rw-r--r--wayland/Wayland/Server/Display.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/wayland/Wayland/Server/Display.hs b/wayland/Wayland/Server/Display.hs
index 527d9da..2594330 100644
--- a/wayland/Wayland/Server/Display.hs
+++ b/wayland/Wayland/Server/Display.hs
@@ -338,7 +338,8 @@ flushClientEvents c = liftIO (unwrapClient c >>= wlClientFlush)
-- The object is published through the global wl_registry instance. When a client wants to instantiate the global
-- object, the given "bind" message will be dispatched in the message loop.
registerGlobal
- :: forall o bindMsg s. Object o
+ :: forall o bindMsg s
+ . Object o
=> MessageClass bindMsg
=> (Global -> NewObject o -> bindMsg) -- ^ Function used to create a message to bind the global object for a client.
-> DisplayM s Global -- ^ Display monad wrapping a handle to the global which can be used to unregister it.
@@ -394,7 +395,7 @@ createObject o destroyHook = do
-- This will invoke the object's "destroy" hook.
destroyObject :: Object o => o -> DisplayM s ()
destroyObject o = liftIO $ do
- ptr <- unwrapResource o
+ ptr <- unwrapResource (toAny o)
wlResourceDestroy ptr
-- | Send an event for an object to the client it is associated with.
@@ -510,11 +511,12 @@ unregisterFileSource file = liftIO $ do
freeHaskellFunPtr (fileFunc file)
fromFileEventMask :: FileEventMask -> Word32
-fromFileEventMask events = conditionalMask wlEventReadable (fileEventReadable events)
- $ conditionalMask wlEventWritable (fileEventWritable events)
- $ conditionalMask wlEventHangup (fileEventHangup events)
- $ conditionalMask wlEventError (fileEventError events) 0
- where conditionalMask mask enabled x = if enabled then x .|. mask else x
+fromFileEventMask events = 0
+ .|. conditionalMask wlEventReadable (fileEventReadable events)
+ .|. conditionalMask wlEventWritable (fileEventWritable events)
+ .|. conditionalMask wlEventHangup (fileEventHangup events)
+ .|. conditionalMask wlEventError (fileEventError events)
+ where conditionalMask mask enabled = if enabled then mask else 0
toFileEventMask :: Word32 -> FileEventMask
toFileEventMask bits = FileEventMask { fileEventReadable = testMask wlEventReadable