~elementary-os/elementaryos/os-patch-notify-osd-precise

« back to all changes in this revision

Viewing changes to egg/egg-hack.c

  • Committer: Sergey "Shnatsel" Davidoff
  • Date: 2012-06-18 21:08:31 UTC
  • Revision ID: shnatsel@gmail.com-20120618210831-g6k5y7vecjdylgic
Initial import, version 0.9.34-0ubuntu2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef HAVE_CONFIG_H
 
2
#include "config.h"
 
3
#endif
 
4
 
 
5
#include <stdlib.h>
 
6
#include <glib.h>
 
7
#include <locale.h>
 
8
 
 
9
#include "egg-hack.h"
 
10
 
 
11
static guint egg_default_fps        = 60;
 
12
 
 
13
guint
 
14
egg_get_default_frame_rate (void)
 
15
{
 
16
        return egg_default_fps;
 
17
}
 
18
 
 
19
guint egg_debug_flags = 0;  /* global egg debug flag */
 
20
 
 
21
#ifdef EGG_ENABLE_DEBUG
 
22
static const GDebugKey egg_debug_keys[] = {
 
23
  { "misc", EGG_DEBUG_MISC },
 
24
  { "actor", EGG_DEBUG_ACTOR },
 
25
  { "texture", EGG_DEBUG_TEXTURE },
 
26
  { "event", EGG_DEBUG_EVENT },
 
27
  { "paint", EGG_DEBUG_PAINT },
 
28
  { "gl", EGG_DEBUG_GL },
 
29
  { "alpha", EGG_DEBUG_ALPHA },
 
30
  { "behaviour", EGG_DEBUG_BEHAVIOUR },
 
31
  { "pango", EGG_DEBUG_PANGO },
 
32
  { "backend", EGG_DEBUG_BACKEND },
 
33
  { "scheduler", EGG_DEBUG_SCHEDULER },
 
34
  { "script", EGG_DEBUG_SCRIPT },
 
35
  { "shader", EGG_DEBUG_SHADER },
 
36
  { "multistage", EGG_DEBUG_MULTISTAGE },
 
37
};
 
38
#endif /* EGG_ENABLE_DEBUG */
 
39
 
 
40
gboolean
 
41
egg_get_debug_enabled (void)
 
42
{
 
43
#ifdef EGG_ENABLE_DEBUG
 
44
  return egg_debug_flags != 0;
 
45
#else
 
46
  return FALSE;
 
47
#endif
 
48
}
 
49
 
 
50
void
 
51
egg_threads_enter (void)
 
52
{
 
53
        return;
 
54
}
 
55
 
 
56
void
 
57
egg_threads_leave (void)
 
58
{
 
59
        return;
 
60
}
 
61
 
 
62
static guint egg_main_loop_level    = 0;
 
63
static GSList *main_loops               = NULL;
 
64
static gboolean egg_is_initialized  = FALSE;
 
65
 
 
66
 
 
67
/**
 
68
 * egg_main:
 
69
 *
 
70
 * Starts the Egg mainloop.
 
71
 */
 
72
void
 
73
egg_main (void)
 
74
{
 
75
  GMainLoop *loop;
 
76
 
 
77
#if 0
 
78
  /* Make sure there is a context */
 
79
  EGG_CONTEXT ();
 
80
#endif
 
81
 
 
82
  if (!egg_is_initialized)
 
83
    {
 
84
      g_warning ("Called egg_main() but Egg wasn't initialised.  "
 
85
                 "You must call egg_init() first.");
 
86
      return;
 
87
    }
 
88
 
 
89
  EGG_MARK ();
 
90
 
 
91
  egg_main_loop_level++;
 
92
 
 
93
  loop = g_main_loop_new (NULL, TRUE);
 
94
  main_loops = g_slist_prepend (main_loops, loop);
 
95
 
 
96
#ifdef HAVE_EGG_FRUITY
 
97
  /* egg fruity creates an application that forwards events and manually
 
98
   * spins the mainloop
 
99
   */
 
100
  egg_fruity_main ();
 
101
#else
 
102
  if (g_main_loop_is_running (main_loops->data))
 
103
    {
 
104
      egg_threads_leave ();
 
105
      g_main_loop_run (loop);
 
106
      egg_threads_enter ();
 
107
    }
 
108
#endif
 
109
 
 
110
  main_loops = g_slist_remove (main_loops, loop);
 
111
 
 
112
  g_main_loop_unref (loop);
 
113
 
 
114
  egg_main_loop_level--;
 
115
 
 
116
  EGG_MARK ();
 
117
}
 
118
 
 
119
EggInitError
 
120
egg_init (int    *argc,
 
121
              char ***argv)
 
122
{
 
123
        if (!egg_is_initialized)
 
124
        {
 
125
                /* initialise GLib type system */
 
126
                g_type_init ();
 
127
 
 
128
                egg_is_initialized = TRUE;
 
129
        }
 
130
 
 
131
        return EGG_INIT_SUCCESS;
 
132
}
 
133
 
 
134
 
 
135
/* -------------------------------------------------------------------------- */
 
136
 
 
137
/* auto-generated code taken from egg-enum-types.c */
 
138
 
 
139
/* enumerations from "./egg-timeline.h" */
 
140
#include "./egg-timeline.h"
 
141
GType
 
142
egg_timeline_direction_get_type(void) {
 
143
  static GType etype = 0;
 
144
  if (G_UNLIKELY (!etype))
 
145
    {
 
146
      static const GEnumValue values[] = {
 
147
        { EGG_TIMELINE_FORWARD, "EGG_TIMELINE_FORWARD", "forward" },
 
148
        { EGG_TIMELINE_BACKWARD, "EGG_TIMELINE_BACKWARD", "backward" },
 
149
        { 0, NULL, NULL }
 
150
      };
 
151
      etype = g_enum_register_static (g_intern_static_string ("EggTimelineDirection"), values);
 
152
    }
 
153
  return etype;
 
154
}
 
155
 
 
156
/* auto-generated code taken from egg-marshal.c */
 
157
 
 
158
#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
 
159
#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
 
160
 
 
161
/* VOID:STRING,INT (./egg-marshal.list:12) */
 
162
void
 
163
egg_marshal_VOID__STRING_INT (GClosure     *closure,
 
164
                                  GValue       *return_value G_GNUC_UNUSED,
 
165
                                  guint         n_param_values,
 
166
                                  const GValue *param_values,
 
167
                                  gpointer      invocation_hint G_GNUC_UNUSED,
 
168
                                  gpointer      marshal_data)
 
169
{
 
170
  typedef void (*GMarshalFunc_VOID__STRING_INT) (gpointer     data1,
 
171
                                                 gpointer     arg_1,
 
172
                                                 gint         arg_2,
 
173
                                                 gpointer     data2);
 
174
  register GMarshalFunc_VOID__STRING_INT callback;
 
175
  register GCClosure *cc = (GCClosure*) closure;
 
176
  register gpointer data1, data2;
 
177
 
 
178
  g_return_if_fail (n_param_values == 3);
 
179
 
 
180
  if (G_CCLOSURE_SWAP_DATA (closure))
 
181
    {
 
182
      data1 = closure->data;
 
183
      data2 = g_value_peek_pointer (param_values + 0);
 
184
    }
 
185
  else
 
186
    {
 
187
      data1 = g_value_peek_pointer (param_values + 0);
 
188
      data2 = closure->data;
 
189
    }
 
190
  callback = (GMarshalFunc_VOID__STRING_INT) (marshal_data ? marshal_data : cc->callback);
 
191
 
 
192
  callback (data1,
 
193
            g_marshal_value_peek_string (param_values + 1),
 
194
            g_marshal_value_peek_int (param_values + 2),
 
195
            data2);
 
196
}
 
197
 
 
198
/* VOID:INT,INT (./egg-marshal.list:6) */
 
199
void
 
200
egg_marshal_VOID__INT_INT (GClosure     *closure,
 
201
                               GValue       *return_value G_GNUC_UNUSED,
 
202
                               guint         n_param_values,
 
203
                               const GValue *param_values,
 
204
                               gpointer      invocation_hint G_GNUC_UNUSED,
 
205
                               gpointer      marshal_data)
 
206
{
 
207
  typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer     data1,
 
208
                                              gint         arg_1,
 
209
                                              gint         arg_2,
 
210
                                              gpointer     data2);
 
211
  register GMarshalFunc_VOID__INT_INT callback;
 
212
  register GCClosure *cc = (GCClosure*) closure;
 
213
  register gpointer data1, data2;
 
214
 
 
215
  g_return_if_fail (n_param_values == 3);
 
216
 
 
217
  if (G_CCLOSURE_SWAP_DATA (closure))
 
218
    {
 
219
      data1 = closure->data;
 
220
      data2 = g_value_peek_pointer (param_values + 0);
 
221
    }
 
222
  else
 
223
    {
 
224
      data1 = g_value_peek_pointer (param_values + 0);
 
225
      data2 = closure->data;
 
226
    }
 
227
  callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
 
228
 
 
229
  callback (data1,
 
230
            g_marshal_value_peek_int (param_values + 1),
 
231
            g_marshal_value_peek_int (param_values + 2),
 
232
            data2);
 
233
}
 
234
 
 
235
/* UINT:VOID (./egg-marshal.list:2) */
 
236
void
 
237
egg_marshal_UINT__VOID (GClosure     *closure,
 
238
                            GValue       *return_value G_GNUC_UNUSED,
 
239
                            guint         n_param_values,
 
240
                            const GValue *param_values,
 
241
                            gpointer      invocation_hint G_GNUC_UNUSED,
 
242
                            gpointer      marshal_data)
 
243
{
 
244
  typedef guint (*GMarshalFunc_UINT__VOID) (gpointer     data1,
 
245
                                            gpointer     data2);
 
246
  register GMarshalFunc_UINT__VOID callback;
 
247
  register GCClosure *cc = (GCClosure*) closure;
 
248
  register gpointer data1, data2;
 
249
  guint v_return;
 
250
 
 
251
  g_return_if_fail (return_value != NULL);
 
252
  g_return_if_fail (n_param_values == 1);
 
253
 
 
254
  if (G_CCLOSURE_SWAP_DATA (closure))
 
255
    {
 
256
      data1 = closure->data;
 
257
      data2 = g_value_peek_pointer (param_values + 0);
 
258
    }
 
259
  else
 
260
    {
 
261
      data1 = g_value_peek_pointer (param_values + 0);
 
262
      data2 = closure->data;
 
263
    }
 
264
  callback = (GMarshalFunc_UINT__VOID) (marshal_data ? marshal_data : cc->callback);
 
265
 
 
266
  v_return = callback (data1,
 
267
                       data2);
 
268
 
 
269
  g_value_set_uint (return_value, v_return);
 
270
}
 
271