diff options
Diffstat (limited to 'lib/Wayland')
| -rw-r--r-- | lib/Wayland/Display.lean | 4 | ||||
| -rw-r--r-- | lib/Wayland/Native.lean | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Wayland/Display.lean b/lib/Wayland/Display.lean index f07c5ff..0a049b3 100644 --- a/lib/Wayland/Display.lean +++ b/lib/Wayland/Display.lean @@ -317,6 +317,10 @@ def Object.listen {ι : InterfaceName} [iface : Interface ι] (obj : Object ι) ReaderT.run (handler event) global global.listen obj.proxy actualHandler +/-- Shorthand to ensure the reference count of an `Object` does not drop to `0`. -/ +def Object.keep {ι : InterfaceName} (obj : Object ι) : DisplayM σ Unit := + obj.proxy.keep + end Proxies end Wayland diff --git a/lib/Wayland/Native.lean b/lib/Wayland/Native.lean index dd138e4..f8d4c53 100644 --- a/lib/Wayland/Native.lean +++ b/lib/Wayland/Native.lean @@ -136,4 +136,7 @@ opaque Proxy.sendConstructor : (proxy : @& Proxy) → (opcode : UInt32) → (arg @[extern "waylean_proxy_listen"] opaque Proxy.listen : (proxy : @& Proxy) → (handler : UInt32 → ArgumentBuffer → EventLoop M × M) → IO Unit +@[extern "waylean_proxy_keep"] +opaque Proxy.keep : (proxy : @& Proxy) → IO Unit + end Wayland.Native |
