gtk3: Update to 3.16.1. Build examples/demo/tests

This commit is contained in:
Alexpux
2015-04-09 13:54:55 +03:00
parent f44fa161e9
commit 044da37bf4
2 changed files with 4 additions and 247 deletions

View File

@@ -1,243 +0,0 @@
From 213a66f27f5a2a09ecc49e45ec82de7aaf059eae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Tue, 9 Sep 2014 14:49:05 +0000
Subject: [PATCH] Make reftest plugins W32-compatible
When a plugin is loaded, see if it has an initialization function.
If it does, call that function, passing snapshot API function table to it.
This way reftest plugins can be built without linking them to gtk-reftest
application (which provides snapshot inhibition API).
https://bugzilla.gnome.org/show_bug.cgi?id=736338
---
testsuite/reftests/Makefile.am | 6 ++-
testsuite/reftests/expand-expander.c | 6 +--
testsuite/reftests/gtk-reftest.c | 10 +++++
testsuite/reftests/libreftest.c | 47 ++++++++++++++++++++++
testsuite/reftests/libreftest.h | 38 +++++++++++++++++
.../{gtk-reftest.h => libreftest_private.h} | 10 ++---
6 files changed, 107 insertions(+), 10 deletions(-)
create mode 100644 testsuite/reftests/libreftest.c
create mode 100644 testsuite/reftests/libreftest.h
rename testsuite/reftests/{gtk-reftest.h => libreftest_private.h} (80%)
diff --git a/testsuite/reftests/Makefile.am b/testsuite/reftests/Makefile.am
index 0853a00..539dcf3 100644
--- a/testsuite/reftests/Makefile.am
+++ b/testsuite/reftests/Makefile.am
@@ -32,8 +32,7 @@ gtk_reftest_LDADD = \
$(NULL)
gtk_reftest_SOURCES = \
- gtk-reftest.c \
- gtk-reftest.h
+ gtk-reftest.c
clean-local:
rm -rf output/ || true
@@ -445,6 +444,9 @@ libreftest_la_LDFLAGS += -avoid-version -module $(no_undefined)
libreftest_la_CFLAGS = $(gtk_reftest_CFLAGS)
libreftest_la_LIBADD = $(gtk_reftest_LDADD)
libreftest_la_SOURCES = \
+ libreftest.c \
+ libreftest_private.h \
+ libreftest.h \
expand-expander.c \
set-default-direction.c \
statusbar-remove-all.c \
diff --git a/testsuite/reftests/expand-expander.c b/testsuite/reftests/expand-expander.c
index 0bb4d9d..1b8ad2b 100644
--- a/testsuite/reftests/expand-expander.c
+++ b/testsuite/reftests/expand-expander.c
@@ -22,19 +22,19 @@
#include <gtk/gtk.h>
-#include "gtk-reftest.h"
+#include "libreftest_private.h"
static gboolean
unblock (gpointer data)
{
- reftest_uninhibit_snapshot ();
+ libreftest_uninhibit_snapshot ();
return G_SOURCE_REMOVE;
}
G_MODULE_EXPORT void
expand_expander (GtkWidget *widget)
{
- reftest_inhibit_snapshot ();
+ libreftest_inhibit_snapshot ();
gtk_expander_set_expanded (GTK_EXPANDER (widget), TRUE);
g_timeout_add (500, unblock, NULL);
}
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index ed0e634..6da068a 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "reftest-module.h"
+#include "libreftest.h"
#include <string.h>
#include <glib/gstdio.h>
@@ -256,6 +257,11 @@ reftest_uninhibit_snapshot (void)
g_idle_add (quit_when_idle, loop);
}
+reftest_api api = {
+ .reftest_inhibit_snapshot = reftest_inhibit_snapshot,
+ .reftest_uninhibit_snapshot = reftest_uninhibit_snapshot
+};
+
static void
check_for_draw (GdkEvent *event, gpointer data)
{
@@ -351,6 +357,7 @@ connect_signals (GtkBuilder *builder,
ReftestModule *module;
const char *directory;
GCallback func;
+ reftest_plugin_init_func init_func;
GClosure *closure;
char **split;
@@ -397,6 +404,9 @@ connect_signals (GtkBuilder *builder,
g_error ("failed to lookup handler for name '%s' in module '%s'", split[1], split[0]);
return;
}
+ init_func = (reftest_plugin_init_func) reftest_module_lookup (module, "reftest_plugin_init");
+ if (init_func)
+ init_func (&api);
break;
default:
g_error ("Could not connect signal handler named '%s'", handler_name);
diff --git a/testsuite/reftests/libreftest.c b/testsuite/reftests/libreftest.c
new file mode 100644
index 0000000..78eba95
--- /dev/null
+++ b/testsuite/reftests/libreftest.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Red Hat Inc.
+ *
+ * Author:
+ * Matthias Clasen <mclasen@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "libreftest.h"
+
+static reftest_api api;
+
+void
+libreftest_inhibit_snapshot (void)
+{
+ if (api.reftest_inhibit_snapshot)
+ api.reftest_inhibit_snapshot ();
+}
+
+void
+libreftest_uninhibit_snapshot (void)
+{
+ if (api.reftest_uninhibit_snapshot)
+ api.reftest_uninhibit_snapshot ();
+}
+
+G_MODULE_EXPORT void
+reftest_plugin_init (reftest_api *app_api)
+{
+ api = *app_api;
+}
diff --git a/testsuite/reftests/libreftest.h b/testsuite/reftests/libreftest.h
new file mode 100644
index 0000000..194703a
--- /dev/null
+++ b/testsuite/reftests/libreftest.h
@@ -0,0 +1,38 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LIBREFTEST_H__
+#define __LIBREFTEST_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef void (* reftest_inhibit_snapshot_func) (void);
+typedef void (* reftest_uninhibit_snapshot_func) (void);
+
+typedef struct
+{
+ reftest_inhibit_snapshot_func reftest_inhibit_snapshot;
+ reftest_uninhibit_snapshot_func reftest_uninhibit_snapshot;
+} reftest_api;
+
+typedef void (* reftest_plugin_init_func) (reftest_api *api);
+
+G_END_DECLS
+
+#endif /* __LIBREFTEST_H__ */
diff --git a/testsuite/reftests/gtk-reftest.h b/testsuite/reftests/libreftest_private.h
similarity index 80%
rename from testsuite/reftests/gtk-reftest.h
rename to testsuite/reftests/libreftest_private.h
index aa527b6..4359cf7 100644
--- a/testsuite/reftests/gtk-reftest.h
+++ b/testsuite/reftests/libreftest_private.h
@@ -15,14 +15,14 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __GTK_REFTEST_H__
-#define __GTK_REFTEST_H__
+#ifndef __LIBREFTEST_PRIVATE_H__
+#define __LIBREFTEST_PRIVATE_H__
G_BEGIN_DECLS
-void reftest_inhibit_snapshot (void);
-void reftest_uninhibit_snapshot (void);
+void libreftest_inhibit_snapshot (void);
+void libreftest_uninhibit_snapshot (void);
G_END_DECLS
-#endif /* __GTK_REFTEST_H__ */
+#endif /* __LIBREFTEST_PRIVATE_H__ */
--
1.8.5.3

View File

@@ -2,8 +2,8 @@
_realname=gtk3
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.16.0
pkgrel=2
pkgver=3.16.1
pkgrel=1
pkgdesc="GObject-based multi-platform GUI toolkit (v3) (mingw-w64)"
arch=('any')
url="http://www.gtk.org"
@@ -36,7 +36,7 @@ source=("http://ftp.gnome.org/pub/gnome/sources/gtk+/${pkgver%.*}/gtk+-${pkgver}
0055-skip-testsuite.all.patch
Make-reftest-plugins-W32-compatible.patch
do-not-check-xgettext.patch)
md5sums=('11c97ce2527956e0ddb5ad5b236e4572'
md5sums=('7458661889a718f93b46cb44b677cc41'
'9e0296da2986be7697cf343563b85d1f'
'21789d52c1debcab59f8b6a99232de68'
'3aa19ea25cc1d7693ae57f8e80f88440'
@@ -53,7 +53,7 @@ prepare() {
patch -Np1 -i "${srcdir}"/0035-enable-rgba-w32-windows.all.patch
patch -Np1 -i "${srcdir}"/0037-W32-better-dwm-loading-and-support-dwm-detection.all.patch
patch -Np1 -i "${srcdir}"/0054-no-transparency-for-children.all.patch
patch -Np1 -i "${srcdir}"/0055-skip-testsuite.all.patch
#patch -Np1 -i "${srcdir}"/0055-skip-testsuite.all.patch
#patch -Np1 -i "${srcdir}"/Make-reftest-plugins-W32-compatible.patch
patch -Np1 -i "${srcdir}"/do-not-check-xgettext.patch