[virt-tools-list] [PATCH virt-viewer 4/4] window: keep window size when leaving auto-conf fullscreen

Hans de Goede hdegoede at redhat.com
Tue Mar 26 07:55:40 UTC 2013


Hi,

On 03/26/2013 02:09 AM, Marc-André Lureau wrote:
>
>
> ----- Mensaje original -----
>> Hi,
>>
>> On 03/25/2013 10:32 PM, Marc-André Lureau wrote:
>>> On Mon, Mar 25, 2013 at 10:26 PM, Marc-André Lureau
>>> <marcandre.lureau at gmail.com> wrote:
>>>> +    if (virt_viewer_app_get_fullscreen_auto_conf(priv->app)) {
>>>
>>> Actually, I realize the bug is about all kind of fullscreen. My
>>> reasoning was that auto-conf is a bit special because it tries it
>>> best
>>> to keep client monitor configuration, rather than obeying to window
>>> manager constrains. But that distincition is a bit blurry nowadays.
>>>
>>> So we can decide to use app_get_fullscreen() instead here.
>>
>> I agree that the problem is with all kinds of fullscreen, but only
>> when we start fullscreen. so we've no priv->before_saved and then
>> we end up with the very small windows for all monitors.
>>
>> It seems wrong to me to always try to keep the fullscreen size /
>> resolution when we leave fullscreen. I think restoring the size
>> and position from before going fullscreen is the right thing to
>> do. Except when there is no size / position to restore, and I
>> believe that in that case it does make sense to keep the window
>> sizes as they were in fullscreen mode.
>>
>> So how about:
>>
>>       if (priv->before_saved) {
>>           ...
>>       } else {
>>           virt_viewer_display_queue_resize(priv->display);
>>       }
>>
>
> That's ok, though we need to change the:
>
> -    if (!priv->before_saved) {
> +    if (gtk_widget_get_realized(priv->window)) {
>
> Which seems a reasonable change.

But what then if enter_fullscreen is somehow execute twice?
Then the coordinates + size we get from the second run are
when we're already fullscreen. Which is what the
!priv->before_saved protects against.

So IMHO the new check should be:
+    if (!priv->before_saved && gtk_widget_get_realized(priv->window)) {

> Also, I don't think we should set back priv->before_saved = FALSE, as it contains valid value from then on. And setting it back to FALSE might end up to queue_resize() if we call leave_fullscreen() twice for some reason.

leave_fullscreen is protected against being called twice, it starts with:

     if (!priv->fullscreen)
         return;

Where as enter_fullscreen has the before_fullscreen saving before
its similar getting called twice check, not sure why things are done
that way, but they are.

###

Thinking about this it is probably best to move the

     if (priv->fullscreen)
         return;

In enter_fullscreen to the top, and then go with your suggestion,
so make the check for setting before_fullscreen + before_saved:

     if (gtk_widget_get_realized(priv->window)) {

And removing the priv->before_saved = FALSE call.

Regards,

Hans




More information about the virt-tools-list mailing list