Fix menu positioning in 'menu' plugin.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 18:24:59 +0000 (20:24 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 18:24:59 +0000 (20:24 +0200)
It became broken after migration internal container to GtkEventBox.

plugins/menu.c

index be63519..2093dec 100644 (file)
@@ -146,44 +146,9 @@ run_command(GtkWidget *widget, void (*cmd)(void))
 static void
 menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget)
 {
-    int ox, oy, w, h;
-    menup *m;
-    GtkAllocation allocation;
-
-    gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation);
-    ENTER;
-    m = lxpanel_plugin_get_data(widget);
-    gdk_window_get_origin(gtk_widget_get_window(widget), &ox, &oy);
-#if GTK_CHECK_VERSION(2,20,0)
-    GtkRequisition requisition;
-    gtk_widget_get_requisition(GTK_WIDGET(menu), &requisition);
-    w = requisition.width;
-    h = requisition.height;
-
-#else
-    w = GTK_WIDGET(menu)->requisition.width;
-    h = GTK_WIDGET(menu)->requisition.height;
-#endif
-    if (panel_get_orientation(m->panel) == GTK_ORIENTATION_HORIZONTAL) {
-        *x = ox;
-        if (*x + w > gdk_screen_width())
-            *x = ox + allocation.width - w;
-        *y = oy - h;
-        if (*y < 0)
-            *y = oy + allocation.height;
-    } else {
-        *x = ox + allocation.width;
-        if (*x > gdk_screen_width())
-            *x = ox - w;
-        *y = oy;
-        if (*y + h >  gdk_screen_height())
-            *y = oy + allocation.height - h;
-    }
-    DBG("widget: x,y=%d,%d  w,h=%d,%d\n", ox, oy,
-          allocation.width, allocation.height );
-    DBG("w-h %d %d\n", w, h);
+    menup *m = lxpanel_plugin_get_data(widget);
+    lxpanel_plugin_popup_set_position_helper(m->panel, widget, GTK_WIDGET(menu), x, y);
     *push_in = TRUE;
-    RET();
 }
 
 static void on_menu_item( GtkMenuItem* mi, menup* m )