[PATCH weston v3 5/8] fullscreen-shell: Support tracking active surfaces
Bryce Harrington
bryce at osg.samsung.com
Sat Jun 4 01:45:59 UTC 2016
On Thu, May 26, 2016 at 06:01:52PM +0300, Pekka Paalanen wrote:
> 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?
Then in that case can all this just be shortcircuited and make all
surfaces be active? If I understand what you're saying then by
definition with fullscreen-shell there would be no such thing as
non-active surfaces.
Bryce
> > 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iQIVAwUBV0cP4CNf5bQRqqqnAQjzsQ//Y81OgHDRxsgB71pnHsw0sYlMncNmeem+
> 9VEJhUtu8GzoazK5rHdahqJQyouTBRZuvwP2YB/2vfOAjIxpf9UoRPhNDaUEl+Xw
> yeipKlsQHghrNGFTFT5KGNY7JgyuBwWSuw3MHDiOLZL1UEQEgHzgv1RMPUths9Y9
> DifQMWislb78xO88Q149w5/ksSCFwFygtxgO3sJ+jjEAvVLZJy5flxNnDPMObDDC
> ExdUtjbEyp2TztRWMhj2ps9hNL4BlIJsetTntDPGJe4LfEfsT86/cklcMqvlfU90
> cq6MMbwvHXjqpIydKQ9rPwnRoJGdfcsbrvyNS3DTS64oEKkqq/L0H3pPuKKV6qTp
> yf64wKwOhtxtrAiKBLsmxEFs3mDSgI6M5bOwCJBBrtxmKC/QqgiZ6yOMtL9ETuGo
> sHnWHyajo9Zw6YvZzfkk+xfwPwwOdN+3xOZlFlOQPpoOjktmPz8/JTbjLQQB1RcO
> y5o7tZYJvRGPYECKikyNOP1uML5q86qjjTa3tDb+2VQxM1dm9pDguoSCdx/eTgN+
> CMDoAsAn5r0u84ZskRxlVJ+1HS4XolHxBwgWc6zCsTRK9ucusn2V74krBsVmx6YH
> psSKsm5LjVxPpfrnyxhcUeH+DziuJPl1qGGhBdSPCmXXCyrUynBOXBfyLOFzDrmI
> ey4JbR1N2VM=
> =eEHI
> -----END PGP SIGNATURE-----
More information about the wayland-devel
mailing list