diff options
author | raveit65 <[email protected]> | 2018-06-07 20:54:04 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-06-10 14:32:25 +0200 |
commit | 9edbc591d23410e5a1da9528822f9d58eea6a68e (patch) | |
tree | c44511895022ee925025a6f6d5e28dec893a450f /libslab | |
parent | 4facc83230086b6ebfd4a325e179b8d8efae74e8 (diff) | |
download | mate-control-center-9edbc591d23410e5a1da9528822f9d58eea6a68e.tar.bz2 mate-control-center-9edbc591d23410e5a1da9528822f9d58eea6a68e.tar.xz |
libslab: replace deprecated gtk_menu_popup
Diffstat (limited to 'libslab')
-rw-r--r-- | libslab/tile.c | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/libslab/tile.c b/libslab/tile.c index b2f483f7..9d628f8b 100644 --- a/libslab/tile.c +++ b/libslab/tile.c @@ -52,8 +52,6 @@ static gboolean tile_button_release (GtkWidget *, GdkEventButton *); static gboolean tile_key_release (GtkWidget *, GdkEventKey *); static gboolean tile_popup_menu (GtkWidget *); -static void tile_popup_menu_position (GtkMenu *, gint *, gint *, gboolean *, gpointer); - static void tile_drag_begin (GtkWidget *, GdkDragContext *); static void tile_drag_data_get (GtkWidget *, GdkDragContext *, GtkSelectionData *, guint, guint); @@ -377,8 +375,11 @@ tile_button_release (GtkWidget * widget, GdkEventButton * event) case 3: if (GTK_IS_MENU (tile->context_menu)) - gtk_menu_popup (tile->context_menu, NULL, NULL, NULL, NULL, event->button, - event->time); + gtk_menu_popup_at_widget (GTK_MENU (tile->context_menu), + widget, + GDK_GRAVITY_SOUTH_WEST, + GDK_GRAVITY_NORTH_WEST, + (const GdkEvent*) event); break; @@ -408,31 +409,6 @@ tile_key_release (GtkWidget * widget, GdkEventKey * event) return FALSE; } -static void -tile_popup_menu_position (GtkMenu * menu, gint * x, gint * y, gboolean * push_in, gpointer data) -{ - Tile *tile = TILE (data); - - GtkAllocation all; - GtkRequisition req; - GtkWidget *top; - - if (!gtk_widget_get_realized (GTK_WIDGET (tile))) - return; - - gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); - gtk_widget_get_allocation (GTK_WIDGET (menu), &all); - - top = gtk_widget_get_toplevel (GTK_WIDGET (tile)); - - gdk_window_get_origin (gtk_widget_get_window (top), x, y); - - *x += (all.width / 2) - (req.width / 2); - *y += (all.height / 2) - (req.height / 2); - - *push_in = FALSE; -} - static gboolean tile_popup_menu (GtkWidget * widget) { @@ -440,8 +416,11 @@ tile_popup_menu (GtkWidget * widget) if (GTK_IS_MENU (tile->context_menu)) { - gtk_menu_popup (tile->context_menu, NULL, NULL, tile_popup_menu_position, tile, 0, - gtk_get_current_event_time ()); + gtk_menu_popup_at_widget (GTK_MENU (tile->context_menu), + widget, + GDK_GRAVITY_SOUTH_WEST, + GDK_GRAVITY_NORTH_WEST, + NULL); return TRUE; } |