summaryrefslogtreecommitdiff
path: root/lib/Wayland/Native.lean
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2026-03-06 18:11:12 +0100
committerHannes Schulze <haschu0103@outlook.de>2026-03-06 18:11:12 +0100
commit5e7359619cec9c032c8b78f5ca2a38b87b0c79f3 (patch)
treeafc9bbf241b32ea006b1a57dfdd9a803e450cca2 /lib/Wayland/Native.lean
parentac696809b0c62f7f062a0dc155a4bf4a995cc9cf (diff)
implement event loop
Diffstat (limited to 'lib/Wayland/Native.lean')
-rw-r--r--lib/Wayland/Native.lean33
1 files changed, 31 insertions, 2 deletions
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))