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

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

#include <glib-object.h>
#include <meta/display.h>
#include <glib.h>
#include <meta/window.h>
#include <meta/workspace.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_WINDOW_ATTENTION_TRACKER (gala_window_attention_tracker_get_type ())
#define GALA_WINDOW_ATTENTION_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_WINDOW_ATTENTION_TRACKER, GalaWindowAttentionTracker))
#define GALA_WINDOW_ATTENTION_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_WINDOW_ATTENTION_TRACKER, GalaWindowAttentionTrackerClass))
#define GALA_IS_WINDOW_ATTENTION_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_WINDOW_ATTENTION_TRACKER))
#define GALA_IS_WINDOW_ATTENTION_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_WINDOW_ATTENTION_TRACKER))
#define GALA_WINDOW_ATTENTION_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_WINDOW_ATTENTION_TRACKER, GalaWindowAttentionTrackerClass))

typedef struct _GalaWindowAttentionTracker GalaWindowAttentionTracker;
typedef struct _GalaWindowAttentionTrackerClass GalaWindowAttentionTrackerClass;
typedef struct _GalaWindowAttentionTrackerPrivate GalaWindowAttentionTrackerPrivate;
enum  {
	GALA_WINDOW_ATTENTION_TRACKER_0_PROPERTY,
	GALA_WINDOW_ATTENTION_TRACKER_NUM_PROPERTIES
};
static GParamSpec* gala_window_attention_tracker_properties[GALA_WINDOW_ATTENTION_TRACKER_NUM_PROPERTIES];

struct _GalaWindowAttentionTracker {
	GObject parent_instance;
	GalaWindowAttentionTrackerPrivate * priv;
};

struct _GalaWindowAttentionTrackerClass {
	GObjectClass parent_class;
};

static gpointer gala_window_attention_tracker_parent_class = NULL;

VALA_EXTERN GType gala_window_attention_tracker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaWindowAttentionTracker, g_object_unref)
VALA_EXTERN void gala_window_attention_tracker_init (MetaDisplay* display);
static void gala_window_attention_tracker_on_window_demands_attention (MetaWindow* window);
static void _gala_window_attention_tracker_on_window_demands_attention_meta_display_window_demands_attention (MetaDisplay* _sender,
                                                                                                       MetaWindow* object,
                                                                                                       gpointer self);
static void _gala_window_attention_tracker_on_window_demands_attention_meta_display_window_marked_urgent (MetaDisplay* _sender,
                                                                                                   MetaWindow* object,
                                                                                                   gpointer self);
VALA_EXTERN GalaWindowAttentionTracker* gala_window_attention_tracker_new (void);
VALA_EXTERN GalaWindowAttentionTracker* gala_window_attention_tracker_construct (GType object_type);
static GType gala_window_attention_tracker_get_type_once (void);

static void
_gala_window_attention_tracker_on_window_demands_attention_meta_display_window_demands_attention (MetaDisplay* _sender,
                                                                                                  MetaWindow* object,
                                                                                                  gpointer self)
{
	gala_window_attention_tracker_on_window_demands_attention (object);
}

static void
_gala_window_attention_tracker_on_window_demands_attention_meta_display_window_marked_urgent (MetaDisplay* _sender,
                                                                                              MetaWindow* object,
                                                                                              gpointer self)
{
	gala_window_attention_tracker_on_window_demands_attention (object);
}

void
gala_window_attention_tracker_init (MetaDisplay* display)
{
	g_return_if_fail (display != NULL);
	g_signal_connect (display, "window-demands-attention", (GCallback) _gala_window_attention_tracker_on_window_demands_attention_meta_display_window_demands_attention, NULL);
	g_signal_connect (display, "window-marked-urgent", (GCallback) _gala_window_attention_tracker_on_window_demands_attention_meta_display_window_marked_urgent, NULL);
}

static void
gala_window_attention_tracker_on_window_demands_attention (MetaWindow* window)
{
	MetaWorkspace* _tmp0_;
	MetaDisplay* _tmp1_;
	MetaDisplay* _tmp2_;
	g_return_if_fail (window != NULL);
	meta_window_raise (window);
	_tmp0_ = meta_window_get_workspace (window);
	_tmp1_ = meta_window_get_display (window);
	_tmp2_ = _tmp1_;
	meta_workspace_activate_with_focus (_tmp0_, window, meta_display_get_current_time (_tmp2_));
}

GalaWindowAttentionTracker*
gala_window_attention_tracker_construct (GType object_type)
{
	GalaWindowAttentionTracker * self = NULL;
	self = (GalaWindowAttentionTracker*) g_object_new (object_type, NULL);
	return self;
}

GalaWindowAttentionTracker*
gala_window_attention_tracker_new (void)
{
	return gala_window_attention_tracker_construct (GALA_TYPE_WINDOW_ATTENTION_TRACKER);
}

static void
gala_window_attention_tracker_class_init (GalaWindowAttentionTrackerClass * klass,
                                          gpointer klass_data)
{
	gala_window_attention_tracker_parent_class = g_type_class_peek_parent (klass);
}

static void
gala_window_attention_tracker_instance_init (GalaWindowAttentionTracker * self,
                                             gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
gala_window_attention_tracker_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaWindowAttentionTrackerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_window_attention_tracker_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaWindowAttentionTracker), 0, (GInstanceInitFunc) gala_window_attention_tracker_instance_init, NULL };
	GType gala_window_attention_tracker_type_id;
	gala_window_attention_tracker_type_id = g_type_register_static (G_TYPE_OBJECT, "GalaWindowAttentionTracker", &g_define_type_info, 0);
	return gala_window_attention_tracker_type_id;
}

GType
gala_window_attention_tracker_get_type (void)
{
	static gsize gala_window_attention_tracker_type_id__once = 0;
	if (g_once_init_enter (&gala_window_attention_tracker_type_id__once)) {
		GType gala_window_attention_tracker_type_id;
		gala_window_attention_tracker_type_id = gala_window_attention_tracker_get_type_once ();
		g_once_init_leave (&gala_window_attention_tracker_type_id__once, gala_window_attention_tracker_type_id);
	}
	return gala_window_attention_tracker_type_id__once;
}

