Le 18/03/2013 16:26, יוסף אור בוצ'קו a écrit :
>
> Attachment: [PATCH] GTK3 support for Addons
>
>
> Yosef Or
>
> Boczko
>
> [...]
>
> From af63bd8d40ef8d28dda4a85c3ee519ac1a5876fb Mon Sep 17 00:00:00 2001
> From: Yosef Or Boczko <yosefor3(a)walla.com>
> Date: Mon, 18 Mar 2013 17:21:04 +0200
> Subject: [PATCH] GTK3 support for Addons
>
> ---
> addons/src/ao_doclist.c | 15 ++++++++++++---
> build/addons.m4 | 6 +++++-
> 2 files changed, 17 insertions(+), 4 deletions(-)>
>
> diff --git a/addons/src/ao_doclist.c b/addons/src/ao_doclist.c
> index 16a5ffa..1311ac8 100644
> --- a/addons/src/ao_doclist.c
> +++ b/addons/src/ao_doclist.c
> @@ -126,15 +126,24 @@ static void ao_popup_position_menu(GtkMenu *menu, gint *x, gint *y, gboolean *pu
> 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))
This looks wrong, like the opposite.
And gtk_widget_get_has_window() is only available with GTK >= 2.18.
> {
> - gdk_window_get_position(widget->window, &wx, &wy);
> + gdk_window_get_position(gtk_widget_get_parent_window(widget), &wx, &wy);
Looks like it should be gtk_widget_get_window() not get_parent_window()
which does a very different thing.
> +#if GTK_CHECK_VERSION(3, 0, 0)
> + wx += gtk_widget_get_allocated_width(widget);
> + wy += gtk_widget_get_allocated_height(widget);
> +#else
> wx += widget->allocation.x;
> wy += widget->allocation.y;
> +#endif
Both version doesn't look to do the same at all, the GTK2 version uses
the coordinates while the GTK3 one uses the dimensions.
> }
> else
> - gdk_window_get_origin(widget->window, &wx, &wy);
> + gdk_window_get_origin(gtk_widget_get_parent_window(widget), &wx, &wy);
Same as above.
> +#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 */
> diff --git a/build/addons.m4 b/build/addons.m4
> index e668612..3b136ea 100644
> --- a/build/addons.m4
> +++ b/build/addons.m4
> @@ -1,8 +1,12 @@
> AC_DEFUN([GP_CHECK_ADDONS],
> [
> GP_ARG_DISABLE([Addons], [auto])
> - GP_CHECK_PLUGIN_GTK2_ONLY([Addons])
> +
> + GP_CHECK_PLUGIN_DEPS([Addons], [ADDONS],
> + [$GP_GTK_PACKAGE >= 2.16])
> +
No need to check for the GTK version only to get build under GTK3, just
drop the GP_CHECK_PLUGIN_GTK2_ONLY() call.
> GP_COMMIT_PLUGIN_STATUS([Addons])
> +
> AC_CONFIG_FILES([
> addons/Makefile
> addons/src/Makefile
> -- 1.8.2