Fix fullscreen in xdg-shell
This commit is contained in:
parent
bc68f26960
commit
54f1135c05
|
@ -1,9 +1,10 @@
|
|||
#ifndef WLR_TYPES_WLR_SURFACE_H
|
||||
#define WLR_TYPES_WLR_SURFACE_H
|
||||
#include <wayland-server.h>
|
||||
#include <pixman.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <pixman.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
||||
struct wlr_frame_callback {
|
||||
|
@ -142,4 +143,7 @@ void wlr_surface_send_enter(struct wlr_surface *surface,
|
|||
void wlr_surface_send_leave(struct wlr_surface *surface,
|
||||
struct wlr_output *output);
|
||||
|
||||
void wlr_surface_send_frame_done(struct wlr_surface *surface,
|
||||
const struct timespec *when);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
#include "rootston/desktop.h"
|
||||
#include "rootston/config.h"
|
||||
|
||||
static inline int64_t timespec_to_msec(const struct timespec *a) {
|
||||
return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate a child's position relative to a parent. The parent size is (pw, ph),
|
||||
* the child position is (*sx, *sy) and its size is (sw, sh).
|
||||
|
@ -75,12 +71,7 @@ static void render_surface(struct wlr_surface *surface,
|
|||
wlr_render_with_matrix(desktop->server->renderer, surface->texture,
|
||||
&matrix);
|
||||
|
||||
struct wlr_frame_callback *cb, *cnext;
|
||||
wl_list_for_each_safe(cb, cnext,
|
||||
&surface->current->frame_callback_list, link) {
|
||||
wl_callback_send_done(cb->resource, timespec_to_msec(when));
|
||||
wl_resource_destroy(cb->resource);
|
||||
}
|
||||
wlr_surface_send_frame_done(surface, when);
|
||||
}
|
||||
|
||||
struct wlr_subsurface *subsurface;
|
||||
|
@ -176,7 +167,6 @@ static void render_view(struct roots_view *view, struct roots_desktop *desktop,
|
|||
|
||||
static bool has_standalone_surface(struct roots_view *view) {
|
||||
if (!wl_list_empty(&view->wlr_surface->subsurface_list)) {
|
||||
wlr_log(L_DEBUG, "has subsurfaces");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ void wlr_output_make_current(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
static void output_fullscreen_surface_render(struct wlr_output *output,
|
||||
struct wlr_surface *surface) {
|
||||
struct wlr_surface *surface, const struct timespec *when) {
|
||||
int x = (output->width - surface->current->width) / 2;
|
||||
int y = (output->height - surface->current->height) / 2;
|
||||
|
||||
|
@ -268,6 +268,8 @@ static void output_fullscreen_surface_render(struct wlr_output *output,
|
|||
wlr_texture_get_matrix(surface->texture, &matrix, &output->transform_matrix,
|
||||
x, y);
|
||||
wlr_render_with_matrix(surface->renderer, surface->texture, &matrix);
|
||||
|
||||
wlr_surface_send_frame_done(surface, when);
|
||||
}
|
||||
|
||||
static void output_cursor_get_box(struct wlr_output_cursor *cursor,
|
||||
|
@ -278,7 +280,8 @@ static void output_cursor_get_box(struct wlr_output_cursor *cursor,
|
|||
box->height = cursor->height;
|
||||
}
|
||||
|
||||
static void output_cursor_render(struct wlr_output_cursor *cursor) {
|
||||
static void output_cursor_render(struct wlr_output_cursor *cursor,
|
||||
const struct timespec *when) {
|
||||
struct wlr_texture *texture = cursor->texture;
|
||||
struct wlr_renderer *renderer = cursor->renderer;
|
||||
if (cursor->surface != NULL) {
|
||||
|
@ -321,13 +324,21 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
|
|||
wlr_texture_get_matrix(texture, &matrix, &cursor->output->transform_matrix,
|
||||
x, y);
|
||||
wlr_render_with_matrix(renderer, texture, &matrix);
|
||||
|
||||
if (cursor->surface != NULL) {
|
||||
wlr_surface_send_frame_done(cursor->surface, when);
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_output_swap_buffers(struct wlr_output *output) {
|
||||
wl_signal_emit(&output->events.swap_buffers, &output);
|
||||
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
if (output->fullscreen_surface != NULL) {
|
||||
output_fullscreen_surface_render(output, output->fullscreen_surface);
|
||||
output_fullscreen_surface_render(output, output->fullscreen_surface,
|
||||
&now);
|
||||
}
|
||||
|
||||
struct wlr_output_cursor *cursor;
|
||||
|
@ -335,7 +346,7 @@ void wlr_output_swap_buffers(struct wlr_output *output) {
|
|||
if (!cursor->enabled || output->hardware_cursor == cursor) {
|
||||
continue;
|
||||
}
|
||||
output_cursor_render(cursor);
|
||||
output_cursor_render(cursor, &now);
|
||||
}
|
||||
|
||||
output->impl->swap_buffers(output);
|
||||
|
@ -472,30 +483,18 @@ static void output_cursor_commit(struct wlr_output_cursor *cursor) {
|
|||
cursor->output->needs_swap = true;
|
||||
} else {
|
||||
// TODO: upload pixels
|
||||
}
|
||||
}
|
||||
|
||||
static inline int64_t timespec_to_msec(const struct timespec *a) {
|
||||
return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
wlr_surface_send_frame_done(cursor->surface, &now);
|
||||
}
|
||||
}
|
||||
|
||||
static void output_cursor_handle_commit(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_output_cursor *cursor = wl_container_of(listener, cursor,
|
||||
surface_commit);
|
||||
struct wlr_surface *surface = data;
|
||||
|
||||
output_cursor_commit(cursor);
|
||||
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
struct wlr_frame_callback *cb, *cnext;
|
||||
wl_list_for_each_safe(cb, cnext, &surface->current->frame_callback_list,
|
||||
link) {
|
||||
wl_callback_send_done(cb->resource, timespec_to_msec(&now));
|
||||
wl_resource_destroy(cb->resource);
|
||||
}
|
||||
}
|
||||
|
||||
static void output_cursor_handle_destroy(struct wl_listener *listener,
|
||||
|
|
|
@ -929,3 +929,17 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int64_t timespec_to_msec(const struct timespec *a) {
|
||||
return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
void wlr_surface_send_frame_done(struct wlr_surface *surface,
|
||||
const struct timespec *when) {
|
||||
struct wlr_frame_callback *cb, *cnext;
|
||||
wl_list_for_each_safe(cb, cnext, &surface->current->frame_callback_list,
|
||||
link) {
|
||||
wl_callback_send_done(cb->resource, timespec_to_msec(when));
|
||||
wl_resource_destroy(cb->resource);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue