Setup basic layout system
- add Enter event bindings - Add some more window bindings.
This commit is contained in:
+52
-3
@@ -6,9 +6,10 @@ let _xcb_change_window_attributes_checked =
|
||||
(ptr Types.Connection.typ @-> Types.Window.typ @-> uint32_t @-> ptr uint32_t
|
||||
@-> returning Types.Cookie.Void.typ)
|
||||
|
||||
let values =
|
||||
CArray.of_list uint32_t
|
||||
[ Unsigned.UInt32.of_int (1048576 lor 524288 lor 131072 lor 4194304) ]
|
||||
let event_mask =
|
||||
(1 lsl 4) lor (1 lsl 17) lor (1 lsl 19) lor (1 lsl 20) lor (1 lsl 22)
|
||||
|
||||
let values = CArray.of_list uint32_t [ Unsigned.UInt32.of_int event_mask ]
|
||||
|
||||
let setup conn root =
|
||||
let cookie =
|
||||
@@ -18,6 +19,42 @@ let setup conn root =
|
||||
in
|
||||
Error.check conn cookie
|
||||
|
||||
let window_event_mask = 1 lsl 4
|
||||
|
||||
let values_window =
|
||||
CArray.of_list uint32_t [ Unsigned.UInt32.of_int window_event_mask ]
|
||||
|
||||
let setup_window conn window =
|
||||
let cookie =
|
||||
_xcb_change_window_attributes_checked conn window
|
||||
(Unsigned.UInt32.of_int 2048)
|
||||
(CArray.start values_window)
|
||||
in
|
||||
Error.check conn cookie
|
||||
|
||||
let _xcb_configure_window =
|
||||
foreign "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 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;
|
||||
]
|
||||
in
|
||||
let cookie =
|
||||
_xcb_configure_window conn window
|
||||
(Unsigned.UInt16.of_int mask)
|
||||
(CArray.start values)
|
||||
in
|
||||
Error.check conn cookie
|
||||
|
||||
let _xcb_grab_key =
|
||||
foreign "xcb_grab_key"
|
||||
(ptr Types.Connection.typ @-> uint8_t @-> Types.Window.typ @-> uint16_t
|
||||
@@ -42,6 +79,18 @@ let map conn window =
|
||||
let cookie = _xcb_map_window conn window in
|
||||
Error.check conn cookie
|
||||
|
||||
let _xcb_set_input_focus =
|
||||
foreign "xcb_set_input_focus"
|
||||
(ptr Types.Connection.typ @-> uint8_t @-> Types.Window.typ @-> uint32_t
|
||||
@-> returning Types.Cookie.Void.typ)
|
||||
|
||||
let focus conn window =
|
||||
let cookie =
|
||||
_xcb_set_input_focus conn (Unsigned.UInt8.of_int 0) window
|
||||
(Unsigned.UInt32.of_int 0)
|
||||
in
|
||||
Error.check conn cookie
|
||||
|
||||
let _xcb_kill_client =
|
||||
foreign "xcb_kill_client"
|
||||
(ptr Types.Connection.typ @-> Types.Window.typ
|
||||
|
||||
Reference in New Issue
Block a user