[libwnck/wip/muktupavels/wnck-image-menu-item] tasklist: avoid deprecated gtk_menu_popup
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck/wip/muktupavels/wnck-image-menu-item] tasklist: avoid deprecated gtk_menu_popup
- Date: Sat, 12 Nov 2016 01:15:14 +0000 (UTC)
commit 344d711334d419a557390ab66a5f4ffd8d9a4e56
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Nov 12 03:14:23 2016 +0200
tasklist: avoid deprecated gtk_menu_popup
libwnck/tasklist.c | 62 ++++++---------------------------------------------
1 files changed, 8 insertions(+), 54 deletions(-)
---
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index ec4185d..78c6d17 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -2620,51 +2620,6 @@ wnck_tasklist_viewports_changed (WnckScreen *screen,
gtk_widget_queue_resize (GTK_WIDGET (tasklist));
}
-static void
-wnck_task_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data)
-{
- GtkWidget *widget = GTK_WIDGET (user_data);
- GdkWindow *window;
- GdkSeat *seat;
- GdkDevice *pointer;
- GtkAllocation allocation;
- GtkRequisition requisition;
- gint menu_xpos;
- gint menu_ypos;
- gint pointer_x;
- gint pointer_y;
-
- gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
-
- window = gtk_widget_get_window (widget);
- gtk_widget_get_allocation (widget, &allocation);
-
- gdk_window_get_origin (window, &menu_xpos, &menu_ypos);
-
- menu_xpos += allocation.x;
- menu_ypos += allocation.y;
-
- if (menu_ypos > gdk_screen_height () / 2)
- menu_ypos -= requisition.height;
- else
- menu_ypos += allocation.height;
-
- seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
- pointer = gdk_seat_get_pointer (seat);
- gdk_window_get_device_position (window, pointer, &pointer_x, &pointer_y, NULL);
-
- if (requisition.width < pointer_x)
- menu_xpos += MIN (pointer_x, allocation.width - requisition.width);
-
- *x = menu_xpos;
- *y = menu_ypos;
- *push_in = FALSE;
-}
-
static gboolean
wnck_tasklist_change_active_timeout (gpointer data)
{
@@ -3032,10 +2987,10 @@ wnck_task_popup_menu (WnckTask *task,
_wnck_screen_get_gdk_screen (task->tasklist->priv->screen));
gtk_widget_show (menu);
- gtk_menu_popup (GTK_MENU (menu),
- NULL, NULL,
- wnck_task_position_menu, task->button,
- 1, gtk_get_current_event_time ());
+ gtk_menu_popup_at_widget (GTK_MENU (menu), task->button,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ NULL);
}
static void
@@ -3684,11 +3639,10 @@ wnck_task_button_press_event (GtkWidget *widget,
_wnck_screen_get_gdk_screen (task->tasklist->priv->screen));
gtk_widget_show (task->action_menu);
- gtk_menu_popup (GTK_MENU (task->action_menu),
- NULL, NULL,
- wnck_task_position_menu, task->button,
- event->button,
- gtk_get_current_event_time ());
+ gtk_menu_popup_at_widget (GTK_MENU (task->action_menu), task->button,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (GdkEvent *) event);
g_signal_connect (task->action_menu, "selection-done",
G_CALLBACK (gtk_widget_destroy), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]