tUse a different border color for active window - spkp - Stacking wayland compositor
(HTM) git clone git://git.z3bra.org/spkp.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit fb861150ce5d1fc35b2b420d5d572a4d3ce206c9
(DIR) parent 99f831765709a109e30d4a5ef5343ed2e55ea3fc
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Thu, 12 Nov 2020 15:17:36 +0100
Use a different border color for active window
Diffstat:
M compositor.c | 7 +++++--
M config.def.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/compositor.c b/compositor.c
t@@ -793,10 +793,11 @@ add_pointer(struct state *server, struct wlr_input_device *device)
void
render(struct wlr_surface *surface, int x, int y, void *data)
{
- float matrix[9];
+ float *color, matrix[9];
struct rdata *rdata;
struct window *window;
struct wlr_output *output;
+ struct wlr_surface *focus;
struct wlr_texture *texture;
struct wlr_box box, border;
enum wl_output_transform transform;
t@@ -816,12 +817,14 @@ render(struct wlr_surface *surface, int x, int y, void *data)
box.width = surface->current.width;
box.height = surface->current.height;
+ focus = window->server->seat->keyboard_state.focused_surface;
if (surface == window->toplevel->surface) {
border.x = box.x - bordersize;
border.y = box.y - bordersize;
border.width = box.width + bordersize * 2;
border.height = box.height + bordersize * 2;
- wlr_render_rect(rdata->renderer, &border, bordercolor, output->transform_matrix);
+ color = surface == focus ? activecolor : bordercolor;
+ wlr_render_rect(rdata->renderer, &border, color, output->transform_matrix);
}
wlr_matrix_project_box(matrix, &box, transform, 0, output->transform_matrix);
(DIR) diff --git a/config.def.h b/config.def.h
t@@ -1,5 +1,7 @@
float background[4] = { 1.0, 0.6, 0.6, 0.3 };
+
float bordercolor[4] = { 0.7, 0.7, 0.7, 1.0 };
+float activecolor[4] = { 0.3, 0.3, 0.3, 1.0 };
int bordersize = 2;