/* GestureBackend.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from GestureBackend.vala, do not modify */

/*
 * Copyright 2025 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authored by: Leonhard Kargl <leo.kargl@proton.me>
 */

#include <glib-object.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include "gala.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GALA_TYPE_GESTURE_BACKEND (gala_gesture_backend_get_type ())
#define GALA_GESTURE_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_GESTURE_BACKEND, GalaGestureBackend))
#define GALA_IS_GESTURE_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_GESTURE_BACKEND))
#define GALA_GESTURE_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GALA_TYPE_GESTURE_BACKEND, GalaGestureBackendIface))

typedef struct _GalaGestureBackend GalaGestureBackend;
typedef struct _GalaGestureBackendIface GalaGestureBackendIface;

#define GALA_TYPE_GESTURE (gala_gesture_get_type ())
#define GALA_GESTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_GESTURE, GalaGesture))
#define GALA_GESTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_GESTURE, GalaGestureClass))
#define GALA_IS_GESTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_GESTURE))
#define GALA_IS_GESTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_GESTURE))
#define GALA_GESTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_GESTURE, GalaGestureClass))

typedef struct _GalaGesture GalaGesture;
typedef struct _GalaGestureClass GalaGestureClass;
enum  {
	GALA_GESTURE_BACKEND_ON_GESTURE_DETECTED_SIGNAL,
	GALA_GESTURE_BACKEND_ON_BEGIN_SIGNAL,
	GALA_GESTURE_BACKEND_ON_UPDATE_SIGNAL,
	GALA_GESTURE_BACKEND_ON_END_SIGNAL,
	GALA_GESTURE_BACKEND_NUM_SIGNALS
};
static guint gala_gesture_backend_signals[GALA_GESTURE_BACKEND_NUM_SIGNALS] = {0};

struct _GalaGestureBackendIface {
	GTypeInterface parent_iface;
	void (*cancel_gesture) (GalaGestureBackend* self);
};

 G_GNUC_INTERNAL GType gala_gesture_backend_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL void gala_gesture_backend_cancel_gesture (GalaGestureBackend* self);
static void gala_gesture_backend_real_cancel_gesture (GalaGestureBackend* self);
 G_GNUC_INTERNAL gpointer gala_gesture_ref (gpointer instance);
 G_GNUC_INTERNAL void gala_gesture_unref (gpointer instance);
 G_GNUC_INTERNAL GParamSpec* gala_param_spec_gesture (const gchar* name,
                                     const gchar* nick,
                                     const gchar* blurb,
                                     GType object_type,
                                     GParamFlags flags);
 G_GNUC_INTERNAL void gala_value_set_gesture (GValue* value,
                             gpointer v_object) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL void gala_value_take_gesture (GValue* value,
                              gpointer v_object);
 G_GNUC_INTERNAL gpointer gala_value_get_gesture (const GValue* value) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GType gala_gesture_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void g_cclosure_user_marshal_BOOLEAN__GALA_GESTURE_UINT (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__DOUBLE_UINT64 (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static GType gala_gesture_backend_get_type_once (void);

/**
     * The gesture should be cancelled. The implementation should stop emitting
     * signals and reset any internal state. In particular it should not emit on_end.
     * The implementation has to make sure that any further events from the same gesture will
     * will be ignored. Once the gesture ends a new gesture should be treated as usual.
     */
static void
gala_gesture_backend_real_cancel_gesture (GalaGestureBackend* self)
{
}

void
gala_gesture_backend_cancel_gesture (GalaGestureBackend* self)
{
	GalaGestureBackendIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GALA_GESTURE_BACKEND_GET_INTERFACE (self);
	if (_iface_->cancel_gesture) {
		_iface_->cancel_gesture (self);
	}
}

static void
g_cclosure_user_marshal_BOOLEAN__GALA_GESTURE_UINT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__GALA_GESTURE_UINT) (gpointer data1, gpointer arg_1, guint32 arg_2, gpointer data2);
	register GMarshalFunc_BOOLEAN__GALA_GESTURE_UINT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__GALA_GESTURE_UINT) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, gala_value_get_gesture (param_values + 1), g_value_get_uint (param_values + 2), data2);
	g_value_set_boolean (return_value, v_return);
}

static void
g_cclosure_user_marshal_VOID__DOUBLE_UINT64 (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__DOUBLE_UINT64) (gpointer data1, gdouble arg_1, guint64 arg_2, gpointer data2);
	register GMarshalFunc_VOID__DOUBLE_UINT64 callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__DOUBLE_UINT64) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_double (param_values + 1), g_value_get_uint64 (param_values + 2), data2);
}

static void
gala_gesture_backend_default_init (GalaGestureBackendIface * iface,
                                   gpointer iface_data)
{
	gala_gesture_backend_signals[GALA_GESTURE_BACKEND_ON_GESTURE_DETECTED_SIGNAL] = g_signal_new ("on-gesture-detected", GALA_TYPE_GESTURE_BACKEND, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__GALA_GESTURE_UINT, G_TYPE_BOOLEAN, 2, GALA_TYPE_GESTURE, G_TYPE_UINT);
	gala_gesture_backend_signals[GALA_GESTURE_BACKEND_ON_BEGIN_SIGNAL] = g_signal_new ("on-begin", GALA_TYPE_GESTURE_BACKEND, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__DOUBLE_UINT64, G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_UINT64);
	gala_gesture_backend_signals[GALA_GESTURE_BACKEND_ON_UPDATE_SIGNAL] = g_signal_new ("on-update", GALA_TYPE_GESTURE_BACKEND, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__DOUBLE_UINT64, G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_UINT64);
	gala_gesture_backend_signals[GALA_GESTURE_BACKEND_ON_END_SIGNAL] = g_signal_new ("on-end", GALA_TYPE_GESTURE_BACKEND, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__DOUBLE_UINT64, G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_UINT64);
	iface->cancel_gesture = gala_gesture_backend_real_cancel_gesture;
}

 G_GNUC_NO_INLINE static GType
gala_gesture_backend_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaGestureBackendIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_gesture_backend_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gala_gesture_backend_type_id;
	gala_gesture_backend_type_id = g_type_register_static (G_TYPE_INTERFACE, "GalaGestureBackend", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gala_gesture_backend_type_id, G_TYPE_OBJECT);
	return gala_gesture_backend_type_id;
}

 G_GNUC_INTERNAL GType
gala_gesture_backend_get_type (void)
{
	static gsize gala_gesture_backend_type_id__once = 0;
	if (g_once_init_enter (&gala_gesture_backend_type_id__once)) {
		GType gala_gesture_backend_type_id;
		gala_gesture_backend_type_id = gala_gesture_backend_get_type_once ();
		g_once_init_leave (&gala_gesture_backend_type_id__once, gala_gesture_backend_type_id);
	}
	return gala_gesture_backend_type_id__once;
}

