diff options
author | 2023-05-17 17:27:50 +0200 | |
---|---|---|
committer | 2023-05-17 17:27:50 +0200 | |
commit | cdc629aea95731433267a5be81a7e40e8d24b2d0 (patch) | |
tree | 61e265056f04e51309a26061ec7782565e545c95 | |
parent | 17cdced87bf3c337574215ce7625c462f15798a0 (diff) | |
download | cherry-cdc629aea95731433267a5be81a7e40e8d24b2d0.tar.gz cherry-cdc629aea95731433267a5be81a7e40e8d24b2d0.zip |
Add graphics support
-rw-r--r-- | src/application.c | 2 | ||||
-rw-r--r-- | src/window.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/application.c b/src/application.c index 444dfc7..91b1719 100644 --- a/src/application.c +++ b/src/application.c @@ -103,6 +103,8 @@ cherry_application_run(CherryApplication *app, int argc, char **argv) char *wnd_name = cherry_window_get_title(w); printf("Destroying window: %s\n", wnd_name); XFree(wnd_name); + + XFreeGC(app->display, w->gc); XDestroyWindow(app->display, w->window_handler); } diff --git a/src/window.c b/src/window.c index c6eb5fd..3afd4b0 100644 --- a/src/window.c +++ b/src/window.c @@ -7,6 +7,7 @@ #include <X11/Xutil.h> #include "application.h" #include "window.h" +#include "color.h" CherryWindow * cherry_window_new(void) @@ -53,6 +54,11 @@ cherry_window_new(void) clist_add(&(app->windows), w, sizeof(*w)); + w->gc = XCreateGC(app->display, w->window_handler, 0, 0); + XSetBackground(app->display, w->gc, WhitePixel(app->display, app->screen)); + XSetForeground(app->display, w->gc, BlackPixel(app->display, app->screen)); + + return w; } |