nx_x11_window.nx
buildroot/runtime/nx_x11_window.nx
about
nx_x11_window.nx -- bits-up X11 CreateWindow + MapWindow.
Session 2 of the bits-up browser arc (Task #83). Composes the
X11 connection from nx_x11_connect with the wire-protocol opcodes
that put a window on screen. WSLg translates the X11 stream into
a real native Windows surface.
CreateWindow (opcode 1) layout (X Protocol §10 / xproto.xml):
byte 0: opcode = 1
byte 1: depth (0 = CopyFromParent)
bytes 2-3: request_length (4-byte units)
bytes 4-7: window_id (allocated via nx_x11_alloc_id)
bytes 8-11: parent (e.g. root_window)
bytes 12-13: x (signed)
bytes 14-15: y
bytes 16-17: width
bytes 18-19: height
bytes 20-21: border_width
bytes 22-23: class (1 = InputOutput, 2 = InputOnly)
bytes 24-27: visual (0 = CopyFromParent)
bytes 28-31: value_mask
(optional) value_list (4 bytes per set bit in value_mask)
value-mask bits we use (X protocol §6.7):
CWBackPixel = 0x00000002
CWEventMask = 0x00000800
MapWindow (opcode 8):
byte 0: opcode = 8
byte 1: unused
bytes 2-3: request_length = 2
bytes 4-7: window_id
API:
nx_x11_create_window(conn, x, y, w, h, bg_pixel, event_mask)
-> window_id (or 0 - NX_X11_*)
nx_x11_map_window(conn, window_id) -> 0 | negative
nx_x11_flush_via_get_input_focus(conn)
-- forces server to actually process pending requests by
sending a synchronous round-trip (GetInputFocus). Without
dependencies 2 imports · 13 importers
diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.
imports: nx_syscalls.nxnx_x11_connect.nx
imported by: nx_browser.nxnx_browser_demo_test.nxnx_render_wiki_styled_window.nxnx_render_wiki_window.nxnx_x11_font_test.nxnx_x11_get_image.nxnx_x11_keyboard.nxnx_x11_paint.nxnx_x11_paint_text_5x7.nxnx_x11_pixmap.nxnx_x11_pixmap_kat_test.nxnx_x11_put_image.nxnx_x11_window_real_test.nx
structs
| none |
consts
| 50 | const NX_X11_CW_BACK_PIXEL: i64 = 0x00000002 |
| 51 | const NX_X11_CW_EVENT_MASK: i64 = 0x00000800 |
functions
| 54 | func _x11_wr_u16(buf: *u8, off: i64, v: i64) -> i64 |
| 60 | func _x11_wr_u32(buf: *u8, off: i64, v: i64) -> i64 |
| 69 | func _x11_send(conn: *X11Conn, buf: *u8, n: i64) -> i64 |
| 81 | func nx_x11_create_window(conn: *X11Conn, called by 8: mainmaindg_setupmainmainmain+2 calls 5: nx_x11_alloc_idsys_mmap_x11_wr_u16_x11_wr_u32_x11_send |
| 133 | func nx_x11_set_wm_name(conn: *X11Conn, window: i64, |
| 164 | func nx_x11_map_window(conn: *X11Conn, window_id: i64) -> i64 |
| 184 | func nx_x11_flush_via_get_input_focus(conn: *X11Conn) -> i64 called by 12: br_drawmainmaindg_setupdg_prove_surfacedraw_styled+6 calls 4: sys_mmap_x11_wr_u16_x11_sendsys_read |
| 213 | func _x11_dead_err_path() -> i64 calls 1: sys_mmap |
| 223 | func main() -> i64 |