mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-30 00:15:58 +01:00
Add support for fullscreen xwayland views
This commit is contained in:
parent
b04a9a248d
commit
80998cdf57
3 changed files with 26 additions and 0 deletions
|
@ -38,6 +38,7 @@ struct roots_xwayland_surface {
|
||||||
struct wl_listener request_move;
|
struct wl_listener request_move;
|
||||||
struct wl_listener request_resize;
|
struct wl_listener request_resize;
|
||||||
struct wl_listener request_maximize;
|
struct wl_listener request_maximize;
|
||||||
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener map_notify;
|
struct wl_listener map_notify;
|
||||||
struct wl_listener unmap_notify;
|
struct wl_listener unmap_notify;
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,6 +92,13 @@ static void maximize(struct roots_view *view, bool maximized) {
|
||||||
view->xwayland_surface, 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) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xwayland_surface *roots_surface =
|
struct roots_xwayland_surface *roots_surface =
|
||||||
wl_container_of(listener, roots_surface, destroy);
|
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);
|
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) {
|
static void handle_map_notify(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xwayland_surface *roots_surface =
|
struct roots_xwayland_surface *roots_surface =
|
||||||
wl_container_of(listener, roots_surface, map_notify);
|
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;
|
roots_surface->request_maximize.notify = handle_request_maximize;
|
||||||
wl_signal_add(&surface->events.request_maximize,
|
wl_signal_add(&surface->events.request_maximize,
|
||||||
&roots_surface->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));
|
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||||
if (view == NULL) {
|
if (view == NULL) {
|
||||||
|
@ -240,6 +260,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
||||||
view->move = move;
|
view->move = move;
|
||||||
view->move_resize = move_resize;
|
view->move_resize = move_resize;
|
||||||
view->maximize = maximize;
|
view->maximize = maximize;
|
||||||
|
view->set_fullscreen = set_fullscreen;
|
||||||
view->close = close;
|
view->close = close;
|
||||||
roots_surface->view = view;
|
roots_surface->view = view;
|
||||||
view_init(view, desktop);
|
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,
|
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
||||||
struct wlr_surface *surface) {
|
struct wlr_surface *surface) {
|
||||||
// TODO: hardware fullscreen
|
// TODO: hardware fullscreen
|
||||||
|
if (output->fullscreen_surface == surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
output_fullscreen_surface_reset(output);
|
output_fullscreen_surface_reset(output);
|
||||||
|
|
||||||
output->fullscreen_surface = surface;
|
output->fullscreen_surface = surface;
|
||||||
|
|
Loading…
Reference in a new issue