| 1 |
/* Clutter. |
| 2 |
* An OpenGL based 'interactive canvas' library. |
| 3 |
* Authored By Matthew Allum <[email protected]> |
| 4 |
* Copyright (C) 2006-2007 OpenedHand |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef __CLUTTER_BACKEND_X11_H__ |
| 23 |
#define __CLUTTER_BACKEND_X11_H__ |
| 24 |
|
| 25 |
#include <glib-object.h> |
| 26 |
#include <clutter/clutter-event.h> |
| 27 |
#include <X11/Xlib.h> |
| 28 |
#include <X11/Xatom.h> |
| 29 |
|
| 30 |
#include "clutter-x11.h" |
| 31 |
|
| 32 |
#include "clutter-backend-private.h" |
| 33 |
#include "clutter-keymap-x11.h" |
| 34 |
|
| 35 |
#include "xsettings/xsettings-client.h" |
| 36 |
|
| 37 |
G_BEGIN_DECLS |
| 38 |
|
| 39 |
#define CLUTTER_TYPE_BACKEND_X11 (clutter_backend_x11_get_type ()) |
| 40 |
#define CLUTTER_BACKEND_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11)) |
| 41 |
#define CLUTTER_IS_BACKEND_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_X11)) |
| 42 |
#define CLUTTER_BACKEND_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11Class)) |
| 43 |
#define CLUTTER_IS_BACKEND_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_X11)) |
| 44 |
#define CLUTTER_BACKEND_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11Class)) |
| 45 |
|
| 46 |
typedef struct _ClutterBackendX11 ClutterBackendX11; |
| 47 |
typedef struct _ClutterBackendX11Class ClutterBackendX11Class; |
| 48 |
typedef struct _ClutterEventX11 ClutterEventX11; |
| 49 |
typedef struct _ClutterX11EventFilter ClutterX11EventFilter; |
| 50 |
|
| 51 |
struct _ClutterX11EventFilter |
| 52 |
{ |
| 53 |
ClutterX11FilterFunc func; |
| 54 |
gpointer data; |
| 55 |
|
| 56 |
}; |
| 57 |
|
| 58 |
struct _ClutterEventX11 |
| 59 |
{ |
| 60 |
/* additional fields for Key events */ |
| 61 |
gint key_group; |
| 62 |
|
| 63 |
guint key_is_modifier : 1; |
| 64 |
guint num_lock_set : 1; |
| 65 |
guint caps_lock_set : 1; |
| 66 |
}; |
| 67 |
|
| 68 |
struct _ClutterBackendX11 |
| 69 |
{ |
| 70 |
ClutterBackend parent_instance; |
| 71 |
|
| 72 |
Display *xdpy; |
| 73 |
gchar *display_name; |
| 74 |
|
| 75 |
Screen *xscreen; |
| 76 |
int xscreen_num; |
| 77 |
int xscreen_width; |
| 78 |
int xscreen_height; |
| 79 |
|
| 80 |
Window xwin_root; |
| 81 |
|
| 82 |
/* event source */ |
| 83 |
GSource *event_source; |
| 84 |
GSList *event_filters; |
| 85 |
|
| 86 |
/* props */ |
| 87 |
Atom atom_NET_WM_PID; |
| 88 |
Atom atom_NET_WM_PING; |
| 89 |
Atom atom_NET_WM_STATE; |
| 90 |
Atom atom_NET_WM_STATE_FULLSCREEN; |
| 91 |
Atom atom_NET_WM_USER_TIME; |
| 92 |
Atom atom_WM_PROTOCOLS; |
| 93 |
Atom atom_WM_DELETE_WINDOW; |
| 94 |
Atom atom_XEMBED; |
| 95 |
Atom atom_XEMBED_INFO; |
| 96 |
Atom atom_NET_WM_NAME; |
| 97 |
Atom atom_UTF8_STRING; |
| 98 |
|
| 99 |
Time last_event_time; |
| 100 |
|
| 101 |
ClutterDeviceManager *device_manager; |
| 102 |
gboolean has_xinput; |
| 103 |
int xi_minor; |
| 104 |
|
| 105 |
XSettingsClient *xsettings; |
| 106 |
Window xsettings_xwin; |
| 107 |
|
| 108 |
ClutterKeymapX11 *keymap; |
| 109 |
gboolean use_xkb; |
| 110 |
gboolean have_xkb_autorepeat; |
| 111 |
guint keymap_serial; |
| 112 |
}; |
| 113 |
|
| 114 |
struct _ClutterBackendX11Class |
| 115 |
{ |
| 116 |
ClutterBackendClass parent_class; |
| 117 |
}; |
| 118 |
|
| 119 |
GType clutter_backend_x11_get_type (void) G_GNUC_CONST; |
| 120 |
|
| 121 |
ClutterBackend *clutter_backend_x11_new (void); |
| 122 |
|
| 123 |
void _clutter_backend_x11_events_init (ClutterBackend *backend); |
| 124 |
|
| 125 |
GSource * _clutter_x11_event_source_new (ClutterBackendX11 *backend_x11); |
| 126 |
|
| 127 |
/* Private to glx/eglx backends */ |
| 128 |
XVisualInfo * _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11); |
| 129 |
|
| 130 |
void _clutter_x11_select_events (Window xwin); |
| 131 |
|
| 132 |
ClutterEventX11 * _clutter_event_x11_new (void); |
| 133 |
ClutterEventX11 * _clutter_event_x11_copy (ClutterEventX11 *event_x11); |
| 134 |
void _clutter_event_x11_free (ClutterEventX11 *event_x11); |
| 135 |
|
| 136 |
gboolean _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device, |
| 137 |
gint stage_root_x, |
| 138 |
gint stage_root_y, |
| 139 |
guint index_, |
| 140 |
gdouble value, |
| 141 |
gdouble *axis_value); |
| 142 |
|
| 143 |
G_END_DECLS |
| 144 |
|
| 145 |
#endif /* __CLUTTER_BACKEND_X11_H__ */ |