PatchworkOS
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1#include "taskbar.h"
2
4#include <stdio.h>
5#include <stdlib.h>
6
7int main(void)
8{
9 display_t* disp = display_new();
10 if (disp == NULL)
11 {
12 printf("taskbar: failed to create display\n");
13 return EXIT_FAILURE;
14 }
15
16 window_t* win = taskbar_new(disp);
17 if (win == NULL)
18 {
19 printf("taskbar: failed to create taskbar\n");
20 display_free(disp);
21 return EXIT_FAILURE;
22 }
23
24 event_t event = {0};
25 while (display_next(disp, &event, CLOCKS_NEVER) != ERR)
26 {
27 display_dispatch(disp, &event);
28 }
29
30 window_free(win);
31 display_free(disp);
32 return 0;
33}
#define CLOCKS_NEVER
Definition clock_t.h:16
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_dispatch(display_t *disp, const event_t *event)
Dispatch an event to the appropriate surface.
Definition display.c:440
void display_free(display_t *disp)
Free a display connection.
Definition display.c:113
display_t * display_new(void)
Create a new display connection.
Definition display.c:36
void window_free(window_t *win)
Free a window.
Definition window.c:415
#define NULL
Pointer error value.
Definition NULL.h:23
#define ERR
Definition main.c:44
int main()
Definition main.c:97
_PUBLIC int printf(const char *_RESTRICT format,...)
Definition printf.c:5
#define EXIT_FAILURE
Definition stdlib.h:47
Opaque display structure.
Definition internal.h:61
Event structure.
Definition event.h:271
Opaque window structure.
Definition internal.h:44
window_t * taskbar_new(display_t *disp)
Definition taskbar.c:351