[PATCH weston v3 5/8] fullscreen-shell: Support tracking active surfaces
Pekka Paalanen
ppaalanen at gmail.com
Thu May 26 15:01:52 UTC 2016
On Thu, 7 Apr 2016 16:44:20 -0700
Bryce Harrington <bryce at osg.samsung.com> wrote:
> Surface activity is determined by what surface is being displayed
> fullscreen. Only a single surface can be active in the shell.
Hi,
only a single surface can be active? But there is a surface for every
output.
Shouldn't every visible surface be active in this case, as the shell
protocol enforces a single visible surface per output policy?
> Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> ---
> fullscreen-shell/fullscreen-shell.c | 27 ++++++++++++++++++++++++++-
> 1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
> index e1f8a63..8b1930f 100644
> --- a/fullscreen-shell/fullscreen-shell.c
> +++ b/fullscreen-shell/fullscreen-shell.c
> @@ -46,6 +46,7 @@ struct fullscreen_shell {
> struct wl_listener output_created_listener;
>
> struct wl_listener seat_created_listener;
> + struct weston_surface *active_surface;
> };
>
> struct fs_output {
> @@ -84,14 +85,23 @@ struct pointer_focus_listener {
> };
>
> static void
> -pointer_focus_changed(struct wl_listener *listener, void *data)
> +pointer_focus_changed(struct wl_listener *l, void *data)
> {
> struct weston_pointer *pointer = data;
> + struct weston_surface *old_surface;
> + struct pointer_focus_listener *listener;
> +
> + listener = container_of(l, struct pointer_focus_listener,
> + seat_destroyed);
>
> if (pointer->focus && pointer->focus->surface->resource) {
> + old_surface = listener->shell->active_surface;
> + if (old_surface != NULL)
> + weston_surface_deactivate(old_surface);
> weston_surface_assign_keyboard(pointer->focus->surface, pointer->seat);
> if (pointer->focus->surface != NULL)
> weston_surface_activate(pointer->focus->surface);
> + listener->shell->active_surface = pointer->focus->surface;
So the active surface is the one with the pointer focus?
What happens when you have multiple weston_seats each with a pointer?
> }
> }
>
> @@ -101,6 +111,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
> struct weston_seat *seat = data;
> struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
> struct weston_pointer *pointer = weston_seat_get_pointer(seat);
> + struct weston_surface *old_surface;
> struct pointer_focus_listener *listener;
> struct fs_output *fsout;
>
> @@ -119,11 +130,15 @@ seat_caps_changed(struct wl_listener *l, void *data)
> }
>
> if (keyboard && keyboard->focus != NULL) {
> + old_surface = listener->shell->active_surface;
> wl_list_for_each(fsout, &listener->shell->output_list, link) {
> if (fsout->surface) {
> + if (old_surface != NULL)
> + weston_surface_deactivate(old_surface);
> weston_surface_assign_keyboard(fsout->surface, seat);
> if (fsout->surface != NULL)
> weston_surface_activate(fsout->surface);
> + listener->shell->active_surface = fsout->surface;
> return;
Seat cap change taken into account, I wouldn't probably have thought of
that. Very good.
> }
> }
> @@ -676,6 +691,7 @@ fullscreen_shell_present_surface(struct wl_client *client,
> wl_resource_get_user_data(resource);
> struct weston_output *output;
> struct weston_surface *surface;
> + struct weston_surface *old_surface;
> struct weston_seat *seat;
> struct fs_output *fsout;
>
> @@ -709,9 +725,13 @@ fullscreen_shell_present_surface(struct wl_client *client,
> weston_seat_get_keyboard(seat);
>
> if (keyboard && !keyboard->focus) {
> + old_surface = shell->active_surface;
> + if (old_surface != NULL)
> + weston_surface_deactivate(old_surface);
> weston_surface_assign_keyboard(surface, seat);
> if (surface != NULL)
> weston_surface_activate(surface);
> + shell->active_surface = surface;
And surface going off is also deactivated, good.
> }
> }
> }
> @@ -737,6 +757,7 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
> wl_resource_get_user_data(resource);
> struct weston_output *output;
> struct weston_surface *surface;
> + struct weston_surface *old_surface;
> struct weston_seat *seat;
> struct fs_output *fsout;
>
> @@ -763,9 +784,13 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
> weston_seat_get_keyboard(seat);
>
> if (keyboard && !keyboard->focus) {
> + old_surface = shell->active_surface;
> + if (old_surface != NULL)
> + weston_surface_deactivate(old_surface);
> weston_surface_assign_keyboard(surface, seat);
> if (surface != NULL)
> weston_surface_activate(surface);
> + shell->active_surface = surface;
> }
> }
> }
Yeah, good otherwise, but I just question the idea of what should be
active in this shell.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160526/71cbc1ed/attachment.sig>
More information about the wayland-devel
mailing list