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

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib/gstdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xregion.h>
#include <cairo-gobject.h>
#include <gst/gst.h>

#define PDFPC_PATHS_SOURCE_PATH "/build/pdfpc/src/pdfpc-4.7.0"
#define PDFPC_PATHS_SHARE_PATH "/usr/share/pdfpc"
#define PDFPC_PATHS_CONF_PATH "/etc"
#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 PDFPC_TYPE_APPLICATION (pdfpc_application_get_type ())
#define PDFPC_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_APPLICATION, pdfpcApplication))
#define PDFPC_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_APPLICATION, pdfpcApplicationClass))
#define PDFPC_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_APPLICATION))
#define PDFPC_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_APPLICATION))
#define PDFPC_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_APPLICATION, pdfpcApplicationClass))

typedef struct _pdfpcApplication pdfpcApplication;
typedef struct _pdfpcApplicationClass pdfpcApplicationClass;
typedef struct _pdfpcApplicationPrivate pdfpcApplicationPrivate;

#define PDFPC_TYPE_PRESENTATION_CONTROLLER (pdfpc_presentation_controller_get_type ())
#define PDFPC_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationController))
#define PDFPC_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))
#define PDFPC_IS_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_IS_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_PRESENTATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))

typedef struct _pdfpcPresentationController pdfpcPresentationController;
typedef struct _pdfpcPresentationControllerClass pdfpcPresentationControllerClass;
enum  {
	PDFPC_APPLICATION_0_PROPERTY,
	PDFPC_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* pdfpc_application_properties[PDFPC_APPLICATION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PDFPC_TYPE_OPTIONS (pdfpc_options_get_type ())
#define PDFPC_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_OPTIONS, pdfpcOptions))
#define PDFPC_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_OPTIONS, pdfpcOptionsClass))
#define PDFPC_IS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_OPTIONS))
#define PDFPC_IS_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_OPTIONS))
#define PDFPC_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_OPTIONS, pdfpcOptionsClass))

typedef struct _pdfpcOptions pdfpcOptions;
typedef struct _pdfpcOptionsClass pdfpcOptionsClass;
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block16Data Block16Data;

#define PDFPC_TYPE_CONFIG_FILE_READER (pdfpc_config_file_reader_get_type ())
#define PDFPC_CONFIG_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReader))
#define PDFPC_CONFIG_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReaderClass))
#define PDFPC_IS_CONFIG_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_CONFIG_FILE_READER))
#define PDFPC_IS_CONFIG_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_CONFIG_FILE_READER))
#define PDFPC_CONFIG_FILE_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReaderClass))

typedef struct _pdfpcConfigFileReader pdfpcConfigFileReader;
typedef struct _pdfpcConfigFileReaderClass pdfpcConfigFileReaderClass;
#define _pdfpc_config_file_reader_unref0(var) ((var == NULL) ? NULL : (var = (pdfpc_config_file_reader_unref (var), NULL)))

#define PDFPC_METADATA_TYPE_PDF (pdfpc_metadata_pdf_get_type ())
#define PDFPC_METADATA_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf))
#define PDFPC_METADATA_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))
#define PDFPC_METADATA_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))

typedef struct _pdfpcMetadataPdf pdfpcMetadataPdf;
typedef struct _pdfpcMetadataPdfClass pdfpcMetadataPdfClass;

#define PDFPC_WINDOW_TYPE_FULLSCREEN (pdfpc_window_fullscreen_get_type ())
#define PDFPC_WINDOW_FULLSCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreen))
#define PDFPC_WINDOW_FULLSCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreenClass))
#define PDFPC_WINDOW_IS_FULLSCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN))
#define PDFPC_WINDOW_IS_FULLSCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_WINDOW_TYPE_FULLSCREEN))
#define PDFPC_WINDOW_FULLSCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_WINDOW_TYPE_FULLSCREEN, pdfpcWindowFullscreenClass))

typedef struct _pdfpcWindowFullscreen pdfpcWindowFullscreen;
typedef struct _pdfpcWindowFullscreenClass pdfpcWindowFullscreenClass;

#define PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW (pdfpc_window_controllable_window_get_type ())
#define PDFPC_WINDOW_CONTROLLABLE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW, pdfpcWindowControllableWindow))
#define PDFPC_WINDOW_CONTROLLABLE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW, pdfpcWindowControllableWindowClass))
#define PDFPC_WINDOW_IS_CONTROLLABLE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW))
#define PDFPC_WINDOW_IS_CONTROLLABLE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW))
#define PDFPC_WINDOW_CONTROLLABLE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_WINDOW_TYPE_CONTROLLABLE_WINDOW, pdfpcWindowControllableWindowClass))

typedef struct _pdfpcWindowControllableWindow pdfpcWindowControllableWindow;
typedef struct _pdfpcWindowControllableWindowClass pdfpcWindowControllableWindowClass;

#define PDFPC_WINDOW_TYPE_PRESENTER (pdfpc_window_presenter_get_type ())
#define PDFPC_WINDOW_PRESENTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_WINDOW_TYPE_PRESENTER, pdfpcWindowPresenter))
#define PDFPC_WINDOW_PRESENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_WINDOW_TYPE_PRESENTER, pdfpcWindowPresenterClass))
#define PDFPC_WINDOW_IS_PRESENTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_WINDOW_TYPE_PRESENTER))
#define PDFPC_WINDOW_IS_PRESENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_WINDOW_TYPE_PRESENTER))
#define PDFPC_WINDOW_PRESENTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_WINDOW_TYPE_PRESENTER, pdfpcWindowPresenterClass))

typedef struct _pdfpcWindowPresenter pdfpcWindowPresenter;
typedef struct _pdfpcWindowPresenterClass pdfpcWindowPresenterClass;

#define PDFPC_WINDOW_TYPE_PRESENTATION (pdfpc_window_presentation_get_type ())
#define PDFPC_WINDOW_PRESENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_WINDOW_TYPE_PRESENTATION, pdfpcWindowPresentation))
#define PDFPC_WINDOW_PRESENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_WINDOW_TYPE_PRESENTATION, pdfpcWindowPresentationClass))
#define PDFPC_WINDOW_IS_PRESENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_WINDOW_TYPE_PRESENTATION))
#define PDFPC_WINDOW_IS_PRESENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_WINDOW_TYPE_PRESENTATION))
#define PDFPC_WINDOW_PRESENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_WINDOW_TYPE_PRESENTATION, pdfpcWindowPresentationClass))

typedef struct _pdfpcWindowPresentation pdfpcWindowPresentation;
typedef struct _pdfpcWindowPresentationClass pdfpcWindowPresentationClass;
typedef struct _Block17Data Block17Data;

struct _pdfpcApplication {
	GObject parent_instance;
	pdfpcApplicationPrivate * priv;
};

struct _pdfpcApplicationClass {
	GObjectClass parent_class;
};

struct _pdfpcApplicationPrivate {
	pdfpcPresentationController* controller;
};

struct _Block16Data {
	int _ref_count_;
	pdfpcApplication* self;
	GdkDisplay* display;
	gint width;
	gint height;
	gboolean presentation_windowed;
	gint n_monitors;
};

struct _Block17Data {
	int _ref_count_;
	Block16Data * _data16_;
	pdfpcPresentationController* controller;
};

static gint pdfpcApplication_private_offset;
static gpointer pdfpc_application_parent_class = NULL;
VALA_EXTERN gboolean pdfpc_options_list_bindings;
static gchar** pdfpc_application_pdfpcrc_statements;
VALA_EXTERN gboolean pdfpc_options_use_time_of_day;
VALA_EXTERN guint pdfpc_options_duration;
VALA_EXTERN gchar* pdfpc_options_end_time;
VALA_EXTERN gchar* pdfpc_options_notes_format;
VALA_EXTERN gboolean pdfpc_options_disable_auto_grouping;
VALA_EXTERN guint pdfpc_options_last_minutes;
static gboolean pdfpc_application_list_actions;
static gboolean pdfpc_application_list_monitors;
VALA_EXTERN gchar* pdfpc_options_notes_position;
VALA_EXTERN gboolean pdfpc_options_no_install;
VALA_EXTERN gint pdfpc_options_rest_port;
static gint pdfpc_application_page_hnum;
VALA_EXTERN gchar* pdfpc_options_default_transition;
VALA_EXTERN gchar* pdfpc_options_pdfpc_location;
VALA_EXTERN gboolean pdfpc_options_display_switch;
VALA_EXTERN gboolean pdfpc_options_single_screen;
VALA_EXTERN gchar* pdfpc_options_start_time;
VALA_EXTERN gboolean pdfpc_options_auto_srt;
static gboolean pdfpc_application_version;
VALA_EXTERN gboolean pdfpc_options_enable_rest;
VALA_EXTERN gchar* pdfpc_options_windowed;
VALA_EXTERN gboolean pdfpc_options_wayland_workaround;
VALA_EXTERN gchar* pdfpc_options_external_script;
VALA_EXTERN gchar* pdfpc_options_size;
VALA_EXTERN gchar* pdfpc_options_presenter_screen;
VALA_EXTERN gchar* pdfpc_options_presentation_screen;
static gboolean pdfpc_application_list_actions = FALSE;
static gboolean pdfpc_application_list_monitors = FALSE;
static gchar** pdfpc_application_pdfpcrc_statements = NULL;
static gint pdfpc_application_page_hnum = 1;
static gboolean pdfpc_application_version = FALSE;
VALA_EXTERN gboolean pdfpc_options_toolbox_shown;
VALA_EXTERN gint pdfpc_options_prerender_slides;
VALA_EXTERN gint pdfpc_options_cache_min_rtime;

VALA_EXTERN GType pdfpc_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcApplication, g_object_unref)
VALA_EXTERN GType pdfpc_presentation_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcPresentationController, g_object_unref)
VALA_EXTERN gchar* pdfpc_application_parse_command_line_options (pdfpcApplication* self,
                                                     gchar*** args,
                                                     gint* args_length1);
VALA_EXTERN pdfpcOptions* pdfpc_options_new (void);
VALA_EXTERN pdfpcOptions* pdfpc_options_construct (GType object_type);
VALA_EXTERN GType pdfpc_options_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcOptions, g_object_unref)
static void pdfpc_application_print_version (pdfpcApplication* self);
VALA_EXTERN void pdfpc_release_print_version (void);
static void pdfpc_application_set_styling (pdfpcApplication* self);
VALA_EXTERN void pdfpc_application_run (pdfpcApplication* self,
                            gchar** args,
                            gint args_length1);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
VALA_EXTERN gpointer pdfpc_config_file_reader_ref (gpointer instance);
VALA_EXTERN void pdfpc_config_file_reader_unref (gpointer instance);
VALA_EXTERN GParamSpec* pdfpc_param_spec_config_file_reader (const gchar* name,
                                                 const gchar* nick,
                                                 const gchar* blurb,
                                                 GType object_type,
                                                 GParamFlags flags);
VALA_EXTERN void pdfpc_value_set_config_file_reader (GValue* value,
                                         gpointer v_object);
VALA_EXTERN void pdfpc_value_take_config_file_reader (GValue* value,
                                          gpointer v_object);
VALA_EXTERN gpointer pdfpc_value_get_config_file_reader (const GValue* value);
VALA_EXTERN GType pdfpc_config_file_reader_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcConfigFileReader, pdfpc_config_file_reader_unref)
VALA_EXTERN pdfpcConfigFileReader* pdfpc_config_file_reader_new (void);
VALA_EXTERN pdfpcConfigFileReader* pdfpc_config_file_reader_construct (GType object_type);
VALA_EXTERN void pdfpc_config_file_reader_readConfig (pdfpcConfigFileReader* self,
                                          const gchar* fname);
VALA_EXTERN void pdfpc_config_file_reader_parseStatement (pdfpcConfigFileReader* self,
                                              const gchar* line);
VALA_EXTERN pdfpcPresentationController* pdfpc_presentation_controller_new (void);
VALA_EXTERN pdfpcPresentationController* pdfpc_presentation_controller_construct (GType object_type);
VALA_EXTERN gchar** pdfpc_presentation_controller_get_action_descriptions (pdfpcPresentationController* self,
                                                               gint* result_length1);
VALA_EXTERN gchar** pdfpc_presentation_controller_get_action_bindings (pdfpcPresentationController* self,
                                                           gint* result_length1);
VALA_EXTERN GType pdfpc_metadata_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcMetadataPdf, g_object_unref)
VALA_EXTERN pdfpcMetadataPdf* pdfpc_metadata_pdf_new (const gchar* pdfFilename);
VALA_EXTERN pdfpcMetadataPdf* pdfpc_metadata_pdf_construct (GType object_type,
                                                const gchar* pdfFilename);
VALA_EXTERN void pdfpc_presentation_controller_set_metadata (pdfpcPresentationController* self,
                                                 pdfpcMetadataPdf* value);
VALA_EXTERN pdfpcWindowPresenter* pdfpc_window_presenter_new (pdfpcPresentationController* controller,
                                                  gint screen_num,
                                                  gboolean windowed);
VALA_EXTERN pdfpcWindowPresenter* pdfpc_window_presenter_construct (GType object_type,
                                                        pdfpcPresentationController* controller,
                                                        gint screen_num,
                                                        gboolean windowed);
VALA_EXTERN GType pdfpc_window_fullscreen_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcWindowFullscreen, g_object_unref)
VALA_EXTERN GType pdfpc_window_controllable_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcWindowControllableWindow, g_object_unref)
VALA_EXTERN GType pdfpc_window_presenter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcWindowPresenter, g_object_unref)
VALA_EXTERN void pdfpc_presentation_controller_set_presenter (pdfpcPresentationController* self,
                                                  pdfpcWindowPresenter* value);
VALA_EXTERN pdfpcWindowPresenter* pdfpc_presentation_controller_get_presenter (pdfpcPresentationController* self);
static void ___lambda52_ (pdfpcApplication* self);
VALA_EXTERN void pdfpc_window_presenter_update (pdfpcWindowPresenter* self);
static void ____lambda52__gtk_widget_show (GtkWidget* _sender,
                                    gpointer self);
VALA_EXTERN pdfpcWindowPresentation* pdfpc_window_presentation_new (pdfpcPresentationController* controller,
                                                        gint screen_num,
                                                        gboolean windowed,
                                                        gint width,
                                                        gint height);
VALA_EXTERN pdfpcWindowPresentation* pdfpc_window_presentation_construct (GType object_type,
                                                              pdfpcPresentationController* controller,
                                                              gint screen_num,
                                                              gboolean windowed,
                                                              gint width,
                                                              gint height);
VALA_EXTERN GType pdfpc_window_presentation_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcWindowPresentation, g_object_unref)
VALA_EXTERN void pdfpc_presentation_controller_set_presentation (pdfpcPresentationController* self,
                                                     pdfpcWindowPresentation* value);
VALA_EXTERN pdfpcWindowPresentation* pdfpc_presentation_controller_get_presentation (pdfpcPresentationController* self);
static void ___lambda53_ (pdfpcApplication* self);
VALA_EXTERN void pdfpc_window_presentation_update (pdfpcWindowPresentation* self);
static void ____lambda53__gtk_widget_show (GtkWidget* _sender,
                                    gpointer self);
VALA_EXTERN gint pdfpc_metadata_pdf_get_end_user_slide (pdfpcMetadataPdf* self);
VALA_EXTERN gint pdfpc_metadata_pdf_user_slide_to_real_slide (pdfpcMetadataPdf* self,
                                                  gint number,
                                                  gboolean lastSlide);
VALA_EXTERN void pdfpc_presentation_controller_switch_to_slide_number (pdfpcPresentationController* self,
                                                           gint slide_number,
                                                           gboolean skip_history);
VALA_EXTERN void pdfpc_metadata_pdf_set_default_transition_from_string (pdfpcMetadataPdf* self,
                                                            const gchar* line);
static void __lambda54_ (Block16Data* _data16_,
                  GdkMonitor* m);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static void _______lambda55_ (Block17Data* _data17_);
static void ________lambda55__gtk_widget_show (GtkWidget* _sender,
                                        gpointer self);
VALA_EXTERN gboolean pdfpc_window_fullscreen_is_monitor_connected (pdfpcWindowFullscreen* self);
VALA_EXTERN void pdfpc_window_fullscreen_connect_monitor (pdfpcWindowFullscreen* self,
                                              GdkMonitor* monitor);
VALA_EXTERN gboolean pdfpc_presentation_controller_get_hidden (pdfpcPresentationController* self);
VALA_EXTERN void pdfpc_presentation_controller_hide_presentation (pdfpcPresentationController* self);
static void ___lambda54__gdk_display_monitor_added (GdkDisplay* _sender,
                                             GdkMonitor* monitor,
                                             gpointer self);
static void __lambda56_ (pdfpcApplication* self,
                  GdkMonitor* m);
VALA_EXTERN GdkMonitor* pdfpc_window_fullscreen_get_monitor (pdfpcWindowFullscreen* self);
static void ___lambda56__gdk_display_monitor_removed (GdkDisplay* _sender,
                                               GdkMonitor* monitor,
                                               gpointer self);
static gint pdfpc_application_main (gchar** args,
                             gint args_length1);
VALA_EXTERN pdfpcApplication* pdfpc_application_new (void);
VALA_EXTERN pdfpcApplication* pdfpc_application_construct (GType object_type);
static void pdfpc_application_finalize (GObject * obj);
static GType pdfpc_application_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GOptionEntry PDFPC_APPLICATION_options[29] = {{"list-bindings", 'B', (gint) 0, 0, &pdfpc_options_list_bindings, "List action bindings defined", NULL}, {"cfg-statement", 'c', (gint) 0, G_OPTION_ARG_STRING_ARRAY, &pdfpc_application_pdfpcrc_statements, "Interpret the string as a pdfpcrc statement", "STRING"}, {"time-of-day", 'C', (gint) 0, 0, &pdfpc_options_use_time_of_day, "Use the current time for the timer", NULL}, {"duration", 'd', (gint) 0, G_OPTION_ARG_INT, &pdfpc_options_duration, "Duration of the presentation (in minutes)", "N"}, {"end-time", 'e', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_end_time, "End time of the presentation", "HH:MM"}, {"note-format", 'f', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_notes_format, "Enforce note format (plain|markdown)", "FORMAT"}, {"disable-auto-grouping", 'g', (gint) 0, 0, &pdfpc_options_disable_auto_grouping, "Disable auto detection of overlays", NULL}, {"last-minutes", 'l', (gint) 0, G_OPTION_ARG_INT, &pdfpc_options_last_minutes, "Change the timer color during last N mins [5]", "N"}, {"list-actions", 'L', (gint) 0, 0, &pdfpc_application_list_actions, "List actions supported in the config file(s)", NULL}, {"list-monitors", 'M', (gint) 0, 0, &pdfpc_application_list_monitors, "List available monitors", NULL}, {"notes", 'n', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_notes_position, "Position of notes (left|right|top|bottom)", "P"}, {"no-install", 'N', (gint) 0, 0, &pdfpc_options_no_install, "Test pdfpc without installation", NULL}, {"rest-port", 'p', (gint) 0, G_OPTION_ARG_INT, &pdfpc_options_rest_port, "REST port number [8088]", NULL}, {"page", 'P', (gint) 0, G_OPTION_ARG_INT, &pdfpc_application_page_hnum, "Go to page number N directly after startup", "N"}, {"page-transition", 'r', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_default_transition, "Set default page transition", "TYPE"}, {"pdfpc-location", 'R', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_pdfpc_location, "Full path location to a pdfpc file", "PATH"}, {"switch-screens", 's', (gint) 0, 0, &pdfpc_options_display_switch, "Swap the presentation/presenter screens", NULL}, {"single-screen", 'S', (gint) 0, 0, &pdfpc_options_single_screen, "Force to use only one screen", NULL}, {"start-time", 't', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_start_time, "Start time of the presentation", "HH:MM"}, {"enable-auto-srt-load", 'T', (gint) 0, 0, &pdfpc_options_auto_srt, "Load video subtitle files automatically", NULL}, {"version", 'v', (gint) 0, 0, &pdfpc_application_version, "Output version information and exit", NULL}, {"enable-rest-server", 'V', (gint) 0, 0, &pdfpc_options_enable_rest, "Enable REST server", NULL}, {"windowed", 'w', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_windowed, "Run in the given windowed mode", "MODE"}, {"wayland-workaround", 'W', (gint) 0, 0, &pdfpc_options_wayland_workaround, "Enable Wayland-specific workaround", NULL}, {"external-script", 'X', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_external_script, "Enable execution of an external script", "file"}, {"size", 'Z', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_size, "Size of the presentation window (implies \"-w\")", "W:H"}, {"presenter-screen", '1', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_presenter_screen, "Monitor to be used for the presenter", "M"}, {"presentation-screen", '2', (gint) 0, G_OPTION_ARG_STRING, &pdfpc_options_presentation_screen, "Monitor to be used for the presentation", "M"}, {NULL}};

static inline gpointer
pdfpc_application_get_instance_private (pdfpcApplication* self)
{
	return G_STRUCT_MEMBER_P (self, pdfpcApplication_private_offset);
}

/**
         * Parse the commandline and apply all found options to there according
         * static class members.
         *
         * Returns the name of the pdf file to open (or null if not present)
         */
gchar*
pdfpc_application_parse_command_line_options (pdfpcApplication* self,
                                              gchar*** args,
                                              gint* args_length1)
{
	pdfpcOptions* _tmp0_;
	pdfpcOptions* _tmp1_;
	GOptionContext* context = NULL;
	GOptionContext* _tmp2_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = pdfpc_options_new ();
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
	_tmp2_ = g_option_context_new ("<pdf-file>");
	context = _tmp2_;
	g_option_context_add_main_entries (context, PDFPC_APPLICATION_options, NULL);
	{
		g_option_context_parse (context, (gint*) (args_length1), args, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_OPTION_ERROR) {
				goto __catch0_g_option_error;
			}
			_g_option_context_free0 (context);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	goto __finally0;
	__catch0_g_option_error:
	{
		GError* e = NULL;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e->message;
		_tmp4_ = g_option_context_get_help (context, TRUE, NULL);
		_tmp5_ = _tmp4_;
		g_printerr ("%s\n\n%s\n", _tmp3_, _tmp5_);
		_g_free0 (_tmp5_);
		exit (1);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	if ((*args_length1) < 2) {
		result = NULL;
		_g_option_context_free0 (context);
		return result;
	} else {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp6_ = (*args)[1];
		_tmp7_ = g_strdup (_tmp6_);
		result = _tmp7_;
		_g_option_context_free0 (context);
		return result;
	}
}

/**
         * Print version string and copyright statement
         */
static void
pdfpc_application_print_version (pdfpcApplication* self)
{
	g_return_if_fail (self != NULL);
	pdfpc_release_print_version ();
}

/**
         * Set the CSS styling for GTK.
         */
static void
pdfpc_application_set_styling (pdfpcApplication* self)
{
	GtkCssProvider* globalProvider = NULL;
	GtkCssProvider* _tmp0_;
	GtkCssProvider* userProvider = NULL;
	GtkCssProvider* _tmp1_;
	GdkDisplay* _tmp2_;
	GdkScreen* _tmp3_;
	GtkCssProvider* _tmp4_;
	GdkDisplay* _tmp5_;
	GdkScreen* _tmp6_;
	GtkCssProvider* _tmp7_;
	gchar* distCssPath = NULL;
	gchar* legacyUserCssPath = NULL;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* userCssPath = NULL;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_css_provider_new ();
	globalProvider = _tmp0_;
	_tmp1_ = gtk_css_provider_new ();
	userProvider = _tmp1_;
	_tmp2_ = gdk_display_get_default ();
	_tmp3_ = gdk_display_get_default_screen (_tmp2_);
	_tmp4_ = globalProvider;
	gtk_style_context_add_provider_for_screen (_tmp3_, (GtkStyleProvider*) _tmp4_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_tmp5_ = gdk_display_get_default ();
	_tmp6_ = gdk_display_get_default_screen (_tmp5_);
	_tmp7_ = userProvider;
	gtk_style_context_add_provider_for_screen (_tmp6_, (GtkStyleProvider*) _tmp7_, (guint) GTK_STYLE_PROVIDER_PRIORITY_USER);
	if (pdfpc_options_no_install) {
		gchar* _tmp8_;
		_tmp8_ = g_build_filename (PDFPC_PATHS_SOURCE_PATH, "css/pdfpc.css", NULL);
		_g_free0 (distCssPath);
		distCssPath = _tmp8_;
	} else {
		gchar* _tmp9_;
		_tmp9_ = g_build_filename (PDFPC_PATHS_SHARE_PATH, "css/pdfpc.css", NULL);
		_g_free0 (distCssPath);
		distCssPath = _tmp9_;
	}
	_tmp10_ = g_get_user_config_dir ();
	_tmp11_ = g_build_filename (_tmp10_, "pdfpc.css", NULL);
	legacyUserCssPath = _tmp11_;
	_tmp12_ = g_get_user_config_dir ();
	_tmp13_ = g_build_filename (_tmp12_, "pdfpc", "pdfpc.css", NULL);
	userCssPath = _tmp13_;
	{
		const gchar* _tmp14_;
		const gchar* _tmp17_;
		_tmp14_ = distCssPath;
		if (g_file_test (_tmp14_, G_FILE_TEST_IS_REGULAR)) {
			GtkCssProvider* _tmp15_;
			const gchar* _tmp16_;
			_tmp15_ = globalProvider;
			_tmp16_ = distCssPath;
			gtk_css_provider_load_from_path (_tmp15_, _tmp16_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			g_printerr ("No CSS file found\n");
			exit (1);
		}
		_tmp17_ = userCssPath;
		if (g_file_test (_tmp17_, G_FILE_TEST_IS_REGULAR)) {
			GtkCssProvider* _tmp18_;
			const gchar* _tmp19_;
			_tmp18_ = userProvider;
			_tmp19_ = userCssPath;
			gtk_css_provider_load_from_path (_tmp18_, _tmp19_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			const gchar* _tmp20_;
			_tmp20_ = legacyUserCssPath;
			if (g_file_test (_tmp20_, G_FILE_TEST_IS_REGULAR)) {
				GtkCssProvider* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				_tmp21_ = userProvider;
				_tmp22_ = legacyUserCssPath;
				gtk_css_provider_load_from_path (_tmp21_, _tmp22_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
				_tmp23_ = userCssPath;
				g_printerr ("Loaded pdfpc.css from legacy location. Please move your style sheet to" \
" %s\n", _tmp23_);
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp24_;
		const gchar* _tmp25_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp24_ = _error_;
		_tmp25_ = _tmp24_->message;
		g_printerr ("Could not load styling from data: %s\n", _tmp25_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (userCssPath);
		_g_free0 (legacyUserCssPath);
		_g_free0 (distCssPath);
		_g_object_unref0 (userProvider);
		_g_object_unref0 (globalProvider);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_free0 (userCssPath);
	_g_free0 (legacyUserCssPath);
	_g_free0 (distCssPath);
	_g_object_unref0 (userProvider);
	_g_object_unref0 (globalProvider);
}

/**
         * Main application function, which instantiates the windows and
         * initializes the Gtk system.
         */
static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		pdfpcApplication* self;
		self = _data16_->self;
		_g_object_unref0 (_data16_->display);
		_g_object_unref0 (self);
		g_slice_free (Block16Data, _data16_);
	}
}

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

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static void
___lambda52_ (pdfpcApplication* self)
{
	pdfpcPresentationController* _tmp0_;
	pdfpcWindowPresenter* _tmp1_;
	pdfpcWindowPresenter* _tmp2_;
	_tmp0_ = self->priv->controller;
	_tmp1_ = pdfpc_presentation_controller_get_presenter (_tmp0_);
	_tmp2_ = _tmp1_;
	pdfpc_window_presenter_update (_tmp2_);
}

static void
____lambda52__gtk_widget_show (GtkWidget* _sender,
                               gpointer self)
{
	___lambda52_ ((pdfpcApplication*) self);
}

static void
___lambda53_ (pdfpcApplication* self)
{
	pdfpcPresentationController* _tmp0_;
	pdfpcWindowPresentation* _tmp1_;
	pdfpcWindowPresentation* _tmp2_;
	_tmp0_ = self->priv->controller;
	_tmp1_ = pdfpc_presentation_controller_get_presentation (_tmp0_);
	_tmp2_ = _tmp1_;
	pdfpc_window_presentation_update (_tmp2_);
}

static void
____lambda53__gtk_widget_show (GtkWidget* _sender,
                               gpointer self)
{
	___lambda53_ ((pdfpcApplication*) self);
}

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		pdfpcApplication* self;
		self = _data17_->_data16_->self;
		_g_object_unref0 (_data17_->controller);
		block16_data_unref (_data17_->_data16_);
		_data17_->_data16_ = NULL;
		g_slice_free (Block17Data, _data17_);
	}
}

static void
_______lambda55_ (Block17Data* _data17_)
{
	Block16Data* _data16_;
	pdfpcApplication* self;
	pdfpcPresentationController* _tmp0_;
	pdfpcWindowPresentation* _tmp1_;
	pdfpcWindowPresentation* _tmp2_;
	_data16_ = _data17_->_data16_;
	self = _data16_->self;
	_tmp0_ = _data17_->controller;
	_tmp1_ = pdfpc_presentation_controller_get_presentation (_tmp0_);
	_tmp2_ = _tmp1_;
	pdfpc_window_presentation_update (_tmp2_);
}

static void
________lambda55__gtk_widget_show (GtkWidget* _sender,
                                   gpointer self)
{
	_______lambda55_ (self);
}

static void
__lambda54_ (Block16Data* _data16_,
             GdkMonitor* m)
{
	pdfpcApplication* self;
	Block17Data* _data17_;
	const gchar* _tmp0_;
	pdfpcPresentationController* _tmp1_;
	pdfpcPresentationController* _tmp2_;
	pdfpcWindowPresentation* presentation = NULL;
	pdfpcPresentationController* _tmp3_;
	pdfpcWindowPresentation* _tmp4_;
	pdfpcWindowPresentation* _tmp5_;
	pdfpcWindowPresentation* _tmp6_;
	pdfpcWindowPresentation* _tmp7_;
	self = _data16_->self;
	g_return_if_fail (m != NULL);
	_data17_ = g_slice_new0 (Block17Data);
	_data17_->_ref_count_ = 1;
	_data17_->_data16_ = block16_data_ref (_data16_);
	_tmp0_ = gdk_monitor_get_model (m);
	g_print ("Monitor %s added\n", _tmp0_);
	if (pdfpc_options_single_screen) {
		block17_data_unref (_data17_);
		_data17_ = NULL;
		return;
	}
	_tmp1_ = self->priv->controller;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data17_->controller = _tmp2_;
	_tmp3_ = _data17_->controller;
	_tmp4_ = pdfpc_presentation_controller_get_presentation (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	presentation = _tmp6_;
	_tmp7_ = presentation;
	if (_tmp7_ == NULL) {
		_data16_->n_monitors = gdk_display_get_n_monitors (_data16_->display);
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp8_ = FALSE;
				_tmp8_ = TRUE;
				while (TRUE) {
					GdkMonitor* _tmp10_;
					if (!_tmp8_) {
						gint _tmp9_;
						_tmp9_ = i;
						i = _tmp9_ + 1;
					}
					_tmp8_ = FALSE;
					if (!(i < _data16_->n_monitors)) {
						break;
					}
					_tmp10_ = gdk_display_get_monitor (_data16_->display, i);
					if (_tmp10_ == m) {
						pdfpcPresentationController* _tmp11_;
						pdfpcPresentationController* _tmp12_;
						pdfpcWindowPresentation* _tmp13_;
						pdfpcWindowPresentation* _tmp14_;
						pdfpcPresentationController* _tmp15_;
						pdfpcWindowPresentation* _tmp16_;
						pdfpcWindowPresentation* _tmp17_;
						pdfpcPresentationController* _tmp18_;
						pdfpcWindowPresentation* _tmp19_;
						pdfpcWindowPresentation* _tmp20_;
						_tmp11_ = _data17_->controller;
						_tmp12_ = _data17_->controller;
						_tmp13_ = pdfpc_window_presentation_new (_tmp12_, i, _data16_->presentation_windowed, _data16_->width, _data16_->height);
						g_object_ref_sink (_tmp13_);
						_tmp14_ = _tmp13_;
						pdfpc_presentation_controller_set_presentation (_tmp11_, _tmp14_);
						_g_object_unref0 (_tmp14_);
						_tmp15_ = _data17_->controller;
						_tmp16_ = pdfpc_presentation_controller_get_presentation (_tmp15_);
						_tmp17_ = _tmp16_;
						g_signal_connect_data ((GtkWidget*) _tmp17_, "show", (GCallback) ________lambda55__gtk_widget_show, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
						_tmp18_ = _data17_->controller;
						_tmp19_ = pdfpc_presentation_controller_get_presentation (_tmp18_);
						_tmp20_ = _tmp19_;
						gtk_widget_show_all ((GtkWidget*) _tmp20_);
						break;
					}
				}
			}
		}
	} else {
		pdfpcWindowPresentation* _tmp21_;
		_tmp21_ = presentation;
		if (!pdfpc_window_fullscreen_is_monitor_connected ((pdfpcWindowFullscreen*) _tmp21_)) {
			pdfpcWindowPresentation* _tmp22_;
			pdfpcPresentationController* _tmp23_;
			gboolean _tmp24_;
			gboolean _tmp25_;
			_tmp22_ = presentation;
			pdfpc_window_fullscreen_connect_monitor ((pdfpcWindowFullscreen*) _tmp22_, m);
			_tmp23_ = _data17_->controller;
			_tmp24_ = pdfpc_presentation_controller_get_hidden (_tmp23_);
			_tmp25_ = _tmp24_;
			if (_tmp25_) {
				pdfpcPresentationController* _tmp26_;
				_tmp26_ = _data17_->controller;
				pdfpc_presentation_controller_hide_presentation (_tmp26_);
			}
		} else {
		}
	}
	_g_object_unref0 (presentation);
	block17_data_unref (_data17_);
	_data17_ = NULL;
}

static void
___lambda54__gdk_display_monitor_added (GdkDisplay* _sender,
                                        GdkMonitor* monitor,
                                        gpointer self)
{
	__lambda54_ (self, monitor);
}

static void
__lambda56_ (pdfpcApplication* self,
             GdkMonitor* m)
{
	const gchar* _tmp0_;
	pdfpcPresentationController* controller = NULL;
	pdfpcPresentationController* _tmp1_;
	pdfpcPresentationController* _tmp2_;
	pdfpcWindowPresentation* presentation = NULL;
	pdfpcPresentationController* _tmp3_;
	pdfpcWindowPresentation* _tmp4_;
	pdfpcWindowPresentation* _tmp5_;
	pdfpcWindowPresentation* _tmp6_;
	gboolean _tmp7_ = FALSE;
	pdfpcWindowPresentation* _tmp8_;
	g_return_if_fail (m != NULL);
	_tmp0_ = gdk_monitor_get_model (m);
	g_print ("Monitor %s removed\n", _tmp0_);
	if (pdfpc_options_single_screen) {
		return;
	}
	_tmp1_ = self->priv->controller;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	controller = _tmp2_;
	_tmp3_ = controller;
	_tmp4_ = pdfpc_presentation_controller_get_presentation (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	presentation = _tmp6_;
	_tmp8_ = presentation;
	if (_tmp8_ != NULL) {
		pdfpcWindowPresentation* _tmp9_;
		GdkMonitor* _tmp10_;
		GdkMonitor* _tmp11_;
		_tmp9_ = presentation;
		_tmp10_ = pdfpc_window_fullscreen_get_monitor ((pdfpcWindowFullscreen*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_ == m;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		pdfpcPresentationController* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		pdfpcWindowPresentation* _tmp16_;
		_tmp12_ = controller;
		_tmp13_ = pdfpc_presentation_controller_get_hidden (_tmp12_);
		_tmp14_ = _tmp13_;
		if (!_tmp14_) {
			pdfpcPresentationController* _tmp15_;
			_tmp15_ = controller;
			pdfpc_presentation_controller_hide_presentation (_tmp15_);
		}
		_tmp16_ = presentation;
		pdfpc_window_fullscreen_connect_monitor ((pdfpcWindowFullscreen*) _tmp16_, NULL);
	}
	_g_object_unref0 (presentation);
	_g_object_unref0 (controller);
}

static void
___lambda56__gdk_display_monitor_removed (GdkDisplay* _sender,
                                          GdkMonitor* monitor,
                                          gpointer self)
{
	__lambda56_ ((pdfpcApplication*) self, monitor);
}

void
pdfpc_application_run (pdfpcApplication* self,
                       gchar** args,
                       gint args_length1)
{
	Block16Data* _data16_;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	gchar* pdfFilename = NULL;
	gchar* _tmp2_;
	GdkSeat* seat = NULL;
	GdkSeat* _tmp19_;
	GdkSeat* _tmp20_;
	GList* touchSeats = NULL;
	GdkSeat* _tmp21_;
	GList* _tmp22_;
	GList* _tmp23_;
	pdfpcConfigFileReader* configFileReader = NULL;
	pdfpcConfigFileReader* _tmp24_;
	gchar* systemConfig = NULL;
	pdfpcConfigFileReader* _tmp27_;
	const gchar* _tmp28_;
	gchar* userConfig = NULL;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	const gchar* _tmp31_;
	pdfpcConfigFileReader* _tmp39_;
	const gchar* _tmp40_;
	gchar** _tmp41_;
	gint _tmp41__length1;
	const gchar* _tmp45_;
	gboolean presenter_windowed = FALSE;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	GQuark _tmp59_ = 0U;
	static GQuark _tmp58_label0 = 0;
	static GQuark _tmp58_label1 = 0;
	static GQuark _tmp58_label2 = 0;
	static GQuark _tmp58_label3 = 0;
	static GQuark _tmp58_label4 = 0;
	pdfpcPresentationController* _tmp61_;
	pdfpcMetadataPdf* metadata = NULL;
	pdfpcMetadataPdf* _tmp96_;
	pdfpcPresentationController* _tmp97_;
	pdfpcMetadataPdf* _tmp98_;
	gint primary_monitor_num = 0;
	gint secondary_monitor_num = 0;
	gint presenter_monitor = 0;
	gint presentation_monitor = 0;
	gboolean _tmp114_ = FALSE;
	const gchar* _tmp115_;
	gboolean _tmp117_ = FALSE;
	const gchar* _tmp118_;
	gboolean _tmp122_ = FALSE;
	gboolean single_screen_mode = FALSE;
	gboolean _tmp125_ = FALSE;
	gboolean _tmp136_ = FALSE;
	gboolean _tmp147_ = FALSE;
	const gchar* _tmp152_;
	gchar* im_module = NULL;
	const gchar* _tmp155_;
	gchar* _tmp156_;
	const gchar* _tmp157_;
	g_return_if_fail (self != NULL);
	_data16_ = g_slice_new0 (Block16Data);
	_data16_->_ref_count_ = 1;
	_data16_->self = g_object_ref (self);
	XInitThreads ();
	gtk_init ((gint*) (&args_length1), &args);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data16_->display = _tmp1_;
	_tmp2_ = pdfpc_application_parse_command_line_options (self, &args, (gint*) (&args_length1));
	pdfFilename = _tmp2_;
	if (pdfpc_application_version) {
		pdfpc_application_print_version (self);
		exit (0);
	}
	if (pdfpc_application_list_monitors) {
		gint n_monitors = 0;
		n_monitors = gdk_display_get_n_monitors (_data16_->display);
		g_print ("Monitors: %d\n", n_monitors);
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					GdkMonitor* monitor = NULL;
					GdkMonitor* _tmp5_;
					GdkMonitor* _tmp6_;
					gint sf = 0;
					GdkMonitor* _tmp7_;
					GdkRectangle geo = {0};
					GdkMonitor* _tmp8_;
					GdkRectangle _tmp9_ = {0};
					gchar _tmp10_ = '\0';
					GdkMonitor* _tmp11_;
					GdkMonitor* _tmp12_;
					const gchar* _tmp13_;
					GdkRectangle _tmp14_;
					GdkRectangle _tmp15_;
					GdkRectangle _tmp16_;
					GdkRectangle _tmp17_;
					GdkMonitor* _tmp18_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					if (!(i < n_monitors)) {
						break;
					}
					_tmp5_ = gdk_display_get_monitor (_data16_->display, i);
					_tmp6_ = _g_object_ref0 (_tmp5_);
					monitor = _tmp6_;
					_tmp7_ = monitor;
					sf = gdk_monitor_get_scale_factor (_tmp7_);
					_tmp8_ = monitor;
					gdk_monitor_get_geometry (_tmp8_, &_tmp9_);
					geo = _tmp9_;
					_tmp11_ = monitor;
					if (gdk_monitor_is_primary (_tmp11_)) {
						_tmp10_ = '*';
					} else {
						_tmp10_ = ' ';
					}
					_tmp12_ = monitor;
					_tmp13_ = gdk_monitor_get_model (_tmp12_);
					_tmp14_ = geo;
					_tmp15_ = geo;
					_tmp16_ = geo;
					_tmp17_ = geo;
					_tmp18_ = monitor;
					g_print (" %d: %c %s \t[%dx%d+%d+%d@%dHz \tscale=%d%%]\n", i, (gint) _tmp10_, _tmp13_, _tmp14_.width * sf, _tmp15_.height * sf, _tmp16_.x * sf, _tmp17_.y * sf, (gdk_monitor_get_refresh_rate (_tmp18_) + 500) / 1000, 100 * sf);
					_g_object_unref0 (monitor);
				}
			}
		}
		exit (0);
	}
	_tmp19_ = gdk_display_get_default_seat (_data16_->display);
	_tmp20_ = _g_object_ref0 (_tmp19_);
	seat = _tmp20_;
	_tmp21_ = seat;
	_tmp22_ = gdk_seat_get_slaves (_tmp21_, GDK_SEAT_CAPABILITY_TOUCH);
	touchSeats = _tmp22_;
	_tmp23_ = touchSeats;
	if (g_list_length (_tmp23_) > ((guint) 0)) {
		pdfpc_options_toolbox_shown = TRUE;
	}
	_tmp24_ = pdfpc_config_file_reader_new ();
	configFileReader = _tmp24_;
	if (pdfpc_options_no_install) {
		gchar* _tmp25_;
		_tmp25_ = g_build_filename (PDFPC_PATHS_SOURCE_PATH, "rc/pdfpcrc", NULL);
		_g_free0 (systemConfig);
		systemConfig = _tmp25_;
	} else {
		gchar* _tmp26_;
		_tmp26_ = g_build_filename (PDFPC_PATHS_CONF_PATH, "pdfpcrc", NULL);
		_g_free0 (systemConfig);
		systemConfig = _tmp26_;
	}
	_tmp27_ = configFileReader;
	_tmp28_ = systemConfig;
	pdfpc_config_file_reader_readConfig (_tmp27_, _tmp28_);
	_tmp29_ = g_get_user_config_dir ();
	_tmp30_ = g_build_filename (_tmp29_, "pdfpc", "pdfpcrc", NULL);
	userConfig = _tmp30_;
	_tmp31_ = userConfig;
	if (!g_file_test (_tmp31_, G_FILE_TEST_IS_REGULAR)) {
		gchar* legacyUserConfig = NULL;
		const gchar* _tmp32_;
		gchar* _tmp33_;
		const gchar* _tmp34_;
		_tmp32_ = g_get_home_dir ();
		_tmp33_ = g_build_filename (_tmp32_, ".pdfpcrc", NULL);
		legacyUserConfig = _tmp33_;
		_tmp34_ = legacyUserConfig;
		if (g_file_test (_tmp34_, G_FILE_TEST_IS_REGULAR)) {
			const gchar* _tmp35_;
			const gchar* _tmp36_;
			const gchar* _tmp37_;
			gchar* _tmp38_;
			_tmp35_ = legacyUserConfig;
			_tmp36_ = userConfig;
			g_printerr ("Please move your config file from %s to %s\n", _tmp35_, _tmp36_);
			_tmp37_ = legacyUserConfig;
			_tmp38_ = g_strdup (_tmp37_);
			_g_free0 (userConfig);
			userConfig = _tmp38_;
		}
		_g_free0 (legacyUserConfig);
	}
	_tmp39_ = configFileReader;
	_tmp40_ = userConfig;
	pdfpc_config_file_reader_readConfig (_tmp39_, _tmp40_);
	_tmp41_ = pdfpc_application_pdfpcrc_statements;
	_tmp41__length1 = _vala_array_length (pdfpc_application_pdfpcrc_statements);
	{
		gchar** statement_collection = NULL;
		gint statement_collection_length1 = 0;
		gint _statement_collection_size_ = 0;
		gint statement_it = 0;
		statement_collection = _tmp41_;
		statement_collection_length1 = _tmp41__length1;
		for (statement_it = 0; statement_it < statement_collection_length1; statement_it = statement_it + 1) {
			gchar* _tmp42_;
			gchar* statement = NULL;
			_tmp42_ = g_strdup (statement_collection[statement_it]);
			statement = _tmp42_;
			{
				pdfpcConfigFileReader* _tmp43_;
				const gchar* _tmp44_;
				_tmp43_ = configFileReader;
				_tmp44_ = statement;
				pdfpc_config_file_reader_parseStatement (_tmp43_, _tmp44_);
				_g_free0 (statement);
			}
		}
	}
	if (pdfpc_options_prerender_slides != 0) {
		pdfpc_options_cache_min_rtime = 0;
	}
	gst_init ((gint*) (&args_length1), &args);
	_data16_->width = -1;
	_data16_->height = -1;
	_tmp45_ = pdfpc_options_size;
	if (_tmp45_ != NULL) {
		gint colonIndex = 0;
		const gchar* _tmp46_;
		const gchar* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		const gchar* _tmp50_;
		gchar* _tmp51_;
		gchar* _tmp52_;
		gboolean _tmp53_ = FALSE;
		gchar* _tmp55_;
		_tmp46_ = pdfpc_options_size;
		colonIndex = string_index_of (_tmp46_, ":", 0);
		_tmp47_ = pdfpc_options_size;
		_tmp48_ = string_substring (_tmp47_, (glong) 0, (glong) colonIndex);
		_tmp49_ = _tmp48_;
		_data16_->width = atoi (_tmp49_);
		_g_free0 (_tmp49_);
		_tmp50_ = pdfpc_options_size;
		_tmp51_ = string_substring (_tmp50_, (glong) (colonIndex + 1), (glong) -1);
		_tmp52_ = _tmp51_;
		_data16_->height = atoi (_tmp52_);
		_g_free0 (_tmp52_);
		if (_data16_->width < 1) {
			_tmp53_ = TRUE;
		} else {
			_tmp53_ = _data16_->height < 1;
		}
		if (_tmp53_) {
			const gchar* _tmp54_;
			_tmp54_ = pdfpc_options_size;
			g_printerr ("Failed to parse --size=%s\n", _tmp54_);
			exit (1);
		}
		_tmp55_ = g_strdup ("both");
		_g_free0 (pdfpc_options_windowed);
		pdfpc_options_windowed = _tmp55_;
	}
	presenter_windowed = FALSE;
	_data16_->presentation_windowed = FALSE;
	_tmp56_ = pdfpc_options_windowed;
	_tmp57_ = _tmp56_;
	_tmp59_ = (NULL == _tmp57_) ? 0 : g_quark_from_string (_tmp57_);
	if (_tmp59_ == ((0 != _tmp58_label0) ? _tmp58_label0 : (_tmp58_label0 = g_quark_from_static_string ("none")))) {
		switch (0) {
			default:
			{
				break;
			}
		}
	} else if ((_tmp59_ == ((0 != _tmp58_label1) ? _tmp58_label1 : (_tmp58_label1 = g_quark_from_static_string ("presenter")))) || (_tmp59_ == ((0 != _tmp58_label2) ? _tmp58_label2 : (_tmp58_label2 = g_quark_from_static_string (NULL))))) {
		switch (0) {
			default:
			{
				presenter_windowed = TRUE;
				break;
			}
		}
	} else if (_tmp59_ == ((0 != _tmp58_label3) ? _tmp58_label3 : (_tmp58_label3 = g_quark_from_static_string ("presentation")))) {
		switch (0) {
			default:
			{
				_data16_->presentation_windowed = TRUE;
				break;
			}
		}
	} else if (_tmp59_ == ((0 != _tmp58_label4) ? _tmp58_label4 : (_tmp58_label4 = g_quark_from_static_string ("both")))) {
		switch (0) {
			default:
			{
				presenter_windowed = TRUE;
				_data16_->presentation_windowed = TRUE;
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				const gchar* _tmp60_;
				_tmp60_ = pdfpc_options_windowed;
				g_printerr ("Unknown windowed mode \"%s\"\n", _tmp60_);
				exit (1);
			}
		}
	}
	_tmp61_ = pdfpc_presentation_controller_new ();
	_g_object_unref0 (self->priv->controller);
	self->priv->controller = _tmp61_;
	if (pdfpc_application_list_actions) {
		gchar** actions = NULL;
		pdfpcPresentationController* _tmp62_;
		gint _tmp63_ = 0;
		gchar** _tmp64_;
		gint actions_length1;
		gint _actions_size_;
		g_print ("Actions supported by pdfpc:\n");
		_tmp62_ = self->priv->controller;
		_tmp64_ = pdfpc_presentation_controller_get_action_descriptions (_tmp62_, &_tmp63_);
		actions = _tmp64_;
		actions_length1 = _tmp63_;
		_actions_size_ = actions_length1;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp65_ = FALSE;
				_tmp65_ = TRUE;
				while (TRUE) {
					gchar** _tmp66_;
					gint _tmp66__length1;
					gchar* tabAlignment = NULL;
					gchar* _tmp67_;
					gchar** _tmp68_;
					gint _tmp68__length1;
					const gchar* _tmp69_;
					gint _tmp70_;
					gint _tmp71_;
					gchar** _tmp74_;
					gint _tmp74__length1;
					const gchar* _tmp75_;
					const gchar* _tmp76_;
					gchar** _tmp77_;
					gint _tmp77__length1;
					const gchar* _tmp78_;
					if (!_tmp65_) {
						i += 2;
					}
					_tmp65_ = FALSE;
					_tmp66_ = actions;
					_tmp66__length1 = actions_length1;
					if (!(i < _tmp66__length1)) {
						break;
					}
					_tmp67_ = g_strdup ("\t");
					tabAlignment = _tmp67_;
					_tmp68_ = actions;
					_tmp68__length1 = actions_length1;
					_tmp69_ = _tmp68_[i];
					_tmp70_ = strlen (_tmp69_);
					_tmp71_ = _tmp70_;
					if (_tmp71_ < 12) {
						const gchar* _tmp72_;
						gchar* _tmp73_;
						_tmp72_ = tabAlignment;
						_tmp73_ = g_strconcat (_tmp72_, "\t", NULL);
						_g_free0 (tabAlignment);
						tabAlignment = _tmp73_;
					}
					_tmp74_ = actions;
					_tmp74__length1 = actions_length1;
					_tmp75_ = _tmp74_[i];
					_tmp76_ = tabAlignment;
					_tmp77_ = actions;
					_tmp77__length1 = actions_length1;
					_tmp78_ = _tmp77_[i + 1];
					g_print ("    %s%s=> %s\n", _tmp75_, _tmp76_, _tmp78_);
					_g_free0 (tabAlignment);
				}
			}
		}
		actions = (_vala_array_free (actions, actions_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (userConfig);
		_g_free0 (systemConfig);
		_pdfpc_config_file_reader_unref0 (configFileReader);
		(touchSeats == NULL) ? NULL : (touchSeats = (g_list_free (touchSeats), NULL));
		_g_object_unref0 (seat);
		_g_free0 (pdfFilename);
		block16_data_unref (_data16_);
		_data16_ = NULL;
		return;
	}
	if (pdfpc_options_list_bindings) {
		gchar** actions = NULL;
		pdfpcPresentationController* _tmp79_;
		gint _tmp80_ = 0;
		gchar** _tmp81_;
		gint actions_length1;
		gint _actions_size_;
		g_print ("Action bindings defined:\n");
		_tmp79_ = self->priv->controller;
		_tmp81_ = pdfpc_presentation_controller_get_action_bindings (_tmp79_, &_tmp80_);
		actions = _tmp81_;
		actions_length1 = _tmp80_;
		_actions_size_ = actions_length1;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp82_ = FALSE;
				_tmp82_ = TRUE;
				while (TRUE) {
					gchar** _tmp83_;
					gint _tmp83__length1;
					gchar* tabAlignment = NULL;
					gchar* _tmp84_;
					gchar** _tmp85_;
					gint _tmp85__length1;
					const gchar* _tmp86_;
					gint _tmp87_;
					gint _tmp88_;
					gchar** _tmp91_;
					gint _tmp91__length1;
					const gchar* _tmp92_;
					const gchar* _tmp93_;
					gchar** _tmp94_;
					gint _tmp94__length1;
					const gchar* _tmp95_;
					if (!_tmp82_) {
						i += 2;
					}
					_tmp82_ = FALSE;
					_tmp83_ = actions;
					_tmp83__length1 = actions_length1;
					if (!(i < _tmp83__length1)) {
						break;
					}
					_tmp84_ = g_strdup ("\t");
					tabAlignment = _tmp84_;
					_tmp85_ = actions;
					_tmp85__length1 = actions_length1;
					_tmp86_ = _tmp85_[i];
					_tmp87_ = strlen (_tmp86_);
					_tmp88_ = _tmp87_;
					if (_tmp88_ < 12) {
						const gchar* _tmp89_;
						gchar* _tmp90_;
						_tmp89_ = tabAlignment;
						_tmp90_ = g_strconcat (_tmp89_, "\t", NULL);
						_g_free0 (tabAlignment);
						tabAlignment = _tmp90_;
					}
					_tmp91_ = actions;
					_tmp91__length1 = actions_length1;
					_tmp92_ = _tmp91_[i];
					_tmp93_ = tabAlignment;
					_tmp94_ = actions;
					_tmp94__length1 = actions_length1;
					_tmp95_ = _tmp94_[i + 1];
					g_print ("    %s%s<= %s\n", _tmp92_, _tmp93_, _tmp95_);
					_g_free0 (tabAlignment);
				}
			}
		}
		actions = (_vala_array_free (actions, actions_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (userConfig);
		_g_free0 (systemConfig);
		_pdfpc_config_file_reader_unref0 (configFileReader);
		(touchSeats == NULL) ? NULL : (touchSeats = (g_list_free (touchSeats), NULL));
		_g_object_unref0 (seat);
		_g_free0 (pdfFilename);
		block16_data_unref (_data16_);
		_data16_ = NULL;
		return;
	}
	if (pdfFilename == NULL) {
		g_printerr ("No pdf file given\n");
		exit (1);
	} else {
		if (!g_file_test (pdfFilename, G_FILE_TEST_IS_REGULAR)) {
			g_printerr ("Pdf file \"%s\" not found\n", pdfFilename);
			exit (1);
		}
	}
	_tmp96_ = pdfpc_metadata_pdf_new (pdfFilename);
	metadata = _tmp96_;
	_tmp97_ = self->priv->controller;
	_tmp98_ = metadata;
	pdfpc_presentation_controller_set_metadata (_tmp97_, _tmp98_);
	pdfpc_application_set_styling (self);
	primary_monitor_num = 0;
	secondary_monitor_num = 0;
	presenter_monitor = -1;
	presentation_monitor = -1;
	_data16_->n_monitors = gdk_display_get_n_monitors (_data16_->display);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp99_ = FALSE;
			_tmp99_ = TRUE;
			while (TRUE) {
				gchar* monitor_model = NULL;
				GdkMonitor* _tmp101_;
				const gchar* _tmp102_;
				gchar* _tmp103_;
				gboolean _tmp104_ = FALSE;
				const gchar* _tmp105_;
				gboolean _tmp108_ = FALSE;
				const gchar* _tmp109_;
				gboolean _tmp112_ = FALSE;
				GdkMonitor* _tmp113_;
				if (!_tmp99_) {
					gint _tmp100_;
					_tmp100_ = i;
					i = _tmp100_ + 1;
				}
				_tmp99_ = FALSE;
				if (!(i < _data16_->n_monitors)) {
					break;
				}
				_tmp101_ = gdk_display_get_monitor (_data16_->display, i);
				_tmp102_ = gdk_monitor_get_model (_tmp101_);
				_tmp103_ = g_strdup (_tmp102_);
				monitor_model = _tmp103_;
				_tmp105_ = pdfpc_options_presenter_screen;
				if (_tmp105_ != NULL) {
					const gchar* _tmp106_;
					const gchar* _tmp107_;
					_tmp106_ = pdfpc_options_presenter_screen;
					_tmp107_ = monitor_model;
					_tmp104_ = g_strcmp0 (_tmp106_, _tmp107_) == 0;
				} else {
					_tmp104_ = FALSE;
				}
				if (_tmp104_) {
					presenter_monitor = i;
				}
				_tmp109_ = pdfpc_options_presentation_screen;
				if (_tmp109_ != NULL) {
					const gchar* _tmp110_;
					const gchar* _tmp111_;
					_tmp110_ = pdfpc_options_presentation_screen;
					_tmp111_ = monitor_model;
					_tmp108_ = g_strcmp0 (_tmp110_, _tmp111_) == 0;
				} else {
					_tmp108_ = FALSE;
				}
				if (_tmp108_) {
					presentation_monitor = i;
				}
				if (presentation_monitor >= 0) {
					_tmp112_ = presenter_monitor >= 0;
				} else {
					_tmp112_ = FALSE;
				}
				if (_tmp112_) {
					_g_free0 (monitor_model);
					break;
				}
				_tmp113_ = gdk_display_get_monitor (_data16_->display, i);
				if (gdk_monitor_is_primary (_tmp113_)) {
					primary_monitor_num = i;
				} else {
					secondary_monitor_num = i;
				}
				_g_free0 (monitor_model);
			}
		}
	}
	_tmp115_ = pdfpc_options_presenter_screen;
	if (_tmp115_ != NULL) {
		_tmp114_ = presenter_monitor == -1;
	} else {
		_tmp114_ = FALSE;
	}
	if (_tmp114_) {
		const gchar* _tmp116_;
		_tmp116_ = pdfpc_options_presenter_screen;
		g_printerr ("Monitor \"%s\" not found\n", _tmp116_);
		exit (1);
	}
	_tmp118_ = pdfpc_options_presentation_screen;
	if (_tmp118_ != NULL) {
		_tmp117_ = presentation_monitor == -1;
	} else {
		_tmp117_ = FALSE;
	}
	if (_tmp117_) {
		const gchar* _tmp119_;
		_tmp119_ = pdfpc_options_presentation_screen;
		g_printerr ("Monitor \"%s\" not found\n", _tmp119_);
		exit (1);
	}
	if (presenter_monitor == -1) {
		gint _tmp120_ = 0;
		if (!pdfpc_options_display_switch) {
			_tmp120_ = primary_monitor_num;
		} else {
			_tmp120_ = secondary_monitor_num;
		}
		presenter_monitor = _tmp120_;
	}
	if (presentation_monitor == -1) {
		gint _tmp121_ = 0;
		if (!pdfpc_options_display_switch) {
			_tmp121_ = secondary_monitor_num;
		} else {
			_tmp121_ = primary_monitor_num;
		}
		presentation_monitor = _tmp121_;
	}
	if (pdfpc_options_single_screen) {
		_tmp122_ = TRUE;
	} else {
		gboolean _tmp123_ = FALSE;
		if (_data16_->n_monitors == 1) {
			const gchar* _tmp124_;
			_tmp124_ = pdfpc_options_windowed;
			_tmp123_ = g_strcmp0 (_tmp124_, "both") != 0;
		} else {
			_tmp123_ = FALSE;
		}
		_tmp122_ = _tmp123_;
	}
	single_screen_mode = _tmp122_;
	if (!single_screen_mode) {
		_tmp125_ = TRUE;
	} else {
		_tmp125_ = !pdfpc_options_display_switch;
	}
	if (_tmp125_) {
		pdfpcPresentationController* _tmp126_;
		pdfpcPresentationController* _tmp127_;
		pdfpcWindowPresenter* _tmp128_;
		pdfpcWindowPresenter* _tmp129_;
		pdfpcPresentationController* _tmp130_;
		pdfpcWindowPresenter* _tmp131_;
		pdfpcWindowPresenter* _tmp132_;
		pdfpcPresentationController* _tmp133_;
		pdfpcWindowPresenter* _tmp134_;
		pdfpcWindowPresenter* _tmp135_;
		_tmp126_ = self->priv->controller;
		_tmp127_ = self->priv->controller;
		_tmp128_ = pdfpc_window_presenter_new (_tmp127_, presenter_monitor, presenter_windowed);
		g_object_ref_sink (_tmp128_);
		_tmp129_ = _tmp128_;
		pdfpc_presentation_controller_set_presenter (_tmp126_, _tmp129_);
		_g_object_unref0 (_tmp129_);
		_tmp130_ = self->priv->controller;
		_tmp131_ = pdfpc_presentation_controller_get_presenter (_tmp130_);
		_tmp132_ = _tmp131_;
		g_signal_connect_object ((GtkWidget*) _tmp132_, "show", (GCallback) ____lambda52__gtk_widget_show, self, 0);
		_tmp133_ = self->priv->controller;
		_tmp134_ = pdfpc_presentation_controller_get_presenter (_tmp133_);
		_tmp135_ = _tmp134_;
		gtk_widget_show_all ((GtkWidget*) _tmp135_);
	}
	if (!single_screen_mode) {
		_tmp136_ = TRUE;
	} else {
		_tmp136_ = pdfpc_options_display_switch;
	}
	if (_tmp136_) {
		pdfpcPresentationController* _tmp137_;
		pdfpcPresentationController* _tmp138_;
		pdfpcWindowPresentation* _tmp139_;
		pdfpcWindowPresentation* _tmp140_;
		pdfpcPresentationController* _tmp141_;
		pdfpcWindowPresentation* _tmp142_;
		pdfpcWindowPresentation* _tmp143_;
		pdfpcPresentationController* _tmp144_;
		pdfpcWindowPresentation* _tmp145_;
		pdfpcWindowPresentation* _tmp146_;
		_tmp137_ = self->priv->controller;
		_tmp138_ = self->priv->controller;
		_tmp139_ = pdfpc_window_presentation_new (_tmp138_, presentation_monitor, _data16_->presentation_windowed, _data16_->width, _data16_->height);
		g_object_ref_sink (_tmp139_);
		_tmp140_ = _tmp139_;
		pdfpc_presentation_controller_set_presentation (_tmp137_, _tmp140_);
		_g_object_unref0 (_tmp140_);
		_tmp141_ = self->priv->controller;
		_tmp142_ = pdfpc_presentation_controller_get_presentation (_tmp141_);
		_tmp143_ = _tmp142_;
		g_signal_connect_object ((GtkWidget*) _tmp143_, "show", (GCallback) ____lambda53__gtk_widget_show, self, 0);
		_tmp144_ = self->priv->controller;
		_tmp145_ = pdfpc_presentation_controller_get_presentation (_tmp144_);
		_tmp146_ = _tmp145_;
		gtk_widget_show_all ((GtkWidget*) _tmp146_);
	}
	if (pdfpc_application_page_hnum >= 1) {
		pdfpcMetadataPdf* _tmp148_;
		_tmp148_ = metadata;
		_tmp147_ = pdfpc_application_page_hnum <= (pdfpc_metadata_pdf_get_end_user_slide (_tmp148_) + 1);
	} else {
		_tmp147_ = FALSE;
	}
	if (_tmp147_) {
		gint u = 0;
		pdfpcMetadataPdf* _tmp149_;
		pdfpcPresentationController* _tmp150_;
		_tmp149_ = metadata;
		u = pdfpc_metadata_pdf_user_slide_to_real_slide (_tmp149_, pdfpc_application_page_hnum - 1, FALSE);
		_tmp150_ = self->priv->controller;
		pdfpc_presentation_controller_switch_to_slide_number (_tmp150_, u, TRUE);
	} else {
		pdfpcMetadataPdf* _tmp151_;
		_tmp151_ = metadata;
		g_printerr ("Argument --page/-P must be between 1 and %d\n", pdfpc_metadata_pdf_get_end_user_slide (_tmp151_));
		exit (1);
	}
	_tmp152_ = pdfpc_options_default_transition;
	if (_tmp152_ != NULL) {
		pdfpcMetadataPdf* _tmp153_;
		const gchar* _tmp154_;
		_tmp153_ = metadata;
		_tmp154_ = pdfpc_options_default_transition;
		pdfpc_metadata_pdf_set_default_transition_from_string (_tmp153_, _tmp154_);
	}
	g_signal_connect_data (_data16_->display, "monitor-added", (GCallback) ___lambda54__gdk_display_monitor_added, block16_data_ref (_data16_), (GClosureNotify) block16_data_unref, 0);
	g_signal_connect_object (_data16_->display, "monitor-removed", (GCallback) ___lambda56__gdk_display_monitor_removed, self, 0);
	_tmp155_ = g_getenv ("GTK_IM_MODULE");
	_tmp156_ = g_strdup (_tmp155_);
	im_module = _tmp156_;
	_tmp157_ = im_module;
	if (g_strcmp0 (_tmp157_, "xim") == 0) {
		g_printerr ("Warning: XIM is known to cause problems\n");
	}
	gtk_main ();
	_g_free0 (im_module);
	_g_object_unref0 (metadata);
	_g_free0 (userConfig);
	_g_free0 (systemConfig);
	_pdfpc_config_file_reader_unref0 (configFileReader);
	(touchSeats == NULL) ? NULL : (touchSeats = (g_list_free (touchSeats), NULL));
	_g_object_unref0 (seat);
	_g_free0 (pdfFilename);
	block16_data_unref (_data16_);
	_data16_ = NULL;
}

/**
         * Basic application entry point
         */
static gint
pdfpc_application_main (gchar** args,
                        gint args_length1)
{
	pdfpcApplication* application = NULL;
	pdfpcApplication* _tmp0_;
	gint result;
	_tmp0_ = pdfpc_application_new ();
	application = _tmp0_;
	pdfpc_application_run (application, args, (gint) args_length1);
	result = 0;
	_g_object_unref0 (application);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return pdfpc_application_main (argv, argc);
}

pdfpcApplication*
pdfpc_application_construct (GType object_type)
{
	pdfpcApplication * self = NULL;
	self = (pdfpcApplication*) g_object_new (object_type, NULL);
	return self;
}

pdfpcApplication*
pdfpc_application_new (void)
{
	return pdfpc_application_construct (PDFPC_TYPE_APPLICATION);
}

static void
pdfpc_application_class_init (pdfpcApplicationClass * klass,
                              gpointer klass_data)
{
	pdfpc_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdfpcApplication_private_offset);
	G_OBJECT_CLASS (klass)->finalize = pdfpc_application_finalize;
}

static void
pdfpc_application_instance_init (pdfpcApplication * self,
                                 gpointer klass)
{
	self->priv = pdfpc_application_get_instance_private (self);
}

static void
pdfpc_application_finalize (GObject * obj)
{
	pdfpcApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_TYPE_APPLICATION, pdfpcApplication);
	_g_object_unref0 (self->priv->controller);
	G_OBJECT_CLASS (pdfpc_application_parent_class)->finalize (obj);
}

/**
     * Pdf Presenter Console main application class
     *
     * This class contains the main method as well as all the logic needed for
     * initializing the application, like commandline parsing and window creation.
     */
static GType
pdfpc_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcApplication), 0, (GInstanceInitFunc) pdfpc_application_instance_init, NULL };
	GType pdfpc_application_type_id;
	pdfpc_application_type_id = g_type_register_static (G_TYPE_OBJECT, "pdfpcApplication", &g_define_type_info, 0);
	pdfpcApplication_private_offset = g_type_add_instance_private (pdfpc_application_type_id, sizeof (pdfpcApplicationPrivate));
	return pdfpc_application_type_id;
}

GType
pdfpc_application_get_type (void)
{
	static volatile gsize pdfpc_application_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_application_type_id__once)) {
		GType pdfpc_application_type_id;
		pdfpc_application_type_id = pdfpc_application_get_type_once ();
		g_once_init_leave (&pdfpc_application_type_id__once, pdfpc_application_type_id);
	}
	return pdfpc_application_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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;
}

