summaryrefslogtreecommitdiff
path: root/userland/libgui/libgui.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-03-25 21:02:58 +0100
committerAnton Kling <anton@kling.gg>2024-03-25 21:04:10 +0100
commit3deb2df8e62a5f0a5535ee734a5aa13b0959f53f (patch)
treeaf8841076c95ae3de7dcd4a006026be2607a0fbf /userland/libgui/libgui.c
parent6baa733f5682f660143c851a635a53dc2c2df7ae (diff)
Random changes
Diffstat (limited to 'userland/libgui/libgui.c')
-rw-r--r--userland/libgui/libgui.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/userland/libgui/libgui.c b/userland/libgui/libgui.c
index a344778..2a8361d 100644
--- a/userland/libgui/libgui.c
+++ b/userland/libgui/libgui.c
@@ -256,6 +256,19 @@ void GUI_EventLoop(GUI_Window *w, void (*event_handler)(WS_EVENT ev)) {
}
}
+void GUI_Resize(GUI_Window *w, uint32_t sx, uint32_t sy) {
+ ftruncate(w->bitmap_fd, sx * sy * sizeof(uint32_t));
+ w->sx = sx;
+ w->sy = sy;
+ char buffer[sizeof(uint8_t) + sizeof(uint32_t) * 2];
+ uint8_t l = 2;
+ memcpy(buffer, &l, sizeof(l));
+ memcpy(buffer + sizeof(uint8_t), &sx, sizeof(sx));
+ memcpy(buffer + sizeof(uint8_t) + sizeof(uint32_t), &sy, sizeof(sy));
+ int len = sizeof(uint8_t) + sizeof(uint32_t) * 2;
+ write(w->ws_socket, buffer, len);
+}
+
GUI_Window *GUI_CreateWindow(uint32_t x, uint32_t y, uint32_t sx, uint32_t sy) {
GUI_Window *w = malloc(sizeof(GUI_Window));
if (!w)