~sircmpwn/wio

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Different colour for selection box and move box

Leon Plickat
Details
Message ID
<20190612022942.9453-1-leonhenrik.plickat@stud.uni-goettingen.de>
Sender timestamp
1560306582
DKIM signature
missing
Download raw message
Patch: +15 -5
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.
---
 include/colors.h |  4 ++++
 output.c         | 16 +++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/colors.h b/include/colors.h
index 2d3bfa7..f8d40dc 100644
--- 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
index 012da97..a44691a 100644
--- 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;
-- 
2.22.0
Review patch Export thread (mbox)