spkp

Stacking wayland compositor
git clone git://git.z3bra.org/spkp.git
Log | Files | Refs

commit 08dafffce80305abfea7da9365ac9850f4b7f8c1
parent 34f80fafd1d2f50e2f89b12e551475067b261e4e
Author: Willy Goiffon <dev@z3bra.org>
Date:   Sat, 14 Nov 2020 22:37:58 +0100

Make selection border color stand out

Diffstat:
Mconfig.def.h | 1+
Msp:kp.c | 11++++-------
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -2,6 +2,7 @@ float background[4] = { 1, 1, 0.9, 1 }; float bordercolor[4] = { 0.6, 0.6, 0.6, 0.7 }; float activecolor[4] = { 0.2, 0.2, 0.2, 0.7 }; +float drawcolor[4] = { 1, 0.2, 0.2, 0.7 }; int bordersize = 6; diff --git a/sp:kp.c b/sp:kp.c @@ -195,7 +195,7 @@ static void cb_paint_cursor(struct wl_listener *, void *); static void add_keyboard(struct state *, struct wlr_input_device *); static void add_pointer(struct state *, struct wlr_input_device *); static void render(struct wlr_surface *, int, int, void *); -static void render_border(struct wlr_box *, struct rdata *, int); +static void render_border(struct wlr_box *, struct rdata *, float *); static void focus(struct window *); static int dropprivilege(); static int keybinding(struct state *, uint32_t, uint32_t, enum wlr_key_state); @@ -363,7 +363,7 @@ cb_frame_output(struct wl_listener *listener, void *data) struct state *server = output->server; if (server->grabmode != NORMAL) - render_border(&server->grabbox, &rdata, 1); + render_border(&server->grabbox, &rdata, drawcolor); /* render cursor by software in case the GPU doesn't handle it */ wlr_output_render_software_cursors(wlr_output, NULL); @@ -900,7 +900,7 @@ render(struct wlr_surface *surface, int x, int y, void *data) focus = window->server->seat->keyboard_state.focused_surface; if (surface == window->toplevel->surface) - render_border(&box, rdata, (surface == focus)); + render_border(&box, rdata, (surface == focus) ? activecolor : bordercolor); wlr_matrix_project_box(matrix, &box, transform, 0, output->transform_matrix); wlr_render_texture_with_matrix(rdata->renderer, texture, matrix, 1); @@ -908,13 +908,10 @@ render(struct wlr_surface *surface, int x, int y, void *data) } void -render_border(struct wlr_box *content, struct rdata *rdata, int active) +render_border(struct wlr_box *content, struct rdata *rdata, float *color) { - float *color; struct wlr_box box; - color = active ? activecolor : bordercolor; - /* top */ box.x = content->x - bordersize; box.y = content->y - bordersize;