|
|
|
@ -137,28 +137,6 @@ static const struct mp_keymap keymap[] = {
|
|
|
|
|
{0, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define OPT_BASE_STRUCT struct wayland_opts
|
|
|
|
|
const struct m_sub_options wayland_conf = {
|
|
|
|
|
.opts = (const struct m_option[]) {
|
|
|
|
|
{"wayland-configure-bounds", OPT_CHOICE(configure_bounds,
|
|
|
|
|
{"auto", -1}, {"no", 0}, {"yes", 1})},
|
|
|
|
|
{"wayland-disable-vsync", OPT_BOOL(disable_vsync)},
|
|
|
|
|
{"wayland-edge-pixels-pointer", OPT_INT(edge_pixels_pointer),
|
|
|
|
|
M_RANGE(0, INT_MAX)},
|
|
|
|
|
{"wayland-edge-pixels-touch", OPT_INT(edge_pixels_touch),
|
|
|
|
|
M_RANGE(0, INT_MAX)},
|
|
|
|
|
{"wayland-present", OPT_BOOL(present)},
|
|
|
|
|
{0},
|
|
|
|
|
},
|
|
|
|
|
.size = sizeof(struct wayland_opts),
|
|
|
|
|
.defaults = &(struct wayland_opts) {
|
|
|
|
|
.configure_bounds = -1,
|
|
|
|
|
.edge_pixels_pointer = 16,
|
|
|
|
|
.edge_pixels_touch = 32,
|
|
|
|
|
.present = true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct vo_wayland_feedback_pool {
|
|
|
|
|
struct wp_presentation_feedback **fback;
|
|
|
|
|
struct vo_wayland_state *wl;
|
|
|
|
@ -322,7 +300,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
|
|
|
|
|
enum xdg_toplevel_resize_edge edges;
|
|
|
|
|
if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y) &&
|
|
|
|
|
!wl->locked_size && (button == MP_MBTN_LEFT) && (state == MP_KEY_STATE_DOWN) &&
|
|
|
|
|
!wl->vo_opts->border && check_for_resize(wl, wl->opts->edge_pixels_pointer, &edges))
|
|
|
|
|
!wl->opts->border && check_for_resize(wl, wl->opts->wl_edge_pixels_pointer, &edges))
|
|
|
|
|
{
|
|
|
|
|
// Implement an edge resize zone if there are no decorations
|
|
|
|
|
xdg_toplevel_resize(wl->xdg_toplevel, s->seat, serial, edges);
|
|
|
|
@ -443,7 +421,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
|
|
|
|
|
|
|
|
|
|
enum xdg_toplevel_resize_edge edge;
|
|
|
|
|
if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y) &&
|
|
|
|
|
!wl->locked_size && check_for_resize(wl, wl->opts->edge_pixels_touch, &edge))
|
|
|
|
|
!wl->locked_size && check_for_resize(wl, wl->opts->wl_edge_pixels_touch, &edge))
|
|
|
|
|
{
|
|
|
|
|
xdg_toplevel_resize(wl->xdg_toplevel, s->seat, serial, edge);
|
|
|
|
|
} else {
|
|
|
|
@ -611,7 +589,7 @@ static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *wl_keybo
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_seat *s = data;
|
|
|
|
|
struct vo_wayland_state *wl = s->wl;
|
|
|
|
|
if (wl->vo_opts->native_keyrepeat)
|
|
|
|
|
if (wl->opts->native_keyrepeat)
|
|
|
|
|
mp_input_set_repeat_info(wl->vo->input_ctx, rate, delay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -672,7 +650,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
|
|
|
|
|
struct vo_wayland_seat *s = data;
|
|
|
|
|
struct vo_wayland_state *wl = s->wl;
|
|
|
|
|
int score = mp_event_get_mime_type_score(wl->vo->input_ctx, mime_type);
|
|
|
|
|
if (score > wl->dnd_mime_score && wl->vo_opts->drag_and_drop != -2) {
|
|
|
|
|
if (score > wl->dnd_mime_score && wl->opts->drag_and_drop != -2) {
|
|
|
|
|
wl->dnd_mime_score = score;
|
|
|
|
|
if (wl->dnd_mime_type)
|
|
|
|
|
talloc_free(wl->dnd_mime_type);
|
|
|
|
@ -689,9 +667,9 @@ static void data_offer_action(void *data, struct wl_data_offer *wl_data_offer, u
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_seat *s = data;
|
|
|
|
|
struct vo_wayland_state *wl = s->wl;
|
|
|
|
|
if (dnd_action && wl->vo_opts->drag_and_drop != -2) {
|
|
|
|
|
if (wl->vo_opts->drag_and_drop >= 0) {
|
|
|
|
|
wl->dnd_action = wl->vo_opts->drag_and_drop;
|
|
|
|
|
if (dnd_action && wl->opts->drag_and_drop != -2) {
|
|
|
|
|
if (wl->opts->drag_and_drop >= 0) {
|
|
|
|
|
wl->dnd_action = wl->opts->drag_and_drop;
|
|
|
|
|
} else {
|
|
|
|
|
wl->dnd_action = dnd_action & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY ?
|
|
|
|
|
DND_REPLACE : DND_APPEND;
|
|
|
|
@ -737,7 +715,7 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_ddev,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->drag_and_drop != -2) {
|
|
|
|
|
if (wl->opts->drag_and_drop != -2) {
|
|
|
|
|
wl_data_offer_set_actions(id, WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
|
|
|
|
|
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE,
|
|
|
|
|
WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
|
|
|
|
@ -759,7 +737,7 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_ddev)
|
|
|
|
|
wl->dnd_offer = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->drag_and_drop != -2) {
|
|
|
|
|
if (wl->opts->drag_and_drop != -2) {
|
|
|
|
|
MP_VERBOSE(wl, "Releasing DND offer with mime type %s\n", wl->dnd_mime_type);
|
|
|
|
|
if (wl->dnd_mime_type)
|
|
|
|
|
TA_FREEP(&wl->dnd_mime_type);
|
|
|
|
@ -787,7 +765,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_ddev)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->drag_and_drop != -2) {
|
|
|
|
|
if (wl->opts->drag_and_drop != -2) {
|
|
|
|
|
MP_VERBOSE(wl, "Receiving DND offer with mime %s\n", wl->dnd_mime_type);
|
|
|
|
|
wl_data_offer_receive(wl->dnd_offer, wl->dnd_mime_type, pipefd[1]);
|
|
|
|
|
}
|
|
|
|
@ -1036,7 +1014,7 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
|
|
|
|
|
int32_t width, int32_t height, struct wl_array *states)
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_state *wl = data;
|
|
|
|
|
struct mp_vo_opts *vo_opts = wl->vo_opts;
|
|
|
|
|
struct mp_vo_opts *opts = wl->opts;
|
|
|
|
|
struct mp_rect old_geometry = wl->geometry;
|
|
|
|
|
|
|
|
|
|
if (width < 0 || height < 0) {
|
|
|
|
@ -1046,8 +1024,8 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
|
|
|
|
|
|
|
|
|
|
if (!wl->geometry_configured) {
|
|
|
|
|
/* Save initial window size if the compositor gives us a hint here. */
|
|
|
|
|
bool autofit_or_geometry = vo_opts->geometry.wh_valid || vo_opts->autofit.wh_valid ||
|
|
|
|
|
vo_opts->autofit_larger.wh_valid || vo_opts->autofit_smaller.wh_valid;
|
|
|
|
|
bool autofit_or_geometry = opts->geometry.wh_valid || opts->autofit.wh_valid ||
|
|
|
|
|
opts->autofit_larger.wh_valid || opts->autofit_smaller.wh_valid;
|
|
|
|
|
if (width && height && !autofit_or_geometry) {
|
|
|
|
|
wl->initial_size_hint = true;
|
|
|
|
|
wl->window_size = (struct mp_rect){0, 0, width, height};
|
|
|
|
@ -1076,9 +1054,9 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
|
|
|
|
|
* minimized, but it may not have been minimized
|
|
|
|
|
* previously, so we can't detect the exact state.
|
|
|
|
|
*/
|
|
|
|
|
vo_opts->window_minimized = false;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache,
|
|
|
|
|
&vo_opts->window_minimized);
|
|
|
|
|
opts->window_minimized = false;
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache,
|
|
|
|
|
&opts->window_minimized);
|
|
|
|
|
break;
|
|
|
|
|
case XDG_TOPLEVEL_STATE_TILED_TOP:
|
|
|
|
|
case XDG_TOPLEVEL_STATE_TILED_LEFT:
|
|
|
|
@ -1098,16 +1076,16 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
|
|
|
|
|
if (wl->hidden != is_suspended)
|
|
|
|
|
wl->hidden = is_suspended;
|
|
|
|
|
|
|
|
|
|
if (vo_opts->fullscreen != is_fullscreen) {
|
|
|
|
|
if (opts->fullscreen != is_fullscreen) {
|
|
|
|
|
wl->state_change = wl->reconfigured;
|
|
|
|
|
vo_opts->fullscreen = is_fullscreen;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->fullscreen);
|
|
|
|
|
opts->fullscreen = is_fullscreen;
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache, &opts->fullscreen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vo_opts->window_maximized != is_maximized) {
|
|
|
|
|
if (opts->window_maximized != is_maximized) {
|
|
|
|
|
wl->state_change = wl->reconfigured;
|
|
|
|
|
vo_opts->window_maximized = is_maximized;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->window_maximized);
|
|
|
|
|
opts->window_maximized = is_maximized;
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache, &opts->window_maximized);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_tiled && wl->tiled)
|
|
|
|
@ -1242,7 +1220,7 @@ static void configure_decorations(void *data,
|
|
|
|
|
uint32_t mode)
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_state *wl = data;
|
|
|
|
|
struct mp_vo_opts *opts = wl->vo_opts;
|
|
|
|
|
struct mp_vo_opts *opts = wl->opts;
|
|
|
|
|
|
|
|
|
|
if (wl->requested_decoration && mode != wl->requested_decoration) {
|
|
|
|
|
MP_DBG(wl,
|
|
|
|
@ -1260,7 +1238,7 @@ static void configure_decorations(void *data,
|
|
|
|
|
MP_VERBOSE(wl, "Disabling server decorations\n");
|
|
|
|
|
}
|
|
|
|
|
opts->border = mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache, &opts->border);
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache, &opts->border);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = {
|
|
|
|
@ -1339,7 +1317,7 @@ static void frame_callback(void *data, struct wl_callback *callback, uint32_t ti
|
|
|
|
|
wl->frame_callback = wl_surface_frame(wl->callback_surface);
|
|
|
|
|
wl_callback_add_listener(wl->frame_callback, &frame_listener, wl);
|
|
|
|
|
|
|
|
|
|
wl->use_present = wl->present_clock && wl->opts->present;
|
|
|
|
|
wl->use_present = wl->present_clock && wl->opts->wl_present;
|
|
|
|
|
if (wl->use_present) {
|
|
|
|
|
struct wp_presentation_feedback *fback = wp_presentation_feedback(wl->presentation, wl->callback_surface);
|
|
|
|
|
add_feedback(wl->fback_pool, fback);
|
|
|
|
@ -1571,12 +1549,12 @@ static const struct wl_registry_listener registry_listener = {
|
|
|
|
|
/* Static functions */
|
|
|
|
|
static void apply_keepaspect(struct vo_wayland_state *wl, int *width, int *height)
|
|
|
|
|
{
|
|
|
|
|
if (!wl->vo_opts->keepaspect)
|
|
|
|
|
if (!wl->opts->keepaspect)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
double scale_factor = (double)*width / wl->reduced_width;
|
|
|
|
|
*width = ceil(wl->reduced_width * scale_factor);
|
|
|
|
|
if (wl->vo_opts->keepaspect_window)
|
|
|
|
|
if (wl->opts->keepaspect_window)
|
|
|
|
|
*height = ceil(wl->reduced_height * scale_factor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1645,7 +1623,7 @@ static void check_dnd_fd(struct vo_wayland_state *wl)
|
|
|
|
|
static int check_for_resize(struct vo_wayland_state *wl, int edge_pixels,
|
|
|
|
|
enum xdg_toplevel_resize_edge *edge)
|
|
|
|
|
{
|
|
|
|
|
if (wl->vo_opts->fullscreen || wl->vo_opts->window_maximized)
|
|
|
|
|
if (wl->opts->fullscreen || wl->opts->window_maximized)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
int pos[2] = { wl->mouse_x, wl->mouse_y };
|
|
|
|
@ -1736,7 +1714,7 @@ static void add_feedback(struct vo_wayland_feedback_pool *fback_pool,
|
|
|
|
|
|
|
|
|
|
static void do_minimize(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
if (wl->vo_opts->window_minimized)
|
|
|
|
|
if (wl->opts->window_minimized)
|
|
|
|
|
xdg_toplevel_set_minimized(wl->xdg_toplevel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1827,7 +1805,7 @@ static void guess_focus(struct vo_wayland_state *wl)
|
|
|
|
|
static struct vo_wayland_output *find_output(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
int index = 0;
|
|
|
|
|
struct mp_vo_opts *opts = wl->vo_opts;
|
|
|
|
|
struct mp_vo_opts *opts = wl->opts;
|
|
|
|
|
int screen_id = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
|
|
|
|
|
char *screen_name = opts->fullscreen ? opts->fsscreen_name : opts->screen_name;
|
|
|
|
|
struct vo_wayland_output *output = NULL;
|
|
|
|
@ -1936,7 +1914,7 @@ static void request_decoration_mode(struct vo_wayland_state *wl, uint32_t mode)
|
|
|
|
|
|
|
|
|
|
static void rescale_geometry(struct vo_wayland_state *wl, double old_scale)
|
|
|
|
|
{
|
|
|
|
|
if (!wl->vo_opts->hidpi_window_scale && !wl->locked_size)
|
|
|
|
|
if (!wl->opts->hidpi_window_scale && !wl->locked_size)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
double factor = old_scale / wl->scaling;
|
|
|
|
@ -2019,10 +1997,10 @@ static void set_content_type(struct vo_wayland_state *wl)
|
|
|
|
|
if (!wl->content_type_manager)
|
|
|
|
|
return;
|
|
|
|
|
// handle auto;
|
|
|
|
|
if (wl->vo_opts->content_type == -1) {
|
|
|
|
|
if (wl->opts->wl_content_type == -1) {
|
|
|
|
|
wp_content_type_v1_set_content_type(wl->content_type, wl->current_content_type);
|
|
|
|
|
} else {
|
|
|
|
|
wp_content_type_v1_set_content_type(wl->content_type, wl->vo_opts->content_type);
|
|
|
|
|
wp_content_type_v1_set_content_type(wl->content_type, wl->opts->wl_content_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2160,9 +2138,9 @@ static void set_window_bounds(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
// If the user has set geometry/autofit and the option is auto,
|
|
|
|
|
// don't use these.
|
|
|
|
|
if (wl->opts->configure_bounds == -1 && (wl->vo_opts->geometry.wh_valid ||
|
|
|
|
|
wl->vo_opts->autofit.wh_valid || wl->vo_opts->autofit_larger.wh_valid ||
|
|
|
|
|
wl->vo_opts->autofit_smaller.wh_valid))
|
|
|
|
|
if (wl->opts->wl_configure_bounds == -1 && (wl->opts->geometry.wh_valid ||
|
|
|
|
|
wl->opts->autofit.wh_valid || wl->opts->autofit_larger.wh_valid ||
|
|
|
|
|
wl->opts->autofit_smaller.wh_valid))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -2230,10 +2208,10 @@ static int spawn_cursor(struct vo_wayland_state *wl)
|
|
|
|
|
|
|
|
|
|
static void toggle_fullscreen(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
bool specific_screen = wl->vo_opts->fsscreen_id >= 0 || wl->vo_opts->fsscreen_name;
|
|
|
|
|
if (wl->vo_opts->fullscreen && !specific_screen) {
|
|
|
|
|
bool specific_screen = wl->opts->fsscreen_id >= 0 || wl->opts->fsscreen_name;
|
|
|
|
|
if (wl->opts->fullscreen && !specific_screen) {
|
|
|
|
|
xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL);
|
|
|
|
|
} else if (wl->vo_opts->fullscreen && specific_screen) {
|
|
|
|
|
} else if (wl->opts->fullscreen && specific_screen) {
|
|
|
|
|
struct vo_wayland_output *output = find_output(wl);
|
|
|
|
|
xdg_toplevel_set_fullscreen(wl->xdg_toplevel, output->output);
|
|
|
|
|
} else {
|
|
|
|
@ -2244,7 +2222,7 @@ static void toggle_fullscreen(struct vo_wayland_state *wl)
|
|
|
|
|
|
|
|
|
|
static void toggle_maximized(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
if (wl->vo_opts->window_maximized) {
|
|
|
|
|
if (wl->opts->window_maximized) {
|
|
|
|
|
xdg_toplevel_set_maximized(wl->xdg_toplevel);
|
|
|
|
|
} else {
|
|
|
|
|
wl->state_change = wl->reconfigured;
|
|
|
|
@ -2254,7 +2232,7 @@ static void toggle_maximized(struct vo_wayland_state *wl)
|
|
|
|
|
|
|
|
|
|
static void update_app_id(struct vo_wayland_state *wl)
|
|
|
|
|
{
|
|
|
|
|
xdg_toplevel_set_app_id(wl->xdg_toplevel, wl->vo_opts->appid);
|
|
|
|
|
xdg_toplevel_set_app_id(wl->xdg_toplevel, wl->opts->appid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void update_output_scaling(struct vo_wayland_state *wl)
|
|
|
|
@ -2379,7 +2357,7 @@ int vo_wayland_allocate_memfd(struct vo *vo, size_t size)
|
|
|
|
|
bool vo_wayland_check_visible(struct vo *vo)
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_state *wl = vo->wl;
|
|
|
|
|
bool render = !wl->hidden || wl->vo_opts->force_render;
|
|
|
|
|
bool render = !wl->hidden || wl->opts->force_render;
|
|
|
|
|
wl->frame_wait = true;
|
|
|
|
|
return render;
|
|
|
|
|
}
|
|
|
|
@ -2387,7 +2365,7 @@ bool vo_wayland_check_visible(struct vo *vo)
|
|
|
|
|
int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
{
|
|
|
|
|
struct vo_wayland_state *wl = vo->wl;
|
|
|
|
|
struct mp_vo_opts *opts = wl->vo_opts;
|
|
|
|
|
struct mp_vo_opts *opts = wl->opts;
|
|
|
|
|
wl_display_dispatch_pending(wl->display);
|
|
|
|
|
|
|
|
|
|
switch (request) {
|
|
|
|
@ -2405,7 +2383,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
}
|
|
|
|
|
case VOCTRL_VO_OPTS_CHANGED: {
|
|
|
|
|
void *opt;
|
|
|
|
|
while (m_config_cache_get_next_changed(wl->vo_opts_cache, &opt)) {
|
|
|
|
|
while (m_config_cache_get_next_changed(wl->opts_cache, &opt)) {
|
|
|
|
|
if (opt == &opts->appid)
|
|
|
|
|
update_app_id(wl);
|
|
|
|
|
if (opt == &opts->border)
|
|
|
|
@ -2416,7 +2394,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
if (wl->xdg_toplevel_decoration) {
|
|
|
|
|
int requested_border_mode = opts->border;
|
|
|
|
|
opts->border = !opts->border;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache,
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache,
|
|
|
|
|
&opts->border);
|
|
|
|
|
request_decoration_mode(
|
|
|
|
|
wl, requested_border_mode ?
|
|
|
|
@ -2424,11 +2402,11 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
|
|
|
|
|
} else {
|
|
|
|
|
opts->border = false;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache,
|
|
|
|
|
&wl->vo_opts->border);
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache,
|
|
|
|
|
&wl->opts->border);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (opt == &opts->content_type)
|
|
|
|
|
if (opt == &opts->wl_content_type)
|
|
|
|
|
set_content_type(wl);
|
|
|
|
|
if (opt == &opts->cursor_passthrough)
|
|
|
|
|
set_input_region(wl, opts->cursor_passthrough);
|
|
|
|
@ -2462,7 +2440,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
}
|
|
|
|
|
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
|
|
|
|
int *s = arg;
|
|
|
|
|
if (wl->vo_opts->window_maximized || wl->tiled) {
|
|
|
|
|
if (wl->opts->window_maximized || wl->tiled) {
|
|
|
|
|
s[0] = mp_rect_w(wl->geometry);
|
|
|
|
|
s[1] = mp_rect_h(wl->geometry);
|
|
|
|
|
} else {
|
|
|
|
@ -2477,13 +2455,13 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|
|
|
|
wl->window_size.y0 = 0;
|
|
|
|
|
wl->window_size.x1 = s[0];
|
|
|
|
|
wl->window_size.y1 = s[1];
|
|
|
|
|
if (!wl->vo_opts->fullscreen && !wl->tiled) {
|
|
|
|
|
if (!wl->opts->fullscreen && !wl->tiled) {
|
|
|
|
|
wl->state_change = true;
|
|
|
|
|
if (wl->vo_opts->window_maximized) {
|
|
|
|
|
if (wl->opts->window_maximized) {
|
|
|
|
|
xdg_toplevel_unset_maximized(wl->xdg_toplevel);
|
|
|
|
|
wl_display_dispatch_pending(wl->display);
|
|
|
|
|
/* Make sure the compositor let us unmaximize */
|
|
|
|
|
if (wl->vo_opts->window_maximized)
|
|
|
|
|
if (wl->opts->window_maximized)
|
|
|
|
|
return VO_TRUE;
|
|
|
|
|
}
|
|
|
|
|
wl->geometry = wl->window_size;
|
|
|
|
@ -2564,9 +2542,9 @@ bool vo_wayland_init(struct vo *vo)
|
|
|
|
|
.display_fd = -1,
|
|
|
|
|
.dnd_fd = -1,
|
|
|
|
|
.cursor_visible = true,
|
|
|
|
|
.vo_opts_cache = m_config_cache_alloc(wl, vo->global, &vo_sub_opts),
|
|
|
|
|
.opts_cache = m_config_cache_alloc(wl, vo->global, &vo_sub_opts),
|
|
|
|
|
};
|
|
|
|
|
wl->vo_opts = wl->vo_opts_cache->opts;
|
|
|
|
|
wl->opts = wl->opts_cache->opts;
|
|
|
|
|
bool using_dmabuf_wayland = !strcmp(wl->vo->driver->name, "dmabuf-wayland");
|
|
|
|
|
|
|
|
|
|
wl_list_init(&wl->output_list);
|
|
|
|
@ -2664,7 +2642,7 @@ bool vo_wayland_init(struct vo *vo)
|
|
|
|
|
wl->fback_pool->len = VO_MAX_SWAPCHAIN_DEPTH;
|
|
|
|
|
wl->fback_pool->fback = talloc_zero_array(wl->fback_pool, struct wp_presentation_feedback *,
|
|
|
|
|
wl->fback_pool->len);
|
|
|
|
|
wl->present = mp_present_initialize(wl, wl->vo_opts, VO_MAX_SWAPCHAIN_DEPTH);
|
|
|
|
|
wl->present = mp_present_initialize(wl, wl->opts, VO_MAX_SWAPCHAIN_DEPTH);
|
|
|
|
|
} else {
|
|
|
|
|
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
|
|
|
|
|
wp_presentation_interface.name);
|
|
|
|
@ -2674,13 +2652,13 @@ bool vo_wayland_init(struct vo *vo)
|
|
|
|
|
wl->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(wl->xdg_decoration_manager, wl->xdg_toplevel);
|
|
|
|
|
zxdg_toplevel_decoration_v1_add_listener(wl->xdg_toplevel_decoration, &decoration_listener, wl);
|
|
|
|
|
request_decoration_mode(
|
|
|
|
|
wl, wl->vo_opts->border ?
|
|
|
|
|
wl, wl->opts->border ?
|
|
|
|
|
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE :
|
|
|
|
|
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
|
|
|
|
|
} else {
|
|
|
|
|
wl->vo_opts->border = false;
|
|
|
|
|
m_config_cache_write_opt(wl->vo_opts_cache,
|
|
|
|
|
&wl->vo_opts->border);
|
|
|
|
|
wl->opts->border = false;
|
|
|
|
|
m_config_cache_write_opt(wl->opts_cache,
|
|
|
|
|
&wl->opts->border);
|
|
|
|
|
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
|
|
|
|
|
zxdg_decoration_manager_v1_interface.name);
|
|
|
|
|
}
|
|
|
|
@ -2690,7 +2668,6 @@ bool vo_wayland_init(struct vo *vo)
|
|
|
|
|
zwp_idle_inhibit_manager_v1_interface.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl->opts = mp_get_config_group(wl, wl->vo->global, &wayland_conf);
|
|
|
|
|
wl->display_fd = wl_display_get_fd(wl->display);
|
|
|
|
|
|
|
|
|
|
update_app_id(wl);
|
|
|
|
@ -2727,29 +2704,29 @@ bool vo_wayland_reconfig(struct vo *vo)
|
|
|
|
|
wl->pending_vo_events |= VO_EVENT_DPI;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->auto_window_resize || !wl->geometry_configured)
|
|
|
|
|
if (wl->opts->auto_window_resize || !wl->geometry_configured)
|
|
|
|
|
set_geometry(wl, false);
|
|
|
|
|
|
|
|
|
|
if (wl->geometry_configured && wl->vo_opts->auto_window_resize)
|
|
|
|
|
if (wl->geometry_configured && wl->opts->auto_window_resize)
|
|
|
|
|
wl->reconfigured = true;
|
|
|
|
|
|
|
|
|
|
if (wl->opts->configure_bounds)
|
|
|
|
|
if (wl->opts->wl_configure_bounds)
|
|
|
|
|
set_window_bounds(wl);
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->cursor_passthrough)
|
|
|
|
|
if (wl->opts->cursor_passthrough)
|
|
|
|
|
set_input_region(wl, true);
|
|
|
|
|
|
|
|
|
|
if (!wl->geometry_configured || !wl->locked_size)
|
|
|
|
|
wl->geometry = wl->window_size;
|
|
|
|
|
|
|
|
|
|
if (!wl->geometry_configured) {
|
|
|
|
|
if (wl->vo_opts->fullscreen)
|
|
|
|
|
if (wl->opts->fullscreen)
|
|
|
|
|
toggle_fullscreen(wl);
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->window_maximized)
|
|
|
|
|
if (wl->opts->window_maximized)
|
|
|
|
|
toggle_maximized(wl);
|
|
|
|
|
|
|
|
|
|
if (wl->vo_opts->window_minimized)
|
|
|
|
|
if (wl->opts->window_minimized)
|
|
|
|
|
do_minimize(wl);
|
|
|
|
|
wl->geometry_configured = true;
|
|
|
|
|
}
|
|
|
|
|