wio

a wayland wm stylised after plan9 rio - forked from git.sr.ht/~srcmpwn/wio
git clone git://src.gearsix.net/wio
Log | Files | Refs | Atom | Submodules | README | LICENSE

commit 960ffdf57dbd67d563b56fce86bdbbd7c20f4326
parent 24217ec72d33653b1e45719bb48d68c1683d592f
Author: Leon Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
Date:   Wed, 12 Jun 2019 04:29:42 +0200

Different colour for selection box and move box

This is closer to rio's behavior and also improves the visibility of
the selection box, as it now clearly stands out.

Adding a flag to render_view_border is not pretty, but a reasonable
solution to change not just the colour of the selection box but also of
the move box, as "(!view)" does not catch the move box.

Diffstat:
Minclude/colors.h | 4++++
Moutput.c | 16+++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/colors.h b/include/colors.h @@ -5,6 +5,10 @@ static const float background[4] = { 0x77 / 255.0f, 0x77 / 255.0f, 0x77 / 255.0f, 1.0f, }; +static const float selection_box[4] = { + 0xFF / 255.0f, 0x0 / 255.0f, 0x0 / 255.0f, 1.0f, +}; + static const float active_border[4] = { 0x50 / 255.0f, 0xA1 / 255.0f, 0xAD / 255.0f, 1.0f, }; diff --git a/output.c b/output.c @@ -172,9 +172,12 @@ static void render_menu(struct wio_output *output) { static void render_view_border(struct wlr_renderer *renderer, struct wio_output *output, struct wio_view *view, - int x, int y, int width, int height) { + int x, int y, int width, int height, + int selection) { float color[4]; - if (!view || view->xdg_surface->toplevel->current.activated) { + if (selection) { + memcpy(color, selection_box, sizeof(color)); + } else if (!view || view->xdg_surface->toplevel->current.activated) { memcpy(color, active_border, sizeof(color)); } else { memcpy(color, inactive_border, sizeof(color)); @@ -298,7 +301,8 @@ static void output_frame(struct wl_listener *listener, void *data) { render_view_border(renderer, output, view, view->x, view->y, view->xdg_surface->surface->current.width, - view->xdg_surface->surface->current.height); + view->xdg_surface->surface->current.height, + 0); wlr_xdg_surface_for_each_surface(view->xdg_surface, render_surface, &rdata); } @@ -309,14 +313,16 @@ static void output_frame(struct wl_listener *listener, void *data) { server->cursor->x - server->interactive.sx, server->cursor->y - server->interactive.sy, view->xdg_surface->surface->current.width, - view->xdg_surface->surface->current.height); + view->xdg_surface->surface->current.height, + 1); break; case INPUT_STATE_NEW_END: case INPUT_STATE_RESIZE_END: render_view_border(renderer, output, NULL, server->interactive.sx, server->interactive.sy, server->cursor->x - server->interactive.sx, - server->cursor->y - server->interactive.sy); + server->cursor->y - server->interactive.sy, + 1); break; default: break;