xwayland: Allow shells to make xwayland surfaces fullscreen
The fullscreen state for xwayland surfaces can currently only be effectively set from the client side. This commit enables libweston-desktop based shells to properly set the fullscreen state for xwayland surfaces. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
This commit is contained in:
parent
eefd8ae2e0
commit
ca7b631310
|
@ -65,6 +65,7 @@ struct weston_desktop_xwayland_surface {
|
||||||
bool added;
|
bool added;
|
||||||
enum weston_desktop_xwayland_surface_state state;
|
enum weston_desktop_xwayland_surface_state state;
|
||||||
enum weston_desktop_xwayland_surface_state prev_state;
|
enum weston_desktop_xwayland_surface_state prev_state;
|
||||||
|
bool state_updated;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -85,6 +86,10 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
|
||||||
}
|
}
|
||||||
|
|
||||||
wsurface = weston_desktop_surface_get_surface(surface->surface);
|
wsurface = weston_desktop_surface_get_surface(surface->surface);
|
||||||
|
/* In some cases when adding a surface, the state may be updated by the
|
||||||
|
* shell (e.g., to fullscreen). Track if this has happened and respect
|
||||||
|
* the updated value. */
|
||||||
|
surface->state_updated = false;
|
||||||
|
|
||||||
if (surface->state != state) {
|
if (surface->state != state) {
|
||||||
if (surface->state == XWAYLAND) {
|
if (surface->state == XWAYLAND) {
|
||||||
|
@ -126,7 +131,13 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
|
||||||
weston_surface_map(wsurface);
|
weston_surface_map(wsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the surface state was updated by the shell during this
|
||||||
|
* call, respect the updated value, otherwise assign the new
|
||||||
|
* value. */
|
||||||
|
if (!surface->state_updated) {
|
||||||
surface->state = state;
|
surface->state = state;
|
||||||
|
surface->state_updated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
|
@ -194,6 +205,19 @@ weston_desktop_xwayland_surface_set_size(struct weston_desktop_surface *dsurface
|
||||||
surface->client_interface->send_configure(wsurface, width, height);
|
surface->client_interface->send_configure(wsurface, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
weston_desktop_xwayland_surface_set_fullscreen(struct weston_desktop_surface *dsurface,
|
||||||
|
void *user_data, bool fullscreen)
|
||||||
|
{
|
||||||
|
struct weston_desktop_xwayland_surface *surface = user_data;
|
||||||
|
struct weston_surface *wsurface =
|
||||||
|
weston_desktop_surface_get_surface(surface->surface);
|
||||||
|
|
||||||
|
surface->state = fullscreen ? FULLSCREEN : TOPLEVEL;
|
||||||
|
surface->state_updated = true;
|
||||||
|
surface->client_interface->send_fullscreen(wsurface, fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
weston_desktop_xwayland_surface_destroy(struct weston_desktop_surface *dsurface,
|
weston_desktop_xwayland_surface_destroy(struct weston_desktop_surface *dsurface,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
|
@ -244,6 +268,7 @@ weston_desktop_xwayland_surface_get_fullscreen(struct weston_desktop_surface *ds
|
||||||
static const struct weston_desktop_surface_implementation weston_desktop_xwayland_surface_internal_implementation = {
|
static const struct weston_desktop_surface_implementation weston_desktop_xwayland_surface_internal_implementation = {
|
||||||
.committed = weston_desktop_xwayland_surface_committed,
|
.committed = weston_desktop_xwayland_surface_committed,
|
||||||
.set_size = weston_desktop_xwayland_surface_set_size,
|
.set_size = weston_desktop_xwayland_surface_set_size,
|
||||||
|
.set_fullscreen = weston_desktop_xwayland_surface_set_fullscreen,
|
||||||
|
|
||||||
.get_maximized = weston_desktop_xwayland_surface_get_maximized,
|
.get_maximized = weston_desktop_xwayland_surface_get_maximized,
|
||||||
.get_fullscreen = weston_desktop_xwayland_surface_get_fullscreen,
|
.get_fullscreen = weston_desktop_xwayland_surface_get_fullscreen,
|
||||||
|
|
|
@ -3130,9 +3130,30 @@ send_position(struct weston_surface *surface, int32_t x, int32_t y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_fullscreen(struct weston_surface *surface, bool fullscreen)
|
||||||
|
{
|
||||||
|
struct weston_wm_window *window = get_wm_window(surface);
|
||||||
|
|
||||||
|
if (!window || !window->wm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (window->fullscreen == fullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
window->fullscreen = fullscreen;
|
||||||
|
weston_wm_window_set_net_wm_state(window);
|
||||||
|
|
||||||
|
if (window->fullscreen) {
|
||||||
|
window->saved_width = window->width;
|
||||||
|
window->saved_height = window->height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const struct weston_xwayland_client_interface shell_client = {
|
static const struct weston_xwayland_client_interface shell_client = {
|
||||||
send_configure,
|
send_configure,
|
||||||
send_close,
|
send_close,
|
||||||
|
send_fullscreen,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct weston_desktop_xwayland_surface;
|
||||||
struct weston_xwayland_client_interface {
|
struct weston_xwayland_client_interface {
|
||||||
void (*send_configure)(struct weston_surface *surface, int32_t width, int32_t height);
|
void (*send_configure)(struct weston_surface *surface, int32_t width, int32_t height);
|
||||||
void (*send_close)(struct weston_surface *surface);
|
void (*send_close)(struct weston_surface *surface);
|
||||||
|
void (*send_fullscreen)(struct weston_surface *surface, bool fullscreen);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct weston_desktop_xwayland_interface {
|
struct weston_desktop_xwayland_interface {
|
||||||
|
|
Loading…
Reference in New Issue