~sircmpwn/wio

Different colour for selection box and move box v1 PROPOSED

Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/wio/%3C20190612022942.9453-1-leonhenrik.plickat%40stud.uni-goettingen.de%3E/mbox | git am -3
Learn more about email & git

[PATCH] Different colour for selection box and move box Export this patch

Leon Plickat
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
View this thread in the archives