52 disp->
ctl =
openf(
"/net/local/%s/ctl", disp->
id);
230 if (readBytes ==
sizeof(
event_t))
234 else if (readBytes ==
ERR)
246 else if (!(revents &
POLLIN))
259 if (fds[1].revents &
POLLIN)
262 if (readBytes ==
sizeof(
event_t))
267 else if (readBytes ==
ERR)
273 if (fds[0].revents &
POLLIN)
309 allFds[0].
fd = disp->
data;
315 allFds[i + 2] = fds[i];
333 if (allFds[0].revents &
POLLIN)
337 if (allFds[1].revents &
POLLIN)
377 for (
uint64_t i = 0; i < initEventsInPipe; i++)
385 if (event->
type != expected)
405 if (event->
type == expected)
482 for (
uint64_t i = 0; i < initEventsInPipe; i++)
570 *
info =
event.report.info;
#define MAX_NAME
Maximum length of names.
@ CMD_SURFACE_VISIBLE_SET
#define CMD_BUFFER_MAX_DATA
static uint64_t display_events_pipe_read(display_t *disp, event_t *event)
static uint64_t display_events_pipe_write(display_t *disp, const event_t *event)
void font_free(font_t *font)
font_t * font_new(display_t *disp, const char *family, const char *weight, uint64_t size)
void display_disconnect(display_t *disp)
Disconnect the display connection.
uint64_t display_poll(display_t *disp, pollfd_t *fds, uint64_t nfds, clock_t timeout)
Poll the display connection for events together with other file descriptors.
void * display_cmd_alloc(display_t *disp, cmd_type_t type, uint64_t size)
Allocate a section of the displays command buffer.
uint64_t display_next(display_t *disp, event_t *event, clock_t timeout)
Retrieve the next event from the display connection.
uint64_t display_unsubscribe(display_t *disp, event_type_t type)
Unsubscribe from events of a specific type.
void display_cmds_flush(display_t *disp)
Flush the display's command buffer.
uint64_t display_dispatch(display_t *disp, const event_t *event)
Dispatch an event to the appropriate surface.
void display_push(display_t *disp, surface_id_t target, event_type_t type, void *data, uint64_t size)
Push an event to the display's internal event queue.
uint64_t display_wait(display_t *disp, event_t *event, event_type_t expected)
Wait for the display to receive an event of the expected type.
uint64_t display_get_screen(display_t *disp, rect_t *rect, uint64_t index)
Get the rectangle of a screen.
void display_free(display_t *disp)
Free a display connection.
uint64_t display_set_focus(display_t *disp, surface_id_t id)
Set the focus to a surface.
bool display_is_connected(display_t *disp)
Check if the display connection is still connected.
uint64_t display_emit(display_t *disp, surface_id_t target, event_type_t type, void *data, uint64_t size)
Emit an event to a target surface.
uint64_t display_dispatch_pending(display_t *disp, event_type_t type, surface_id_t target)
Dispatch all events currently in the display's internal event queue of a specific type and target.
display_t * display_new(void)
Create a new display connection.
uint64_t display_get_surface_info(display_t *disp, surface_id_t id, surface_info_t *info)
Get information about a surface.
uint64_t display_subscribe(display_t *disp, event_type_t type)
Subscribe to events of a specific type.
uint64_t display_set_is_visible(display_t *disp, surface_id_t id, bool isVisible)
Set the visibility of a surface.
#define EVENT_MAX_DATA
Maximum size of event data.
uint16_t event_type_t
Event type.
#define EVENT_SCREEN_INFO
uint64_t window_dispatch(window_t *win, const event_t *event)
Dispatch an event to the window's elements.
void window_free(window_t *win)
Free a window.
#define EINVAL
Invalid argument.
#define ETIMEDOUT
Connection timed out.
#define ENOMEM
Out of memory.
#define errno
Error number variable.
#define ENOTCONN
Transport endpoint is not connected.
uint64_t writef(fd_t fd, const char *_RESTRICT format,...)
Wrapper for writing a formatted string to a file.
fd_t open(const char *path)
System call for opening files.
uint64_t close(fd_t fd)
System call for closing files.
uint64_t readfile(const char *path, void *buffer, uint64_t count, uint64_t offset)
Wrapper for reading a file directly using a path.
uint64_t poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
System call for polling files.
fd_t openf(const char *_RESTRICT format,...)
Wrapper for opening files with a formatted path.
uint64_t read(fd_t fd, void *buffer, uint64_t count)
System call for reading from files.
poll_events_t
Poll events type.
uint64_t write(fd_t fd, const void *buffer, uint64_t count)
System call for writing to files.
@ POLLIN
File descriptor is ready to read.
@ POLLERR
File descriptor caused an error.
#define LIST_FOR_EACH_SAFE(elem, temp, list, member)
Safely iterates over a list, allowing for element removal during iteration.
static void list_init(list_t *list)
Initializes a list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ clock_t
A nanosecond time.
void image_free(image_t *image)
#define RECT_INIT(left, top, right, bottom)
#define offsetof(type, member)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
_PUBLIC void * memset(void *s, int c, size_t n)
Opaque display structure.
event_screen_info_t screenInfo
Poll file descriptor structure.
poll_events_t revents
The events that occurred.
poll_events_t events
The events to wait for.
fd_t fd
The file descriptor to poll.
_PUBLIC int mtx_lock(mtx_t *mtx)
_PUBLIC int mtx_init(mtx_t *mtx, int type)
_PUBLIC int mtx_unlock(mtx_t *mtx)
_PUBLIC void mtx_destroy(mtx_t *mtx)