[gtk+/wip/attachment-rectangle] menu: use 1x1 attachment rectangle at mouse for unattached popup menus



commit df5a281d9bc820feb5a8900e181c98439c600423
Author: William Hua <william hua canonical com>
Date:   Wed Aug 26 15:41:59 2015 +0100

    menu: use 1x1 attachment rectangle at mouse for unattached popup menus

 gtk/gtkmenu.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 9535c90..50515a6 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -4613,6 +4613,17 @@ gtk_menu_position (GtkMenu  *menu,
               return;
             }
         }
+
+      pointer = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (menu));
+      gdk_device_get_position (pointer, &pointer_screen, &x, &y);
+      parent_origin.x = 0;
+      parent_origin.y = 0;
+      allocation.x = x;
+      allocation.y = y;
+      allocation.width = 1;
+      allocation.height = 1;
+      gdk_window_set_attachment_rectangle (menu_window, &parent_origin, &allocation, 
GDK_ATTACHMENT_ATTACH_ANY_EDGE);
+      return;
     }
 
   widget = GTK_WIDGET (menu);


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