Add support for fullscreen xwayland views

master
emersion 7 years ago
parent b04a9a248d
commit 80998cdf57
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -38,6 +38,7 @@ struct roots_xwayland_surface {
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
struct wl_listener map_notify;
struct wl_listener unmap_notify;
};

@ -92,6 +92,13 @@ static void maximize(struct roots_view *view, bool maximized) {
view->xwayland_surface, maximized);
}
static void set_fullscreen(struct roots_view *view, bool fullscreen) {
assert(view->type == ROOTS_XWAYLAND_VIEW);
wlr_xwayland_surface_set_fullscreen(view->desktop->xwayland,
view->xwayland_surface, fullscreen);
}
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
@ -170,6 +177,16 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
view_maximize(view, maximized);
}
static void handle_request_fullscreen(struct wl_listener *listener,
void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, request_fullscreen);
struct roots_view *view = roots_surface->view;
struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;
view_set_fullscreen(view, xwayland_surface->fullscreen, NULL);
}
static void handle_map_notify(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, map_notify);
@ -223,6 +240,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
roots_surface->request_maximize.notify = handle_request_maximize;
wl_signal_add(&surface->events.request_maximize,
&roots_surface->request_maximize);
roots_surface->request_fullscreen.notify = handle_request_fullscreen;
wl_signal_add(&surface->events.request_fullscreen,
&roots_surface->request_fullscreen);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (view == NULL) {
@ -240,6 +260,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->move = move;
view->move_resize = move_resize;
view->maximize = maximize;
view->set_fullscreen = set_fullscreen;
view->close = close;
roots_surface->view = view;
view_init(view, desktop);

@ -382,6 +382,10 @@ static void output_fullscreen_surface_handle_destroy(
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;

Loading…
Cancel
Save