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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <poppler.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 PDFPC_VIEW_TYPE_PDF (pdfpc_view_pdf_get_type ())
#define PDFPC_VIEW_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdf))
#define PDFPC_VIEW_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdfClass))
#define PDFPC_VIEW_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_PDF))
#define PDFPC_VIEW_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_PDF))
#define PDFPC_VIEW_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdfClass))

typedef struct _pdfpcViewPdf pdfpcViewPdf;
typedef struct _pdfpcViewPdfClass pdfpcViewPdfClass;
typedef struct _pdfpcViewPdfPrivate pdfpcViewPdfPrivate;

#define PDFPC_RENDERER_TYPE_PDF (pdfpc_renderer_pdf_get_type ())
#define PDFPC_RENDERER_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdf))
#define PDFPC_RENDERER_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))
#define PDFPC_RENDERER_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))

typedef struct _pdfpcRendererPdf pdfpcRendererPdf;
typedef struct _pdfpcRendererPdfClass pdfpcRendererPdfClass;

#define PDFPC_VIEW_BEHAVIOUR_TYPE_BASE (pdfpc_view_behaviour_base_get_type ())
#define PDFPC_VIEW_BEHAVIOUR_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBase))
#define PDFPC_VIEW_BEHAVIOUR_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBaseClass))
#define PDFPC_VIEW_BEHAVIOUR_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE))
#define PDFPC_VIEW_BEHAVIOUR_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE))
#define PDFPC_VIEW_BEHAVIOUR_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBaseClass))

typedef struct _pdfpcViewBehaviourBase pdfpcViewBehaviourBase;
typedef struct _pdfpcViewBehaviourBaseClass pdfpcViewBehaviourBaseClass;

#define PDFPC_PRESENTATION_CONTROLLER_TYPE_SCALED_RECTANGLE (pdfpc_presentation_controller_scaled_rectangle_get_type ())
typedef struct _pdfpcPresentationControllerScaledRectangle pdfpcPresentationControllerScaledRectangle;
enum  {
	PDFPC_VIEW_PDF_0_PROPERTY,
	PDFPC_VIEW_PDF_N_SLIDES_PROPERTY,
	PDFPC_VIEW_PDF_NUM_PROPERTIES
};
static GParamSpec* pdfpc_view_pdf_properties[PDFPC_VIEW_PDF_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL)))
#define _pdfpc_presentation_controller_scaled_rectangle_free0(var) ((var == NULL) ? NULL : (var = (pdfpc_presentation_controller_scaled_rectangle_free (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;
typedef struct _Block9Data Block9Data;

#define PDFPC_RENDERER_TYPE_RENDER_ERROR (pdfpc_renderer_render_error_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

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

#define PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK (pdfpc_view_behaviour_pdf_link_get_type ())
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK, pdfpcViewBehaviourPdfLink))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK, pdfpcViewBehaviourPdfLinkClass))
#define PDFPC_VIEW_BEHAVIOUR_IS_PDF_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK))
#define PDFPC_VIEW_BEHAVIOUR_IS_PDF_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_PDF_LINK, pdfpcViewBehaviourPdfLinkClass))

typedef struct _pdfpcViewBehaviourPdfLink pdfpcViewBehaviourPdfLink;
typedef struct _pdfpcViewBehaviourPdfLinkClass pdfpcViewBehaviourPdfLinkClass;

#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_TYPE_CONTROLLABLE (pdfpc_controllable_get_type ())
#define PDFPC_CONTROLLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_CONTROLLABLE, pdfpcControllable))
#define PDFPC_IS_CONTROLLABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_CONTROLLABLE))
#define PDFPC_CONTROLLABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PDFPC_TYPE_CONTROLLABLE, pdfpcControllableIface))

typedef struct _pdfpcControllable pdfpcControllable;
typedef struct _pdfpcControllableIface pdfpcControllableIface;

#define PDFPC_VIEW_BEHAVIOUR_TYPE_ASSOCIATION_ERROR (pdfpc_view_behaviour_association_error_get_type ())

#define PDFPC_VIEW_TYPE_TRANSITION_MANAGER (pdfpc_view_transition_manager_get_type ())
#define PDFPC_VIEW_TRANSITION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_TRANSITION_MANAGER, pdfpcViewTransitionManager))
#define PDFPC_VIEW_TRANSITION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_TRANSITION_MANAGER, pdfpcViewTransitionManagerClass))
#define PDFPC_VIEW_IS_TRANSITION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_TRANSITION_MANAGER))
#define PDFPC_VIEW_IS_TRANSITION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_TRANSITION_MANAGER))
#define PDFPC_VIEW_TRANSITION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_TRANSITION_MANAGER, pdfpcViewTransitionManagerClass))

typedef struct _pdfpcViewTransitionManager pdfpcViewTransitionManager;
typedef struct _pdfpcViewTransitionManagerClass pdfpcViewTransitionManagerClass;
typedef struct _Block10Data Block10Data;
typedef struct _Block11Data Block11Data;
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
enum  {
	PDFPC_VIEW_PDF_LEAVING_SLIDE_SIGNAL,
	PDFPC_VIEW_PDF_ENTERING_SLIDE_SIGNAL,
	PDFPC_VIEW_PDF_FREEZE_TOGGLED_SIGNAL,
	PDFPC_VIEW_PDF_NUM_SIGNALS
};
static guint pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_NUM_SIGNALS] = {0};

struct _pdfpcPresentationControllerScaledRectangle {
	gdouble x;
	gdouble y;
	gdouble width;
	gdouble height;
};

struct _pdfpcViewPdf {
	GtkDrawingArea parent_instance;
	pdfpcViewPdfPrivate * priv;
	gboolean entering_slide_queued;
	pdfpcRendererPdf* renderer;
	gint current_slide_number;
	cairo_surface_t* current_slide;
	cairo_surface_t* buffer;
	gboolean disabled;
	gboolean user_slides;
	GList* behaviours;
	gint gdk_scale;
	gboolean notes_area;
	guint prerender_tid;
	guint transition_tid;
	gboolean transitions_enabled;
	pdfpcPresentationControllerScaledRectangle* zoom_area;
};

struct _pdfpcViewPdfClass {
	GtkDrawingAreaClass parent_class;
	gboolean (*prerender) (pdfpcViewPdf* self);
};

struct _Block9Data {
	int _ref_count_;
	pdfpcViewPdf* self;
	gint* p_slide;
	pdfpcMetadataPdf* metadata;
	gint first_page;
	gint last_slide;
	gint width;
	gint height;
};

typedef enum  {
	PDFPC_RENDERER_RENDER_ERROR_SLIDE_DOES_NOT_EXIST
} pdfpcRendererRenderError;
#define PDFPC_RENDERER_RENDER_ERROR pdfpc_renderer_render_error_quark ()

struct _pdfpcControllableIface {
	GTypeInterface parent_iface;
	pdfpcPresentationController* (*get_controller) (pdfpcControllable* self);
	void (*set_controller) (pdfpcControllable* self, pdfpcPresentationController* value);
	pdfpcViewPdf* (*get_main_view) (pdfpcControllable* self);
	void (*set_main_view) (pdfpcControllable* self, pdfpcViewPdf* value);
};

typedef enum  {
	PDFPC_VIEW_BEHAVIOUR_ASSOCIATION_ERROR_BEHAVIOUR_ALREADY_ASSOCIATED,
	PDFPC_VIEW_BEHAVIOUR_ASSOCIATION_ERROR_VIEW_NOT_SUPPORTED
} pdfpcViewBehaviourAssociationError;
#define PDFPC_VIEW_BEHAVIOUR_ASSOCIATION_ERROR pdfpc_view_behaviour_association_error_quark ()

struct _Block10Data {
	int _ref_count_;
	pdfpcViewPdf* self;
	pdfpcViewTransitionManager* transman;
};

struct _Block11Data {
	int _ref_count_;
	Block10Data * _data10_;
	cairo_t* buffer_cr;
};

static gpointer pdfpc_view_pdf_parent_class = NULL;
VALA_EXTERN gint pdfpc_options_prerender_slides;
VALA_EXTERN gint pdfpc_options_prerender_delay;

VALA_EXTERN GType pdfpc_view_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcViewPdf, g_object_unref)
VALA_EXTERN GType pdfpc_renderer_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcRendererPdf, g_object_unref)
VALA_EXTERN GType pdfpc_view_behaviour_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcViewBehaviourBase, g_object_unref)
VALA_EXTERN GType pdfpc_presentation_controller_scaled_rectangle_get_type (void) G_GNUC_CONST ;
VALA_EXTERN pdfpcPresentationControllerScaledRectangle* pdfpc_presentation_controller_scaled_rectangle_dup (const pdfpcPresentationControllerScaledRectangle* self);
VALA_EXTERN void pdfpc_presentation_controller_scaled_rectangle_free (pdfpcPresentationControllerScaledRectangle* self);
VALA_EXTERN gboolean pdfpc_view_pdf_prerender (pdfpcViewPdf* self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
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_view_pdf_get_metadata (pdfpcViewPdf* self);
VALA_EXTERN pdfpcMetadataPdf* pdfpc_renderer_pdf_get_metadata (pdfpcRendererPdf* self);
static gboolean pdfpc_view_pdf_real_prerender (pdfpcViewPdf* self);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
VALA_EXTERN gint pdfpc_metadata_pdf_nearest_nonhidden (pdfpcMetadataPdf* self,
                                           gint slide_number,
                                           gboolean backwards);
VALA_EXTERN gint pdfpc_view_pdf_get_n_slides (pdfpcViewPdf* self);
VALA_EXTERN gint pdfpc_metadata_pdf_real_slide_to_user_slide (pdfpcMetadataPdf* self,
                                                  gint number);
VALA_EXTERN gint pdfpc_metadata_pdf_get_user_slide_count (pdfpcMetadataPdf* self);
VALA_EXTERN gint pdfpc_metadata_pdf_user_slide_to_real_slide (pdfpcMetadataPdf* self,
                                                  gint number,
                                                  gboolean lastSlide);
VALA_EXTERN void pdfpc_view_pdf_get_pixel_dimensions (pdfpcViewPdf* self,
                                          gint* width,
                                          gint* height);
static gboolean __lambda11_ (Block9Data* _data9_);
VALA_EXTERN gboolean pdfpc_metadata_pdf_is_user_slide (pdfpcMetadataPdf* self,
                                           gint number);
VALA_EXTERN GQuark pdfpc_renderer_render_error_quark (void);
VALA_EXTERN GType pdfpc_renderer_render_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN cairo_surface_t* pdfpc_renderer_pdf_render (pdfpcRendererPdf* self,
                                            gint slide_number,
                                            gboolean notes_area,
                                            gint width,
                                            gint height,
                                            gboolean force_cache,
                                            gboolean permanent_cache,
                                            pdfpcPresentationControllerScaledRectangle* zoom_area,
                                            GError** error);
static gboolean ___lambda11__gsource_func (gpointer self);
VALA_EXTERN GType pdfpc_presentation_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcPresentationController, g_object_unref)
VALA_EXTERN pdfpcViewPdf* pdfpc_view_pdf_new (pdfpcRendererPdf* renderer,
                                  gboolean notes_area,
                                  gboolean clickable_links,
                                  pdfpcPresentationController* controller,
                                  gint gdk_scale_factor,
                                  gboolean user_slides);
VALA_EXTERN pdfpcViewPdf* pdfpc_view_pdf_construct (GType object_type,
                                        pdfpcRendererPdf* renderer,
                                        gboolean notes_area,
                                        gboolean clickable_links,
                                        pdfpcPresentationController* controller,
                                        gint gdk_scale_factor,
                                        gboolean user_slides);
VALA_EXTERN void pdfpc_view_pdf_associate_behaviour (pdfpcViewPdf* self,
                                         pdfpcViewBehaviourBase* behaviour);
VALA_EXTERN pdfpcViewBehaviourPdfLink* pdfpc_view_behaviour_pdf_link_new (void);
VALA_EXTERN pdfpcViewBehaviourPdfLink* pdfpc_view_behaviour_pdf_link_construct (GType object_type);
VALA_EXTERN GType pdfpc_view_behaviour_pdf_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcViewBehaviourPdfLink, g_object_unref)
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 pdfpcViewPdf* pdfpc_view_pdf_new_from_controllable_window (pdfpcWindowControllableWindow* window,
                                                           gboolean notes_area,
                                                           gboolean clickable_links,
                                                           gboolean user_slides);
VALA_EXTERN pdfpcViewPdf* pdfpc_view_pdf_construct_from_controllable_window (GType object_type,
                                                                 pdfpcWindowControllableWindow* window,
                                                                 gboolean notes_area,
                                                                 gboolean clickable_links,
                                                                 gboolean user_slides);
VALA_EXTERN GType pdfpc_controllable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcControllable, g_object_unref)
VALA_EXTERN pdfpcPresentationController* pdfpc_controllable_get_controller (pdfpcControllable* self);
VALA_EXTERN pdfpcMetadataPdf* pdfpc_presentation_controller_get_metadata (pdfpcPresentationController* self);
VALA_EXTERN pdfpcRendererPdf* pdfpc_metadata_pdf_get_renderer (pdfpcMetadataPdf* self);
VALA_EXTERN gint pdfpc_window_fullscreen_get_gdk_scale (pdfpcWindowFullscreen* self);
VALA_EXTERN void pdfpc_view_pdf_convert_poppler_rectangle_to_gdk_rectangle (pdfpcViewPdf* self,
                                                                PopplerRectangle* poppler_rectangle,
                                                                GdkRectangle* result);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_page_width (pdfpcMetadataPdf* self);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_page_height (pdfpcMetadataPdf* self);
VALA_EXTERN GQuark pdfpc_view_behaviour_association_error_quark (void);
VALA_EXTERN GType pdfpc_view_behaviour_association_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void pdfpc_view_behaviour_base_associate (pdfpcViewBehaviourBase* self,
                                          pdfpcViewPdf* target,
                                          GError** error);
VALA_EXTERN void pdfpc_view_pdf_display (pdfpcViewPdf* self,
                             gint slide_number,
                             gboolean force,
                             pdfpcPresentationControllerScaledRectangle* rect);
VALA_EXTERN GType pdfpc_view_transition_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcViewTransitionManager, g_object_unref)
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static gboolean _pdfpc_view_pdf_prerender_gsource_func (gpointer self);
VALA_EXTERN cairo_surface_t* pdfpc_renderer_pdf_fade_to_black (pdfpcRendererPdf* self,
                                                   gint width,
                                                   gint height);
VALA_EXTERN pdfpcViewTransitionManager* pdfpc_view_transition_manager_new (pdfpcMetadataPdf* metadata,
                                                               gint slide_number,
                                                               cairo_surface_t* prev,
                                                               cairo_surface_t* next,
                                                               gboolean inverse);
VALA_EXTERN pdfpcViewTransitionManager* pdfpc_view_transition_manager_construct (GType object_type,
                                                                     pdfpcMetadataPdf* metadata,
                                                                     gint slide_number,
                                                                     cairo_surface_t* prev,
                                                                     cairo_surface_t* next,
                                                                     gboolean inverse);
VALA_EXTERN gboolean pdfpc_view_transition_manager_get_is_enabled (pdfpcViewTransitionManager* self);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
VALA_EXTERN guint pdfpc_view_transition_manager_get_frame_duration (pdfpcViewTransitionManager* self);
static gboolean ____lambda13_ (Block11Data* _data11_);
VALA_EXTERN gboolean pdfpc_view_transition_manager_advance (pdfpcViewTransitionManager* self);
VALA_EXTERN void pdfpc_view_transition_manager_draw_frame (pdfpcViewTransitionManager* self,
                                               cairo_t* cr);
static gboolean _____lambda13__gsource_func (gpointer self);
VALA_EXTERN void pdfpc_view_pdf_invalidate (pdfpcViewPdf* self);
static gboolean pdfpc_view_pdf_real_draw (GtkWidget* base,
                                   cairo_t* cr);
VALA_EXTERN guint pdfpc_metadata_pdf_get_slide_count (pdfpcMetadataPdf* self);
static void g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure,
                                            GValue * return_value,
                                            guint n_param_values,
                                            const GValue * param_values,
                                            gpointer invocation_hint,
                                            gpointer marshal_data);
static void pdfpc_view_pdf_finalize (GObject * obj);
static GType pdfpc_view_pdf_get_type_once (void);
static void _vala_pdfpc_view_pdf_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

/**
         * Return the metadata object
         */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

pdfpcMetadataPdf*
pdfpc_view_pdf_get_metadata (pdfpcViewPdf* self)
{
	pdfpcRendererPdf* _tmp0_;
	pdfpcMetadataPdf* _tmp1_;
	pdfpcMetadataPdf* _tmp2_;
	pdfpcMetadataPdf* _tmp3_;
	pdfpcMetadataPdf* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->renderer;
	_tmp1_ = pdfpc_renderer_pdf_get_metadata (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

/**
         * Launch pre-rendering
         */
static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		pdfpcViewPdf* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->metadata);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static gboolean
__lambda11_ (Block9Data* _data9_)
{
	pdfpcViewPdf* self;
	gint* _tmp0_;
	gboolean _tmp3_ = FALSE;
	gint* _tmp15_;
	gint* _tmp16_;
	gint* _tmp17_;
	pdfpcMetadataPdf* _tmp18_;
	gint* _tmp19_;
	gint* _tmp20_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = _data9_->self;
	_tmp0_ = _data9_->p_slide;
	if (_tmp0_ == NULL) {
		void* _tmp1_;
		gint* _tmp2_;
		_tmp1_ = g_malloc ((gsize) sizeof (gint));
		_data9_->p_slide = _tmp1_;
		_tmp2_ = _data9_->p_slide;
		*_tmp2_ = _data9_->first_page;
	}
	if (!self->user_slides) {
		_tmp3_ = TRUE;
	} else {
		pdfpcMetadataPdf* _tmp4_;
		gint* _tmp5_;
		_tmp4_ = _data9_->metadata;
		_tmp5_ = _data9_->p_slide;
		_tmp3_ = pdfpc_metadata_pdf_is_user_slide (_tmp4_, *_tmp5_);
	}
	if (_tmp3_) {
		{
			pdfpcRendererPdf* _tmp6_;
			gint* _tmp7_;
			cairo_surface_t* _tmp8_;
			cairo_surface_t* _tmp9_;
			_tmp6_ = self->renderer;
			_tmp7_ = _data9_->p_slide;
			_tmp8_ = pdfpc_renderer_pdf_render (_tmp6_, *_tmp7_, self->notes_area, _data9_->width, _data9_->height, TRUE, FALSE, NULL, &_inner_error0_);
			_tmp9_ = _tmp8_;
			_cairo_surface_destroy0 (_tmp9_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gboolean _tmp10_ = FALSE;
				if (_inner_error0_->domain == PDFPC_RENDERER_RENDER_ERROR) {
					goto __catch0_pdfpc_renderer_render_error;
				}
				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 _tmp10_;
			}
		}
		goto __finally0;
		__catch0_pdfpc_renderer_render_error:
		{
			GError* e = NULL;
			gint* _tmp11_;
			GError* _tmp12_;
			const gchar* _tmp13_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp11_ = _data9_->p_slide;
			_tmp12_ = e;
			_tmp13_ = _tmp12_->message;
			g_printerr ("Could pre-render page '%i': %s\n", *_tmp11_, _tmp13_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp14_ = FALSE;
			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 _tmp14_;
		}
	}
	_tmp15_ = _data9_->p_slide;
	_tmp16_ = _data9_->p_slide;
	*_tmp15_ = (*_tmp16_) + 1;
	_tmp17_ = _data9_->p_slide;
	_tmp18_ = _data9_->metadata;
	_tmp19_ = _data9_->p_slide;
	*_tmp17_ = pdfpc_metadata_pdf_nearest_nonhidden (_tmp18_, *_tmp19_, FALSE);
	_tmp20_ = _data9_->p_slide;
	if ((*_tmp20_) > _data9_->last_slide) {
		gint* _tmp21_;
		_tmp21_ = _data9_->p_slide;
		g_free (_tmp21_);
		result = G_SOURCE_REMOVE;
		return result;
	} else {
		result = G_SOURCE_CONTINUE;
		return result;
	}
}

static gboolean
___lambda11__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda11_ (self);
	return result;
}

static gboolean
pdfpc_view_pdf_real_prerender (pdfpcViewPdf* self)
{
	Block9Data* _data9_;
	pdfpcMetadataPdf* _tmp0_;
	pdfpcMetadataPdf* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp15_ = 0;
	gint _tmp16_ = 0;
	gboolean result;
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	self->prerender_tid = (guint) 0;
	if (self->disabled) {
		result = G_SOURCE_REMOVE;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	_data9_->p_slide = NULL;
	_tmp0_ = pdfpc_view_pdf_get_metadata (self);
	_data9_->metadata = _tmp0_;
	_data9_->first_page = self->current_slide_number + 1;
	_tmp1_ = _data9_->metadata;
	_data9_->first_page = pdfpc_metadata_pdf_nearest_nonhidden (_tmp1_, _data9_->first_page, FALSE);
	_tmp2_ = pdfpc_view_pdf_get_n_slides (self);
	_tmp3_ = _tmp2_;
	if (_data9_->first_page >= _tmp3_) {
		result = G_SOURCE_REMOVE;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	if (pdfpc_options_prerender_slides < 0) {
		gint _tmp4_;
		gint _tmp5_;
		_tmp4_ = pdfpc_view_pdf_get_n_slides (self);
		_tmp5_ = _tmp4_;
		_data9_->last_slide = _tmp5_ - 1;
	} else {
		if (self->user_slides) {
			gint user_slide = 0;
			pdfpcMetadataPdf* _tmp6_;
			gint last_user_slide = 0;
			pdfpcMetadataPdf* _tmp7_;
			_tmp6_ = _data9_->metadata;
			user_slide = pdfpc_metadata_pdf_real_slide_to_user_slide (_tmp6_, self->current_slide_number);
			last_user_slide = user_slide + pdfpc_options_prerender_slides;
			_tmp7_ = _data9_->metadata;
			if (last_user_slide < pdfpc_metadata_pdf_get_user_slide_count (_tmp7_)) {
				pdfpcMetadataPdf* _tmp8_;
				_tmp8_ = _data9_->metadata;
				_data9_->last_slide = pdfpc_metadata_pdf_user_slide_to_real_slide (_tmp8_, last_user_slide, TRUE);
			} else {
				gint _tmp9_;
				gint _tmp10_;
				_tmp9_ = pdfpc_view_pdf_get_n_slides (self);
				_tmp10_ = _tmp9_;
				_data9_->last_slide = _tmp10_ - 1;
			}
		} else {
			gint _tmp11_;
			gint _tmp12_;
			_data9_->last_slide = self->current_slide_number + pdfpc_options_prerender_slides;
			_tmp11_ = pdfpc_view_pdf_get_n_slides (self);
			_tmp12_ = _tmp11_;
			if (_data9_->last_slide >= _tmp12_) {
				gint _tmp13_;
				gint _tmp14_;
				_tmp13_ = pdfpc_view_pdf_get_n_slides (self);
				_tmp14_ = _tmp13_;
				_data9_->last_slide = _tmp14_ - 1;
			}
		}
	}
	pdfpc_view_pdf_get_pixel_dimensions (self, &_tmp15_, &_tmp16_);
	_data9_->width = _tmp15_;
	_data9_->height = _tmp16_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda11__gsource_func, block9_data_ref (_data9_), block9_data_unref);
	result = G_SOURCE_REMOVE;
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return result;
}

gboolean
pdfpc_view_pdf_prerender (pdfpcViewPdf* self)
{
	pdfpcViewPdfClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = PDFPC_VIEW_PDF_GET_CLASS (self);
	if (_klass_->prerender) {
		return _klass_->prerender (self);
	}
	return FALSE;
}

/**
         * Default constructor restricted to Pdf renderers as input parameter
         */
pdfpcViewPdf*
pdfpc_view_pdf_construct (GType object_type,
                          pdfpcRendererPdf* renderer,
                          gboolean notes_area,
                          gboolean clickable_links,
                          pdfpcPresentationController* controller,
                          gint gdk_scale_factor,
                          gboolean user_slides)
{
	pdfpcViewPdf * self = NULL;
	pdfpcRendererPdf* _tmp0_;
	g_return_val_if_fail (renderer != NULL, NULL);
	g_return_val_if_fail (controller != NULL, NULL);
	self = (pdfpcViewPdf*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (renderer);
	_g_object_unref0 (self->renderer);
	self->renderer = _tmp0_;
	self->gdk_scale = gdk_scale_factor;
	self->notes_area = notes_area;
	self->user_slides = user_slides;
	self->current_slide_number = -1;
	gtk_widget_add_events ((GtkWidget*) self, (gint) GDK_STRUCTURE_MASK);
	if (clickable_links) {
		pdfpcViewBehaviourPdfLink* _tmp1_;
		pdfpcViewBehaviourPdfLink* _tmp2_;
		_tmp1_ = pdfpc_view_behaviour_pdf_link_new ();
		_tmp2_ = _tmp1_;
		pdfpc_view_pdf_associate_behaviour (self, (pdfpcViewBehaviourBase*) _tmp2_);
		_g_object_unref0 (_tmp2_);
	}
	return self;
}

pdfpcViewPdf*
pdfpc_view_pdf_new (pdfpcRendererPdf* renderer,
                    gboolean notes_area,
                    gboolean clickable_links,
                    pdfpcPresentationController* controller,
                    gint gdk_scale_factor,
                    gboolean user_slides)
{
	return pdfpc_view_pdf_construct (PDFPC_VIEW_TYPE_PDF, renderer, notes_area, clickable_links, controller, gdk_scale_factor, user_slides);
}

/**
         * Create a new Pdf view from a ControllableWindow instance
         *
         * This is a convenience constructor which automatically creates a full
         * metadata and rendering chain to be used with the pdf view.
         */
pdfpcViewPdf*
pdfpc_view_pdf_construct_from_controllable_window (GType object_type,
                                                   pdfpcWindowControllableWindow* window,
                                                   gboolean notes_area,
                                                   gboolean clickable_links,
                                                   gboolean user_slides)
{
	pdfpcViewPdf * self = NULL;
	pdfpcPresentationController* controller = NULL;
	pdfpcPresentationController* _tmp0_;
	pdfpcPresentationController* _tmp1_;
	pdfpcPresentationController* _tmp2_;
	pdfpcMetadataPdf* metadata = NULL;
	pdfpcMetadataPdf* _tmp3_;
	pdfpcMetadataPdf* _tmp4_;
	pdfpcMetadataPdf* _tmp5_;
	pdfpcRendererPdf* renderer = NULL;
	pdfpcRendererPdf* _tmp6_;
	pdfpcRendererPdf* _tmp7_;
	pdfpcRendererPdf* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	g_return_val_if_fail (window != NULL, NULL);
	_tmp0_ = pdfpc_controllable_get_controller ((pdfpcControllable*) window);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	controller = _tmp2_;
	_tmp3_ = pdfpc_presentation_controller_get_metadata (controller);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	metadata = _tmp5_;
	_tmp6_ = pdfpc_metadata_pdf_get_renderer (metadata);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	renderer = _tmp8_;
	_tmp9_ = pdfpc_window_fullscreen_get_gdk_scale ((pdfpcWindowFullscreen*) window);
	_tmp10_ = _tmp9_;
	self = (pdfpcViewPdf*) pdfpc_view_pdf_construct (object_type, renderer, notes_area, clickable_links, controller, _tmp10_, user_slides);
	_g_object_unref0 (renderer);
	_g_object_unref0 (metadata);
	_g_object_unref0 (controller);
	return self;
}

pdfpcViewPdf*
pdfpc_view_pdf_new_from_controllable_window (pdfpcWindowControllableWindow* window,
                                             gboolean notes_area,
                                             gboolean clickable_links,
                                             gboolean user_slides)
{
	return pdfpc_view_pdf_construct_from_controllable_window (PDFPC_VIEW_TYPE_PDF, window, notes_area, clickable_links, user_slides);
}

/**
         * Convert an arbitrary Poppler.Rectangle struct into a Gdk.Rectangle
         * struct taking into account the measurement differences between pdf
         * space and screen space.
         */
void
pdfpc_view_pdf_convert_poppler_rectangle_to_gdk_rectangle (pdfpcViewPdf* self,
                                                           PopplerRectangle* poppler_rectangle,
                                                           GdkRectangle* result)
{
	GdkRectangle gdk_rectangle = {0};
	GtkAllocation allocation = {0};
	GtkAllocation _tmp0_ = {0};
	pdfpcMetadataPdf* metadata = NULL;
	pdfpcMetadataPdf* _tmp1_;
	PopplerRectangle _tmp2_;
	GtkAllocation _tmp3_;
	PopplerRectangle _tmp4_;
	PopplerRectangle _tmp5_;
	GtkAllocation _tmp6_;
	PopplerRectangle _tmp7_;
	GtkAllocation _tmp8_;
	PopplerRectangle _tmp9_;
	PopplerRectangle _tmp10_;
	GtkAllocation _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (poppler_rectangle != NULL);
	memset (&gdk_rectangle, 0, sizeof (GdkRectangle));
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
	allocation = _tmp0_;
	_tmp1_ = pdfpc_view_pdf_get_metadata (self);
	metadata = _tmp1_;
	_tmp2_ = *poppler_rectangle;
	_tmp3_ = allocation;
	gdk_rectangle.x = (gint) ceil ((_tmp2_.x1 / pdfpc_metadata_pdf_get_page_width (metadata)) * _tmp3_.width);
	_tmp4_ = *poppler_rectangle;
	_tmp5_ = *poppler_rectangle;
	_tmp6_ = allocation;
	gdk_rectangle.width = (gint) floor (((_tmp4_.x2 - _tmp5_.x1) / pdfpc_metadata_pdf_get_page_width (metadata)) * _tmp6_.width);
	_tmp7_ = *poppler_rectangle;
	_tmp8_ = allocation;
	gdk_rectangle.y = (gint) ceil (((pdfpc_metadata_pdf_get_page_height (metadata) - _tmp7_.y2) / pdfpc_metadata_pdf_get_page_height (metadata)) * _tmp8_.height);
	_tmp9_ = *poppler_rectangle;
	_tmp10_ = *poppler_rectangle;
	_tmp11_ = allocation;
	gdk_rectangle.height = (gint) floor (((_tmp9_.y2 - _tmp10_.y1) / pdfpc_metadata_pdf_get_page_height (metadata)) * _tmp11_.height);
	*result = gdk_rectangle;
	_g_object_unref0 (metadata);
	return;
}

/**
         * Associate a new Behaviour with this View
         *
         * The implementation supports an arbitrary amount of different
         * behaviours.
         */
void
pdfpc_view_pdf_associate_behaviour (pdfpcViewPdf* self,
                                    pdfpcViewBehaviourBase* behaviour)
{
	pdfpcViewBehaviourBase* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (behaviour != NULL);
	_tmp0_ = _g_object_ref0 (behaviour);
	self->behaviours = g_list_append (self->behaviours, _tmp0_);
	{
		pdfpc_view_behaviour_base_associate (behaviour, self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == PDFPC_VIEW_BEHAVIOUR_ASSOCIATION_ERROR) {
				goto __catch0_pdfpc_view_behaviour_association_error;
			}
			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;
		}
	}
	goto __finally0;
	__catch0_pdfpc_view_behaviour_association_error:
	{
		GError* e = NULL;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e->message;
		g_printerr ("Behaviour association failure: %s\n", _tmp1_);
		exit (1);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

/**
         * Display a specific slide number, optionally zooming in a
         * rectangular area
         */
static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		pdfpcViewPdf* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->transman);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static gpointer
_pdfpc_presentation_controller_scaled_rectangle_dup0 (gpointer self)
{
	return self ? pdfpc_presentation_controller_scaled_rectangle_dup (self) : NULL;
}

static gpointer
_cairo_surface_reference0 (gpointer self)
{
	return self ? cairo_surface_reference (self) : NULL;
}

static gboolean
_pdfpc_view_pdf_prerender_gsource_func (gpointer self)
{
	gboolean result;
	result = pdfpc_view_pdf_prerender ((pdfpcViewPdf*) self);
	return result;
}

static Block11Data*
block11_data_ref (Block11Data* _data11_)
{
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		pdfpcViewPdf* self;
		self = _data11_->_data10_->self;
		_cairo_destroy0 (_data11_->buffer_cr);
		block10_data_unref (_data11_->_data10_);
		_data11_->_data10_ = NULL;
		g_slice_free (Block11Data, _data11_);
	}
}

static gboolean
____lambda13_ (Block11Data* _data11_)
{
	Block10Data* _data10_;
	pdfpcViewPdf* self;
	gboolean inprogress = FALSE;
	pdfpcViewTransitionManager* _tmp0_;
	cairo_t* _tmp1_;
	pdfpcViewTransitionManager* _tmp2_;
	cairo_t* _tmp3_;
	gboolean result;
	_data10_ = _data11_->_data10_;
	self = _data10_->self;
	_tmp0_ = _data10_->transman;
	inprogress = pdfpc_view_transition_manager_advance (_tmp0_);
	_tmp1_ = _data11_->buffer_cr;
	cairo_reset_clip (_tmp1_);
	_tmp2_ = _data10_->transman;
	_tmp3_ = _data11_->buffer_cr;
	pdfpc_view_transition_manager_draw_frame (_tmp2_, _tmp3_);
	if (!inprogress) {
		self->entering_slide_queued = TRUE;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	if (inprogress) {
		result = TRUE;
		return result;
	} else {
		self->transition_tid = (guint) 0;
		result = FALSE;
		return result;
	}
}

static gboolean
_____lambda13__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda13_ (self);
	return result;
}

void
pdfpc_view_pdf_display (pdfpcViewPdf* self,
                        gint slide_number,
                        gboolean force,
                        pdfpcPresentationControllerScaledRectangle* rect)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = pdfpc_view_pdf_get_n_slides (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == 0) {
		return;
	}
	if (self->current_slide_number != slide_number) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = force;
	}
	if (_tmp2_) {
		Block10Data* _data10_;
		gint width = 0;
		gint height = 0;
		gint _tmp3_ = 0;
		gint _tmp4_ = 0;
		gboolean _tmp5_ = FALSE;
		pdfpcMetadataPdf* metadata = NULL;
		pdfpcMetadataPdf* _tmp6_;
		gboolean trans_inverse = FALSE;
		gboolean sequential_move = FALSE;
		pdfpcMetadataPdf* _tmp7_;
		gint trans_slide_number = 0;
		pdfpcPresentationControllerScaledRectangle* _tmp9_;
		cairo_surface_t* previous_slide = NULL;
		cairo_surface_t* _tmp10_;
		cairo_surface_t* _tmp11_;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_ = FALSE;
		gboolean _tmp26_ = FALSE;
		gboolean _tmp32_ = FALSE;
		pdfpcViewTransitionManager* _tmp33_;
		_data10_ = g_slice_new0 (Block10Data);
		_data10_->_ref_count_ = 1;
		_data10_->self = g_object_ref (self);
		pdfpc_view_pdf_get_pixel_dimensions (self, &_tmp3_, &_tmp4_);
		width = _tmp3_;
		height = _tmp4_;
		if (height <= 1) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = width <= 1;
		}
		if (_tmp5_) {
			block10_data_unref (_data10_);
			_data10_ = NULL;
			return;
		}
		_tmp6_ = pdfpc_view_pdf_get_metadata (self);
		metadata = _tmp6_;
		trans_inverse = FALSE;
		sequential_move = FALSE;
		_tmp7_ = metadata;
		if (slide_number == pdfpc_metadata_pdf_nearest_nonhidden (_tmp7_, self->current_slide_number + 1, FALSE)) {
			sequential_move = TRUE;
		} else {
			pdfpcMetadataPdf* _tmp8_;
			_tmp8_ = metadata;
			if (slide_number == pdfpc_metadata_pdf_nearest_nonhidden (_tmp8_, self->current_slide_number - 1, TRUE)) {
				sequential_move = TRUE;
				trans_inverse = TRUE;
			}
		}
		if (trans_inverse) {
			trans_slide_number = self->current_slide_number;
		} else {
			trans_slide_number = slide_number;
		}
		g_signal_emit (self, pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_LEAVING_SLIDE_SIGNAL], 0, self->current_slide_number, slide_number);
		self->current_slide_number = slide_number;
		_tmp9_ = _pdfpc_presentation_controller_scaled_rectangle_dup0 (rect);
		_pdfpc_presentation_controller_scaled_rectangle_free0 (self->zoom_area);
		self->zoom_area = _tmp9_;
		if (self->transition_tid != ((guint) 0)) {
			g_source_remove (self->transition_tid);
			self->transition_tid = (guint) 0;
		}
		_tmp10_ = self->current_slide;
		_tmp11_ = _cairo_surface_reference0 (_tmp10_);
		previous_slide = _tmp11_;
		{
			gboolean _tmp12_ = FALSE;
			gint _tmp13_;
			gint _tmp14_;
			_tmp13_ = pdfpc_view_pdf_get_n_slides (self);
			_tmp14_ = _tmp13_;
			if (self->current_slide_number < _tmp14_) {
				_tmp12_ = !self->disabled;
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				cairo_surface_t* _tmp15_ = NULL;
				pdfpcRendererPdf* _tmp16_;
				pdfpcPresentationControllerScaledRectangle* _tmp17_;
				cairo_surface_t* _tmp18_;
				cairo_surface_t* _tmp19_;
				_tmp16_ = self->renderer;
				_tmp17_ = self->zoom_area;
				_tmp18_ = pdfpc_renderer_pdf_render (_tmp16_, self->current_slide_number, self->notes_area, width, height, FALSE, FALSE, _tmp17_, &_inner_error0_);
				_tmp15_ = _tmp18_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == PDFPC_RENDERER_RENDER_ERROR) {
						goto __catch0_pdfpc_renderer_render_error;
					}
					_cairo_surface_destroy0 (previous_slide);
					_g_object_unref0 (metadata);
					block10_data_unref (_data10_);
					_data10_ = NULL;
					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;
				}
				_tmp19_ = _tmp15_;
				_tmp15_ = NULL;
				_cairo_surface_destroy0 (self->current_slide);
				self->current_slide = _tmp19_;
				if (pdfpc_options_prerender_slides != 0) {
					if (self->prerender_tid != ((guint) 0)) {
						g_source_remove (self->prerender_tid);
					}
					self->prerender_tid = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) (1000 * pdfpc_options_prerender_delay), _pdfpc_view_pdf_prerender_gsource_func, g_object_ref (self), g_object_unref);
				}
				_cairo_surface_destroy0 (_tmp15_);
			} else {
				pdfpcRendererPdf* _tmp20_;
				cairo_surface_t* _tmp21_;
				_tmp20_ = self->renderer;
				_tmp21_ = pdfpc_renderer_pdf_fade_to_black (_tmp20_, width, height);
				_cairo_surface_destroy0 (self->current_slide);
				self->current_slide = _tmp21_;
			}
		}
		goto __finally0;
		__catch0_pdfpc_renderer_render_error:
		{
			GError* e = NULL;
			GError* _tmp22_;
			const gchar* _tmp23_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp22_ = e;
			_tmp23_ = _tmp22_->message;
			g_printerr ("The pdf page %d could not be rendered: %s\n", self->current_slide_number, _tmp23_);
			_g_error_free0 (e);
			_cairo_surface_destroy0 (previous_slide);
			_g_object_unref0 (metadata);
			block10_data_unref (_data10_);
			_data10_ = NULL;
			return;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_cairo_surface_destroy0 (previous_slide);
			_g_object_unref0 (metadata);
			block10_data_unref (_data10_);
			_data10_ = NULL;
			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;
		}
		_data10_->transman = NULL;
		if (!self->disabled) {
			_tmp26_ = self->transitions_enabled;
		} else {
			_tmp26_ = FALSE;
		}
		if (_tmp26_) {
			_tmp25_ = sequential_move;
		} else {
			_tmp25_ = FALSE;
		}
		if (_tmp25_) {
			cairo_surface_t* _tmp27_;
			_tmp27_ = previous_slide;
			_tmp24_ = _tmp27_ != NULL;
		} else {
			_tmp24_ = FALSE;
		}
		if (_tmp24_) {
			pdfpcMetadataPdf* _tmp28_;
			cairo_surface_t* _tmp29_;
			cairo_surface_t* _tmp30_;
			pdfpcViewTransitionManager* _tmp31_;
			_tmp28_ = metadata;
			_tmp29_ = previous_slide;
			_tmp30_ = self->current_slide;
			_tmp31_ = pdfpc_view_transition_manager_new (_tmp28_, trans_slide_number, _tmp29_, _tmp30_, trans_inverse);
			_g_object_unref0 (_data10_->transman);
			_data10_->transman = _tmp31_;
		}
		_tmp33_ = _data10_->transman;
		if (_tmp33_ == NULL) {
			_tmp32_ = TRUE;
		} else {
			pdfpcViewTransitionManager* _tmp34_;
			gboolean _tmp35_;
			gboolean _tmp36_;
			_tmp34_ = _data10_->transman;
			_tmp35_ = pdfpc_view_transition_manager_get_is_enabled (_tmp34_);
			_tmp36_ = _tmp35_;
			_tmp32_ = !_tmp36_;
		}
		if (_tmp32_) {
			cairo_surface_t* _tmp37_;
			cairo_surface_t* _tmp38_;
			_tmp37_ = self->current_slide;
			_tmp38_ = _cairo_surface_reference0 (_tmp37_);
			_cairo_surface_destroy0 (self->buffer);
			self->buffer = _tmp38_;
			self->entering_slide_queued = TRUE;
			gtk_widget_queue_draw ((GtkWidget*) self);
		} else {
			Block11Data* _data11_;
			cairo_surface_t* _tmp39_;
			cairo_surface_t* _tmp40_;
			cairo_t* _tmp41_;
			guint delay = 0U;
			pdfpcViewTransitionManager* _tmp42_;
			guint _tmp43_;
			guint _tmp44_;
			_data11_ = g_slice_new0 (Block11Data);
			_data11_->_ref_count_ = 1;
			_data11_->_data10_ = block10_data_ref (_data10_);
			_tmp39_ = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
			_cairo_surface_destroy0 (self->buffer);
			self->buffer = _tmp39_;
			_tmp40_ = self->buffer;
			_tmp41_ = cairo_create (_tmp40_);
			_data11_->buffer_cr = _tmp41_;
			_tmp42_ = _data10_->transman;
			_tmp43_ = pdfpc_view_transition_manager_get_frame_duration (_tmp42_);
			_tmp44_ = _tmp43_;
			delay = _tmp44_;
			self->transition_tid = g_timeout_add_full (G_PRIORITY_HIGH, delay, _____lambda13__gsource_func, block11_data_ref (_data11_), block11_data_unref);
			block11_data_unref (_data11_);
			_data11_ = NULL;
		}
		_cairo_surface_destroy0 (previous_slide);
		_g_object_unref0 (metadata);
		block10_data_unref (_data10_);
		_data10_ = NULL;
	}
}

/**
         * Invalidate the current slide, forcing redrawing on update
         */
void
pdfpc_view_pdf_invalidate (pdfpcViewPdf* self)
{
	g_return_if_fail (self != NULL);
	self->current_slide_number = -1;
	_cairo_surface_destroy0 (self->current_slide);
	self->current_slide = NULL;
}

/**
         * Return pixel dimensions of the widget
         */
void
pdfpc_view_pdf_get_pixel_dimensions (pdfpcViewPdf* self,
                                     gint* width,
                                     gint* height)
{
	gint _vala_width = 0;
	gint _vala_height = 0;
	GtkAllocation allocation = {0};
	GtkAllocation _tmp0_ = {0};
	GtkAllocation _tmp1_;
	GtkAllocation _tmp2_;
	g_return_if_fail (self != NULL);
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
	allocation = _tmp0_;
	_tmp1_ = allocation;
	_vala_width = _tmp1_.width * self->gdk_scale;
	_tmp2_ = allocation;
	_vala_height = _tmp2_.height * self->gdk_scale;
	if (width) {
		*width = _vala_width;
	}
	if (height) {
		*height = _vala_height;
	}
}

/**
         * This method is called by Gdk every time the widget needs to be redrawn.
         *
         * The implementation does a simple blit from the internal pixmap to
         * the window surface.
         */
static gboolean
pdfpc_view_pdf_real_draw (GtkWidget* base,
                          cairo_t* cr)
{
	pdfpcViewPdf * self;
	cairo_surface_t* _tmp0_;
	gint width = 0;
	gint height = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gboolean _tmp3_ = FALSE;
	cairo_surface_t* _tmp4_;
	cairo_surface_t* _tmp13_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = (pdfpcViewPdf*) base;
	g_return_val_if_fail (cr != NULL, FALSE);
	_tmp0_ = self->buffer;
	if (_tmp0_ == NULL) {
		result = TRUE;
		return result;
	}
	pdfpc_view_pdf_get_pixel_dimensions (self, &_tmp1_, &_tmp2_);
	width = _tmp1_;
	height = _tmp2_;
	_tmp4_ = self->buffer;
	if (width != cairo_image_surface_get_width (_tmp4_)) {
		_tmp3_ = TRUE;
	} else {
		cairo_surface_t* _tmp5_;
		_tmp5_ = self->buffer;
		_tmp3_ = height != cairo_image_surface_get_height (_tmp5_);
	}
	if (_tmp3_) {
		{
			cairo_surface_t* _tmp6_ = NULL;
			pdfpcRendererPdf* _tmp7_;
			pdfpcPresentationControllerScaledRectangle* _tmp8_;
			cairo_surface_t* _tmp9_;
			cairo_surface_t* _tmp11_;
			_tmp7_ = self->renderer;
			_tmp8_ = self->zoom_area;
			_tmp9_ = pdfpc_renderer_pdf_render (_tmp7_, self->current_slide_number, self->notes_area, width, height, FALSE, FALSE, _tmp8_, &_inner_error0_);
			_tmp6_ = _tmp9_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gboolean _tmp10_ = FALSE;
				if (_inner_error0_->domain == PDFPC_RENDERER_RENDER_ERROR) {
					goto __catch0_pdfpc_renderer_render_error;
				}
				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 _tmp10_;
			}
			_tmp11_ = _tmp6_;
			_tmp6_ = NULL;
			_cairo_surface_destroy0 (self->buffer);
			self->buffer = _tmp11_;
			_cairo_surface_destroy0 (_tmp6_);
		}
		goto __finally0;
		__catch0_pdfpc_renderer_render_error:
		{
			g_clear_error (&_inner_error0_);
			result = TRUE;
			return result;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp12_ = FALSE;
			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 _tmp12_;
		}
	}
	cairo_scale (cr, 1.0 / self->gdk_scale, 1.0 / self->gdk_scale);
	_tmp13_ = self->buffer;
	cairo_set_source_surface (cr, _tmp13_, (gdouble) 0, (gdouble) 0);
	cairo_paint (cr);
	if (self->entering_slide_queued) {
		self->entering_slide_queued = FALSE;
		g_signal_emit (self, pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_ENTERING_SLIDE_SIGNAL], 0, self->current_slide_number);
	}
	result = TRUE;
	return result;
}

gint
pdfpc_view_pdf_get_n_slides (pdfpcViewPdf* self)
{
	gint result;
	pdfpcMetadataPdf* _tmp0_;
	pdfpcMetadataPdf* _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = pdfpc_view_pdf_get_metadata (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = (gint) pdfpc_metadata_pdf_get_slide_count (_tmp1_);
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure,
                                       GValue * return_value,
                                       guint n_param_values,
                                       const GValue * param_values,
                                       gpointer invocation_hint,
                                       gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, gint arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__INT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), data2);
}

static void
pdfpc_view_pdf_class_init (pdfpcViewPdfClass * klass,
                           gpointer klass_data)
{
	pdfpc_view_pdf_parent_class = g_type_class_peek_parent (klass);
	((pdfpcViewPdfClass *) klass)->prerender = (gboolean (*) (pdfpcViewPdf*)) pdfpc_view_pdf_real_prerender;
	((GtkWidgetClass *) klass)->draw = (gboolean (*) (GtkWidget*, cairo_t*)) pdfpc_view_pdf_real_draw;
	G_OBJECT_CLASS (klass)->get_property = _vala_pdfpc_view_pdf_get_property;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_view_pdf_finalize;
	/**
	         * The number of slides in the presentation
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_VIEW_PDF_N_SLIDES_PROPERTY, pdfpc_view_pdf_properties[PDFPC_VIEW_PDF_N_SLIDES_PROPERTY] = g_param_spec_int ("n-slides", "n-slides", "n-slides", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	         * Signal fired every time a slide is about to be left
	         */
	pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_LEAVING_SLIDE_SIGNAL] = g_signal_new ("leaving-slide", PDFPC_VIEW_TYPE_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
	/**
	         * Signal fired every time a slide is fully entered (i.e, the
	         * transition animation, if defined, is over)
	         */
	pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_ENTERING_SLIDE_SIGNAL] = g_signal_new ("entering-slide", PDFPC_VIEW_TYPE_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
	/**
	         * Signal emitted on toggling the freeze state
	         */
	pdfpc_view_pdf_signals[PDFPC_VIEW_PDF_FREEZE_TOGGLED_SIGNAL] = g_signal_new ("freeze-toggled", PDFPC_VIEW_TYPE_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
pdfpc_view_pdf_instance_init (pdfpcViewPdf * self,
                              gpointer klass)
{
	self->entering_slide_queued = FALSE;
	self->behaviours = NULL;
	self->gdk_scale = 1;
	self->prerender_tid = (guint) 0;
	self->transition_tid = (guint) 0;
	self->transitions_enabled = FALSE;
	self->zoom_area = NULL;
}

static void
pdfpc_view_pdf_finalize (GObject * obj)
{
	pdfpcViewPdf * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_VIEW_TYPE_PDF, pdfpcViewPdf);
	_g_object_unref0 (self->renderer);
	_cairo_surface_destroy0 (self->current_slide);
	_cairo_surface_destroy0 (self->buffer);
	(self->behaviours == NULL) ? NULL : (self->behaviours = (_g_list_free__g_object_unref0_ (self->behaviours), NULL));
	_pdfpc_presentation_controller_scaled_rectangle_free0 (self->zoom_area);
	G_OBJECT_CLASS (pdfpc_view_pdf_parent_class)->finalize (obj);
}

/**
     * View spezialized to work with Pdf renderers.
     *
     * This class is mainly needed to be decorated with pdf-link-interactions
     * signals.
     *
     * By default it does not implement any further functionality.
     */
static GType
pdfpc_view_pdf_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcViewPdfClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_view_pdf_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcViewPdf), 0, (GInstanceInitFunc) pdfpc_view_pdf_instance_init, NULL };
	GType pdfpc_view_pdf_type_id;
	pdfpc_view_pdf_type_id = g_type_register_static (gtk_drawing_area_get_type (), "pdfpcViewPdf", &g_define_type_info, 0);
	return pdfpc_view_pdf_type_id;
}

GType
pdfpc_view_pdf_get_type (void)
{
	static volatile gsize pdfpc_view_pdf_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_view_pdf_type_id__once)) {
		GType pdfpc_view_pdf_type_id;
		pdfpc_view_pdf_type_id = pdfpc_view_pdf_get_type_once ();
		g_once_init_leave (&pdfpc_view_pdf_type_id__once, pdfpc_view_pdf_type_id);
	}
	return pdfpc_view_pdf_type_id__once;
}

static void
_vala_pdfpc_view_pdf_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	pdfpcViewPdf * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFPC_VIEW_TYPE_PDF, pdfpcViewPdf);
	switch (property_id) {
		case PDFPC_VIEW_PDF_N_SLIDES_PROPERTY:
		g_value_set_int (value, pdfpc_view_pdf_get_n_slides (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

