<div dir="ltr"><div>Hi Pekka, thanks a lot for getting this on the rails !<br><br>"I'm not so sure about the pointer_set_focus here. Shuffling surfaces is<br>
supposed to trigger a repick, which will reassign the pointer focus.<br>
However, it seems something is off."<br><br></div><div>The "pointer_set_focus(... 0, 0)" thing was added for a client (Chromium) whch privilegies pointer focus over keyboard focus, It considers itself still focused when minimized ; mostly because it disregards keyboard focus and, last time I looked in desktop-shell, even xdg-shell activate() events were mostly linked to keyboard focus. So adding this call for pointer_leave fixed it. What is your opinon on this ?<br><br>"assume the first wl_pointer.leave(nil) is for the popup surface, so<br>
that's ok. The enter for nil looks very suspicious though. Maybe that<br>
is caused by this patch?"<br><br></div><div>It clearly is ; I interpret this as the pointer leaving the main terminal surface when it minimizes, which seems logical, but maybe I'm misleaded (btw, how do you get all these logs ?). <br><br>"Just curious, how can the surface go off-center? Some output<br>
hot-unplugging involved?"<br><br></div><div>The call to "unset_fullscreen()" will reposition the surface at its former non-fullscreen position (old_x, old_y), which is good. When the surface gets focused again later, fullscreen state gets triggered again because the hint is stll too, which is good, too ; but the x,y is now old_x, old_y, so off-center.<br><br>"When wouldn't there be a black_view?"<br><br></div><div>When you refocus a minimized surface, black_view has been destroyed by "unset_fullscreen()". It gets created later again, but after this part, where it is NULL and thus crashes.<br>---<br></div><div>(btw, as you pushed master, you'll want to take a look at my 2 no-brainer patches which fix building it : <a href="http://lists.freedesktop.org/archives/wayland-devel/2015-March/020920.html">http://lists.freedesktop.org/archives/wayland-devel/2015-March/020920.html</a> - <a href="http://lists.freedesktop.org/archives/wayland-devel/2015-March/020921.html">http://lists.freedesktop.org/archives/wayland-devel/2015-March/020921.html</a>)<br><br></div><div>Regards,</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-27 15:22 GMT+01:00 Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, 16 Feb 2015 11:52:47 +0100<br>
Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>> wrote:<br>
<br>
> From: Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>><br>
><br>
> 2 things were wrong with the minimization code :<br>
> - if the minimized surface was fullscreen, the shell would keep<br>
>   its fullscreen mode on and only display a black background ;<br>
> - keyboard focus was unset, but pointer focus was not.<br>
><br>
> On the other hand, make sure a fullscreen surface gets centered<br>
> again when refocused with Mod+Tab.<br>
><br>
> Author: Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>><br>
> Author: Nicolas Guyomard <<a href="mailto:nicolas.guyomard@open.eurogiciel.org">nicolas.guyomard@open.eurogiciel.org</a>><br>
> Signed-off-by: Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>><br>
> ---<br>
>  desktop-shell/shell.c |   16 +++++++++++++---<br>
>  1 file changed, 13 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c<br>
> index 5900c4d..830c25d 100644<br>
> --- a/desktop-shell/shell.c<br>
> +++ b/desktop-shell/shell.c<br>
> @@ -2657,13 +2657,20 @@ set_minimized(struct weston_surface *surface)<br>
>       weston_layer_entry_remove(&view->layer_link);<br>
>       weston_layer_entry_insert(&shsurf->shell->minimized_layer.view_list, &view->layer_link);<br>
><br>
> +     if (shsurf->state.fullscreen)<br>
> +             unset_fullscreen(shsurf);<br>
> +<br>
>       drop_focus_state(shsurf->shell, current_ws, view->surface);<br>
>       wl_list_for_each(seat, &shsurf->shell->compositor->seat_list, link) {<br>
>               if (!seat->keyboard)<br>
>                       continue;<br>
>               focus = weston_surface_get_main_surface(seat->keyboard->focus);<br>
> -             if (focus == view->surface)<br>
> +             if (focus == view->surface) {<br>
>                       weston_keyboard_set_focus(seat->keyboard, NULL);<br>
> +                     weston_pointer_set_focus(seat->pointer, NULL,<br>
> +                                              wl_fixed_from_int(0),<br>
> +                                              wl_fixed_from_int(0));<br>
> +             }<br>
>       }<br>
<br>
</div></div>Hi,<br>
<br>
I'm not so sure about the pointer_set_focus here. Shuffling surfaces is<br>
supposed to trigger a repick, which will reassign the pointer focus.<br>
However, it seems something is off. The keyboards focus is different to<br>
pointer focus, because keyboard focus is "sticky" and needs to be<br>
explicitly managed. Pointer focus generally follows picking unless the<br>
pointer is grabbed.<br>
<br>
With this patch applied:<br>
<br>
[2030091.702]  -> xdg_surface@15.set_minimized()<br>
[2030091.737]  -> xdg_popup@21.destroy()<br>
[2030091.768]  -> wl_surface@25.destroy()<br>
[2030091.805]  -> wl_buffer@29.destroy()<br>
[2030091.892]  -> wl_shm_pool@28.destroy()<br>
[2030092.413] wl_display@1.delete_id(21)<br>
[2030092.469] wl_display@1.delete_id(25)<br>
[2030092.503] wl_display@1.delete_id(29)<br>
[2030092.537] wl_display@1.delete_id(28)<br>
[2030092.570] wl_keyboard@16.leave(315, wl_surface@14)<br>
[2030092.633] xdg_surface@15.configure(1024, 600, array, 316)<br>
[2030092.722]  -> xdg_surface@15.ack_configure(316)<br>
[2030092.762]  -> xdg_surface@15.set_title("pq@erebos:~/git/weston")<br>
[2030092.798] wl_pointer@17.leave(317, nil)<br>
[2030092.853] wl_keyboard@16.modifiers(318, 0, 0, 0, 0)<br>
[2030093.019] wl_pointer@17.enter(318, nil, 69.000000, 109.000000)<br>
[2030093.154] xdg_shell@12.ping(319)<br>
[2030093.195]  -> xdg_shell@12.pong(319)<br>
[2030093.265] wl_pointer@17.leave(320, nil)<br>
[2030093.322]  -> wl_compositor@4.create_region(new id wl_region@28)<br>
[2030093.372]  -> xdg_surface@15.set_title("pq@erebos:~/git/weston")<br>
[2030093.409]  -> wl_compositor@4.create_region(new id wl_region@29)<br>
[2030093.455]  -> wl_region@29.add(0, 0, 1024, 600)<br>
[2030093.553]  -> wl_region@28.add(0, 0, 1024, 600)<br>
[2030093.642]  -> wl_surface@14.frame(new id wl_callback@25)<br>
[2030098.044]  -> wl_surface@14.set_opaque_region(wl_region@28)<br>
[2030098.142]  -> wl_region@28.destroy()<br>
[2030098.170]  -> wl_surface@14.set_input_region(wl_region@29)<br>
[2030098.208]  -> wl_region@29.destroy()<br>
[2030098.291]  -> wl_surface@14.attach(wl_buffer@24, 0, 0)<br>
[2030098.379]  -> wl_surface@14.damage(0, 0, 1024, 600)<br>
[2030098.436]  -> wl_surface@14.commit()<br>
[2030103.646] wl_display@1.delete_id(28)<br>
[2030103.727] wl_display@1.delete_id(29)<br>
<br>
This was made with weston-terminal patched to have a "minimize" option<br>
in the context menu. I just pushed that patch to master, btw. so<br>
everyone can test.<br>
<br>
I assume the first wl_pointer.leave(nil) is for the popup surface, so<br>
that's ok. The enter for nil looks very suspicious though. Maybe that<br>
is caused by this patch?<br>
<br>
My opinion is that this looks okay apart from the pointer focus.<br>
<span class=""><br>
><br>
>       shell_surface_update_child_surface_layers(shsurf);<br>
> @@ -5937,8 +5944,11 @@ switcher_next(struct switcher *switcher)<br>
>               view->alpha = 1.0;<br>
><br>
>       shsurf = get_shell_surface(switcher->current);<br>
> -     if (shsurf && shsurf->state.fullscreen)<br>
> -             shsurf->fullscreen.black_view->alpha = 1.0;<br>
> +     if (shsurf && shsurf->state.fullscreen) {<br>
> +             center_on_output(shsurf->view, shsurf->fullscreen_output);<br>
> +             if (shsurf->fullscreen.black_view)<br>
> +                     shsurf->fullscreen.black_view->alpha = 1.0;<br>
<br>
</span>Just curious, how can the surface go off-center? Some output<br>
hot-unplugging involved?<br>
<br>
When wouldn't there be a black_view?<br>
<br>
> +     }<br>
>  }<br>
><br>
>  static void<br>
<br>
Thanks,<br>
pq<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><font>Regards,<br>
<br>
<i><b>Manuel BACHMANN</b><br>
Tizen Project<br>
VANNES-FR</i><br>
</font></div></div>
</div>