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
c035d905
Commit
c035d905
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Add function to create objects from incoming ids
parent
5ac56da0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Quasar/Wayland/Protocol/Core.hs
+18
-8
18 additions, 8 deletions
src/Quasar/Wayland/Protocol/Core.hs
with
18 additions
and
8 deletions
src/Quasar/Wayland/Protocol/Core.hs
+
18
−
8
View file @
c035d905
...
...
@@ -403,7 +403,7 @@ setException ex = protocolStep do
State
.
modify
\
st
->
st
{
protocolException
=
Just
(
toException
ex
)}
-- Create an object. The caller is responsible for sending the 'NewId' exactly once before using the object.
--
|
Create an object. The caller is responsible for sending the 'NewId' exactly once before using the object.
newObject
::
forall
s
m
i
.
(
IsInterfaceSide
s
i
,
MonadCatch
m
)
=>
Callback
s
m
i
...
...
@@ -415,14 +415,12 @@ newObjectInternal
=>
Callback
s
m
i
->
ProtocolAction
s
m
(
Object
s
m
i
,
NewId
(
InterfaceName
i
))
newObjectInternal
callback
=
do
oId
<-
allocateObjectId
@
s
@
m
@
i
let
object
=
Object
oId
callback
someObject
=
SomeObject
object
State
.
modify
\
st
->
st
{
objects
=
HM
.
insert
oId
someObject
st
.
objects
}
pure
(
object
,
NewId
oId
)
genOId
<-
allocateObjectId
@
s
@
m
let
oId
=
NewId
@
(
InterfaceName
i
)
genOId
object
<-
newObjectFromId
oId
callback
pure
(
object
,
oId
)
where
allocateObjectId
::
forall
s
m
i
.
(
Is
Interface
Side
s
i
,
MonadCatch
m
)
=>
ProtocolAction
s
m
GenericObjectId
allocateObjectId
::
forall
s
m
.
(
IsSide
s
,
MonadCatch
m
)
=>
ProtocolAction
s
m
GenericObjectId
allocateObjectId
=
do
st
<-
State
.
get
let
...
...
@@ -433,6 +431,18 @@ newObjectInternal callback = do
State
.
put
$
st
{
nextId
=
nextId'
}
pure
id
newObjectFromId
::
forall
s
m
i
.
(
IsInterfaceSide
s
i
,
MonadCatch
m
)
=>
NewId
(
InterfaceName
i
)
->
Callback
s
m
i
->
ProtocolAction
s
m
(
Object
s
m
i
)
newObjectFromId
(
NewId
oId
)
callback
=
do
let
object
=
Object
oId
callback
someObject
=
SomeObject
object
State
.
modify
\
st
->
st
{
objects
=
HM
.
insert
oId
someObject
st
.
objects
}
pure
object
-- | Sends a message without checking any ids or creating proxy objects objects.
sendMessage
::
forall
s
m
i
.
(
IsInterfaceSide
s
i
,
MonadCatch
m
)
=>
Object
s
m
i
->
Up
s
i
->
ProtocolStep
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