PatchworkOS
Loading...
Searching...
No Matches
display.h
Go to the documentation of this file.
1#ifndef PATCHWORK_DISPLAY_H
2#define PATCHWORK_DISPLAY_H 1
3
4#include "cmd.h"
5#include "event.h"
6#include "rect.h"
7
8#include <stdbool.h>
9#include <stdint.h>
10#include <sys/proc.h>
11
12#if defined(__cplusplus)
13extern "C"
14{
15#endif
16
39typedef struct display display_t;
40
47
53void display_free(display_t* disp);
54
62
74
86void* display_cmd_alloc(display_t* disp, cmd_type_t type, uint64_t size);
87
96
105uint64_t display_next(display_t* disp, event_t* event, clock_t timeout);
106
117uint64_t display_poll(display_t* disp, pollfd_t* fds, uint64_t nfds, clock_t timeout);
118
131void display_push(display_t* disp, surface_id_t target, event_type_t type, void* data, uint64_t size);
132
145uint64_t display_wait(display_t* disp, event_t* event, event_type_t expected);
146
159uint64_t display_emit(display_t* disp, surface_id_t target, event_type_t type, void* data, uint64_t size);
160
170uint64_t display_dispatch(display_t* disp, const event_t* event);
171
181
191
201
213
223
233uint64_t display_set_is_visible(display_t* disp, surface_id_t id, bool isVisible);
234
244
247#if defined(__cplusplus)
248}
249#endif
250
251#endif
cmd_type_t
Definition cmd.h:23
static fd_t data
Definition dwm.c:21
void display_disconnect(display_t *disp)
Disconnect the display connection.
Definition display.c:161
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.
Definition display.c:288
void * display_cmd_alloc(display_t *disp, cmd_type_t type, uint64_t size)
Allocate a section of the displays command buffer.
Definition display.c:173
uint64_t display_next(display_t *disp, event_t *event, clock_t timeout)
Retrieve the next event from the display connection.
Definition display.c:213
uint64_t display_unsubscribe(display_t *disp, event_type_t type)
Unsubscribe from events of a specific type.
Definition display.c:528
void display_cmds_flush(display_t *disp)
Flush the display's command buffer.
Definition display.c:198
uint64_t display_dispatch(display_t *disp, const event_t *event)
Dispatch an event to the appropriate surface.
Definition display.c:440
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.
Definition display.c:349
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.
Definition display.c:367
uint64_t display_get_screen(display_t *disp, rect_t *rect, uint64_t index)
Get the rectangle of a screen.
Definition display.c:603
void display_free(display_t *disp)
Free a display connection.
Definition display.c:113
uint64_t display_set_focus(display_t *disp, surface_id_t id)
Set the focus to a surface.
Definition display.c:574
bool display_is_connected(display_t *disp)
Check if the display connection is still connected.
Definition display.c:148
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.
Definition display.c:419
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.
Definition display.c:472
display_t * display_new(void)
Create a new display connection.
Definition display.c:36
uint64_t display_get_surface_info(display_t *disp, surface_id_t id, surface_info_t *info)
Get information about a surface.
Definition display.c:547
uint64_t display_subscribe(display_t *disp, event_type_t type)
Subscribe to events of a specific type.
Definition display.c:509
uint64_t display_set_is_visible(display_t *disp, surface_id_t id, bool isVisible)
Set the visibility of a surface.
Definition display.c:588
uint16_t event_type_t
Event type.
Definition event.h:72
uint64_t surface_id_t
Definition surface.h:53
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
static fb_info_t info
Definition gop.c:41
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
Opaque display structure.
Definition internal.h:61
Event structure.
Definition event.h:271
Poll file descriptor structure.
Definition io.h:307
Definition rect.h:13