mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Add deco parts top, right and bottom
This commit is contained in:
parent
a6ac2a0439
commit
c07acc9ee6
7 changed files with 104 additions and 22 deletions
43
src/output.c
43
src/output.c
|
|
@ -1,12 +1,19 @@
|
|||
#include "labwc.h"
|
||||
|
||||
struct render_data {
|
||||
struct wlr_output *output;
|
||||
static float window_active_title_bg[] = { 0.29, 0.55, 0.78, 1.0 };
|
||||
static float window_active_handle_bg[] = { 0.21, 0.49, 0.71, 1.0 };
|
||||
|
||||
struct draw_data {
|
||||
struct wlr_renderer *renderer;
|
||||
struct view *view;
|
||||
struct timespec *when;
|
||||
float *transform_matrix;
|
||||
float *rgba;
|
||||
};
|
||||
|
||||
static void draw_rect(struct draw_data *d, struct wlr_box box)
|
||||
{
|
||||
wlr_render_rect(d->renderer, &box, d->rgba, d->transform_matrix);
|
||||
}
|
||||
|
||||
static void render_cycle_box(struct output *output)
|
||||
{
|
||||
if (!output->server->cycle_view)
|
||||
|
|
@ -34,20 +41,28 @@ static void render_decorations(struct wlr_output *output, struct view *view)
|
|||
{
|
||||
if (!view_want_deco(view))
|
||||
return;
|
||||
struct draw_data ddata = {
|
||||
.renderer = view->server->renderer,
|
||||
.transform_matrix = output->transform_matrix,
|
||||
};
|
||||
|
||||
struct wlr_box box = deco_max_extents(view);
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
|
||||
output->transform_matrix);
|
||||
float color[] = { 0.2, 0.2, 0.7, 0.9 };
|
||||
wlr_render_quad_with_matrix(view->server->renderer, color, matrix);
|
||||
ddata.rgba = window_active_handle_bg;
|
||||
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_TOP));
|
||||
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_RIGHT));
|
||||
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_BOTTOM));
|
||||
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT));
|
||||
|
||||
box = deco_box(view, LAB_DECO_PART_TOP);
|
||||
float color2[] = { 0.7, 0.2, 0.2, 0.9 };
|
||||
wlr_render_rect(view->server->renderer, &box, color2,
|
||||
output->transform_matrix);
|
||||
ddata.rgba = window_active_title_bg;
|
||||
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_TITLE));
|
||||
}
|
||||
|
||||
struct render_data {
|
||||
struct wlr_output *output;
|
||||
struct wlr_renderer *renderer;
|
||||
struct view *view;
|
||||
struct timespec *when;
|
||||
};
|
||||
|
||||
static void render_surface(struct wlr_surface *surface, int sx, int sy,
|
||||
void *data)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue