[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCHWORK] [virt-manager] fullscreen behaviour



On 11/11/2009 09:04 PM, Jon Nordby wrote:
> Here is something showing the behaviour I had in mind. Basically the regular
> menubar is tossed into its own window in fullscreen mode.
> It is minimized by default, but will pop up on hovering over it. There are
> some known unsolved issues that I want feedback on. In particular (quoting
> the patch):
> 
>   #FIXME: spawned windows (eg manager/help from menu) end up behind the
> fullscreened
>   # Not entirely unexpected but. Anything we can do? Gray out these entries?
> 
> Graying out the entries seems easy enough to do, but gives a loss of
> functionality (for a non-obvious reason seen from user POV).
> Another alternative is to go out of fullscreen mode if any of these entries
> are activated. Is that feasible and wanted?
>

I think the latter would be the better way, though I don't see it as a
priority issue since the existing code has the same deficiency.

> I intend to fix all of these before requesting merge:
>   #TODO: don't close menu if we got a new show_menu before timeout

You can probably just keep the object timer id around, and unregister it
on show_menu.

>   #TODO: kill details window on destruction

What does this mean exactly?

>   #TODO: actually not centered?
> 
> Not neccesary imo, but nice to have (especially the first):
>   #NICE: add a button for getting out of fullscreen

Where would the button go? A separate window, or just a top level menu
entry?

>   #NICE: ability to have this "pinned"
> And possibly a keyboard shortcut.
> 

All the above should probably be done as separate patches though. I
think just getting the autohide behavior correct should be it's own
piece, then we can tweak and increment from there.

> And the class should be called vmmFullScreenMenu I guess. Should it reside
> in a separate file?
> 

I think it's best to keep it in console.py.

> Thoughts, comments?

I tried it out, I like the direction its going in! I know the comments
above indicate that the alignment isn't quite right, but is this what
you are seeing?

http://fedorapeople.org/~crobinso/tmp/win-fullscreen.png

Particularly the distance from the top of the screen. Is that
intentional? I'm running on fedora rawhide FYI.

Out of curiousity, what does virtual box do here? (you indicated you
were familiar with it). I'll try to take some time to set up vmware
workstation and vbox to play with it. There seems like several ways we
could possibly tweak this behavior, and I'm interested what the
precedent is.

A few small comments inline:

> # HG changeset patch
> # User Jon Nordby <jononor gmail com>
> # Date 1257990842 -3600
> # Node ID fbb0c9b65e9e287ca1aae4c4f75fd2457fe54766
> # Parent  7449fa221c45069b120871cfb02ed26eab2fbc54
> fullscreen: Put menubar in its own window
> 
> diff -r 7449fa221c45 -r fbb0c9b65e9e src/virtManager/console.py
> --- a/src/virtManager/console.py	Wed Nov 11 11:02:57 2009 -0500
> +++ b/src/virtManager/console.py	Thu Nov 12 02:54:02 2009 +0100
> @@ -62,6 +62,8 @@
>          self.title = vm.get_name() + " " + self.topwin.get_title()
>          self.topwin.set_title(self.title)
>  
> +        self.fullscreen_menu = FullScreenMenu(self)
> +
>          # State for disabling modifiers when keyboard is grabbed
>          self.accel_groups = gtk.accel_groups_from_object(self.topwin)
>          self.gtk_settings_accel = None
> @@ -76,6 +78,9 @@
>          self.vncViewer = gtkvnc.Display()
>          self.window.get_widget("console-vnc-viewport").add(self.vncViewer)
>  
> +        self.vncViewer.add_events(gtk.gdk.ENTER_NOTIFY_MASK)
> +        self.vncViewer.connect("enter-notify-event", self.fullscreen_menu.hide_menu_delayed)
> +

Long line here.

>          self.init_vnc()
>  
>          self.notifyID = None
> @@ -260,7 +265,8 @@
>      def toggle_fullscreen(self, src):
>          self.window.get_widget("control-fullscreen").set_active(src.get_active())
>          if src.get_active():
> -
> +            # Fullscreen enabled
> +            self.fullscreen_menu.activate()
>              # if scaling is enabled make sure we fit onto the root window
>              if self.vncViewer.get_scaling():
>                  ignore, h = self.window.get_widget("menubar3").size_request()
> @@ -277,6 +283,9 @@
>  
>              self.window.get_widget("toolbar-box").hide()
>          else:
> +            # Fullscreen disabled
> +            self.fullscreen_menu.deactivate()
> +
>              if self.config.get_console_keygrab() == 1:
>                  self._enable_modifiers()
>                  gtk.gdk.keyboard_ungrab(0L)
> @@ -638,3 +647,73 @@
>  
>  
>  gobject.type_register(vmmConsolePages)
> +
> +
> +class FullScreenMenu(object):
> +    def __init__(self, console):
> +        self.orig_menu_container = console.window.get_widget("vbox2")
> +        self.menubar = console.window.get_widget("menubar3")

We should probably give these widgets better names in vmm-details, since
we use them in a few spots now.

> +        self.activated = False
> +
> +        # Make sure we get wanted window behaviour
> +        # gtk.WINDOW_POPUP is too sticky
> +        self.menuwin = gtk.Window() 
> +        self.menuwin.set_transient_for(console.topwin)
> +        self.menuwin.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_MENU)
> +        self.menuwin.set_decorated(False)
> +        self.menuwin.set_resizable(False)
> +        #NICE: ability to have this "pinned"
> +        #NICE: add a button for getting out of fullscreen
> +        #TODO: don't close menu if we got a new show_menu before timeout
> +        #TODO: kill details window on destruction
> +        #FIXME: spawned windows (eg manager/help from menu) end up behind the fullscreened window. 
> +                # Not entirely unexpected but. Anything we can do? Gray out these entries?
> +
> +        w, _ = self.menubar.size_request()

'_' is the gettext function, so overwriting it could cause issues if
this code ever included translated messages in the future. You can use
'ignore' which pylint won't complain about.

Thanks a bunch!

- Cole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]