Setup proper WM lifecycle and xcb bindings

This commit is contained in:
2026-07-26 14:45:58 +01:00
parent 837d457b10
commit 45ef92f27e
11 changed files with 559 additions and 348 deletions
+12 -9
View File
@@ -1,15 +1,18 @@
open Ctypes
open Foreign
module Void = struct
type t
module Atom = struct
let _xcb_intern_atom =
foreign "xcb_intern_atom"
(ptr Types.Connection.typ @-> uint8_t @-> uint16_t @-> string
@-> returning Types.Cookie.Atom.typ)
let typ : t structure typ = structure "xcb_void_cookie_t"
let sequence = field typ "sequence" uint32_t
let () = seal typ
let intern conn only_if_exists name =
_xcb_intern_atom conn
(Unsigned.UInt8.of_int (if only_if_exists then 1 else 0))
(Unsigned.UInt16.of_int (String.length name))
name
let _xcb_change_window_attributes_checked =
foreign "xcb_change_window_attributes_checked"
(ptr Connection.typ @-> uint32_t @-> uint32_t @-> ptr uint32_t
@-> returning typ)
let wm_protocols conn = intern conn true "WM_PROTOCOLS"
let wm_delete_window conn = intern conn false "WM_DELETE_WINDOW"
end