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

/**/
/*  Copyright (C) 2017 Santiago León O., Adam Bieńkowski*/
/**/
/*  This program is free software: you can redistribute it and/or modify*/
/*  it under the terms of the GNU General Public License as published by*/
/*  the Free Software Foundation, either version 3 of the License, or*/
/*  (at your option) any later version.*/
/**/
/*  This program is distributed in the hope that it will be useful,*/
/*  but WITHOUT ANY WARRANTY; without even the implied warranty of*/
/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
/*  GNU General Public License for more details.*/
/**/
/*  You should have received a copy of the GNU General Public License*/
/*  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
/**/

#include "gala-pip.h"
#include "gala.h"
#include <graphene-gobject.h>
#include <glib.h>
#include <clutter/clutter.h>
#include <cairo-gobject.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <meta/meta-plugin.h>
#include <meta/display.h>
#include <meta/common.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  {
	GALA_PLUGINS_PIP_SELECTION_AREA_0_PROPERTY,
	GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY,
	GALA_PLUGINS_PIP_SELECTION_AREA_NUM_PROPERTIES
};
static GParamSpec* gala_plugins_pip_selection_area_properties[GALA_PLUGINS_PIP_SELECTION_AREA_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GALA_PLUGINS_PIP_SELECTION_AREA_CAPTURED_SIGNAL,
	GALA_PLUGINS_PIP_SELECTION_AREA_SELECTED_SIGNAL,
	GALA_PLUGINS_PIP_SELECTION_AREA_CLOSED_SIGNAL,
	GALA_PLUGINS_PIP_SELECTION_AREA_NUM_SIGNALS
};
static guint gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_NUM_SIGNALS] = {0};

struct _GalaPluginsPIPSelectionAreaPrivate {
	GalaWindowManager* _wm;
	GalaModalProxy* modal_proxy;
	graphene_point_t start_point;
	graphene_point_t end_point;
	gboolean dragging;
	gboolean clicked;
};

static gint GalaPluginsPIPSelectionArea_private_offset;
static gpointer gala_plugins_pip_selection_area_parent_class = NULL;

static gboolean gala_plugins_pip_selection_area_real_key_press_event (ClutterActor* base,
                                                               ClutterEvent* e);
static gboolean gala_plugins_pip_selection_area_real_button_press_event (ClutterActor* base,
                                                                  ClutterEvent* e);
static gboolean gala_plugins_pip_selection_area_real_button_release_event (ClutterActor* base,
                                                                    ClutterEvent* e);
static void gala_plugins_pip_selection_area_get_selection_rectangle (GalaPluginsPIPSelectionArea* self,
                                                              gint* x,
                                                              gint* y,
                                                              gint* width,
                                                              gint* height);
static gboolean gala_plugins_pip_selection_area_real_motion_event (ClutterActor* base,
                                                            ClutterEvent* e);
static void gala_plugins_pip_selection_area_real_draw (GalaCanvasActor* base,
                                                cairo_t* ctx,
                                                gint width,
                                                gint height);
static void g_cclosure_user_marshal_VOID__INT_INT_INT_INT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure,
                                            GValue * return_value,
                                            guint n_param_values,
                                            const GValue * param_values,
                                            gpointer invocation_hint,
                                            gpointer marshal_data);
static GObject * gala_plugins_pip_selection_area_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties);
static void gala_plugins_pip_selection_area_finalize (GObject * obj);
static GType gala_plugins_pip_selection_area_get_type_once (void);
static void _vala_gala_plugins_pip_selection_area_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_gala_plugins_pip_selection_area_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);

static inline gpointer
gala_plugins_pip_selection_area_get_instance_private (GalaPluginsPIPSelectionArea* self)
{
	return G_STRUCT_MEMBER_P (self, GalaPluginsPIPSelectionArea_private_offset);
}

GalaPluginsPIPSelectionArea*
gala_plugins_pip_selection_area_construct (GType object_type,
                                           GalaWindowManager* wm)
{
	GalaPluginsPIPSelectionArea * self = NULL;
	g_return_val_if_fail (wm != NULL, NULL);
	self = (GalaPluginsPIPSelectionArea*) g_object_new (object_type, "wm", wm, NULL);
	return self;
}

GalaPluginsPIPSelectionArea*
gala_plugins_pip_selection_area_new (GalaWindowManager* wm)
{
	return gala_plugins_pip_selection_area_construct (GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, wm);
}

static gboolean
gala_plugins_pip_selection_area_real_key_press_event (ClutterActor* base,
                                                      ClutterEvent* e)
{
	GalaPluginsPIPSelectionArea * self;
	gboolean result;
	self = (GalaPluginsPIPSelectionArea*) base;
	g_return_val_if_fail (e != NULL, FALSE);
	if (clutter_event_get_key_symbol (e) == CLUTTER_KEY_Escape) {
		gala_plugins_pip_selection_area_close (self);
		g_signal_emit (self, gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_CLOSED_SIGNAL], 0);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
gala_plugins_pip_selection_area_real_button_press_event (ClutterActor* base,
                                                         ClutterEvent* e)
{
	GalaPluginsPIPSelectionArea * self;
	gboolean _tmp0_ = FALSE;
	gfloat press_x = 0.0F;
	gfloat press_y = 0.0F;
	gfloat _tmp1_ = 0.0F;
	gfloat _tmp2_ = 0.0F;
	graphene_point_t _tmp3_ = {0};
	gboolean result;
	self = (GalaPluginsPIPSelectionArea*) base;
	g_return_val_if_fail (e != NULL, FALSE);
	if (self->priv->dragging) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = clutter_event_get_button (e) != CLUTTER_BUTTON_PRIMARY;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	self->priv->clicked = TRUE;
	clutter_event_get_coords (e, &_tmp1_, &_tmp2_);
	press_x = _tmp1_;
	press_y = _tmp2_;
	_tmp3_.x = (gfloat) ((gint) press_x);
	_tmp3_.y = (gfloat) ((gint) press_y);
	self->priv->start_point = _tmp3_;
	result = TRUE;
	return result;
}

static gboolean
gala_plugins_pip_selection_area_real_button_release_event (ClutterActor* base,
                                                           ClutterEvent* e)
{
	GalaPluginsPIPSelectionArea * self;
	gint x = 0;
	gint y = 0;
	gint w = 0;
	gint h = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	graphene_point_t _tmp6_ = {0};
	graphene_point_t _tmp7_ = {0};
	ClutterContent* _tmp8_;
	ClutterContent* _tmp9_;
	gboolean result;
	self = (GalaPluginsPIPSelectionArea*) base;
	g_return_val_if_fail (e != NULL, FALSE);
	if (clutter_event_get_button (e) != CLUTTER_BUTTON_PRIMARY) {
		result = TRUE;
		return result;
	}
	if (!self->priv->dragging) {
		gfloat event_x = 0.0F;
		gfloat event_y = 0.0F;
		gfloat _tmp0_ = 0.0F;
		gfloat _tmp1_ = 0.0F;
		clutter_event_get_coords (e, &_tmp0_, &_tmp1_);
		event_x = _tmp0_;
		event_y = _tmp1_;
		g_signal_emit (self, gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_SELECTED_SIGNAL], 0, (gint) event_x, (gint) event_y);
		gala_plugins_pip_selection_area_close (self);
		result = TRUE;
		return result;
	}
	self->priv->dragging = FALSE;
	self->priv->clicked = FALSE;
	gala_plugins_pip_selection_area_get_selection_rectangle (self, &_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_);
	x = _tmp2_;
	y = _tmp3_;
	w = _tmp4_;
	h = _tmp5_;
	gala_plugins_pip_selection_area_close (self);
	_tmp6_.x = (gfloat) 0;
	_tmp6_.y = (gfloat) 0;
	self->priv->start_point = _tmp6_;
	_tmp7_.x = (gfloat) 0;
	_tmp7_.y = (gfloat) 0;
	self->priv->end_point = _tmp7_;
	clutter_actor_hide ((ClutterActor*) self);
	_tmp8_ = clutter_actor_get_content ((ClutterActor*) self);
	_tmp9_ = _tmp8_;
	clutter_content_invalidate (_tmp9_);
	g_signal_emit (self, gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_CAPTURED_SIGNAL], 0, x, y, w, h);
	result = TRUE;
	return result;
}

static gboolean
gala_plugins_pip_selection_area_real_motion_event (ClutterActor* base,
                                                   ClutterEvent* e)
{
	GalaPluginsPIPSelectionArea * self;
	gfloat press_x = 0.0F;
	gfloat press_y = 0.0F;
	gfloat _tmp0_ = 0.0F;
	gfloat _tmp1_ = 0.0F;
	graphene_point_t _tmp2_ = {0};
	ClutterContent* _tmp3_;
	ClutterContent* _tmp4_;
	gboolean result;
	self = (GalaPluginsPIPSelectionArea*) base;
	g_return_val_if_fail (e != NULL, FALSE);
	if (!self->priv->clicked) {
		result = TRUE;
		return result;
	}
	clutter_event_get_coords (e, &_tmp0_, &_tmp1_);
	press_x = _tmp0_;
	press_y = _tmp1_;
	_tmp2_.x = (gfloat) ((gint) press_x);
	_tmp2_.y = (gfloat) ((gint) press_y);
	self->priv->end_point = _tmp2_;
	_tmp3_ = clutter_actor_get_content ((ClutterActor*) self);
	_tmp4_ = _tmp3_;
	clutter_content_invalidate (_tmp4_);
	if (!self->priv->dragging) {
		self->priv->dragging = TRUE;
	}
	result = TRUE;
	return result;
}

void
gala_plugins_pip_selection_area_close (GalaPluginsPIPSelectionArea* self)
{
	GalaWindowManager* _tmp0_;
	MetaDisplay* _tmp1_;
	GalaModalProxy* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_wm;
	_tmp1_ = meta_plugin_get_display ((MetaPlugin*) _tmp0_);
	meta_display_set_cursor (_tmp1_, META_CURSOR_DEFAULT);
	_tmp2_ = self->priv->modal_proxy;
	if (_tmp2_ != NULL) {
		GalaWindowManager* _tmp3_;
		GalaModalProxy* _tmp4_;
		_tmp3_ = self->priv->_wm;
		_tmp4_ = self->priv->modal_proxy;
		gala_window_manager_pop_modal (_tmp3_, _tmp4_);
	}
}

void
gala_plugins_pip_selection_area_start_selection (GalaPluginsPIPSelectionArea* self)
{
	GalaWindowManager* _tmp0_;
	MetaDisplay* _tmp1_;
	GalaWindowManager* _tmp2_;
	GalaModalProxy* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_wm;
	_tmp1_ = meta_plugin_get_display ((MetaPlugin*) _tmp0_);
	meta_display_set_cursor (_tmp1_, META_CURSOR_CROSSHAIR);
	clutter_actor_grab_key_focus ((ClutterActor*) self);
	_tmp2_ = self->priv->_wm;
	_tmp3_ = gala_window_manager_push_modal (_tmp2_, (ClutterActor*) self, TRUE);
	_g_object_unref0 (self->priv->modal_proxy);
	self->priv->modal_proxy = _tmp3_;
}

static void
gala_plugins_pip_selection_area_get_selection_rectangle (GalaPluginsPIPSelectionArea* self,
                                                         gint* x,
                                                         gint* y,
                                                         gint* width,
                                                         gint* height)
{
	gint _vala_x = 0;
	gint _vala_y = 0;
	gint _vala_width = 0;
	gint _vala_height = 0;
	graphene_point_t _tmp0_;
	graphene_point_t _tmp1_;
	graphene_point_t _tmp2_;
	graphene_point_t _tmp3_;
	graphene_point_t _tmp4_;
	graphene_point_t _tmp5_;
	graphene_point_t _tmp6_;
	graphene_point_t _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->start_point;
	_tmp1_ = self->priv->end_point;
	_vala_x = (gint) MIN (_tmp0_.x, _tmp1_.x);
	_tmp2_ = self->priv->start_point;
	_tmp3_ = self->priv->end_point;
	_vala_y = (gint) MIN (_tmp2_.y, _tmp3_.y);
	_tmp4_ = self->priv->start_point;
	_tmp5_ = self->priv->end_point;
	_vala_width = (gint) fabsf (_tmp4_.x - _tmp5_.x);
	_tmp6_ = self->priv->start_point;
	_tmp7_ = self->priv->end_point;
	_vala_height = (gint) fabsf (_tmp6_.y - _tmp7_.y);
	if (x) {
		*x = _vala_x;
	}
	if (y) {
		*y = _vala_y;
	}
	if (width) {
		*width = _vala_width;
	}
	if (height) {
		*height = _vala_height;
	}
}

static void
gala_plugins_pip_selection_area_real_draw (GalaCanvasActor* base,
                                           cairo_t* ctx,
                                           gint width,
                                           gint height)
{
	GalaPluginsPIPSelectionArea * self;
	gint x = 0;
	gint y = 0;
	gint w = 0;
	gint h = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	self = (GalaPluginsPIPSelectionArea*) base;
	g_return_if_fail (ctx != NULL);
	cairo_save (ctx);
	cairo_set_operator (ctx, CAIRO_OPERATOR_CLEAR);
	cairo_paint (ctx);
	cairo_restore (ctx);
	if (!self->priv->dragging) {
		return;
	}
	gala_plugins_pip_selection_area_get_selection_rectangle (self, &_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_);
	x = _tmp0_;
	y = _tmp1_;
	w = _tmp2_;
	h = _tmp3_;
	cairo_rectangle (ctx, (gdouble) x, (gdouble) y, (gdouble) w, (gdouble) h);
	cairo_set_source_rgba (ctx, 0.1, 0.1, 0.1, 0.2);
	cairo_fill (ctx);
	cairo_rectangle (ctx, (gdouble) x, (gdouble) y, (gdouble) w, (gdouble) h);
	cairo_set_source_rgb (ctx, 0.7, 0.7, 0.7);
	cairo_set_line_width (ctx, 1.0);
	cairo_stroke (ctx);
}

GalaWindowManager*
gala_plugins_pip_selection_area_get_wm (GalaPluginsPIPSelectionArea* self)
{
	GalaWindowManager* result;
	GalaWindowManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_wm;
	result = _tmp0_;
	return result;
}

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

static void
gala_plugins_pip_selection_area_set_wm (GalaPluginsPIPSelectionArea* self,
                                        GalaWindowManager* value)
{
	GalaWindowManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_plugins_pip_selection_area_get_wm (self);
	if (old_value != value) {
		GalaWindowManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_wm);
		self->priv->_wm = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_plugins_pip_selection_area_properties[GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__INT_INT_INT_INT (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_INT_INT_INT) (gpointer data1, gint arg_1, gint arg_2, gint arg_3, gint arg_4, gpointer data2);
	register GMarshalFunc_VOID__INT_INT_INT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), g_value_get_int (param_values + 3), g_value_get_int (param_values + 4), data2);
}

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

static GObject *
gala_plugins_pip_selection_area_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaPluginsPIPSelectionArea * self;
	graphene_point_t _tmp0_ = {0};
	graphene_point_t _tmp1_ = {0};
	gint screen_width = 0;
	gint screen_height = 0;
	GalaWindowManager* _tmp2_;
	MetaDisplay* _tmp3_;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	parent_class = G_OBJECT_CLASS (gala_plugins_pip_selection_area_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, GalaPluginsPIPSelectionArea);
	_tmp0_.x = (gfloat) 0;
	_tmp0_.y = (gfloat) 0;
	self->priv->start_point = _tmp0_;
	_tmp1_.x = (gfloat) 0;
	_tmp1_.y = (gfloat) 0;
	self->priv->end_point = _tmp1_;
	g_object_set ((ClutterActor*) self, "visible", TRUE, NULL);
	clutter_actor_set_reactive ((ClutterActor*) self, TRUE);
	_tmp2_ = self->priv->_wm;
	_tmp3_ = meta_plugin_get_display ((MetaPlugin*) _tmp2_);
	meta_display_get_size (_tmp3_, &_tmp4_, &_tmp5_);
	screen_width = _tmp4_;
	screen_height = _tmp5_;
	clutter_actor_set_width ((ClutterActor*) self, (gfloat) screen_width);
	clutter_actor_set_height ((ClutterActor*) self, (gfloat) screen_height);
	return obj;
}

static void
gala_plugins_pip_selection_area_class_init (GalaPluginsPIPSelectionAreaClass * klass,
                                            gpointer klass_data)
{
	gala_plugins_pip_selection_area_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaPluginsPIPSelectionArea_private_offset);
	((ClutterActorClass *) klass)->key_press_event = (gboolean (*) (ClutterActor*, ClutterEvent*)) gala_plugins_pip_selection_area_real_key_press_event;
	((ClutterActorClass *) klass)->button_press_event = (gboolean (*) (ClutterActor*, ClutterEvent*)) gala_plugins_pip_selection_area_real_button_press_event;
	((ClutterActorClass *) klass)->button_release_event = (gboolean (*) (ClutterActor*, ClutterEvent*)) gala_plugins_pip_selection_area_real_button_release_event;
	((ClutterActorClass *) klass)->motion_event = (gboolean (*) (ClutterActor*, ClutterEvent*)) gala_plugins_pip_selection_area_real_motion_event;
	((GalaCanvasActorClass *) klass)->draw = (void (*) (GalaCanvasActor*, cairo_t*, gint, gint)) gala_plugins_pip_selection_area_real_draw;
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_plugins_pip_selection_area_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gala_plugins_pip_selection_area_set_property;
	G_OBJECT_CLASS (klass)->constructor = gala_plugins_pip_selection_area_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_plugins_pip_selection_area_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY, gala_plugins_pip_selection_area_properties[GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY] = g_param_spec_object ("wm", "wm", "wm", GALA_TYPE_WINDOW_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_CAPTURED_SIGNAL] = g_signal_new ("captured", GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT_INT_INT, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
	gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_SELECTED_SIGNAL] = g_signal_new ("selected", GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
	gala_plugins_pip_selection_area_signals[GALA_PLUGINS_PIP_SELECTION_AREA_CLOSED_SIGNAL] = g_signal_new ("closed", GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
gala_plugins_pip_selection_area_instance_init (GalaPluginsPIPSelectionArea * self,
                                               gpointer klass)
{
	self->priv = gala_plugins_pip_selection_area_get_instance_private (self);
	self->priv->dragging = FALSE;
	self->priv->clicked = FALSE;
}

static void
gala_plugins_pip_selection_area_finalize (GObject * obj)
{
	GalaPluginsPIPSelectionArea * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, GalaPluginsPIPSelectionArea);
	_g_object_unref0 (self->priv->_wm);
	_g_object_unref0 (self->priv->modal_proxy);
	G_OBJECT_CLASS (gala_plugins_pip_selection_area_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gala_plugins_pip_selection_area_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaPluginsPIPSelectionAreaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_plugins_pip_selection_area_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaPluginsPIPSelectionArea), 0, (GInstanceInitFunc) gala_plugins_pip_selection_area_instance_init, NULL };
	GType gala_plugins_pip_selection_area_type_id;
	gala_plugins_pip_selection_area_type_id = g_type_register_static (GALA_TYPE_CANVAS_ACTOR, "GalaPluginsPIPSelectionArea", &g_define_type_info, 0);
	GalaPluginsPIPSelectionArea_private_offset = g_type_add_instance_private (gala_plugins_pip_selection_area_type_id, sizeof (GalaPluginsPIPSelectionAreaPrivate));
	return gala_plugins_pip_selection_area_type_id;
}

GType
gala_plugins_pip_selection_area_get_type (void)
{
	static gsize gala_plugins_pip_selection_area_type_id__once = 0;
	if (g_once_init_enter (&gala_plugins_pip_selection_area_type_id__once)) {
		GType gala_plugins_pip_selection_area_type_id;
		gala_plugins_pip_selection_area_type_id = gala_plugins_pip_selection_area_get_type_once ();
		g_once_init_leave (&gala_plugins_pip_selection_area_type_id__once, gala_plugins_pip_selection_area_type_id);
	}
	return gala_plugins_pip_selection_area_type_id__once;
}

static void
_vala_gala_plugins_pip_selection_area_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	GalaPluginsPIPSelectionArea * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, GalaPluginsPIPSelectionArea);
	switch (property_id) {
		case GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY:
		g_value_set_object (value, gala_plugins_pip_selection_area_get_wm (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gala_plugins_pip_selection_area_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	GalaPluginsPIPSelectionArea * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_PLUGINS_PIP_TYPE_SELECTION_AREA, GalaPluginsPIPSelectionArea);
	switch (property_id) {
		case GALA_PLUGINS_PIP_SELECTION_AREA_WM_PROPERTY:
		gala_plugins_pip_selection_area_set_wm (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

