[Spice-devel] [spice-gtk][PATCH] widget: grab the kbd even if the kbd is not focused
Pavel Grunt
pgrunt at redhat.com
Tue Oct 27 10:20:19 PDT 2015
Hi Fabiano,
this patch will cause stealing the "keyboard grab", e.g.:
Imagine you are writing something, you accidentaly move mouse cursor over
the SpiceDisplay widget, then the keys will be forwarded to the guest.
But you can take the keyboard grab if any SpiceDisplay (of the session) has the
keyboard focus.
Pavel
On Tue, 2015-10-27 at 17:45 +0100, Fabiano Fidêncio wrote:
> Not grabbing the keyboard when it has no focus might end up in
> undesired situations where the users have their mouse over the spice
> widget but the keyboard does act over the client's DE.
>
> The main situation I am trying to avoid can only be reproduced with
> {virt,remote}-viewer as client and is quite annoying when using multiple
> monitors:
> - On a client's machine with 2 monitors, open remote-viewer in
> fullscreen mode (-f/--fullscreen)
> - Move the mouse (without do any clicking operation) from one monitor to
> another.
>
> At this point, spice-gtk will try to grab the keyboard, but it won't
> happen because the keyboard has no focus.
>
> - Do any keyboard action (like Alt+Tab) and you'll realize the keyboard
> action will take effect in the client's DE (as the keyboard was not
> grabbed).
>
> A simpler reproducer can just be:
> - Open remote-viewer (one single display)
> - Give the focus to another app (by clicking the another app, for
> instance)
> - Move the mouse pointer to the remote-viewer's guest area without
> taking the focus from the previous app (so, again, no clicking)
>
> Here, as mentioned above, spice-gtk wull try to grab the keyboard, but
> it won't happend because the keyboard has no focus.
>
> - Do any keyboard action (like Alt+Tab) and you'll realize the keyboard
> action will take effect in the client's DE (as the keyboard was not
> grabbed).
>
> Resolves: rhbz#1275231
> ---
> src/spice-widget.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 503f82a..af5ae09 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -737,8 +737,6 @@ static void try_keyboard_grab(SpiceDisplay *display)
> return;
> if (d->keyboard_grab_active)
> return;
> - if (!d->keyboard_have_focus)
> - return;
> if (!d->mouse_have_pointer)
> return;
> if (d->keyboard_grab_released)
More information about the Spice-devel
mailing list