update to 1.10.4
[profile/ivi/clutter.git] / clutter / x11 / clutter-x11.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *
8  * Copyright (C) 2006 OpenedHand
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
22  *
23  *
24  */
25
26 /**
27  * SECTION:clutter-x11
28  * @short_description: X11 specific API
29  *
30  * The X11 backend for Clutter provides some specific API, allowing
31  * integration with the Xlibs API for embedding and manipulating the
32  * stage window, or for trapping X errors.
33  *
34  * The ClutterX11 API is available since Clutter 0.6
35  */
36
37 #ifndef __CLUTTER_X11_H__
38 #define __CLUTTER_X11_H__
39
40 #include <glib.h>
41 #include <X11/Xlib.h>
42 #include <X11/Xatom.h>
43 #include <X11/Xutil.h>
44 #include <clutter/clutter.h>
45 #include <clutter/x11/clutter-x11-texture-pixmap.h>
46
47 G_BEGIN_DECLS
48
49 /**
50  * ClutterX11FilterReturn:
51  * @CLUTTER_X11_FILTER_CONTINUE: The event was not handled, continues the
52  *   processing
53  * @CLUTTER_X11_FILTER_TRANSLATE: Native event translated into a Clutter
54  *   event, stops the processing
55  * @CLUTTER_X11_FILTER_REMOVE: Remove the event, stops the processing
56  *
57  * Return values for the #ClutterX11FilterFunc function.
58  *
59  * Since: 0.6
60  */
61 typedef enum {
62   CLUTTER_X11_FILTER_CONTINUE,
63   CLUTTER_X11_FILTER_TRANSLATE,
64   CLUTTER_X11_FILTER_REMOVE
65 } ClutterX11FilterReturn;
66
67 /*
68  * This is an internal only enumeration; it should really be private
69  */
70 typedef enum {
71   CLUTTER_X11_XINPUT_KEY_PRESS_EVENT = 0,
72   CLUTTER_X11_XINPUT_KEY_RELEASE_EVENT,
73   CLUTTER_X11_XINPUT_BUTTON_PRESS_EVENT,
74   CLUTTER_X11_XINPUT_BUTTON_RELEASE_EVENT,
75   CLUTTER_X11_XINPUT_MOTION_NOTIFY_EVENT,
76   CLUTTER_X11_XINPUT_LAST_EVENT
77 } ClutterX11XInputEventTypes;
78
79 /*
80  * This is not used any more
81  */
82 typedef struct _ClutterX11XInputDevice ClutterX11XInputDevice;
83
84 /**
85  * ClutterX11FilterFunc:
86  * @xev: Native X11 event structure
87  * @cev: Clutter event structure
88  * @data: user data passed to the filter function
89  *
90  * Filter function for X11 native events.
91  *
92  * Return value: the result of the filtering
93  *
94  * Since: 0.6
95  */
96 typedef ClutterX11FilterReturn (*ClutterX11FilterFunc) (XEvent        *xev,
97                                                         ClutterEvent  *cev,
98                                                         gpointer       data);
99
100 void     clutter_x11_trap_x_errors       (void);
101 gint     clutter_x11_untrap_x_errors     (void);
102
103 Display *clutter_x11_get_default_display (void);
104 int      clutter_x11_get_default_screen  (void);
105 Window   clutter_x11_get_root_window     (void);
106 XVisualInfo *clutter_x11_get_visual_info (void);
107 void     clutter_x11_set_display         (Display * xdpy);
108
109 CLUTTER_DEPRECATED_FOR(clutter_x11_get_visual_info)
110 XVisualInfo *clutter_x11_get_stage_visual  (ClutterStage *stage);
111
112 Window       clutter_x11_get_stage_window  (ClutterStage *stage);
113 gboolean     clutter_x11_set_stage_foreign (ClutterStage *stage,
114                                             Window        xwindow);
115
116 void         clutter_x11_add_filter    (ClutterX11FilterFunc func,
117                                         gpointer             data);
118 void         clutter_x11_remove_filter (ClutterX11FilterFunc func,
119                                         gpointer             data);
120
121 ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent);
122
123 void     clutter_x11_disable_event_retrieval (void);
124 gboolean clutter_x11_has_event_retrieval (void);
125
126 ClutterStage *clutter_x11_get_stage_from_window (Window win);
127
128 CLUTTER_DEPRECATED_FOR(clutter_device_manager_peek_devices)
129 const GSList* clutter_x11_get_input_devices (void);
130
131 void     clutter_x11_enable_xinput (void);
132 gboolean clutter_x11_has_xinput (void);
133
134 gboolean clutter_x11_has_composite_extension (void);
135
136 void     clutter_x11_set_use_argb_visual (gboolean use_argb);
137 gboolean clutter_x11_get_use_argb_visual (void);
138
139 Time clutter_x11_get_current_event_time (void);
140
141 gint clutter_x11_event_get_key_group (const ClutterEvent *event);
142
143 G_END_DECLS
144
145 #endif /* __CLUTTER_X11_H__ */