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

/**/
/*  Copyright (C) 2011-2012 Robert Dyer, Rico Tzschichholz*/
/**/
/*  This file is part of Plank.*/
/**/
/*  Plank 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.*/
/**/
/*  Plank 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 "plank.h"
#include <gtk/gtk.h>
#include <cairo-gobject.h>
#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.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  {
	PLANK_COMPOSITED_WINDOW_0_PROPERTY,
	PLANK_COMPOSITED_WINDOW_NUM_PROPERTIES
};
static GParamSpec* plank_composited_window_properties[PLANK_COMPOSITED_WINDOW_NUM_PROPERTIES];

static gpointer plank_composited_window_parent_class = NULL;

static gboolean plank_composited_window_real_draw (GtkWidget* base,
                                            cairo_t* cr);
static GObject * plank_composited_window_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static GType plank_composited_window_get_type_once (void);

PlankCompositedWindow*
plank_composited_window_construct (GType object_type)
{
	PlankCompositedWindow * self = NULL;
	self = (PlankCompositedWindow*) g_object_new (object_type, "type", GTK_WINDOW_TOPLEVEL, NULL);
	return self;
}

PlankCompositedWindow*
plank_composited_window_new (void)
{
	return plank_composited_window_construct (PLANK_TYPE_COMPOSITED_WINDOW);
}

PlankCompositedWindow*
plank_composited_window_construct_with_type (GType object_type,
                                             GtkWindowType window_type)
{
	PlankCompositedWindow * self = NULL;
	self = (PlankCompositedWindow*) g_object_new (object_type, "type", window_type, NULL);
	return self;
}

PlankCompositedWindow*
plank_composited_window_new_with_type (GtkWindowType window_type)
{
	return plank_composited_window_construct_with_type (PLANK_TYPE_COMPOSITED_WINDOW, window_type);
}

static gboolean
plank_composited_window_real_draw (GtkWidget* base,
                                   cairo_t* cr)
{
	PlankCompositedWindow * self;
	gboolean result;
	self = (PlankCompositedWindow*) base;
	g_return_val_if_fail (cr != NULL, FALSE);
	cairo_save (cr);
	cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
	cairo_paint (cr);
	cairo_restore (cr);
	result = GDK_EVENT_STOP;
	return result;
}

static GObject *
plank_composited_window_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PlankCompositedWindow * self;
	GdkScreen* screen = NULL;
	GdkScreen* _tmp0_;
	GdkVisual* _tmp1_ = NULL;
	GdkScreen* _tmp2_;
	GdkVisual* _tmp3_;
	parent_class = G_OBJECT_CLASS (plank_composited_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLANK_TYPE_COMPOSITED_WINDOW, PlankCompositedWindow);
	gtk_widget_set_app_paintable ((GtkWidget*) self, TRUE);
	gtk_window_set_decorated ((GtkWindow*) self, FALSE);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	gtk_widget_set_double_buffered ((GtkWidget*) self, FALSE);
	_tmp0_ = gtk_window_get_screen ((GtkWindow*) self);
	screen = _tmp0_;
	_tmp2_ = screen;
	_tmp3_ = gdk_screen_get_rgba_visual (_tmp2_);
	_tmp1_ = _tmp3_;
	if (_tmp1_ == NULL) {
		GdkScreen* _tmp4_;
		GdkVisual* _tmp5_;
		_tmp4_ = screen;
		_tmp5_ = gdk_screen_get_system_visual (_tmp4_);
		_tmp1_ = _tmp5_;
	}
	gtk_widget_set_visual ((GtkWidget*) self, _tmp1_);
	return obj;
}

static void
plank_composited_window_class_init (PlankCompositedWindowClass * klass,
                                    gpointer klass_data)
{
	plank_composited_window_parent_class = g_type_class_peek_parent (klass);
	((GtkWidgetClass *) klass)->draw = (gboolean (*) (GtkWidget*, cairo_t*)) plank_composited_window_real_draw;
	G_OBJECT_CLASS (klass)->constructor = plank_composited_window_constructor;
}

static void
plank_composited_window_instance_init (PlankCompositedWindow * self,
                                       gpointer klass)
{
}

/**
 * A {@link Gtk.Window} with compositing support enabled.
 * The default expose event will draw a completely transparent window.
 */
static GType
plank_composited_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PlankCompositedWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plank_composited_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlankCompositedWindow), 0, (GInstanceInitFunc) plank_composited_window_instance_init, NULL };
	GType plank_composited_window_type_id;
	plank_composited_window_type_id = g_type_register_static (gtk_window_get_type (), "PlankCompositedWindow", &g_define_type_info, 0);
	return plank_composited_window_type_id;
}

GType
plank_composited_window_get_type (void)
{
	static volatile gsize plank_composited_window_type_id__once = 0;
	if (g_once_init_enter (&plank_composited_window_type_id__once)) {
		GType plank_composited_window_type_id;
		plank_composited_window_type_id = plank_composited_window_get_type_once ();
		g_once_init_leave (&plank_composited_window_type_id__once, plank_composited_window_type_id);
	}
	return plank_composited_window_type_id__once;
}

