aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rootston/view.h5
-rw-r--r--render/gles2/renderer.c2
-rw-r--r--rootston/desktop.c12
-rw-r--r--rootston/output.c24
-rw-r--r--rootston/xwayland.c5
5 files changed, 47 insertions, 1 deletions
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 579b148a..a18eda8f 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -61,6 +61,10 @@ struct roots_view {
double x, y;
float rotation;
+ bool decorated;
+ int border_width;
+ int titlebar_height;
+
bool maximized;
struct roots_output *fullscreen_output;
struct {
@@ -113,6 +117,7 @@ struct roots_view {
};
void view_get_box(const struct roots_view *view, struct wlr_box *box);
+void view_get_deco_box(const struct roots_view *view, struct wlr_box *box);
void view_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y);
void view_resize(struct roots_view *view, uint32_t width, uint32_t height);
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 89cc4ffb..30247af0 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -177,7 +177,7 @@ static bool wlr_gles2_render_texture(struct wlr_renderer *_renderer,
static void wlr_gles2_render_quad(struct wlr_renderer *renderer,
const float (*color)[4], const float (*matrix)[16]) {
GL_CALL(glUseProgram(shaders.quad));
- GL_CALL(glUniformMatrix4fv(0, 1, GL_TRUE, *matrix));
+ GL_CALL(glUniformMatrix4fv(0, 1, GL_FALSE, *matrix));
GL_CALL(glUniform4f(1, (*color)[0], (*color)[1], (*color)[2], (*color)[3]));
draw_quad();
}
diff --git a/rootston/desktop.c b/rootston/desktop.c
index d7da1600..3de1f669 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -31,6 +31,18 @@ void view_get_box(const struct roots_view *view, struct wlr_box *box) {
}
}
+void view_get_deco_box(const struct roots_view *view, struct wlr_box *box) {
+ view_get_box(view, box);
+ if (!view->decorated) {
+ return;
+ }
+
+ box->x -= view->border_width;
+ box->y -= (view->border_width + view->titlebar_height);
+ box->width += view->border_width * 2;
+ box->height += (view->border_width * 2 + view->titlebar_height);
+}
+
static void view_update_output(const struct roots_view *view,
const struct wlr_box *before) {
struct roots_desktop *desktop = view->desktop;
diff --git a/rootston/output.c b/rootston/output.c
index 42dbd972..502e72d2 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -144,8 +144,32 @@ static void render_xwayland_children(struct wlr_xwayland_surface *surface,
}
}
+static void render_decorations(struct roots_view *view,
+ struct roots_desktop *desktop, struct wlr_output *output) {
+ if (!view->decorated) {
+ return;
+ }
+ struct wlr_box deco_box;
+ view_get_deco_box(view, &deco_box);
+ double ox = deco_box.x;
+ double oy = deco_box.y;
+ wlr_output_layout_output_coords(desktop->layout, output, &ox, &oy);
+ ox *= output->scale;
+ oy *= output->scale;
+
+ float matrix[16];
+ wlr_output_get_box_matrix(output, ox, oy, deco_box.width,
+ deco_box.height, WL_OUTPUT_TRANSFORM_NORMAL, view->rotation,
+ &matrix);
+
+ float color[4] = { 0.2, 0.2, 0.2, 1 };
+ wlr_render_colored_quad(desktop->server->renderer, &color, &matrix);
+}
+
static void render_view(struct roots_view *view, struct roots_desktop *desktop,
struct wlr_output *wlr_output, struct timespec *when) {
+ render_decorations(view, desktop, wlr_output);
+
switch (view->type) {
case ROOTS_XDG_SHELL_V6_VIEW:
render_surface(view->wlr_surface, desktop, wlr_output, when,
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index 3d84dc19..eb84eba0 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -296,6 +296,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->type = ROOTS_XWAYLAND_VIEW;
view->x = (double)surface->x;
view->y = (double)surface->y;
+
view->xwayland_surface = surface;
view->roots_xwayland_surface = roots_surface;
view->wlr_surface = surface->surface;
@@ -311,6 +312,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
wl_list_insert(&desktop->views, &view->link);
if (!surface->override_redirect) {
+ view->decorated = true;
+ view->border_width = 4;
+ view->titlebar_height = 12;
+
view_setup(view);
}
}