@@ -118,54 +118,6 @@ ev_navigation_action_widget_set_menu(EvNavigationActionWidget *button, GtkWidget
118
118
}
119
119
}
120
120
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
-
169
121
static void
170
122
popup_menu_under_arrow (EvNavigationActionWidget * button ,
171
123
GdkEventButton * event )
@@ -175,11 +127,8 @@ popup_menu_under_arrow (EvNavigationActionWidget *button,
175
127
if (!button -> menu )
176
128
return ;
177
129
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 );
183
132
}
184
133
185
134
static void
0 commit comments