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

/*
 * Copyright 2026 elementary, Inc. <https://elementary.io>
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "gala.h"
#include <glib.h>
#include <float.h>
#include <math.h>
#include <clutter/clutter.h>
#include <cairo-gobject.h>
#include <glib-object.h>
#include <meta/display.h>
#include <meta/meta-plugin.h>
#include <mtk/mtk.h>
#include <stdlib.h>
#include <string.h>
#include <atk/atk.h>
#include <pango/pango.h>

#define GALA_ABSTRACT_SWITCHER_MIN_OFFSET 64
#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_ABSTRACT_SWITCHER_0_PROPERTY,
	GALA_ABSTRACT_SWITCHER_ACTOR_PROPERTY,
	GALA_ABSTRACT_SWITCHER_WM_PROPERTY,
	GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY,
	GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY,
	GALA_ABSTRACT_SWITCHER_CAPTION_TEXT_PROPERTY,
	GALA_ABSTRACT_SWITCHER_NUM_PROPERTIES
};
static GParamSpec* gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_ClutterColor_free0(var) ((var == NULL) ? NULL : (var = (_vala_ClutterColor_free (var), NULL)))

struct _GalaAbstractSwitcherPrivate {
	GalaWindowManager* _wm;
	gfloat _monitor_scale;
	ClutterActor* _container;
	GalaText* caption;
	GalaDrawingStyleManager* style_manager;
	GalaShadowEffect* shadow_effect;
	GalaBackgroundBlurEffect* blur_effect;
};

static gint GalaAbstractSwitcher_private_offset;
static gpointer gala_abstract_switcher_parent_class = NULL;

static void gala_abstract_switcher_scale (GalaAbstractSwitcher* self);
static void gala_abstract_switcher_real_get_preferred_width (ClutterActor* base,
                                                      gfloat for_height,
                                                      gfloat* min_width,
                                                      gfloat* natural_width);
static void gala_abstract_switcher_real_draw (GalaCanvasActor* base,
                                       cairo_t* ctx,
                                       gint width,
                                       gint height);
static void _vala_ClutterColor_free (ClutterColor* self);
static void gala_abstract_switcher_set_container (GalaAbstractSwitcher* self,
                                           ClutterActor* value);
static GObject * gala_abstract_switcher_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void _gala_abstract_switcher_scale_g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self);
static void _clutter_content_invalidate_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self);
static void _gala_abstract_switcher___lambda27_ (GalaAbstractSwitcher* self);
static void __gala_abstract_switcher___lambda27__g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self);
static void gala_abstract_switcher_finalize (GObject * obj);
static GType gala_abstract_switcher_get_type_once (void);
static void _vala_gala_abstract_switcher_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_gala_abstract_switcher_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);

VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_LIGHT_BACKGROUND;
VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_LIGHT_BORDER;
VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_LIGHT_HIGHLIGHT;
VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_DARK_BACKGROUND;
VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_DARK_BORDER;
VALA_EXTERN const ClutterColor GALA_DRAWING_COLOR_DARK_HIGHLIGHT;

static inline gpointer
gala_abstract_switcher_get_instance_private (GalaAbstractSwitcher* self)
{
	return G_STRUCT_MEMBER_P (self, GalaAbstractSwitcher_private_offset);
}

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

static void
gala_abstract_switcher_scale (GalaAbstractSwitcher* self)
{
	gint margin = 0;
	gfloat _tmp0_;
	ClutterActor* _tmp1_;
	ClutterActor* _tmp2_;
	ClutterActor* _tmp3_;
	ClutterActor* _tmp4_;
	GalaText* _tmp5_;
	GalaText* _tmp6_;
	GalaText* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_monitor_scale;
	margin = gala_utils_scale_to_int (GALA_ABSTRACT_SWITCHER_WRAPPER_PADDING, _tmp0_);
	_tmp1_ = self->priv->_container;
	clutter_actor_set_margin_left (_tmp1_, (gfloat) margin);
	_tmp2_ = self->priv->_container;
	clutter_actor_set_margin_right (_tmp2_, (gfloat) margin);
	_tmp3_ = self->priv->_container;
	clutter_actor_set_margin_bottom (_tmp3_, (gfloat) margin);
	_tmp4_ = self->priv->_container;
	clutter_actor_set_margin_top (_tmp4_, (gfloat) margin);
	_tmp5_ = self->priv->caption;
	clutter_actor_set_margin_left ((ClutterActor*) _tmp5_, (gfloat) margin);
	_tmp6_ = self->priv->caption;
	clutter_actor_set_margin_right ((ClutterActor*) _tmp6_, (gfloat) margin);
	_tmp7_ = self->priv->caption;
	clutter_actor_set_margin_bottom ((ClutterActor*) _tmp7_, (gfloat) margin);
}

static void
gala_abstract_switcher_real_get_preferred_width (ClutterActor* base,
                                                 gfloat for_height,
                                                 gfloat* min_width,
                                                 gfloat* natural_width)
{
	GalaAbstractSwitcher * self;
	gfloat _vala_min_width = 0.0F;
	gfloat _vala_natural_width = 0.0F;
	gfloat preferred_nat_width = 0.0F;
	gfloat _tmp0_ = 0.0F;
	MetaDisplay* display = NULL;
	GalaWindowManager* _tmp1_;
	MetaDisplay* _tmp2_;
	MtkRectangle geom = {0};
	MtkRectangle _tmp3_ = {0};
	gfloat container_nat_width = 0.0F;
	ClutterActor* _tmp4_;
	gfloat _tmp5_ = 0.0F;
	gfloat max_width = 0.0F;
	MtkRectangle _tmp6_;
	gfloat _tmp7_;
	self = (GalaAbstractSwitcher*) base;
	_vala_min_width = (gfloat) 0;
	CLUTTER_ACTOR_CLASS (gala_abstract_switcher_parent_class)->get_preferred_width ((ClutterActor*) G_TYPE_CHECK_INSTANCE_CAST (self, GALA_TYPE_CANVAS_ACTOR, GalaCanvasActor), for_height, NULL, &_tmp0_);
	preferred_nat_width = _tmp0_;
	_tmp1_ = self->priv->_wm;
	_tmp2_ = meta_plugin_get_display ((MetaPlugin*) _tmp1_);
	display = _tmp2_;
	meta_display_get_monitor_geometry (display, meta_display_get_current_monitor (display), &_tmp3_);
	geom = _tmp3_;
	_tmp4_ = self->priv->_container;
	clutter_actor_get_preferred_size (_tmp4_, NULL, NULL, &_tmp5_, NULL);
	container_nat_width = _tmp5_;
	_tmp6_ = geom;
	_tmp7_ = self->priv->_monitor_scale;
	max_width = MIN ((gfloat) (_tmp6_.width - gala_utils_scale_to_int (GALA_ABSTRACT_SWITCHER_MIN_OFFSET * 2, _tmp7_)), container_nat_width);
	_vala_natural_width = MIN (max_width, preferred_nat_width);
	if (min_width) {
		*min_width = _vala_min_width;
	}
	if (natural_width) {
		*natural_width = _vala_natural_width;
	}
}

static ClutterColor*
_vala_clutter_color_from_string (const gchar* str)
{
	ClutterColor* color = NULL;
	ClutterColor* _tmp0_;
	ClutterColor* result;
	g_return_val_if_fail (str != NULL, NULL);
	_tmp0_ = clutter_color_alloc ();
	color = _tmp0_;
	clutter_color_from_string (color, str);
	result = color;
	return result;
}

static void
_vala_ClutterColor_free (ClutterColor* self)
{
	g_boxed_free (clutter_color_get_type (), self);
}

static void
gala_abstract_switcher_real_draw (GalaCanvasActor* base,
                                  cairo_t* ctx,
                                  gint width,
                                  gint height)
{
	GalaAbstractSwitcher * self;
	ClutterColor background_color = {0};
	ClutterColor border_color = {0};
	gchar* caption_color = NULL;
	gchar* _tmp0_;
	ClutterColor highlight_color = {0};
	GalaDrawingStyleManager* _tmp1_;
	GalaDrawingStyleManagerColorScheme _tmp2_;
	GalaDrawingStyleManagerColorScheme _tmp3_;
	GalaText* _tmp5_;
	const gchar* _tmp6_;
	ClutterColor* _tmp7_;
	ClutterColor* _tmp8_;
	ClutterColor _tmp9_;
	gint stroke_width = 0;
	gfloat _tmp10_;
	gfloat _tmp11_;
	ClutterColor _tmp12_;
	ClutterColor _tmp13_;
	ClutterColor _tmp14_;
	ClutterColor _tmp15_;
	ClutterColor _tmp16_;
	ClutterColor _tmp17_;
	ClutterColor _tmp18_;
	gfloat _tmp19_;
	ClutterColor _tmp20_;
	ClutterColor _tmp21_;
	ClutterColor _tmp22_;
	self = (GalaAbstractSwitcher*) base;
	g_return_if_fail (ctx != NULL);
	background_color = GALA_DRAWING_COLOR_LIGHT_BACKGROUND;
	border_color = GALA_DRAWING_COLOR_LIGHT_BORDER;
	_tmp0_ = g_strdup ("#2e2e31");
	caption_color = _tmp0_;
	highlight_color = GALA_DRAWING_COLOR_LIGHT_HIGHLIGHT;
	_tmp1_ = self->priv->style_manager;
	_tmp2_ = gala_drawing_style_manager_get_prefers_color_scheme (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == GALA_DRAWING_STYLE_MANAGER_COLOR_SCHEME_DARK) {
		gchar* _tmp4_;
		background_color = GALA_DRAWING_COLOR_DARK_BACKGROUND;
		border_color = GALA_DRAWING_COLOR_DARK_BORDER;
		_tmp4_ = g_strdup ("#fafafa");
		_g_free0 (caption_color);
		caption_color = _tmp4_;
		highlight_color = GALA_DRAWING_COLOR_DARK_HIGHLIGHT;
	}
	_tmp5_ = self->priv->caption;
	_tmp6_ = caption_color;
	_tmp7_ = _vala_clutter_color_from_string (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = *_tmp8_;
	gala_text_set_color (_tmp5_, &_tmp9_);
	__vala_ClutterColor_free0 (_tmp8_);
	cairo_save (ctx);
	cairo_set_operator (ctx, CAIRO_OPERATOR_CLEAR);
	cairo_paint (ctx);
	cairo_clip (ctx);
	cairo_reset_clip (ctx);
	cairo_set_operator (ctx, CAIRO_OPERATOR_SOURCE);
	_tmp10_ = self->priv->_monitor_scale;
	stroke_width = gala_utils_scale_to_int (1, _tmp10_);
	_tmp11_ = self->priv->_monitor_scale;
	gala_drawing_utilities_cairo_rounded_rectangle (ctx, stroke_width / 2.0, stroke_width / 2.0, (gdouble) (width - stroke_width), (gdouble) (height - stroke_width), (gdouble) gala_utils_scale_to_int (9, _tmp11_));
	_tmp12_ = background_color;
	_tmp13_ = background_color;
	_tmp14_ = background_color;
	cairo_set_source_rgba (ctx, _tmp12_.red / 255.0, _tmp13_.green / 255.0, _tmp14_.blue / 255.0, 0.6);
	cairo_fill_preserve (ctx);
	cairo_set_line_width (ctx, (gdouble) stroke_width);
	_tmp15_ = border_color;
	_tmp16_ = border_color;
	_tmp17_ = border_color;
	_tmp18_ = border_color;
	cairo_set_source_rgba (ctx, _tmp15_.red / 255.0, _tmp16_.green / 255.0, _tmp17_.blue / 255.0, _tmp18_.alpha / 255.0);
	cairo_stroke (ctx);
	cairo_restore (ctx);
	_tmp19_ = self->priv->_monitor_scale;
	gala_drawing_utilities_cairo_rounded_rectangle (ctx, stroke_width * 1.5, stroke_width * 1.5, (gdouble) (width - (stroke_width * 3)), (gdouble) (height - (stroke_width * 3)), (gdouble) gala_utils_scale_to_int (8, _tmp19_));
	cairo_set_line_width (ctx, (gdouble) stroke_width);
	_tmp20_ = highlight_color;
	_tmp21_ = highlight_color;
	_tmp22_ = highlight_color;
	cairo_set_source_rgba (ctx, _tmp20_.red / 255.0, _tmp21_.green / 255.0, _tmp22_.blue / 255.0, 0.3);
	cairo_stroke (ctx);
	cairo_restore (ctx);
	_g_free0 (caption_color);
}

ClutterActor*
gala_abstract_switcher_get_actor (GalaAbstractSwitcher* self)
{
	ClutterActor* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = (ClutterActor*) self;
	return result;
}

GalaWindowManager*
gala_abstract_switcher_get_wm (GalaAbstractSwitcher* 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_abstract_switcher_set_wm (GalaAbstractSwitcher* self,
                               GalaWindowManager* value)
{
	GalaWindowManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_abstract_switcher_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_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_WM_PROPERTY]);
	}
}

gfloat
gala_abstract_switcher_get_monitor_scale (GalaAbstractSwitcher* self)
{
	gfloat result;
	g_return_val_if_fail (self != NULL, -1.0F);
	result = self->priv->_monitor_scale;
	return result;
}

void
gala_abstract_switcher_set_monitor_scale (GalaAbstractSwitcher* self,
                                          gfloat value)
{
	gfloat old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_abstract_switcher_get_monitor_scale (self);
	if (old_value != value) {
		self->priv->_monitor_scale = value;
		g_object_notify_by_pspec ((GObject *) self, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY]);
	}
}

ClutterActor*
gala_abstract_switcher_get_container (GalaAbstractSwitcher* self)
{
	ClutterActor* result;
	ClutterActor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_container;
	result = _tmp0_;
	return result;
}

static void
gala_abstract_switcher_set_container (GalaAbstractSwitcher* self,
                                      ClutterActor* value)
{
	ClutterActor* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_abstract_switcher_get_container (self);
	if (old_value != value) {
		ClutterActor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_container);
		self->priv->_container = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY]);
	}
}

void
gala_abstract_switcher_set_caption_text (GalaAbstractSwitcher* self,
                                         const gchar* value)
{
	GalaText* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->caption;
	gala_text_set_text (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_CAPTION_TEXT_PROPERTY]);
}

static void
_gala_abstract_switcher_scale_g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self)
{
	gala_abstract_switcher_scale ((GalaAbstractSwitcher*) self);
}

static void
_clutter_content_invalidate_g_object_notify (GObject* _sender,
                                             GParamSpec* pspec,
                                             gpointer self)
{
	clutter_content_invalidate ((ClutterContent*) self);
}

static void
_gala_abstract_switcher___lambda27_ (GalaAbstractSwitcher* self)
{
	guint _tmp0_;
	guint _tmp1_;
	_tmp0_ = clutter_actor_get_opacity ((ClutterActor*) self);
	_tmp1_ = _tmp0_;
	g_object_set ((ClutterActor*) self, "visible", _tmp1_ != ((guint) 0), NULL);
}

static void
__gala_abstract_switcher___lambda27__g_object_notify (GObject* _sender,
                                                      GParamSpec* pspec,
                                                      gpointer self)
{
	_gala_abstract_switcher___lambda27_ ((GalaAbstractSwitcher*) self);
}

static GObject *
gala_abstract_switcher_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaAbstractSwitcher * self;
	GalaDrawingStyleManager* _tmp0_;
	GalaDrawingStyleManager* _tmp1_;
	ClutterFlowLayout* _tmp2_;
	ClutterActor* _tmp3_ = NULL;
	ClutterActor* _tmp4_;
	ClutterActor* _tmp5_;
	AtkObject* _tmp6_;
	GalaText* _tmp7_ = NULL;
	ClutterActor* _tmp8_;
	GalaText* _tmp9_;
	ClutterBoxLayout* _tmp10_ = NULL;
	ClutterBoxLayout* _tmp11_;
	gfloat _tmp12_;
	GalaShadowEffect* _tmp13_ = NULL;
	GalaShadowEffect* _tmp14_;
	GalaShadowEffect* _tmp15_;
	gfloat _tmp16_;
	GalaBackgroundBlurEffect* _tmp17_;
	GalaBackgroundBlurEffect* _tmp18_;
	GalaBackgroundBlurEffect* _tmp19_;
	GalaDrawingStyleManager* _tmp20_;
	ClutterContent* _tmp21_;
	ClutterContent* _tmp22_;
	parent_class = G_OBJECT_CLASS (gala_abstract_switcher_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_ABSTRACT_SWITCHER, GalaAbstractSwitcher);
	_tmp0_ = gala_drawing_style_manager_get_instance ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->style_manager);
	self->priv->style_manager = _tmp1_;
	_tmp2_ = (ClutterFlowLayout*) clutter_flow_layout_new (CLUTTER_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = clutter_actor_new ();
	clutter_actor_set_reactive (_tmp3_, TRUE);
	clutter_actor_set_layout_manager (_tmp3_, (ClutterLayoutManager*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	gala_abstract_switcher_set_container (self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = self->priv->_container;
	_tmp6_ = clutter_actor_get_accessible (_tmp5_);
	g_object_set (_tmp6_, "accessible-role", ATK_ROLE_LIST, NULL);
	_tmp7_ = gala_text_new ();
	gala_text_set_ellipsize (_tmp7_, PANGO_ELLIPSIZE_END);
	gala_text_set_line_alignment (_tmp7_, PANGO_ALIGN_CENTER);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->caption);
	self->priv->caption = _tmp7_;
	_tmp8_ = self->priv->_container;
	clutter_actor_add_child ((ClutterActor*) self, _tmp8_);
	_tmp9_ = self->priv->caption;
	clutter_actor_add_child ((ClutterActor*) self, (ClutterActor*) _tmp9_);
	clutter_actor_set_reactive ((ClutterActor*) self, TRUE);
	g_object_set ((ClutterActor*) self, "visible", FALSE, NULL);
	clutter_actor_set_opacity ((ClutterActor*) self, (guint) 0);
	_tmp10_ = (ClutterBoxLayout*) clutter_box_layout_new ();
	clutter_box_layout_set_orientation (_tmp10_, CLUTTER_ORIENTATION_VERTICAL);
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	clutter_actor_set_layout_manager ((ClutterActor*) self, (ClutterLayoutManager*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	g_signal_connect_object ((GObject*) self, "notify::monitor-scale", (GCallback) _gala_abstract_switcher_scale_g_object_notify, self, 0);
	gala_abstract_switcher_scale (self);
	_tmp12_ = self->priv->_monitor_scale;
	_tmp13_ = gala_shadow_effect_new ("window-switcher", _tmp12_);
	gala_shadow_effect_set_border_radius (_tmp13_, 10);
	gala_shadow_effect_set_shadow_opacity (_tmp13_, (guint8) 100);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->shadow_effect);
	self->priv->shadow_effect = _tmp13_;
	_tmp14_ = self->priv->shadow_effect;
	g_object_bind_property_with_closures ((GObject*) self, "monitor-scale", (GObject*) _tmp14_, "monitor-scale", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp15_ = self->priv->shadow_effect;
	clutter_actor_add_effect ((ClutterActor*) self, (ClutterEffect*) _tmp15_);
	_tmp16_ = self->priv->_monitor_scale;
	_tmp17_ = gala_background_blur_effect_new ((gfloat) 40, (gfloat) 9, _tmp16_);
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->blur_effect);
	self->priv->blur_effect = _tmp17_;
	_tmp18_ = self->priv->blur_effect;
	g_object_bind_property_with_closures ((GObject*) self, "monitor-scale", (GObject*) _tmp18_, "monitor-scale", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp19_ = self->priv->blur_effect;
	clutter_actor_add_effect ((ClutterActor*) self, (ClutterEffect*) _tmp19_);
	_tmp20_ = self->priv->style_manager;
	_tmp21_ = clutter_actor_get_content ((ClutterActor*) self);
	_tmp22_ = _tmp21_;
	g_signal_connect_object ((GObject*) _tmp20_, "notify::prefers-color-scheme", (GCallback) _clutter_content_invalidate_g_object_notify, _tmp22_, 0);
	g_signal_connect_object ((GObject*) self, "notify::opacity", (GCallback) __gala_abstract_switcher___lambda27__g_object_notify, self, 0);
	return obj;
}

static void
gala_abstract_switcher_class_init (GalaAbstractSwitcherClass * klass,
                                   gpointer klass_data)
{
	gala_abstract_switcher_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaAbstractSwitcher_private_offset);
	((ClutterActorClass *) klass)->get_preferred_width = (void (*) (ClutterActor*, gfloat, gfloat*, gfloat*)) gala_abstract_switcher_real_get_preferred_width;
	((GalaCanvasActorClass *) klass)->draw = (void (*) (GalaCanvasActor*, cairo_t*, gint, gint)) gala_abstract_switcher_real_draw;
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_abstract_switcher_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gala_abstract_switcher_set_property;
	G_OBJECT_CLASS (klass)->constructor = gala_abstract_switcher_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_abstract_switcher_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_ABSTRACT_SWITCHER_ACTOR_PROPERTY, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_ACTOR_PROPERTY] = g_param_spec_object ("actor", "actor", "actor", clutter_actor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_ABSTRACT_SWITCHER_WM_PROPERTY, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY] = g_param_spec_float ("monitor-scale", "monitor-scale", "monitor-scale", -G_MAXFLOAT, G_MAXFLOAT, 1.0f, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY] = g_param_spec_object ("container", "container", "container", clutter_actor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_ABSTRACT_SWITCHER_CAPTION_TEXT_PROPERTY, gala_abstract_switcher_properties[GALA_ABSTRACT_SWITCHER_CAPTION_TEXT_PROPERTY] = g_param_spec_string ("caption-text", "caption-text", "caption-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
gala_abstract_switcher_instance_init (GalaAbstractSwitcher * self,
                                      gpointer klass)
{
	self->priv = gala_abstract_switcher_get_instance_private (self);
	self->priv->_monitor_scale = 1.0f;
}

static void
gala_abstract_switcher_finalize (GObject * obj)
{
	GalaAbstractSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_ABSTRACT_SWITCHER, GalaAbstractSwitcher);
	_g_object_unref0 (self->priv->_wm);
	_g_object_unref0 (self->priv->_container);
	_g_object_unref0 (self->priv->caption);
	_g_object_unref0 (self->priv->style_manager);
	_g_object_unref0 (self->priv->shadow_effect);
	_g_object_unref0 (self->priv->blur_effect);
	G_OBJECT_CLASS (gala_abstract_switcher_parent_class)->finalize (obj);
}

/**
  * AbstractSwitcher is an abstract class that draws a "window switcher"-like widget.
  * It sets up required actor structure and handles drawing.
  */
 G_GNUC_NO_INLINE static GType
gala_abstract_switcher_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaAbstractSwitcherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_abstract_switcher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaAbstractSwitcher), 0, (GInstanceInitFunc) gala_abstract_switcher_instance_init, NULL };
	GType gala_abstract_switcher_type_id;
	gala_abstract_switcher_type_id = g_type_register_static (GALA_TYPE_CANVAS_ACTOR, "GalaAbstractSwitcher", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	GalaAbstractSwitcher_private_offset = g_type_add_instance_private (gala_abstract_switcher_type_id, sizeof (GalaAbstractSwitcherPrivate));
	return gala_abstract_switcher_type_id;
}

GType
gala_abstract_switcher_get_type (void)
{
	static gsize gala_abstract_switcher_type_id__once = 0;
	if (g_once_init_enter (&gala_abstract_switcher_type_id__once)) {
		GType gala_abstract_switcher_type_id;
		gala_abstract_switcher_type_id = gala_abstract_switcher_get_type_once ();
		g_once_init_leave (&gala_abstract_switcher_type_id__once, gala_abstract_switcher_type_id);
	}
	return gala_abstract_switcher_type_id__once;
}

static void
_vala_gala_abstract_switcher_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	GalaAbstractSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_ABSTRACT_SWITCHER, GalaAbstractSwitcher);
	switch (property_id) {
		case GALA_ABSTRACT_SWITCHER_ACTOR_PROPERTY:
		g_value_set_object (value, gala_abstract_switcher_get_actor (self));
		break;
		case GALA_ABSTRACT_SWITCHER_WM_PROPERTY:
		g_value_set_object (value, gala_abstract_switcher_get_wm (self));
		break;
		case GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY:
		g_value_set_float (value, gala_abstract_switcher_get_monitor_scale (self));
		break;
		case GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY:
		g_value_set_object (value, gala_abstract_switcher_get_container (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gala_abstract_switcher_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	GalaAbstractSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_ABSTRACT_SWITCHER, GalaAbstractSwitcher);
	switch (property_id) {
		case GALA_ABSTRACT_SWITCHER_WM_PROPERTY:
		gala_abstract_switcher_set_wm (self, g_value_get_object (value));
		break;
		case GALA_ABSTRACT_SWITCHER_MONITOR_SCALE_PROPERTY:
		gala_abstract_switcher_set_monitor_scale (self, g_value_get_float (value));
		break;
		case GALA_ABSTRACT_SWITCHER_CONTAINER_PROPERTY:
		gala_abstract_switcher_set_container (self, g_value_get_object (value));
		break;
		case GALA_ABSTRACT_SWITCHER_CAPTION_TEXT_PROPERTY:
		gala_abstract_switcher_set_caption_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

