From 02f427a6cae9b2e9d26f7beb6fd9f1f57367044c Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sat, 18 Nov 2023 00:38:31 +0100 Subject: WindowServer: Implement window resizing. Currently no event is sent to a client that a window is resized. This should be added when I can bother adding that functionality to the client applications also. --- userland/windowserver/draw.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'userland/windowserver/draw.c') diff --git a/userland/windowserver/draw.c b/userland/windowserver/draw.c index 7e07305..1e02d0d 100644 --- a/userland/windowserver/draw.c +++ b/userland/windowserver/draw.c @@ -81,6 +81,8 @@ void draw_window(DISPLAY *disp, const WINDOW *w) { const int py = w->y; const int sx = w->sx; const int sy = w->sy; + const int b_sx = w->buffer_sx; + const int b_sy = w->buffer_sy; x = px; y = py; // Draw a border around the current selected window @@ -102,9 +104,19 @@ void draw_window(DISPLAY *disp, const WINDOW *w) { px * disp->bpp; if (i * sx > disp->height * disp->width) break; - uint32_t *bm = &w->bitmap_ptr[i * sx]; - for (int j = 0; j < sx; j++) { - ptr[j] = bm[j]; + if (i < b_sy) { + uint32_t *bm = &w->bitmap_ptr[i * b_sx]; + int j = 0; + for (; j < b_sx && j < sx; j++) { + ptr[j] = bm[j]; + } + for (; j < sx; j++) { + ptr[j] = 0; + } + } else { + for (int j = 0; j < sx; j++) { + ptr[j] = 0; + } } } } -- cgit v1.2.3