/* controller-surface-policy.c generated by valac 0.56.19, the Vala compiler
 * generated from controller-surface-policy.vala, do not modify */

#include "protonplus_core.h"
#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <float.h>
#include <math.h>
#include <string.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

enum  {
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_surface_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_NUM_PROPERTIES];
enum  {
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_SIZE_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_ACTIVE_SURFACE_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_DISMISSABLE_SURFACE_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_surface_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_NUM_PROPERTIES];
enum  {
	PROTON_PLUS_UTILS_CONTROLLER_WINDOW_RESOLVER_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_WINDOW_RESOLVER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_window_resolver_properties[PROTON_PLUS_UTILS_CONTROLLER_WINDOW_RESOLVER_NUM_PROPERTIES];

struct _ProtonPlusUtilsControllerSurfacePrivate {
	ProtonPlusUtilsControllerSurfaceKind _kind;
	gboolean _opener_valid;
};

struct _ProtonPlusUtilsControllerSurfaceRemovalPrivate {
	gboolean _was_active;
	gboolean _restore_opener;
	ProtonPlusUtilsControllerSurface* _active_surface;
};

struct _ProtonPlusUtilsControllerSurfacePolicyPrivate {
	ProtonPlusUtilsControllerSurface* window_surface;
	GeeArrayList* surfaces;
};

static gint ProtonPlusUtilsControllerSurface_private_offset;
static gpointer proton_plus_utils_controller_surface_parent_class = NULL;
static gint ProtonPlusUtilsControllerSurfaceRemoval_private_offset;
static gpointer proton_plus_utils_controller_surface_removal_parent_class = NULL;
static gint ProtonPlusUtilsControllerSurfacePolicy_private_offset;
static gpointer proton_plus_utils_controller_surface_policy_parent_class = NULL;
static gpointer proton_plus_utils_controller_window_resolver_parent_class = NULL;

static void proton_plus_utils_controller_surface_set_kind (ProtonPlusUtilsControllerSurface* self,
                                                    ProtonPlusUtilsControllerSurfaceKind value);
static void proton_plus_utils_controller_surface_finalize (GObject * obj);
static GType proton_plus_utils_controller_surface_get_type_once (void);
static void _vala_proton_plus_utils_controller_surface_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_proton_plus_utils_controller_surface_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);
static void proton_plus_utils_controller_surface_removal_set_was_active (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                                  gboolean value);
static void proton_plus_utils_controller_surface_removal_set_restore_opener (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                                      gboolean value);
static void proton_plus_utils_controller_surface_removal_set_active_surface (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                                      ProtonPlusUtilsControllerSurface* value);
static void proton_plus_utils_controller_surface_removal_finalize (GObject * obj);
static GType proton_plus_utils_controller_surface_removal_get_type_once (void);
static void _vala_proton_plus_utils_controller_surface_removal_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec);
static void _vala_proton_plus_utils_controller_surface_removal_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec);
static void proton_plus_utils_controller_surface_policy_finalize (GObject * obj);
static GType proton_plus_utils_controller_surface_policy_get_type_once (void);
static void _vala_proton_plus_utils_controller_surface_policy_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec);
static GType proton_plus_utils_controller_host_adapter_get_type_once (void);
static GType proton_plus_utils_controller_window_resolver_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
proton_plus_utils_controller_surface_kind_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_WINDOW, "PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_WINDOW", "window"}, {PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_DIALOG, "PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_DIALOG", "dialog"}, {PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_POPOVER, "PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_POPOVER", "popover"}, {0, NULL, NULL}};
	GType proton_plus_utils_controller_surface_kind_type_id;
	proton_plus_utils_controller_surface_kind_type_id = g_enum_register_static ("ProtonPlusUtilsControllerSurfaceKind", values);
	return proton_plus_utils_controller_surface_kind_type_id;
}

GType
proton_plus_utils_controller_surface_kind_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_surface_kind_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_surface_kind_type_id__once)) {
		GType proton_plus_utils_controller_surface_kind_type_id;
		proton_plus_utils_controller_surface_kind_type_id = proton_plus_utils_controller_surface_kind_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_surface_kind_type_id__once, proton_plus_utils_controller_surface_kind_type_id);
	}
	return proton_plus_utils_controller_surface_kind_type_id__once;
}

static inline gpointer
proton_plus_utils_controller_surface_get_instance_private (ProtonPlusUtilsControllerSurface* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerSurface_private_offset);
}

ProtonPlusUtilsControllerSurface*
proton_plus_utils_controller_surface_construct (GType object_type,
                                                ProtonPlusUtilsControllerSurfaceKind kind)
{
	ProtonPlusUtilsControllerSurface * self = NULL;
	self = (ProtonPlusUtilsControllerSurface*) g_object_new (object_type, NULL);
	proton_plus_utils_controller_surface_set_kind (self, kind);
	return self;
}

ProtonPlusUtilsControllerSurface*
proton_plus_utils_controller_surface_new (ProtonPlusUtilsControllerSurfaceKind kind)
{
	return proton_plus_utils_controller_surface_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, kind);
}

ProtonPlusUtilsControllerSurfaceKind
proton_plus_utils_controller_surface_get_kind (ProtonPlusUtilsControllerSurface* self)
{
	ProtonPlusUtilsControllerSurfaceKind result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_kind;
	return result;
}

static void
proton_plus_utils_controller_surface_set_kind (ProtonPlusUtilsControllerSurface* self,
                                               ProtonPlusUtilsControllerSurfaceKind value)
{
	ProtonPlusUtilsControllerSurfaceKind old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_surface_get_kind (self);
	if (old_value != value) {
		self->priv->_kind = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_surface_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY]);
	}
}

gboolean
proton_plus_utils_controller_surface_get_opener_valid (ProtonPlusUtilsControllerSurface* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_opener_valid;
	return result;
}

void
proton_plus_utils_controller_surface_set_opener_valid (ProtonPlusUtilsControllerSurface* self,
                                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_surface_get_opener_valid (self);
	if (old_value != value) {
		self->priv->_opener_valid = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_surface_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY]);
	}
}

static void
proton_plus_utils_controller_surface_class_init (ProtonPlusUtilsControllerSurfaceClass * klass,
                                                 gpointer klass_data)
{
	proton_plus_utils_controller_surface_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerSurface_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_controller_surface_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_controller_surface_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_surface_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY, proton_plus_utils_controller_surface_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY] = g_param_spec_enum ("kind", "kind", "kind", PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_KIND, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY, proton_plus_utils_controller_surface_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY] = g_param_spec_boolean ("opener-valid", "opener-valid", "opener-valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
proton_plus_utils_controller_surface_instance_init (ProtonPlusUtilsControllerSurface * self,
                                                    gpointer klass)
{
	self->priv = proton_plus_utils_controller_surface_get_instance_private (self);
	self->priv->_opener_valid = FALSE;
}

static void
proton_plus_utils_controller_surface_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerSurface * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, ProtonPlusUtilsControllerSurface);
	G_OBJECT_CLASS (proton_plus_utils_controller_surface_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_surface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerSurfaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_surface_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerSurface), 0, (GInstanceInitFunc) proton_plus_utils_controller_surface_instance_init, NULL };
	GType proton_plus_utils_controller_surface_type_id;
	proton_plus_utils_controller_surface_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerSurface", &g_define_type_info, 0);
	ProtonPlusUtilsControllerSurface_private_offset = g_type_add_instance_private (proton_plus_utils_controller_surface_type_id, sizeof (ProtonPlusUtilsControllerSurfacePrivate));
	return proton_plus_utils_controller_surface_type_id;
}

GType
proton_plus_utils_controller_surface_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_surface_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_surface_type_id__once)) {
		GType proton_plus_utils_controller_surface_type_id;
		proton_plus_utils_controller_surface_type_id = proton_plus_utils_controller_surface_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_surface_type_id__once, proton_plus_utils_controller_surface_type_id);
	}
	return proton_plus_utils_controller_surface_type_id__once;
}

static void
_vala_proton_plus_utils_controller_surface_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	ProtonPlusUtilsControllerSurface * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, ProtonPlusUtilsControllerSurface);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY:
		g_value_set_enum (value, proton_plus_utils_controller_surface_get_kind (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY:
		g_value_set_boolean (value, proton_plus_utils_controller_surface_get_opener_valid (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_controller_surface_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	ProtonPlusUtilsControllerSurface * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, ProtonPlusUtilsControllerSurface);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_PROPERTY:
		proton_plus_utils_controller_surface_set_kind (self, g_value_get_enum (value));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_OPENER_VALID_PROPERTY:
		proton_plus_utils_controller_surface_set_opener_valid (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_utils_controller_surface_removal_get_instance_private (ProtonPlusUtilsControllerSurfaceRemoval* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerSurfaceRemoval_private_offset);
}

ProtonPlusUtilsControllerSurfaceRemoval*
proton_plus_utils_controller_surface_removal_construct (GType object_type,
                                                        gboolean was_active,
                                                        gboolean restore_opener,
                                                        ProtonPlusUtilsControllerSurface* active_surface)
{
	ProtonPlusUtilsControllerSurfaceRemoval * self = NULL;
	g_return_val_if_fail (active_surface != NULL, NULL);
	self = (ProtonPlusUtilsControllerSurfaceRemoval*) g_object_new (object_type, NULL);
	proton_plus_utils_controller_surface_removal_set_was_active (self, was_active);
	proton_plus_utils_controller_surface_removal_set_restore_opener (self, restore_opener);
	proton_plus_utils_controller_surface_removal_set_active_surface (self, active_surface);
	return self;
}

ProtonPlusUtilsControllerSurfaceRemoval*
proton_plus_utils_controller_surface_removal_new (gboolean was_active,
                                                  gboolean restore_opener,
                                                  ProtonPlusUtilsControllerSurface* active_surface)
{
	return proton_plus_utils_controller_surface_removal_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_REMOVAL, was_active, restore_opener, active_surface);
}

gboolean
proton_plus_utils_controller_surface_removal_get_was_active (ProtonPlusUtilsControllerSurfaceRemoval* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_was_active;
	return result;
}

static void
proton_plus_utils_controller_surface_removal_set_was_active (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_surface_removal_get_was_active (self);
	if (old_value != value) {
		self->priv->_was_active = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY]);
	}
}

gboolean
proton_plus_utils_controller_surface_removal_get_restore_opener (ProtonPlusUtilsControllerSurfaceRemoval* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_restore_opener;
	return result;
}

static void
proton_plus_utils_controller_surface_removal_set_restore_opener (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_surface_removal_get_restore_opener (self);
	if (old_value != value) {
		self->priv->_restore_opener = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY]);
	}
}

ProtonPlusUtilsControllerSurface*
proton_plus_utils_controller_surface_removal_get_active_surface (ProtonPlusUtilsControllerSurfaceRemoval* self)
{
	ProtonPlusUtilsControllerSurface* result;
	ProtonPlusUtilsControllerSurface* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_active_surface;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
proton_plus_utils_controller_surface_removal_set_active_surface (ProtonPlusUtilsControllerSurfaceRemoval* self,
                                                                 ProtonPlusUtilsControllerSurface* value)
{
	ProtonPlusUtilsControllerSurface* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_surface_removal_get_active_surface (self);
	if (old_value != value) {
		ProtonPlusUtilsControllerSurface* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_active_surface);
		self->priv->_active_surface = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY]);
	}
}

static void
proton_plus_utils_controller_surface_removal_class_init (ProtonPlusUtilsControllerSurfaceRemovalClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_utils_controller_surface_removal_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerSurfaceRemoval_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_controller_surface_removal_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_controller_surface_removal_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_surface_removal_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY] = g_param_spec_boolean ("was-active", "was-active", "was-active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY] = g_param_spec_boolean ("restore-opener", "restore-opener", "restore-opener", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY, proton_plus_utils_controller_surface_removal_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY] = g_param_spec_object ("active-surface", "active-surface", "active-surface", PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_controller_surface_removal_instance_init (ProtonPlusUtilsControllerSurfaceRemoval * self,
                                                            gpointer klass)
{
	self->priv = proton_plus_utils_controller_surface_removal_get_instance_private (self);
}

static void
proton_plus_utils_controller_surface_removal_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerSurfaceRemoval * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_REMOVAL, ProtonPlusUtilsControllerSurfaceRemoval);
	_g_object_unref0 (self->priv->_active_surface);
	G_OBJECT_CLASS (proton_plus_utils_controller_surface_removal_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_surface_removal_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerSurfaceRemovalClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_surface_removal_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerSurfaceRemoval), 0, (GInstanceInitFunc) proton_plus_utils_controller_surface_removal_instance_init, NULL };
	GType proton_plus_utils_controller_surface_removal_type_id;
	proton_plus_utils_controller_surface_removal_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerSurfaceRemoval", &g_define_type_info, 0);
	ProtonPlusUtilsControllerSurfaceRemoval_private_offset = g_type_add_instance_private (proton_plus_utils_controller_surface_removal_type_id, sizeof (ProtonPlusUtilsControllerSurfaceRemovalPrivate));
	return proton_plus_utils_controller_surface_removal_type_id;
}

GType
proton_plus_utils_controller_surface_removal_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_surface_removal_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_surface_removal_type_id__once)) {
		GType proton_plus_utils_controller_surface_removal_type_id;
		proton_plus_utils_controller_surface_removal_type_id = proton_plus_utils_controller_surface_removal_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_surface_removal_type_id__once, proton_plus_utils_controller_surface_removal_type_id);
	}
	return proton_plus_utils_controller_surface_removal_type_id__once;
}

static void
_vala_proton_plus_utils_controller_surface_removal_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec)
{
	ProtonPlusUtilsControllerSurfaceRemoval * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_REMOVAL, ProtonPlusUtilsControllerSurfaceRemoval);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY:
		g_value_set_boolean (value, proton_plus_utils_controller_surface_removal_get_was_active (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY:
		g_value_set_boolean (value, proton_plus_utils_controller_surface_removal_get_restore_opener (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY:
		g_value_set_object (value, proton_plus_utils_controller_surface_removal_get_active_surface (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_controller_surface_removal_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec)
{
	ProtonPlusUtilsControllerSurfaceRemoval * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_REMOVAL, ProtonPlusUtilsControllerSurfaceRemoval);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_WAS_ACTIVE_PROPERTY:
		proton_plus_utils_controller_surface_removal_set_was_active (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_RESTORE_OPENER_PROPERTY:
		proton_plus_utils_controller_surface_removal_set_restore_opener (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_REMOVAL_ACTIVE_SURFACE_PROPERTY:
		proton_plus_utils_controller_surface_removal_set_active_surface (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_utils_controller_surface_policy_get_instance_private (ProtonPlusUtilsControllerSurfacePolicy* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerSurfacePolicy_private_offset);
}

ProtonPlusUtilsControllerSurfacePolicy*
proton_plus_utils_controller_surface_policy_construct (GType object_type,
                                                       ProtonPlusUtilsControllerSurface* window_surface)
{
	ProtonPlusUtilsControllerSurfacePolicy * self = NULL;
	ProtonPlusUtilsControllerSurface* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_val_if_fail (window_surface != NULL, NULL);
	self = (ProtonPlusUtilsControllerSurfacePolicy*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (window_surface);
	_g_object_unref0 (self->priv->window_surface);
	self->priv->window_surface = _tmp0_;
	_tmp1_ = self->priv->surfaces;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, window_surface);
	return self;
}

ProtonPlusUtilsControllerSurfacePolicy*
proton_plus_utils_controller_surface_policy_new (ProtonPlusUtilsControllerSurface* window_surface)
{
	return proton_plus_utils_controller_surface_policy_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_POLICY, window_surface);
}

gboolean
proton_plus_utils_controller_surface_policy_can_register_popover (gboolean visible,
                                                                  gboolean mapped)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (visible) {
		_tmp0_ = mapped;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
proton_plus_utils_controller_surface_policy_scroll_container_needs_focus (gdouble upper,
                                                                          gdouble page_size)
{
	gboolean result;
	result = upper > (page_size + 0.5);
	return result;
}

void
proton_plus_utils_controller_surface_policy_present (ProtonPlusUtilsControllerSurfacePolicy* self,
                                                     ProtonPlusUtilsControllerSurface* surface)
{
	ProtonPlusUtilsControllerSurface* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (surface != NULL);
	_tmp0_ = self->priv->window_surface;
	if (surface == _tmp0_) {
		return;
	}
	_tmp1_ = self->priv->surfaces;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp1_, surface);
	_tmp2_ = self->priv->surfaces;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, surface);
}

ProtonPlusUtilsControllerSurfaceRemoval*
proton_plus_utils_controller_surface_policy_remove (ProtonPlusUtilsControllerSurfacePolicy* self,
                                                    ProtonPlusUtilsControllerSurface* surface)
{
	gboolean was_active = FALSE;
	ProtonPlusUtilsControllerSurface* _tmp0_;
	ProtonPlusUtilsControllerSurface* _tmp1_;
	ProtonPlusUtilsControllerSurface* _tmp2_;
	gboolean _tmp3_;
	ProtonPlusUtilsControllerSurface* _tmp4_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	ProtonPlusUtilsControllerSurface* _tmp12_;
	ProtonPlusUtilsControllerSurface* _tmp13_;
	ProtonPlusUtilsControllerSurface* _tmp14_;
	ProtonPlusUtilsControllerSurfaceRemoval* _tmp15_;
	ProtonPlusUtilsControllerSurfaceRemoval* _tmp16_;
	ProtonPlusUtilsControllerSurfaceRemoval* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (surface != NULL, NULL);
	_tmp0_ = proton_plus_utils_controller_surface_policy_get_active_surface (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = surface == _tmp2_;
	_g_object_unref0 (_tmp2_);
	was_active = _tmp3_;
	_tmp4_ = self->priv->window_surface;
	if (surface != _tmp4_) {
		GeeArrayList* _tmp5_;
		_tmp5_ = self->priv->surfaces;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp5_, surface);
	}
	if (was_active) {
		ProtonPlusUtilsControllerSurfaceKind _tmp8_;
		ProtonPlusUtilsControllerSurfaceKind _tmp9_;
		_tmp8_ = proton_plus_utils_controller_surface_get_kind (surface);
		_tmp9_ = _tmp8_;
		_tmp7_ = _tmp9_ == PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_POPOVER;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		gboolean _tmp10_;
		gboolean _tmp11_;
		_tmp10_ = proton_plus_utils_controller_surface_get_opener_valid (surface);
		_tmp11_ = _tmp10_;
		_tmp6_ = _tmp11_;
	} else {
		_tmp6_ = FALSE;
	}
	_tmp12_ = proton_plus_utils_controller_surface_policy_get_active_surface (self);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	_tmp15_ = proton_plus_utils_controller_surface_removal_new (was_active, _tmp6_, _tmp14_);
	_tmp16_ = _tmp15_;
	_g_object_unref0 (_tmp14_);
	result = _tmp16_;
	return result;
}

void
proton_plus_utils_controller_surface_policy_reset (ProtonPlusUtilsControllerSurfacePolicy* self)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	ProtonPlusUtilsControllerSurface* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->surfaces;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
	_tmp1_ = self->priv->surfaces;
	_tmp2_ = self->priv->window_surface;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, _tmp2_);
}

gint
proton_plus_utils_controller_surface_policy_get_size (ProtonPlusUtilsControllerSurfacePolicy* self)
{
	gint result;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->surfaces;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

ProtonPlusUtilsControllerSurface*
proton_plus_utils_controller_surface_policy_get_active_surface (ProtonPlusUtilsControllerSurfacePolicy* self)
{
	ProtonPlusUtilsControllerSurface* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gpointer _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->surfaces;
	_tmp1_ = self->priv->surfaces;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, _tmp3_ - 1);
	result = (ProtonPlusUtilsControllerSurface*) _tmp4_;
	return result;
}

ProtonPlusUtilsControllerSurface*
proton_plus_utils_controller_surface_policy_get_dismissable_surface (ProtonPlusUtilsControllerSurfacePolicy* self)
{
	ProtonPlusUtilsControllerSurface* result;
	ProtonPlusUtilsControllerSurface* active = NULL;
	ProtonPlusUtilsControllerSurface* _tmp0_;
	ProtonPlusUtilsControllerSurface* _tmp1_;
	ProtonPlusUtilsControllerSurface* _tmp2_ = NULL;
	ProtonPlusUtilsControllerSurface* _tmp3_;
	ProtonPlusUtilsControllerSurfaceKind _tmp4_;
	ProtonPlusUtilsControllerSurfaceKind _tmp5_;
	ProtonPlusUtilsControllerSurface* _tmp7_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = proton_plus_utils_controller_surface_policy_get_active_surface (self);
	_tmp1_ = _tmp0_;
	active = _tmp1_;
	_tmp3_ = active;
	_tmp4_ = proton_plus_utils_controller_surface_get_kind (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == PROTON_PLUS_UTILS_CONTROLLER_SURFACE_KIND_WINDOW) {
		_tmp2_ = NULL;
	} else {
		ProtonPlusUtilsControllerSurface* _tmp6_;
		_tmp6_ = active;
		_tmp2_ = _tmp6_;
	}
	_tmp7_ = _g_object_ref0 (_tmp2_);
	result = _tmp7_;
	_g_object_unref0 (active);
	return result;
}

static void
proton_plus_utils_controller_surface_policy_class_init (ProtonPlusUtilsControllerSurfacePolicyClass * klass,
                                                        gpointer klass_data)
{
	proton_plus_utils_controller_surface_policy_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerSurfacePolicy_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_controller_surface_policy_get_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_surface_policy_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_SIZE_PROPERTY, proton_plus_utils_controller_surface_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_SIZE_PROPERTY] = g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_ACTIVE_SURFACE_PROPERTY, proton_plus_utils_controller_surface_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_ACTIVE_SURFACE_PROPERTY] = g_param_spec_object ("active-surface", "active-surface", "active-surface", PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_DISMISSABLE_SURFACE_PROPERTY, proton_plus_utils_controller_surface_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_DISMISSABLE_SURFACE_PROPERTY] = g_param_spec_object ("dismissable-surface", "dismissable-surface", "dismissable-surface", PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_controller_surface_policy_instance_init (ProtonPlusUtilsControllerSurfacePolicy * self,
                                                           gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = proton_plus_utils_controller_surface_policy_get_instance_private (self);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->surfaces = _tmp0_;
}

static void
proton_plus_utils_controller_surface_policy_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerSurfacePolicy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_POLICY, ProtonPlusUtilsControllerSurfacePolicy);
	_g_object_unref0 (self->priv->window_surface);
	_g_object_unref0 (self->priv->surfaces);
	G_OBJECT_CLASS (proton_plus_utils_controller_surface_policy_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_surface_policy_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerSurfacePolicyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_surface_policy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerSurfacePolicy), 0, (GInstanceInitFunc) proton_plus_utils_controller_surface_policy_instance_init, NULL };
	GType proton_plus_utils_controller_surface_policy_type_id;
	proton_plus_utils_controller_surface_policy_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerSurfacePolicy", &g_define_type_info, 0);
	ProtonPlusUtilsControllerSurfacePolicy_private_offset = g_type_add_instance_private (proton_plus_utils_controller_surface_policy_type_id, sizeof (ProtonPlusUtilsControllerSurfacePolicyPrivate));
	return proton_plus_utils_controller_surface_policy_type_id;
}

GType
proton_plus_utils_controller_surface_policy_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_surface_policy_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_surface_policy_type_id__once)) {
		GType proton_plus_utils_controller_surface_policy_type_id;
		proton_plus_utils_controller_surface_policy_type_id = proton_plus_utils_controller_surface_policy_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_surface_policy_type_id__once, proton_plus_utils_controller_surface_policy_type_id);
	}
	return proton_plus_utils_controller_surface_policy_type_id__once;
}

static void
_vala_proton_plus_utils_controller_surface_policy_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec)
{
	ProtonPlusUtilsControllerSurfacePolicy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_SURFACE_POLICY, ProtonPlusUtilsControllerSurfacePolicy);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_SIZE_PROPERTY:
		g_value_set_int (value, proton_plus_utils_controller_surface_policy_get_size (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_ACTIVE_SURFACE_PROPERTY:
		g_value_take_object (value, proton_plus_utils_controller_surface_policy_get_active_surface (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_SURFACE_POLICY_DISMISSABLE_SURFACE_PROPERTY:
		g_value_take_object (value, proton_plus_utils_controller_surface_policy_get_dismissable_surface (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

gboolean
proton_plus_utils_controller_host_adapter_is_controller_window (ProtonPlusUtilsControllerHostAdapter* self,
                                                                GObject* candidate)
{
	ProtonPlusUtilsControllerHostAdapterIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = PROTON_PLUS_UTILS_CONTROLLER_HOST_ADAPTER_GET_INTERFACE (self);
	if (_iface_->is_controller_window) {
		return _iface_->is_controller_window (self, candidate);
	}
	return FALSE;
}

GObject*
proton_plus_utils_controller_host_adapter_get_root (ProtonPlusUtilsControllerHostAdapter* self,
                                                    GObject* candidate)
{
	ProtonPlusUtilsControllerHostAdapterIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = PROTON_PLUS_UTILS_CONTROLLER_HOST_ADAPTER_GET_INTERFACE (self);
	if (_iface_->get_root) {
		return _iface_->get_root (self, candidate);
	}
	return NULL;
}

static void
proton_plus_utils_controller_host_adapter_default_init (ProtonPlusUtilsControllerHostAdapterIface * iface,
                                                        gpointer iface_data)
{
}

static GType
proton_plus_utils_controller_host_adapter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerHostAdapterIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_host_adapter_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType proton_plus_utils_controller_host_adapter_type_id;
	proton_plus_utils_controller_host_adapter_type_id = g_type_register_static (G_TYPE_INTERFACE, "ProtonPlusUtilsControllerHostAdapter", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (proton_plus_utils_controller_host_adapter_type_id, G_TYPE_OBJECT);
	return proton_plus_utils_controller_host_adapter_type_id;
}

GType
proton_plus_utils_controller_host_adapter_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_host_adapter_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_host_adapter_type_id__once)) {
		GType proton_plus_utils_controller_host_adapter_type_id;
		proton_plus_utils_controller_host_adapter_type_id = proton_plus_utils_controller_host_adapter_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_host_adapter_type_id__once, proton_plus_utils_controller_host_adapter_type_id);
	}
	return proton_plus_utils_controller_host_adapter_type_id__once;
}

GObject*
proton_plus_utils_controller_window_resolver_resolve (GObject* parent,
                                                      ProtonPlusUtilsControllerHostAdapter* adapter)
{
	GObject* root = NULL;
	GObject* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GObject* _tmp3_;
	GObject* result;
	g_return_val_if_fail (adapter != NULL, NULL);
	if (parent == NULL) {
		result = NULL;
		return result;
	}
	if (proton_plus_utils_controller_host_adapter_is_controller_window (adapter, parent)) {
		GObject* _tmp0_;
		_tmp0_ = _g_object_ref0 (parent);
		result = _tmp0_;
		return result;
	}
	_tmp1_ = proton_plus_utils_controller_host_adapter_get_root (adapter, parent);
	root = _tmp1_;
	_tmp3_ = root;
	if (_tmp3_ != NULL) {
		GObject* _tmp4_;
		_tmp4_ = root;
		_tmp2_ = proton_plus_utils_controller_host_adapter_is_controller_window (adapter, _tmp4_);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		result = root;
		return result;
	}
	result = NULL;
	_g_object_unref0 (root);
	return result;
}

ProtonPlusUtilsControllerWindowResolver*
proton_plus_utils_controller_window_resolver_construct (GType object_type)
{
	ProtonPlusUtilsControllerWindowResolver * self = NULL;
	self = (ProtonPlusUtilsControllerWindowResolver*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsControllerWindowResolver*
proton_plus_utils_controller_window_resolver_new (void)
{
	return proton_plus_utils_controller_window_resolver_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_WINDOW_RESOLVER);
}

static void
proton_plus_utils_controller_window_resolver_class_init (ProtonPlusUtilsControllerWindowResolverClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_utils_controller_window_resolver_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_utils_controller_window_resolver_instance_init (ProtonPlusUtilsControllerWindowResolver * self,
                                                            gpointer klass)
{
}

static GType
proton_plus_utils_controller_window_resolver_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerWindowResolverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_window_resolver_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerWindowResolver), 0, (GInstanceInitFunc) proton_plus_utils_controller_window_resolver_instance_init, NULL };
	GType proton_plus_utils_controller_window_resolver_type_id;
	proton_plus_utils_controller_window_resolver_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerWindowResolver", &g_define_type_info, 0);
	return proton_plus_utils_controller_window_resolver_type_id;
}

GType
proton_plus_utils_controller_window_resolver_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_window_resolver_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_window_resolver_type_id__once)) {
		GType proton_plus_utils_controller_window_resolver_type_id;
		proton_plus_utils_controller_window_resolver_type_id = proton_plus_utils_controller_window_resolver_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_window_resolver_type_id__once, proton_plus_utils_controller_window_resolver_type_id);
	}
	return proton_plus_utils_controller_window_resolver_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

