/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.28 from the
 * contents of GtkClipboard.xs. Do not edit this file, edit GtkClipboard.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "xs/GtkClipboard.xs"
/*
 * Copyright (c) 2003-2006 by the gtk2-perl team (see the file AUTHORS)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 * Boston, MA  02111-1307  USA.
 *
 * $Id$
 */

#include "gtk2perl.h"

/*
 * this entire object didn't exist in the original 2.0.0 release.  hrm.
 */
#ifdef GTK_TYPE_CLIPBOARD


#define DEFINE_QUARK(stem)	\
static GQuark								\
stem ## _quark (void) 							\
{									\
	static GQuark q = 0;						\
	if (q == 0)							\
		q = g_quark_from_static_string ("gtk2perl_" #stem );	\
	return q;							\
}

DEFINE_QUARK (clipboard_get)
DEFINE_QUARK (clipboard_clear)
DEFINE_QUARK (clipboard_user_data)

static void 
gtk2perl_clipboard_received_func (GtkClipboard *clipboard,
                                  GtkSelectionData *selection_data,
                                  gpointer data)
{
	GPerlCallback * callback = (GPerlCallback*) data;
	gperl_callback_invoke (callback, NULL, clipboard, selection_data);
	gperl_callback_destroy (callback);
}

static void
gtk2perl_clipboard_text_received_func (GtkClipboard *clipboard,
                                       const gchar *text,
                                       gpointer data)
{
	GPerlCallback * callback = (GPerlCallback*) data;
	gperl_callback_invoke (callback, NULL, clipboard, text);
	gperl_callback_destroy (callback);
}

#if GTK_CHECK_VERSION(2, 4, 0)

static void
gtk2perl_clipboard_targets_received_func (GtkClipboard *clipboard,
                                          GdkAtom * targets,
                                          gint n_targets,
                                          gpointer data)
{
	SV * targetlist;
	AV * av;
	int i;
	GPerlCallback * callback = (GPerlCallback*) data;

	av = newAV ();
	for (i = 0 ; i < n_targets ; i++)
		av_push (av, newSVGdkAtom (targets[i]));
	targetlist = sv_2mortal (newRV_noinc ((SV*) av));
	gperl_callback_invoke (callback, NULL, clipboard, targetlist);
	gperl_callback_destroy (callback);
}

#endif

#if GTK_CHECK_VERSION(2, 6, 0)

static void
gtk2perl_clipboard_image_received_func (GtkClipboard *clipboard,
                                        GdkPixbuf *pixbuf,
                                        gpointer data)
{
	GPerlCallback * callback = (GPerlCallback*) data;
	gperl_callback_invoke (callback, NULL, clipboard, pixbuf);
	gperl_callback_destroy (callback);
}

#endif

static void
gtk2perl_clipboard_get_func (GtkClipboard *clipboard,
                             GtkSelectionData *selection_data,
                             guint info,
                             gpointer user_data_or_owner)
{
	GPerlCallback * callback = (GPerlCallback*)
			g_object_get_qdata (G_OBJECT (clipboard),
			                    clipboard_get_quark());
	gperl_callback_invoke (callback, NULL,
	                       clipboard, selection_data, info,
	                       user_data_or_owner);
}

static void
gtk2perl_clipboard_clear_func (GtkClipboard *clipboard,
                               gpointer user_data_or_owner)
{
	GPerlCallback * callback = (GPerlCallback*)
			g_object_get_qdata (G_OBJECT (clipboard),
			                    clipboard_clear_quark());
	gperl_callback_invoke (callback, NULL, clipboard, user_data_or_owner);
}

#if GTK_CHECK_VERSION (2, 10, 0)

static void
gtk2perl_clipboard_rich_text_received_func (GtkClipboard     *clipboard,
                                            GdkAtom           format,
                                            const guint8     *text,
                                            gsize             length,
                                            gpointer          data)
{
        gperl_callback_invoke ((GPerlCallback*) data, NULL, clipboard,
                               sv_2mortal (newSVGdkAtom (format)),
                               sv_2mortal (newSVpvn ((const char *) text, length)));
}

#endif /* 2.10 */

#if GTK_CHECK_VERSION (2, 14, 0)

static void
gtk2perl_clipboard_uri_received_func (GtkClipboard *clipboard,
				      gchar **uris,
				      gpointer data)
{
	/* uris is not owned by us */
        gperl_callback_invoke ((GPerlCallback*) data, NULL, clipboard, uris);
}

#endif /* 2.14 */

#endif /* defined GTK_TYPE_CLIPBOARD */

#line 166 "xs/GtkClipboard.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 310 "xs/GtkClipboard.c"
#ifdef GTK_TYPE_CLIPBOARD
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Gtk2__Clipboard_get); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_get)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "class, selection");
    {
	GdkAtom	selection = SvGdkAtom (ST(1))
;
	GtkClipboard *	RETVAL;

	RETVAL = gtk_clipboard_get(selection);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkClipboard (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if GTK_CHECK_VERSION(2,2,0)
#define XSubPPtmpAAAB 1


XS_EUPXS(XS_Gtk2__Clipboard_get_for_display); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_get_for_display)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, display, selection");
    {
	GdkDisplay *	display = SvGdkDisplay (ST(1))
;
	GdkAtom	selection = SvGdkAtom (ST(2))
;
	GtkClipboard *	RETVAL;

	RETVAL = gtk_clipboard_get_for_display(display, selection);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkClipboard (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_get_display); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_get_display)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GdkDisplay *	RETVAL;

	RETVAL = gtk_clipboard_get_display(clipboard);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGdkDisplay (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif /* >=2.2.0 */

XS_EUPXS(XS_Gtk2__Clipboard_set_with_data); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_set_with_data)
{
    dVAR; dXSARGS;
    if (items < 4)
       croak_xs_usage(cv,  "clipboard, get_func, clear_func, user_data, ...");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	get_func = ST(1)
;
	SV *	clear_func = ST(2)
;
	SV *	user_data = ST(3)
;
#line 195 "xs/GtkClipboard.xs"
	GtkTargetEntry *targets = NULL;
	guint n_targets;
	GPerlCallback * get_callback;
	GType get_param_types[4];
	GPerlCallback * clear_callback;
	GType clear_param_types[2];
	SV * real_user_data;
#line 413 "xs/GtkClipboard.c"
	gboolean	RETVAL;
#line 203 "xs/GtkClipboard.xs"
    	get_param_types[0] = GTK_TYPE_CLIPBOARD;
    	get_param_types[1] = GTK_TYPE_SELECTION_DATA;
    	get_param_types[2] = G_TYPE_UINT;
	/* since we're on the _data one */
    	get_param_types[3] = GPERL_TYPE_SV;

    	clear_param_types[0] = GTK_TYPE_CLIPBOARD;
	/* since we're on the _data one */
    	clear_param_types[1] = GPERL_TYPE_SV;

	GTK2PERL_STACK_ITEMS_TO_TARGET_ENTRY_ARRAY (4, targets, n_targets);
	/* WARNING: since we're piggybacking on the same callback for
	 *    the _with_data and _with_owner forms, the user_data arg
	 *    will go through the standard GSignal user data, and thus
	 *    we'll pass NULL to gperl_callback_new's user_data parameter.
	 *    this is not typical usage. */
	get_callback = gperl_callback_new (get_func, NULL,
	                                   4, get_param_types, G_TYPE_NONE);
	clear_callback = gperl_callback_new (clear_func, NULL,
	                                     2, clear_param_types, G_TYPE_NONE);
	real_user_data = newSVsv (user_data);

	RETVAL = gtk_clipboard_set_with_data (clipboard, targets, n_targets,
	                                      gtk2perl_clipboard_get_func,
	                                      gtk2perl_clipboard_clear_func,
	                                      real_user_data);
	if (!RETVAL) {
		gperl_callback_destroy (get_callback);
		gperl_callback_destroy (clear_callback);
		SvREFCNT_dec (real_user_data);
	} else {
		g_object_set_qdata_full (G_OBJECT (clipboard),
		                         clipboard_get_quark(),
		                         get_callback,
		                         (GDestroyNotify)
		                                gperl_callback_destroy);
		g_object_set_qdata_full (G_OBJECT (clipboard),
		                         clipboard_clear_quark(),
		                         clear_callback,
		                         (GDestroyNotify)
		                                gperl_callback_destroy);
		g_object_set_qdata_full (G_OBJECT (clipboard),
		                         clipboard_user_data_quark (),
		                         real_user_data,
		                         (GDestroyNotify)
		                                gperl_sv_free);
	}
#line 463 "xs/GtkClipboard.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_set_with_owner); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_set_with_owner)
{
    dVAR; dXSARGS;
    if (items < 4)
       croak_xs_usage(cv,  "clipboard, get_func, clear_func, owner, ...");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	get_func = ST(1)
;
	SV *	clear_func = ST(2)
;
	GObject *	owner = SvGObject (ST(3))
;
#line 264 "xs/GtkClipboard.xs"
	GtkTargetEntry *targets = NULL;
	guint n_targets = 0;
	GPerlCallback * get_callback;
	GType get_param_types[4];
	GPerlCallback * clear_callback;
	GType clear_param_types[2];
#line 492 "xs/GtkClipboard.c"
	gboolean	RETVAL;
#line 271 "xs/GtkClipboard.xs"
    	get_param_types[0] = GTK_TYPE_CLIPBOARD;
    	get_param_types[1] = GTK_TYPE_SELECTION_DATA;
    	get_param_types[2] = G_TYPE_UINT;
	/* since we're on the _owner one */
    	get_param_types[3] = G_TYPE_OBJECT;

    	clear_param_types[0] = GTK_TYPE_CLIPBOARD;
	/* since we're on the _owner one */
    	clear_param_types[1] = G_TYPE_OBJECT;

	GTK2PERL_STACK_ITEMS_TO_TARGET_ENTRY_ARRAY (4, targets, n_targets);
	/* WARNING: since we're piggybacking on the same callback for
	 *    the _with_data and _with_owner forms, the owner arg
	 *    will go through the standard GSignal user data, and thus
	 *    we'll pass NULL to gperl_callback_new's user_data parameter.
	 *    this is not typical usage. 
	 *
	 *    you may be thinking that i should just use the same function
	 *    for both forms, like with signal_connect in Glib.  the 
	 *    difference here is that gtk will treat the owner differently --
	 *    you can query the owner -- so we have to call the proper one.
	 *    of course, we could put both of these in the same perl wrapper...
	 */
	get_callback = gperl_callback_new (get_func, NULL,
	                                   4, get_param_types, G_TYPE_NONE);
	clear_callback = gperl_callback_new (clear_func, NULL,
	                                     2, clear_param_types, G_TYPE_NONE);

	RETVAL = gtk_clipboard_set_with_owner (clipboard, targets, n_targets,
	                                       gtk2perl_clipboard_get_func,
	                                       gtk2perl_clipboard_clear_func,
	                                       owner);
	if (!RETVAL) {
		gperl_callback_destroy (get_callback);
		gperl_callback_destroy (clear_callback);
	} else {
		g_object_set_qdata_full (G_OBJECT (clipboard),
		                         clipboard_get_quark(),
		                         get_callback,
		                         (GDestroyNotify)
		                                gperl_callback_destroy);
		g_object_set_qdata_full (G_OBJECT (clipboard),
		                         clipboard_clear_quark(),
		                         clear_callback,
		                         (GDestroyNotify)
		                                gperl_callback_destroy);
	}
#line 542 "xs/GtkClipboard.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_get_owner); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_get_owner)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GObject *	RETVAL;

	RETVAL = gtk_clipboard_get_owner(clipboard);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGObject (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_clear); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_clear)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;

	gtk_clipboard_clear(clipboard);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_set_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_set_text)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, text");
    {
	STRLEN	STRLEN_length_of_text;
	int	XSauto_length_of_text;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	const gchar_length *	text;

	XSauto_length_of_text = STRLEN_length_of_text;

	sv_utf8_upgrade (ST(1));
	text = (const gchar_length *)SvPV (ST(1), STRLEN_length_of_text);
        XSauto_length_of_text = STRLEN_length_of_text
;

	gtk_clipboard_set_text(clipboard, text, XSauto_length_of_text);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_request_contents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_contents)
{
    dVAR; dXSARGS;
    if (items < 3 || items > 4)
       croak_xs_usage(cv,  "clipboard, target, callback, user_data=NULL");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GdkAtom	target = SvGdkAtom (ST(1))
;
	SV *	callback = ST(2)
;
	SV *	user_data;
#line 342 "xs/GtkClipboard.xs"
	GPerlCallback * real_callback;
	GType param_types[2];
#line 631 "xs/GtkClipboard.c"

	if (items < 4)
	    user_data = NULL;
	else {
	    user_data = ST(3)
;
	}
#line 345 "xs/GtkClipboard.xs"
    	param_types[0] = GTK_TYPE_CLIPBOARD;
	param_types[1] = GTK_TYPE_SELECTION_DATA;
	real_callback = gperl_callback_new (callback, user_data,
	                                    2, param_types, G_TYPE_NONE);
	gtk_clipboard_request_contents (clipboard, target, 
	                                gtk2perl_clipboard_received_func,
					real_callback);
#line 647 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_request_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_text)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "clipboard, callback, user_data=NULL");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	callback = ST(1)
;
	SV *	user_data;
#line 360 "xs/GtkClipboard.xs"
	GPerlCallback * real_callback;
	GType param_types[2];
#line 668 "xs/GtkClipboard.c"

	if (items < 3)
	    user_data = NULL;
	else {
	    user_data = ST(2)
;
	}
#line 363 "xs/GtkClipboard.xs"
    	param_types[0] = GTK_TYPE_CLIPBOARD;
    	param_types[1] = G_TYPE_STRING;
	real_callback = gperl_callback_new (callback, user_data,
	                                    2, param_types, G_TYPE_NONE);
	gtk_clipboard_request_text (clipboard, 
				    gtk2perl_clipboard_text_received_func, 
				    real_callback);
#line 684 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_contents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_contents)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, target");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GdkAtom	target = SvGdkAtom (ST(1))
;
	GtkSelectionData_own_ornull *	RETVAL;

	RETVAL = gtk_clipboard_wait_for_contents(clipboard, target);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkSelectionData_own_ornull (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_text)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	gchar *	RETVAL;

	RETVAL = gtk_clipboard_wait_for_text(clipboard);
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    /* same as newSVGChar(), but not in a function */
	    sv_setpv ((SV*)RETVALSV, RETVAL);
	    SvUTF8_on (RETVALSV);
	    ST(0) = RETVALSV;
	}
#line 382 "xs/GtkClipboard.xs"
	g_free (RETVAL);
#line 737 "xs/GtkClipboard.c"
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_is_text_available); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_is_text_available)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	gboolean	RETVAL;

	RETVAL = gtk_clipboard_wait_is_text_available(clipboard);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}

#if GTK_CHECK_VERSION (2, 4, 0)
#define XSubPPtmpAAAC 1


XS_EUPXS(XS_Gtk2__Clipboard_request_targets); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_targets)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "clipboard, callback, user_data=NULL");
    {
#line 395 "xs/GtkClipboard.xs"
	GType param_types[2];
	GPerlCallback * real_callback;
#line 774 "xs/GtkClipboard.c"
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	callback = ST(1)
;
	SV *	user_data;

	if (items < 3)
	    user_data = NULL;
	else {
	    user_data = ST(2)
;
	}
#line 398 "xs/GtkClipboard.xs"
	param_types[0] = GTK_TYPE_CLIPBOARD;
	param_types[1] = GPERL_TYPE_SV;

	real_callback = gperl_callback_new (callback, user_data,
	                                    2, param_types, G_TYPE_NONE);
	gtk_clipboard_request_targets
			(clipboard,
			 gtk2perl_clipboard_targets_received_func,
			 real_callback);
#line 797 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_targets); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_targets)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 415 "xs/GtkClipboard.xs"
	GdkAtom *targets = NULL;
	gint n_targets, i;
#line 815 "xs/GtkClipboard.c"
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
#line 418 "xs/GtkClipboard.xs"
	if (!gtk_clipboard_wait_for_targets (clipboard, &targets, &n_targets))
		XSRETURN_EMPTY;
	if (targets) {
		EXTEND (SP, n_targets);
		for (i = 0 ; i < n_targets ; i++)
			PUSHs (sv_2mortal (newSVGdkAtom (targets[i])));
		g_free (targets);
	}
#line 827 "xs/GtkClipboard.c"
	PUTBACK;
	return;
    }
}

#endif /* 2.4.0 */
#if GTK_CHECK_VERSION (2, 6, 0)
#define XSubPPtmpAAAD 1


XS_EUPXS(XS_Gtk2__Clipboard_set_image); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_set_image)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, pixbuf");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GdkPixbuf *	pixbuf = SvGdkPixbuf (ST(1))
;

	gtk_clipboard_set_image(clipboard, pixbuf);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_image); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_image)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GdkPixbuf_noinc_ornull *	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;

	RETVAL = gtk_clipboard_wait_for_image(clipboard);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGdkPixbuf_noinc_ornull (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_is_image_available); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_is_image_available)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	gboolean	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;

	RETVAL = gtk_clipboard_wait_is_image_available(clipboard);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_request_image); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_image)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "clipboard, callback, user_data=NULL");
    {
#line 441 "xs/GtkClipboard.xs"
	GType param_types[2];
	GPerlCallback *real_callback;
#line 907 "xs/GtkClipboard.c"
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	callback = ST(1)
;
	SV *	user_data;

	if (items < 3)
	    user_data = NULL;
	else {
	    user_data = ST(2)
;
	}
#line 444 "xs/GtkClipboard.xs"
	param_types[0] = GTK_TYPE_CLIPBOARD;
	param_types[1] = GDK_TYPE_PIXBUF;

	real_callback = gperl_callback_new (callback, user_data,
	                                    2, param_types, G_TYPE_NONE);
	gtk_clipboard_request_image
			(clipboard,
			 gtk2perl_clipboard_image_received_func,
			 real_callback);
#line 930 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_set_can_store); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_set_can_store)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "clipboard, ...");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
#line 462 "xs/GtkClipboard.xs"
	GtkTargetEntry *targets = NULL;
	guint n_targets;
#line 948 "xs/GtkClipboard.c"
#line 465 "xs/GtkClipboard.xs"
	GTK2PERL_STACK_ITEMS_TO_TARGET_ENTRY_ARRAY (1, targets, n_targets);
	gtk_clipboard_set_can_store (clipboard, targets, (gint) n_targets);
#line 952 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_store); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_store)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;

	gtk_clipboard_store(clipboard);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_is_target_available); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_is_target_available)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, target");
    {
	gboolean	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GdkAtom	target = SvGdkAtom (ST(1))
;

	RETVAL = gtk_clipboard_wait_is_target_available(clipboard, target);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}

#endif /* 2.6.0 */
#if GTK_CHECK_VERSION (2, 10, 0)
#define XSubPPtmpAAAE 1


XS_EUPXS(XS_Gtk2__Clipboard_request_rich_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_rich_text)
{
    dVAR; dXSARGS;
    if (items < 3 || items > 4)
       croak_xs_usage(cv,  "clipboard, buffer, callback, user_data=NULL");
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GtkTextBuffer *	buffer = SvGtkTextBuffer (ST(1))
;
	SV *	callback = ST(2)
;
	SV *	user_data;
#line 488 "xs/GtkClipboard.xs"
        GPerlCallback * real_callback;
        GType param_types[3];
#line 1015 "xs/GtkClipboard.c"

	if (items < 4)
	    user_data = NULL;
	else {
	    user_data = ST(3)
;
	}
#line 491 "xs/GtkClipboard.xs"
        param_types[0] = GTK_TYPE_CLIPBOARD;
        param_types[1] = GPERL_TYPE_SV; /* there is no GDK_TYPE_ATOM */
        /* The real callback gets string and length parameters, but
         * perl scalars know their own length, so we won't expose that.
         * The string may have embedded nuls, so we use an SV. */
        param_types[2] = GPERL_TYPE_SV;
        real_callback = gperl_callback_new (callback, user_data,
                                            G_N_ELEMENTS (param_types),
                                            param_types, G_TYPE_NONE);
        gtk_clipboard_request_rich_text
                                (clipboard, buffer,
                                 gtk2perl_clipboard_rich_text_received_func,
				 real_callback);
#line 1037 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_rich_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_rich_text)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, buffer");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GtkTextBuffer *	buffer = SvGtkTextBuffer (ST(1))
;
#line 515 "xs/GtkClipboard.xs"
        GdkAtom       format;
        gsize         length;
        guint8       *text;
#line 1060 "xs/GtkClipboard.c"
#line 519 "xs/GtkClipboard.xs"
        text = gtk_clipboard_wait_for_rich_text (clipboard, buffer,
                                                 &format, &length);
        if (text) {
                EXTEND (SP, 2);
                PUSHs (sv_2mortal (newSVpvn ((const char *) text, length)));
                PUSHs (sv_2mortal (newSVGdkAtom (format)));
                g_free (text);
        }
#line 1070 "xs/GtkClipboard.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_is_rich_text_available); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_is_rich_text_available)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "clipboard, buffer");
    {
	gboolean	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	GtkTextBuffer *	buffer = SvGtkTextBuffer (ST(1))
;

	RETVAL = gtk_clipboard_wait_is_rich_text_available(clipboard, buffer);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}

#endif /* 2.10.0 */
#if GTK_CHECK_VERSION (2, 14, 0)
#define XSubPPtmpAAAF 1


XS_EUPXS(XS_Gtk2__Clipboard_request_uris); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_request_uris)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "clipboard, func, data=NULL");
    {
#line 538 "xs/GtkClipboard.xs"
	GPerlCallback * callback;
	GType param_types[2];
#line 1111 "xs/GtkClipboard.c"
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
	SV *	func = ST(1)
;
	SV *	data;

	if (items < 3)
	    data = NULL;
	else {
	    data = ST(2)
;
	}
#line 541 "xs/GtkClipboard.xs"
	param_types[0] = GTK_TYPE_CLIPBOARD;
	param_types[1] = G_TYPE_STRV;
	callback = gperl_callback_new (func, data,
				       G_N_ELEMENTS (param_types),
				       param_types, G_TYPE_NONE);
	gtk_clipboard_request_uris (clipboard,
				    gtk2perl_clipboard_uri_received_func,
				    callback);
#line 1133 "xs/GtkClipboard.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_for_uris); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_for_uris)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
#line 554 "xs/GtkClipboard.xs"
	gchar **strv;
#line 1148 "xs/GtkClipboard.c"
	SV *	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;
#line 556 "xs/GtkClipboard.xs"
	strv = gtk_clipboard_wait_for_uris (clipboard);
	RETVAL = gperl_new_boxed (strv, G_TYPE_STRV, TRUE); /* we own the strv */
#line 1155 "xs/GtkClipboard.c"
	RETVAL = sv_2mortal(RETVAL);
	ST(0) = RETVAL;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__Clipboard_wait_is_uris_available); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Clipboard_wait_is_uris_available)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "clipboard");
    {
	gboolean	RETVAL;
	GtkClipboard *	clipboard = SvGtkClipboard (ST(0))
;

	RETVAL = gtk_clipboard_wait_is_uris_available(clipboard);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}

#endif /* 2.14 */
#endif /* defined GTK_TYPE_CLIPBOARD */
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Gtk2__Clipboard); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Gtk2__Clipboard)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

#if XSubPPtmpAAAA
        newXS_deffile("Gtk2::Clipboard::get", XS_Gtk2__Clipboard_get);
#if XSubPPtmpAAAB
        newXS_deffile("Gtk2::Clipboard::get_for_display", XS_Gtk2__Clipboard_get_for_display);
        newXS_deffile("Gtk2::Clipboard::get_display", XS_Gtk2__Clipboard_get_display);
#endif
        newXS_deffile("Gtk2::Clipboard::set_with_data", XS_Gtk2__Clipboard_set_with_data);
        newXS_deffile("Gtk2::Clipboard::set_with_owner", XS_Gtk2__Clipboard_set_with_owner);
        newXS_deffile("Gtk2::Clipboard::get_owner", XS_Gtk2__Clipboard_get_owner);
        newXS_deffile("Gtk2::Clipboard::clear", XS_Gtk2__Clipboard_clear);
        newXS_deffile("Gtk2::Clipboard::set_text", XS_Gtk2__Clipboard_set_text);
        newXS_deffile("Gtk2::Clipboard::request_contents", XS_Gtk2__Clipboard_request_contents);
        newXS_deffile("Gtk2::Clipboard::request_text", XS_Gtk2__Clipboard_request_text);
        newXS_deffile("Gtk2::Clipboard::wait_for_contents", XS_Gtk2__Clipboard_wait_for_contents);
        newXS_deffile("Gtk2::Clipboard::wait_for_text", XS_Gtk2__Clipboard_wait_for_text);
        newXS_deffile("Gtk2::Clipboard::wait_is_text_available", XS_Gtk2__Clipboard_wait_is_text_available);
#if XSubPPtmpAAAC
        newXS_deffile("Gtk2::Clipboard::request_targets", XS_Gtk2__Clipboard_request_targets);
        newXS_deffile("Gtk2::Clipboard::wait_for_targets", XS_Gtk2__Clipboard_wait_for_targets);
#endif
#if XSubPPtmpAAAD
        newXS_deffile("Gtk2::Clipboard::set_image", XS_Gtk2__Clipboard_set_image);
        newXS_deffile("Gtk2::Clipboard::wait_for_image", XS_Gtk2__Clipboard_wait_for_image);
        newXS_deffile("Gtk2::Clipboard::wait_is_image_available", XS_Gtk2__Clipboard_wait_is_image_available);
        newXS_deffile("Gtk2::Clipboard::request_image", XS_Gtk2__Clipboard_request_image);
        newXS_deffile("Gtk2::Clipboard::set_can_store", XS_Gtk2__Clipboard_set_can_store);
        newXS_deffile("Gtk2::Clipboard::store", XS_Gtk2__Clipboard_store);
        newXS_deffile("Gtk2::Clipboard::wait_is_target_available", XS_Gtk2__Clipboard_wait_is_target_available);
#endif
#if XSubPPtmpAAAE
        newXS_deffile("Gtk2::Clipboard::request_rich_text", XS_Gtk2__Clipboard_request_rich_text);
        newXS_deffile("Gtk2::Clipboard::wait_for_rich_text", XS_Gtk2__Clipboard_wait_for_rich_text);
        newXS_deffile("Gtk2::Clipboard::wait_is_rich_text_available", XS_Gtk2__Clipboard_wait_is_rich_text_available);
#endif
#if XSubPPtmpAAAF
        newXS_deffile("Gtk2::Clipboard::request_uris", XS_Gtk2__Clipboard_request_uris);
        newXS_deffile("Gtk2::Clipboard::wait_for_uris", XS_Gtk2__Clipboard_wait_for_uris);
        newXS_deffile("Gtk2::Clipboard::wait_is_uris_available", XS_Gtk2__Clipboard_wait_is_uris_available);
#endif
#endif

    /* Initialisation Section */

#if XSubPPtmpAAAA
#if XSubPPtmpAAAB
#endif
#if XSubPPtmpAAAC
#endif
#if XSubPPtmpAAAD
#endif
#if XSubPPtmpAAAE
#endif
#if XSubPPtmpAAAF
#endif
#endif
#line 1265 "xs/GtkClipboard.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

