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

[virt-tools-list] [PATCH virt-viewer] window: fix send key menu popup position



From: Marc-André Lureau <marcandre lureau redhat com>

Fix send key menu popup position.

The current code wasn't correctly translating the menu coordinates
based on the toplevel windows position, it was always using origin 0.

https://bugzilla.redhat.com/show_bug.cgi?id=913601
---
 src/virt-viewer-window.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 5c9a9db..814726f 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -726,11 +726,12 @@ static void keycombo_menu_location(GtkMenu *menu G_GNUC_UNUSED, gint *x, gint *y
 {
     VirtViewerWindow *self = user_data;
     GtkAllocation allocation;
+    GtkWidget *toplevel = gtk_widget_get_toplevel(self->priv->toolbar_send_key);
 
     *push_in = TRUE;
-    gdk_window_get_origin(gtk_widget_get_window(self->priv->toolbar_send_key), x, y);
-    gtk_widget_translate_coordinates(self->priv->toolbar_send_key, gtk_widget_get_toplevel(self->priv->toolbar_send_key),
-                                     0, 0, x, y);
+    gdk_window_get_origin(gtk_widget_get_window(toplevel), x, y);
+    gtk_widget_translate_coordinates(self->priv->toolbar_send_key, toplevel,
+                                     *x, *y, x, y);
     gtk_widget_get_allocation(self->priv->toolbar_send_key, &allocation);
     *y += allocation.height;
 }
-- 
1.8.3.rc1.49.g8d97506


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