e1067b247506fd78aea1b759709182e470807175
[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 "chimara-glk.h"
10
11 G_BEGIN_DECLS
12
13 typedef struct _ChimaraGlkPrivate ChimaraGlkPrivate;
14
15 struct _ChimaraGlkPrivate {
16     /* Pointer back to the widget itself for use in thread */
17     ChimaraGlk *self;
18
19         /* *** Widget properties *** */
20     /* Whether user input is expected */
21     gboolean interactive;
22     /* Whether file operations are allowed */
23     gboolean protect;
24         /* Font description of proportional font */
25         PangoFontDescription *default_font_desc;
26         /* Font description of monospace font */
27         PangoFontDescription *monospace_font_desc;
28         /* Spacing between Glk windows */
29         guint spacing;
30
31         /* *** Threading data *** */
32     /* Glk program loaded in widget */
33     GModule *program;
34     /* Thread in which Glk program is run */
35     GThread *thread;
36     /* Event queue and threading stuff */
37     GQueue *event_queue;
38     GMutex *event_lock;
39     GCond *event_queue_not_empty;
40     GCond *event_queue_not_full;
41     /* Abort mechanism */
42     GMutex *abort_lock;
43     gboolean abort_signalled;
44         /* Window arrangement locks */
45         GMutex *arrange_lock;
46         GCond *rearranged;
47         gboolean needs_rearrange;
48         gboolean ignore_next_arrange_event;
49
50         /* *** Glk library data *** */
51     /* User-defined interrupt handler */
52     void (*interrupt_handler)(void);
53     /* Global tree of all windows */
54     GNode *root_window;
55     /* List of filerefs currently in existence */
56     GList *fileref_list;
57     /* Current stream */
58     strid_t current_stream;
59     /* List of streams currently in existence */
60     GList *stream_list;
61         /* Current timer */
62         guint timer_id;
63         /* Current resource blorb map */
64         giblorb_map_t *resource_map;
65         /* File stream pointing to the blorb used as current resource map */
66         strid_t resource_file;
67
68         /* *** Platform-dependent Glk library data *** */
69         /* Flag for functions to find out if they are being called from startup code */
70         gboolean in_startup;
71         /* "Current directory" for creating filerefs */
72         gchar *current_dir;
73 };
74
75 #define CHIMARA_GLK_PRIVATE(obj) \
76         (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHIMARA_TYPE_GLK, ChimaraGlkPrivate))
77         
78 G_END_DECLS
79
80 #endif /* __CHIMARA_GLK_PRIVATE_H__ */