Skip to content

Commit

Permalink
Store subsurface position
Browse files Browse the repository at this point in the history
  • Loading branch information
queezle42 committed Aug 9, 2024
1 parent 8301ed9 commit facee83
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions quasar-wayland/src/Quasar/Wayland/Server/Surface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ data Subsurface b = Subsurface {
key :: Unique,
surface :: ServerSurface b,
parentSurface :: ServerSurface b,
subsurfaceMode :: TVar SubsurfaceMode
subsurfaceMode :: TVar SubsurfaceMode,
position :: TVar (Int32, Int32)
}

isDesynchronizedSurface :: ServerSurface b -> STMc NoRetry '[] Bool
Expand Down Expand Up @@ -527,11 +528,13 @@ initializeServerSubsurface wlSubsurface wlSurface wlParent = do
surface <- getServerSurface @b wlSurface
parentSurface <- getServerSurface @b wlParent
subsurfaceMode <- newTVar Synchronized
position <- newTVar (0, 0)
let subsurface = Subsurface {
key,
surface,
parentSurface,
subsurfaceMode
subsurfaceMode,
position
}
assignSurfaceRole @Interface_wl_subsurface surface (SurfaceRoleSubsurface subsurface)
attachFinalizer wlSubsurface (destroySubsurface subsurface)
Expand All @@ -544,7 +547,7 @@ initializeServerSubsurface wlSubsurface wlSurface wlParent = do

setRequestHandler wlSubsurface RequestHandler_wl_subsurface {
destroy = pure (),
set_position = \x y -> traceM (mconcat ["TODO: Subsurface position: ", show x, ", ", show y]),
set_position = \x y -> writeTVar position (x, y),
place_above = \sibling -> traceM "TODO: Subsurface above",
place_below = \sibling -> traceM "TODO: Subsurface below",
set_sync = setSynchronized subsurface,
Expand Down

0 comments on commit facee83

Please sign in to comment.