Skip to content

Commit

Permalink
Merge pull request #271 from eht16/addons_gtk3_fix
Browse files Browse the repository at this point in the history
Replace deprecated GTK2 API to fix compilation against GTK3
  • Loading branch information
frlan committed Jul 25, 2015
2 parents f573148 + e619d8a commit 4b01b16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 12 additions & 5 deletions addons/src/ao_doclist.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,25 @@ static void ao_popup_position_menu(GtkMenu *menu, gint *x, gint *y, gboolean *pu
gint wx, wy;
GtkRequisition widget_req;
GtkWidget *widget = data;
GdkWindow *window = gtk_widget_get_window(widget);
gint widget_height;

/* Retrieve size and position of both widget and menu */
if (GTK_WIDGET_NO_WINDOW(widget))
if (! gtk_widget_get_has_window(widget))
{
gdk_window_get_position(widget->window, &wx, &wy);
wx += widget->allocation.x;
wy += widget->allocation.y;
GtkAllocation allocation;
gdk_window_get_position(window, &wx, &wy);
gtk_widget_get_allocation(widget, &allocation);
wx += allocation.x;
wy += allocation.y;
}
else
gdk_window_get_origin(widget->window, &wx, &wy);
gdk_window_get_origin(window, &wx, &wy);
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_preferred_size(widget, &widget_req, NULL);
#else
gtk_widget_size_request(widget, &widget_req);
#endif
widget_height = widget_req.height; /* Better than allocation.height */

/* Calculate menu position */
Expand Down
1 change: 0 additions & 1 deletion build/addons.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
AC_DEFUN([GP_CHECK_ADDONS],
[
GP_ARG_DISABLE([Addons], [auto])
GP_CHECK_PLUGIN_GTK2_ONLY([Addons])
GP_COMMIT_PLUGIN_STATUS([Addons])
AC_CONFIG_FILES([
addons/Makefile
Expand Down

0 comments on commit 4b01b16

Please sign in to comment.