[virt-tools-list] [PATCH v2 06/16] display: ignore display that do not have toplevel window
Victor Toso
victortoso at redhat.com
Thu Dec 20 16:17:06 UTC 2018
Hi,
On Wed, Sep 26, 2018 at 07:26:29PM +0400, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> virt_viewer_display_get_preferred_monitor_geometry() may be called
> during application initialization (when the VTE console is being
> shown, virt_viewer_session_update_displays_geometry() is called when
> the visibility menu item is toggled). But the other displays may not
> yet be associated with a window, ignore them.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
> ---
> src/virt-viewer-display.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index b3cc095..a1fcb82 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -687,7 +687,9 @@ void virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
>
> g_return_if_fail(preferred != NULL);
>
> - if (!virt_viewer_display_get_enabled(self)) {
> + top = gtk_widget_get_toplevel(GTK_WIDGET(self));
> + if (!virt_viewer_display_get_enabled(self) ||
> + !GTK_IS_WINDOW(top)) {
> preferred->width = 0;
> preferred->height = 0;
> preferred->x = 0;
> @@ -695,7 +697,6 @@ void virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
> return;
> }
>
> - top = gtk_widget_get_toplevel(GTK_WIDGET(self));
> gtk_window_get_position(GTK_WINDOW(top), &topx, &topy);
> topx = MAX(topx, 0);
> topy = MAX(topy, 0);
> --
> 2.19.0.271.gfe8321ec05
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20181220/df1f6cb6/attachment.sig>
More information about the virt-tools-list
mailing list