|
|
@ -332,19 +332,22 @@ void wlr_output_make_current(struct wlr_output *output) {
|
|
|
|
output->impl->make_current(output);
|
|
|
|
output->impl->make_current(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void output_fullscreen_surface_render(struct wlr_output *output,
|
|
|
|
static void output_fullscreen_surface_get_box(struct wlr_output *output,
|
|
|
|
struct wlr_surface *surface, const struct timespec *when) {
|
|
|
|
struct wlr_surface *surface, struct wlr_box *box) {
|
|
|
|
int width, height;
|
|
|
|
int width, height;
|
|
|
|
wlr_output_effective_resolution(output, &width, &height);
|
|
|
|
wlr_output_effective_resolution(output, &width, &height);
|
|
|
|
|
|
|
|
|
|
|
|
int x = (width - surface->current->width) / 2;
|
|
|
|
int x = (width - surface->current->width) / 2;
|
|
|
|
int y = (height - surface->current->height) / 2;
|
|
|
|
int y = (height - surface->current->height) / 2;
|
|
|
|
|
|
|
|
|
|
|
|
int render_x = x * output->scale;
|
|
|
|
box->x = x * output->scale;
|
|
|
|
int render_y = y * output->scale;
|
|
|
|
box->y = y * output->scale;
|
|
|
|
int render_width = surface->current->width * output->scale;
|
|
|
|
box->width = surface->current->width * output->scale;
|
|
|
|
int render_height = surface->current->height * output->scale;
|
|
|
|
box->height = surface->current->height * output->scale;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void output_fullscreen_surface_render(struct wlr_output *output,
|
|
|
|
|
|
|
|
struct wlr_surface *surface, const struct timespec *when) {
|
|
|
|
glViewport(0, 0, output->width, output->height);
|
|
|
|
glViewport(0, 0, output->width, output->height);
|
|
|
|
glClearColor(0, 0, 0, 0);
|
|
|
|
glClearColor(0, 0, 0, 0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
@ -353,11 +356,14 @@ static void output_fullscreen_surface_render(struct wlr_output *output,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_box box;
|
|
|
|
|
|
|
|
output_fullscreen_surface_get_box(output, surface, &box);
|
|
|
|
|
|
|
|
|
|
|
|
float translate[16];
|
|
|
|
float translate[16];
|
|
|
|
wlr_matrix_translate(&translate, render_x, render_y, 0);
|
|
|
|
wlr_matrix_translate(&translate, box.x, box.y, 0);
|
|
|
|
|
|
|
|
|
|
|
|
float scale[16];
|
|
|
|
float scale[16];
|
|
|
|
wlr_matrix_scale(&scale, render_width, render_height, 1);
|
|
|
|
wlr_matrix_scale(&scale, box.width, box.height, 1);
|
|
|
|
|
|
|
|
|
|
|
|
float matrix[16];
|
|
|
|
float matrix[16];
|
|
|
|
wlr_matrix_mul(&translate, &scale, &matrix);
|
|
|
|
wlr_matrix_mul(&translate, &scale, &matrix);
|
|
|
@ -401,14 +407,14 @@ static void output_cursor_render(struct wlr_output_cursor *cursor,
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_box cursor_box;
|
|
|
|
struct wlr_box box;
|
|
|
|
output_cursor_get_box(cursor, &cursor_box);
|
|
|
|
output_cursor_get_box(cursor, &box);
|
|
|
|
|
|
|
|
|
|
|
|
float translate[16];
|
|
|
|
float translate[16];
|
|
|
|
wlr_matrix_translate(&translate, cursor_box.x, cursor_box.y, 0);
|
|
|
|
wlr_matrix_translate(&translate, box.x, box.y, 0);
|
|
|
|
|
|
|
|
|
|
|
|
float scale[16];
|
|
|
|
float scale[16];
|
|
|
|
wlr_matrix_scale(&scale, cursor_box.width, cursor_box.height, 1);
|
|
|
|
wlr_matrix_scale(&scale, box.width, box.height, 1);
|
|
|
|
|
|
|
|
|
|
|
|
float matrix[16];
|
|
|
|
float matrix[16];
|
|
|
|
wlr_matrix_mul(&translate, &scale, &matrix);
|
|
|
|
wlr_matrix_mul(&translate, &scale, &matrix);
|
|
|
@ -477,8 +483,17 @@ static void output_fullscreen_surface_handle_commit(
|
|
|
|
struct wl_listener *listener, void *data) {
|
|
|
|
struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_output *output = wl_container_of(listener, output,
|
|
|
|
struct wlr_output *output = wl_container_of(listener, output,
|
|
|
|
fullscreen_surface_commit);
|
|
|
|
fullscreen_surface_commit);
|
|
|
|
// TODO: use surface damage
|
|
|
|
struct wlr_surface *surface = output->fullscreen_surface;
|
|
|
|
output_damage_whole(output);
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_box box;
|
|
|
|
|
|
|
|
output_fullscreen_surface_get_box(output, surface, &box);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pixman_region32_t damage;
|
|
|
|
|
|
|
|
pixman_region32_init(&damage);
|
|
|
|
|
|
|
|
pixman_region32_copy(&damage, &surface->current->surface_damage);
|
|
|
|
|
|
|
|
pixman_region32_translate(&damage, box.x, box.y);
|
|
|
|
|
|
|
|
pixman_region32_union(&output->damage, &output->damage, &damage);
|
|
|
|
|
|
|
|
pixman_region32_fini(&damage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void output_fullscreen_surface_handle_destroy(
|
|
|
|
static void output_fullscreen_surface_handle_destroy(
|
|
|
|