~sircmpwn/wio

960ffdf57dbd67d563b56fce86bdbbd7c20f4326 — Leon Plickat 2 years ago 24217ec
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.
2 files changed, 15 insertions(+), 5 deletions(-)

M include/colors.h
M output.c
M include/colors.h => include/colors.h +4 -0
@@ 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,
};

M output.c => output.c +11 -5
@@ 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;