compositor, backend-vnc: Allow to disable output resizing
In some use cases the VNC client should not be allowed to resize the VNC output. Add a boolean option "resizeable" in the VNC [output] section to control this. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
690beab475
commit
d1df848d94
@ -3444,6 +3444,7 @@ vnc_backend_output_configure(struct weston_output *output)
|
||||
struct weston_config_section *section;
|
||||
int width;
|
||||
int height;
|
||||
bool resizeable;
|
||||
|
||||
assert(parsed_options);
|
||||
|
||||
@ -3457,10 +3458,12 @@ vnc_backend_output_configure(struct weston_output *output)
|
||||
parse_simple_mode(output, section, &width, &height, &defaults,
|
||||
compositor->parsed_options);
|
||||
|
||||
weston_config_section_get_bool(section, "resizeable", &resizeable, true);
|
||||
|
||||
weston_output_set_scale(output, 1);
|
||||
weston_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||
|
||||
if (api->output_set_size(output, width, height) < 0) {
|
||||
if (api->output_set_size(output, width, height, resizeable) < 0) {
|
||||
weston_log("Cannot configure output \"%s\" using weston_vnc_output_api.\n",
|
||||
output->name);
|
||||
return -1;
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||
#include <libweston/libweston.h>
|
||||
#include <libweston/plugin-registry.h>
|
||||
|
||||
#define WESTON_VNC_OUTPUT_API_NAME "weston_vnc_output_api_v1"
|
||||
#define WESTON_VNC_OUTPUT_API_NAME "weston_vnc_output_api_v2"
|
||||
#define VNC_DEFAULT_FREQ 60
|
||||
|
||||
struct weston_vnc_output_api {
|
||||
@ -42,7 +42,7 @@ struct weston_vnc_output_api {
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int (*output_set_size)(struct weston_output *output,
|
||||
int width, int height);
|
||||
int width, int height, bool resizeable);
|
||||
};
|
||||
|
||||
static inline const struct weston_vnc_output_api *
|
||||
|
@ -92,6 +92,8 @@ struct vnc_output {
|
||||
struct nvnc_fb_pool *fb_pool;
|
||||
|
||||
struct wl_list peers;
|
||||
|
||||
bool resizeable;
|
||||
};
|
||||
|
||||
struct vnc_peer {
|
||||
@ -400,13 +402,16 @@ vnc_handle_desktop_layout_event(struct nvnc_client *client,
|
||||
|
||||
vnc_log_desktop_layout(peer->backend, layout);
|
||||
|
||||
if (!output->resizeable)
|
||||
return false;
|
||||
|
||||
new_mode.width = width;
|
||||
new_mode.height = height;
|
||||
new_mode.refresh = peer->backend->vnc_monitor_refresh_rate;
|
||||
|
||||
weston_output_mode_set_native(&output->base, &new_mode, 1);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1140,7 +1145,8 @@ vnc_switch_mode(struct weston_output *base, struct weston_mode *target_mode)
|
||||
}
|
||||
|
||||
static int
|
||||
vnc_output_set_size(struct weston_output *base, int width, int height)
|
||||
vnc_output_set_size(struct weston_output *base, int width, int height,
|
||||
bool resizeable)
|
||||
{
|
||||
struct vnc_output *output = to_vnc_output(base);
|
||||
struct vnc_backend *backend = output->backend;
|
||||
@ -1164,6 +1170,8 @@ vnc_output_set_size(struct weston_output *base, int width, int height)
|
||||
output->base.set_dpms = NULL;
|
||||
output->base.switch_mode = vnc_switch_mode;
|
||||
|
||||
output->resizeable = resizeable;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user