Fix katze_widget_popup_position_menu for GTK+
The window NULL-check was wrong in any case. The key issue here is that GtkEntry internals changed in GTK+3 and we need to take that into account.
This commit is contained in:
parent
79b29a9362
commit
7af5019d86
1 changed files with 17 additions and 9 deletions
|
@ -910,21 +910,29 @@ katze_widget_popup_position_menu (GtkMenu* menu,
|
||||||
GtkRequisition widget_req;
|
GtkRequisition widget_req;
|
||||||
KatzePopupInfo* info = user_data;
|
KatzePopupInfo* info = user_data;
|
||||||
GtkWidget* widget = info->widget;
|
GtkWidget* widget = info->widget;
|
||||||
|
GdkWindow* window = gtk_widget_get_window (widget);
|
||||||
gint widget_height;
|
gint widget_height;
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION (3, 0, 0)
|
||||||
|
if (GTK_IS_ENTRY (widget))
|
||||||
|
window = gdk_window_get_parent (window);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Retrieve size and position of both widget and menu */
|
/* Retrieve size and position of both widget and menu */
|
||||||
if (!gtk_widget_get_has_window (widget))
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
{
|
gdk_window_get_origin (window, &wx, &wy);
|
||||||
gdk_window_get_position (gtk_widget_get_window (widget), &wx, &wy);
|
|
||||||
wx += allocation.x;
|
wx += allocation.x;
|
||||||
wy += allocation.y;
|
wy += allocation.y;
|
||||||
}
|
#if GTK_CHECK_VERSION (3, 0, 0)
|
||||||
else
|
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL);
|
||||||
gdk_window_get_origin (gtk_widget_get_window (widget), &wx, &wy);
|
gtk_widget_get_preferred_size (widget, &widget_req, NULL);
|
||||||
|
#else
|
||||||
gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
|
gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
|
||||||
gtk_widget_size_request (widget, &widget_req);
|
gtk_widget_size_request (widget, &widget_req);
|
||||||
|
#endif
|
||||||
menu_width = menu_req.width;
|
menu_width = menu_req.width;
|
||||||
widget_height = widget_req.height; /* Better than allocation.height */
|
widget_height = widget_req.height; /* Better than allocation.height */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue