Merge pull request #659 from agx/alpha

Make wlr_render_with_matrix use alpha
This commit is contained in:
Drew DeVault 2018-02-25 13:16:35 -05:00 committed by GitHub
commit 3296365ce5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 55 additions and 22 deletions

View file

@ -23,6 +23,16 @@
#include "rootston/view.h"
#include "rootston/xcursor.h"
struct roots_view *view_create() {
struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (!view) {
return NULL;
}
view->alpha = 1.0f;
return view;
}
void view_get_box(const struct roots_view *view, struct wlr_box *box) {
box->x = view->x;
box->y = view->y;
@ -269,6 +279,15 @@ void view_rotate(struct roots_view *view, float rotation) {
view_damage_whole(view);
}
void view_cycle_alpha(struct roots_view *view) {
view->alpha -= 0.05;
/* Don't go completely transparent */
if (view->alpha < 0.1) {
view->alpha = 1.0;
}
view_damage_whole(view);
}
void view_close(struct roots_view *view) {
if (view->close) {
view->close(view);