/* controller-control-policy.c generated by valac 0.56.19, the Vala compiler
 * generated from controller-control-policy.vala, do not modify */

#include "protonplus_core.h"
#include <glib-object.h>
#include <glib.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

enum  {
	PROTON_PLUS_UTILS_CONTROLLER_CONTROL_POLICY_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_CONTROL_POLICY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_control_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_CONTROL_POLICY_NUM_PROPERTIES];

static gpointer proton_plus_utils_controller_control_policy_parent_class = NULL;

static GType proton_plus_utils_controller_control_policy_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
proton_plus_utils_controller_control_kind_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_DEFAULT, "PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_DEFAULT", "default"}, {PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_HORIZONTAL_RANGE, "PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_HORIZONTAL_RANGE", "horizontal-range"}, {PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_VERTICAL_RANGE, "PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_VERTICAL_RANGE", "vertical-range"}, {0, NULL, NULL}};
	GType proton_plus_utils_controller_control_kind_type_id;
	proton_plus_utils_controller_control_kind_type_id = g_enum_register_static ("ProtonPlusUtilsControllerControlKind", values);
	return proton_plus_utils_controller_control_kind_type_id;
}

GType
proton_plus_utils_controller_control_kind_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_control_kind_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_control_kind_type_id__once)) {
		GType proton_plus_utils_controller_control_kind_type_id;
		proton_plus_utils_controller_control_kind_type_id = proton_plus_utils_controller_control_kind_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_control_kind_type_id__once, proton_plus_utils_controller_control_kind_type_id);
	}
	return proton_plus_utils_controller_control_kind_type_id__once;
}

static GType
proton_plus_utils_controller_direction_action_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_MOVE_FOCUS, "PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_MOVE_FOCUS", "move-focus"}, {PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_BACKWARD, "PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_BACKWARD", "adjust-backward"}, {PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_FORWARD, "PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_FORWARD", "adjust-forward"}, {0, NULL, NULL}};
	GType proton_plus_utils_controller_direction_action_type_id;
	proton_plus_utils_controller_direction_action_type_id = g_enum_register_static ("ProtonPlusUtilsControllerDirectionAction", values);
	return proton_plus_utils_controller_direction_action_type_id;
}

GType
proton_plus_utils_controller_direction_action_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_direction_action_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_direction_action_type_id__once)) {
		GType proton_plus_utils_controller_direction_action_type_id;
		proton_plus_utils_controller_direction_action_type_id = proton_plus_utils_controller_direction_action_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_direction_action_type_id__once, proton_plus_utils_controller_direction_action_type_id);
	}
	return proton_plus_utils_controller_direction_action_type_id__once;
}

ProtonPlusUtilsControllerDirectionAction
proton_plus_utils_controller_control_policy_get_direction_action (ProtonPlusUtilsControllerControlKind control,
                                                                  ProtonPlusUtilsControllerNavigationDirection direction)
{
	ProtonPlusUtilsControllerDirectionAction result;
	switch (control) {
		case PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_HORIZONTAL_RANGE:
		{
			if (direction == PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_LEFT) {
				result = PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_BACKWARD;
				return result;
			}
			if (direction == PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_RIGHT) {
				result = PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_FORWARD;
				return result;
			}
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_CONTROL_KIND_VERTICAL_RANGE:
		{
			if (direction == PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_UP) {
				result = PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_BACKWARD;
				return result;
			}
			if (direction == PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_DOWN) {
				result = PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_ADJUST_FORWARD;
				return result;
			}
			break;
		}
		default:
		{
			break;
		}
	}
	result = PROTON_PLUS_UTILS_CONTROLLER_DIRECTION_ACTION_MOVE_FOCUS;
	return result;
}

ProtonPlusUtilsControllerControlPolicy*
proton_plus_utils_controller_control_policy_construct (GType object_type)
{
	ProtonPlusUtilsControllerControlPolicy * self = NULL;
	self = (ProtonPlusUtilsControllerControlPolicy*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsControllerControlPolicy*
proton_plus_utils_controller_control_policy_new (void)
{
	return proton_plus_utils_controller_control_policy_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_CONTROL_POLICY);
}

static void
proton_plus_utils_controller_control_policy_class_init (ProtonPlusUtilsControllerControlPolicyClass * klass,
                                                        gpointer klass_data)
{
	proton_plus_utils_controller_control_policy_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_utils_controller_control_policy_instance_init (ProtonPlusUtilsControllerControlPolicy * self,
                                                           gpointer klass)
{
}

static GType
proton_plus_utils_controller_control_policy_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerControlPolicyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_control_policy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerControlPolicy), 0, (GInstanceInitFunc) proton_plus_utils_controller_control_policy_instance_init, NULL };
	GType proton_plus_utils_controller_control_policy_type_id;
	proton_plus_utils_controller_control_policy_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerControlPolicy", &g_define_type_info, 0);
	return proton_plus_utils_controller_control_policy_type_id;
}

GType
proton_plus_utils_controller_control_policy_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_control_policy_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_control_policy_type_id__once)) {
		GType proton_plus_utils_controller_control_policy_type_id;
		proton_plus_utils_controller_control_policy_type_id = proton_plus_utils_controller_control_policy_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_control_policy_type_id__once, proton_plus_utils_controller_control_policy_type_id);
	}
	return proton_plus_utils_controller_control_policy_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

