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

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <handy.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <atk/atk.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.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 BOXES_TYPE_KEYS_INPUT_POPOVER (boxes_keys_input_popover_get_type ())
#define BOXES_KEYS_INPUT_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_KEYS_INPUT_POPOVER, BoxesKeysInputPopover))
#define BOXES_KEYS_INPUT_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_KEYS_INPUT_POPOVER, BoxesKeysInputPopoverClass))
#define BOXES_IS_KEYS_INPUT_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_KEYS_INPUT_POPOVER))
#define BOXES_IS_KEYS_INPUT_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_KEYS_INPUT_POPOVER))
#define BOXES_KEYS_INPUT_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_KEYS_INPUT_POPOVER, BoxesKeysInputPopoverClass))

typedef struct _BoxesKeysInputPopover BoxesKeysInputPopover;
typedef struct _BoxesKeysInputPopoverClass BoxesKeysInputPopoverClass;
typedef struct _BoxesKeysInputPopoverPrivate BoxesKeysInputPopoverPrivate;

#define BOXES_TYPE_APP_WINDOW (boxes_app_window_get_type ())
#define BOXES_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindow))
#define BOXES_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))
#define BOXES_IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP_WINDOW))
#define BOXES_IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP_WINDOW))
#define BOXES_APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))

typedef struct _BoxesAppWindow BoxesAppWindow;
typedef struct _BoxesAppWindowClass BoxesAppWindowClass;
enum  {
	BOXES_KEYS_INPUT_POPOVER_0_PROPERTY,
	BOXES_KEYS_INPUT_POPOVER_NUM_PROPERTIES
};
static GParamSpec* boxes_keys_input_popover_properties[BOXES_KEYS_INPUT_POPOVER_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define BOXES_TYPE_COLLECTION_ITEM (boxes_collection_item_get_type ())
#define BOXES_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItem))
#define BOXES_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))
#define BOXES_IS_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_IS_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_COLLECTION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))

typedef struct _BoxesCollectionItem BoxesCollectionItem;
typedef struct _BoxesCollectionItemClass BoxesCollectionItemClass;

#define BOXES_TYPE_MACHINE (boxes_machine_get_type ())
#define BOXES_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE, BoxesMachine))
#define BOXES_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE, BoxesMachineClass))
#define BOXES_IS_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE))
#define BOXES_IS_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE))
#define BOXES_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE, BoxesMachineClass))

typedef struct _BoxesMachine BoxesMachine;
typedef struct _BoxesMachineClass BoxesMachineClass;

#define BOXES_TYPE_DISPLAY (boxes_display_get_type ())
#define BOXES_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY, BoxesDisplay))
#define BOXES_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY, BoxesDisplayClass))
#define BOXES_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY))
#define BOXES_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY))
#define BOXES_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY, BoxesDisplayClass))

typedef struct _BoxesDisplay BoxesDisplay;
typedef struct _BoxesDisplayClass BoxesDisplayClass;

struct _BoxesKeysInputPopover {
	GtkPopover parent_instance;
	BoxesKeysInputPopoverPrivate * priv;
};

struct _BoxesKeysInputPopoverClass {
	GtkPopoverClass parent_class;
};

struct _BoxesKeysInputPopoverPrivate {
	BoxesAppWindow* window;
	GSimpleActionGroup* action_group;
};

static gint BoxesKeysInputPopover_private_offset;
static gpointer boxes_keys_input_popover_parent_class = NULL;

VALA_EXTERN GType boxes_keys_input_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesKeysInputPopover, g_object_unref)
VALA_EXTERN GType boxes_app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAppWindow, g_object_unref)
static void boxes_keys_input_popover_ctrl_alt_backspace_activated (BoxesKeysInputPopover* self);
static void _boxes_keys_input_popover_ctrl_alt_backspace_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                              GVariant* parameter,
                                                                                              gpointer self);
static void boxes_keys_input_popover_ctrl_alt_del_activated (BoxesKeysInputPopover* self);
static void _boxes_keys_input_popover_ctrl_alt_del_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                        GVariant* parameter,
                                                                                        gpointer self);
static void boxes_keys_input_popover_ctrl_alt_fn_activated (BoxesKeysInputPopover* self,
                                                     GSimpleAction* action);
static void _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                       GVariant* parameter,
                                                                                       gpointer self);
VALA_EXTERN BoxesKeysInputPopover* boxes_keys_input_popover_new (BoxesAppWindow* window);
VALA_EXTERN BoxesKeysInputPopover* boxes_keys_input_popover_construct (GType object_type,
                                                           BoxesAppWindow* window);
static void boxes_keys_input_popover_send_keys (BoxesKeysInputPopover* self,
                                         guint* keyvals,
                                         gint keyvals_length1);
VALA_EXTERN GType boxes_collection_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCollectionItem, g_object_unref)
VALA_EXTERN GType boxes_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMachine, g_object_unref)
VALA_EXTERN BoxesCollectionItem* boxes_app_window_get_current_item (BoxesAppWindow* self);
VALA_EXTERN GType boxes_display_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDisplay, g_object_unref)
VALA_EXTERN BoxesDisplay* boxes_machine_get_display (BoxesMachine* self);
VALA_EXTERN void boxes_display_send_keys (BoxesDisplay* self,
                              guint* keyvals,
                              gint keyvals_length1);
static void boxes_keys_input_popover_finalize (GObject * obj);
static GType boxes_keys_input_popover_get_type_once (void);

static const GActionEntry BOXES_KEYS_INPUT_POPOVER_action_entries[8] = {{"ctrl+alt+backspace", _boxes_keys_input_popover_ctrl_alt_backspace_activated_gsimple_action_activate_callback}, {"ctrl+alt+del", _boxes_keys_input_popover_ctrl_alt_del_activated_gsimple_action_activate_callback}, {"ctrl+alt+f1", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}, {"ctrl+alt+f2", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}, {"ctrl+alt+f3", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}, {"ctrl+alt+f6", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}, {"ctrl+alt+f7", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}, {"ctrl+alt+f9", _boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback}};

static inline gpointer
boxes_keys_input_popover_get_instance_private (BoxesKeysInputPopover* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesKeysInputPopover_private_offset);
}

static void
_boxes_keys_input_popover_ctrl_alt_backspace_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                         GVariant* parameter,
                                                                                         gpointer self)
{
	boxes_keys_input_popover_ctrl_alt_backspace_activated ((BoxesKeysInputPopover*) self);
}

static void
_boxes_keys_input_popover_ctrl_alt_del_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                   GVariant* parameter,
                                                                                   gpointer self)
{
	boxes_keys_input_popover_ctrl_alt_del_activated ((BoxesKeysInputPopover*) self);
}

static void
_boxes_keys_input_popover_ctrl_alt_fn_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self)
{
	boxes_keys_input_popover_ctrl_alt_fn_activated ((BoxesKeysInputPopover*) self, action);
}

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

BoxesKeysInputPopover*
boxes_keys_input_popover_construct (GType object_type,
                                    BoxesAppWindow* window)
{
	BoxesKeysInputPopover * self = NULL;
	BoxesAppWindow* _tmp0_;
	GSimpleActionGroup* _tmp1_;
	GSimpleActionGroup* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GMenu* menu = NULL;
	GMenu* _tmp4_;
	GMenu* section = NULL;
	GMenu* _tmp5_;
	AtkObject* a11y = NULL;
	AtkObject* _tmp6_;
	AtkObject* _tmp7_;
	g_return_val_if_fail (window != NULL, NULL);
	self = (BoxesKeysInputPopover*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp0_;
	_tmp1_ = g_simple_action_group_new ();
	_g_object_unref0 (self->priv->action_group);
	self->priv->action_group = _tmp1_;
	_tmp2_ = self->priv->action_group;
	g_action_map_add_action_entries ((GActionMap*) _tmp2_, BOXES_KEYS_INPUT_POPOVER_action_entries, (gint) G_N_ELEMENTS (BOXES_KEYS_INPUT_POPOVER_action_entries), self);
	_tmp3_ = self->priv->action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "key", (GActionGroup*) _tmp3_);
	_tmp4_ = g_menu_new ();
	menu = _tmp4_;
	g_menu_append (menu, _ ("Ctrl + Alt + Backspace"), "key.ctrl+alt+backspace");
	g_menu_append (menu, _ ("Ctrl + Alt + Del"), "key.ctrl+alt+del");
	_tmp5_ = g_menu_new ();
	section = _tmp5_;
	g_menu_append (section, _ ("Ctrl + Alt + F1"), "key.ctrl+alt+f1");
	g_menu_append (section, _ ("Ctrl + Alt + F2"), "key.ctrl+alt+f2");
	g_menu_append (section, _ ("Ctrl + Alt + F3"), "key.ctrl+alt+f3");
	g_menu_append (section, _ ("Ctrl + Alt + F6"), "key.ctrl+alt+f6");
	g_menu_append (section, _ ("Ctrl + Alt + F7"), "key.ctrl+alt+f7");
	g_menu_append (section, _ ("Ctrl + Alt + F9"), "key.ctrl+alt+f9");
	g_menu_append_section (menu, NULL, (GMenuModel*) section);
	gtk_popover_bind_model ((GtkPopover*) self, (GMenuModel*) menu, NULL);
	_tmp6_ = gtk_widget_get_accessible ((GtkWidget*) self);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	a11y = _tmp7_;
	a11y->role = ATK_ROLE_POPUP_MENU;
	a11y->name = _ ("Send key combinations");
	_g_object_unref0 (a11y);
	_g_object_unref0 (section);
	_g_object_unref0 (menu);
	return self;
}

BoxesKeysInputPopover*
boxes_keys_input_popover_new (BoxesAppWindow* window)
{
	return boxes_keys_input_popover_construct (BOXES_TYPE_KEYS_INPUT_POPOVER, window);
}

static void
boxes_keys_input_popover_ctrl_alt_backspace_activated (BoxesKeysInputPopover* self)
{
	guint* keyvals = NULL;
	guint* _tmp0_;
	gint keyvals_length1;
	gint _keyvals_size_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (guint, 3);
	_tmp0_[0] = GDK_KEY_Control_L;
	_tmp0_[1] = GDK_KEY_Alt_L;
	_tmp0_[2] = GDK_KEY_BackSpace;
	keyvals = _tmp0_;
	keyvals_length1 = 3;
	_keyvals_size_ = keyvals_length1;
	boxes_keys_input_popover_send_keys (self, keyvals, (gint) keyvals_length1);
	keyvals = (g_free (keyvals), NULL);
}

static void
boxes_keys_input_popover_ctrl_alt_del_activated (BoxesKeysInputPopover* self)
{
	guint* keyvals = NULL;
	guint* _tmp0_;
	gint keyvals_length1;
	gint _keyvals_size_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (guint, 3);
	_tmp0_[0] = GDK_KEY_Control_L;
	_tmp0_[1] = GDK_KEY_Alt_L;
	_tmp0_[2] = GDK_KEY_Delete;
	keyvals = _tmp0_;
	keyvals_length1 = 3;
	_keyvals_size_ = keyvals_length1;
	boxes_keys_input_popover_send_keys (self, keyvals, (gint) keyvals_length1);
	keyvals = (g_free (keyvals), NULL);
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static void
boxes_keys_input_popover_ctrl_alt_fn_activated (BoxesKeysInputPopover* self,
                                                GSimpleAction* action)
{
	guint* keyvals = NULL;
	guint* _tmp0_;
	gint keyvals_length1;
	gint _keyvals_size_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	guint* _tmp43_;
	gint _tmp43__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = g_new0 (guint, 3);
	_tmp0_[0] = GDK_KEY_Control_L;
	_tmp0_[1] = GDK_KEY_Alt_L;
	_tmp0_[2] = (guint) 0;
	keyvals = _tmp0_;
	keyvals_length1 = 3;
	_keyvals_size_ = keyvals_length1;
	_tmp1_ = g_action_get_name ((GAction*) action);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_action_get_name ((GAction*) action);
	_tmp4_ = _tmp3_;
	_tmp5_ = strlen (_tmp4_);
	_tmp6_ = _tmp5_;
	if (string_get (_tmp2_, (glong) (_tmp6_ - 1)) == '1') {
		guint* _tmp7_;
		gint _tmp7__length1;
		_tmp7_ = keyvals;
		_tmp7__length1 = keyvals_length1;
		_tmp7_[2] = GDK_KEY_F1;
	} else {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		_tmp8_ = g_action_get_name ((GAction*) action);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_action_get_name ((GAction*) action);
		_tmp11_ = _tmp10_;
		_tmp12_ = strlen (_tmp11_);
		_tmp13_ = _tmp12_;
		if (string_get (_tmp9_, (glong) (_tmp13_ - 1)) == '2') {
			guint* _tmp14_;
			gint _tmp14__length1;
			_tmp14_ = keyvals;
			_tmp14__length1 = keyvals_length1;
			_tmp14_[2] = GDK_KEY_F2;
		} else {
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			gint _tmp19_;
			gint _tmp20_;
			_tmp15_ = g_action_get_name ((GAction*) action);
			_tmp16_ = _tmp15_;
			_tmp17_ = g_action_get_name ((GAction*) action);
			_tmp18_ = _tmp17_;
			_tmp19_ = strlen (_tmp18_);
			_tmp20_ = _tmp19_;
			if (string_get (_tmp16_, (glong) (_tmp20_ - 1)) == '3') {
				guint* _tmp21_;
				gint _tmp21__length1;
				_tmp21_ = keyvals;
				_tmp21__length1 = keyvals_length1;
				_tmp21_[2] = GDK_KEY_F3;
			} else {
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				const gchar* _tmp25_;
				gint _tmp26_;
				gint _tmp27_;
				_tmp22_ = g_action_get_name ((GAction*) action);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_action_get_name ((GAction*) action);
				_tmp25_ = _tmp24_;
				_tmp26_ = strlen (_tmp25_);
				_tmp27_ = _tmp26_;
				if (string_get (_tmp23_, (glong) (_tmp27_ - 1)) == '6') {
					guint* _tmp28_;
					gint _tmp28__length1;
					_tmp28_ = keyvals;
					_tmp28__length1 = keyvals_length1;
					_tmp28_[2] = GDK_KEY_F6;
				} else {
					const gchar* _tmp29_;
					const gchar* _tmp30_;
					const gchar* _tmp31_;
					const gchar* _tmp32_;
					gint _tmp33_;
					gint _tmp34_;
					_tmp29_ = g_action_get_name ((GAction*) action);
					_tmp30_ = _tmp29_;
					_tmp31_ = g_action_get_name ((GAction*) action);
					_tmp32_ = _tmp31_;
					_tmp33_ = strlen (_tmp32_);
					_tmp34_ = _tmp33_;
					if (string_get (_tmp30_, (glong) (_tmp34_ - 1)) == '7') {
						guint* _tmp35_;
						gint _tmp35__length1;
						_tmp35_ = keyvals;
						_tmp35__length1 = keyvals_length1;
						_tmp35_[2] = GDK_KEY_F7;
					} else {
						const gchar* _tmp36_;
						const gchar* _tmp37_;
						const gchar* _tmp38_;
						const gchar* _tmp39_;
						gint _tmp40_;
						gint _tmp41_;
						_tmp36_ = g_action_get_name ((GAction*) action);
						_tmp37_ = _tmp36_;
						_tmp38_ = g_action_get_name ((GAction*) action);
						_tmp39_ = _tmp38_;
						_tmp40_ = strlen (_tmp39_);
						_tmp41_ = _tmp40_;
						if (string_get (_tmp37_, (glong) (_tmp41_ - 1)) == '9') {
							guint* _tmp42_;
							gint _tmp42__length1;
							_tmp42_ = keyvals;
							_tmp42__length1 = keyvals_length1;
							_tmp42_[2] = GDK_KEY_F9;
						} else {
							g_warn_if_reached ();
							keyvals = (g_free (keyvals), NULL);
							return;
						}
					}
				}
			}
		}
	}
	_tmp43_ = keyvals;
	_tmp43__length1 = keyvals_length1;
	boxes_keys_input_popover_send_keys (self, _tmp43_, (gint) _tmp43__length1);
	keyvals = (g_free (keyvals), NULL);
}

static void
boxes_keys_input_popover_send_keys (BoxesKeysInputPopover* self,
                                    guint* keyvals,
                                    gint keyvals_length1)
{
	BoxesMachine* machine = NULL;
	BoxesAppWindow* _tmp0_;
	BoxesCollectionItem* _tmp1_;
	BoxesCollectionItem* _tmp2_;
	BoxesMachine* _tmp3_;
	gboolean _tmp4_ = FALSE;
	BoxesMachine* _tmp5_;
	BoxesMachine* _tmp9_;
	BoxesDisplay* _tmp10_;
	BoxesDisplay* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = boxes_app_window_get_current_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (BOXES_IS_MACHINE (_tmp2_) ? ((BoxesMachine*) _tmp2_) : NULL);
	machine = _tmp3_;
	_tmp5_ = machine;
	if (_tmp5_ != NULL) {
		BoxesMachine* _tmp6_;
		BoxesDisplay* _tmp7_;
		BoxesDisplay* _tmp8_;
		_tmp6_ = machine;
		_tmp7_ = boxes_machine_get_display (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	g_return_if_fail (_tmp4_);
	_tmp9_ = machine;
	_tmp10_ = boxes_machine_get_display (_tmp9_);
	_tmp11_ = _tmp10_;
	boxes_display_send_keys (_tmp11_, keyvals, (gint) keyvals_length1);
	_g_object_unref0 (machine);
}

static void
boxes_keys_input_popover_class_init (BoxesKeysInputPopoverClass * klass,
                                     gpointer klass_data)
{
	boxes_keys_input_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesKeysInputPopover_private_offset);
	G_OBJECT_CLASS (klass)->finalize = boxes_keys_input_popover_finalize;
}

static void
boxes_keys_input_popover_instance_init (BoxesKeysInputPopover * self,
                                        gpointer klass)
{
	self->priv = boxes_keys_input_popover_get_instance_private (self);
}

static void
boxes_keys_input_popover_finalize (GObject * obj)
{
	BoxesKeysInputPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_KEYS_INPUT_POPOVER, BoxesKeysInputPopover);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->action_group);
	G_OBJECT_CLASS (boxes_keys_input_popover_parent_class)->finalize (obj);
}

static GType
boxes_keys_input_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesKeysInputPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_keys_input_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesKeysInputPopover), 0, (GInstanceInitFunc) boxes_keys_input_popover_instance_init, NULL };
	GType boxes_keys_input_popover_type_id;
	boxes_keys_input_popover_type_id = g_type_register_static (gtk_popover_get_type (), "BoxesKeysInputPopover", &g_define_type_info, 0);
	BoxesKeysInputPopover_private_offset = g_type_add_instance_private (boxes_keys_input_popover_type_id, sizeof (BoxesKeysInputPopoverPrivate));
	return boxes_keys_input_popover_type_id;
}

GType
boxes_keys_input_popover_get_type (void)
{
	static volatile gsize boxes_keys_input_popover_type_id__once = 0;
	if (g_once_init_enter (&boxes_keys_input_popover_type_id__once)) {
		GType boxes_keys_input_popover_type_id;
		boxes_keys_input_popover_type_id = boxes_keys_input_popover_get_type_once ();
		g_once_init_leave (&boxes_keys_input_popover_type_id__once, boxes_keys_input_popover_type_id);
	}
	return boxes_keys_input_popover_type_id__once;
}

