[geany/geany-osx] cabab4: Add the "patches" directory from gtk-osx

Jiří Techet git-noreply at xxxxx
Fri Oct 29 20:13:18 UTC 2021


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 29 Oct 2021 20:13:18 UTC
Commit:      cabab45d898b08058a8a773a3ed73842d13d60f7
             https://github.com/geany/geany-osx/commit/cabab45d898b08058a8a773a3ed73842d13d60f7

Log Message:
-----------
Add the "patches" directory from gtk-osx


Modified Paths:
--------------
    README.md
    patches/0001-Add-G_GNUC_PRINTF-on-all-functions-with-format-strin.patch
    patches/0001-Bug-571582-GtkSelection-implementation-for-quartz.patch
    patches/0001-Bug-667759-gtkdnd-quartz.c-is-missing-annotations-fo.patch
    patches/0001-Bug-670373-gtk2-modules-printing-cups-gtkprintbackendcups.patch
    patches/0001-Bug-670373-gtk3-modules-printing-cups-gtkprintbackendcups.patch
    patches/0001-Bug-702516-Make-Werror-format-nonliteral-happy.patch
    patches/0001-Bug-707945-GTK2-Quartz-typeahead-find-in-GtkTreeView.patch
    patches/0001-Bug-708998-Avoid-infinite-loop.patch
    patches/0001-Bug-709939-quartz-window-pos.patch
    patches/0001-Enable-use-of-XDG_DATA_DIRS-for-locating-iso-code-fi.patch
    patches/0001-Fix-DnD-Introspection-on-Quartz-Backend.patch
    patches/0001-Fix-relative-module-paths.patch
    patches/0001-Make-ATSUI-backend-compile-again.patch
    patches/0001-Patch-Orbit-2.14.19-to-master-for-current-GLib.patch
    patches/0001-Prevent-WebKitWebProcess-from-being-in-the-dock-or-p.patch
    patches/0001-Restore-gl_GLIBC21-to-configure-needed-for-libcharse.patch
    patches/0001-quartz-Fix-the-32-bits-build-on-MacOSX-10.7.patch
    patches/0001-scanner-split-CC-environment-variable.patch
    patches/0002-gtk2-Extract-reasons-and-reasons_desc-arrays-to-file-leve.patch
    patches/0002-gtk3-Extract-reasons-and-reasons_desc-arrays-to-file-leve.patch
    patches/0003-Fix-double-free-introduced-in-f86dc163.patch
    patches/0003-gtk2-Create-enum-PrinterStateLevel.patch
    patches/0003-gtk3-Create-enum-PrinterStateLevel.patch
    patches/0003-quartz-NULL-check-on-default-keymap.patch
    patches/0004-Bug-571582-GtkSelection-implementation-for-quartz.patch
    patches/0004-Ensure-src-and-dest-are-GdkWindows-in-_gdk_sythesize.patch
    patches/0004-gtk2-Extract-printer-setup-variables-into-a-struct.patch
    patches/0004-gtk3-Extract-printer-setup-variables-into-a-struct.patch
    patches/0005-gtk2-Extract-function-cups_printer_handle_attribute.patch
    patches/0005-gtk3-Extract-function-cups_printer_handle_attribute.patch
    patches/0006-Bug-658722-Drag-and-Drop-sometimes-stops-working.patch
    patches/0006-gtk2-Extract-Function-cups_create_printer.patch
    patches/0006-gtk3-Extract-Function-cups_create_printer.patch
    patches/0007-gtk2-Move-some-variable-declarations-into-the-scopes-in-w.patch
    patches/0007-gtk3-Move-some-variable-declarations-into-the-scopes-in-w.patch
    patches/0008-Bug-670373-gtk2-modules-printing-cups-gtkprintbackendcups.patch
    patches/0008-Bug-670373-gtk3-modules-printing-cups-gtkprintbackendcups.patch
    patches/0008-Implement-GtkDragSourceOwner-pasteboardChangedOwner.patch
    patches/0009-Bug-670373-gtk2-modules-printing-cups-gtkprintbackendcups.patch
    patches/0009-Bug-670373-gtk3-modules-printing-cups-gtkprintbackendcups.patch
    patches/Bug-555525-plug-ins-twain-tw_mac.c.patch
    patches/Bug-673403-replace-values_h.patch
    patches/Cairo-44584-llvm-no-flto.patch
    patches/Cairo-quartz-surface-create-internal.patch
    patches/GConf-characters.patch
    patches/Glade-3-8-Bug-663492-Update-Mac-integration-bindings-to-.patch
    patches/Glade-3-8-Mac-Integration-Fix-up-menu-accelerators-for-Mac.patch
    patches/Glade-master-Bug-663492-Update-Mac-integration-bindings-to-.patch
    patches/Glade-master-Mac-Integration-Fix-up-menu-accelerators-for-Mac.patch
    patches/Gtk3-24-1-Handle-NULL-NSGraphicsContext-currentContext.patch
    patches/Gtk3-24-1-Update-GDK_OSX-versions-to-current-MacOS-release.patch
    patches/Gtk3-24-1-Use-NSGraphicsContext-CGContext-instead-of-graphicsP.patch
    patches/Gtk3-24-1-quartz-do-not-cache-the-screen-in-the-gdkmonitor.patch
    patches/Python3.6-stack-size-flag.patch
    patches/Quartz-version-detection-for-macOS-12.patch
    patches/WebKit-2.16.1-Bug-167343-wtf-unicode-UTF8.h.patch
    patches/WebKit-2.4.11-fixups.patch
    patches/WebKit2Gtk3-2.30.0-cumulative.patch
    patches/WebKit2Gtk3-2.30.1-Disable-AUDIT_TOKEN-for-Gtk-builds.patch
    patches/WebKit2Gtk3-2.30.1-Disable-WebKitGenericCueAPIEnabled.patch
    patches/WebKit2Gtk3-2.30.1-Extend-UNIX_DOMAIN_SOCKETS-precedence-over-Mac-and-Win.patch
    patches/WebKit2Gtk3-2.30.1-Fix-Socket-signal-defines-for-Darwin-and-maybe-BSD.patch
    patches/WebKit2Gtk3-2.30.1-Force-FindICU-instead-of-inserting-heade.patch
    patches/WebKit2Gtk3-2.30.2-GUniquePtrGtk.patch
    patches/WebKit2Gtk3-2.30.2-Prevent-WebKitWebProcess-from-being-in-.patch
    patches/WebKit2Gtk3-2.32.0-color-components-correct-math-header.patch
    patches/WebKit2Gtk3-2.32.0-cumulative.patch
    patches/Webkit-2.16-Fix-some-includes.patch
    patches/Webkit-2.16-build-without-OpenGL.patch
    patches/amtk-build-on-macOS.patch
    patches/bug-92264-webkit-bison-2.6.patch
    patches/cairo-freetype-font-variations.patch
    patches/cairo-image-refcount.patch
    patches/cairomm-Bug-100894-Cairomm-compile-failure-if-no-cairo-ft.patch
    patches/cmake-libnetwork.patch
    patches/delete-gnetworking.h.patch
    patches/devhelp-3-build-on-macOS.patch
    patches/devhelp-646962-variable-name.patch
    patches/devhelp-663789-gtkosxapplication.patch
    patches/enchant-env.patch
    patches/enchant-gsize.patch
    patches/faad2-2.7-ac-config-headers.patch
    patches/firefox78-rust-manifest-and-max-sdk.patch
    patches/freetype-2.5.3-ccexe_cflags.patch
    patches/freetype-install-name.patch
    patches/frodo-getopt-autotools.patch
    patches/gdk-pixbuf-loader-name.patch
    patches/gi_cairo_library_path.patch
    patches/girscanner-objc.patch
    patches/gjs-remove-js::CodeCoverage.patch
    patches/glade-1-18.patch
    patches/glade-3.22.1-xslproc.patch
    patches/glib-2.52-Fallback-to-CFStringGetCSTring-if-CFStringGetC.patch
    patches/glib-gint64-long-long.patch
    patches/glib-iconv.patch
    patches/glibmm-Bug-781947-Build-fails-on-MacOS-because-glib-doesn-t.patch
    patches/gnutls-yes-weak-imports.patch
    patches/gobject-introspection-625195-Fix-non-libtool-linker-flags-on-Darwin.patch
    patches/graphviz-remove-rpath.patch
    patches/gtk+-2-m4-creation.patch
    patches/gtk+-Bug-655065-Better-Fix.patch
    patches/gtk+-scale-absolute-value.patch
    patches/gtk-3.14-GDesktopAppInfo-not-implemented-on-Mac.patch
    patches/gtk-3.14-stylecontext-unnecessary-assert.patch
    patches/gtk-gimp-dnd-bug767091.patch
    patches/gtk-mac-integration-work-around-svg-locale-bug.patch
    patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch
    patches/gtk3-14-get-scale-factor.patch
    patches/gtk3-14-gtkdesktop.patch
    patches/gtk3-quartz-3-24-7-fixes.patch
    patches/gtkmm-3-bad-const-property-background.patch
    patches/gtksourceview-664511-gtkosxapplication.patch
    patches/gtksourceview3-664511-gtkosxapplication.patch
    patches/gtksourceview3-664679-backends.patch
    patches/gtkspell-3-install.sh-wrong-sh-path.patch
    patches/guild-shell.patch
    patches/guile-clocktime.patch
    patches/guile20-align-fix.patch
    patches/harfbuzz-kCTTypesetterOptionForcedEmbeddingLevel-Leopard.patch
    patches/itstool-config-python.patch
    patches/itstool-memory-management.patch
    patches/libgcrypt-cflags-for-cc-for-build.patch
    patches/libglade-gmodule.patch
    patches/libgpg-error-cflags-for-cc-for-build.patch
    patches/libnettle-cc-for-build-needs-cflags.patch
    patches/libnettle-cc-for-build-return.patch
    patches/liboil-use-ac-config-headers-macro.patch
    patches/libsoup-python.patch
    patches/libtasn1-inline-fix.patch
    patches/libunique-663913-sockaddr-un.patch
    patches/libxml2.9.10-conditional-parentheses.patch
    patches/p11-kit-dirfd.patch
    patches/patch status
    patches/patch-bundle-link-webcore.diff
    patches/patch-webkit2gtk-2282-os-log-availability.diff
    patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff
    patches/patch-webkit2gtk-272-macports.diff
    patches/patch-webkit2gtk-macports.diff
    patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch
    patches/pygobject-gdesktopappinfo-missing.patch
    patches/pygtk-libtool.patch
    patches/pygtk-pango-decls.patch
    patches/pygtk-pango1.4x.patch
    patches/python-issue27806_v3.patch
    patches/python-ldflags.patch
    patches/python2-linkflags.patch
    patches/python2-test_grammar.py-typo.patch
    patches/python2-xcode-stubs.patch
    patches/ragel-6.9-setiosflags.patch
    patches/ragel-configure.in.patch
    patches/tiff-nohtml.patch
    patches/vasnprintf.patch
    patches/webkit-133293-cfi-clang-failure.patch
    patches/webkit-140167-disable-netscape-api.patch
    patches/webkit-2.16-No-stringview-lifetime.patch
    patches/webkit-2.16-main-thread.patch
    patches/webkit-clang-fixes.patch
    patches/webkit-disable-apple-icu.patch
    patches/xmlto-allow-net-access.patch

Modified: README.md
10 lines changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -29,11 +29,11 @@ A brief description of the contents of the project directory:
 *	*Papirus, Papirus-Dark*: Papirus GTK 3 icon theme with lots of unneeded
 	icons removed to save space.
 *	*iconbuilder.iconset*: source Geany icons for the bundle.
-*	*modulesets-stable*: copy of the modulesets-stable directory from
-	the [gtk-osx](https://gitlab.gnome.org/GNOME/gtk-osx/) project containing
-	dependency specifications. Since the upstram project is in a constant
-	state of flux and fails to build frequently, this allows us to make
-	a snapshot of a working configuration for our build.
+*	*modulesets-stable, patches*: copy of the modulesets-stable and patches 
+    directory from the [gtk-osx](https://gitlab.gnome.org/GNOME/gtk-osx/)
+	project containing dependency specifications. Since the upstram project 
+	is sometimes in an unstable state, this allows us to make a snapshot of
+	a working configuration for our build.
 *	*geany_patches*: various patches fixing dependencies to enable bundling.
 *	*utils*: various utility scripts.
 


Modified: patches/0001-Add-G_GNUC_PRINTF-on-all-functions-with-format-strin.patch
387 lines changed, 387 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,387 @@
+From 0955160e15ec303d4d3f6a56bd424c68a41b0a54 Mon Sep 17 00:00:00 2001
+From: Henrique Dante de Almeida <hdante at gmail.com>
+Date: Sun, 13 Jan 2013 14:05:14 -0200
+Subject: [PATCH] Add G_GNUC_PRINTF on all functions with format strings
+
+This allows compilation with clang wihtout errors, even
+when -Wformat-nonliteral is active (as long as there are
+no real cases of non literal formatting).
+
+https://bugzilla.gnome.org/show_bug.cgi?id=691608
+---
+ gio/gdbusauth.c              |    1 +
+ gio/gdbusauthmechanismsha1.c |    1 +
+ gio/gdbusdaemon.c            |    1 +
+ gio/gdbuserror.h             |    4 ++--
+ gio/gdbusmessage.c           |    1 +
+ gio/gdbusmethodinvocation.h  |    5 +++--
+ gio/gsimpleasyncresult.h     |    5 +++--
+ gio/gtask.h                  |    2 +-
+ glib/gerror.c                |    1 +
+ glib/gerror.h                |    2 +-
+ glib/gmarkup.c               |    2 ++
+ glib/gmarkup.h               |    2 +-
+ glib/gmessages.h             |    4 ++--
+ glib/gprintf.h               |    8 ++++----
+ glib/gstrfuncs.h             |    3 ++-
+ glib/gstring.h               |    6 ++++--
+ glib/gutils.h                |    3 ++-
+ glib/gvariant-parser.c       |    4 ++++
+ glib/tests/markup-escape.c   |    1 +
+ glib/tests/string.c          |    1 +
+ glib/tests/test-printf.c     |    1 +
+ 21 files changed, 39 insertions(+), 19 deletions(-)
+
+diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c
+index 962a218..dd4cc2c 100644
+--- a/gio/gdbusauth.c
++++ b/gio/gdbusauth.c
+@@ -46,6 +46,7 @@
+ 
+ #include "glibintl.h"
+ 
++G_GNUC_PRINTF(1, 2)
+ static void
+ debug_print (const gchar *message, ...)
+ {
+diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
+index 4729208..5e8b6c0 100644
+--- a/gio/gdbusauthmechanismsha1.c
++++ b/gio/gdbusauthmechanismsha1.c
+@@ -469,6 +469,7 @@ keyring_lookup_entry (const gchar  *cookie_context,
+ }
+ 
+ /* function for logging important events that the system administrator should take notice of */
++G_GNUC_PRINTF(1, 2)
+ static void
+ _log (const gchar *message,
+       ...)
+diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c
+index 35a724c..2393771 100644
+--- a/gio/gdbusdaemon.c
++++ b/gio/gdbusdaemon.c
+@@ -1346,6 +1346,7 @@ handle_start_service_by_name (_GFreedesktopDBus *object,
+   return TRUE;
+ }
+ 
++G_GNUC_PRINTF(5, 6)
+ static void
+ return_error (Client *client, GDBusMessage *message,
+ 	      GQuark                 domain,
+diff --git a/gio/gdbuserror.h b/gio/gdbuserror.h
+index d32b928..c1d3e9c 100644
+--- a/gio/gdbuserror.h
++++ b/gio/gdbuserror.h
+@@ -87,12 +87,12 @@ void     g_dbus_error_set_dbus_error        (GError         **error,
+                                              const gchar     *dbus_error_name,
+                                              const gchar     *dbus_error_message,
+                                              const gchar     *format,
+-                                             ...);
++                                             ...) G_GNUC_PRINTF(4, 5);
+ void     g_dbus_error_set_dbus_error_valist (GError         **error,
+                                              const gchar     *dbus_error_name,
+                                              const gchar     *dbus_error_message,
+                                              const gchar     *format,
+-                                             va_list          var_args);
++                                             va_list          var_args) G_GNUC_PRINTF(4, 0);
+ gchar   *g_dbus_error_encode_gerror         (const GError    *error);
+ 
+ G_END_DECLS
+diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
+index ecbc033..9181029 100644
+--- a/gio/gdbusmessage.c
++++ b/gio/gdbusmessage.c
+@@ -827,6 +827,7 @@ g_dbus_message_new_method_error_literal (GDBusMessage  *method_call_message,
+  *
+  * Since: 2.26
+  */
++G_GNUC_PRINTF(3, 0)
+ GDBusMessage *
+ g_dbus_message_new_method_error_valist (GDBusMessage             *method_call_message,
+                                         const gchar              *error_name,
+diff --git a/gio/gdbusmethodinvocation.h b/gio/gdbusmethodinvocation.h
+index 9146b21..29cfe63 100644
+--- a/gio/gdbusmethodinvocation.h
++++ b/gio/gdbusmethodinvocation.h
+@@ -55,12 +55,13 @@ void                   g_dbus_method_invocation_return_error         (GDBusMetho
+                                                                       GQuark                 domain,
+                                                                       gint                   code,
+                                                                       const gchar           *format,
+-                                                                      ...);
++                                                                      ...) G_GNUC_PRINTF(4, 5);
+ void                   g_dbus_method_invocation_return_error_valist  (GDBusMethodInvocation *invocation,
+                                                                       GQuark                 domain,
+                                                                       gint                   code,
+                                                                       const gchar           *format,
+-                                                                      va_list                var_args);
++                                                                      va_list                var_args)
++                                                                      G_GNUC_PRINTF(4, 0);
+ void                   g_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
+                                                                       GQuark                 domain,
+                                                                       gint                   code,
+diff --git a/gio/gsimpleasyncresult.h b/gio/gsimpleasyncresult.h
+index 6233369..1ea98f4 100644
+--- a/gio/gsimpleasyncresult.h
++++ b/gio/gsimpleasyncresult.h
+@@ -110,7 +110,8 @@ void                g_simple_async_result_set_error_va     (GSimpleAsyncResult
+ 							    GQuark                   domain,
+ 							    gint                     code,
+ 							    const char              *format,
+-							    va_list                  args);
++							    va_list                  args)
++							    G_GNUC_PRINTF(4, 0);
+ gboolean            g_simple_async_result_is_valid         (GAsyncResult            *result,
+                                                             GObject                 *source,
+                                                             gpointer                 source_tag);
+@@ -121,7 +122,7 @@ void g_simple_async_report_error_in_idle  (GObject            *object,
+ 					   GQuark              domain,
+ 					   gint                code,
+ 					   const char         *format,
+-					   ...);
++					   ...) G_GNUC_PRINTF(6, 7);
+ void g_simple_async_report_gerror_in_idle (GObject            *object,
+ 					   GAsyncReadyCallback callback,
+ 					   gpointer            user_data,
+diff --git a/gio/gtask.h b/gio/gtask.h
+index bb03226..d5a2d77 100644
+--- a/gio/gtask.h
++++ b/gio/gtask.h
+@@ -61,7 +61,7 @@ void          g_task_report_new_error      (gpointer             source_object,
+                                             GQuark               domain,
+                                             gint                 code,
+                                             const char          *format,
+-                                            ...);
++                                            ...) G_GNUC_PRINTF(7, 8);
+ 
+ GLIB_AVAILABLE_IN_2_36
+ void          g_task_set_task_data         (GTask               *task,
+diff --git a/glib/gerror.c b/glib/gerror.c
+index e6ce3c0..2adbdf8 100644
+--- a/glib/gerror.c
++++ b/glib/gerror.c
+@@ -645,6 +645,7 @@ g_clear_error (GError **err)
+     }
+ }
+ 
++G_GNUC_PRINTF(2, 0)
+ static void
+ g_error_add_prefix (gchar       **string,
+                     const gchar  *format,
+diff --git a/glib/gerror.h b/glib/gerror.h
+index f9020d6..8b5de28 100644
+--- a/glib/gerror.h
++++ b/glib/gerror.h
+@@ -60,7 +60,7 @@ GError*  g_error_new_literal   (GQuark         domain,
+ GError*  g_error_new_valist    (GQuark         domain,
+                                 gint           code,
+                                 const gchar   *format,
+-                                va_list        args);
++                                va_list        args) G_GNUC_PRINTF(3, 0);
+ 
+ void     g_error_free          (GError        *error);
+ GError*  g_error_copy          (const GError  *error);
+diff --git a/glib/gmarkup.c b/glib/gmarkup.c
+index 11f68de..bf7c008 100644
+--- a/glib/gmarkup.c
++++ b/glib/gmarkup.c
+@@ -403,6 +403,7 @@ set_error_literal (GMarkupParseContext  *context,
+   g_propagate_error (error, tmp_error);
+ }
+ 
++G_GNUC_PRINTF(4, 5)
+ static void
+ set_error (GMarkupParseContext  *context,
+            GError              **error,
+@@ -564,6 +565,7 @@ utf8_str (const gchar *utf8,
+   return buf;
+ }
+ 
++G_GNUC_PRINTF(5, 6)
+ static void
+ set_unescape_error (GMarkupParseContext  *context,
+                     GError              **error,
+diff --git a/glib/gmarkup.h b/glib/gmarkup.h
+index d26c2ad..d0eda4f 100644
+--- a/glib/gmarkup.h
++++ b/glib/gmarkup.h
+@@ -214,7 +214,7 @@ gchar* g_markup_escape_text (const gchar *text,
+ gchar *g_markup_printf_escaped (const char *format,
+ 				...) G_GNUC_PRINTF (1, 2);
+ gchar *g_markup_vprintf_escaped (const char *format,
+-				 va_list     args);
++				 va_list     args) G_GNUC_PRINTF(1, 0);
+ 
+ typedef enum
+ {
+diff --git a/glib/gmessages.h b/glib/gmessages.h
+index 777cda2..d0c1930 100644
+--- a/glib/gmessages.h
++++ b/glib/gmessages.h
+@@ -46,7 +46,7 @@ G_BEGIN_DECLS
+ /* calculate a string size, guaranteed to fit format + args.
+  */
+ gsize	g_printf_string_upper_bound (const gchar* format,
+-				     va_list	  args);
++				     va_list	  args) G_GNUC_PRINTF(1, 0);
+ 
+ /* Log level shift offset for user defined
+  * log levels (0-7 are used by GLib).
+@@ -101,7 +101,7 @@ void            g_log                   (const gchar    *log_domain,
+ void            g_logv                  (const gchar    *log_domain,
+                                          GLogLevelFlags  log_level,
+                                          const gchar    *format,
+-                                         va_list         args);
++                                         va_list         args) G_GNUC_PRINTF(3, 0);
+ GLogLevelFlags  g_log_set_fatal_mask    (const gchar    *log_domain,
+                                          GLogLevelFlags  fatal_mask);
+ GLogLevelFlags  g_log_set_always_fatal  (GLogLevelFlags  fatal_mask);
+diff --git a/glib/gprintf.h b/glib/gprintf.h
+index d96870f..2ed5ecc 100644
+--- a/glib/gprintf.h
++++ b/glib/gprintf.h
+@@ -36,16 +36,16 @@ gint                  g_sprintf   (gchar       *string,
+ 				   ...) G_GNUC_PRINTF (2, 3);
+ 
+ gint                  g_vprintf   (gchar const *format,
+-                                   va_list      args);
++                                   va_list      args) G_GNUC_PRINTF(1, 0);
+ gint                  g_vfprintf  (FILE        *file,
+ 				   gchar const *format,
+-				   va_list      args);
++				   va_list      args) G_GNUC_PRINTF(2, 0);
+ gint                  g_vsprintf  (gchar       *string,
+ 				   gchar const *format,
+-				   va_list      args);
++				   va_list      args) G_GNUC_PRINTF(2, 0);
+ gint                  g_vasprintf (gchar      **string,
+ 				   gchar const *format,
+-				   va_list      args);
++				   va_list      args) G_GNUC_PRINTF(2, 0);
+ 
+ G_END_DECLS
+ 
+diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h
+index 3142485..e0752d3 100644
+--- a/glib/gstrfuncs.h
++++ b/glib/gstrfuncs.h
+@@ -188,7 +188,8 @@ gchar*	              g_strdup	       (const gchar *str) G_GNUC_MALLOC;
+ gchar*	              g_strdup_printf  (const gchar *format,
+ 					...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC;
+ gchar*	              g_strdup_vprintf (const gchar *format,
+-					va_list      args) G_GNUC_MALLOC;
++					va_list      args) G_GNUC_PRINTF(1, 0)
++					G_GNUC_MALLOC;
+ gchar*	              g_strndup	       (const gchar *str,
+ 					gsize        n) G_GNUC_MALLOC;  
+ gchar*	              g_strnfill       (gsize        length,  
+diff --git a/glib/gstring.h b/glib/gstring.h
+index a97aa4e..c6a11ae 100644
+--- a/glib/gstring.h
++++ b/glib/gstring.h
+@@ -109,13 +109,15 @@ GString*     g_string_ascii_down        (GString         *string);
+ GString*     g_string_ascii_up          (GString         *string);
+ void         g_string_vprintf           (GString         *string,
+                                          const gchar     *format,
+-                                         va_list          args);
++                                         va_list          args)
++                                         G_GNUC_PRINTF(2, 0);
+ void         g_string_printf            (GString         *string,
+                                          const gchar     *format,
+                                          ...) G_GNUC_PRINTF (2, 3);
+ void         g_string_append_vprintf    (GString         *string,
+                                          const gchar     *format,
+-                                         va_list          args);
++                                         va_list          args)
++                                         G_GNUC_PRINTF(2, 0);
+ void         g_string_append_printf     (GString         *string,
+                                          const gchar     *format,
+                                          ...) G_GNUC_PRINTF (2, 3);
+diff --git a/glib/gutils.h b/glib/gutils.h
+index 8102f53..6c21bf7 100644
+--- a/glib/gutils.h
++++ b/glib/gutils.h
+@@ -187,7 +187,8 @@ gint                  g_snprintf           (gchar       *string,
+ gint                  g_vsnprintf          (gchar       *string,
+ 					    gulong       n,
+ 					    gchar const *format,
+-					    va_list      args);
++					    va_list      args)
++					    G_GNUC_PRINTF(3, 0);
+ 
+ void                  g_nullify_pointer    (gpointer    *nullify_location);
+ 
+diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
+index e2e85ab..d5c036a 100644
+--- a/glib/gvariant-parser.c
++++ b/glib/gvariant-parser.c
+@@ -78,6 +78,7 @@ typedef struct
+   gint start, end;
+ } SourceRef;
+ 
++G_GNUC_PRINTF(5, 0)
+ static void
+ parser_set_error_va (GError      **error,
+                      SourceRef    *location,
+@@ -105,6 +106,7 @@ parser_set_error_va (GError      **error,
+   g_string_free (msg, TRUE);
+ }
+ 
++G_GNUC_PRINTF(5, 6)
+ static void
+ parser_set_error (GError      **error,
+                   SourceRef    *location,
+@@ -130,6 +132,7 @@ typedef struct
+ } TokenStream;
+ 
+ 
++G_GNUC_PRINTF(5, 6)
+ static void
+ token_stream_set_error (TokenStream  *stream,
+                         GError      **error,
+@@ -525,6 +528,7 @@ ast_free (AST *ast)
+   ast->class->free (ast);
+ }
+ 
++G_GNUC_PRINTF(5, 6)
+ static void
+ ast_set_error (AST          *ast,
+                GError      **error,
+diff --git a/glib/tests/markup-escape.c b/glib/tests/markup-escape.c
+index 0cd90ef..b2de289 100644
+--- a/glib/tests/markup-escape.c
++++ b/glib/tests/markup-escape.c
+@@ -96,6 +96,7 @@ unichar_test (gconstpointer d)
+   escape_test (&t);
+ }
+ 
++G_GNUC_PRINTF(1, 3)
+ static void
+ test_format (const gchar *format,
+ 	     const gchar *expected,
+diff --git a/glib/tests/string.c b/glib/tests/string.c
+index 454574b..ba55d3d 100644
+--- a/glib/tests/string.c
++++ b/glib/tests/string.c
+@@ -106,6 +106,7 @@ test_string_new (void)
+   g_string_free (string2, TRUE);
+ }
+ 
++G_GNUC_PRINTF(2, 3)
+ static void
+ my_string_printf (GString     *string,
+                   const gchar *format,
+diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c
+index 10d0a1d..dbfc8fc 100644
+--- a/glib/tests/test-printf.c
++++ b/glib/tests/test-printf.c
+@@ -942,6 +942,7 @@ _Pragma ("GCC diagnostic pop")
+ #endif
+ }
+ 
++G_GNUC_PRINTF(1, 2)
+ static gsize
+ upper_bound (const gchar *format, ...)
+ {
+-- 
+1.7.10.4
+


Modified: patches/0001-Bug-571582-GtkSelection-implementation-for-quartz.patch
875 lines changed, 875 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,875 @@
+From 7385087cae85e14bce61f8effba0f04aab070592 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sun, 11 Sep 2011 16:08:22 -0700
+Subject: [PATCH] Bug 571582: GtkSelection implementation for quartz.
+
+---
+ gdk/quartz/gdkselection-quartz.c |   22 +-
+ gtk/Makefile.am                  |    4 +-
+ gtk/gtkselection-quartz.c        |  674 ++++++++++++++++++++++++++++++++++++++
+ gtk/gtkselection.c               |   14 +-
+ 4 files changed, 701 insertions(+), 13 deletions(-)
+ create mode 100644 gtk/gtkselection-quartz.c
+
+diff --git a/gdk/quartz/gdkselection-quartz.c b/gdk/quartz/gdkselection-quartz.c
+index 3accf32..f6048c8 100644
+--- a/gdk/quartz/gdkselection-quartz.c
++++ b/gdk/quartz/gdkselection-quartz.c
+@@ -32,7 +32,8 @@ _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
+                                          guint32     time,
+                                          gint        send_event)
+ {
+-  /* FIXME: Implement */
++  g_warning ("Not a valid interface on Quartz. Use GtkSelection.\n");
++  g_return_val_if_reached(TRUE);
+   return TRUE;
+ }
+ 
+@@ -40,7 +41,7 @@ GdkWindow*
+ _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
+                                          GdkAtom     selection)
+ {
+-  /* FIXME: Implement */
++ /* Quartz doesn't have an X-selection, so it doesn't have a gdk_selection. */
+   return NULL;
+ }
+ 
+@@ -51,7 +52,9 @@ _gdk_quartz_display_convert_selection (GdkDisplay *display,
+                                        GdkAtom     target,
+                                        guint32     time)
+ {
+-  /* FIXME: Implement */
++  g_warning ("Not a valid interface on Quartz. Use GtkSelection.\n");
++  g_return_if_reached();
++
+ }
+ 
+ gint
+@@ -61,7 +64,8 @@ _gdk_quartz_display_get_selection_property (GdkDisplay *display,
+                                             GdkAtom    *ret_type,
+                                             gint       *ret_format)
+ {
+-  /* FIXME: Implement */
++  g_warning ("Quartz windows do not support properties.\n");
++  g_return_val_if_reached (-1);
+   return 0;
+ }
+ 
+@@ -69,8 +73,8 @@ gchar *
+ _gdk_quartz_display_utf8_to_string_target (GdkDisplay  *display,
+                                            const gchar *str)
+ {
+-  /* FIXME: Implement */
+-  return NULL;
++  /* UTF8 is the standard string on OSX */
++  return g_strdup (str);
+ }
+ 
+ static gint
+@@ -90,7 +94,7 @@ make_list (const gchar  *text,
+   while (p < text + length)
+     {
+       gchar *str;
+-      
++
+       q = p;
+       while (*q && q < text + length)
+ 	q++;
+@@ -123,6 +127,8 @@ make_list (const gchar  *text,
+   if (list)
+     *list = g_new0 (gchar *, n_strings + 1);
+ 
++  (*list)[n_strings] = NULL;
++
+   i = n_strings;
+   tmp_list = strings;
+   while (tmp_list)
+@@ -163,7 +169,7 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay    *display,
+     {
+       gchar *enc_name = gdk_atom_name (encoding);
+ 
+-      g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);
++      g_warning ("gdk_text_property_to_utf8_list: encoding %s not handled\n", enc_name);
+       g_free (enc_name);
+ 
+       if (list)
+diff --git a/gtk/Makefile.am b/gtk/Makefile.am
+index 55d7f22..de81d57 100644
+--- a/gtk/Makefile.am
++++ b/gtk/Makefile.am
+@@ -798,7 +798,9 @@ if USE_QUARTZ
+ gtk_clipboard_dnd_c_sources = 	\
+ 	gtkclipboard-quartz.c	\
+ 	gtkdnd-quartz.c		\
+-	gtkquartz.c
++	gtkquartz.c		\
++	gtkselection-quartz.c
++
+ gtk_clipboard_dnd_h_sources = gtkquartz.h
+ else
+ gtk_clipboard_dnd_c_sources = gtkclipboard.c gtkdnd.c
+diff --git a/gtk/gtkselection-quartz.c b/gtk/gtkselection-quartz.c
+new file mode 100644
+index 0000000..1e948ad
+--- /dev/null
++++ b/gtk/gtkselection-quartz.c
+@@ -0,0 +1,674 @@
++/* GTK - The GIMP Toolkit
++ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
++ *
++ * 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, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++/* This file implements most of the work of the ICCCM selection protocol.
++ * The code was written after an intensive study of the equivalent part
++ * of John Ousterhout's Tk toolkit, and does many things in much the
++ * same way.
++ *
++ * The one thing in the ICCCM that isn't fully supported here (or in Tk)
++ * is side effects targets. For these to be handled properly, MULTIPLE
++ * targets need to be done in the order specified. This cannot be
++ * guaranteed with the way we do things, since if we are doing INCR
++ * transfers, the order will depend on the timing of the requestor.
++ *
++ * By Owen Taylor <owt1 at cornell.edu>	      8/16/97
++ */
++
++/* Terminology note: when not otherwise specified, the term "incr" below
++ * refers to the _sending_ part of the INCR protocol. The receiving
++ * portion is referred to just as "retrieval". (Terminology borrowed
++ * from Tk, because there is no good opposite to "retrieval" in English.
++ * "send" can't be made into a noun gracefully and we're already using
++ * "emission" for something else ....)
++ */
++
++/* The MOTIF entry widget seems to ask for the TARGETS target, then
++   (regardless of the reply) ask for the TEXT target. It's slightly
++   possible though that it somehow thinks we are responding negatively
++   to the TARGETS request, though I don't really think so ... */
++
++/*
++ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
++ * file for a list of people on the GTK+ Team.  See the ChangeLog
++ * files for a list of changes.  These files are distributed with
++ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
++ */
++
++#include "config.h"
++#include <stdarg.h>
++#include <string.h>
++#include "gdk.h"
++
++#include "gtkmain.h"
++#include "gtkselection.h"
++#include "gtkselectionprivate.h"
++#include "gtktextbufferrichtext.h"
++#include "gtkintl.h"
++#include "gdk-pixbuf/gdk-pixbuf.h"
++#include "gtkclipboard.h"
++
++#import <Cocoa/Cocoa.h>
++
++#undef DEBUG_SELECTION
++/*
++ * DON'T USE THIS INTERFACE: USE GTKCLIPBOARD INSTEAD!
++ *
++ * This is the Quartz version of gtkselection. Unlike the other
++ * versions, it was written in 2010, after most code was rewritten to
++ * use GtkClipboard. Quartz, unlike X11, is not a remote-capable
++ * display system, so most of ICCCM is pointless. This implementation
++ * can therefore be much simpler than the X11 implementation. Text is
++ * a lot simpler, too. It's UTF8. No compound text, no legacy
++ * charsets.  There's also only one display, so instead of passing it
++ * around, we'll generally just use gdk_display_get_default() when we
++ * need it.
++ *
++ * There are two constraints: The existing code in various GtkWidgets
++ * which uses GDK_SELECTION_CLIPBOARD (which gtkclipboard-quartz sets
++ * to generalPasteboard) for <ctrl>c copies and GDK_SELECTION_PRIMARY
++ * (for which gtkclipboard-quartz creates a separate pasteboard) for
++ * X-style selection transfers, and Apple's X11 Quartz implementation
++ * which by default puts both on the generalPasteboard. We need to
++ * operate with both.
++ *
++ * IMPORTANT: There is no X11 magic in quartz. If you insist on using
++ * this interface (and you really shouldn't), your MUST connect to
++ * selection-get, selection-received, and selection-clear-event for
++ * your widget.
++ */
++
++/* Maximum size of a sent chunk, in bytes. Also the default size of
++   our buffers */
++
++
++#define IDLE_ABORT_TIME 30
++
++enum {
++  INCR,
++  MULTIPLE,
++  TARGETS,
++  TIMESTAMP,
++  SAVE_TARGETS,
++  LAST_ATOM
++};
++
++typedef struct _GtkSelectionInfo GtkSelectionInfo;
++
++struct _GtkSelectionInfo
++{
++  GdkAtom	 selection;
++  GtkWidget	*owner;	/* widget that owns selection */
++  guint32	 time;		/* time used to acquire selection */
++};
++
++
++/* Local Functions */
++static void gtk_selection_get_cb            (GtkClipboard     *clipboard,
++					     GtkSelectionData *data,
++					     guint             info,
++					     gpointer          widget);
++static void gtk_selection_clear_cb          (GtkClipboard     *clipboard,
++					     gpointer 	       widget);
++static void gtk_selection_default_handler   (GtkWidget        *widget,
++					     GtkSelectionData *data);
++static int  gtk_selection_bytes_per_item    (gint              format);
++static GtkSelectionInfo *gtk_selection_info_get (GdkAtom selection);
++static void gtk_selection_info_remove		(GdkAtom selection,
++						 GtkWidget *owner);
++static void gtk_selection_info_append 		(GdkAtom selection,
++						 GtkWidget *owner,
++						 guint32 time);
++static void gtk_selection_info_clear		(GtkWidget *owner);
++static GtkTargetList *gtk_selection_target_list_get (GtkWidget    *widget,
++						     GdkAtom       selection);
++static void gtk_selection_target_list_remove 	    (GtkWidget *widget);
++
++/* Local Data */
++static gint initialize = TRUE;
++static GList *current_selections = NULL;
++
++static GdkAtom gtk_selection_atoms[LAST_ATOM];
++static const char gtk_selection_handler_key[] = "gtk-selection-handlers";
++
++static GtkTargetEntry default_target = {"UTF8_STRING", 0, 1};
++
++/**
++ * gtk_selection_owner_set_for_display:
++ * @display: the #Gdkdisplay where the selection is set
++ * @widget: (allow-none): new selection owner (a #GdkWidget), or %NULL.
++ * @selection: an interned atom representing the selection to claim.
++ * @time_: timestamp with which to claim the selection
++ *
++ * Claim ownership of a given selection for a particular widget, or,
++ * if @widget is %NULL, release ownership of the selection.
++ *
++ * Return value: TRUE if the operation succeeded
++ *
++ * Since: 2.2
++ */
++gboolean
++gtk_selection_owner_set_for_display (GdkDisplay   *display,
++				     GtkWidget    *widget,
++				     GdkAtom       selection,
++				     guint32       time)
++{
++  GObject *old_owner;
++  GtkClipboard *clip = gtk_clipboard_get (selection);
++  GtkTargetEntry *targets = &default_target;
++  gint num_targets = 1;
++  GtkTargetList *tlist;
++
++  g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
++  g_return_val_if_fail (selection != GDK_NONE, FALSE);
++
++  old_owner = gtk_clipboard_get_owner (clip);
++  if (old_owner)
++    gtk_selection_info_remove (selection, GTK_WIDGET(old_owner));
++
++  if (widget == NULL)
++    return TRUE;
++
++  g_return_val_if_fail (gtk_widget_get_display (widget) == display, FALSE);
++
++  if ((tlist = gtk_selection_target_list_get (widget, selection)) != NULL)
++      targets = gtk_target_table_new_from_list (tlist, &num_targets);
++
++  if (gtk_clipboard_set_with_owner (clip, targets, num_targets,
++				    gtk_selection_get_cb,
++				    gtk_selection_clear_cb,
++				    G_OBJECT (widget)))
++    {
++      gtk_selection_info_append (selection, widget, GDK_CURRENT_TIME);
++      return TRUE;
++    }
++  return FALSE;
++}
++
++
++typedef struct _GtkSelectionTargetList GtkSelectionTargetList;
++
++struct _GtkSelectionTargetList {
++  GdkAtom selection;
++  GtkTargetList *list;
++};
++
++/**
++ * gtk_selection_remove_all:
++ * @widget: a #GtkWidget
++ *
++ * Removes all handlers and unsets ownership of all
++ * selections for a widget. Called when widget is being
++ * destroyed. This function will not generally be
++ * called by applications.
++ **/
++void
++gtk_selection_remove_all (GtkWidget *widget)
++{
++  g_return_if_fail(widget == NULL || GTK_IS_WIDGET(widget));
++  gtk_selection_info_clear (widget);
++  /* Remove all selection lists */
++  gtk_selection_target_list_remove (widget);
++}
++
++
++/**
++ * gtk_selection_convert:
++ * @widget: The widget which acts as requestor
++ * @selection: Which selection to get
++ * @target: Form of information desired (e.g., STRING)
++ * @time_: Time of request (usually of triggering event)
++       In emergency, you could use #GDK_CURRENT_TIME
++ *
++ * Requests the contents of a selection. When received,
++ * a "selection-received" signal will be generated.
++ *
++ * Return value: %TRUE if requested succeeded. %FALSE if we could not process
++ *          request. (e.g., there was already a request in process for
++ *          this widget).
++ **/
++gboolean
++gtk_selection_convert (GtkWidget *widget,
++		       GdkAtom	  selection,
++		       GdkAtom	  target,
++		       guint32	  time_)
++{
++  GtkClipboard *clip = gtk_clipboard_get (selection);
++  GtkSelectionData *data;
++
++  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
++  g_return_val_if_fail (selection != GDK_NONE, FALSE);
++
++  data = gtk_clipboard_wait_for_contents (clip, target);
++  if (data == NULL)
++    return FALSE;
++
++  g_signal_emit_by_name (widget, "selection-received", data, time);
++
++  return TRUE;
++}
++
++
++/**
++ * _gtk_selection_clear:
++ * @widget: a #GtkWidget
++ * @event: the event
++ *
++ * The default handler for the #GtkWidget::selection-clear-event
++ * signal.
++ *
++ * Return value: %TRUE if the event was handled, otherwise false
++ **/
++gboolean
++_gtk_selection_clear (GtkWidget         *widget,
++		     GdkEventSelection *event)
++{
++  gtk_selection_clear_targets (widget, event->selection);
++  return FALSE;
++}
++
++
++/*************************************************************
++ * _gtk_selection_request:
++ *     Handler for "selection_request_event"
++ *   arguments:
++ *     widget:
++ *     event:
++ *   results:
++ *************************************************************/
++
++gboolean
++_gtk_selection_request (GtkWidget *widget,
++			GdkEventSelection *event)
++{
++  g_print ("Selection Request Events should not occur in quartz\n");
++  return TRUE;
++}
++
++/*************************************************************
++ * _gtk_selection_incr_event:
++ *     Called whenever an PropertyNotify event occurs for an
++ *     GdkWindow with user_data == NULL. These will be notifications
++ *     that a window we are sending the selection to via the
++ *     INCR protocol has deleted a property and is ready for
++ *     more data.
++ *
++ *   arguments:
++ *     window:	the requestor window
++ *     event:	the property event structure
++ *
++ *   results:
++ *************************************************************/
++
++gboolean
++_gtk_selection_incr_event (GdkWindow	   *window,
++			   GdkEventProperty *event)
++{
++  g_print ("Selection_INCR_Events should not occur in quartz\n");
++  return TRUE;
++}
++
++/*************************************************************
++ * _gtk_selection_notify:
++ *     Handler for "selection-notify-event" signals on windows
++ *     where a retrieval is currently in process. The selection
++ *     owner has responded to our conversion request.
++ *   arguments:
++ *     widget:		Widget getting signal
++ *     event:		Selection event structure
++ *     info:		Information about this retrieval
++ *   results:
++ *     was event handled?
++ *************************************************************/
++
++gboolean
++_gtk_selection_notify (GtkWidget	       *widget,
++		       GdkEventSelection *event)
++{
++  g_print ("Selection_Notifications should not occur in quartz\n");
++
++  return TRUE;
++}
++
++/*************************************************************
++ * _gtk_selection_property_notify:
++ *     Handler for "property-notify-event" signals on windows
++ *     where a retrieval is currently in process. The selection
++ *     owner has added more data.
++ *   arguments:
++ *     widget:		Widget getting signal
++ *     event:		Property event structure
++ *     info:		Information about this retrieval
++ *   results:
++ *     was event handled?
++ *************************************************************/
++
++gboolean
++_gtk_selection_property_notify (GtkWidget	*widget,
++				GdkEventProperty *event)
++{
++  g_print ("Selection_Property_Notifications should not occur in quartz\n");
++  return TRUE;
++}
++
++
++/*************************************************************
++ * gtk_selection_get_cb()
++ * @clipboard: The clipboard requesting the data
++ * @data: Pass to selection-get signal; handlers should put requested
++ * data in the structure pointed to.
++ * @info: DND uses this on Windows and X11. It can be ignored for
++ * normal selection use.
++ * @owner: The window to which the information request is sent; it's
++ * the owner set with gtk_selection_owner_set_for_display.
++ *
++ * Emits a signal to the owner window to fill in the provided data structure.
++ *************************************************************/
++/* GtkClipboardGetFunc */
++static void
++gtk_selection_get_cb (GtkClipboard* clipboard,
++		      GtkSelectionData *data,
++		      guint info,
++		      gpointer owner)
++{
++  GtkTargetList *target_list;
++  GtkWidget *widget = GTK_WIDGET (owner);
++
++
++  g_return_if_fail (widget != NULL);
++
++  target_list = gtk_selection_target_list_get (widget, data->selection);
++
++  if ( data->target == gtk_selection_atoms[TIMESTAMP] ||
++       data->target == gtk_selection_atoms[TARGETS] ||
++       data->target == gtk_selection_atoms[SAVE_TARGETS])
++    {
++      gtk_selection_default_handler (widget, data);
++      return;
++    }
++  if (target_list &&
++      gtk_target_list_find (target_list, data->target, &info))
++    {
++      g_signal_emit_by_name (widget,
++			     "selection-get",
++			     data,
++			     info, time);
++    }
++}
++
++static void
++gtk_selection_clear_cb (GtkClipboard* clipboard,
++			gpointer owner)
++{
++  GtkWidget *widget = GTK_WIDGET (owner);
++  GdkEventSelection event;
++  event.type = GDK_SELECTION_CLEAR;
++  event.selection = GDK_SELECTION_PRIMARY;
++  event.window = gtk_widget_get_window(widget);
++  g_signal_emit_by_name (widget,
++			 "selection-clear-event",
++			 &event,
++			 NULL);
++}
++
++/*************************************************************
++ * gtk_selection_default_handler:
++ *     Handles some default targets that exist for any widget
++ *     If it can't fit results into buffer, returns -1. This
++ *     won't happen in any conceivable case, since it would
++ *     require 1000 selection targets!
++ *
++ *   arguments:
++ *     widget:	    selection owner
++ *     data:	    selection data [INOUT]
++ *
++ *************************************************************/
++
++static void
++gtk_selection_default_handler (GtkWidget	*widget,
++			       GtkSelectionData *data)
++{
++  if (data->target == gtk_selection_atoms[TIMESTAMP])
++    {
++      /* Time which was used to obtain selection */
++      GList *tmp_list;
++      GtkSelectionInfo *selection_info;
++
++      tmp_list = current_selections;
++      while (tmp_list)
++	{
++	  selection_info = (GtkSelectionInfo *)tmp_list->data;
++	  if ((selection_info->owner == widget) &&
++	      (selection_info->selection == data->selection))
++	    {
++	      gulong time = selection_info->time;
++
++	      gtk_selection_data_set (data,
++				      GDK_SELECTION_TYPE_INTEGER,
++				      32,
++				      (guchar *)&time,
++				      sizeof (time));
++	      return;
++	    }
++
++	  tmp_list = tmp_list->next;
++	}
++
++      data->length = -1;
++    }
++  else if (data->target == gtk_selection_atoms[TARGETS])
++    {
++      /* List of all targets supported for this widget/selection pair */
++      GdkAtom *p;
++      guint count;
++      GList *tmp_list;
++      GtkTargetList *target_list;
++      GtkTargetPair *pair;
++
++      target_list = gtk_selection_target_list_get (widget,
++						   data->selection);
++      count = g_list_length (target_list->list) + 3;
++
++      data->type = GDK_SELECTION_TYPE_ATOM;
++      data->format = 32;
++      data->length = count * sizeof (GdkAtom);
++
++      /* selection data is always terminated by a trailing \0
++       */
++      p = g_malloc (data->length + 1);
++      data->data = (guchar *)p;
++      data->data[data->length] = '\0';
++
++      *p++ = gtk_selection_atoms[TIMESTAMP];
++      *p++ = gtk_selection_atoms[TARGETS];
++      *p++ = gtk_selection_atoms[MULTIPLE];
++
++      tmp_list = target_list->list;
++      while (tmp_list)
++	{
++	  pair = (GtkTargetPair *)tmp_list->data;
++	  *p++ = pair->target;
++
++	  tmp_list = tmp_list->next;
++	}
++    }
++  else if (data->target == gtk_selection_atoms[SAVE_TARGETS])
++    {
++      gtk_selection_data_set (data,
++			      gdk_atom_intern_static_string ("NULL"),
++			      32, NULL, 0);
++    }
++  else
++    {
++      data->length = -1;
++    }
++}
++
++static GtkSelectionInfo *
++gtk_selection_info_get (GdkAtom selection)
++{
++  GList *tmp_list;
++  GList *next;
++  GtkSelectionInfo *selection_info;
++
++  tmp_list = current_selections;
++  while (tmp_list)
++    {
++      next = tmp_list->next;
++      selection_info = (GtkSelectionInfo *)tmp_list->data;
++
++      if (selection_info->selection == selection)
++	{
++	  return selection_info;
++	}
++
++      tmp_list = next;
++    }
++  return NULL;
++}
++
++static void
++gtk_selection_info_remove (GdkAtom selection, GtkWidget *owner)
++{
++  GList *tmp_list;
++  GList *next;
++  GtkSelectionInfo *selection_info;
++
++  g_return_if_fail (GTK_IS_WIDGET (owner));
++
++  tmp_list = current_selections;
++  while (tmp_list)
++    {
++      next = tmp_list->next;
++      selection_info = (GtkSelectionInfo *)tmp_list->data;
++
++      if (selection_info->selection == selection &&
++	  selection_info->owner == owner)
++	{
++	  /* Clear the clipboard; this will send a changedOwner to the
++	     pasteboard so that it won't try to retrieve the
++	     still-pending types later when the window isn't around to
++	     provide them. */
++	  GtkClipboard *clip = gtk_clipboard_get(selection_info->selection);
++	  gtk_clipboard_clear(clip);
++	  current_selections = g_list_remove_link (current_selections,
++						   tmp_list);
++	  g_list_free (tmp_list);
++	  g_slice_free (GtkSelectionInfo, selection_info);
++	  return;
++	}
++
++      tmp_list = next;
++    }
++}
++static void
++gtk_selection_info_append (GdkAtom selection, GtkWidget *owner, guint32 time)
++{
++  GtkSelectionInfo *selection_info;
++
++  g_return_if_fail (GTK_IS_WIDGET (owner));
++
++  selection_info = g_slice_new (GtkSelectionInfo);
++  selection_info->selection = selection;
++  selection_info->owner = owner;
++  selection_info->time = time;
++  current_selections = g_list_prepend (current_selections,
++				       selection_info);
++}
++
++static void
++gtk_selection_info_clear (GtkWidget *owner)
++{
++  GList *tmp_list;
++  GList *next;
++  GtkSelectionInfo *selection_info;
++
++  g_return_if_fail (GTK_IS_WIDGET (owner));
++
++  tmp_list = current_selections;
++  while (tmp_list)
++    {
++      next = tmp_list->next;
++      selection_info = (GtkSelectionInfo *)tmp_list->data;
++
++      if (selection_info->owner == owner)
++	{
++	  current_selections = g_list_remove_link (current_selections,
++						   tmp_list);
++	  g_list_free (tmp_list);
++	  g_slice_free (GtkSelectionInfo, selection_info);
++	}
++
++      tmp_list = next;
++    }
++}
++
++static GtkTargetList *
++gtk_selection_target_list_get (GtkWidget    *widget,
++			       GdkAtom       selection)
++{
++  GtkSelectionTargetList *sellist;
++  GList *tmp_list;
++  GList *lists;
++
++  lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key);
++
++  tmp_list = lists;
++  while (tmp_list)
++    {
++      sellist = tmp_list->data;
++      if (sellist->selection == selection)
++	return sellist->list;
++      tmp_list = tmp_list->next;
++    }
++
++  sellist = g_slice_new (GtkSelectionTargetList);
++  sellist->selection = selection;
++  sellist->list = gtk_target_list_new (NULL, 0);
++
++  lists = g_list_prepend (lists, sellist);
++  g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), lists);
++
++  return sellist->list;
++}
++
++static void
++gtk_selection_target_list_remove (GtkWidget *widget)
++{
++  GtkSelectionTargetList *sellist;
++  GList *tmp_list;
++  GList *lists;
++
++  lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key);
++
++  tmp_list = lists;
++  while (tmp_list)
++    {
++      sellist = tmp_list->data;
++
++      gtk_target_list_unref (sellist->list);
++
++      g_slice_free (GtkSelectionTargetList, sellist);
++      tmp_list = tmp_list->next;
++    }
++
++  g_list_free (lists);
++  g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), NULL);
++}
++
+diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
+index 9e2295f..77bb934 100644
+--- a/gtk/gtkselection.c
++++ b/gtk/gtkselection.c
+@@ -661,6 +661,7 @@ gtk_target_table_free (GtkTargetEntry *targets,
+   g_free (targets);
+ }
+ 
++#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
+ /**
+  * gtk_selection_owner_set_for_display:
+  * @display: the #Gdkdisplay where the selection is set
+@@ -763,7 +764,7 @@ gtk_selection_owner_set_for_display (GdkDisplay   *display,
+   else
+     return FALSE;
+ }
+-
++#endif /* GDK_WINDOWING_QUARTZ */
+ /**
+  * gtk_selection_owner_set:
+  * @widget: (allow-none):  a #GtkWidget, or %NULL.
+@@ -965,7 +966,7 @@ gtk_selection_add_targets (GtkWidget            *widget,
+ #endif
+ }
+ 
+-
++#ifndef GDK_WINDOWING_QUARTZ /* Quartz is handled in gtkselection-quartz.c */
+ /**
+  * gtk_selection_remove_all:
+  * @widget: a #GtkWidget 
+@@ -1026,8 +1027,9 @@ gtk_selection_remove_all (GtkWidget *widget)
+   /* Remove all selection lists */
+   gtk_selection_target_list_remove (widget);
+ }
++#endif /* GDK_WINDOWING_QUARTZ */
+ 
+-
++#ifndef GDK_WINDOWING_QUARTZ /* Quartz is handled in gtkselection-quartz.c */
+ /**
+  * gtk_selection_convert:
+  * @widget: The widget which acts as requestor
+@@ -1138,7 +1140,7 @@ gtk_selection_convert (GtkWidget *widget,
+   
+   return TRUE;
+ }
+-
++#endif /* GDK_WINDOWING_QUARTZ */
+ /**
+  * gtk_selection_data_get_selection:
+  * @selection_data: a pointer to a #GtkSelectionData structure.
+@@ -2232,6 +2234,7 @@ gtk_selection_init (void)
+   initialize = FALSE;
+ }
+ 
++#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
+ /**
+  * _gtk_selection_clear:
+  * @widget: a #GtkWidget
+@@ -2652,6 +2655,7 @@ _gtk_selection_incr_event (GdkWindow	   *window,
+   
+   return TRUE;
+ }
++#endif /* GDK_WINDOWING_QUARTZ */
+ 
+ /*************************************************************
+  * gtk_selection_incr_timeout:
+@@ -2706,6 +2710,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
+   return retval;
+ }
+ 
++#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
+ /*************************************************************
+  * _gtk_selection_notify:
+  *     Handler for "selection-notify-event" signals on windows
+@@ -2904,6 +2909,7 @@ _gtk_selection_property_notify (GtkWidget	*widget,
+   
+   return TRUE;
+ }
++#endif /* GDK_WINDOWING_QUARTZ */
+ 
+ /*************************************************************
+  * gtk_selection_retrieval_timeout:
+-- 
+1.7.6.3.dirty
+


Modified: patches/0001-Bug-667759-gtkdnd-quartz.c-is-missing-annotations-fo.patch
47 lines changed, 47 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,47 @@
+From 4aebe6d4f08297066b231eee7aa15d33d8dd6d98 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Fri, 3 May 2013 10:31:47 -0700
+Subject: [PATCH] Bug 667759 - gtkdnd-quartz.c is missing annotations for
+ introspection
+
+Work around this by introspecting gtkclipboard.c and gtkdnd.c instead
+of the quartz alternatives.
+
+Note that this is temporary: The implementation of GdkSelection
+will make the quartz alternatives unnecessary. See bug 571582.
+---
+ gtk/Makefile.am | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/gtk/Makefile.am b/gtk/Makefile.am
+index 6e7bbf1..0b82797 100644
+--- a/gtk/Makefile.am
++++ b/gtk/Makefile.am
+@@ -1313,13 +1313,23 @@ LDADDS =								\
+ 	$(GTK_DEP_LIBS)
+ 
+ if HAVE_INTROSPECTION
++# The Quartz clipboard and dnd files aren't annotated for
++# introspection. Rather than copy the annotations over from the
++# regular files, exclude the quartz ones:
+ introspection_files = \
+-    $(filter-out %private.h gtktextdisplay.h gtktextlayout.h, $(gtkinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
++    $(filter-out %private.h gtktextdisplay.h gtktextlayout.h, $(gtkinclude_HEADERS) $(deprecatedinclude_HEADERS) gtkclipboard-quartz.c gtkdnd-quartz.c) \
+     $(gtk_base_c_sources) \
+     gtkprintoperation-unix.c \
+     gtktypebuiltins.h \
+     gtktypebuiltins.c
+ 
++# And include the regular ones:
++if USE_QUARTZ
++introspection_files += \
++    gtkclipboard.c \
++    gtkdnd.c
++endif
++
+ if USE_X11
+ introspection_files += \
+     gtksocket.c \
+-- 
+1.8.3.rc0
+


Modified: patches/0001-Bug-670373-gtk2-modules-printing-cups-gtkprintbackendcups.patch
332 lines changed, 332 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,332 @@
+From bf8d9699ec228a8dd67c1bd1a84c38c398ba0b09 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sat, 25 Feb 2012 17:43:18 -0800
+Subject: [PATCH 1/9] [Bug 670373] modules/printing/cups/gtkprintbackendcups.c
+  won't build with CUPS 1.6
+
+ The first, simple changes. Turns off the deprecation warnings and
+ substitutes macros and short ifdef blocks where feasible.
+---
+ configure.in                                     |    6 +
+ modules/printbackends/cups/gtkprintbackendcups.c |  146 +++++++++++++---------
+ 2 files changed, 93 insertions(+), 59 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index dff4588..288ad0c 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1473,6 +1473,12 @@ else
+       AC_DEFINE(HAVE_CUPS_API_1_2, 1, 
+                 [Define to 1 if CUPS 1.2 API is available])
+     fi
++    if test $CUPS_API_MAJOR -gt 1 -o \
++	    $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 6; then
++      AC_DEFINE(HAVE_CUPS_API_1_6, 1,
++                [Define to 1 if CUPS 1.6 API is available])
++
++    fi
+ 
+     AC_SUBST(CUPS_API_MAJOR)
+     AC_SUBST(CUPS_API_MINOR)
+diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
+index 59914ba..283a0ff 100644
+--- a/modules/printbackends/cups/gtkprintbackendcups.c
++++ b/modules/printbackends/cups/gtkprintbackendcups.c
+@@ -30,6 +30,13 @@
+ #include <sys/stat.h>
+ #include <stdlib.h>
+ #include <time.h>
++/* Cups 1.6 deprecates ppdFindAttr(), ppdFindCustomOption(),
++ * ppdFirstCustomParam(), and ppdNextCustomParam() among others. This
++ * turns off the warning so that it will compile.
++ */
++#ifdef HAVE_CUPS_API_1_6
++# define _PPD_DEPRECATED
++#endif
+ 
+ #include <cups/cups.h>
+ #include <cups/language.h>
+@@ -235,7 +242,22 @@ pb_module_create (void)
+ {
+   return gtk_print_backend_cups_new ();
+ }
+-
++/* CUPS 1.6 Getter/Setter Functions CUPS 1.6 makes private most of the
++ * IPP structures and enforces access via new getter functions, which
++ * are unfortunately not available in earlier versions. We define
++ * below those getter functions as macros for use when building
++ * against earlier CUPS versions.
++ */
++#ifndef HAVE_CUPS_API_1_6
++#define ippGetOperation(ipp_request) ipp_request->request.op.operation_id
++#define ippGetInteger(attr, index) attr->values[index].integer
++#define ippGetBoolean(attr, index) attr->values[index].boolean
++#define ippGetString(attr, index, foo) attr->values[index].string.text
++#define ippGetValueTag(attr) attr->value_tag
++#define ippGetName(attr) attr->name
++#define ippGetCount(attr) attr->num_values
++#define ippGetGroupTag(attr) attr->group_tag
++#endif
+ /*
+  * GtkPrintBackendCups
+  */
+@@ -463,7 +485,7 @@ cups_print_cb (GtkPrintBackendCups *print_backend,
+       ipp_t *response = gtk_cups_result_get_response (result);
+ 
+       if ((attr = ippFindAttribute (response, "job-id", IPP_TAG_INTEGER)) != NULL)
+-	job_id = attr->values[0].integer;
++	job_id = ippGetInteger (attr, 0);
+ 
+       if (!gtk_print_job_get_track_print_status (ps->job) || job_id == 0)
+ 	gtk_print_job_set_status (ps->job, GTK_PRINT_STATUS_FINISHED);
+@@ -900,7 +922,7 @@ request_password (gpointer data)
+ 
+       dispatch->backend->authentication_lock = TRUE;
+ 
+-      switch (dispatch->request->ipp_request->request.op.operation_id)
++      switch (ippGetOperation (dispatch->request->ipp_request))
+         {
+           case IPP_PRINT_JOB:
+             if (job_title != NULL && printer_name != NULL)
+@@ -928,7 +950,7 @@ request_password (gpointer data)
+             break;
+           default:
+             /* work around gcc warning about 0 not being a value for this enum */
+-            if (dispatch->request->ipp_request->request.op.operation_id == 0)
++            if (ippGetOperation (dispatch->request->ipp_request) == 0)
+               prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname);
+             else
+               prompt = g_strdup_printf ( _("Authentication is required on %s"), hostname);
+@@ -1516,10 +1538,15 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend,
+     }
+ 
+   data->counter++;
+-  
++
+   response = gtk_cups_result_get_response (result);
+ 
+   state = 0;
++
++#ifdef HAVE_CUPS_API_1_6
++  attr = ippFindAttribute (response, "job-state", IPP_TAG_INTEGER);
++  state = ippGetInteger (attr, 0);
++#else
+   for (attr = response->attrs; attr != NULL; attr = attr->next) 
+     {
+       if (!attr->name)
+@@ -1527,7 +1554,8 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend,
+       
+       _CUPS_MAP_ATTR_INT (attr, state, "job-state");
+     }
+-  
++#endif
++
+   done = FALSE;
+   switch (state)
+     {
+@@ -1760,53 +1788,53 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
+       gboolean is_accepting_jobs = TRUE;
+       gboolean default_printer = FALSE;
+       gboolean got_printer_type = FALSE;
+-      gchar   *default_cover_before = NULL;
+-      gchar   *default_cover_after = NULL;
++      const gchar   *default_cover_before = NULL;
++      const gchar   *default_cover_after = NULL;
+       gboolean remote_printer = FALSE;
+       gchar  **auth_info_required = NULL;
+       
+       /* Skip leading attributes until we hit a printer...
+        */
+-      while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
++      while (attr != NULL && ippGetGroupTag (attr) != IPP_TAG_PRINTER)
+         attr = attr->next;
+ 
+       if (attr == NULL)
+         break;
+ 
+-      while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
++      while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_PRINTER)
+       {
+-        if (strcmp (attr->name, "printer-name") == 0 &&
+-	    attr->value_tag == IPP_TAG_NAME)
+-	  printer_name = attr->values[0].string.text;
+-	else if (strcmp (attr->name, "printer-uri-supported") == 0 &&
+-		 attr->value_tag == IPP_TAG_URI)
+-	  printer_uri = attr->values[0].string.text;
+-	else if (strcmp (attr->name, "member-uris") == 0 &&
+-		 attr->value_tag == IPP_TAG_URI)
+-	  member_uris = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-location") == 0)
+-          location = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-info") == 0)
+-          description = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-state-message") == 0)
+-          state_msg = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-state-reasons") == 0)
++        if (strcmp (ippGetName (attr), "printer-name") == 0 &&
++	    ippGetValueTag (attr) == IPP_TAG_NAME)
++	    printer_name = ippGetString (attr, 0, NULL);
++	else if (strcmp (ippGetName (attr), "printer-uri-supported") == 0 &&
++		 ippGetValueTag (attr) == IPP_TAG_URI)
++	    printer_uri = ippGetString (attr, 0, NULL);
++	else if (strcmp (ippGetName (attr), "member-uris") == 0 &&
++		 ippGetValueTag (attr) == IPP_TAG_URI)
++	    member_uris = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-location") == 0)
++	    location = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-info") == 0)
++	    description = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-state-message") == 0)
++	    state_msg = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-state-reasons") == 0)
+           /* Store most important reason to reason_msg and set
+              its importance at printer_state_reason_level */
+           {
+-            for (i = 0; i < attr->num_values; i++)
++            for (i = 0; i < ippGetCount (attr); i++)
+               {
+-                if (strcmp (attr->values[i].string.text, "none") != 0)
++		  if (strcmp (ippGetString (attr, i, NULL), "none") != 0)
+                   {
+                     /* Sets is_paused flag for paused printer. */
+-                    if (strcmp (attr->values[i].string.text, "paused") == 0)
++		      if (strcmp (ippGetString (attr, i, NULL), "paused") == 0)
+                       {
+                         is_paused = TRUE;
+                       }
+ 
+                     interested_in = FALSE;
+                     for (j = 0; j < G_N_ELEMENTS (reasons); j++)
+-                        if (strncmp (attr->values[i].string.text, reasons[j], strlen (reasons[j])) == 0)
++                        if (strncmp (ippGetString (attr, i, NULL), reasons[j], strlen (reasons[j])) == 0)
+                           {
+                             interested_in = TRUE;
+                             break;
+@@ -1814,87 +1842,87 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
+ 
+                     if (interested_in)
+                       {
+-                        if (g_str_has_suffix (attr->values[i].string.text, "-report"))
++			  if (g_str_has_suffix (ippGetString (attr, i, NULL), "-report"))
+                           {
+                             if (printer_state_reason_level <= 1)
+                               {
+-                                reason_msg = attr->values[i].string.text;
++				  reason_msg = ippGetString (attr, i, NULL);
+                                 printer_state_reason_level = 1;
+                               }
+                           }
+-                        else if (g_str_has_suffix (attr->values[i].string.text, "-warning"))
++			  else if (g_str_has_suffix (ippGetString (attr, i, NULL), "-warning"))
+                           {
+                             if (printer_state_reason_level <= 2)
+                               {
+-                                reason_msg = attr->values[i].string.text;
++				  reason_msg = ippGetString (attr, i, NULL);
+                                 printer_state_reason_level = 2;
+-                              }
++                             }
+                           }
+                         else  /* It is error in the case of no suffix. */
+                           {
+-                            reason_msg = attr->values[i].string.text;
++			      reason_msg = ippGetString (attr, i, NULL);
+                             printer_state_reason_level = 3;
+                           }
+                       }
+                   }
+               }
+           }
+-        else if (strcmp (attr->name, "printer-state") == 0)
+-          state = attr->values[0].integer;
+-        else if (strcmp (attr->name, "queued-job-count") == 0)
+-          job_count = attr->values[0].integer;
+-        else if (strcmp (attr->name, "printer-is-accepting-jobs") == 0)
++        else if (strcmp (ippGetName (attr), "printer-state") == 0)
++          state = ippGetInteger (attr, 0);
++        else if (strcmp (ippGetName (attr), "queued-job-count") == 0)
++          job_count = ippGetInteger (attr, 0);
++        else if (strcmp (ippGetName (attr), "printer-is-accepting-jobs") == 0)
+           {
+-            if (attr->values[0].boolean == 1)
++            if (ippGetBoolean (attr, 0) == 1)
+               is_accepting_jobs = TRUE;
+             else
+               is_accepting_jobs = FALSE;
+           }
+-        else if (strcmp (attr->name, "job-sheets-supported") == 0)
++        else if (strcmp (ippGetName (attr), "job-sheets-supported") == 0)
+           {
+             if (cups_backend->covers == NULL)
+               {
+-                cups_backend->number_of_covers = attr->num_values;
++                cups_backend->number_of_covers = ippGetCount (attr);
+                 cups_backend->covers = g_new (char *, cups_backend->number_of_covers + 1);
+                 for (i = 0; i < cups_backend->number_of_covers; i++)
+-                  cups_backend->covers[i] = g_strdup (attr->values[i].string.text);
++		    cups_backend->covers[i] = g_strdup (ippGetString (attr, i, NULL));
+                 cups_backend->covers[cups_backend->number_of_covers] = NULL;
+               }
+           }
+-        else if (strcmp (attr->name, "job-sheets-default") == 0)
++        else if (strcmp (ippGetName (attr), "job-sheets-default") == 0)
+           {
+-            if (attr->num_values == 2)
++            if (ippGetCount (attr) == 2)
+               {
+-                default_cover_before = attr->values[0].string.text;
+-                default_cover_after = attr->values[1].string.text;
++		  default_cover_before = ippGetString (attr, 0, NULL);
++		  default_cover_after = ippGetString (attr, 1, NULL);
+               }
+           }
+-        else if (strcmp (attr->name, "printer-type") == 0)
++        else if (strcmp (ippGetName (attr), "printer-type") == 0)
+           {
+             got_printer_type = TRUE;
+-            if (attr->values[0].integer & 0x00020000)
++            if (ippGetInteger (attr, 0) & 0x00020000)
+               default_printer = TRUE;
+             else
+               default_printer = FALSE;
+ 
+-            if (attr->values[0].integer & 0x00000002)
++            if (ippGetInteger (attr, 0) & 0x00000002)
+               remote_printer = TRUE;
+             else
+               remote_printer = FALSE;
+           }
+-        else if (strcmp (attr->name, "auth-info-required") == 0)
++        else if (strcmp (ippGetName (attr), "auth-info-required") == 0)
+           {
+-            if (strcmp (attr->values[0].string.text, "none") != 0)
++	      if (strcmp (ippGetString (attr, 0, NULL), "none") != 0)
+               {
+-                auth_info_required = g_new0 (gchar *, attr->num_values + 1);
+-                for (i = 0; i < attr->num_values; i++)
+-                  auth_info_required[i] = g_strdup (attr->values[i].string.text);
++                auth_info_required = g_new0 (gchar *, ippGetCount (attr) + 1);
++                for (i = 0; i < ippGetCount (attr); i++)
++		    auth_info_required[i] = g_strdup (ippGetString (attr, i, NULL));
+               }
+           }
+         else
+ 	  {
+ 	    GTK_NOTE (PRINTING,
+-                      g_print ("CUPS Backend: Attribute %s ignored", attr->name));
++                      g_print ("CUPS Backend: Attribute %s ignored", ippGetName (attr)));
+ 	  }
+ 
+         attr = attr->next;
+@@ -2707,7 +2735,7 @@ cups_request_default_printer_cb (GtkPrintBackendCups *print_backend,
+   response = gtk_cups_result_get_response (result);
+   
+   if ((attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME)) != NULL)
+-    print_backend->default_printer = g_strdup (attr->values[0].string.text);
++      print_backend->default_printer = g_strdup (ippGetString (attr, 0, NULL));
+ 
+   print_backend->got_default_printer = TRUE;
+ 
+-- 
+1.7.7.5 (Apple Git-28)
+


Modified: patches/0001-Bug-670373-gtk3-modules-printing-cups-gtkprintbackendcups.patch
331 lines changed, 331 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,331 @@
+From 3c586545f528e18ef2a9fa9e2ff17fc369e3a38f Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sat, 18 Feb 2012 14:16:27 -0800
+Subject: [PATCH 1/9] [Bug 670373] modules/printing/cups/gtkprintbackendcups.c
+ won't build with CUPS 1.6
+
+The first, simple changes. Turns off the deprecation warnings and substitutes macros and short ifdef blocks where feasible.
+---
+ configure.in                                     |    6 +
+ modules/printbackends/cups/gtkprintbackendcups.c |  146 +++++++++++++---------
+ 2 files changed, 93 insertions(+), 59 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 75761d5..85c5960 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1473,6 +1473,12 @@ else
+       AC_DEFINE(HAVE_CUPS_API_1_2, 1, 
+                 [Define to 1 if CUPS 1.2 API is available])
+     fi
++    if test $CUPS_API_MAJOR -gt 1 -o \
++	    $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 6; then
++      AC_DEFINE(HAVE_CUPS_API_1_6, 1,
++                [Define to 1 if CUPS 1.6 API is available])
++
++    fi
+ 
+     AC_SUBST(CUPS_API_MAJOR)
+     AC_SUBST(CUPS_API_MINOR)
+diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
+index 79d66cd..12c6ab6 100644
+--- a/modules/printbackends/cups/gtkprintbackendcups.c
++++ b/modules/printbackends/cups/gtkprintbackendcups.c
+@@ -30,6 +30,13 @@
+ #include <sys/stat.h>
+ #include <stdlib.h>
+ #include <time.h>
++/* Cups 1.6 deprecates ppdFindAttr(), ppdFindCustomOption(),
++ * ppdFirstCustomParam(), and ppdNextCustomParam() among others. This
++ * turns off the warning so that it will compile.
++ */
++#ifdef HAVE_CUPS_API_1_6
++# define _PPD_DEPRECATED
++#endif
+ 
+ #include <cups/cups.h>
+ #include <cups/language.h>
+@@ -235,7 +242,22 @@ pb_module_create (void)
+ {
+   return gtk_print_backend_cups_new ();
+ }
+-
++/* CUPS 1.6 Getter/Setter Functions CUPS 1.6 makes private most of the
++ * IPP structures and enforces access via new getter functions, which
++ * are unfortunately not available in earlier versions. We define
++ * below those getter functions as macros for use when building
++ * against earlier CUPS versions.
++ */
++#ifndef HAVE_CUPS_API_1_6
++#define ippGetOperation(ipp_request) ipp_request->request.op.operation_id
++#define ippGetInteger(attr, index) attr->values[index].integer
++#define ippGetBoolean(attr, index) attr->values[index].boolean
++#define ippGetString(attr, index, foo) attr->values[index].string.text
++#define ippGetValueTag(attr) attr->value_tag
++#define ippGetName(attr) attr->name
++#define ippGetCount(attr) attr->num_values
++#define ippGetGroupTag(attr) attr->group_tag
++#endif
+ /*
+  * GtkPrintBackendCups
+  */
+@@ -463,7 +485,7 @@ cups_print_cb (GtkPrintBackendCups *print_backend,
+       ipp_t *response = gtk_cups_result_get_response (result);
+ 
+       if ((attr = ippFindAttribute (response, "job-id", IPP_TAG_INTEGER)) != NULL)
+-	job_id = attr->values[0].integer;
++	job_id = ippGetInteger (attr, 0);
+ 
+       if (!gtk_print_job_get_track_print_status (ps->job) || job_id == 0)
+ 	gtk_print_job_set_status (ps->job, GTK_PRINT_STATUS_FINISHED);
+@@ -900,7 +922,7 @@ request_password (gpointer data)
+ 
+       dispatch->backend->authentication_lock = TRUE;
+ 
+-      switch (dispatch->request->ipp_request->request.op.operation_id)
++      switch (ippGetOperation (dispatch->request->ipp_request))
+         {
+           case IPP_PRINT_JOB:
+             if (job_title != NULL && printer_name != NULL)
+@@ -928,7 +950,7 @@ request_password (gpointer data)
+             break;
+           default:
+             /* work around gcc warning about 0 not being a value for this enum */
+-            if (dispatch->request->ipp_request->request.op.operation_id == 0)
++            if (ippGetOperation (dispatch->request->ipp_request) == 0)
+               prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname);
+             else
+               prompt = g_strdup_printf ( _("Authentication is required on %s"), hostname);
+@@ -1516,10 +1538,15 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend,
+     }
+ 
+   data->counter++;
+-  
++
+   response = gtk_cups_result_get_response (result);
+ 
+   state = 0;
++
++#ifdef HAVE_CUPS_API_1_6
++  attr = ippFindAttribute (response, "job-state", IPP_TAG_INTEGER);
++  state = ippGetInteger (attr, 0);
++#else
+   for (attr = response->attrs; attr != NULL; attr = attr->next) 
+     {
+       if (!attr->name)
+@@ -1527,7 +1554,8 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend,
+       
+       _CUPS_MAP_ATTR_INT (attr, state, "job-state");
+     }
+-  
++#endif
++
+   done = FALSE;
+   switch (state)
+     {
+@@ -1760,53 +1788,53 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
+       gboolean is_accepting_jobs = TRUE;
+       gboolean default_printer = FALSE;
+       gboolean got_printer_type = FALSE;
+-      gchar   *default_cover_before = NULL;
+-      gchar   *default_cover_after = NULL;
++      const gchar   *default_cover_before = NULL;
++      const gchar   *default_cover_after = NULL;
+       gboolean remote_printer = FALSE;
+       gchar  **auth_info_required = NULL;
+       
+       /* Skip leading attributes until we hit a printer...
+        */
+-      while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
++      while (attr != NULL && ippGetGroupTag (attr) != IPP_TAG_PRINTER)
+         attr = attr->next;
+ 
+       if (attr == NULL)
+         break;
+ 
+-      while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
++      while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_PRINTER)
+       {
+-        if (strcmp (attr->name, "printer-name") == 0 &&
+-	    attr->value_tag == IPP_TAG_NAME)
+-	  printer_name = attr->values[0].string.text;
+-	else if (strcmp (attr->name, "printer-uri-supported") == 0 &&
+-		 attr->value_tag == IPP_TAG_URI)
+-	  printer_uri = attr->values[0].string.text;
+-	else if (strcmp (attr->name, "member-uris") == 0 &&
+-		 attr->value_tag == IPP_TAG_URI)
+-	  member_uris = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-location") == 0)
+-          location = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-info") == 0)
+-          description = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-state-message") == 0)
+-          state_msg = attr->values[0].string.text;
+-        else if (strcmp (attr->name, "printer-state-reasons") == 0)
++        if (strcmp (ippGetName (attr), "printer-name") == 0 &&
++	    ippGetValueTag (attr) == IPP_TAG_NAME)
++	    printer_name = ippGetString (attr, 0, NULL);
++	else if (strcmp (ippGetName (attr), "printer-uri-supported") == 0 &&
++		 ippGetValueTag (attr) == IPP_TAG_URI)
++	    printer_uri = ippGetString (attr, 0, NULL);
++	else if (strcmp (ippGetName (attr), "member-uris") == 0 &&
++		 ippGetValueTag (attr) == IPP_TAG_URI)
++	    member_uris = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-location") == 0)
++	    location = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-info") == 0)
++	    description = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-state-message") == 0)
++	    state_msg = ippGetString (attr, 0, NULL);
++        else if (strcmp (ippGetName (attr), "printer-state-reasons") == 0)
+           /* Store most important reason to reason_msg and set
+              its importance at printer_state_reason_level */
+           {
+-            for (i = 0; i < attr->num_values; i++)
++            for (i = 0; i < ippGetCount (attr); i++)
+               {
+-                if (strcmp (attr->values[i].string.text, "none") != 0)
++		  if (strcmp (ippGetString (attr, i, NULL), "none") != 0)
+                   {
+                     /* Sets is_paused flag for paused printer. */
+-                    if (strcmp (attr->values[i].string.text, "paused") == 0)
++		      if (strcmp (ippGetString (attr, i, NULL), "paused") == 0)
+                       {
+                         is_paused = TRUE;
+                       }
+ 
+                     interested_in = FALSE;
+                     for (j = 0; j < G_N_ELEMENTS (reasons); j++)
+-                        if (strncmp (attr->values[i].string.text, reasons[j], strlen (reasons[j])) == 0)
++                        if (strncmp (ippGetString (attr, i, NULL), reasons[j], strlen (reasons[j])) == 0)
+                           {
+                             interested_in = TRUE;
+                             break;
+@@ -1814,87 +1842,87 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
+ 
+                     if (interested_in)
+                       {
+-                        if (g_str_has_suffix (attr->values[i].string.text, "-report"))
++			  if (g_str_has_suffix (ippGetString (attr, i, NULL), "-report"))
+                           {
+                             if (printer_state_reason_level <= 1)
+                               {
+-                                reason_msg = attr->values[i].string.text;
++				  reason_msg = ippGetString (attr, i, NULL);
+                                 printer_state_reason_level = 1;
+                               }
+                           }
+-                        else if (g_str_has_suffix (attr->values[i].string.text, "-warning"))
++			  else if (g_str_has_suffix (ippGetString (attr, i, NULL), "-warning"))
+                           {
+                             if (printer_state_reason_level <= 2)
+                               {
+-                                reason_msg = attr->values[i].string.text;
++				  reason_msg = ippGetString (attr, i, NULL);
+                                 printer_state_reason_level = 2;
+-                              }
++                             }
+                           }
+                         else  /* It is error in the case of no suffix. */
+                           {
+-                            reason_msg = attr->values[i].string.text;
++			      reason_msg = ippGetString (attr, i, NULL);
+                             printer_state_reason_level = 3;
+                           }
+                       }
+                   }
+               }
+           }
+-        else if (strcmp (attr->name, "printer-state") == 0)
+-          state = attr->values[0].integer;
+-        else if (strcmp (attr->name, "queued-job-count") == 0)
+-          job_count = attr->values[0].integer;
+-        else if (strcmp (attr->name, "printer-is-accepting-jobs") == 0)
++        else if (strcmp (ippGetName (attr), "printer-state") == 0)
++          state = ippGetInteger (attr, 0);
++        else if (strcmp (ippGetName (attr), "queued-job-count") == 0)
++          job_count = ippGetInteger (attr, 0);
++        else if (strcmp (ippGetName (attr), "printer-is-accepting-jobs") == 0)
+           {
+-            if (attr->values[0].boolean == 1)
++            if (ippGetBoolean (attr, 0) == 1)
+               is_accepting_jobs = TRUE;
+             else
+               is_accepting_jobs = FALSE;
+           }
+-        else if (strcmp (attr->name, "job-sheets-supported") == 0)
++        else if (strcmp (ippGetName (attr), "job-sheets-supported") == 0)
+           {
+             if (cups_backend->covers == NULL)
+               {
+-                cups_backend->number_of_covers = attr->num_values;
++                cups_backend->number_of_covers = ippGetCount (attr);
+                 cups_backend->covers = g_new (char *, cups_backend->number_of_covers + 1);
+                 for (i = 0; i < cups_backend->number_of_covers; i++)
+-                  cups_backend->covers[i] = g_strdup (attr->values[i].string.text);
++		    cups_backend->covers[i] = g_strdup (ippGetString (attr, i, NULL));
+                 cups_backend->covers[cups_backend->number_of_covers] = NULL;
+               }
+           }
+-        else if (strcmp (attr->name, "job-sheets-default") == 0)
++        else if (strcmp (ippGetName (attr), "job-sheets-default") == 0)
+           {
+-            if (attr->num_values == 2)
++            if (ippGetCount (attr) == 2)
+               {
+-                default_cover_before = attr->values[0].string.text;
+-                default_cover_after = attr->values[1].string.text;
++		  default_cover_before = ippGetString (attr, 0, NULL);
++		  default_cover_after = ippGetString (attr, 1, NULL);
+               }
+           }
+-        else if (strcmp (attr->name, "printer-type") == 0)
++        else if (strcmp (ippGetName (attr), "printer-type") == 0)
+           {
+             got_printer_type = TRUE;
+-            if (attr->values[0].integer & 0x00020000)
++            if (ippGetInteger (attr, 0) & 0x00020000)
+               default_printer = TRUE;
+             else
+               default_printer = FALSE;
+ 
+-            if (attr->values[0].integer & 0x00000002)
++            if (ippGetInteger (attr, 0) & 0x00000002)
+               remote_printer = TRUE;
+             else
+               remote_printer = FALSE;
+           }
+-        else if (strcmp (attr->name, "auth-info-required") == 0)
++        else if (strcmp (ippGetName (attr), "auth-info-required") == 0)
+           {
+-            if (strcmp (attr->values[0].string.text, "none") != 0)
++	      if (strcmp (ippGetString (attr, 0, NULL), "none") != 0)
+               {
+-                auth_info_required = g_new0 (gchar *, attr->num_values + 1);
+-                for (i = 0; i < attr->num_values; i++)
+-                  auth_info_required[i] = g_strdup (attr->values[i].string.text);
++                auth_info_required = g_new0 (gchar *, ippGetCount (attr) + 1);
++                for (i = 0; i < ippGetCount (attr); i++)
++		    auth_info_required[i] = g_strdup (ippGetString (attr, i, NULL));
+               }
+           }
+         else
+ 	  {
+ 	    GTK_NOTE (PRINTING,
+-                      g_print ("CUPS Backend: Attribute %s ignored", attr->name));
++                      g_print ("CUPS Backend: Attribute %s ignored", ippGetName (attr)));
+ 	  }
+ 
+         attr = attr->next;
+@@ -2707,7 +2737,7 @@ cups_request_default_printer_cb (GtkPrintBackendCups *print_backend,
+   response = gtk_cups_result_get_response (result);
+   
+   if ((attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME)) != NULL)
+-    print_backend->default_printer = g_strdup (attr->values[0].string.text);
++      print_backend->default_printer = g_strdup (ippGetString (attr, 0, NULL));
+ 
+   print_backend->got_default_printer = TRUE;
+ 
+-- 
+1.7.7.5 (Apple Git-28)
+


Modified: patches/0001-Bug-702516-Make-Werror-format-nonliteral-happy.patch
253 lines changed, 253 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,253 @@
+From 96e40ec7321990fe63fb41b1be0ceead21b3ffc3 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sun, 29 Sep 2013 11:40:25 -0700
+Subject: [PATCH] Bug 702516 - Make -Werror=format-nonliteral happy
+
+---
+ gio/gcontenttype.c      |  5 ++++-
+ gio/gthreadedresolver.c |  5 +++++
+ glib/gfileutils.c       | 50 +++++++++++++++++++++++++++++++++++--------------
+ glib/gmarkup.c          |  7 ++++++-
+ glib/gstrfuncs.c        |  6 +++++-
+ glib/gutils.c           |  5 +++++
+ 6 files changed, 61 insertions(+), 17 deletions(-)
+
+diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
+index 575d6fe..8dc5896 100644
+--- a/gio/gcontenttype.c
++++ b/gio/gcontenttype.c
+@@ -393,6 +393,8 @@ g_content_type_get_mime_type (const char *type)
+   return g_strdup (type);
+ }
+ 
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ 
+ static GIcon *
+ g_content_type_get_icon_internal (const gchar *type,
+@@ -423,7 +425,7 @@ g_content_type_get_icon_internal (const gchar *type,
+   G_LOCK (gio_xdgmime);
+   xdg_icon = xdg_mime_get_icon (type);
+   G_UNLOCK (gio_xdgmime);
+-  if (xdg_icon != NULL)
++   if (xdg_icon != NULL)
+     xdg_mimetype_icon = g_strdup_printf (file_template, xdg_icon);
+ 
+   if (xdg_mimetype_icon)
+@@ -450,6 +452,7 @@ g_content_type_get_icon_internal (const gchar *type,
+ 
+   return themed_icon;
+ }
++#pragma GCC diagnostic pop
+ 
+ /**
+  * g_content_type_get_icon:
+diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
+index 37f930c..1ffaf15 100644
+--- a/gio/gthreadedresolver.c
++++ b/gio/gthreadedresolver.c
+@@ -505,6 +505,9 @@ g_resolver_record_type_to_rrtype (GResolverRecordType type)
+   g_return_val_if_reached (-1);
+ }
+ 
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ static GList *
+ g_resolver_records_from_res_query (const gchar      *rrname,
+                                    gint              rrtype,
+@@ -619,6 +622,8 @@ g_resolver_records_from_res_query (const gchar      *rrname,
+     return records;
+ }
+ 
++#pragma GCC diagnostic pop
++
+ #elif defined(G_OS_WIN32)
+ 
+ static GVariant *
+diff --git a/glib/gfileutils.c b/glib/gfileutils.c
+index 7e5bedc..eb5baea 100644
+--- a/glib/gfileutils.c
++++ b/glib/gfileutils.c
+@@ -1004,25 +1004,47 @@ rename_file (const char  *old_name,
+   return TRUE;
+ }
+ 
+-/* format string must have two '%s':
+- *
+- *   - the place for the filename
+- *   - the place for the strerror
+- */
+-static void
+-format_error_message (GError      **error,
+-                      const gchar  *filename,
++static char *
++format_error_message (const gchar  *filename,
++                      const gchar  *format_string) G_GNUC_FORMAT(2);
++
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
++static char *
++format_error_message (const gchar  *filename,
+                       const gchar  *format_string)
+ {
+   gint saved_errno = errno;
+   gchar *display_name;
++  gchar *msg;
+ 
+   display_name = g_filename_display_name (filename);
++  msg = g_strdup_printf (format_string, display_name, g_strerror (saved_errno));
++  g_free (display_name);
++
++  return msg;
++}
+ 
+-  g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno),
+-               format_string, display_name, g_strerror (saved_errno));
++#pragma GCC diagnostic pop
+ 
+-  g_free (display_name);
++/* format string must have two '%s':
++ *
++ *   - the place for the filename
++ *   - the place for the strerror
++ */
++static void
++set_file_error (GError      **error,
++                const gchar  *filename,
++                const gchar  *format_string)
++                      
++{
++  int saved_errno = errno;
++  char *msg = format_error_message (filename, format_string);
++
++  g_set_error_literal (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno),
++                       msg);
++  g_free (msg);
+ }
+ 
+ static gchar *
+@@ -1044,7 +1066,7 @@ write_to_temp_file (const gchar  *contents,
+ 
+   if (fd == -1)
+     {
+-      format_error_message (err, tmp_name, _("Failed to create file '%s': %s"));
++      set_file_error (err, tmp_name, _("Failed to create file '%s': %s"));
+       goto out;
+     }
+ 
+@@ -1068,7 +1090,7 @@ write_to_temp_file (const gchar  *contents,
+           if (errno == EINTR)
+             continue;
+ 
+-          format_error_message (err, tmp_name, _("Failed to write file '%s': write() failed: %s"));
++          set_file_error (err, tmp_name, _("Failed to write file '%s': write() failed: %s"));
+           close (fd);
+           g_unlink (tmp_name);
+ 
+@@ -1108,7 +1130,7 @@ write_to_temp_file (const gchar  *contents,
+      */
+     if (g_lstat (dest_file, &statbuf) == 0 && statbuf.st_size > 0 && fsync (fd) != 0)
+       {
+-        format_error_message (err, tmp_name, _("Failed to write file '%s': fsync() failed: %s"));
++        set_file_error (err, tmp_name, _("Failed to write file '%s': fsync() failed: %s"));
+         close (fd);
+         g_unlink (tmp_name);
+ 
+diff --git a/glib/gmarkup.c b/glib/gmarkup.c
+index 552773f..fb02a42 100644
+--- a/glib/gmarkup.c
++++ b/glib/gmarkup.c
+@@ -2366,6 +2366,9 @@ find_conversion (const char  *format,
+  *
+  * Since: 2.4
+  */
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ gchar *
+ g_markup_vprintf_escaped (const gchar *format,
+                           va_list      args)
+@@ -2430,6 +2433,7 @@ g_markup_vprintf_escaped (const gchar *format,
+   G_VA_COPY (args2, args);
+ 
+   output1 = g_strdup_vprintf (format1->str, args);
++
+   if (!output1)
+     {
+       va_end (args2);
+@@ -2440,7 +2444,6 @@ g_markup_vprintf_escaped (const gchar *format,
+   va_end (args2);
+   if (!output2)
+     goto cleanup;
+-
+   result = g_string_new (NULL);
+ 
+   /* Iterate through the original format string again,
+@@ -2492,6 +2495,8 @@ g_markup_vprintf_escaped (const gchar *format,
+     return NULL;
+ }
+ 
++#pragma GCC diagnostic pop
++
+ /**
+  * g_markup_printf_escaped:
+  * @format: printf() style format string
+diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
+index 9509233..4fcd91c 100644
+--- a/glib/gstrfuncs.c
++++ b/glib/gstrfuncs.c
+@@ -881,6 +881,9 @@ g_ascii_dtostr (gchar       *buffer,
+   return g_ascii_formatd (buffer, buf_len, "%.17g", d);
+ }
+ 
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ /**
+  * g_ascii_formatd:
+  * @buffer: A buffer to place the resulting string in
+@@ -909,7 +912,7 @@ g_ascii_formatd (gchar       *buffer,
+   locale_t old_locale;
+ 
+   old_locale = uselocale (get_C_locale ());
+-  _g_snprintf (buffer, buf_len, format, d);
++   _g_snprintf (buffer, buf_len, format, d);
+   uselocale (old_locale);
+ 
+   return buffer;
+@@ -988,6 +991,7 @@ g_ascii_formatd (gchar       *buffer,
+   return buffer;
+ #endif
+ }
++#pragma GCC diagnostic pop
+ 
+ #define ISSPACE(c)              ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
+                                  (c) == '\r' || (c) == '\t' || (c) == '\v')
+diff --git a/glib/gutils.c b/glib/gutils.c
+index 0a9944f..2620cb6 100644
+--- a/glib/gutils.c
++++ b/glib/gutils.c
+@@ -2148,6 +2148,9 @@ g_format_size (guint64 size)
+  * Flags to modify the format of the string returned by g_format_size_full().
+  */
+ 
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ /**
+  * g_format_size_full:
+  * @size: a size in bytes
+@@ -2281,6 +2284,8 @@ g_format_size_full (guint64          size,
+   return g_string_free (string, FALSE);
+ }
+ 
++#pragma GCC diagnostic pop
++
+ /**
+  * g_format_size_for_display:
+  * @size: a size in bytes
+-- 
+1.8.3.rc0
+


Modified: patches/0001-Bug-707945-GTK2-Quartz-typeahead-find-in-GtkTreeView.patch
69 lines changed, 69 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,69 @@
+From 8407a6268b69ebf127240f5ad4372cabedb6891a Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sun, 28 Dec 2014 14:54:14 -0800
+Subject: [PATCH] Bug 707945 - GTK2/Quartz: 'typeahead find' in GtkTreeView no
+ longer
+
+accepts text input
+
+Get win from the event rather than from the IMContextQuartz's client window,
+because it's the event window that will eventually be called on to insert
+the text.
+---
+ modules/input/imquartz.c | 26 +++++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/modules/input/imquartz.c b/modules/input/imquartz.c
+index 67c7d6c..b72d05f 100644
+--- a/modules/input/imquartz.c
++++ b/modules/input/imquartz.c
+@@ -194,15 +194,6 @@ quartz_filter_keypress (GtkIMContext *context,
+   if (!qc->client_window)
+     return FALSE;
+ 
+-  nsview = gdk_quartz_window_get_nsview (qc->client_window);
+-  if (GDK_IS_WINDOW (nsview))
+-       /* it gets GDK_WINDOW in some cases */
+-    return gtk_im_context_filter_keypress (qc->slave, event);
+-  else
+-    win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
+-  GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
+-			   qc->client_window, win, nsview));
+-
+   NSEvent *nsevent = gdk_quartz_event_get_nsevent ((GdkEvent *)event);
+ 
+   if (!nsevent)
+@@ -214,6 +205,22 @@ quartz_filter_keypress (GtkIMContext *context,
+         return gtk_im_context_filter_keypress (qc->slave, event);
+     }
+ 
++  nsview = gdk_quartz_window_get_nsview (qc->client_window);
++  if (GDK_IS_WINDOW (nsview))
++       /* it gets GDK_WINDOW in some cases */
++    return gtk_im_context_filter_keypress (qc->slave, event);
++  else
++    /* It's the window in the event, not the window that Gtk thinks
++     * has focus, that NSTextInputClient calls to insert the text, so
++     * we need to pass the right window to output_result in order to
++     * get it back.
++     */
++    win = (GdkWindow *)[(GdkQuartzView *)[[nsevent window] contentView] gdkWindow];
++
++  GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
++			   qc->client_window, win, nsview));
++
++
+   if (event->type == GDK_KEY_RELEASE)
+     return FALSE;
+ 
+@@ -226,6 +233,7 @@ quartz_filter_keypress (GtkIMContext *context,
+        g_object_set_data (G_OBJECT (win), TIC_IN_KEY_DOWN,
+                                           GUINT_TO_POINTER (TRUE));
+        [nsview keyDown: nsevent];
++
+     }
+   /* JIS_Eisu || JIS_Kana */
+   if (event->hardware_keycode == 102 || event->hardware_keycode == 104)
+-- 
+1.8.3.rc0
+


Modified: patches/0001-Bug-708998-Avoid-infinite-loop.patch
42 lines changed, 42 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,42 @@
+From e1dcd5c77d52db0033cafd23d84f392c4d9f457e Mon Sep 17 00:00:00 2001
+From: Hamish Mackenzie <Hamish.K.Mackenzie at googlemail.com>
+Date: Sun, 29 Sep 2013 05:06:53 +1300
+Subject: [PATCH] Fix infinite loop in gdkevents.c _gdk_event_queue_find_first
+
+---
+ gdk/gdkevents.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
+index 327b543..e770f47 100644
+--- a/gdk/gdkevents.c
++++ b/gdk/gdkevents.c
+@@ -96,16 +96,16 @@ _gdk_event_queue_find_first (GdkDisplay *display)
+     {
+       GdkEventPrivate *event = tmp_list->data;
+ 
+-      if (event->flags & GDK_EVENT_PENDING)
+-        continue;
+-
+-      if (pending_motion)
+-        return pending_motion;
++      if (!(event->flags & GDK_EVENT_PENDING))
++        {
++          if (pending_motion)
++            return pending_motion;
+ 
+-      if (event->event.type == GDK_MOTION_NOTIFY && !display->flushing_events)
+-        pending_motion = tmp_list;
+-      else
+-        return tmp_list;
++          if (event->event.type == GDK_MOTION_NOTIFY && !display->flushing_events)
++            pending_motion = tmp_list;
++          else
++            return tmp_list;
++        }
+ 
+       tmp_list = g_list_next (tmp_list);
+     }
+-- 
+1.7.12.4 (Apple Git-37)
+


Modified: patches/0001-Bug-709939-quartz-window-pos.patch
17 lines changed, 17 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,17 @@
+diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
+index e83c87b..e28f3b2 100644
+--- a/gdk/quartz/gdkscreen-quartz.c
++++ b/gdk/quartz/gdkscreen-quartz.c
+@@ -208,7 +208,11 @@ _gdk_quartz_screen_update_window_sizes (GdkScreen *screen)
+   windows = gdk_screen_get_toplevel_windows (screen);
+ 
+   for (list = windows; list; list = list->next)
+-    _gdk_quartz_window_update_position (list->data);
++    {
++      if (GDK_WINDOW_TYPE(list->data) == GDK_WINDOW_OFFSCREEN)
++        continue;
++      _gdk_quartz_window_update_position (list->data);
++    }
+ 
+   g_list_free (windows);
+ }


Modified: patches/0001-Enable-use-of-XDG_DATA_DIRS-for-locating-iso-code-fi.patch
29 lines changed, 29 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,29 @@
+From afc08dfa25dc5a26d3f0ffae8bf31d3be0e89b57 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Fri, 9 Sep 2016 15:46:34 -0700
+Subject: [PATCH] Enable use of XDG_DATA_DIRS for locating iso-code files.
+
+Permits using them in a relocatable package like a Mac application bundle.
+---
+ gtkspell/gtkspell-codetable.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gtkspell/gtkspell-codetable.c b/gtkspell/gtkspell-codetable.c
+index b53951f..dcb5f1e 100644
+--- a/gtkspell/gtkspell-codetable.c
++++ b/gtkspell/gtkspell-codetable.c
+@@ -103,7 +103,10 @@ iso_codes_parse (const GMarkupParser *parser,
+   gchar *filename;
+   GError *error = NULL;
+ 
+-  filename = g_build_filename (ISO_CODES_PREFIX, "share", "xml", "iso-codes",
++  const gchar *dirname = g_getenv("XDG_DATA_DIRS");
++  if (dirname == NULL)
++       dirname = g_build_filename (ISO_CODES_PREFIX, "share", NULL);
++  filename = g_build_filename (dirname, "xml", "iso-codes",
+                                basename, NULL);
+   mapped_file = g_mapped_file_new (filename, FALSE, &error);
+   g_free (filename);
+-- 
+2.2.2
+


Modified: patches/0001-Fix-DnD-Introspection-on-Quartz-Backend.patch
26 lines changed, 26 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,26 @@
+From 673013ac67e322ff86193001131255fc24a68d5e Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Fri, 29 May 2015 13:04:07 -0700
+Subject: [PATCH] Fix DnD Introspection on Quartz Backend.
+
+Don't exclude the -quartz.c files from introspection_files.
+---
+ gtk/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gtk/Makefile.am b/gtk/Makefile.am
+index 51153e6..ae4ae62 100644
+--- a/gtk/Makefile.am
++++ b/gtk/Makefile.am
+@@ -1331,7 +1331,7 @@ distclean-local:
+ if HAVE_INTROSPECTION
+ introspection_files = \
+     $(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
+-    $(filter-out %win32.c %quartz.c, $(gtk_base_c_sources)) \
++    $(filter-out %win32.c, $(gtk_base_c_sources)) \
+     gtkprintoperation-unix.c \
+     gtktypebuiltins.h \
+     gtktypebuiltins.c
+-- 
+2.2.2
+


Modified: patches/0001-Fix-relative-module-paths.patch
42 lines changed, 42 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,42 @@
+From 2332e82a1415696a36f138768b8330c1e97d3a89 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sat, 3 Nov 2012 11:46:59 -0700
+Subject: [PATCH] Fix relative module paths
+
+So that the created absolute path is where the modules are installed
+instead of where the modules file is installed (i.e.,
+lib/pango/1.8.0/modules instead of etc/pango).
+---
+ pango/modules.c |   16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/pango/modules.c b/pango/modules.c
+index 644cc9c..c5a19f2 100644
+--- a/pango/modules.c
++++ b/pango/modules.c
+@@ -450,11 +450,17 @@ process_module_file (FILE *module_file, const gchar *module_file_dir)
+ 	  switch (i)
+ 	    {
+ 	    case 0:
+-	      if (!g_path_is_absolute (tmp_buf->str)) {
+-		const gchar *abs_file_name = g_build_filename (module_file_dir, tmp_buf->str, NULL);
+-		g_string_assign (tmp_buf, abs_file_name);
+-		g_free ((gpointer) abs_file_name);
+-	      }
++	      if (!g_path_is_absolute (tmp_buf->str))
++		{
++		  const gchar *lib_dir = pango_get_lib_subdirectory ();
++		  const gchar *abs_file_name = g_build_filename (lib_dir,
++								 MODULE_VERSION,
++								 "modules",
++								 tmp_buf->str,
++								 NULL);
++		  g_string_assign (tmp_buf, abs_file_name);
++		  g_free ((gpointer) abs_file_name);
++		}
+ 	      pair->module = find_or_create_module (tmp_buf->str);
+ 	      break;
+ 	    case 1:
+-- 
+1.7.9.6 (Apple Git-31.1)
+


Modified: patches/0001-Make-ATSUI-backend-compile-again.patch
74 lines changed, 74 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,74 @@
+From 18dc8d4059c6c21f62caa75d0e0ff7d3d14d8649 Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris at gtk.org>
+Date: Fri, 1 Jul 2011 21:08:39 +0200
+Subject: [PATCH] Make ATSUI backend compile again
+
+Commit 02f80c9acdec53f58fef0e12f41363c3c4ea1efe broke the build and was
+likely committed untested.
+
+pango-1-29-4 was branched from tag 1.29.3, before this fix was applied
+to master.
+
+Note that the problem affects only OS X 10.4 (Tiger); pango builds on
+later OS X versions without this change.
+---
+ pango/pangoatsui-fontmap.c |    8 ++++++--
+ pango/pangoatsui-private.h |    2 ++
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c
+index 8eb123a..c169f0d 100644
+--- a/pango/pangoatsui-fontmap.c
++++ b/pango/pangoatsui-fontmap.c
+@@ -70,6 +70,8 @@ struct _PangoATSUIFace
+ static GType pango_atsui_family_get_type (void);
+ static GType pango_atsui_face_get_type (void);
+ 
++static gpointer pango_atsui_face_parent_class;
++
+ static const char *
+ get_real_family (const char *family_name)
+ {
+@@ -200,6 +202,8 @@ pango_atsui_family_is_monospace (PangoFontFamily *family)
+   return atsuifamily->is_monospace;
+ }
+ 
++G_DEFINE_TYPE (PangoATSUIFamily, pango_atsui_family, PANGO_TYPE_FONT_FAMILY);
++
+ static void
+ pango_atsui_family_finalize (GObject *object)
+ {
+@@ -219,8 +223,6 @@ pango_atsui_family_finalize (GObject *object)
+   G_OBJECT_CLASS (pango_atsui_family_parent_class)->finalize (object);
+ }
+ 
+-G_DEFINE_TYPE (PangoATSUIFamilyClass, pango_atsui_family, PANGO_TYPE_FONT_FAMILY);
+-
+ static void
+ pango_atsui_family_class_init (PangoATSUIFamilyClass *class)
+ {
+@@ -337,6 +339,8 @@ pango_atsui_face_class_init (PangoFontFaceClass *class)
+ {
+   GObjectClass *object_class = (GObjectClass *)class;
+ 
++  pango_atsui_face_parent_class = g_type_class_peek_parent (class);
++
+   object_class->finalize = pango_atsui_face_finalize;
+ 
+   class->describe = pango_atsui_face_describe;
+diff --git a/pango/pangoatsui-private.h b/pango/pangoatsui-private.h
+index a5ab0cb..81bcf60 100644
+--- a/pango/pangoatsui-private.h
++++ b/pango/pangoatsui-private.h
+@@ -38,6 +38,8 @@ G_BEGIN_DECLS
+ 
+ 
+ typedef struct _PangoATSUIFamily       PangoATSUIFamily;
++typedef struct _PangoFontFamilyClass   PangoATSUIFamilyClass;
++
+ typedef struct _PangoATSUIFace         PangoATSUIFace;
+ 
+ typedef struct _PangoATSUIFontMap      PangoATSUIFontMap;
+-- 
+1.7.6.3.dirty
+


Modified: patches/0001-Patch-Orbit-2.14.19-to-master-for-current-GLib.patch
1963 lines changed, 1963 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,1963 @@
+From 8b6f17f1bf1a253b5d39bfd30c764c63b65001ef Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Tue, 1 Oct 2013 16:37:01 -0700
+Subject: [PATCH] Patch Orbit-2.14.19 to master for current GLib
+
+---
+ NEWS                                    |   7 +
+ configure.ac                            | 424 ++++++++++++++++++++++++++++++++
+ configure.in                            | 413 -------------------------------
+ include/orbit/GIOP/giop-types.h         |   5 +
+ include/orbit/GIOP/giop.h               |   1 +
+ include/orbit/orb-core/corba-orb-type.h |   3 +
+ include/orbit/orb-core/corba-orb.h      |   2 +
+ include/orbit/poa/orbit-adaptor.h       |   3 +
+ include/orbit/util/basic_types.h        |   8 -
+ linc2/src/Makefile.am                   |   6 +-
+ linc2/src/linc-connection.c             |  17 +-
+ linc2/src/linc-private.h                |   3 +
+ linc2/src/linc-protocols.c              |   1 +
+ linc2/src/linc.c                        |  40 ++-
+ linc2/test/Makefile.am                  |   2 +-
+ src/idl-compiler/Makefile.am            |   2 +-
+ src/orb/GIOP/Makefile.am                |   2 +-
+ src/orb/GIOP/giop-recv-buffer.c         |  14 +-
+ src/orb/GIOP/giop-send-buffer.c         |   9 +-
+ src/orb/GIOP/giop.c                     |  38 ++-
+ src/orb/Makefile.am                     |   2 +-
+ src/orb/dynamic/Makefile.am             |   2 +-
+ src/orb/orb-core/Makefile.am            |   2 +-
+ src/orb/orb-core/corba-object.c         |   8 +
+ src/orb/orb-core/corba-orb.c            |  24 +-
+ src/orb/poa/Makefile.am                 |   2 +-
+ src/orb/poa/poa.c                       |  25 +-
+ src/orb/util/Makefile.am                |   2 +-
+ src/orb/util/genrand.c                  |  13 +-
+ src/services/imodule/Makefile.am        |   2 +-
+ src/services/name/Makefile.am           |   2 +-
+ test/Makefile.am                        |   2 +-
+ test/everything/Makefile.am             |   4 +-
+ test/everything/client.c                |  14 +-
+ test/everything/server.c                |   3 +-
+ test/inhibit/Makefile.am                |   2 +-
+ test/poa/Makefile.am                    |   2 +-
+ test/poa/poatest-basic-shell.c          |   3 +-
+ test/test-corbaloc.c                    |   4 +-
+ test/test-dynany.c                      |   5 +-
+ test/test-giop.c                        |   4 +-
+ test/test-mem.c                         |   8 +-
+ test/test-performance.c                 |   2 +
+ test/timeout-client.c                   |   2 +
+ test/timeout-server.c                   |   3 +-
+ 45 files changed, 662 insertions(+), 480 deletions(-)
+ create mode 100644 configure.ac
+ delete mode 100644 configure.in
+
+diff --git a/NEWS b/NEWS
+index bddfdff..7734385 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,3 +1,10 @@
++ORBit2-2.14.20
++
++	- build fixes
++		+ Stop using -DG_DISABLE_DEPRECATED since it doesn't build
++		+ Use AM_CPPFLAGS instead of I@@ Diff output truncated at 100000 characters. @@

--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list