@@ -301,54 +301,6 @@ get_max_text_width (GtkWidget *widget,
301301 return logical_rect .width ;
302302}
303303
304- static void
305- cpufreq_applet_popup_position_menu (GtkMenu * menu ,
306- int * x ,
307- int * y ,
308- gboolean * push_in ,
309- gpointer gdata )
310- {
311- GtkWidget * widget ;
312- GtkRequisition requisition ;
313- GtkAllocation allocation ;
314- gint menu_xpos ;
315- gint menu_ypos ;
316-
317- widget = GTK_WIDGET (gdata );
318-
319- gtk_widget_get_preferred_size (GTK_WIDGET (menu ), & requisition , NULL );
320-
321- gdk_window_get_origin (gtk_widget_get_window (widget ), & menu_xpos , & menu_ypos );
322-
323- gtk_widget_get_allocation (widget , & allocation );
324-
325- menu_xpos += allocation .x ;
326- menu_ypos += allocation .y ;
327-
328- switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (widget ))) {
329- case MATE_PANEL_APPLET_ORIENT_DOWN :
330- case MATE_PANEL_APPLET_ORIENT_UP :
331- if (menu_ypos > HeightOfScreen (gdk_x11_screen_get_xscreen (gtk_widget_get_screen (widget ))) / 2 )
332- menu_ypos -= requisition .height ;
333- else
334- menu_ypos += allocation .height ;
335- break ;
336- case MATE_PANEL_APPLET_ORIENT_RIGHT :
337- case MATE_PANEL_APPLET_ORIENT_LEFT :
338- if (menu_xpos > WidthOfScreen (gdk_x11_screen_get_xscreen (gtk_widget_get_screen (widget ))) / 2 )
339- menu_xpos -= requisition .width ;
340- else
341- menu_xpos += allocation .width ;
342- break ;
343- default :
344- g_assert_not_reached ();
345- }
346-
347- * x = menu_xpos ;
348- * y = menu_ypos ;
349- if (push_in ) * push_in = FALSE; /*fix bottom panel menu rendering in gtk3*/
350- }
351-
352304static void
353305cpufreq_applet_menu_popup (CPUFreqApplet * applet ,
354306 guint32 time )
@@ -381,10 +333,11 @@ cpufreq_applet_menu_popup (CPUFreqApplet *applet,
381333 gtk_style_context_add_class (context ,"gnome-panel-menu-bar" );
382334 gtk_style_context_add_class (context ,"mate-panel-menu-bar" );
383335
384- gtk_menu_popup (GTK_MENU (menu ), NULL , NULL ,
385- cpufreq_applet_popup_position_menu ,
386- (gpointer ) applet ,
387- 1 , time );
336+ gtk_menu_popup_at_widget (GTK_MENU (menu ),
337+ GTK_WIDGET (applet ),
338+ GDK_GRAVITY_SOUTH_WEST ,
339+ GDK_GRAVITY_NORTH_WEST ,
340+ NULL );
388341}
389342
390343static gboolean
0 commit comments