mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
Delegate direct scan-out to wlr_scene
Depends on [1]. [1]: https://github.com/swaywm/wlroots/pull/3279
This commit is contained in:
parent
e6f89ed6f1
commit
5a1933f660
1 changed files with 1 additions and 70 deletions
71
output.c
71
output.c
|
|
@ -98,61 +98,6 @@ send_frame_done(struct cg_output *output, const struct timespec *when)
|
|||
wlr_scene_node_for_each_surface(&output->server->scene->node, send_frame_done_iterator, &data);
|
||||
}
|
||||
|
||||
static void
|
||||
count_surface_iterator(struct wlr_surface *surface, int sx, int sy, void *data)
|
||||
{
|
||||
size_t *n = data;
|
||||
(*n)++;
|
||||
}
|
||||
|
||||
static bool
|
||||
scan_out_primary_view(struct cg_output *output)
|
||||
{
|
||||
struct cg_server *server = output->server;
|
||||
struct wlr_output *wlr_output = output->wlr_output;
|
||||
|
||||
struct cg_drag_icon *drag_icon;
|
||||
wl_list_for_each (drag_icon, &server->seat->drag_icons, link) {
|
||||
if (drag_icon->wlr_drag_icon->mapped) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
struct cg_view *view = seat_get_focus(server->seat);
|
||||
if (!view || !view->wlr_surface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t n_surfaces = 0;
|
||||
wlr_scene_node_for_each_surface(view->scene_node, count_surface_iterator, &n_surfaces);
|
||||
if (n_surfaces > 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if CAGE_HAS_XWAYLAND
|
||||
if (view->type == CAGE_XWAYLAND_VIEW) {
|
||||
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||
if (!wl_list_empty(&xwayland_view->xwayland_surface->children)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct wlr_surface *surface = view->wlr_surface;
|
||||
|
||||
if (!surface->buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((float) surface->current.scale != wlr_output->scale ||
|
||||
surface->current.transform != wlr_output->transform) {
|
||||
return false;
|
||||
}
|
||||
|
||||
wlr_output_attach_buffer(wlr_output, &surface->buffer->base);
|
||||
return wlr_output_commit(wlr_output);
|
||||
}
|
||||
|
||||
static void
|
||||
output_enable(struct cg_output *output)
|
||||
{
|
||||
|
|
@ -204,21 +149,7 @@ handle_output_frame(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Check if we can scan-out the primary view. */
|
||||
static bool last_scanned_out = false;
|
||||
bool scanned_out = scan_out_primary_view(output);
|
||||
|
||||
if (scanned_out && !last_scanned_out) {
|
||||
wlr_log(WLR_DEBUG, "Scanning out primary view");
|
||||
}
|
||||
if (last_scanned_out && !scanned_out) {
|
||||
wlr_log(WLR_DEBUG, "Stopping primary view scan out");
|
||||
}
|
||||
last_scanned_out = scanned_out;
|
||||
|
||||
if (!scanned_out) {
|
||||
wlr_scene_output_commit(output->scene_output);
|
||||
}
|
||||
wlr_scene_output_commit(output->scene_output);
|
||||
|
||||
struct timespec now = {0};
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue