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

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include "gnome-games.h"

#define GAMES_FULLSCREEN_BOX_INACTIVITY_TIME_MILLISECONDS ((guint) 3000)
#define GAMES_FULLSCREEN_BOX_SHOW_HEADERBAR_DISTANCE 5
#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 GAMES_TYPE_FULLSCREEN_BOX (games_fullscreen_box_get_type ())
#define GAMES_FULLSCREEN_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBox))
#define GAMES_FULLSCREEN_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBoxClass))
#define GAMES_IS_FULLSCREEN_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_FULLSCREEN_BOX))
#define GAMES_IS_FULLSCREEN_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_FULLSCREEN_BOX))
#define GAMES_FULLSCREEN_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBoxClass))

typedef struct _GamesFullscreenBox GamesFullscreenBox;
typedef struct _GamesFullscreenBoxClass GamesFullscreenBoxClass;
typedef struct _GamesFullscreenBoxPrivate GamesFullscreenBoxPrivate;

#define GAMES_TYPE_TITLEBAR_BOX (games_titlebar_box_get_type ())
#define GAMES_TITLEBAR_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TITLEBAR_BOX, GamesTitlebarBox))
#define GAMES_TITLEBAR_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_TITLEBAR_BOX, GamesTitlebarBoxClass))
#define GAMES_IS_TITLEBAR_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TITLEBAR_BOX))
#define GAMES_IS_TITLEBAR_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_TITLEBAR_BOX))
#define GAMES_TITLEBAR_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_TITLEBAR_BOX, GamesTitlebarBoxClass))

typedef struct _GamesTitlebarBox GamesTitlebarBox;
typedef struct _GamesTitlebarBoxClass GamesTitlebarBoxClass;
enum  {
	GAMES_FULLSCREEN_BOX_0_PROPERTY,
	GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY,
	GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY,
	GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY,
	GAMES_FULLSCREEN_BOX_NUM_PROPERTIES
};
static GParamSpec* games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesFullscreenBox {
	GtkEventBox parent_instance;
	GamesFullscreenBoxPrivate * priv;
};

struct _GamesFullscreenBoxClass {
	GtkEventBoxClass parent_class;
};

struct _GamesFullscreenBoxPrivate {
	gboolean _is_fullscreen;
	gboolean _overlay;
	gboolean _autohide;
	GamesTitlebarBox* titlebar_box;
	guint ui_timeout_id;
	guint cursor_timeout_id;
};

static gint GamesFullscreenBox_private_offset;
static gpointer games_fullscreen_box_parent_class = NULL;
static GtkBuildableIface * games_fullscreen_box_gtk_buildable_parent_iface = NULL;

VALA_EXTERN GType games_fullscreen_box_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_titlebar_box_get_type (void) G_GNUC_CONST ;
static void games_fullscreen_box_real_add_child (GtkBuildable* base,
                                          GtkBuilder* builder,
                                          GObject* child,
                                          const gchar* type);
VALA_EXTERN void games_titlebar_box_set_titlebar (GamesTitlebarBox* self,
                                      GtkWidget* value);
static gboolean games_fullscreen_box_on_motion_event (GamesFullscreenBox* self,
                                               GdkEventMotion* event);
VALA_EXTERN gboolean games_fullscreen_box_get_autohide (GamesFullscreenBox* self);
static void games_fullscreen_box_show_ui (GamesFullscreenBox* self);
static void games_fullscreen_box_on_cursor_moved (GamesFullscreenBox* self);
static gboolean _games_fullscreen_box_on_motion_event_gtk_widget_motion_notify_event (GtkWidget* _sender,
                                                                               GdkEventMotion* event,
                                                                               gpointer self);
VALA_EXTERN gboolean games_fullscreen_box_get_is_fullscreen (GamesFullscreenBox* self);
static gboolean games_fullscreen_box_hide_ui (GamesFullscreenBox* self);
static gboolean _games_fullscreen_box_hide_ui_gsource_func (gpointer self);
VALA_EXTERN void games_titlebar_box_set_reveal_titlebar (GamesTitlebarBox* self,
                                             gboolean value);
static gboolean games_fullscreen_box_on_inactivity (GamesFullscreenBox* self);
static gboolean _games_fullscreen_box_on_inactivity_gsource_func (gpointer self);
static void games_fullscreen_box_show_cursor (GamesFullscreenBox* self,
                                       gboolean show);
static void games_fullscreen_box_on_restore (GamesFullscreenBox* self);
VALA_EXTERN GamesFullscreenBox* games_fullscreen_box_new (void);
VALA_EXTERN GamesFullscreenBox* games_fullscreen_box_construct (GType object_type);
VALA_EXTERN void games_fullscreen_box_set_is_fullscreen (GamesFullscreenBox* self,
                                             gboolean value);
VALA_EXTERN gboolean games_fullscreen_box_get_overlay (GamesFullscreenBox* self);
VALA_EXTERN void games_fullscreen_box_set_overlay (GamesFullscreenBox* self,
                                       gboolean value);
VALA_EXTERN void games_fullscreen_box_set_autohide (GamesFullscreenBox* self,
                                        gboolean value);
static GObject * games_fullscreen_box_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void games_fullscreen_box_finalize (GObject * obj);
static GType games_fullscreen_box_get_type_once (void);
static void _vala_games_fullscreen_box_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_games_fullscreen_box_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_fullscreen_box_get_instance_private (GamesFullscreenBox* self)
{
	return G_STRUCT_MEMBER_P (self, GamesFullscreenBox_private_offset);
}

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

static void
games_fullscreen_box_real_add_child (GtkBuildable* base,
                                     GtkBuilder* builder,
                                     GObject* child,
                                     const gchar* type)
{
	GamesFullscreenBox * self;
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	GamesTitlebarBox* _tmp1_;
	self = (GamesFullscreenBox*) base;
	g_return_if_fail (builder != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (child, gtk_widget_get_type ()) ? ((GtkWidget*) child) : NULL);
	widget = _tmp0_;
	_tmp1_ = self->priv->titlebar_box;
	if (_tmp1_ == NULL) {
		GtkWidget* _tmp2_;
		_tmp2_ = widget;
		gtk_container_add ((GtkContainer*) self, _tmp2_);
		_g_object_unref0 (widget);
		return;
	}
	if (g_strcmp0 (type, "titlebar") == 0) {
		GamesTitlebarBox* _tmp3_;
		GtkWidget* _tmp4_;
		_tmp3_ = self->priv->titlebar_box;
		_tmp4_ = widget;
		games_titlebar_box_set_titlebar (_tmp3_, _tmp4_);
	} else {
		GamesTitlebarBox* _tmp5_;
		GtkWidget* _tmp6_;
		_tmp5_ = self->priv->titlebar_box;
		_tmp6_ = widget;
		gtk_container_add ((GtkContainer*) _tmp5_, _tmp6_);
	}
	_g_object_unref0 (widget);
}

static gboolean
games_fullscreen_box_on_motion_event (GamesFullscreenBox* self,
                                      GdkEventMotion* event)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = games_fullscreen_box_get_autohide (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	if (event->y_root <= ((gdouble) GAMES_FULLSCREEN_BOX_SHOW_HEADERBAR_DISTANCE)) {
		games_fullscreen_box_show_ui (self);
	}
	games_fullscreen_box_on_cursor_moved (self);
	result = FALSE;
	return result;
}

static gboolean
_games_fullscreen_box_on_motion_event_gtk_widget_motion_notify_event (GtkWidget* _sender,
                                                                      GdkEventMotion* event,
                                                                      gpointer self)
{
	gboolean result;
	result = games_fullscreen_box_on_motion_event ((GamesFullscreenBox*) self, event);
	return result;
}

static gboolean
_games_fullscreen_box_hide_ui_gsource_func (gpointer self)
{
	gboolean result;
	result = games_fullscreen_box_hide_ui ((GamesFullscreenBox*) self);
	return result;
}

static void
games_fullscreen_box_show_ui (GamesFullscreenBox* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	GamesTitlebarBox* _tmp2_;
	g_return_if_fail (self != NULL);
	if (self->priv->ui_timeout_id != ((guint) -1)) {
		g_source_remove (self->priv->ui_timeout_id);
		self->priv->ui_timeout_id = (guint) -1;
	}
	_tmp0_ = games_fullscreen_box_get_is_fullscreen (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	self->priv->ui_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, GAMES_FULLSCREEN_BOX_INACTIVITY_TIME_MILLISECONDS, _games_fullscreen_box_hide_ui_gsource_func, g_object_ref (self), g_object_unref);
	_tmp2_ = self->priv->titlebar_box;
	games_titlebar_box_set_reveal_titlebar (_tmp2_, TRUE);
}

static gboolean
games_fullscreen_box_hide_ui (GamesFullscreenBox* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	GamesTitlebarBox* _tmp2_;
	GamesTitlebarBox* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->ui_timeout_id = (guint) -1;
	_tmp0_ = games_fullscreen_box_get_is_fullscreen (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	_tmp2_ = self->priv->titlebar_box;
	games_titlebar_box_set_reveal_titlebar (_tmp2_, FALSE);
	_tmp3_ = self->priv->titlebar_box;
	gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
	result = FALSE;
	return result;
}

static gboolean
_games_fullscreen_box_on_inactivity_gsource_func (gpointer self)
{
	gboolean result;
	result = games_fullscreen_box_on_inactivity ((GamesFullscreenBox*) self);
	return result;
}

static void
games_fullscreen_box_on_cursor_moved (GamesFullscreenBox* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->cursor_timeout_id != ((guint) -1)) {
		g_source_remove (self->priv->cursor_timeout_id);
		self->priv->cursor_timeout_id = (guint) -1;
	}
	self->priv->cursor_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, GAMES_FULLSCREEN_BOX_INACTIVITY_TIME_MILLISECONDS, _games_fullscreen_box_on_inactivity_gsource_func, g_object_ref (self), g_object_unref);
	games_fullscreen_box_show_cursor (self, TRUE);
}

static gboolean
games_fullscreen_box_on_inactivity (GamesFullscreenBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->cursor_timeout_id = (guint) -1;
	games_fullscreen_box_show_cursor (self, FALSE);
	result = FALSE;
	return result;
}

static void
games_fullscreen_box_on_restore (GamesFullscreenBox* self)
{
	GamesTitlebarBox* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->ui_timeout_id != ((guint) -1)) {
		g_source_remove (self->priv->ui_timeout_id);
		self->priv->ui_timeout_id = (guint) -1;
	}
	if (self->priv->cursor_timeout_id != ((guint) -1)) {
		g_source_remove (self->priv->cursor_timeout_id);
		self->priv->cursor_timeout_id = (guint) -1;
	}
	_tmp0_ = self->priv->titlebar_box;
	games_titlebar_box_set_reveal_titlebar (_tmp0_, TRUE);
	games_fullscreen_box_on_cursor_moved (self);
}

static void
games_fullscreen_box_show_cursor (GamesFullscreenBox* self,
                                  gboolean show)
{
	GdkWindow* window = NULL;
	GdkWindow* _tmp0_;
	GdkWindow* _tmp1_;
	GdkWindow* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_window ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	window = _tmp1_;
	_tmp2_ = window;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (window);
		return;
	}
	if (show) {
		GdkWindow* _tmp5_;
		GdkCursor* _tmp6_;
		GdkCursor* _tmp7_;
		_tmp5_ = window;
		_tmp6_ = gdk_window_get_cursor (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp4_ = _tmp7_ == NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		gboolean _tmp8_ = FALSE;
		if (!show) {
			GdkWindow* _tmp9_;
			GdkCursor* _tmp10_;
			GdkCursor* _tmp11_;
			_tmp9_ = window;
			_tmp10_ = gdk_window_get_cursor (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp8_ = _tmp11_ != NULL;
		} else {
			_tmp8_ = FALSE;
		}
		_tmp3_ = _tmp8_;
	}
	if (_tmp3_) {
		_g_object_unref0 (window);
		return;
	}
	if (!show) {
		GdkDisplay* display = NULL;
		GdkWindow* _tmp12_;
		GdkDisplay* _tmp13_;
		GdkDisplay* _tmp14_;
		GdkWindow* _tmp15_;
		GdkDisplay* _tmp16_;
		GdkCursor* _tmp17_;
		GdkCursor* _tmp18_;
		_tmp12_ = window;
		_tmp13_ = gdk_window_get_display (_tmp12_);
		_tmp14_ = _g_object_ref0 (_tmp13_);
		display = _tmp14_;
		_tmp15_ = window;
		_tmp16_ = display;
		_tmp17_ = gdk_cursor_new_from_name (_tmp16_, "none");
		_tmp18_ = _tmp17_;
		gdk_window_set_cursor (_tmp15_, _tmp18_);
		_g_object_unref0 (_tmp18_);
		_g_object_unref0 (display);
	} else {
		GdkWindow* _tmp19_;
		_tmp19_ = window;
		gdk_window_set_cursor (_tmp19_, NULL);
	}
	_g_object_unref0 (window);
}

GamesFullscreenBox*
games_fullscreen_box_construct (GType object_type)
{
	GamesFullscreenBox * self = NULL;
	self = (GamesFullscreenBox*) g_object_new (object_type, NULL);
	return self;
}

GamesFullscreenBox*
games_fullscreen_box_new (void)
{
	return games_fullscreen_box_construct (GAMES_TYPE_FULLSCREEN_BOX);
}

gboolean
games_fullscreen_box_get_is_fullscreen (GamesFullscreenBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_fullscreen;
	return result;
}

void
games_fullscreen_box_set_is_fullscreen (GamesFullscreenBox* self,
                                        gboolean value)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	self->priv->_is_fullscreen = value;
	_tmp0_ = games_fullscreen_box_get_autohide (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = games_fullscreen_box_get_is_fullscreen (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		games_fullscreen_box_show_ui (self);
		games_fullscreen_box_on_cursor_moved (self);
	} else {
		games_fullscreen_box_on_restore (self);
	}
	g_object_notify_by_pspec ((GObject *) self, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY]);
}

gboolean
games_fullscreen_box_get_overlay (GamesFullscreenBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_overlay;
	return result;
}

void
games_fullscreen_box_set_overlay (GamesFullscreenBox* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_fullscreen_box_get_overlay (self);
	if (old_value != value) {
		self->priv->_overlay = value;
		g_object_notify_by_pspec ((GObject *) self, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY]);
	}
}

gboolean
games_fullscreen_box_get_autohide (GamesFullscreenBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_autohide;
	return result;
}

void
games_fullscreen_box_set_autohide (GamesFullscreenBox* self,
                                   gboolean value)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = games_fullscreen_box_get_autohide (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == value) {
		return;
	}
	self->priv->_autohide = value;
	if (value) {
		games_fullscreen_box_show_ui (self);
		games_fullscreen_box_on_cursor_moved (self);
	} else {
		GamesTitlebarBox* _tmp2_;
		if (self->priv->ui_timeout_id != ((guint) -1)) {
			g_source_remove (self->priv->ui_timeout_id);
			self->priv->ui_timeout_id = (guint) -1;
		}
		if (self->priv->cursor_timeout_id != ((guint) -1)) {
			g_source_remove (self->priv->cursor_timeout_id);
			self->priv->cursor_timeout_id = (guint) -1;
		}
		_tmp2_ = self->priv->titlebar_box;
		games_titlebar_box_set_reveal_titlebar (_tmp2_, TRUE);
		games_fullscreen_box_show_cursor (self, TRUE);
	}
	g_object_notify_by_pspec ((GObject *) self, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY]);
}

static GObject *
games_fullscreen_box_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesFullscreenBox * self;
	parent_class = G_OBJECT_CLASS (games_fullscreen_box_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBox);
	self->priv->ui_timeout_id = (guint) -1;
	self->priv->cursor_timeout_id = (guint) -1;
	return obj;
}

static void
games_fullscreen_box_class_init (GamesFullscreenBoxClass * klass,
                                 gpointer klass_data)
{
	games_fullscreen_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesFullscreenBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_fullscreen_box_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_fullscreen_box_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_fullscreen_box_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_fullscreen_box_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY] = g_param_spec_boolean ("is-fullscreen", "is-fullscreen", "is-fullscreen", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY] = g_param_spec_boolean ("overlay", "overlay", "overlay", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY, games_fullscreen_box_properties[GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY] = g_param_spec_boolean ("autohide", "autohide", "autohide", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/fullscreen-box.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "titlebar_box", FALSE, GamesFullscreenBox_private_offset + G_STRUCT_OFFSET (GamesFullscreenBoxPrivate, titlebar_box));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_motion_event", G_CALLBACK(_games_fullscreen_box_on_motion_event_gtk_widget_motion_notify_event));
}

static void
games_fullscreen_box_gtk_buildable_interface_init (GtkBuildableIface * iface,
                                                   gpointer iface_data)
{
	games_fullscreen_box_gtk_buildable_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_child = (void (*) (GtkBuildable*, GtkBuilder*, GObject*, const gchar*)) games_fullscreen_box_real_add_child;
}

static void
games_fullscreen_box_instance_init (GamesFullscreenBox * self,
                                    gpointer klass)
{
	self->priv = games_fullscreen_box_get_instance_private (self);
	self->priv->_autohide = TRUE;
	g_type_ensure (GAMES_TYPE_TITLEBAR_BOX);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_fullscreen_box_finalize (GObject * obj)
{
	GamesFullscreenBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBox);
	G_OBJECT_CLASS (games_fullscreen_box_parent_class)->finalize (obj);
}

static GType
games_fullscreen_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesFullscreenBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_fullscreen_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesFullscreenBox), 0, (GInstanceInitFunc) games_fullscreen_box_instance_init, NULL };
	static const GInterfaceInfo gtk_buildable_info = { (GInterfaceInitFunc) games_fullscreen_box_gtk_buildable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_fullscreen_box_type_id;
	games_fullscreen_box_type_id = g_type_register_static (gtk_event_box_get_type (), "GamesFullscreenBox", &g_define_type_info, 0);
	g_type_add_interface_static (games_fullscreen_box_type_id, gtk_buildable_get_type (), &gtk_buildable_info);
	GamesFullscreenBox_private_offset = g_type_add_instance_private (games_fullscreen_box_type_id, sizeof (GamesFullscreenBoxPrivate));
	return games_fullscreen_box_type_id;
}

GType
games_fullscreen_box_get_type (void)
{
	static volatile gsize games_fullscreen_box_type_id__once = 0;
	if (g_once_init_enter (&games_fullscreen_box_type_id__once)) {
		GType games_fullscreen_box_type_id;
		games_fullscreen_box_type_id = games_fullscreen_box_get_type_once ();
		g_once_init_leave (&games_fullscreen_box_type_id__once, games_fullscreen_box_type_id);
	}
	return games_fullscreen_box_type_id__once;
}

static void
_vala_games_fullscreen_box_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GamesFullscreenBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBox);
	switch (property_id) {
		case GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY:
		g_value_set_boolean (value, games_fullscreen_box_get_is_fullscreen (self));
		break;
		case GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY:
		g_value_set_boolean (value, games_fullscreen_box_get_overlay (self));
		break;
		case GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY:
		g_value_set_boolean (value, games_fullscreen_box_get_autohide (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_fullscreen_box_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GamesFullscreenBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_FULLSCREEN_BOX, GamesFullscreenBox);
	switch (property_id) {
		case GAMES_FULLSCREEN_BOX_IS_FULLSCREEN_PROPERTY:
		games_fullscreen_box_set_is_fullscreen (self, g_value_get_boolean (value));
		break;
		case GAMES_FULLSCREEN_BOX_OVERLAY_PROPERTY:
		games_fullscreen_box_set_overlay (self, g_value_get_boolean (value));
		break;
		case GAMES_FULLSCREEN_BOX_AUTOHIDE_PROPERTY:
		games_fullscreen_box_set_autohide (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

