Setup proper bindings for mruby.

- and a lot more stuff.
This commit is contained in:
2026-09-09 23:39:05 +01:00
parent 93d71d820a
commit ac72396a0f
17 changed files with 494 additions and 109 deletions
+33 -6
View File
@@ -37,15 +37,15 @@ let _xcb_configure_window =
(ptr Types.Connection.typ @-> Types.Window.typ @-> uint16_t @-> ptr uint32_t
@-> returning Types.Cookie.Void.typ)
let reshape conn window x y width height =
let reshape conn window (rect : Decl.Types.rect) =
let mask = (1 lsl 0) lor (1 lsl 1) lor (1 lsl 2) lor (1 lsl 3) in
let values =
CArray.of_list uint32_t
[
Unsigned.UInt32.of_int x;
Unsigned.UInt32.of_int y;
Unsigned.UInt32.of_int width;
Unsigned.UInt32.of_int height;
Unsigned.UInt32.of_int rect.rect_x;
Unsigned.UInt32.of_int rect.rect_y;
Unsigned.UInt32.of_int rect.rect_width;
Unsigned.UInt32.of_int rect.rect_height;
]
in
let cookie =
@@ -55,13 +55,26 @@ let reshape conn window x y width height =
in
Error.check conn cookie
let set_stack_mode conn window mode =
let mask = 1 lsl 6 in
let values = CArray.of_list uint32_t [ Unsigned.UInt32.of_int mode ] in
let cookie =
_xcb_configure_window conn window
(Unsigned.UInt16.of_int mask)
(CArray.start values)
in
Error.check conn cookie
let move_to_top conn window = set_stack_mode conn window 0
let move_to_bottom conn window = set_stack_mode conn window 1
let _xcb_grab_key =
foreign "xcb_grab_key"
(ptr Types.Connection.typ @-> uint8_t @-> Types.Window.typ @-> uint16_t
@-> uint8_t @-> uint8_t @-> uint8_t
@-> returning Types.Cookie.Void.typ)
let keybind conn window modifier key =
let keybind conn window key modifier =
let cookie =
_xcb_grab_key conn (Unsigned.UInt8.of_int 0) window
(Unsigned.UInt16.of_int modifier)
@@ -70,6 +83,20 @@ let keybind conn window modifier key =
in
Error.check conn cookie
let _xcb_ungrab_key =
foreign "xcb_ungrab_key"
(ptr Types.Connection.typ @-> uint8_t @-> Types.Window.typ @-> uint16_t
@-> returning Types.Cookie.Void.typ)
let keyunbind conn window key modifier =
let cookie =
_xcb_ungrab_key conn
(Unsigned.UInt8.of_int key)
window
(Unsigned.UInt16.of_int modifier)
in
Error.check conn cookie
let _xcb_map_window =
foreign "xcb_map_window"
(ptr Types.Connection.typ @-> Types.Window.typ