From baa5c8716372f29b2e1340601282c44d7c5da7e9 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Sat, 28 Nov 2020 12:33:52 +0100
Subject: Made relative window registring local

---
 libgui/gui.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'libgui')

diff --git a/libgui/gui.c b/libgui/gui.c
index 4b28114..1e22e8c 100644
--- a/libgui/gui.c
+++ b/libgui/gui.c
@@ -36,7 +36,16 @@ static struct window *new_window(const char *title, int x, int y, u32 width, u32
 	win->id = window_count + 1;
 	win->title = title;
 	win->childs = list_new();
-	gfx_new_ctx(win->ctx);
+
+	if (win->ctx->flags & WF_RELATIVE) {
+		win->ctx->pid = getpid();
+		win->ctx->bpp = 32; // TODO: Dynamic bpp
+		win->ctx->pitch = win->ctx->width * (win->ctx->bpp >> 3);
+		win->ctx->fb = malloc(win->ctx->height * win->ctx->pitch);
+		memset(win->ctx->fb, 0, win->ctx->height * win->ctx->pitch);
+	} else {
+		gfx_new_ctx(win->ctx);
+	}
 
 	if (!win->ctx->fb)
 		return NULL;
-- 
cgit v1.2.3