|
@@ -170,57 +170,124 @@ static void render_menu(struct wio_output *output) {
|
|
|
server->menu.height = text_height;
|
|
|
}
|
|
|
|
|
|
-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 selection) {
|
|
|
+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 selection)
|
|
|
+{
|
|
|
float color[4];
|
|
|
- if (selection) {
|
|
|
+ if (selection)
|
|
|
memcpy(color, selection_box, sizeof(color));
|
|
|
- } else if (!view || view->xdg_surface->toplevel->current.activated) {
|
|
|
+ else if (!view || view->xdg_surface->toplevel->current.activated)
|
|
|
memcpy(color, active_border, sizeof(color));
|
|
|
- } else {
|
|
|
+ else
|
|
|
memcpy(color, inactive_border, sizeof(color));
|
|
|
- }
|
|
|
+
|
|
|
struct wlr_output *wlr_output = output->wlr_output;
|
|
|
- int scale = wlr_output->scale;
|
|
|
- double ox = 0, oy = 0;
|
|
|
- wlr_output_layout_output_coords(
|
|
|
- output->server->output_layout, wlr_output, &ox, &oy);
|
|
|
- ox *= scale, oy *= scale;
|
|
|
- struct wlr_box borders;
|
|
|
- // Top
|
|
|
- borders.x = (x - window_border) * scale;
|
|
|
- borders.x += ox;
|
|
|
- borders.y = (y - window_border) * scale;
|
|
|
- borders.y += oy;
|
|
|
- borders.width = (width + window_border * 2) * scale;
|
|
|
- borders.height = window_border * scale;
|
|
|
- wlr_render_rect(renderer, &borders, color, wlr_output->transform_matrix);
|
|
|
- // Right
|
|
|
- borders.x = (x + width) * scale;
|
|
|
- borders.x += ox;
|
|
|
- borders.y = (y - window_border) * scale;
|
|
|
- borders.y += oy;
|
|
|
- borders.width = window_border * scale;
|
|
|
- borders.height = (height + window_border * 2) * scale;
|
|
|
- wlr_render_rect(renderer, &borders, color, wlr_output->transform_matrix);
|
|
|
- // Bottom
|
|
|
- borders.x = (x - window_border) * scale;
|
|
|
- borders.x += ox;
|
|
|
- borders.y = (y + height) * scale;
|
|
|
- borders.y += oy;
|
|
|
- borders.width = (width + window_border * 2) * scale;
|
|
|
- borders.height = window_border * scale;
|
|
|
- wlr_render_rect(renderer, &borders, color, wlr_output->transform_matrix);
|
|
|
- // Left
|
|
|
- borders.x = (x - window_border) * scale;
|
|
|
- borders.x += ox;
|
|
|
- borders.y = (y - window_border) * scale;
|
|
|
- borders.y += oy;
|
|
|
- borders.width = window_border * scale;
|
|
|
- borders.height = (height + window_border * 2) * scale;
|
|
|
- wlr_render_rect(renderer, &borders, color, wlr_output->transform_matrix);
|
|
|
+ int scale = wlr_output->scale;
|
|
|
+ double ox = 0;
|
|
|
+ double oy = 0;
|
|
|
+ struct wlr_box borders;
|
|
|
+
|
|
|
+ wlr_output_layout_output_coords(output->server->output_layout,
|
|
|
+ wlr_output,
|
|
|
+ &ox,
|
|
|
+ &oy);
|
|
|
+ ox *= scale;
|
|
|
+ oy *= scale;
|
|
|
+
|
|
|
+ /* Top */
|
|
|
+ borders.x = (x - window_border) * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y - window_border) * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = (width + window_border * 2) * scale;
|
|
|
+ borders.height = window_border * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+
|
|
|
+ /* Right */
|
|
|
+ borders.x = (x + width) * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y - window_border) * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = window_border * scale;
|
|
|
+ borders.height = (height + window_border * 2) * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+
|
|
|
+ /* Bottom */
|
|
|
+ borders.x = (x - window_border) * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y + height) * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = (width + window_border * 2) * scale;
|
|
|
+ borders.height = window_border * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+
|
|
|
+ /* Left */
|
|
|
+ borders.x = (x - window_border) * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y - window_border) * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = window_border * scale;
|
|
|
+ borders.height = (height + window_border * 2) * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+
|
|
|
+ /* Filler */
|
|
|
+ if (selection)
|
|
|
+ {
|
|
|
+ memcpy(color, selection_filler, sizeof(color));
|
|
|
+ borders.x = x * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = y * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = width * scale;
|
|
|
+ borders.height = height * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Shadow */
|
|
|
+ else if (shadow_width)
|
|
|
+ {
|
|
|
+ memcpy(color, shadow, sizeof(color));
|
|
|
+
|
|
|
+ /* Right */
|
|
|
+ borders.x = (x + width) * scale;
|
|
|
+ borders.x += window_border * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y + shadow_width - window_border) * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = shadow_width * scale;
|
|
|
+ borders.height = (height + window_border * 2) * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+
|
|
|
+ /* Bottom */
|
|
|
+ borders.x = (x + shadow_width - window_border) * scale;
|
|
|
+ borders.x += ox;
|
|
|
+ borders.y = (y + height) * scale;
|
|
|
+ borders.y += window_border * scale;
|
|
|
+ borders.y += oy;
|
|
|
+ borders.width = (width + window_border * 2 - shadow_width) * scale;
|
|
|
+ borders.height = shadow_width * scale;
|
|
|
+ wlr_render_rect(renderer,
|
|
|
+ &borders,
|
|
|
+ color,
|
|
|
+ wlr_output->transform_matrix);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
struct render_data_layer {
|