screen-share: Start screen sharing even if no pointer is found

With commit e825fe38, we no longer display the pointer if no movement is
detected, which will cause screen share to fail to start if that is the
case. There could be also legitimate cases where there's no pointer, so
let's allow screen share to function in those cases as well. Makes uses
of previous helper methods to find a proper output to share in case we
don't have an pointer.

Re-uses the shell utils functions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2021-03-08 23:48:43 +02:00
parent 3bedb70454
commit 9e20730e04
3 changed files with 13 additions and 8 deletions

View file

@ -78,6 +78,7 @@ if get_option('screenshare')
deps_screenshare = [
dep_libexec_weston,
dep_libshared,
dep_shell_utils,
dep_libweston_public,
dep_libweston_private_h, # XXX: https://gitlab.freedesktop.org/wayland/weston/issues/292
dep_wayland_client,

View file

@ -47,6 +47,7 @@
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
#include "shared/timespec-util.h"
#include "shell-utils/shell-utils.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
struct shared_output {
@ -1144,16 +1145,19 @@ share_output_binding(struct weston_keyboard *keyboard,
struct screen_share *ss = data;
pointer = weston_seat_get_pointer(keyboard->seat);
if (!pointer) {
weston_log("Cannot pick output: Seat does not have pointer\n");
return;
if (pointer) {
output = weston_output_find(pointer->seat->compositor,
wl_fixed_to_int(pointer->x),
wl_fixed_to_int(pointer->y));
} else {
output = get_focused_output(keyboard->seat->compositor);
if (!output)
output = get_default_output(keyboard->seat->compositor);
}
output = weston_output_find(pointer->seat->compositor,
wl_fixed_to_int(pointer->x),
wl_fixed_to_int(pointer->y));
if (!output) {
weston_log("Cannot pick output: Pointer not on any output\n");
weston_log("Cannot pick output: Pointer not on any output, "
"or no focused/default output found\n");
return;
}

View file

@ -170,8 +170,8 @@ subdir('shared')
subdir('libweston')
subdir('libweston-desktop')
subdir('xwayland')
subdir('compositor')
subdir('shell-utils')
subdir('compositor')
subdir('desktop-shell')
subdir('fullscreen-shell')
subdir('ivi-shell')