diff options
Diffstat (limited to 'src/kernel/window.c')
-rw-r--r-- | src/kernel/window.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/kernel/window.c b/src/kernel/window.c index 4d700bf..79d718e 100644 --- a/src/kernel/window.c +++ b/src/kernel/window.c @@ -1,3 +1,4 @@ +#include "settings.h" #include "paging.h" #include "window.h" #include "drive.h" @@ -16,7 +17,7 @@ #define GSC(x, y) (x / 4 + y / 4 >= 256 ? 255 : x / 4 + y / 4) #define BACKGROUND(x, y) ((struct pixel){.r = GSC(x / 2, y / 3), .g = GSC(x, y), .b = GSC(x, y / 2)}) -#define BORDER_COLOR ((struct pixel){.r = 0x11, .g = 0x11, .b = 0x11}) +static struct pixel border_color; #define MOVE_BY 5 @@ -52,6 +53,8 @@ static void load_mode_params() { const uint32_t fb_len = VBE_MODE_INFO->width * VBE_MODE_INFO->height; buffer_pages = (fb_len * sizeof(struct pixel) - 1) / 4096 + 1; buffer = allocate_kernel_pages(buffer_pages); + if (!buffer) + PANIC("could not allocate intermediate framebuffer"); #define MASK(offset, length) ((~((1 << offset) - 1)) - (offset + length == 32 ? 0 : (~((1 << (offset + length)) - 1)))) pix_clear_mask = ~( @@ -116,14 +119,14 @@ static void paint_and_above(const struct window *w) { for (uint16_t x = xs; x < xm; ++x) buffer[((y + i->ypos) & 0xffff) * VBE_MODE_INFO->width + ((x + i->xpos) & 0xffff)] = i->pixel_buffer_pma[y * i->width + x]; - draw_hz_line(i->ypos - 2, i->xpos - 2, i->xpos + i->width + 2, BORDER_COLOR); - draw_hz_line(i->ypos - 1, i->xpos - 2, i->xpos + i->width + 2, BORDER_COLOR); - draw_hz_line(i->ypos + i->height, i->xpos - 2, i->xpos + i->width + 2, BORDER_COLOR); - draw_hz_line(i->ypos + i->height + 1, i->xpos - 2, i->xpos + i->width + 2, BORDER_COLOR); - draw_vt_line(i->xpos - 2, i->ypos, i->ypos + i->height, BORDER_COLOR); - draw_vt_line(i->xpos - 1, i->ypos, i->ypos + i->height, BORDER_COLOR); - draw_vt_line(i->xpos + i->width, i->ypos, i->ypos + i->height, BORDER_COLOR); - draw_vt_line(i->xpos + i->width + 1, i->ypos, i->ypos + i->height, BORDER_COLOR); + draw_hz_line(i->ypos - 2, i->xpos - 2, i->xpos + i->width + 2, border_color); + draw_hz_line(i->ypos - 1, i->xpos - 2, i->xpos + i->width + 2, border_color); + draw_hz_line(i->ypos + i->height, i->xpos - 2, i->xpos + i->width + 2, border_color); + draw_hz_line(i->ypos + i->height + 1, i->xpos - 2, i->xpos + i->width + 2, border_color); + draw_vt_line(i->xpos - 2, i->ypos, i->ypos + i->height, border_color); + draw_vt_line(i->xpos - 1, i->ypos, i->ypos + i->height, border_color); + draw_vt_line(i->xpos + i->width, i->ypos, i->ypos + i->height, border_color); + draw_vt_line(i->xpos + i->width + 1, i->ypos, i->ypos + i->height, border_color); } blit(); @@ -296,6 +299,9 @@ static char *run_command; static char *run_command_pass = ""; void init_win() { + if (!try_get_color_setting("wm-border-color", &border_color)) + PANIC("could not load window border color setting."); + buffer = 0; load_mode_params(); |