Skip to content
Snippets Groups Projects
Commit 846d7969 authored by Jens Nolte's avatar Jens Nolte
Browse files

Prefix interface types with 'Interface_'

parent 05c38f17
No related branches found
No related tags found
No related merge requests found
...@@ -11,12 +11,12 @@ import Quasar.Wayland.Protocol.Generated ...@@ -11,12 +11,12 @@ import Quasar.Wayland.Protocol.Generated
import Quasar.Wayland.Registry import Quasar.Wayland.Registry
data ClientDisplay = ClientDisplay { data ClientDisplay = ClientDisplay {
wlDisplay :: Object 'Client I_wl_display, wlDisplay :: Object 'Client Interface_wl_display,
registry :: ClientRegistry registry :: ClientRegistry
} }
newClientDisplay newClientDisplay
:: (IsInterfaceSide 'Client I_wl_display) :: (IsInterfaceSide 'Client Interface_wl_display)
=> STM (ClientDisplay, ProtocolHandle 'Client) => STM (ClientDisplay, ProtocolHandle 'Client)
newClientDisplay = newClientDisplay =
initializeProtocol clientWlDisplayCallback \wlDisplay -> do initializeProtocol clientWlDisplayCallback \wlDisplay -> do
......
...@@ -12,11 +12,11 @@ import Quasar.Wayland.Protocol.Generated ...@@ -12,11 +12,11 @@ import Quasar.Wayland.Protocol.Generated
-- --
-- This is only required when manually managing the @wl_display@ interface (usually it's applied by -- This is only required when manually managing the @wl_display@ interface (usually it's applied by
-- 'Quasar.Wayland.Display.newClientDisplay'). -- 'Quasar.Wayland.Display.newClientDisplay').
clientWlDisplayCallback :: IsInterfaceSide 'Client I_wl_display => Callback 'Client I_wl_display clientWlDisplayCallback :: IsInterfaceSide 'Client Interface_wl_display => Callback 'Client Interface_wl_display
clientWlDisplayCallback = internalFnCallback handler clientWlDisplayCallback = internalFnCallback handler
where where
-- | wl_display is specified to never change, so manually specifying the callback is safe -- | wl_display is specified to never change, so manually specifying the callback is safe
handler :: Object 'Client I_wl_display -> WireEvent_wl_display -> ProtocolM 'Client () handler :: Object 'Client Interface_wl_display -> WireEvent_wl_display -> ProtocolM 'Client ()
-- TODO parse oId -- TODO parse oId
handler _ (WireEvent_wl_display_error oId code message) = throwM $ ServerError code (toString message) handler _ (WireEvent_wl_display_error oId code message) = throwM $ ServerError code (toString message)
handler _ (WireEvent_wl_display_delete_id deletedId) = pure () -- TODO confirm delete handler _ (WireEvent_wl_display_delete_id deletedId) = pure () -- TODO confirm delete
...@@ -170,7 +170,7 @@ interfaceSideInstanceDs interface = execWriterT do ...@@ -170,7 +170,7 @@ interfaceSideInstanceDs interface = execWriterT do
interfaceN :: InterfaceSpec -> Name interfaceN :: InterfaceSpec -> Name
interfaceN interface = mkName $ "I_" <> interface.name interfaceN interface = mkName $ "Interface_" <> interface.name
interfaceT :: InterfaceSpec -> Q Type interfaceT :: InterfaceSpec -> Q Type
interfaceT interface = conT (interfaceN interface) interfaceT interface = conT (interfaceN interface)
......
...@@ -14,15 +14,15 @@ import Quasar.Wayland.Protocol ...@@ -14,15 +14,15 @@ import Quasar.Wayland.Protocol
import Quasar.Wayland.Protocol.Generated import Quasar.Wayland.Protocol.Generated
data ClientRegistry = ClientRegistry { data ClientRegistry = ClientRegistry {
wlRegistry :: Object 'Client I_wl_registry, wlRegistry :: Object 'Client Interface_wl_registry,
globalsVar :: TVar (HM.HashMap Word32 (WlString, Word32)) globalsVar :: TVar (HM.HashMap Word32 (WlString, Word32))
} }
createClientRegistry :: Object 'Client I_wl_display -> ProtocolM 'Client ClientRegistry createClientRegistry :: Object 'Client Interface_wl_display -> ProtocolM 'Client ClientRegistry
createClientRegistry wlDisplay = mfix \clientRegistry -> do createClientRegistry wlDisplay = mfix \clientRegistry -> do
globalsVar <- lift $ newTVar HM.empty globalsVar <- lift $ newTVar HM.empty
(wlRegistry, newId) <- newObject @'Client @I_wl_registry (traceCallback (callback clientRegistry)) (wlRegistry, newId) <- newObject @'Client @Interface_wl_registry (traceCallback (callback clientRegistry))
sendMessage wlDisplay $ WireRequest_wl_display_get_registry newId sendMessage wlDisplay $ WireRequest_wl_display_get_registry newId
pure ClientRegistry { pure ClientRegistry {
...@@ -30,11 +30,11 @@ createClientRegistry wlDisplay = mfix \clientRegistry -> do ...@@ -30,11 +30,11 @@ createClientRegistry wlDisplay = mfix \clientRegistry -> do
globalsVar globalsVar
} }
where where
callback :: ClientRegistry -> IsInterfaceSide 'Client I_wl_registry => Callback 'Client I_wl_registry callback :: ClientRegistry -> IsInterfaceSide 'Client Interface_wl_registry => Callback 'Client Interface_wl_registry
callback clientRegistry = internalFnCallback handler callback clientRegistry = internalFnCallback handler
where where
-- | wl_registry is specified to never change, so manually specifying the callback is safe -- | wl_registry is specified to never change, so manually specifying the callback is safe
handler :: Object 'Client I_wl_registry -> WireEvent_wl_registry -> ProtocolM 'Client () handler :: Object 'Client Interface_wl_registry -> WireEvent_wl_registry -> ProtocolM 'Client ()
handler _ (WireEvent_wl_registry_global name interface version) = do handler _ (WireEvent_wl_registry_global name interface version) = do
lift $ modifyTVar clientRegistry.globalsVar (HM.insert name (interface, version)) lift $ modifyTVar clientRegistry.globalsVar (HM.insert name (interface, version))
handler _ (WireEvent_wl_registry_global_remove name) = do handler _ (WireEvent_wl_registry_global_remove name) = do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment