Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quasar-wayland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
quasar-wayland
Commits
da604cd7
Commit
da604cd7
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Add WIP wl_display implementation
parent
14144089
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
quasar-wayland.cabal
+2
-0
2 additions, 0 deletions
quasar-wayland.cabal
src/Quasar/Wayland/Protocol.hs
+34
-0
34 additions, 0 deletions
src/Quasar/Wayland/Protocol.hs
src/Quasar/Wayland/Protocol/Core.hs
+9
-0
9 additions, 0 deletions
src/Quasar/Wayland/Protocol/Core.hs
with
45 additions
and
0 deletions
quasar-wayland.cabal
+
2
−
0
View file @
da604cd7
...
...
@@ -85,6 +85,7 @@ library
exposed-modules:
Quasar.Wayland.Client
Quasar.Wayland.Connection
Quasar.Wayland.Protocol
Quasar.Wayland.Protocol.Core
Quasar.Wayland.Protocol.Generated
Quasar.Wayland.Protocol.TH
...
...
@@ -99,6 +100,7 @@ library
quasar,
template-haskell,
unordered-containers,
utf8-string,
stm,
xml,
-- required for record-dot-preprocessor
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/Wayland/Protocol.hs
0 → 100644
+
34
−
0
View file @
da604cd7
module
Quasar.Wayland.Protocol
(
-- * A pure implementation of the Wayland wire protocol
createClientStateWithRegistry
)
where
import
Control.Monad.Catch
import
Control.Monad.State
(
StateT
,
runStateT
)
import
Data.ByteString.UTF8
(
toString
)
import
Quasar.Prelude
import
Quasar.Wayland.Protocol.Core
import
Quasar.Wayland.Protocol.Generated
createClientStateWithRegistry
::
forall
m
.
MonadCatch
m
=>
m
(
ProtocolState
'Client
m
)
createClientStateWithRegistry
=
do
(
wlRegistry
,
state'
)
<-
runStateT
go
initialState'
pure
state'
where
(
initialState'
,
wlDisplay
)
=
initialProtocolState
wlDisplayCallback
go
::
ProtocolAction
'Client
m
(
Object
'Client
m
I_wl_registry
)
go
=
do
(
wlRegistry
,
newId
)
<-
newObjectInternal
@
'Client
@
m
@
I_wl_registry
(
traceCallback
ignoreMessage
)
sendMessageInternal
wlDisplay
$
R_wl_display_get_registry
newId
pure
wlRegistry
wlDisplayCallback
::
forall
m
.
(
IsInterfaceSide
'Client
I_wl_display
,
MonadCatch
m
)
=>
Callback
'Client
m
I_wl_display
wlDisplayCallback
=
internalFnCallback
handler
where
handler
::
Object
'Client
m
I_wl_display
->
E_wl_display
->
ProtocolAction
'Client
m
()
-- TODO parse oId
handler
_
(
E_wl_display_error
oId
code
message
)
=
throwM
$
ServerError
code
(
toString
message
)
handler
_
(
E_wl_display_delete_id
deletedId
)
=
pure
()
-- TODO confirm delete
This diff is collapsed.
Click to expand it.
src/Quasar/Wayland/Protocol/Core.hs
+
9
−
0
View file @
da604cd7
...
...
@@ -16,6 +16,7 @@ module Quasar.Wayland.Protocol.Core (
IsObject
,
IsMessage
(
..
),
ProtocolState
,
ProtocolAction
,
Callback
(
..
),
internalFnCallback
,
traceCallback
,
...
...
@@ -26,10 +27,14 @@ module Quasar.Wayland.Protocol.Core (
newObject
,
feedInput
,
setException
,
newObjectInternal
,
sendMessageInternal
,
showObjectMessage
,
isNewId
,
ServerError
(
..
),
-- * Message decoder operations
WireFormat
(
..
),
dropRemaining
,
...
...
@@ -349,6 +354,10 @@ data MaximumIdReached = MaximumIdReached
deriving
stock
Show
deriving
anyclass
Exception
data
ServerError
=
ServerError
Word32
String
deriving
stock
Show
deriving
anyclass
Exception
-- * Monad plumbing
type
ProtocolStep
s
m
a
=
ProtocolState
s
m
->
m
(
Either
SomeException
a
,
Maybe
BSL
.
ByteString
,
ProtocolState
s
m
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment