From 66779122ad298b27315b435339ca83960c6c2d41 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 31 Oct 2020 20:42:35 +0100 Subject: Some performance improvements --- apps/wm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/wm.c b/apps/wm.c index c7622ed..b995efb 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -43,7 +43,8 @@ static struct context *new_context(struct context *ctx, u32 pid, int x, int y, u ctx->fb = malloc(height * ctx->pitch); memset(ctx->fb, 0, height * ctx->pitch); ctx->flags = flags; - context_count++; + if (!(flags & WF_RELATIVE)) + context_count++; if (context_count % 2 == 1) MOUSE_SKIP++; return ctx; @@ -66,6 +67,13 @@ static struct context *context_at(int x, int y) return ret; } +// This only works if window hasn't moved - TODO! +static void redraw_focused() +{ + gfx_ctx_on_ctx(&exchange, focused, focused->x, focused->y); + memcpy(direct.fb, exchange.fb, exchange.pitch * exchange.height); +} + // TODO: Add dirty bitmap redraw (and clipping?): https://github.com/JMarlin/wsbe static void redraw_all() { @@ -257,6 +265,9 @@ int main(int argc, char **argv) case GFX_REDRAW: redraw_all(); break; + case GFX_REDRAW_FOCUSED: + redraw_focused(); + break; case EVENT_MOUSE: handle_mouse(msg->data); break; -- cgit v1.2.3