mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-26 19:39:49 +01:00
output: remove wlr_output_set_fullscreen_surface
This wasn't using direct scan-out. Direct scan-out will probably work differently with @ascent12's work anyway.
This commit is contained in:
parent
df7d4a71fb
commit
57307b7aa7
3 changed files with 0 additions and 168 deletions
|
@ -106,11 +106,6 @@ struct wlr_output {
|
|||
|
||||
struct wl_event_source *idle_frame;
|
||||
|
||||
struct wlr_surface *fullscreen_surface;
|
||||
struct wl_listener fullscreen_surface_commit;
|
||||
struct wl_listener fullscreen_surface_destroy;
|
||||
int fullscreen_width, fullscreen_height;
|
||||
|
||||
struct wl_list cursors; // wlr_output_cursor::link
|
||||
struct wlr_output_cursor *hardware_cursor;
|
||||
int software_cursor_locks; // number of locks forcing software cursors
|
||||
|
@ -226,8 +221,6 @@ bool wlr_output_set_gamma(struct wlr_output *output, size_t size,
|
|||
const uint16_t *r, const uint16_t *g, const uint16_t *b);
|
||||
bool wlr_output_export_dmabuf(struct wlr_output *output,
|
||||
struct wlr_dmabuf_attributes *attribs);
|
||||
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
||||
struct wlr_surface *surface);
|
||||
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource);
|
||||
/**
|
||||
* Locks the output to only use software cursors instead of hardware cursors.
|
||||
|
|
|
@ -157,10 +157,6 @@ static void output_for_each_surface(struct roots_output *output,
|
|||
|
||||
if (output->fullscreen_view != NULL) {
|
||||
struct roots_view *view = output->fullscreen_view;
|
||||
if (wlr_output->fullscreen_surface == view->wlr_surface) {
|
||||
// The surface is managed by the wlr_output
|
||||
return;
|
||||
}
|
||||
|
||||
view_for_each_surface(view, layout_data, iterator, user_data);
|
||||
|
||||
|
@ -388,26 +384,6 @@ static void render_layer(struct roots_output *output,
|
|||
&data->layout, data);
|
||||
}
|
||||
|
||||
static bool has_standalone_surface(struct roots_view *view) {
|
||||
if (!wl_list_empty(&view->wlr_surface->subsurfaces)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (view->type) {
|
||||
case ROOTS_XDG_SHELL_V6_VIEW:
|
||||
return wl_list_empty(&view->xdg_surface_v6->popups);
|
||||
case ROOTS_XDG_SHELL_VIEW:
|
||||
return wl_list_empty(&view->xdg_surface->popups);
|
||||
case ROOTS_WL_SHELL_VIEW:
|
||||
return wl_list_empty(&view->wl_shell_surface->popups);
|
||||
#if WLR_HAS_XWAYLAND
|
||||
case ROOTS_XWAYLAND_VIEW:
|
||||
return wl_list_empty(&view->xwayland_surface->children);
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void surface_send_frame_done(struct wlr_surface *surface, int sx, int sy,
|
||||
void *_data) {
|
||||
struct render_data *data = _data;
|
||||
|
@ -459,17 +435,8 @@ static void render_output(struct roots_output *output) {
|
|||
output_box->y;
|
||||
view_move(view, view_x, view_y);
|
||||
|
||||
if (has_standalone_surface(view) &&
|
||||
wl_list_empty(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY])) {
|
||||
wlr_output_set_fullscreen_surface(wlr_output, view->wlr_surface);
|
||||
} else {
|
||||
wlr_output_set_fullscreen_surface(wlr_output, NULL);
|
||||
}
|
||||
|
||||
// Fullscreen views are rendered on a black background
|
||||
clear_color[0] = clear_color[1] = clear_color[2] = 0;
|
||||
} else {
|
||||
wlr_output_set_fullscreen_surface(wlr_output, NULL);
|
||||
}
|
||||
|
||||
bool needs_swap;
|
||||
|
@ -518,11 +485,6 @@ static void render_output(struct roots_output *output) {
|
|||
if (output->fullscreen_view != NULL) {
|
||||
struct roots_view *view = output->fullscreen_view;
|
||||
|
||||
if (wlr_output->fullscreen_surface == view->wlr_surface) {
|
||||
// The output will render the fullscreen view
|
||||
goto renderer_end;
|
||||
}
|
||||
|
||||
if (view->wlr_surface != NULL) {
|
||||
view_for_each_surface(view, &data.layout, render_surface, &data);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,6 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
|
||||
wl_list_remove(&output->display_destroy.link);
|
||||
wlr_output_destroy_global(output);
|
||||
wlr_output_set_fullscreen_surface(output, NULL);
|
||||
|
||||
wlr_signal_emit_safe(&output->events.destroy, output);
|
||||
|
||||
|
@ -362,53 +361,6 @@ static void output_scissor(struct wlr_output *output, pixman_box32_t *rect) {
|
|||
wlr_renderer_scissor(renderer, &box);
|
||||
}
|
||||
|
||||
static void output_fullscreen_surface_get_box(struct wlr_output *output,
|
||||
struct wlr_surface *surface, struct wlr_box *box) {
|
||||
int width, height;
|
||||
wlr_output_effective_resolution(output, &width, &height);
|
||||
|
||||
int x = (width - surface->current.width) / 2;
|
||||
int y = (height - surface->current.height) / 2;
|
||||
|
||||
box->x = x * output->scale;
|
||||
box->y = y * output->scale;
|
||||
box->width = surface->current.width * 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,
|
||||
pixman_region32_t *damage) {
|
||||
struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend);
|
||||
assert(renderer);
|
||||
|
||||
struct wlr_texture *texture = wlr_surface_get_texture(surface);
|
||||
if (texture == NULL) {
|
||||
wlr_renderer_clear(renderer, (float[]){0, 0, 0, 1});
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_box box;
|
||||
output_fullscreen_surface_get_box(output, surface, &box);
|
||||
|
||||
float matrix[9];
|
||||
enum wl_output_transform transform =
|
||||
wlr_output_transform_invert(surface->current.transform);
|
||||
wlr_matrix_project_box(matrix, &box, transform, 0,
|
||||
output->transform_matrix);
|
||||
|
||||
int nrects;
|
||||
pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects);
|
||||
for (int i = 0; i < nrects; ++i) {
|
||||
output_scissor(output, &rects[i]);
|
||||
wlr_renderer_clear(renderer, (float[]){0, 0, 0, 1});
|
||||
wlr_render_texture_with_matrix(surface->renderer, texture, matrix, 1.0f);
|
||||
}
|
||||
wlr_renderer_scissor(renderer, NULL);
|
||||
|
||||
wlr_surface_send_frame_done(surface, when);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cursor box, scaled for its output.
|
||||
*/
|
||||
|
@ -496,11 +448,6 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
|||
}
|
||||
|
||||
if (pixman_region32_not_empty(&render_damage)) {
|
||||
if (output->fullscreen_surface != NULL) {
|
||||
output_fullscreen_surface_render(output, output->fullscreen_surface,
|
||||
when, &render_damage);
|
||||
}
|
||||
|
||||
struct wlr_output_cursor *cursor;
|
||||
wl_list_for_each(cursor, &output->cursors, link) {
|
||||
if (!cursor->enabled || !cursor->visible ||
|
||||
|
@ -626,76 +573,6 @@ void wlr_output_damage_whole(struct wlr_output *output) {
|
|||
wlr_output_update_needs_swap(output);
|
||||
}
|
||||
|
||||
static void output_fullscreen_surface_reset(struct wlr_output *output) {
|
||||
if (output->fullscreen_surface != NULL) {
|
||||
wl_list_remove(&output->fullscreen_surface_commit.link);
|
||||
wl_list_remove(&output->fullscreen_surface_destroy.link);
|
||||
output->fullscreen_surface = NULL;
|
||||
wlr_output_damage_whole(output);
|
||||
}
|
||||
}
|
||||
|
||||
static void output_fullscreen_surface_handle_commit(
|
||||
struct wl_listener *listener, void *data) {
|
||||
struct wlr_output *output = wl_container_of(listener, output,
|
||||
fullscreen_surface_commit);
|
||||
struct wlr_surface *surface = output->fullscreen_surface;
|
||||
|
||||
if (output->fullscreen_width != surface->current.width ||
|
||||
output->fullscreen_height != surface->current.height) {
|
||||
output->fullscreen_width = surface->current.width;
|
||||
output->fullscreen_height = surface->current.height;
|
||||
wlr_output_damage_whole(output);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
wlr_region_scale(&damage, &damage, output->scale);
|
||||
pixman_region32_translate(&damage, box.x, box.y);
|
||||
pixman_region32_union(&output->damage, &output->damage, &damage);
|
||||
pixman_region32_fini(&damage);
|
||||
|
||||
wlr_output_update_needs_swap(output);
|
||||
}
|
||||
|
||||
static void output_fullscreen_surface_handle_destroy(
|
||||
struct wl_listener *listener, void *data) {
|
||||
struct wlr_output *output = wl_container_of(listener, output,
|
||||
fullscreen_surface_destroy);
|
||||
output_fullscreen_surface_reset(output);
|
||||
}
|
||||
|
||||
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
||||
struct wlr_surface *surface) {
|
||||
// TODO: hardware fullscreen
|
||||
|
||||
if (output->fullscreen_surface == surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
output_fullscreen_surface_reset(output);
|
||||
|
||||
output->fullscreen_surface = surface;
|
||||
wlr_output_damage_whole(output);
|
||||
|
||||
if (surface == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
output->fullscreen_surface_commit.notify =
|
||||
output_fullscreen_surface_handle_commit;
|
||||
wl_signal_add(&surface->events.commit, &output->fullscreen_surface_commit);
|
||||
output->fullscreen_surface_destroy.notify =
|
||||
output_fullscreen_surface_handle_destroy;
|
||||
wl_signal_add(&surface->events.destroy,
|
||||
&output->fullscreen_surface_destroy);
|
||||
}
|
||||
|
||||
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource) {
|
||||
assert(wl_resource_instance_of(resource, &wl_output_interface,
|
||||
&output_impl));
|
||||
|
|
Loading…
Reference in a new issue