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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <platform.h>
#include <gtk/gtk.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
#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

typedef void (*DcPlatformRawMacosFileDropCallback) (const gchar* path, gdouble x, gdouble y, void* user_data);
typedef void (*DcPlatformRawAudioFinishedCallback) (gboolean completed, void* user_data);

VALA_EXTERN gchar* dc_platform_get_executable_path (void);
VALA_EXTERN gboolean dc_platform_is_macos (void);
VALA_EXTERN gboolean dc_platform_is_windows (void);
VALA_EXTERN gboolean dc_platform_supports_background_mode (void);
VALA_EXTERN void dc_platform_setup_macos_bundle_environment (void);
VALA_EXTERN void dc_platform_install_macos_file_drop_handler (GtkWidget* widget,
                                                  DcPlatformRawMacosFileDropCallback callback,
                                                  void* user_data);
VALA_EXTERN gboolean dc_platform_audio_backend_supported (void);
VALA_EXTERN void* dc_platform_audio_backend_new (const gchar* path,
                                     DcPlatformRawAudioFinishedCallback callback,
                                     void* user_data);
VALA_EXTERN gboolean dc_platform_audio_backend_play (void* handle);
VALA_EXTERN void dc_platform_audio_backend_pause (void* handle);
VALA_EXTERN void dc_platform_audio_backend_stop (void* handle);
VALA_EXTERN void dc_platform_audio_backend_seek (void* handle,
                                     gint64 position_us);
VALA_EXTERN void dc_platform_audio_backend_set_rate (void* handle,
                                         gdouble rate);
VALA_EXTERN gint64 dc_platform_audio_backend_get_position (void* handle);
VALA_EXTERN gint64 dc_platform_audio_backend_get_duration (void* handle);
VALA_EXTERN gboolean dc_platform_audio_backend_is_playing (void* handle);
VALA_EXTERN gboolean dc_platform_audio_backend_can_seek (void* handle);
VALA_EXTERN void dc_platform_audio_backend_free (void* handle);
VALA_EXTERN gboolean dc_platform_has_primary_modifier (GdkModifierType state);
VALA_EXTERN gchar* dc_platform_primary_accelerator_prefix (void);
VALA_EXTERN gchar* dc_platform_primary_shortcut_text (const gchar* key);

gchar*
dc_platform_get_executable_path (void)
{
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = parla_get_executable_path ();
	result = _tmp0_;
	return result;
}

gboolean
dc_platform_is_macos (void)
{
	gboolean result;
	result = parla_platform_is_macos ();
	return result;
}

gboolean
dc_platform_is_windows (void)
{
	gboolean result;
	result = FALSE;
	return result;
}

gboolean
dc_platform_supports_background_mode (void)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (!dc_platform_is_macos ()) {
		_tmp0_ = !dc_platform_is_windows ();
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

void
dc_platform_setup_macos_bundle_environment (void)
{
	parla_setup_macos_bundle_environment ();
}

void
dc_platform_install_macos_file_drop_handler (GtkWidget* widget,
                                             DcPlatformRawMacosFileDropCallback callback,
                                             void* user_data)
{
	g_return_if_fail (widget != NULL);
	if (!dc_platform_is_macos ()) {
		return;
	}
	parla_macos_install_file_drop_handler (widget, callback, user_data);
}

gboolean
dc_platform_audio_backend_supported (void)
{
	gboolean result;
	result = parla_audio_backend_supported ();
	return result;
}

void*
dc_platform_audio_backend_new (const gchar* path,
                               DcPlatformRawAudioFinishedCallback callback,
                               void* user_data)
{
	void* _tmp0_;
	void* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = parla_audio_backend_new (path, callback, user_data);
	result = _tmp0_;
	return result;
}

gboolean
dc_platform_audio_backend_play (void* handle)
{
	gboolean result;
	result = parla_audio_backend_play (handle);
	return result;
}

void
dc_platform_audio_backend_pause (void* handle)
{
	parla_audio_backend_pause (handle);
}

void
dc_platform_audio_backend_stop (void* handle)
{
	parla_audio_backend_stop (handle);
}

void
dc_platform_audio_backend_seek (void* handle,
                                gint64 position_us)
{
	parla_audio_backend_seek (handle, position_us);
}

void
dc_platform_audio_backend_set_rate (void* handle,
                                    gdouble rate)
{
	parla_audio_backend_set_rate (handle, rate);
}

gint64
dc_platform_audio_backend_get_position (void* handle)
{
	gint64 result;
	result = parla_audio_backend_get_position (handle);
	return result;
}

gint64
dc_platform_audio_backend_get_duration (void* handle)
{
	gint64 result;
	result = parla_audio_backend_get_duration (handle);
	return result;
}

gboolean
dc_platform_audio_backend_is_playing (void* handle)
{
	gboolean result;
	result = parla_audio_backend_is_playing (handle);
	return result;
}

gboolean
dc_platform_audio_backend_can_seek (void* handle)
{
	gboolean result;
	result = parla_audio_backend_can_seek (handle);
	return result;
}

void
dc_platform_audio_backend_free (void* handle)
{
	parla_audio_backend_free (handle);
}

gboolean
dc_platform_has_primary_modifier (GdkModifierType state)
{
	GdkModifierType _tmp0_ = 0U;
	GdkModifierType mask = 0U;
	gboolean result;
	if (dc_platform_is_macos ()) {
		_tmp0_ = GDK_META_MASK;
	} else {
		_tmp0_ = GDK_CONTROL_MASK;
	}
	mask = _tmp0_;
	result = (state & mask) != 0;
	return result;
}

gchar*
dc_platform_primary_accelerator_prefix (void)
{
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* result;
	if (dc_platform_is_macos ()) {
		_tmp0_ = "<Meta>";
	} else {
		_tmp0_ = "<Control>";
	}
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

gchar*
dc_platform_primary_shortcut_text (const gchar* key)
{
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (key != NULL, NULL);
	if (dc_platform_is_macos ()) {
		_tmp0_ = "Command";
	} else {
		_tmp0_ = "Ctrl";
	}
	_tmp1_ = g_strdup_printf ("%s+%s", _tmp0_, key);
	result = _tmp1_;
	return result;
}

