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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2024 elementary, Inc. (https://elementary.io)
 */

#include "gala.h"
#include <glib-object.h>
#include <meta/display.h>
#include <meta/window.h>
#include <glib.h>
#include <meta/common.h>
#include <clutter/clutter.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 GALA_TYPE_STATIC_WINDOW_CONTAINER (gala_static_window_container_get_type ())
#define GALA_STATIC_WINDOW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainer))
#define GALA_STATIC_WINDOW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainerClass))
#define GALA_IS_STATIC_WINDOW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_STATIC_WINDOW_CONTAINER))
#define GALA_IS_STATIC_WINDOW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_STATIC_WINDOW_CONTAINER))
#define GALA_STATIC_WINDOW_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainerClass))

typedef struct _GalaStaticWindowContainer GalaStaticWindowContainer;
typedef struct _GalaStaticWindowContainerClass GalaStaticWindowContainerClass;
typedef struct _GalaStaticWindowContainerPrivate GalaStaticWindowContainerPrivate;
enum  {
	GALA_STATIC_WINDOW_CONTAINER_0_PROPERTY,
	GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY,
	GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY,
	GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY,
	GALA_STATIC_WINDOW_CONTAINER_NUM_PROPERTIES
};
static GParamSpec* gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block55Data Block55Data;
typedef struct _Block56Data Block56Data;

#define GALA_TYPE_SHELL_CLIENTS_MANAGER (gala_shell_clients_manager_get_type ())
#define GALA_SHELL_CLIENTS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_SHELL_CLIENTS_MANAGER, GalaShellClientsManager))
#define GALA_SHELL_CLIENTS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_SHELL_CLIENTS_MANAGER, GalaShellClientsManagerClass))
#define GALA_IS_SHELL_CLIENTS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_SHELL_CLIENTS_MANAGER))
#define GALA_IS_SHELL_CLIENTS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_SHELL_CLIENTS_MANAGER))
#define GALA_SHELL_CLIENTS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_SHELL_CLIENTS_MANAGER, GalaShellClientsManagerClass))

typedef struct _GalaShellClientsManager GalaShellClientsManager;
typedef struct _GalaShellClientsManagerClass GalaShellClientsManagerClass;

#define GALA_TYPE_STATIC_WINDOW_CLONE (gala_static_window_clone_get_type ())
#define GALA_STATIC_WINDOW_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_STATIC_WINDOW_CLONE, GalaStaticWindowClone))
#define GALA_STATIC_WINDOW_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_STATIC_WINDOW_CLONE, GalaStaticWindowCloneClass))
#define GALA_IS_STATIC_WINDOW_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_STATIC_WINDOW_CLONE))
#define GALA_IS_STATIC_WINDOW_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_STATIC_WINDOW_CLONE))
#define GALA_STATIC_WINDOW_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_STATIC_WINDOW_CLONE, GalaStaticWindowCloneClass))

typedef struct _GalaStaticWindowClone GalaStaticWindowClone;
typedef struct _GalaStaticWindowCloneClass GalaStaticWindowCloneClass;

#define GALA_TYPE_WINDOW_LISTENER (gala_window_listener_get_type ())
#define GALA_WINDOW_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_WINDOW_LISTENER, GalaWindowListener))
#define GALA_WINDOW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_WINDOW_LISTENER, GalaWindowListenerClass))
#define GALA_IS_WINDOW_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_WINDOW_LISTENER))
#define GALA_IS_WINDOW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_WINDOW_LISTENER))
#define GALA_WINDOW_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_WINDOW_LISTENER, GalaWindowListenerClass))

typedef struct _GalaWindowListener GalaWindowListener;
typedef struct _GalaWindowListenerClass GalaWindowListenerClass;
enum  {
	GALA_STATIC_WINDOW_CONTAINER_WINDOW_CHANGED_SIGNAL,
	GALA_STATIC_WINDOW_CONTAINER_NUM_SIGNALS
};
static guint gala_static_window_container_signals[GALA_STATIC_WINDOW_CONTAINER_NUM_SIGNALS] = {0};

struct _GalaStaticWindowContainer {
	GalaActorTarget parent_instance;
	GalaStaticWindowContainerPrivate * priv;
};

struct _GalaStaticWindowContainerClass {
	GalaActorTargetClass parent_class;
};

struct _GalaStaticWindowContainerPrivate {
	MetaDisplay* _display;
	MetaWindow* _grabbed_window;
	MetaWindow* _moving_window;
};

struct _Block55Data {
	int _ref_count_;
	MetaDisplay* display;
};

struct _Block56Data {
	int _ref_count_;
	GalaStaticWindowContainer* self;
	MetaWindow* window;
};

static gint GalaStaticWindowContainer_private_offset;
static gpointer gala_static_window_container_parent_class = NULL;
static GOnce gala_static_window_container_instance;
static GOnce gala_static_window_container_instance = G_ONCE_INIT;

VALA_EXTERN GType gala_static_window_container_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaStaticWindowContainer, g_object_unref)
VALA_EXTERN GalaStaticWindowContainer* gala_static_window_container_get_instance (MetaDisplay* display);
static Block55Data* block55_data_ref (Block55Data* _data55_);
static void block55_data_unref (void * _userdata_);
static GalaStaticWindowContainer* __lambda34_ (Block55Data* _data55_);
static GalaStaticWindowContainer* gala_static_window_container_new (MetaDisplay* display);
static GalaStaticWindowContainer* gala_static_window_container_construct (GType object_type,
                                                                   MetaDisplay* display);
static gpointer ___lambda34__gthread_func (gpointer self);
static void gala_static_window_container_on_grab_op_begin (GalaStaticWindowContainer* self,
                                                    MetaWindow* window,
                                                    MetaGrabOp op);
static void gala_static_window_container_set_grabbed_window (GalaStaticWindowContainer* self,
                                                      MetaWindow* value);
static void gala_static_window_container_check_window_changed (GalaStaticWindowContainer* self,
                                                        MetaWindow* window);
static void gala_static_window_container_on_grab_op_end (GalaStaticWindowContainer* self,
                                                  MetaWindow* window,
                                                  MetaGrabOp op);
static void gala_static_window_container_on_all_workspaces_changed (GalaStaticWindowContainer* self,
                                                             MetaWindow* window);
static Block56Data* block56_data_ref (Block56Data* _data56_);
static void block56_data_unref (void * _userdata_);
static gboolean __lambda35_ (Block56Data* _data56_);
static gboolean ___lambda35__gsource_func (gpointer self);
VALA_EXTERN void gala_static_window_container_notify_window_moving (GalaStaticWindowContainer* self,
                                                        MetaWindow* window);
static void gala_static_window_container_set_moving_window (GalaStaticWindowContainer* self,
                                                     MetaWindow* value);
VALA_EXTERN void gala_static_window_container_notify_move_ended (GalaStaticWindowContainer* self);
VALA_EXTERN MetaWindow* gala_static_window_container_get_moving_window (GalaStaticWindowContainer* self);
VALA_EXTERN gboolean gala_static_window_container_is_static (GalaStaticWindowContainer* self,
                                                 MetaWindow* window);
VALA_EXTERN GType gala_shell_clients_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaShellClientsManager, g_object_unref)
VALA_EXTERN GalaShellClientsManager* gala_shell_clients_manager_get_instance (void);
VALA_EXTERN gboolean gala_shell_clients_manager_is_shell_window (GalaShellClientsManager* self,
                                                     MetaWindow* window);
VALA_EXTERN GType gala_static_window_clone_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaStaticWindowClone, g_object_unref)
VALA_EXTERN MetaWindow* gala_static_window_clone_get_window (GalaStaticWindowClone* self);
VALA_EXTERN GalaStaticWindowClone* gala_static_window_clone_new (MetaWindow* window);
VALA_EXTERN GalaStaticWindowClone* gala_static_window_clone_construct (GType object_type,
                                                           MetaWindow* window);
VALA_EXTERN MetaWindow* gala_static_window_container_get_grabbed_window (GalaStaticWindowContainer* self);
VALA_EXTERN MetaDisplay* gala_static_window_container_get_display (GalaStaticWindowContainer* self);
static void gala_static_window_container_set_display (GalaStaticWindowContainer* self,
                                               MetaDisplay* value);
static void g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static GObject * gala_static_window_container_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties);
static void _gala_static_window_container_on_grab_op_begin_meta_display_grab_op_begin (MetaDisplay* _sender,
                                                                                MetaWindow* object,
                                                                                MetaGrabOp p0,
                                                                                gpointer self);
static void _gala_static_window_container_on_grab_op_end_meta_display_grab_op_end (MetaDisplay* _sender,
                                                                            MetaWindow* object,
                                                                            MetaGrabOp p0,
                                                                            gpointer self);
VALA_EXTERN GType gala_window_listener_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaWindowListener, g_object_unref)
VALA_EXTERN GalaWindowListener* gala_window_listener_get_default (void);
static void _gala_static_window_container_on_all_workspaces_changed_gala_window_listener_window_on_all_workspaces_changed (GalaWindowListener* _sender,
                                                                                                                    MetaWindow* window,
                                                                                                                    gpointer self);
static void gala_static_window_container_finalize (GObject * obj);
static GType gala_static_window_container_get_type_once (void);
static void _vala_gala_static_window_container_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_gala_static_window_container_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);

static inline gpointer
gala_static_window_container_get_instance_private (GalaStaticWindowContainer* self)
{
	return G_STRUCT_MEMBER_P (self, GalaStaticWindowContainer_private_offset);
}

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

static Block55Data*
block55_data_ref (Block55Data* _data55_)
{
	g_atomic_int_inc (&_data55_->_ref_count_);
	return _data55_;
}

static void
block55_data_unref (void * _userdata_)
{
	Block55Data* _data55_;
	_data55_ = (Block55Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data55_->_ref_count_)) {
		_g_object_unref0 (_data55_->display);
		g_slice_free (Block55Data, _data55_);
	}
}

static GalaStaticWindowContainer*
__lambda34_ (Block55Data* _data55_)
{
	GalaStaticWindowContainer* _tmp0_;
	GalaStaticWindowContainer* result;
	_tmp0_ = gala_static_window_container_new (_data55_->display);
	g_object_ref_sink (_tmp0_);
	result = _tmp0_;
	return result;
}

static gpointer
___lambda34__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda34_ (self);
	return result;
}

GalaStaticWindowContainer*
gala_static_window_container_get_instance (MetaDisplay* display)
{
	Block55Data* _data55_;
	MetaDisplay* _tmp0_;
	gconstpointer _tmp1_;
	GalaStaticWindowContainer* _tmp2_;
	GalaStaticWindowContainer* result;
	g_return_val_if_fail (display != NULL, NULL);
	_data55_ = g_slice_new0 (Block55Data);
	_data55_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (display);
	_g_object_unref0 (_data55_->display);
	_data55_->display = _tmp0_;
	_tmp1_ = g_once (&gala_static_window_container_instance, ___lambda34__gthread_func, _data55_);
	_tmp2_ = _g_object_ref0 ((GalaStaticWindowContainer*) _tmp1_);
	result = _tmp2_;
	block55_data_unref (_data55_);
	_data55_ = NULL;
	return result;
}

static GalaStaticWindowContainer*
gala_static_window_container_construct (GType object_type,
                                        MetaDisplay* display)
{
	GalaStaticWindowContainer * self = NULL;
	g_return_val_if_fail (display != NULL, NULL);
	self = (GalaStaticWindowContainer*) g_object_new (object_type, "display", display, NULL);
	return self;
}

static GalaStaticWindowContainer*
gala_static_window_container_new (MetaDisplay* display)
{
	return gala_static_window_container_construct (GALA_TYPE_STATIC_WINDOW_CONTAINER, display);
}

static void
gala_static_window_container_on_grab_op_begin (GalaStaticWindowContainer* self,
                                               MetaWindow* window,
                                               MetaGrabOp op)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	if (op != META_GRAB_OP_MOVING) {
		return;
	}
	gala_static_window_container_set_grabbed_window (self, window);
	gala_static_window_container_check_window_changed (self, window);
}

static void
gala_static_window_container_on_grab_op_end (GalaStaticWindowContainer* self,
                                             MetaWindow* window,
                                             MetaGrabOp op)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	gala_static_window_container_set_grabbed_window (self, NULL);
	gala_static_window_container_check_window_changed (self, window);
}

static Block56Data*
block56_data_ref (Block56Data* _data56_)
{
	g_atomic_int_inc (&_data56_->_ref_count_);
	return _data56_;
}

static void
block56_data_unref (void * _userdata_)
{
	Block56Data* _data56_;
	_data56_ = (Block56Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data56_->_ref_count_)) {
		GalaStaticWindowContainer* self;
		self = _data56_->self;
		_g_object_unref0 (_data56_->window);
		_g_object_unref0 (self);
		g_slice_free (Block56Data, _data56_);
	}
}

static gboolean
__lambda35_ (Block56Data* _data56_)
{
	GalaStaticWindowContainer* self;
	gboolean result;
	self = _data56_->self;
	gala_static_window_container_check_window_changed (self, _data56_->window);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda35__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda35_ (self);
	return result;
}

static void
gala_static_window_container_on_all_workspaces_changed (GalaStaticWindowContainer* self,
                                                        MetaWindow* window)
{
	Block56Data* _data56_;
	MetaWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_data56_ = g_slice_new0 (Block56Data);
	_data56_->_ref_count_ = 1;
	_data56_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (_data56_->window);
	_data56_->window = _tmp0_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda35__gsource_func, block56_data_ref (_data56_), block56_data_unref);
	block56_data_unref (_data56_);
	_data56_ = NULL;
}

void
gala_static_window_container_notify_window_moving (GalaStaticWindowContainer* self,
                                                   MetaWindow* window)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	gala_static_window_container_set_moving_window (self, window);
	gala_static_window_container_check_window_changed (self, window);
}

void
gala_static_window_container_notify_move_ended (GalaStaticWindowContainer* self)
{
	MetaWindow* _tmp0_;
	MetaWindow* window = NULL;
	MetaWindow* _tmp1_;
	MetaWindow* _tmp2_;
	MetaWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_moving_window;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_moving_window;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	window = _tmp2_;
	gala_static_window_container_set_moving_window (self, NULL);
	_tmp3_ = window;
	gala_static_window_container_check_window_changed (self, _tmp3_);
	_g_object_unref0 (window);
}

static void
gala_static_window_container_check_window_changed (GalaStaticWindowContainer* self,
                                                   MetaWindow* window)
{
	gboolean _tmp0_ = FALSE;
	gboolean is_static = FALSE;
	ClutterActor* clone = NULL;
	gboolean _tmp14_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	if (gala_static_window_container_is_static (self, window)) {
		GalaShellClientsManager* _tmp1_;
		_tmp1_ = gala_shell_clients_manager_get_instance ();
		_tmp0_ = !gala_shell_clients_manager_is_shell_window (_tmp1_, window);
	} else {
		_tmp0_ = FALSE;
	}
	is_static = _tmp0_;
	clone = NULL;
	{
		ClutterActor* child = NULL;
		ClutterActor* _tmp2_;
		ClutterActor* _tmp3_;
		_tmp2_ = clutter_actor_get_first_child ((ClutterActor*) self);
		_tmp3_ = _g_object_ref0 (_tmp2_);
		child = _tmp3_;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				ClutterActor* _tmp8_;
				ClutterActor* _tmp9_;
				MetaWindow* _tmp10_;
				MetaWindow* _tmp11_;
				if (!_tmp4_) {
					ClutterActor* _tmp5_;
					ClutterActor* _tmp6_;
					ClutterActor* _tmp7_;
					_tmp5_ = child;
					_tmp6_ = clutter_actor_get_next_sibling (_tmp5_);
					_tmp7_ = _g_object_ref0 (_tmp6_);
					_g_object_unref0 (child);
					child = _tmp7_;
				}
				_tmp4_ = FALSE;
				_tmp8_ = child;
				if (!(_tmp8_ != NULL)) {
					break;
				}
				_tmp9_ = child;
				_tmp10_ = gala_static_window_clone_get_window (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GALA_TYPE_STATIC_WINDOW_CLONE, GalaStaticWindowClone));
				_tmp11_ = _tmp10_;
				if (_tmp11_ == window) {
					ClutterActor* _tmp12_;
					ClutterActor* _tmp13_;
					_tmp12_ = child;
					_tmp13_ = _g_object_ref0 (_tmp12_);
					_g_object_unref0 (clone);
					clone = _tmp13_;
					break;
				}
			}
		}
		_g_object_unref0 (child);
	}
	if (!is_static) {
		ClutterActor* _tmp15_;
		_tmp15_ = clone;
		_tmp14_ = _tmp15_ != NULL;
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		ClutterActor* _tmp16_;
		_tmp16_ = clone;
		clutter_actor_remove_child ((ClutterActor*) self, _tmp16_);
	} else {
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		if (is_static) {
			gboolean _tmp19_;
			gboolean _tmp20_;
			g_object_get (window, "on-all-workspaces", &_tmp19_, NULL);
			_tmp20_ = _tmp19_;
			_tmp18_ = !_tmp20_;
		} else {
			_tmp18_ = FALSE;
		}
		if (_tmp18_) {
			ClutterActor* _tmp21_;
			_tmp21_ = clone;
			_tmp17_ = _tmp21_ == NULL;
		} else {
			_tmp17_ = FALSE;
		}
		if (_tmp17_) {
			GalaStaticWindowClone* _tmp22_;
			GalaStaticWindowClone* _tmp23_;
			_tmp22_ = gala_static_window_clone_new (window);
			g_object_ref_sink (_tmp22_);
			_tmp23_ = _tmp22_;
			clutter_actor_add_child ((ClutterActor*) self, (ClutterActor*) _tmp23_);
			_g_object_unref0 (_tmp23_);
		}
	}
	g_signal_emit (self, gala_static_window_container_signals[GALA_STATIC_WINDOW_CONTAINER_WINDOW_CHANGED_SIGNAL], 0, window, is_static);
	_g_object_unref0 (clone);
}

gboolean
gala_static_window_container_is_static (GalaStaticWindowContainer* self,
                                        MetaWindow* window)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	MetaWindow* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (window != NULL, FALSE);
	_tmp2_ = self->priv->_grabbed_window;
	if (window == _tmp2_) {
		_tmp1_ = TRUE;
	} else {
		MetaWindow* _tmp3_;
		_tmp3_ = self->priv->_moving_window;
		_tmp1_ = window == _tmp3_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp4_;
		gboolean _tmp5_;
		g_object_get (window, "on-all-workspaces", &_tmp4_, NULL);
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp5_;
	}
	result = _tmp0_;
	return result;
}

MetaDisplay*
gala_static_window_container_get_display (GalaStaticWindowContainer* self)
{
	MetaDisplay* result;
	MetaDisplay* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_display;
	result = _tmp0_;
	return result;
}

static void
gala_static_window_container_set_display (GalaStaticWindowContainer* self,
                                          MetaDisplay* value)
{
	MetaDisplay* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_static_window_container_get_display (self);
	if (old_value != value) {
		MetaDisplay* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_display);
		self->priv->_display = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY]);
	}
}

MetaWindow*
gala_static_window_container_get_grabbed_window (GalaStaticWindowContainer* self)
{
	MetaWindow* result;
	MetaWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_grabbed_window;
	result = _tmp0_;
	return result;
}

static void
gala_static_window_container_set_grabbed_window (GalaStaticWindowContainer* self,
                                                 MetaWindow* value)
{
	MetaWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_static_window_container_get_grabbed_window (self);
	if (old_value != value) {
		MetaWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_grabbed_window);
		self->priv->_grabbed_window = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY]);
	}
}

MetaWindow*
gala_static_window_container_get_moving_window (GalaStaticWindowContainer* self)
{
	MetaWindow* result;
	MetaWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_moving_window;
	result = _tmp0_;
	return result;
}

static void
gala_static_window_container_set_moving_window (GalaStaticWindowContainer* self,
                                                MetaWindow* value)
{
	MetaWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_static_window_container_get_moving_window (self);
	if (old_value != value) {
		MetaWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_moving_window);
		self->priv->_moving_window = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_BOOLEAN) (gpointer data1, gpointer arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_BOOLEAN 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__OBJECT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}

static void
_gala_static_window_container_on_grab_op_begin_meta_display_grab_op_begin (MetaDisplay* _sender,
                                                                           MetaWindow* object,
                                                                           MetaGrabOp p0,
                                                                           gpointer self)
{
	gala_static_window_container_on_grab_op_begin ((GalaStaticWindowContainer*) self, object, p0);
}

static void
_gala_static_window_container_on_grab_op_end_meta_display_grab_op_end (MetaDisplay* _sender,
                                                                       MetaWindow* object,
                                                                       MetaGrabOp p0,
                                                                       gpointer self)
{
	gala_static_window_container_on_grab_op_end ((GalaStaticWindowContainer*) self, object, p0);
}

static void
_gala_static_window_container_on_all_workspaces_changed_gala_window_listener_window_on_all_workspaces_changed (GalaWindowListener* _sender,
                                                                                                               MetaWindow* window,
                                                                                                               gpointer self)
{
	gala_static_window_container_on_all_workspaces_changed ((GalaStaticWindowContainer*) self, window);
}

static GObject *
gala_static_window_container_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaStaticWindowContainer * self;
	MetaDisplay* _tmp0_;
	MetaDisplay* _tmp1_;
	GalaWindowListener* _tmp2_;
	parent_class = G_OBJECT_CLASS (gala_static_window_container_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainer);
	_tmp0_ = self->priv->_display;
	g_signal_connect_object (_tmp0_, "grab-op-begin", (GCallback) _gala_static_window_container_on_grab_op_begin_meta_display_grab_op_begin, self, 0);
	_tmp1_ = self->priv->_display;
	g_signal_connect_object (_tmp1_, "grab-op-end", (GCallback) _gala_static_window_container_on_grab_op_end_meta_display_grab_op_end, self, 0);
	_tmp2_ = gala_window_listener_get_default ();
	g_signal_connect_object (_tmp2_, "window-on-all-workspaces-changed", (GCallback) _gala_static_window_container_on_all_workspaces_changed_gala_window_listener_window_on_all_workspaces_changed, self, 0);
	return obj;
}

static void
gala_static_window_container_class_init (GalaStaticWindowContainerClass * klass,
                                         gpointer klass_data)
{
	gala_static_window_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaStaticWindowContainer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_static_window_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gala_static_window_container_set_property;
	G_OBJECT_CLASS (klass)->constructor = gala_static_window_container_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_static_window_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY] = g_param_spec_object ("display", "display", "display", meta_display_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY] = g_param_spec_object ("grabbed-window", "grabbed-window", "grabbed-window", meta_window_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY, gala_static_window_container_properties[GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY] = g_param_spec_object ("moving-window", "moving-window", "moving-window", meta_window_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gala_static_window_container_signals[GALA_STATIC_WINDOW_CONTAINER_WINDOW_CHANGED_SIGNAL] = g_signal_new ("window-changed", GALA_TYPE_STATIC_WINDOW_CONTAINER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, meta_window_get_type (), G_TYPE_BOOLEAN);
}

static void
gala_static_window_container_instance_init (GalaStaticWindowContainer * self,
                                            gpointer klass)
{
	self->priv = gala_static_window_container_get_instance_private (self);
}

static void
gala_static_window_container_finalize (GObject * obj)
{
	GalaStaticWindowContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainer);
	_g_object_unref0 (self->priv->_display);
	_g_object_unref0 (self->priv->_grabbed_window);
	_g_object_unref0 (self->priv->_moving_window);
	G_OBJECT_CLASS (gala_static_window_container_parent_class)->finalize (obj);
}

/**
 * Holds clones of static windows (e.g. on all workspaces or being moved)
 * in the multitasking view and fades them out while opening the multitasking view.
 * The window container use this to know whether a window became static (they shouldn't show it anymore)
 * or isn't static anymore (they have to show it now).
 */
 G_GNUC_NO_INLINE static GType
gala_static_window_container_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaStaticWindowContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_static_window_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaStaticWindowContainer), 0, (GInstanceInitFunc) gala_static_window_container_instance_init, NULL };
	GType gala_static_window_container_type_id;
	gala_static_window_container_type_id = g_type_register_static (GALA_TYPE_ACTOR_TARGET, "GalaStaticWindowContainer", &g_define_type_info, 0);
	GalaStaticWindowContainer_private_offset = g_type_add_instance_private (gala_static_window_container_type_id, sizeof (GalaStaticWindowContainerPrivate));
	return gala_static_window_container_type_id;
}

GType
gala_static_window_container_get_type (void)
{
	static gsize gala_static_window_container_type_id__once = 0;
	if (g_once_init_enter (&gala_static_window_container_type_id__once)) {
		GType gala_static_window_container_type_id;
		gala_static_window_container_type_id = gala_static_window_container_get_type_once ();
		g_once_init_leave (&gala_static_window_container_type_id__once, gala_static_window_container_type_id);
	}
	return gala_static_window_container_type_id__once;
}

static void
_vala_gala_static_window_container_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	GalaStaticWindowContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainer);
	switch (property_id) {
		case GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY:
		g_value_set_object (value, gala_static_window_container_get_display (self));
		break;
		case GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY:
		g_value_set_object (value, gala_static_window_container_get_grabbed_window (self));
		break;
		case GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY:
		g_value_set_object (value, gala_static_window_container_get_moving_window (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gala_static_window_container_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	GalaStaticWindowContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_STATIC_WINDOW_CONTAINER, GalaStaticWindowContainer);
	switch (property_id) {
		case GALA_STATIC_WINDOW_CONTAINER_DISPLAY_PROPERTY:
		gala_static_window_container_set_display (self, g_value_get_object (value));
		break;
		case GALA_STATIC_WINDOW_CONTAINER_GRABBED_WINDOW_PROPERTY:
		gala_static_window_container_set_grabbed_window (self, g_value_get_object (value));
		break;
		case GALA_STATIC_WINDOW_CONTAINER_MOVING_WINDOW_PROPERTY:
		gala_static_window_container_set_moving_window (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

