/* fullscreen.c generated by valac 0.56.17, the Vala compiler
 * generated from fullscreen.vala, do not modify */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <cairo-gobject.h>
#include "display_backend.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PDFPC_WINDOW_TYPE_FULLSCREEN (pdfpc_window_fullscreen_get_type ())
#define PDFPC_WINDOW_FULLSCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreen))
#define PDFPC_WINDOW_FULLSCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreenClass))
#define PDFPC_WINDOW_IS_FULLSCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN))
#define PDFPC_WINDOW_IS_FULLSCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_WINDOW_TYPE_FULLSCREEN))
#define PDFPC_WINDOW_FULLSCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreenClass))

typedef struct _pdfpcWindowFullscreen pdfpcWindowFullscreen;
typedef struct _pdfpcWindowFullscreenClass pdfpcWindowFullscreenClass;
typedef struct _pdfpcWindowFullscreenPrivate pdfpcWindowFullscreenPrivate;
enum  {
	PDFPC_WINDOW_FULLSCREEN_0_PROPERTY,
	PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY,
	PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY,
	PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY,
	PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY,
	PDFPC_WINDOW_FULLSCREEN_NUM_PROPERTIES
};
static GParamSpec* pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _pdfpcWindowFullscreen {
	GtkWindow parent_instance;
	pdfpcWindowFullscreenPrivate * priv;
	gboolean windowed;
	GdkScreen* screen_to_use;
	gint monitor_num_to_use;
};

struct _pdfpcWindowFullscreenClass {
	GtkWindowClass parent_class;
	void (*resize_gui) (pdfpcWindowFullscreen* self);
};

struct _pdfpcWindowFullscreenPrivate {
	gint _window_w;
	gint _window_h;
	gint _gdk_scale;
	GdkMonitor* _monitor;
};

static gint pdfpcWindowFullscreen_private_offset;
static gpointer pdfpc_window_fullscreen_parent_class = NULL;
VALA_EXTERN gboolean pdfpc_options_wayland_workaround;
VALA_EXTERN gboolean pdfpc_options_move_on_mapped;

VALA_EXTERN GType pdfpc_window_fullscreen_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcWindowFullscreen, g_object_unref)
VALA_EXTERN void pdfpc_window_fullscreen_resize_gui (pdfpcWindowFullscreen* self);
static void pdfpc_window_fullscreen_real_resize_gui (pdfpcWindowFullscreen* self);
VALA_EXTERN pdfpcWindowFullscreen* pdfpc_window_fullscreen_new (gint monitor_num,
                                                    gboolean windowed,
                                                    gint width,
                                                    gint height);
VALA_EXTERN pdfpcWindowFullscreen* pdfpc_window_fullscreen_construct (GType object_type,
                                                          gint monitor_num,
                                                          gboolean windowed,
                                                          gint width,
                                                          gint height);
VALA_EXTERN void pdfpc_window_fullscreen_set_monitor (pdfpcWindowFullscreen* self,
                                          GdkMonitor* value);
VALA_EXTERN GdkMonitor* pdfpc_window_fullscreen_get_monitor (pdfpcWindowFullscreen* self);
VALA_EXTERN void pdfpc_window_fullscreen_set_gdk_scale (pdfpcWindowFullscreen* self,
                                            gint value);
VALA_EXTERN void pdfpc_window_fullscreen_set_window_w (pdfpcWindowFullscreen* self,
                                           gint value);
VALA_EXTERN void pdfpc_window_fullscreen_set_window_h (pdfpcWindowFullscreen* self,
                                           gint value);
VALA_EXTERN gint pdfpc_window_fullscreen_get_window_w (pdfpcWindowFullscreen* self);
VALA_EXTERN gint pdfpc_window_fullscreen_get_gdk_scale (pdfpcWindowFullscreen* self);
VALA_EXTERN gint pdfpc_window_fullscreen_get_window_h (pdfpcWindowFullscreen* self);
static gboolean ____lambda4_ (pdfpcWindowFullscreen* self);
VALA_EXTERN void pdfpc_window_fullscreen_do_fullscreen (pdfpcWindowFullscreen* self);
static gboolean _____lambda4__gtk_widget_map_event (GtkWidget* _sender,
                                             GdkEventAny* event,
                                             gpointer self);
static gboolean __lambda5_ (pdfpcWindowFullscreen* self,
                     GdkEventConfigure* ev);
static gboolean ___lambda5__gtk_widget_configure_event (GtkWidget* _sender,
                                                 GdkEventConfigure* event,
                                                 gpointer self);
VALA_EXTERN void pdfpc_window_fullscreen_toggle_windowed (pdfpcWindowFullscreen* self);
VALA_EXTERN void pdfpc_window_fullscreen_connect_monitor (pdfpcWindowFullscreen* self,
                                              GdkMonitor* monitor);
VALA_EXTERN gboolean pdfpc_window_fullscreen_is_monitor_connected (pdfpcWindowFullscreen* self);
static void pdfpc_window_fullscreen_finalize (GObject * obj);
static GType pdfpc_window_fullscreen_get_type_once (void);
static void _vala_pdfpc_window_fullscreen_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_pdfpc_window_fullscreen_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
pdfpc_window_fullscreen_get_instance_private (pdfpcWindowFullscreen* self)
{
	return G_STRUCT_MEMBER_P (self, pdfpcWindowFullscreen_private_offset);
}

static void
pdfpc_window_fullscreen_real_resize_gui (pdfpcWindowFullscreen* self)
{
}

void
pdfpc_window_fullscreen_resize_gui (pdfpcWindowFullscreen* self)
{
	pdfpcWindowFullscreenClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = PDFPC_WINDOW_FULLSCREEN_GET_CLASS (self);
	if (_klass_->resize_gui) {
		_klass_->resize_gui (self);
	}
}

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

static gboolean
____lambda4_ (pdfpcWindowFullscreen* self)
{
	gboolean result;
	pdfpc_window_fullscreen_do_fullscreen (self);
	result = TRUE;
	return result;
}

static gboolean
_____lambda4__gtk_widget_map_event (GtkWidget* _sender,
                                    GdkEventAny* event,
                                    gpointer self)
{
	gboolean result;
	result = ____lambda4_ ((pdfpcWindowFullscreen*) self);
	return result;
}

static gboolean
__lambda5_ (pdfpcWindowFullscreen* self,
            GdkEventConfigure* ev)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gboolean result;
	g_return_val_if_fail (ev != NULL, FALSE);
	_tmp1_ = self->priv->_window_w;
	if (ev->width != _tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp2_;
		_tmp2_ = self->priv->_window_h;
		_tmp0_ = ev->height != _tmp2_;
	}
	if (_tmp0_) {
		pdfpc_window_fullscreen_set_window_w (self, ev->width);
		pdfpc_window_fullscreen_set_window_h (self, ev->height);
		pdfpc_window_fullscreen_resize_gui (self);
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda5__gtk_widget_configure_event (GtkWidget* _sender,
                                        GdkEventConfigure* event,
                                        gpointer self)
{
	gboolean result;
	result = __lambda5_ ((pdfpcWindowFullscreen*) self, event);
	return result;
}

pdfpcWindowFullscreen*
pdfpc_window_fullscreen_construct (GType object_type,
                                   gint monitor_num,
                                   gboolean windowed,
                                   gint width,
                                   gint height)
{
	pdfpcWindowFullscreen * self = NULL;
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkMonitor* _tmp18_;
	GdkRectangle monitor_geometry = {0};
	GdkMonitor* _tmp19_;
	GdkRectangle _tmp20_ = {0};
	GdkRectangle _tmp21_;
	GdkRectangle _tmp22_;
	gboolean _tmp23_ = FALSE;
	gint _tmp31_;
	gint _tmp32_;
	self = (pdfpcWindowFullscreen*) g_object_new (object_type, NULL);
	self->windowed = windowed;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	display = _tmp1_;
	if (monitor_num >= 0) {
		GdkDisplay* _tmp2_;
		GdkMonitor* _tmp3_;
		GdkDisplay* _tmp4_;
		GdkScreen* _tmp5_;
		GdkScreen* _tmp6_;
		_tmp2_ = display;
		_tmp3_ = gdk_display_get_monitor (_tmp2_, monitor_num);
		pdfpc_window_fullscreen_set_monitor (self, _tmp3_);
		self->monitor_num_to_use = monitor_num;
		_tmp4_ = display;
		_tmp5_ = gdk_display_get_default_screen (_tmp4_);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (self->screen_to_use);
		self->screen_to_use = _tmp6_;
	} else {
		GdkDevice* device = NULL;
		GdkDisplay* _tmp7_;
		GdkSeat* _tmp8_;
		GdkDevice* _tmp9_;
		GdkDevice* _tmp10_;
		gint pointerx = 0;
		gint pointery = 0;
		GdkDevice* _tmp11_;
		GdkScreen* _tmp12_ = NULL;
		gint _tmp13_ = 0;
		gint _tmp14_ = 0;
		GdkScreen* _tmp15_;
		GdkDisplay* _tmp16_;
		GdkMonitor* _tmp17_;
		_tmp7_ = display;
		_tmp8_ = gdk_display_get_default_seat (_tmp7_);
		_tmp9_ = gdk_seat_get_pointer (_tmp8_);
		_tmp10_ = _g_object_ref0 (_tmp9_);
		device = _tmp10_;
		_tmp11_ = device;
		gdk_device_get_position (_tmp11_, &_tmp12_, &_tmp13_, &_tmp14_);
		_g_object_unref0 (self->screen_to_use);
		_tmp15_ = _g_object_ref0 (_tmp12_);
		self->screen_to_use = _tmp15_;
		pointerx = _tmp13_;
		pointery = _tmp14_;
		_tmp16_ = display;
		_tmp17_ = gdk_display_get_monitor_at_point (_tmp16_, pointerx, pointery);
		pdfpc_window_fullscreen_set_monitor (self, _tmp17_);
		self->monitor_num_to_use = 0;
		_g_object_unref0 (device);
	}
	_tmp18_ = self->priv->_monitor;
	pdfpc_window_fullscreen_set_gdk_scale (self, gdk_monitor_get_scale_factor (_tmp18_));
	_tmp19_ = self->priv->_monitor;
	gdk_monitor_get_geometry (_tmp19_, &_tmp20_);
	monitor_geometry = _tmp20_;
	_tmp21_ = monitor_geometry;
	pdfpc_window_fullscreen_set_window_w (self, _tmp21_.width);
	_tmp22_ = monitor_geometry;
	pdfpc_window_fullscreen_set_window_h (self, _tmp22_.height);
	if (is_Wayland_backend ()) {
		_tmp23_ = pdfpc_options_wayland_workaround;
	} else {
		_tmp23_ = FALSE;
	}
	if (_tmp23_) {
		gint _tmp24_;
		gint _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		_tmp24_ = self->priv->_window_w;
		_tmp25_ = self->priv->_gdk_scale;
		pdfpc_window_fullscreen_set_window_w (self, _tmp24_ / _tmp25_);
		_tmp26_ = self->priv->_window_h;
		_tmp27_ = self->priv->_gdk_scale;
		pdfpc_window_fullscreen_set_window_h (self, _tmp26_ / _tmp27_);
	}
	if (!self->windowed) {
		if (pdfpc_options_move_on_mapped) {
			g_signal_connect_object ((GtkWidget*) self, "map-event", (GCallback) _____lambda4__gtk_widget_map_event, self, 0);
		} else {
			pdfpc_window_fullscreen_do_fullscreen (self);
		}
	} else {
		gboolean _tmp28_ = FALSE;
		if (width > 0) {
			_tmp28_ = height > 0;
		} else {
			_tmp28_ = FALSE;
		}
		if (_tmp28_) {
			pdfpc_window_fullscreen_set_window_w (self, width);
			pdfpc_window_fullscreen_set_window_h (self, height);
		} else {
			gint _tmp29_;
			gint _tmp30_;
			_tmp29_ = self->priv->_window_w;
			pdfpc_window_fullscreen_set_window_w (self, _tmp29_ / 2);
			_tmp30_ = self->priv->_window_h;
			pdfpc_window_fullscreen_set_window_h (self, _tmp30_ / 2);
		}
	}
	_tmp31_ = self->priv->_window_w;
	_tmp32_ = self->priv->_window_h;
	gtk_window_set_default_size ((GtkWindow*) self, _tmp31_, _tmp32_);
	g_signal_connect_object ((GtkWidget*) self, "configure-event", (GCallback) ___lambda5__gtk_widget_configure_event, self, 0);
	_g_object_unref0 (display);
	return self;
}

pdfpcWindowFullscreen*
pdfpc_window_fullscreen_new (gint monitor_num,
                             gboolean windowed,
                             gint width,
                             gint height)
{
	return pdfpc_window_fullscreen_construct (PDFPC_WINDOW_TYPE_FULLSCREEN, monitor_num, windowed, width, height);
}

void
pdfpc_window_fullscreen_do_fullscreen (pdfpcWindowFullscreen* self)
{
	GdkMonitor* _tmp0_;
	GdkRectangle monitor_geometry = {0};
	GdkMonitor* _tmp1_;
	GdkRectangle _tmp2_ = {0};
	GdkRectangle _tmp3_;
	GdkRectangle _tmp4_;
	GdkScreen* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_monitor;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_monitor;
	gdk_monitor_get_geometry (_tmp1_, &_tmp2_);
	monitor_geometry = _tmp2_;
	_tmp3_ = monitor_geometry;
	_tmp4_ = monitor_geometry;
	gtk_window_move ((GtkWindow*) self, _tmp3_.x, _tmp4_.y);
	_tmp5_ = self->screen_to_use;
	gtk_window_fullscreen_on_monitor ((GtkWindow*) self, _tmp5_, self->monitor_num_to_use);
}

void
pdfpc_window_fullscreen_toggle_windowed (pdfpcWindowFullscreen* self)
{
	g_return_if_fail (self != NULL);
	self->windowed = !self->windowed;
	if (!self->windowed) {
		GdkWindow* window = NULL;
		GdkWindow* _tmp0_;
		GdkWindow* _tmp1_;
		GdkWindow* _tmp2_;
		_tmp0_ = gtk_widget_get_window ((GtkWidget*) self);
		_tmp1_ = _g_object_ref0 (_tmp0_);
		window = _tmp1_;
		_tmp2_ = window;
		if (_tmp2_ != NULL) {
			pdfpc_window_fullscreen_do_fullscreen (self);
		}
		_g_object_unref0 (window);
	} else {
		gtk_window_unfullscreen ((GtkWindow*) self);
	}
}

void
pdfpc_window_fullscreen_connect_monitor (pdfpcWindowFullscreen* self,
                                         GdkMonitor* monitor)
{
	g_return_if_fail (self != NULL);
	pdfpc_window_fullscreen_set_monitor (self, monitor);
}

gboolean
pdfpc_window_fullscreen_is_monitor_connected (pdfpcWindowFullscreen* self)
{
	gboolean _tmp0_ = FALSE;
	GdkMonitor* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_monitor;
	if (_tmp1_ != NULL) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gint
pdfpc_window_fullscreen_get_window_w (pdfpcWindowFullscreen* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_window_w;
	return result;
}

void
pdfpc_window_fullscreen_set_window_w (pdfpcWindowFullscreen* self,
                                      gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_window_fullscreen_get_window_w (self);
	if (old_value != value) {
		self->priv->_window_w = value;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY]);
	}
}

gint
pdfpc_window_fullscreen_get_window_h (pdfpcWindowFullscreen* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_window_h;
	return result;
}

void
pdfpc_window_fullscreen_set_window_h (pdfpcWindowFullscreen* self,
                                      gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_window_fullscreen_get_window_h (self);
	if (old_value != value) {
		self->priv->_window_h = value;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY]);
	}
}

gint
pdfpc_window_fullscreen_get_gdk_scale (pdfpcWindowFullscreen* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_gdk_scale;
	return result;
}

void
pdfpc_window_fullscreen_set_gdk_scale (pdfpcWindowFullscreen* self,
                                       gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_window_fullscreen_get_gdk_scale (self);
	if (old_value != value) {
		self->priv->_gdk_scale = value;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY]);
	}
}

GdkMonitor*
pdfpc_window_fullscreen_get_monitor (pdfpcWindowFullscreen* self)
{
	GdkMonitor* result;
	GdkMonitor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_monitor;
	result = _tmp0_;
	return result;
}

void
pdfpc_window_fullscreen_set_monitor (pdfpcWindowFullscreen* self,
                                     GdkMonitor* value)
{
	GdkMonitor* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_window_fullscreen_get_monitor (self);
	if (old_value != value) {
		GdkMonitor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_monitor);
		self->priv->_monitor = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY]);
	}
}

static void
pdfpc_window_fullscreen_class_init (pdfpcWindowFullscreenClass * klass,
                                    gpointer klass_data)
{
	pdfpc_window_fullscreen_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdfpcWindowFullscreen_private_offset);
	((pdfpcWindowFullscreenClass *) klass)->resize_gui = (void (*) (pdfpcWindowFullscreen*)) pdfpc_window_fullscreen_real_resize_gui;
	G_OBJECT_CLASS (klass)->get_property = _vala_pdfpc_window_fullscreen_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_pdfpc_window_fullscreen_set_property;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_window_fullscreen_finalize;
	/**
	         * The geometry of this window
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY] = g_param_spec_int ("window-w", "window-w", "window-w", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY] = g_param_spec_int ("window-h", "window-h", "window-h", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * The GDK scale factor. Used for better slide rendering
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY] = g_param_spec_int ("gdk-scale", "gdk-scale", "gdk-scale", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * ... and the actual monitor object
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY, pdfpc_window_fullscreen_properties[PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY] = g_param_spec_object ("monitor", "monitor", "monitor", gdk_monitor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
pdfpc_window_fullscreen_instance_init (pdfpcWindowFullscreen * self,
                                       gpointer klass)
{
	self->priv = pdfpc_window_fullscreen_get_instance_private (self);
}

static void
pdfpc_window_fullscreen_finalize (GObject * obj)
{
	pdfpcWindowFullscreen * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreen);
	_g_object_unref0 (self->screen_to_use);
	_g_object_unref0 (self->priv->_monitor);
	G_OBJECT_CLASS (pdfpc_window_fullscreen_parent_class)->finalize (obj);
}

/**
     * Window extension implementing the needed functionality to be
     * displayed/toggled fullscreen, including multi-head configurations.
     */
static GType
pdfpc_window_fullscreen_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcWindowFullscreenClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_window_fullscreen_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcWindowFullscreen), 0, (GInstanceInitFunc) pdfpc_window_fullscreen_instance_init, NULL };
	GType pdfpc_window_fullscreen_type_id;
	pdfpc_window_fullscreen_type_id = g_type_register_static (gtk_window_get_type (), "pdfpcWindowFullscreen", &g_define_type_info, 0);
	pdfpcWindowFullscreen_private_offset = g_type_add_instance_private (pdfpc_window_fullscreen_type_id, sizeof (pdfpcWindowFullscreenPrivate));
	return pdfpc_window_fullscreen_type_id;
}

GType
pdfpc_window_fullscreen_get_type (void)
{
	static volatile gsize pdfpc_window_fullscreen_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_window_fullscreen_type_id__once)) {
		GType pdfpc_window_fullscreen_type_id;
		pdfpc_window_fullscreen_type_id = pdfpc_window_fullscreen_get_type_once ();
		g_once_init_leave (&pdfpc_window_fullscreen_type_id__once, pdfpc_window_fullscreen_type_id);
	}
	return pdfpc_window_fullscreen_type_id__once;
}

static void
_vala_pdfpc_window_fullscreen_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	pdfpcWindowFullscreen * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreen);
	switch (property_id) {
		case PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY:
		g_value_set_int (value, pdfpc_window_fullscreen_get_window_w (self));
		break;
		case PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY:
		g_value_set_int (value, pdfpc_window_fullscreen_get_window_h (self));
		break;
		case PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY:
		g_value_set_int (value, pdfpc_window_fullscreen_get_gdk_scale (self));
		break;
		case PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY:
		g_value_set_object (value, pdfpc_window_fullscreen_get_monitor (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_pdfpc_window_fullscreen_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	pdfpcWindowFullscreen * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreen);
	switch (property_id) {
		case PDFPC_WINDOW_FULLSCREEN_WINDOW_W_PROPERTY:
		pdfpc_window_fullscreen_set_window_w (self, g_value_get_int (value));
		break;
		case PDFPC_WINDOW_FULLSCREEN_WINDOW_H_PROPERTY:
		pdfpc_window_fullscreen_set_window_h (self, g_value_get_int (value));
		break;
		case PDFPC_WINDOW_FULLSCREEN_GDK_SCALE_PROPERTY:
		pdfpc_window_fullscreen_set_gdk_scale (self, g_value_get_int (value));
		break;
		case PDFPC_WINDOW_FULLSCREEN_MONITOR_PROPERTY:
		pdfpc_window_fullscreen_set_monitor (self, g_value_get_object (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;
}

