Skip to content

Commit 05e6aa3

Browse files
raveit65raveit65
raveit65
authored andcommitted
navigation-action-widget: replace deprecated gtk_menu_popup function
1 parent 510ea85 commit 05e6aa3

File tree

1 file changed

+2
-53
lines changed

1 file changed

+2
-53
lines changed

shell/ev-navigation-action-widget.c

+2-53
Original file line numberDiff line numberDiff line change
@@ -118,54 +118,6 @@ ev_navigation_action_widget_set_menu(EvNavigationActionWidget *button, GtkWidget
118118
}
119119
}
120120

121-
static void
122-
menu_position_func (GtkMenu *menu,
123-
int *x,
124-
int *y,
125-
gboolean *push_in,
126-
EvNavigationActionWidget *button)
127-
{
128-
GtkWidget *widget = GTK_WIDGET (button);
129-
GtkRequisition menu_req;
130-
GtkAllocation allocation;
131-
GtkTextDirection direction;
132-
GdkWindow *gdk_window;
133-
GdkRectangle monitor;
134-
GdkMonitor *monitor_num;
135-
GdkDisplay *display;
136-
137-
gtk_widget_get_preferred_size (GTK_WIDGET (button->menu), &menu_req, NULL);
138-
direction = gtk_widget_get_direction (widget);
139-
display = gtk_widget_get_display (GTK_WIDGET (menu));
140-
141-
gdk_window = gtk_widget_get_window (widget);
142-
monitor_num = gdk_display_get_monitor_at_window (display, gdk_window);
143-
if (monitor_num == NULL)
144-
monitor_num = gdk_display_get_monitor (display, 0);
145-
gdk_monitor_get_geometry (monitor_num, &monitor);
146-
147-
gdk_window_get_origin (gdk_window, x, y);
148-
gtk_widget_get_allocation (widget, &allocation);
149-
*x += allocation.x;
150-
*y += allocation.y;
151-
152-
if (direction == GTK_TEXT_DIR_LTR)
153-
*x += MAX (allocation.width - menu_req.width, 0);
154-
else if (menu_req.width > allocation.width)
155-
*x -= menu_req.width - allocation.width;
156-
157-
if ((*y + allocation.height + menu_req.height) <= monitor.y + monitor.height)
158-
*y += allocation.height;
159-
else if ((*y - menu_req.height) >= monitor.y)
160-
*y -= menu_req.height;
161-
else if (monitor.y + monitor.height - (*y + allocation.height) > *y)
162-
*y += allocation.height;
163-
else
164-
*y -= menu_req.height;
165-
166-
*push_in = FALSE;
167-
}
168-
169121
static void
170122
popup_menu_under_arrow (EvNavigationActionWidget *button,
171123
GdkEventButton *event)
@@ -175,11 +127,8 @@ popup_menu_under_arrow (EvNavigationActionWidget *button,
175127
if (!button->menu)
176128
return;
177129

178-
gtk_menu_popup (button->menu, NULL, NULL,
179-
(GtkMenuPositionFunc) menu_position_func,
180-
button,
181-
event ? event->button : 0,
182-
event ? event->time : gtk_get_current_event_time ());
130+
gtk_menu_popup_at_pointer (button->menu,
131+
(const GdkEvent*) event);
183132
}
184133

185134
static void

0 commit comments

Comments
 (0)