From 5e7359619cec9c032c8b78f5ca2a38b87b0c79f3 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Fri, 6 Mar 2026 18:11:12 +0100 Subject: implement event loop --- lib/Wayland/Native.lean | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'lib/Wayland') diff --git a/lib/Wayland/Native.lean b/lib/Wayland/Native.lean index c529b63..d2c3e33 100644 --- a/lib/Wayland/Native.lean +++ b/lib/Wayland/Native.lean @@ -5,5 +5,34 @@ instance : Nonempty Display := DisplayP.property @[extern "waylean_display_new"] opaque Display.new : (name : @& Option String) → IO Display -@[extern "waylean_display_get_version"] -opaque Display.getVersion : (display : @& Display) → IO UInt32 +@[extern "waylean_display_roundtrip"] +opaque Display.roundtrip : (display : @& Display) → IO Unit + +private opaque EventLoopP : NonemptyType +def EventLoop : Type := EventLoopP.type +instance : Nonempty EventLoop := EventLoopP.property + +private opaque EventSourceP : NonemptyType +def EventSource : Type := EventSourceP.type +instance : Nonempty EventSource := EventSourceP.property + +@[extern "waylean_event_loop_new"] +opaque EventLoop.new : IO EventLoop + +@[extern "waylean_event_loop_add_display"] +opaque EventLoop.addDisplay : (eventLoop : @& EventLoop) → (display : @& Display) → IO EventSource + +@[extern "waylean_event_loop_add_timer"] +opaque EventLoop.addTimer : (eventLoop : @& EventLoop) → (delayMs : UInt32) → (msg : @& IO Unit) → IO EventSource + +@[extern "waylean_event_loop_add_signal"] +opaque EventLoop.addSignal : (eventLoop : @& EventLoop) → (signum : UInt32) → (msg : @& IO Unit) → IO EventSource + +@[extern "waylean_event_loop_remove"] +opaque EventLoop.remove : (eventLoop : @& EventLoop) → (source : @& EventSource) → IO Unit + +@[extern "waylean_event_loop_quit"] +opaque EventLoop.quit : (eventLoop : @& EventLoop) → IO Unit + +@[extern "waylean_event_loop_poll"] +opaque EventLoop.poll : (eventLoop : @& EventLoop) → IO (Option (IO Unit)) -- cgit v1.3.1