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
38e31fa9
Commit
38e31fa9
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Add createProxy and add (dummy) TH implementation
parent
28e41603
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Quasar/Wayland/Protocol/Core.hs
+4
-3
4 additions, 3 deletions
src/Quasar/Wayland/Protocol/Core.hs
src/Quasar/Wayland/Protocol/TH.hs
+6
-9
6 additions, 9 deletions
src/Quasar/Wayland/Protocol/TH.hs
with
10 additions
and
12 deletions
src/Quasar/Wayland/Protocol/Core.hs
+
4
−
3
View file @
38e31fa9
...
@@ -13,7 +13,7 @@ module Quasar.Wayland.Protocol.Core (
...
@@ -13,7 +13,7 @@ module Quasar.Wayland.Protocol.Core (
IsSide
(
..
),
IsSide
(
..
),
Side
(
..
),
Side
(
..
),
IsInterface
(
..
),
IsInterface
(
..
),
IsInterfaceSide
,
IsInterfaceSide
(
..
)
,
IsInterfaceHandler
(
..
),
IsInterfaceHandler
(
..
),
Object
,
Object
,
IsObject
,
IsObject
,
...
@@ -226,6 +226,7 @@ class (
...
@@ -226,6 +226,7 @@ class (
IsMessage
(
WireDown
s
i
)
IsMessage
(
WireDown
s
i
)
)
)
=>
IsInterfaceSide
(
s
::
Side
)
i
where
=>
IsInterfaceSide
(
s
::
Side
)
i
where
createProxy
::
Object
s
i
->
Up
s
i
getWireDown
::
forall
s
i
.
IsInterfaceSide
s
i
=>
Object
s
i
->
Opcode
->
Get
(
ProtocolM
s
(
WireDown
s
i
))
getWireDown
::
forall
s
i
.
IsInterfaceSide
s
i
=>
Object
s
i
->
Opcode
->
Get
(
ProtocolM
s
(
WireDown
s
i
))
...
@@ -452,7 +453,7 @@ initializeProtocol wlDisplayWireCallback initializationAction = do
...
@@ -452,7 +453,7 @@ initializeProtocol wlDisplayWireCallback initializationAction = do
}
}
writeTVar
stateVar
(
Right
state
)
writeTVar
stateVar
(
Right
state
)
let
wlDisplay
=
Object
protocol
wlDisplayId
undefined
undefined
wlDisplayWireCallback
let
wlDisplay
=
Object
protocol
wlDisplayId
(
createProxy
wlDisplay
)
undefined
wlDisplayWireCallback
modifyTVar'
objectsVar
(
HM
.
insert
wlDisplayId
(
SomeObject
wlDisplay
))
modifyTVar'
objectsVar
(
HM
.
insert
wlDisplayId
(
SomeObject
wlDisplay
))
result
<-
runReaderT
(
initializationAction
wlDisplay
)
state
result
<-
runReaderT
(
initializationAction
wlDisplay
)
state
...
@@ -546,7 +547,7 @@ newObjectFromId (NewId oId) callback = do
...
@@ -546,7 +547,7 @@ newObjectFromId (NewId oId) callback = do
protocol
<-
askProtocol
protocol
<-
askProtocol
let
let
genericObjectId
=
toGenericObjectId
oId
genericObjectId
=
toGenericObjectId
oId
object
=
Object
protocol
genericObjectId
undefined
undefined
callback
object
=
Object
protocol
genericObjectId
(
createProxy
object
)
undefined
callback
someObject
=
SomeObject
object
someObject
=
SomeObject
object
modifyProtocolVar
(
.
objectsVar
)
(
HM
.
insert
genericObjectId
someObject
)
modifyProtocolVar
(
.
objectsVar
)
(
HM
.
insert
genericObjectId
someObject
)
pure
object
pure
object
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/Wayland/Protocol/TH.hs
+
6
−
9
View file @
38e31fa9
...
@@ -90,8 +90,9 @@ tellQs = tell <=< lift
...
@@ -90,8 +90,9 @@ tellQs = tell <=< lift
interfaceDecs
::
InterfaceSpec
->
Q
([
Dec
],
[
Dec
])
interfaceDecs
::
InterfaceSpec
->
Q
([
Dec
],
[
Dec
])
interfaceDecs
interface
=
do
interfaceDecs
interface
=
do
public
<-
execWriterT
do
public
<-
execWriterT
do
tellQ
$
dataD
(
pure
[]
)
iName
[]
Nothing
[]
[
derivingInterfaceClient
,
derivingInterfaceServer
]
tellQ
$
dataD
(
pure
[]
)
iName
[]
Nothing
[]
[]
tellQ
$
instanceD
(
pure
[]
)
[
t
|
IsInterface $iT
|]
instanceDecs
tellQ
$
instanceD
(
pure
[]
)
[
t
|
IsInterface $iT
|]
instanceDecs
tellQs
$
interfaceSideInstanceDs
interface
when
(
length
interface
.
requests
>
0
)
do
when
(
length
interface
.
requests
>
0
)
do
tellQ
requestRecordD
tellQ
requestRecordD
...
@@ -170,10 +171,12 @@ messageRecordD name messageContexts = dataD (cxt []) name [] Nothing [con] []
...
@@ -170,10 +171,12 @@ messageRecordD name messageContexts = dataD (cxt []) name [] Nothing [con] []
interfaceSideInstanceDs
::
InterfaceSpec
->
Q
[
Dec
]
interfaceSideInstanceDs
::
InterfaceSpec
->
Q
[
Dec
]
interfaceSideInstanceDs
interface
=
execWriterT
do
interfaceSideInstanceDs
interface
=
execWriterT
do
tellQ
s
[
d
|
instance
IsInterfaceSide 'Client $iT
|]
tellQ
$
instance
D
(
pure
[]
)
(
[
t
|
IsInterfaceSide 'Client $iT
|]
)
[
createProxyD
Client
]
tellQ
s
[
d
|
instance
IsInterfaceSide 'Server $iT
|]
tellQ
$
instance
D
(
pure
[]
)
(
[
t
|
IsInterfaceSide 'Server $iT
|]
)
[
createProxyD
Server
]
where
where
iT
=
interfaceT
interface
iT
=
interfaceT
interface
createProxyD
::
Side
->
Q
Dec
createProxyD
side
=
funD
'createProxy
[
clause
[]
(
normalB
[
|
undefined
|
])
[]
]
interfaceN
::
InterfaceSpec
->
Name
interfaceN
::
InterfaceSpec
->
Name
...
@@ -289,12 +292,6 @@ derivingEq = derivClause (Just StockStrategy) [[t|Eq|]]
...
@@ -289,12 +292,6 @@ derivingEq = derivClause (Just StockStrategy) [[t|Eq|]]
derivingShow
::
Q
DerivClause
derivingShow
::
Q
DerivClause
derivingShow
=
derivClause
(
Just
StockStrategy
)
[
[
t
|
Show
|]
]
derivingShow
=
derivClause
(
Just
StockStrategy
)
[
[
t
|
Show
|]
]
derivingInterfaceClient
::
Q
DerivClause
derivingInterfaceClient
=
derivClause
(
Just
AnyclassStrategy
)
[
[
t
|
IsInterfaceSide 'Client
|]
]
derivingInterfaceServer
::
Q
DerivClause
derivingInterfaceServer
=
derivClause
(
Just
AnyclassStrategy
)
[
[
t
|
IsInterfaceSide 'Server
|]
]
-- | Map an argument to its high-level api type
-- | Map an argument to its high-level api type
argumentType
::
ArgumentSpec
->
Q
Type
argumentType
::
ArgumentSpec
->
Q
Type
argumentType
argSpec
=
liftArgumentType
argSpec
.
argType
argumentType
argSpec
=
liftArgumentType
argSpec
.
argType
...
...
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