summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Waylean.lean28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/Waylean.lean b/src/Waylean.lean
index 0f0a2e1..e47c6ad 100644
--- a/src/Waylean.lean
+++ b/src/Waylean.lean
@@ -230,18 +230,19 @@ def Seat.opEnd (s : Seat) : DisplayM State Seat := do
s.proxy.opEnd
return { s with op := .none }
-def Seat.opManage (s : Seat) : DisplayM State Seat := do
+def Seat.opManage (s : Seat) : DisplayM State Unit := do
match s.op with
- | .resize proxy startX startY startWidth startHeight edges =>
+ | .resize proxy _ _ startWidth startHeight edges =>
let mut width := startWidth
let mut height := startHeight
if edges.left then width := width - s.opDeltaX
if edges.right then width := width + s.opDeltaX
if edges.top then height := height - s.opDeltaY
if edges.bottom then height := height + s.opDeltaY
+ width := if width > 0 then width else 1
+ height := if height > 0 then height else 1
proxy.proposeDimensions width height
- pure { s with op := .resize proxy startX startY width height edges }
- | _ => pure s
+ | _ => pure ()
def removeOutputs : DisplayM State Unit := do
let (removedOutputs, aliveOutputs) := (← get).outputs.partition fun _ out ↦ out.removed
@@ -256,16 +257,16 @@ def removeWindows : DisplayM State Unit := do
seats ← seats.mapM fun _ seat ↦ do
let op ← match seat.op with
| .none => pure SeatOp.none
- | .move proxy startX startY =>
+ | op@(.move proxy _ _) =>
if proxy == win.proxy then
seat.proxy.opEnd
pure SeatOp.none
- else pure (SeatOp.move proxy startX startY)
- | .resize proxy startX startY startWidth startHeight edges =>
+ else pure op
+ | op@(.resize proxy _ _ _ _ _) =>
if proxy == win.proxy then
seat.proxy.opEnd
pure SeatOp.none
- else pure (SeatOp.resize proxy startX startY startWidth startHeight edges)
+ else pure op
pure { seat with
op
focused := if seat.focused == win.proxy then .none else seat.focused
@@ -347,7 +348,7 @@ def manageSeats (ctx : Context) : DisplayM State Unit := do
if seat.opRelease then
seat ← seat.opEnd
else
- seat ← seat.opManage
+ seat.opManage
pure { seat with
interacted := .none
opRelease := false
@@ -370,15 +371,14 @@ def handle (ctx : Context) : RiverWindowManagerV1.Event → DisplayM State Unit
manageSeats ctx
ctx.wm.manageFinish
| .renderStart => do
- let seats ← (← get).seats.mapM fun _ seat ↦ do
+ for seat in (← get).seats.values do
match seat.op with
- | .none => pure seat
+ | .none => pure ()
| .move proxy startX startY =>
let windows ← (← get).windows.findAndModifyM
(fun win ↦ win.proxy == proxy)
(fun win ↦ win.setPosition (startX + seat.opDeltaX) (startY + seat.opDeltaY))
set { ← get with windows := windows.fst }
- pure seat
| .resize proxy startX startY startWidth startHeight edges =>
let windows ← (← get).windows.findAndModifyM
(fun win ↦ win.proxy == proxy)
@@ -387,10 +387,6 @@ def handle (ctx : Context) : RiverWindowManagerV1.Event → DisplayM State Unit
let y := startY + if edges.top then (startHeight - win.height) else 0
win.setPosition x y)
set { ← get with windows := windows.fst }
- match windows.snd with
- | .none => pure seat
- | .some win => pure { seat with op := .resize proxy win.x win.y startWidth startHeight edges }
- set { ← get with seats }
ctx.wm.renderFinish
| .sessionLocked => pure ()
| .sessionUnlocked => pure ()