diff options
author | Anton Kling <anton@kling.gg> | 2023-11-18 00:38:31 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-18 00:38:31 +0100 |
commit | 02f427a6cae9b2e9d26f7beb6fd9f1f57367044c (patch) | |
tree | 0748cfd39a0e724e57974d8eefe4f958923992be /userland/windowserver/draw.c | |
parent | 01a9392ad6051878e217bffeffd6261ccf994c42 (diff) |
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.
Diffstat (limited to 'userland/windowserver/draw.c')
-rw-r--r-- | userland/windowserver/draw.c | 18 |
1 files changed, 15 insertions, 3 deletions
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; + } } } } |