Wrote platform-dependent dispatch code
[rodin/chimara.git] / libchimara / chimara-glk-private.h
1 #ifndef __CHIMARA_GLK_PRIVATE_H__
2 #define __CHIMARA_GLK_PRIVATE_H__
3
4 #include <glib.h>
5 #include <gmodule.h>
6 #include <pango/pango.h>
7 #include "glk.h"
8 #include "gi_blorb.h"
9 #include "gi_dispa.h"
10 #include "chimara-glk.h"
11
12 G_BEGIN_DECLS
13
14 typedef struct _ChimaraGlkPrivate ChimaraGlkPrivate;
15
16 struct _ChimaraGlkPrivate {
17     /* Pointer back to the widget itself for use in thread */
18     ChimaraGlk *self;
19
20         /* *** Widget properties *** */
21     /* Whether user input is expected */
22     gboolean interactive;
23     /* Whether file operations are allowed */
24     gboolean protect;
25         /* Font description of proportional font */
26         PangoFontDescription *default_font_desc;
27         /* Font description of monospace font */
28         PangoFontDescription *monospace_font_desc;
29         /* Spacing between Glk windows */
30         guint spacing;
31         /* The CSS file to read style defaults from */
32         gchar *css_file;
33         /* Hashtable containing the default styles */
34         GHashTable *default_styles;
35
36         /* *** Threading data *** */
37     /* Glk program loaded in widget */
38     GModule *program;
39     /* Thread in which Glk program is run */
40     GThread *thread;
41     /* Event queue and threading stuff */
42     GQueue *event_queue;
43     GMutex *event_lock;
44     GCond *event_queue_not_empty;
45     GCond *event_queue_not_full;
46     /* Abort mechanism */
47     GMutex *abort_lock;
48     gboolean abort_signalled;
49         /* Window arrangement locks */
50         GMutex *arrange_lock;
51         GCond *rearranged;
52         gboolean needs_rearrange;
53         gboolean ignore_next_arrange_event;
54
55         /* *** Glk library data *** */
56     /* User-defined interrupt handler */
57     void (*interrupt_handler)(void);
58     /* Global tree of all windows */
59     GNode *root_window;
60     /* List of filerefs currently in existence */
61     GList *fileref_list;
62     /* Current stream */
63     strid_t current_stream;
64     /* List of streams currently in existence */
65     GList *stream_list;
66         /* Current timer */
67         guint timer_id;
68         /* Current resource blorb map */
69         giblorb_map_t *resource_map;
70         /* File stream pointing to the blorb used as current resource map */
71         strid_t resource_file;
72         /* Callbacks for registering and unregistering dispatch objects */
73         gidispatch_rock_t (*register_obj)(void *, glui32);
74         void (*unregister_obj)(void *, glui32, gidispatch_rock_t);
75         gidispatch_rock_t (*register_arr)(void *, glui32, char *);
76         void (*unregister_arr)(void *, glui32, char *, gidispatch_rock_t);
77
78         /* *** Platform-dependent Glk library data *** */
79         /* Flag for functions to find out if they are being called from startup code */
80         gboolean in_startup;
81         /* "Current directory" for creating filerefs */
82         gchar *current_dir;
83 };
84
85 #define CHIMARA_GLK_PRIVATE(obj) \
86         (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHIMARA_TYPE_GLK, ChimaraGlkPrivate))
87         
88 G_END_DECLS
89
90 #endif /* __CHIMARA_GLK_PRIVATE_H__ */