xclient
Header: kmsroots/xclient.h
Table of contents (click to go)
Macros
Enums
Unions
Structs
Functions
Function Pointers
API Documentation
kmr_xcb_window
-
struct kmr_xcb_window
-
conn- A structure that contain all data that XCB needs to communicatewith an X server.
window- Stores the XID of the current window. XID is neeed to createwindows and manage its properties
delWindow- Used to by
kmr_xcb_window_wait_for_event()to verify whenthe window manager attempts to destroy the window.
kmr_xcb_window_create_info
-
struct kmr_xcb_window_create_info
-
const char *display;
-
int *screen;
-
const char *appName;
-
uint16_t width;
-
uint16_t height;
-
bool fullscreen;
-
bool transparent;
display- The X server’s display name. When set to NULL, the DISPLAYenvironment variable is used.
screen- Number for the screen that should be connected. When set to NULL,the screen number is set to 0.
appName- Sets the window name. Can not be more than 60 characters.
width- Width of window in pixels
height- Height of window in pixels
fullscreen- Set to true to go fullscreen, false to display normal window.
transparent- Set to true to have fully transparent window. False will display black background.
-
const char *display;
kmr_xcb_window_create
-
struct kmr_xcb_window *kmr_xcb_window_create(struct kmr_xcb_window_create_info *xcbWindowInfo);
Create an xcb client window instance (can be fullscreen).
- Parameters:
- xcbWindowInfoPointer to a
structkmr_xcb_window_create_infocontains all informationrequired to created an xcb client and some added window configuration options. - Returns:
- on success: pointer to a
structkmr_xcb_windowon failure: NULL
kmr_xcb_window_destroy
-
void kmr_xcb_window_destroy(struct kmr_xcb_window *xcb);
Frees any allocated memory and closes FD’s (if open) created after
kmr_xcb_window_create()call.- Parameters:
- xcbMust past a valid pointer to a
structkmr_xcb_window/* Free'd members with fd's closed */ struct kmr_xcb_window { xcb_connection_t *conn; xcb_window_t window; xcb_intern_atom_reply_t *delWindow; };
kmr_xcb_window_make_visible
-
void kmr_xcb_window_make_visible(struct kmr_xcb_window *xcb);
Creates the window that we display on by informing server to map the window to the screen. NOTE: If window is created before vulkan can establish VkSurfaceKHR/VkFramebuffer objects it leads to window being in a deadlock state. With no way of recovery without a power recycle.
Validation layers report
vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #0 mip level 0 has width (1848) smaller than the corresponding framebuffer width (1920).
- Parameters:
- xcbPointer to a
structkmr_xcb_windowcontains all objects necessaryfor an xcb client window to display.
kmr_xcb_renderer_impl
-
void kmr_xcb_renderer_impl(volatile bool*, uint8_t*, int*, void*);
typedef void (*kmr_xcb_renderer_impl)(volatile bool*, uint8_t*, void*);
Function pointer used by
structkmr_xcb_window_wait_for_event_infoAllows to pass the address of an external function you want to run Given that the arguments of the function are a pointer to a boolean, pointer to an integer, and a pointer to void data type- volatile bool *
- A pointer to a boolean determining if the renderer is running.Used to exit rendering operations.
- uint8_t *
- A pointer to an unsigned 8 bit integer determining current vulkanswapchain image being used.
- void *
- A pointer to any arbitrary data the custom renderer may want passduring rendering operations.
kmr_xcb_window_handle_event_info
-
struct kmr_xcb_window_handle_event_info
-
struct kmr_xcb_window *xcbWindowObject;
-
kmr_xcb_renderer_impl renderer;
-
void *rendererData;
-
uint8_t *rendererCurrentBuffer;
-
volatile bool *rendererRunning;
xcbWindowObject- Pointer to a
structkmr_xcb_windowcontains all objects necessaryto manage xcb client. renderer- Function pointer that allows custom external renderers to beexecuted by the api.
rendererData- Pointer to an optional address that will be passed though.This address may be the address of a struct. Reference passeddepends on external render function.
rendererCurrentBuffer- Pointer to an integer used by the api to update the current displayable buffer
rendererRunning- Pointer to a boolean that determines if a given window/surface is actively running
-
struct kmr_xcb_window *xcbWindowObject;
kmr_xcb_window_handle_event
-
int kmr_xcb_window_handle_event(struct kmr_xcb_window_handle_event_info *xcbEventInfo);
In an X program, everything is driven by events. This functions calls xcb_poll_for_event which doesn’t block operations and returns events from X server when available. The main event watched by function is KEY_PRESSING, when either the ‘Q’ or ‘ESC’ keys are pressed the function will return failure status.
Function is meant to be utilized as a while loop conditional/expression.
See: https://xcb.freedesktop.org/tutorial/events
- Parameters:
- xcbEventInfoPointer to a
structkmr_xcb_window_wait_for_event_infocontains allobjects necessary for an xcb client to run and pointer to custom rendererto execute and the arguments used by said renderer. - Returns:
- on success: 1on failure: 0