FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora/Linux Management Tools

 
 
LinkBack Thread Tools
 
Old 04-19-2008, 01:18 AM
Chris Lalancette
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

All,
I ran into an unfortunate situation today with virt-viewer. I was working
inside a virt-viewer window with the mouse and keyboard grabbed. In the
meantime, a long running job that I had started earlier finished up, and fired
up another virt-viewer window (to a different guest). Unfortunately, however,
my window manager decided to place that new virt-viewer window on top of the one
I was currently working in. Once that happened, I couldn't give input to either
window, so I couldn't ungrab the old window or kill the new window.

The attached patch prevents this situation by doing a forced ungrab when we get
a focus-out-event from GTK.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 04-22-2008, 02:43 PM
Chris Lalancette
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

Chris Lalancette wrote:
> The attached patch prevents this situation by doing a forced ungrab when we get
> a focus-out-event from GTK.
>
> Signed-off-by: Chris Lalancette <clalance@redhat.com>

Any interest in this patch?

Chris Lalancette

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 04-22-2008, 02:49 PM
"Daniel P. Berrange"
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

On Tue, Apr 22, 2008 at 10:43:08AM -0400, Chris Lalancette wrote:
> Chris Lalancette wrote:
> > The attached patch prevents this situation by doing a forced ungrab when we get
> > a focus-out-event from GTK.
> >
> > Signed-off-by: Chris Lalancette <clalance@redhat.com>
>
> Any interest in this patch?

I struggle to understand how/what you managed todo here. If the keyboard
grab is active nothing should be able to steal keyboard input focus, since
this is the whole point of keyboard grab. If something did manage to steal
keyboard input while grab was active, then this is a bug in the window
manager and not something we should hack in virt-viewer - inded if this
is possible, then every single app which uses grabs needs your patch which
is clearly non-scalable

Dan.
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 04-22-2008, 03:57 PM
Chris Lalancette
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

Daniel P. Berrange wrote:
> I struggle to understand how/what you managed todo here. If the keyboard
> grab is active nothing should be able to steal keyboard input focus, since
> this is the whole point of keyboard grab. If something did manage to steal
> keyboard input while grab was active, then this is a bug in the window
> manager and not something we should hack in virt-viewer - inded if this
> is possible, then every single app which uses grabs needs your patch which
> is clearly non-scalable

This arguably is some sort of window manager bug, or possibly a bug in the way
keyboard grab is currently working. In any case, it is very easy to reproduce.
Just do something like:

# virt-viewer guest1 & sleep 10 ; virt-viewer guest2

And make sure to click inside the guest1 virt-viewer window right after it pops
up. Assuming your keyboard is grabbed there, and that your window manager
placed the guest2 window on top of the guest1 window, you will be unable to
escape (with Ctrl-Alt) from the guest1 window.

Chris Lalancette

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 05-20-2008, 07:39 PM
Pat Campbell
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

Chris Lalancette wrote:
> Daniel P. Berrange wrote:
>
>> I struggle to understand how/what you managed todo here. If the keyboard
>> grab is active nothing should be able to steal keyboard input focus, since
>> this is the whole point of keyboard grab. If something did manage to steal
>> keyboard input while grab was active, then this is a bug in the window
>> manager and not something we should hack in virt-viewer - inded if this
>> is possible, then every single app which uses grabs needs your patch which
>> is clearly non-scalable
>>
>
> This arguably is some sort of window manager bug, or possibly a bug in the way
> keyboard grab is currently working. In any case, it is very easy to reproduce.
> Just do something like:
>
> # virt-viewer guest1 & sleep 10 ; virt-viewer guest2
>
> And make sure to click inside the guest1 virt-viewer window right after it pops
> up. Assuming your keyboard is grabbed there, and that your window manager
> placed the guest2 window on top of the guest1 window, you will be unable to
> escape (with Ctrl-Alt) from the guest1 window.
>
> Chris Lalancette
>
>
It is not a Window Manager bug, it is a virt-viewer bug. The Window
Manager is not responsible for releasing keyboard or pointer grabs when
a window looses focus. It is the applications job.

Take a look at xorg/xc/Xserver/dix/event.c: ProcUngrabPointer(ClientPtr
client) This function checks that the releasing client is the client
that owns the grab. This behavior makes sense, would be a huge security
hole otherwise.

Not sure this will apply cleanly but I would suggest something like
below to gtk-vnc/vncdisplay.c:

--- vncdisplay.c.orig 2008-05-20 13:32:24.000000000 -0600
+++ vncdisplay.c 2008-05-20 13:33:22.000000000 -0600
@@ -492,6 +492,9 @@ static gboolean leave_event(GtkWidget *w
if (priv->grab_keyboard)
do_keyboard_ungrab(VNC_DISPLAY(widget), FALSE);

+ if (priv->grab_pointer)
+ do_pointer_ungrab(VNC_DISPLAY(widget), FALSE);
+
return TRUE;
}





_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 05-20-2008, 07:48 PM
"Daniel P. Berrange"
 
Default : Make virt-viewer ungrab the mouse and keyboard on un-focus

On Tue, May 20, 2008 at 01:39:49PM -0600, Pat Campbell wrote:
> Chris Lalancette wrote:
> > Daniel P. Berrange wrote:
> >
> >> I struggle to understand how/what you managed todo here. If the keyboard
> >> grab is active nothing should be able to steal keyboard input focus, since
> >> this is the whole point of keyboard grab. If something did manage to steal
> >> keyboard input while grab was active, then this is a bug in the window
> >> manager and not something we should hack in virt-viewer - inded if this
> >> is possible, then every single app which uses grabs needs your patch which
> >> is clearly non-scalable
> >>
> >
> > This arguably is some sort of window manager bug, or possibly a bug in the way
> > keyboard grab is currently working. In any case, it is very easy to reproduce.
> > Just do something like:
> >
> > # virt-viewer guest1 & sleep 10 ; virt-viewer guest2
> >
> > And make sure to click inside the guest1 virt-viewer window right after it pops
> > up. Assuming your keyboard is grabbed there, and that your window manager
> > placed the guest2 window on top of the guest1 window, you will be unable to
> > escape (with Ctrl-Alt) from the guest1 window.
> >
> > Chris Lalancette
> >
> >
> It is not a Window Manager bug, it is a virt-viewer bug. The Window
> Manager is not responsible for releasing keyboard or pointer grabs when
> a window looses focus. It is the applications job.
>
> Take a look at xorg/xc/Xserver/dix/event.c: ProcUngrabPointer(ClientPtr
> client) This function checks that the releasing client is the client
> that owns the grab. This behavior makes sense, would be a huge security
> hole otherwise.

Ok, that makes a little more sense, though I'm still surprised its possible
to loose keyboard focus while grabbed, and I'm fairly sure we always grab
keyboard whenever the mouse is grabbed.

> Not sure this will apply cleanly but I would suggest something like
> below to gtk-vnc/vncdisplay.c:

Looks reasonable to me - CC'ing the GTK-VNC mailing list..

> --- vncdisplay.c.orig 2008-05-20 13:32:24.000000000 -0600
> +++ vncdisplay.c 2008-05-20 13:33:22.000000000 -0600
> @@ -492,6 +492,9 @@ static gboolean leave_event(GtkWidget *w
> if (priv->grab_keyboard)
> do_keyboard_ungrab(VNC_DISPLAY(widget), FALSE);
>
> + if (priv->grab_pointer)
> + do_pointer_ungrab(VNC_DISPLAY(widget), FALSE);
> +
> return TRUE;
> }

Dan
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 

Thread Tools




All times are GMT. The time now is 09:51 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org