[gtk+/gtk-3-22] mir: set placement for menu-type windows



commit 16e36e539964ed846e1a9efc242628fc5cb11cd8
Author: William Hua <william hua canonical com>
Date:   Mon Mar 13 03:36:30 2017 -0400

    mir: set placement for menu-type windows

 gdk/mir/gdkmirwindowimpl.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 54fb2bc..f0a7687 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -436,6 +436,7 @@ create_spec (GdkWindow        *window,
 {
   MirWindowSpec *spec = NULL;
   GdkWindow *parent;
+  MirRectangle rect;
 
   spec = create_window_type_spec (impl->display,
                                   impl->transient_for,
@@ -477,6 +478,41 @@ create_spec (GdkWindow        *window,
                                      impl->rect_anchor_dx,
                                      impl->rect_anchor_dy);
     }
+  else
+    {
+      switch (impl->type_hint)
+        {
+        case GDK_WINDOW_TYPE_HINT_MENU:
+        case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
+        case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
+        case GDK_WINDOW_TYPE_HINT_TOOLBAR:
+        case GDK_WINDOW_TYPE_HINT_COMBO:
+        case GDK_WINDOW_TYPE_HINT_DND:
+        case GDK_WINDOW_TYPE_HINT_TOOLTIP:
+        case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
+          rect.left = impl->transient_x;
+          rect.top = impl->transient_y;
+          rect.width = 1;
+          rect.height = 1;
+
+          mir_window_spec_set_placement (spec,
+                                         &rect,
+                                         mir_placement_gravity_southeast,
+                                         mir_placement_gravity_northwest,
+                                         (mir_placement_hints_flip_x |
+                                          mir_placement_hints_flip_y |
+                                          mir_placement_hints_slide_x |
+                                          mir_placement_hints_slide_y |
+                                          mir_placement_hints_resize_x |
+                                          mir_placement_hints_resize_y),
+                                         -window->shadow_left,
+                                         -window->shadow_top);
+
+          break;
+        default:
+          break;
+        }
+    }
 
   return spec;
 }
@@ -1155,7 +1191,8 @@ _gdk_mir_window_set_final_rect (GdkWindow    *window,
   gint unflipped_offset;
   gint flipped_offset;
 
-  g_return_if_fail (impl->has_rect);
+  if (!impl->has_rect)
+    return;
 
   best_rect = get_unflipped_rect (&impl->rect,
                                   window->width,


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