[virt-tools-list] [PATCH] Disconnect fullscreen map-event handler when leaving fullscreen

Marc-André Lureau mlureau at redhat.com
Fri Nov 8 10:47:27 UTC 2013


ack

----- Original Message -----
> When we enter fullscreen mode before the window is shown, we set up a signal
> handler to enter fullscreen mode when the window is mapped.  If we then leave
> fullscreen mode before the window is mapped, we don't disconnect this
> handler,
> so it will still enter fullscreen mode when it is shown.
> 
> Fixes rhbz #1009513
> ---
>  src/virt-viewer-window.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 5ce1d98..5003872 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -486,6 +486,16 @@ virt_viewer_window_move_to_monitor(VirtViewerWindow
> *self)
>                                  mon.height);
>  }
>  
> +static gboolean
> +mapped(GtkWidget *widget, GdkEvent *event G_GNUC_UNUSED,
> +       VirtViewerWindow *self)
> +{
> +    g_signal_handlers_disconnect_by_func(widget, mapped, self);
> +    self->priv->fullscreen = FALSE;
> +    virt_viewer_window_enter_fullscreen(self,
> self->priv->fullscreen_monitor);
> +    return FALSE;
> +}
> +
>  void
>  virt_viewer_window_leave_fullscreen(VirtViewerWindow *self)
>  {
> @@ -493,6 +503,10 @@ virt_viewer_window_leave_fullscreen(VirtViewerWindow
> *self)
>      GtkWidget *menu = GTK_WIDGET(gtk_builder_get_object(priv->builder,
>      "top-menu"));
>      GtkCheckMenuItem *check =
>      GTK_CHECK_MENU_ITEM(gtk_builder_get_object(priv->builder,
>      "menu-view-fullscreen"));
>  
> +    /* if we enter and leave fullscreen mode before being shown, make sure
> to
> +     * disconnect the mapped signal handler */
> +    g_signal_handlers_disconnect_by_func(priv->window, mapped, self);
> +
>      if (!priv->fullscreen)
>          return;
>  
> @@ -511,16 +525,6 @@ virt_viewer_window_leave_fullscreen(VirtViewerWindow
> *self)
>  
>  }
>  
> -static gboolean
> -mapped(GtkWidget *widget, GdkEvent *event G_GNUC_UNUSED,
> -       VirtViewerWindow *self)
> -{
> -    g_signal_handlers_disconnect_by_func(widget, mapped, self);
> -    self->priv->fullscreen = FALSE;
> -    virt_viewer_window_enter_fullscreen(self,
> self->priv->fullscreen_monitor);
> -    return FALSE;
> -}
> -
>  void
>  virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor)
>  {
> --
> 1.8.3.1
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list