1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 #ifndef __CINNAMON_GLOBAL_H__
3 #define __CINNAMON_GLOBAL_H__
4 
5 #include <clutter/clutter.h>
6 #include <glib-object.h>
7 #include <gdk-pixbuf/gdk-pixbuf.h>
8 #include <gtk/gtk.h>
9 #include <meta/meta-plugin.h>
10 
11 G_BEGIN_DECLS
12 
13 typedef struct _CinnamonGlobal      CinnamonGlobal;
14 typedef struct _CinnamonGlobalClass CinnamonGlobalClass;
15 
16 #define CINNAMON_TYPE_GLOBAL              (cinnamon_global_get_type ())
17 #define CINNAMON_GLOBAL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), CINNAMON_TYPE_GLOBAL, CinnamonGlobal))
18 #define CINNAMON_GLOBAL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CINNAMON_TYPE_GLOBAL, CinnamonGlobalClass))
19 #define CINNAMON_IS_GLOBAL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), CINNAMON_TYPE_GLOBAL))
20 #define CINNAMON_IS_GLOBAL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CINNAMON_TYPE_GLOBAL))
21 #define CINNAMON_GLOBAL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CINNAMON_TYPE_GLOBAL, CinnamonGlobalClass))
22 
23 struct _CinnamonGlobalClass
24 {
25   GObjectClass parent_class;
26 };
27 
28 GType cinnamon_global_get_type (void) G_GNUC_CONST;
29 
30 CinnamonGlobal   *cinnamon_global_get                       (void);
31 
32 ClutterStage  *cinnamon_global_get_stage                 (CinnamonGlobal *global);
33 MetaScreen    *cinnamon_global_get_screen                (CinnamonGlobal *global);
34 GdkScreen     *cinnamon_global_get_gdk_screen            (CinnamonGlobal *global);
35 MetaDisplay   *cinnamon_global_get_display               (CinnamonGlobal *global);
36 GList         *cinnamon_global_get_window_actors         (CinnamonGlobal *global);
37 GSettings     *cinnamon_global_get_settings              (CinnamonGlobal *global);
38 guint32        cinnamon_global_get_current_time          (CinnamonGlobal *global);
39 pid_t          cinnamon_global_get_pid                   (CinnamonGlobal *global);
40 gchar         *cinnamon_global_get_md5_for_string        (CinnamonGlobal *global, const gchar *string);
41 void           cinnamon_global_dump_gjs_stack            (CinnamonGlobal *global);
42 
43 /* Input/event handling */
44 gboolean cinnamon_global_begin_modal            (CinnamonGlobal         *global,
45                                               guint32              timestamp,
46                                               MetaModalOptions    options);
47 void     cinnamon_global_end_modal              (CinnamonGlobal         *global,
48                                               guint32              timestamp);
49 
50 typedef enum {
51   CINNAMON_STAGE_INPUT_MODE_NONREACTIVE,
52   CINNAMON_STAGE_INPUT_MODE_NORMAL,
53   CINNAMON_STAGE_INPUT_MODE_FOCUSED,
54   CINNAMON_STAGE_INPUT_MODE_FULLSCREEN
55 } CinnamonStageInputMode;
56 
57 void     cinnamon_global_set_stage_input_mode   (CinnamonGlobal         *global,
58                                               CinnamonStageInputMode  mode);
59 void     cinnamon_global_set_stage_input_region (CinnamonGlobal         *global,
60                                               GSList              *rectangles);
61 
62 /* X utilities */
63 typedef enum {
64   CINNAMON_CURSOR_DND_IN_DRAG,
65   CINNAMON_CURSOR_DND_UNSUPPORTED_TARGET,
66   CINNAMON_CURSOR_DND_MOVE,
67   CINNAMON_CURSOR_DND_COPY,
68   CINNAMON_CURSOR_POINTING_HAND,
69   CINNAMON_CURSOR_RESIZE_BOTTOM,
70   CINNAMON_CURSOR_RESIZE_TOP,
71   CINNAMON_CURSOR_RESIZE_LEFT,
72   CINNAMON_CURSOR_RESIZE_RIGHT,
73   CINNAMON_CURSOR_RESIZE_BOTTOM_RIGHT,
74   CINNAMON_CURSOR_RESIZE_BOTTOM_LEFT,
75   CINNAMON_CURSOR_RESIZE_TOP_RIGHT,
76   CINNAMON_CURSOR_RESIZE_TOP_LEFT,
77   CINNAMON_CURSOR_CROSSHAIR,
78   CINNAMON_CURSOR_TEXT
79 } CinnamonCursor;
80 
81 void    cinnamon_global_set_cursor              (CinnamonGlobal         *global,
82                                               CinnamonCursor          type);
83 void    cinnamon_global_unset_cursor            (CinnamonGlobal         *global);
84 
85 guint32 cinnamon_global_create_pointer_barrier  (CinnamonGlobal         *global,
86                                               int                  x1,
87                                               int                  y1,
88                                               int                  x2,
89                                               int                  y2,
90                                               int                  directions);
91 void    cinnamon_global_destroy_pointer_barrier (CinnamonGlobal         *global,
92                                               guint32              barrier);
93 
94 void    cinnamon_global_get_pointer             (CinnamonGlobal         *global,
95                                               int                 *x,
96                                               int                 *y,
97                                               ClutterModifierType *mods);
98 void    cinnamon_global_set_pointer             (CinnamonGlobal         *global,
99                                               int                 x,
100                                               int                 y);
101 
102 /* Run-at-leisure API */
103 void cinnamon_global_begin_work     (CinnamonGlobal          *global);
104 void cinnamon_global_end_work       (CinnamonGlobal          *global);
105 
106 typedef void (*CinnamonLeisureFunction) (gpointer data);
107 
108 void cinnamon_global_run_at_leisure (CinnamonGlobal          *global,
109                                   CinnamonLeisureFunction  func,
110                                   gpointer              user_data,
111                                   GDestroyNotify        notify);
112 
113 
114 /* Misc utilities / Cinnamon API */
115 
116 void     cinnamon_global_sync_pointer              (CinnamonGlobal  *global);
117 
118 GAppLaunchContext *
119          cinnamon_global_create_app_launch_context (CinnamonGlobal  *global);
120 
121 void     cinnamon_global_notify_error              (CinnamonGlobal  *global,
122                                                  const char   *msg,
123                                                  const char   *details);
124 
125 void     cinnamon_global_init_xdnd                 (CinnamonGlobal  *global);
126 
127 void     cinnamon_global_shutdown                  (void);
128 void     cinnamon_global_reexec_self               (CinnamonGlobal  *global);
129 
130 void     cinnamon_global_segfault                  (CinnamonGlobal  *global);
131 
132 G_END_DECLS
133 
134 #endif /* __CINNAMON_GLOBAL_H__ */
135