[mutter/wip/carlosg/input-in-backends: 22/30] clutter: Move X11 input to src/backends/x11
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-in-backends: 22/30] clutter: Move X11 input to src/backends/x11
- Date: Mon, 19 Aug 2019 09:22:54 +0000 (UTC)
commit c4df71d66d55fac33d629fe6854ffe9b183917a0
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 22 13:53:00 2019 +0100
clutter: Move X11 input to src/backends/x11
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendX11, this extends to device manager, input devices,
tools and keymap.
This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
clutter/clutter/clutter-backend-private.h | 1 +
clutter/clutter/clutter-backend.c | 8 -
clutter/clutter/clutter-device-manager-private.h | 24 +
clutter/clutter/clutter-device-manager.c | 2 +-
clutter/clutter/clutter-event-private.h | 5 +
.../clutter/clutter-input-pointer-a11y-private.h | 5 +
clutter/clutter/clutter-mutter.h | 7 +-
clutter/clutter/clutter-private.h | 3 +
clutter/clutter/clutter-stage-private.h | 7 +
clutter/clutter/clutter-stage-window.h | 1 +
clutter/clutter/meson.build | 19 -
clutter/clutter/x11/clutter-backend-x11.c | 146 -----
clutter/clutter/x11/clutter-backend-x11.h | 21 +-
clutter/clutter/x11/clutter-device-manager-xi2.h | 77 ---
.../clutter/x11/clutter-input-device-tool-xi2.h | 74 ---
clutter/clutter/x11/clutter-input-device-xi2.h | 72 ---
clutter/clutter/x11/clutter-keymap-x11.h | 72 ---
clutter/clutter/x11/clutter-stage-x11.h | 99 ---
.../clutter/x11/clutter-virtual-input-device-x11.c | 219 -------
clutter/clutter/x11/clutter-x11.h | 18 -
src/backends/x11/meta-backend-x11.c | 6 +-
src/backends/x11/meta-clutter-backend-x11.c | 122 +++-
.../backends/x11/meta-device-manager-x11.c | 711 ++++++++++-----------
src/backends/x11/meta-device-manager-x11.h | 60 ++
.../backends/x11/meta-event-x11.c | 109 +---
src/backends/x11/meta-event-x11.h | 55 ++
.../backends/x11/meta-input-device-tool-x11.c | 20 +-
src/backends/x11/meta-input-device-tool-x11.h | 51 ++
.../backends/x11/meta-input-device-x11.c | 164 +++--
src/backends/x11/meta-input-device-x11.h | 73 +++
.../backends/x11/meta-keymap-x11.c | 254 ++++----
src/backends/x11/meta-keymap-x11.h | 62 ++
src/backends/x11/meta-stage-x11-nested.c | 10 +-
src/backends/x11/meta-stage-x11-nested.h | 3 +-
.../backends/x11/meta-stage-x11.c | 384 +++++------
src/backends/x11/meta-stage-x11.h | 101 +++
src/backends/x11/meta-virtual-input-device-x11.c | 214 +++++++
.../backends/x11/meta-virtual-input-device-x11.h | 20 +-
.../backends/x11/meta-xkb-a11y-x11.c | 65 +-
.../backends/x11/meta-xkb-a11y-x11.h | 16 +-
src/compositor/compositor.c | 7 +-
src/compositor/meta-compositor-x11.c | 2 +-
src/compositor/meta-dnd.c | 3 +-
src/core/display.c | 3 +-
src/meson.build | 17 +
src/x11/meta-x11-display.c | 2 +-
46 files changed, 1598 insertions(+), 1816 deletions(-)
---
diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h
index 396020e06..f0855e1eb 100644
--- a/clutter/clutter/clutter-backend-private.h
+++ b/clutter/clutter/clutter-backend-private.h
@@ -128,6 +128,7 @@ void _clutter_backend_copy_event_data (Clutter
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
+CLUTTER_EXPORT
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index fee661bbe..9fce0871a 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -534,14 +534,6 @@ clutter_backend_real_init_events (ClutterBackend *backend)
if (input_backend != NULL)
input_backend = g_intern_string (input_backend);
-#ifdef CLUTTER_INPUT_X11
- if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
- (input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11)))
- {
- _clutter_backend_x11_events_init (backend);
- }
- else
-#endif
#ifdef CLUTTER_INPUT_EVDEV
/* Evdev can be used regardless of the windowing system */
if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0)
diff --git a/clutter/clutter/clutter-device-manager-private.h
b/clutter/clutter/clutter-device-manager-private.h
index 86355285a..40a1c7691 100644
--- a/clutter/clutter/clutter-device-manager-private.h
+++ b/clutter/clutter/clutter-device-manager-private.h
@@ -194,11 +194,14 @@ struct _ClutterInputDeviceClass
};
/* device manager */
+CLUTTER_EXPORT
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
+CLUTTER_EXPORT
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
+CLUTTER_EXPORT
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
@@ -208,23 +211,31 @@ void _clutter_device_manager_compress_motion (ClutterDeviceMa
const ClutterEvent *to_discard);
/* input device */
+CLUTTER_EXPORT
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);
+CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
+CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
+CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
+CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
+CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
+CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
+CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
@@ -233,44 +244,57 @@ void _clutter_input_device_set_actor (ClutterInputDev
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
+CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
+CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble min_value,
gdouble max_value,
gdouble resolution);
+CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
+CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
+CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
+CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
+CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
+CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
+CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
+CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
+CLUTTER_EXPORT
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
+CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
+CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index 5c2b3c338..13edc0cba 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -322,7 +322,7 @@ clutter_device_manager_get_default (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
- return backend->device_manager;
+ return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
}
/**
diff --git a/clutter/clutter/clutter-event-private.h b/clutter/clutter/clutter-event-private.h
index 00d627d12..cd840e9a0 100644
--- a/clutter/clutter/clutter-event-private.h
+++ b/clutter/clutter/clutter-event-private.h
@@ -5,6 +5,7 @@
G_BEGIN_DECLS
+CLUTTER_EXPORT
void _clutter_event_set_pointer_emulated (ClutterEvent *event,
gboolean is_emulated);
@@ -17,10 +18,13 @@ gboolean _clutter_event_process_filters (ClutterEvent *eve
void _clutter_clear_events_queue (void);
void _clutter_clear_events_queue_for_stage (ClutterStage *stage);
+CLUTTER_EXPORT
void _clutter_event_set_platform_data (ClutterEvent *event,
gpointer data);
+CLUTTER_EXPORT
gpointer _clutter_event_get_platform_data (const ClutterEvent *event);
+CLUTTER_EXPORT
void _clutter_event_set_state_full (ClutterEvent *event,
ClutterModifierType button_state,
ClutterModifierType base_state,
@@ -28,6 +32,7 @@ void _clutter_event_set_state_full (ClutterEvent *ev
ClutterModifierType locked_state,
ClutterModifierType effective_state);
+CLUTTER_EXPORT
void _clutter_event_push (const ClutterEvent *event,
gboolean do_copy);
diff --git a/clutter/clutter/clutter-input-pointer-a11y-private.h
b/clutter/clutter/clutter-input-pointer-a11y-private.h
index 6648909fc..fbbe04101 100644
--- a/clutter/clutter/clutter-input-pointer-a11y-private.h
+++ b/clutter/clutter/clutter-input-pointer-a11y-private.h
@@ -27,14 +27,19 @@
G_BEGIN_DECLS
+CLUTTER_EXPORT
void _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device);
+CLUTTER_EXPORT
void _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device);
+CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
float x,
float y);
+CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
int button,
gboolean pressed);
+CLUTTER_EXPORT
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
G_END_DECLS
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index a53080457..ca600da94 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -26,10 +26,15 @@
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
+#include "clutter-device-manager-private.h"
+#include "clutter-event-private.h"
+#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
+#include "clutter-private.h"
+#include "clutter-stage-private.h"
#include "clutter-stage-view.h"
#include "cogl/clutter-stage-cogl.h"
-#include "x11/clutter-stage-x11.h"
+#include "clutter/x11/clutter-backend-x11.h"
CLUTTER_EXPORT
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
index a04f74c51..5a768f3fb 100644
--- a/clutter/clutter/clutter-private.h
+++ b/clutter/clutter/clutter-private.h
@@ -185,7 +185,9 @@ typedef struct
gboolean _clutter_threads_dispatch (gpointer data);
void _clutter_threads_dispatch_free (gpointer data);
+CLUTTER_EXPORT
void _clutter_threads_acquire_lock (void);
+CLUTTER_EXPORT
void _clutter_threads_release_lock (void);
ClutterMainContext * _clutter_context_get_default (void);
@@ -294,6 +296,7 @@ gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *translate_p,
ClutterVertex4 *perspective_p);
+CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h
index b4255a475..35e67d574 100644
--- a/clutter/clutter/clutter-stage-private.h
+++ b/clutter/clutter/clutter-stage-private.h
@@ -41,8 +41,11 @@ void _clutter_stage_paint_view (ClutterStage
const cairo_rectangle_int_t *clip);
void _clutter_stage_emit_after_paint (ClutterStage *stage);
+
+CLUTTER_EXPORT
void _clutter_stage_set_window (ClutterStage *stage,
ClutterStageWindow *stage_window);
+CLUTTER_EXPORT
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
CoglMatrix *projection);
@@ -64,6 +67,7 @@ void _clutter_stage_maybe_relayout (ClutterActor
gboolean _clutter_stage_needs_update (ClutterStage *stage);
gboolean _clutter_stage_do_update (ClutterStage *stage);
+CLUTTER_EXPORT
void _clutter_stage_queue_event (ClutterStage *stage,
ClutterEvent *event,
gboolean copy_event);
@@ -116,8 +120,11 @@ ClutterActor * _clutter_stage_get_touch_drag_actor (ClutterStage *st
void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
ClutterEventSequence *sequence);
+CLUTTER_EXPORT
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
+CLUTTER_EXPORT
gboolean _clutter_stage_is_activated (ClutterStage *stage);
+CLUTTER_EXPORT
gboolean _clutter_stage_update_state (ClutterStage *stage,
ClutterStageState unset_state,
ClutterStageState set_state);
diff --git a/clutter/clutter/clutter-stage-window.h b/clutter/clutter/clutter-stage-window.h
index 389ed0596..b72ffe3d8 100644
--- a/clutter/clutter/clutter-stage-window.h
+++ b/clutter/clutter/clutter-stage-window.h
@@ -92,6 +92,7 @@ void _clutter_stage_window_hide (ClutterStageWin
void _clutter_stage_window_resize (ClutterStageWindow *window,
gint width,
gint height);
+CLUTTER_EXPORT
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
cairo_rectangle_int_t *geometry);
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build
index f8dc4337b..9fa1c4dad 100644
--- a/clutter/clutter/meson.build
+++ b/clutter/clutter/meson.build
@@ -271,21 +271,9 @@ clutter_backend_private_headers = [
if have_x11
clutter_x11_sources = [
'x11/clutter-backend-x11.c',
- 'x11/clutter-device-manager-xi2.c',
- 'x11/clutter-event-x11.c',
- 'x11/clutter-input-device-tool-xi2.c',
- 'x11/clutter-input-device-xi2.c',
- 'x11/clutter-keymap-x11.c',
- 'x11/clutter-stage-x11.c',
- 'x11/clutter-virtual-input-device-x11.c',
]
clutter_backend_sources += clutter_x11_sources
- clutter_x11_nonintrospected_sources = [
- 'x11/clutter-xkb-a11y-x11.c',
- ]
- clutter_backend_nonintrospected_sources += clutter_x11_nonintrospected_sources
-
clutter_x11_headers = [
'x11/clutter-x11.h',
]
@@ -293,14 +281,7 @@ if have_x11
clutter_x11_private_headers = [
'x11/clutter-backend-x11.h',
- 'x11/clutter-device-manager-xi2.h',
- 'x11/clutter-input-device-tool-xi2.h',
- 'x11/clutter-input-device-xi2.h',
- 'x11/clutter-keymap-x11.h',
'x11/clutter-settings-x11.h',
- 'x11/clutter-stage-x11.h',
- 'x11/clutter-virtual-input-device-x11.h',
- 'x11/clutter-xkb-a11y-x11.h',
]
clutter_backend_private_headers += clutter_x11_private_headers
diff --git a/clutter/clutter/x11/clutter-backend-x11.c b/clutter/clutter/x11/clutter-backend-x11.c
index 75b64807e..d8be15aab 100644
--- a/clutter/clutter/x11/clutter-backend-x11.c
+++ b/clutter/clutter/x11/clutter-backend-x11.c
@@ -34,9 +34,7 @@
#include <errno.h>
#include "clutter-backend-x11.h"
-#include "clutter-device-manager-xi2.h"
#include "clutter-settings-x11.h"
-#include "clutter-stage-x11.h"
#include "clutter-x11.h"
#include "xsettings/xsettings-common.h"
@@ -54,7 +52,6 @@
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-settings-private.h"
-#include "clutter-xkb-a11y-x11.h"
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND)
@@ -228,75 +225,6 @@ clutter_backend_x11_xsettings_notify (const char *name,
g_object_thaw_notify (G_OBJECT (settings));
}
-static void
-clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
-{
- ClutterBackend *backend;
-
- if (clutter_enable_xinput)
- {
- int event_base, first_event, first_error;
-
- if (XQueryExtension (backend_x11->xdpy, "XInputExtension",
- &event_base,
- &first_event,
- &first_error))
- {
- int major = 2;
- int minor = 3;
-
- if (XIQueryVersion (backend_x11->xdpy, &major, &minor) != BadRequest)
- {
- CLUTTER_NOTE (BACKEND, "Creating XI2 device manager");
- backend_x11->device_manager =
- g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_XI2,
- "backend", backend_x11,
- "opcode", event_base,
- NULL);
- }
- }
- }
-
- if (backend_x11->device_manager == NULL)
- {
- g_critical ("XI2 extension is missing.");
- }
-
- backend = CLUTTER_BACKEND (backend_x11);
- backend->device_manager = backend_x11->device_manager;
-}
-
-static void
-on_keymap_state_change (ClutterKeymapX11 *keymap_x11,
- gpointer data)
-{
- ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
- ClutterKbdA11ySettings kbd_a11y_settings;
-
- /* On keymaps state change, just reapply the current settings, it'll
- * take care of enabling/disabling mousekeys based on NumLock state.
- */
- clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
- clutter_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
-}
-
-static void
-clutter_backend_x11_create_keymap (ClutterBackendX11 *backend_x11)
-{
- if (backend_x11->keymap == NULL)
- {
- backend_x11->keymap =
- g_object_new (CLUTTER_TYPE_KEYMAP_X11,
- "backend", backend_x11,
- NULL);
-
- g_signal_connect (backend_x11->keymap,
- "state-changed",
- G_CALLBACK (on_keymap_state_change),
- backend_x11->device_manager);
- }
-}
-
static gboolean
clutter_backend_x11_pre_parse (ClutterBackend *backend,
GError **error)
@@ -444,21 +372,6 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
return TRUE;
}
-void
-_clutter_backend_x11_events_init (ClutterBackend *backend)
-{
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
-
- CLUTTER_NOTE (EVENT, "initialising the event loop");
-
- clutter_backend_x11_create_device_manager (backend_x11);
-
- /* register keymap; unless we create a generic Keymap object, I'm
- * afraid this will have to stay
- */
- clutter_backend_x11_create_keymap (backend_x11);
-}
-
static const GOptionEntry entries[] =
{
{
@@ -578,8 +491,6 @@ clutter_backend_x11_translate_event (ClutterBackend *backend,
ClutterEvent *event)
{
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
- ClutterDeviceManagerXI2 *device_manager_x11;
- ClutterStageX11 *stage_x11;
XEvent *xevent = native;
/* X11 filter functions have a higher priority */
@@ -615,19 +526,6 @@ clutter_backend_x11_translate_event (ClutterBackend *backend,
*/
update_last_event_time (backend_x11, xevent);
- if (clutter_keymap_x11_handle_event (backend_x11->keymap,
- native))
- return TRUE;
-
- stage_x11 = CLUTTER_STAGE_X11 (clutter_backend_get_stage_window (backend));
- if (clutter_stage_x11_translate_event (stage_x11, native, event))
- return TRUE;
-
- device_manager_x11 = CLUTTER_DEVICE_MANAGER_XI2 (backend_x11->device_manager);
- if (clutter_device_manager_xi2_translate_event (device_manager_x11,
- native, event))
- return TRUE;
-
return FALSE;
}
@@ -748,45 +646,6 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
return display;
}
-static ClutterStageWindow *
-clutter_backend_x11_create_stage (ClutterBackend *backend,
- ClutterStage *wrapper,
- GError **error)
-{
- ClutterStageWindow *stage;
-
- stage = g_object_new (CLUTTER_TYPE_STAGE_X11,
- "backend", backend,
- "wrapper", wrapper,
- NULL);
-
- CLUTTER_NOTE (BACKEND, "X11 stage created (display:%p, screen:%d, root:%u)",
- CLUTTER_BACKEND_X11 (backend)->xdpy,
- CLUTTER_BACKEND_X11 (backend)->xscreen_num,
- (unsigned int) CLUTTER_BACKEND_X11 (backend)->xwin_root);
-
- return stage;
-}
-
-static PangoDirection
-clutter_backend_x11_get_keymap_direction (ClutterBackend *backend)
-{
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
-
- if (G_UNLIKELY (backend_x11->keymap == NULL))
- return PANGO_DIRECTION_NEUTRAL;
-
- return _clutter_keymap_x11_get_direction (backend_x11->keymap);
-}
-
-static ClutterKeymap *
-clutter_backend_x11_get_keymap (ClutterBackend *backend)
-{
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
-
- return CLUTTER_KEYMAP (backend_x11->keymap);
-}
-
static void
clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
{
@@ -796,8 +655,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
gobject_class->dispose = clutter_backend_x11_dispose;
gobject_class->finalize = clutter_backend_x11_finalize;
- backend_class->create_stage = clutter_backend_x11_create_stage;
-
backend_class->pre_parse = clutter_backend_x11_pre_parse;
backend_class->post_parse = clutter_backend_x11_post_parse;
backend_class->add_options = clutter_backend_x11_add_options;
@@ -807,9 +664,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
backend_class->get_renderer = clutter_backend_x11_get_renderer;
backend_class->get_display = clutter_backend_x11_get_display;
-
- backend_class->get_keymap_direction = clutter_backend_x11_get_keymap_direction;
- backend_class->get_keymap = clutter_backend_x11_get_keymap;
}
static void
diff --git a/clutter/clutter/x11/clutter-backend-x11.h b/clutter/clutter/x11/clutter-backend-x11.h
index eedfe4ea1..4a6bd8d4b 100644
--- a/clutter/clutter/x11/clutter-backend-x11.h
+++ b/clutter/clutter/x11/clutter-backend-x11.h
@@ -30,7 +30,6 @@
#include "clutter-x11.h"
#include "clutter-backend-private.h"
-#include "clutter-keymap-x11.h"
#include "xsettings/xsettings-client.h"
@@ -45,7 +44,6 @@ G_BEGIN_DECLS
typedef struct _ClutterBackendX11 ClutterBackendX11;
typedef struct _ClutterBackendX11Class ClutterBackendX11Class;
-typedef struct _ClutterEventX11 ClutterEventX11;
typedef struct _ClutterX11EventFilter ClutterX11EventFilter;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackendX11, g_object_unref)
@@ -57,16 +55,6 @@ struct _ClutterX11EventFilter
};
-struct _ClutterEventX11
-{
- /* additional fields for Key events */
- gint key_group;
-
- guint key_is_modifier : 1;
- guint num_lock_set : 1;
- guint caps_lock_set : 1;
-};
-
struct _ClutterBackendX11
{
ClutterBackend parent_instance;
@@ -102,8 +90,6 @@ struct _ClutterBackendX11
XSettingsClient *xsettings;
Window xsettings_xwin;
-
- ClutterKeymapX11 *keymap;
};
struct _ClutterBackendX11Class
@@ -116,17 +102,12 @@ GType clutter_backend_x11_get_type (void) G_GNUC_CONST;
ClutterBackend *clutter_backend_x11_new (void);
-void _clutter_backend_x11_events_init (ClutterBackend *backend);
-
/* Private to glx/eglx backends */
+CLUTTER_EXPORT
XVisualInfo * _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11);
void _clutter_x11_select_events (Window xwin);
-ClutterEventX11 * _clutter_event_x11_new (void);
-ClutterEventX11 * _clutter_event_x11_copy (ClutterEventX11 *event_x11);
-void _clutter_event_x11_free (ClutterEventX11 *event_x11);
-
gboolean _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device,
gint stage_root_x,
gint stage_root_y,
diff --git a/clutter/clutter/x11/clutter-x11.h b/clutter/clutter/x11/clutter-x11.h
index b59da81a2..a7de5044b 100644
--- a/clutter/clutter/x11/clutter-x11.h
+++ b/clutter/clutter/x11/clutter-x11.h
@@ -104,9 +104,6 @@ XVisualInfo *clutter_x11_get_visual_info (void);
CLUTTER_EXPORT
void clutter_x11_set_display (Display * xdpy);
-CLUTTER_EXPORT
-Window clutter_x11_get_stage_window (ClutterStage *stage);
-
CLUTTER_EXPORT
void clutter_x11_add_filter (ClutterX11FilterFunc func,
gpointer data);
@@ -114,12 +111,6 @@ CLUTTER_EXPORT
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
gpointer data);
-CLUTTER_EXPORT
-ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent);
-
-CLUTTER_EXPORT
-ClutterStage *clutter_x11_get_stage_from_window (Window win);
-
CLUTTER_EXPORT
gboolean clutter_x11_has_composite_extension (void);
@@ -133,15 +124,6 @@ void clutter_x11_set_use_stereo_stage (gboolean use_stereo);
CLUTTER_EXPORT
gboolean clutter_x11_get_use_stereo_stage (void);
-CLUTTER_EXPORT
-Time clutter_x11_get_current_event_time (void);
-
-CLUTTER_EXPORT
-gint clutter_x11_event_get_key_group (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-guint clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence);
-
G_END_DECLS
#endif /* __CLUTTER_X11_H__ */
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index 655bc54a1..3faae7188 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -45,6 +45,8 @@
#include "backends/meta-idle-monitor-private.h"
#include "backends/meta-stage-private.h"
#include "backends/x11/meta-clutter-backend-x11.h"
+#include "backends/x11/meta-event-x11.h"
+#include "backends/x11/meta-stage-x11.h"
#include "backends/x11/meta-renderer-x11.h"
#include "clutter/clutter.h"
#include "clutter/x11/clutter-x11.h"
@@ -382,7 +384,7 @@ handle_host_xevent (MetaBackend *backend,
if (!bypass_clutter)
{
handle_input_event (x11, event);
- clutter_x11_handle_event (event);
+ meta_x11_handle_event (event);
}
XFreeEventData (priv->xdisplay, &event->xcookie);
@@ -807,7 +809,7 @@ Window
meta_backend_x11_get_xwindow (MetaBackendX11 *x11)
{
ClutterActor *stage = meta_backend_get_stage (META_BACKEND (x11));
- return clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
+ return meta_x11_get_stage_window (CLUTTER_STAGE (stage));
}
void
diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c
index 7732276ad..05af25c90 100644
--- a/src/backends/x11/meta-clutter-backend-x11.c
+++ b/src/backends/x11/meta-clutter-backend-x11.c
@@ -29,7 +29,10 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-renderer.h"
#include "backends/x11/meta-clutter-backend-x11.h"
+#include "backends/x11/meta-device-manager-x11.h"
+#include "backends/x11/meta-keymap-x11.h"
#include "backends/x11/meta-stage-x11-nested.h"
+#include "backends/x11/meta-xkb-a11y-x11.h"
#include "clutter/clutter-mutter.h"
#include "clutter/clutter.h"
#include "core/bell.h"
@@ -38,6 +41,8 @@
struct _MetaClutterBackendX11
{
ClutterBackendX11 parent;
+ MetaKeymapX11 *keymap;
+ MetaDeviceManagerX11 *device_manager;
};
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
@@ -64,7 +69,7 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
if (meta_is_wayland_compositor ())
stage_type = META_TYPE_STAGE_X11_NESTED;
else
- stage_type = CLUTTER_TYPE_STAGE_X11;
+ stage_type = META_TYPE_STAGE_X11;
stage = g_object_new (stage_type,
"backend", backend,
@@ -81,6 +86,116 @@ meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
meta_bell_notify (display, NULL);
}
+static ClutterDeviceManager *
+meta_clutter_backend_x11_get_device_manager (ClutterBackend *backend)
+{
+ MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
+
+ return CLUTTER_DEVICE_MANAGER (backend_x11->device_manager);
+}
+
+static PangoDirection
+meta_clutter_backend_x11_get_keymap_direction (ClutterBackend *backend)
+{
+ ClutterKeymap *keymap = clutter_backend_get_keymap (backend);
+
+ if (G_UNLIKELY (keymap == NULL))
+ return PANGO_DIRECTION_NEUTRAL;
+
+ return meta_keymap_x11_get_direction (META_KEYMAP_X11 (keymap));
+}
+
+static ClutterKeymap *
+meta_clutter_backend_x11_get_keymap (ClutterBackend *backend)
+{
+ MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
+
+ return CLUTTER_KEYMAP (backend_x11->keymap);
+}
+
+static gboolean
+meta_clutter_backend_x11_translate_event (ClutterBackend *backend,
+ gpointer native,
+ ClutterEvent *event)
+{
+ MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
+ MetaDeviceManagerX11 *device_manager_x11;
+ MetaStageX11 *stage_x11;
+ ClutterBackendClass *clutter_backend_class;
+
+ clutter_backend_class =
+ CLUTTER_BACKEND_CLASS (meta_clutter_backend_x11_parent_class);
+ if (clutter_backend_class->translate_event (backend, native, event))
+ return TRUE;
+
+ if (meta_keymap_x11_handle_event (backend_x11->keymap, native))
+ return TRUE;
+
+ stage_x11 = META_STAGE_X11 (clutter_backend_get_stage_window (backend));
+ if (meta_stage_x11_translate_event (stage_x11, native, event))
+ return TRUE;
+
+ device_manager_x11 = META_DEVICE_MANAGER_X11 (backend_x11->device_manager);
+ if (meta_device_manager_x11_translate_event (device_manager_x11,
+ native, event))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+on_keymap_state_change (MetaKeymapX11 *keymap_x11,
+ gpointer data)
+{
+ ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
+ ClutterKbdA11ySettings kbd_a11y_settings;
+
+ /* On keymaps state change, just reapply the current settings, it'll
+ * take care of enabling/disabling mousekeys based on NumLock state.
+ */
+ clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
+ meta_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
+}
+
+static void
+meta_clutter_backend_x11_init_events (ClutterBackend *backend)
+{
+ MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
+ int event_base, first_event, first_error;
+
+ if (XQueryExtension (clutter_x11_get_default_display (),
+ "XInputExtension",
+ &event_base,
+ &first_event,
+ &first_error))
+ {
+ int major = 2;
+ int minor = 3;
+
+ if (XIQueryVersion (clutter_x11_get_default_display (),
+ &major, &minor) != BadRequest)
+ {
+ g_debug ("Creating XI2 device manager");
+ backend_x11->device_manager =
+ g_object_new (META_TYPE_DEVICE_MANAGER_X11,
+ "backend", backend_x11,
+ "opcode", event_base,
+ NULL);
+ }
+ }
+
+ if (!backend_x11->device_manager)
+ g_error ("No XInput 2.3 support");
+
+ backend_x11->keymap = g_object_new (META_TYPE_KEYMAP_X11,
+ "backend", backend_x11,
+ NULL);
+ g_signal_connect (backend_x11->keymap,
+ "state-changed",
+ G_CALLBACK (on_keymap_state_change),
+ backend_x11->device_manager);
+}
+
static void
meta_clutter_backend_x11_init (MetaClutterBackendX11 *clutter_backend_x11)
{
@@ -94,4 +209,9 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
clutter_backend_class->get_renderer = meta_clutter_backend_x11_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage;
clutter_backend_class->bell_notify = meta_clutter_backend_x11_bell_notify;
+ clutter_backend_class->get_device_manager = meta_clutter_backend_x11_get_device_manager;
+ clutter_backend_class->get_keymap_direction = meta_clutter_backend_x11_get_keymap_direction;
+ clutter_backend_class->get_keymap = meta_clutter_backend_x11_get_keymap;
+ clutter_backend_class->translate_event = meta_clutter_backend_x11_translate_event;
+ clutter_backend_class->init_events = meta_clutter_backend_x11_init_events;
}
diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/src/backends/x11/meta-device-manager-x11.c
similarity index 72%
rename from clutter/clutter/x11/clutter-device-manager-xi2.c
rename to src/backends/x11/meta-device-manager-x11.c
index 5128a16b2..339558222 100644
--- a/clutter/clutter/x11/clutter-device-manager-xi2.c
+++ b/src/backends/x11/meta-device-manager-x11.c
@@ -1,8 +1,4 @@
/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
* Copyright © 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
@@ -21,29 +17,25 @@
* Author: Emmanuele Bassi <ebassi linux intel com>
*/
-#include "clutter-build-config.h"
+#include "config.h"
#include <stdint.h>
-
-#include "clutter-device-manager-xi2.h"
-
-#include "clutter-backend-x11.h"
-#include "clutter-input-device-xi2.h"
-#include "clutter-input-device-tool-xi2.h"
-#include "clutter-input-pointer-a11y-private.h"
-#include "clutter-virtual-input-device-x11.h"
-#include "clutter-stage-x11.h"
-
-#include "clutter-backend.h"
-#include "clutter-debug.h"
-#include "clutter-device-manager-private.h"
-#include "clutter-event-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-private.h"
-#include "clutter-xkb-a11y-x11.h"
-
#include <X11/extensions/XInput2.h>
+#include "backends/x11/meta-backend-x11.h"
+#include "backends/x11/meta-device-manager-x11.h"
+#include "backends/x11/meta-event-x11.h"
+#include "backends/x11/meta-input-device-x11.h"
+#include "backends/x11/meta-input-device-tool-x11.h"
+#include "backends/x11/meta-keymap-x11.h"
+#include "backends/x11/meta-stage-x11.h"
+#include "backends/x11/meta-virtual-input-device-x11.h"
+#include "backends/x11/meta-xkb-a11y-x11.h"
+#include "clutter/clutter-mutter.h"
+#include "clutter/x11/clutter-x11.h"
+#include "core/display-private.h"
+#include "meta/meta-x11-errors.h"
+
enum
{
PROP_0,
@@ -96,33 +88,31 @@ enum
static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
-#define clutter_device_manager_xi2_get_type _clutter_device_manager_xi2_get_type
-
-G_DEFINE_TYPE (ClutterDeviceManagerXI2,
- clutter_device_manager_xi2,
+G_DEFINE_TYPE (MetaDeviceManagerX11,
+ meta_device_manager_x11,
CLUTTER_TYPE_DEVICE_MANAGER)
static void
-clutter_device_manager_xi2_copy_event_data (ClutterDeviceManager *device_manager,
- const ClutterEvent *src,
- ClutterEvent *dest)
+meta_device_manager_x11_copy_event_data (ClutterDeviceManager *device_manager,
+ const ClutterEvent *src,
+ ClutterEvent *dest)
{
gpointer event_x11;
event_x11 = _clutter_event_get_platform_data (src);
if (event_x11 != NULL)
- _clutter_event_set_platform_data (dest, _clutter_event_x11_copy (event_x11));
+ _clutter_event_set_platform_data (dest, meta_event_x11_copy (event_x11));
}
static void
-clutter_device_manager_xi2_free_event_data (ClutterDeviceManager *device_manager,
- ClutterEvent *event)
+meta_device_manager_x11_free_event_data (ClutterDeviceManager *device_manager,
+ ClutterEvent *event)
{
gpointer event_x11;
event_x11 = _clutter_event_get_platform_data (event);
if (event_x11 != NULL)
- _clutter_event_x11_free (event_x11);
+ meta_event_x11_free (event_x11);
}
static void
@@ -159,13 +149,12 @@ translate_valuator_class (Display *xdisplay,
class->max,
class->resolution);
- CLUTTER_NOTE (BACKEND,
- "Added axis '%s' (min:%.2f, max:%.2fd, res:%d) of device %d",
- clutter_input_axis_atom_names[axis],
- class->min,
- class->max,
- class->resolution,
- device->id);
+ g_debug ("Added axis '%s' (min:%.2f, max:%.2fd, res:%d) of device %d",
+ clutter_input_axis_atom_names[axis],
+ class->min,
+ class->max,
+ class->resolution,
+ device->id);
}
static void
@@ -214,12 +203,12 @@ translate_device_classes (Display *xdisplay,
else
direction = CLUTTER_SCROLL_RIGHT;
- CLUTTER_NOTE (BACKEND, "Scroll valuator %d: %s, increment: %f",
- scroll_info->number,
- scroll_info->scroll_type == XIScrollTypeVertical
- ? "vertical"
- : "horizontal",
- scroll_info->increment);
+ g_debug ("Scroll valuator %d: %s, increment: %f",
+ scroll_info->number,
+ scroll_info->scroll_type == XIScrollTypeVertical
+ ? "vertical"
+ : "horizontal",
+ scroll_info->increment);
_clutter_input_device_add_scroll_info (device,
scroll_info->number,
@@ -268,8 +257,7 @@ is_touch_device (XIAnyClassInfo **classes,
}
static gboolean
-is_touchpad_device (ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info)
+is_touchpad_device (XIDeviceInfo *info)
{
gulong nitems, bytes_after;
guint32 *data = NULL;
@@ -277,12 +265,12 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
Atom type;
Atom prop;
- prop = XInternAtom (backend_x11->xdpy, "libinput Tapping Enabled", True);
+ prop = XInternAtom (clutter_x11_get_default_display (), "libinput Tapping Enabled", True);
if (prop == None)
return FALSE;
clutter_x11_trap_x_errors ();
- rc = XIGetProperty (backend_x11->xdpy,
+ rc = XIGetProperty (clutter_x11_get_default_display (),
info->deviceid,
prop,
0, 1, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
@@ -299,10 +287,9 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
}
static gboolean
-get_device_ids (ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info,
- gchar **vendor_id,
- gchar **product_id)
+get_device_ids (XIDeviceInfo *info,
+ gchar **vendor_id,
+ gchar **product_id)
{
gulong nitems, bytes_after;
guint32 *data = NULL;
@@ -310,9 +297,9 @@ get_device_ids (ClutterBackendX11 *backend_x11,
Atom type;
clutter_x11_trap_x_errors ();
- rc = XIGetProperty (backend_x11->xdpy,
+ rc = XIGetProperty (clutter_x11_get_default_display (),
info->deviceid,
- XInternAtom (backend_x11->xdpy, "Device Product ID", False),
+ XInternAtom (clutter_x11_get_default_display (), "Device Product ID", False),
0, 2, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
clutter_x11_untrap_x_errors ();
@@ -334,8 +321,7 @@ get_device_ids (ClutterBackendX11 *backend_x11,
}
static gchar *
-get_device_node_path (ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info)
+get_device_node_path (XIDeviceInfo *info)
{
gulong nitems, bytes_after;
guchar *data;
@@ -343,13 +329,13 @@ get_device_node_path (ClutterBackendX11 *backend_x11,
Atom prop, type;
gchar *node_path;
- prop = XInternAtom (backend_x11->xdpy, "Device Node", False);
+ prop = XInternAtom (clutter_x11_get_default_display (), "Device Node", False);
if (prop == None)
return NULL;
clutter_x11_trap_x_errors ();
- rc = XIGetProperty (backend_x11->xdpy,
+ rc = XIGetProperty (clutter_x11_get_default_display (),
info->deviceid, prop, 0, 1024, False,
XA_STRING, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
@@ -402,8 +388,7 @@ get_pad_features (XIDeviceInfo *info,
/* The Wacom driver exports the tool type as property. Use that over
guessing based on the device name */
static gboolean
-guess_source_from_wacom_type (ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info,
+guess_source_from_wacom_type (XIDeviceInfo *info,
ClutterInputDeviceType *source_out)
{
gulong nitems, bytes_after;
@@ -414,19 +399,18 @@ guess_source_from_wacom_type (ClutterBackendX11 *backend_x11,
Atom device_type;
Atom types[N_WACOM_TYPE_ATOMS];
- prop = XInternAtom (backend_x11->xdpy, "Wacom Tool Type", True);
+ prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Tool Type", True);
if (prop == None)
return FALSE;
clutter_x11_trap_x_errors ();
- rc = XIGetProperty (backend_x11->xdpy,
+ rc = XIGetProperty (clutter_x11_get_default_display (),
info->deviceid,
prop,
0, 1, False, XA_ATOM, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
clutter_x11_untrap_x_errors ();
-
if (rc != Success || type != XA_ATOM || format != 32 || nitems != 1)
{
XFree (data);
@@ -439,7 +423,7 @@ guess_source_from_wacom_type (ClutterBackendX11 *backend_x11,
if (device_type == 0)
return FALSE;
- rc = XInternAtoms (backend_x11->xdpy,
+ rc = XInternAtoms (clutter_x11_get_default_display (),
(char **)wacom_type_atoms,
N_WACOM_TYPE_ATOMS,
False,
@@ -480,9 +464,9 @@ guess_source_from_wacom_type (ClutterBackendX11 *backend_x11,
}
static ClutterInputDevice *
-create_device (ClutterDeviceManagerXI2 *manager_xi2,
- ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info)
+create_device (MetaDeviceManagerX11 *manager_xi2,
+ ClutterBackend *backend,
+ XIDeviceInfo *info)
{
ClutterInputDeviceType source, touch_source;
ClutterInputDevice *retval;
@@ -495,7 +479,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
{
source = CLUTTER_KEYBOARD_DEVICE;
}
- else if (is_touchpad_device (backend_x11, info))
+ else if (is_touchpad_device (info))
{
source = CLUTTER_TOUCHPAD_DEVICE;
}
@@ -506,7 +490,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
{
source = touch_source;
}
- else if (!guess_source_from_wacom_type (backend_x11, info, &source))
+ else if (!guess_source_from_wacom_type (info, &source))
{
gchar *name;
@@ -552,8 +536,8 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
if (info->use != XIMasterKeyboard &&
info->use != XIMasterPointer)
{
- get_device_ids (backend_x11, info, &vendor_id, &product_id);
- node_path = get_device_node_path (backend_x11, info);
+ get_device_ids (info, &vendor_id, &product_id);
+ node_path = get_device_node_path (info);
}
if (source == CLUTTER_PAD_DEVICE)
@@ -562,14 +546,14 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
get_pad_features (info, &num_rings, &num_strips);
}
- retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2,
+ retval = g_object_new (META_TYPE_INPUT_DEVICE_X11,
"name", info->name,
"id", info->deviceid,
"has-cursor", (info->use == XIMasterPointer),
"device-manager", manager_xi2,
"device-type", source,
"device-mode", mode,
- "backend", backend_x11,
+ "backend", backend,
"enabled", is_enabled,
"vendor-id", vendor_id,
"product-id", product_id,
@@ -579,23 +563,23 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
"n-mode-groups", MAX (num_rings, num_strips),
NULL);
- translate_device_classes (backend_x11->xdpy, retval,
+ translate_device_classes (clutter_x11_get_default_display (), retval,
info->classes,
info->num_classes);
#ifdef HAVE_LIBWACOM
if (source == CLUTTER_PAD_DEVICE)
- clutter_input_device_xi2_ensure_wacom_info (retval, manager_xi2->wacom_db);
+ meta_input_device_x11_ensure_wacom_info (retval, manager_xi2->wacom_db);
#endif
g_free (vendor_id);
g_free (product_id);
g_free (node_path);
- CLUTTER_NOTE (BACKEND, "Created device '%s' (id: %d, has-cursor: %s)",
- info->name,
- info->deviceid,
- info->use == XIMasterPointer ? "yes" : "no");
+ g_debug ("Created device '%s' (id: %d, has-cursor: %s)",
+ info->name,
+ info->deviceid,
+ info->use == XIMasterPointer ? "yes" : "no");
return retval;
}
@@ -641,14 +625,14 @@ pad_passive_button_grab (ClutterInputDevice *device)
}
static ClutterInputDevice *
-add_device (ClutterDeviceManagerXI2 *manager_xi2,
- ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info,
- gboolean in_construction)
+add_device (MetaDeviceManagerX11 *manager_xi2,
+ ClutterBackend *backend,
+ XIDeviceInfo *info,
+ gboolean in_construction)
{
ClutterInputDevice *device;
- device = create_device (manager_xi2, backend_x11, info);
+ device = create_device (manager_xi2, backend, info);
/* we don't go through the DeviceManager::add_device() vfunc because
* that emits the signal, and we only do it conditionally
@@ -703,8 +687,8 @@ add_device (ClutterDeviceManagerXI2 *manager_xi2,
}
static void
-remove_device (ClutterDeviceManagerXI2 *manager_xi2,
- gint device_id)
+remove_device (MetaDeviceManagerX11 *manager_xi2,
+ gint device_id)
{
ClutterInputDevice *device;
@@ -732,9 +716,9 @@ remove_device (ClutterDeviceManagerXI2 *manager_xi2,
}
static void
-translate_hierarchy_event (ClutterBackendX11 *backend_x11,
- ClutterDeviceManagerXI2 *manager_xi2,
- XIHierarchyEvent *ev)
+translate_hierarchy_event (ClutterBackend *backend,
+ MetaDeviceManagerX11 *manager_xi2,
+ XIHierarchyEvent *ev)
{
int i;
@@ -747,22 +731,22 @@ translate_hierarchy_event (ClutterBackendX11 *backend_x11,
XIDeviceInfo *info;
int n_devices;
- CLUTTER_NOTE (EVENT, "Hierarchy event: device enabled");
+ g_debug ("Hierarchy event: device enabled");
clutter_x11_trap_x_errors ();
- info = XIQueryDevice (backend_x11->xdpy,
+ info = XIQueryDevice (clutter_x11_get_default_display (),
ev->info[i].deviceid,
&n_devices);
clutter_x11_untrap_x_errors ();
if (info != NULL)
{
- add_device (manager_xi2, backend_x11, &info[0], FALSE);
+ add_device (manager_xi2, backend, &info[0], FALSE);
XIFreeDeviceInfo (info);
}
}
else if (ev->info[i].flags & XIDeviceDisabled)
{
- CLUTTER_NOTE (EVENT, "Hierarchy event: device disabled");
+ g_debug ("Hierarchy event: device disabled");
remove_device (manager_xi2, ev->info[i].deviceid);
}
@@ -774,10 +758,10 @@ translate_hierarchy_event (ClutterBackendX11 *backend_x11,
int n_devices;
gboolean send_changed = FALSE;
- CLUTTER_NOTE (EVENT, "Hierarchy event: slave %s",
- (ev->info[i].flags & XISlaveAttached)
- ? "attached"
- : "detached");
+ g_debug ("Hierarchy event: slave %s",
+ (ev->info[i].flags & XISlaveAttached)
+ ? "attached"
+ : "detached");
slave = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (ev->info[i].deviceid));
@@ -796,7 +780,7 @@ translate_hierarchy_event (ClutterBackendX11 *backend_x11,
if (ev->info[i].flags & XISlaveAttached)
{
clutter_x11_trap_x_errors ();
- info = XIQueryDevice (backend_x11->xdpy,
+ info = XIQueryDevice (clutter_x11_get_default_display (),
ev->info[i].deviceid,
&n_devices);
clutter_x11_untrap_x_errors ();
@@ -819,18 +803,20 @@ translate_hierarchy_event (ClutterBackendX11 *backend_x11,
{
ClutterStage *stage = _clutter_input_device_get_stage (master);
if (stage != NULL)
- _clutter_stage_x11_events_device_changed (CLUTTER_STAGE_X11 (_clutter_stage_get_window
(stage)),
- master,
- CLUTTER_DEVICE_MANAGER (manager_xi2));
+ {
+ meta_stage_x11_events_device_changed (META_STAGE_X11 (_clutter_stage_get_window (stage)),
+ master,
+ CLUTTER_DEVICE_MANAGER (manager_xi2));
+ }
}
}
}
}
static void
-clutter_device_manager_xi2_select_events (ClutterDeviceManager *manager,
- Window xwindow,
- XIEventMask *event_mask)
+meta_device_manager_x11_select_events (ClutterDeviceManager *manager,
+ Window xwindow,
+ XIEventMask *event_mask)
{
Display *xdisplay;
@@ -840,8 +826,8 @@ clutter_device_manager_xi2_select_events (ClutterDeviceManager *manager,
}
static ClutterStage *
-get_event_stage (ClutterDeviceManagerXI2 *manager_xi2,
- XIEvent *xi_event)
+get_event_stage (MetaDeviceManagerX11 *manager_xi2,
+ XIEvent *xi_event)
{
Window xwindow = None;
@@ -880,7 +866,7 @@ get_event_stage (ClutterDeviceManagerXI2 *manager_xi2,
if (xwindow == None)
return NULL;
- return clutter_x11_get_stage_from_window (xwindow);
+ return meta_x11_get_stage_from_window (xwindow);
}
/*
@@ -1030,11 +1016,11 @@ translate_pad_axis (ClutterInputDevice *device,
}
static void
-translate_coords (ClutterStageX11 *stage_x11,
- gdouble event_x,
- gdouble event_y,
- gfloat *x_out,
- gfloat *y_out)
+translate_coords (MetaStageX11 *stage_x11,
+ gdouble event_x,
+ gdouble event_y,
+ gfloat *x_out,
+ gfloat *y_out)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
ClutterActor *stage = CLUTTER_ACTOR (stage_cogl->wrapper);
@@ -1093,17 +1079,15 @@ scroll_valuators_changed (ClutterInputDevice *device,
}
static void
-clutter_device_manager_xi2_select_stage_events (ClutterDeviceManager *manager,
- ClutterStage *stage)
+meta_device_manager_x11_select_stage_events (ClutterDeviceManager *manager,
+ ClutterStage *stage)
{
- ClutterBackendX11 *backend_x11;
- ClutterStageX11 *stage_x11;
+ MetaStageX11 *stage_x11;
XIEventMask xi_event_mask;
unsigned char *mask;
int len;
- backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
- stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
+ stage_x11 = META_STAGE_X11 (_clutter_stage_get_window (stage));
len = XIMaskLen (XI_LASTEVENT);
mask = g_new0 (unsigned char, len);
@@ -1124,14 +1108,14 @@ clutter_device_manager_xi2_select_stage_events (ClutterDeviceManager *manager,
xi_event_mask.mask = mask;
xi_event_mask.mask_len = len;
- XISelectEvents (backend_x11->xdpy, stage_x11->xwin, &xi_event_mask, 1);
+ XISelectEvents (clutter_x11_get_default_display (),
+ stage_x11->xwin, &xi_event_mask, 1);
g_free (mask);
}
static guint
-device_get_tool_serial (ClutterBackendX11 *backend_x11,
- ClutterInputDevice *device)
+device_get_tool_serial (ClutterInputDevice *device)
{
gulong nitems, bytes_after;
guint32 *data = NULL;
@@ -1140,12 +1124,12 @@ device_get_tool_serial (ClutterBackendX11 *backend_x11,
Atom type;
Atom prop;
- prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
+ prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Serial IDs", True);
if (prop == None)
return 0;
clutter_x11_trap_x_errors ();
- rc = XIGetProperty (backend_x11->xdpy,
+ rc = XIGetProperty (clutter_x11_get_default_display (),
clutter_input_device_get_device_id (device),
prop, 0, 4, FALSE, XA_INTEGER, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
@@ -1160,12 +1144,11 @@ device_get_tool_serial (ClutterBackendX11 *backend_x11,
}
static void
-handle_property_event (ClutterDeviceManagerXI2 *manager_xi2,
- XIEvent *event)
+handle_property_event (MetaDeviceManagerX11 *manager_xi2,
+ XIEvent *event)
{
XIPropertyEvent *xev = (XIPropertyEvent *) event;
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
- Atom serial_ids_prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
+ Atom serial_ids_prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Serial IDs", True);
ClutterInputDevice *device;
device = g_hash_table_lookup (manager_xi2->devices_by_id,
@@ -1179,7 +1162,7 @@ handle_property_event (ClutterDeviceManagerXI2 *manager_xi2,
ClutterInputDeviceToolType type;
guint serial_id;
- serial_id = device_get_tool_serial (backend_x11, device);
+ serial_id = device_get_tool_serial (device);
if (serial_id != 0)
{
@@ -1189,14 +1172,14 @@ handle_property_event (ClutterDeviceManagerXI2 *manager_xi2,
{
type = clutter_input_device_get_device_type (device) == CLUTTER_ERASER_DEVICE ?
CLUTTER_INPUT_DEVICE_TOOL_ERASER : CLUTTER_INPUT_DEVICE_TOOL_PEN;
- tool = clutter_input_device_tool_xi2_new (serial_id, type);
+ tool = meta_input_device_tool_x11_new (serial_id, type);
g_hash_table_insert (manager_xi2->tools_by_serial,
GUINT_TO_POINTER (serial_id),
tool);
}
}
- clutter_input_device_xi2_update_tool (device, tool);
+ meta_input_device_x11_update_tool (device, tool);
g_signal_emit_by_name (manager_xi2, "tool-changed", device, tool);
}
}
@@ -1222,7 +1205,7 @@ translate_pad_event (ClutterEvent *event,
value = -1;
#ifdef HAVE_LIBWACOM
- mode = clutter_input_device_xi2_get_pad_group_mode (device, number);
+ mode = meta_input_device_x11_get_pad_group_mode (device, number);
#endif
if (event->any.type == CLUTTER_PAD_RING)
@@ -1242,22 +1225,22 @@ translate_pad_event (ClutterEvent *event,
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, device);
- CLUTTER_NOTE (EVENT,
- "%s: win:0x%x, device:%d '%s', time:%d "
- "(value:%f)",
- event->any.type == CLUTTER_PAD_RING
- ? "pad ring "
- : "pad strip",
- (unsigned int) xev->event,
- device->id,
- device->device_name,
- event->any.time, value);
+ g_debug ("%s: win:0x%x, device:%d '%s', time:%d "
+ "(value:%f)",
+ event->any.type == CLUTTER_PAD_RING
+ ? "pad ring "
+ : "pad strip",
+ (unsigned int) xev->event,
+ device->id,
+ device->device_name,
+ event->any.time, value);
+
return TRUE;
}
static void
-handle_raw_event (ClutterDeviceManagerXI2 *manager_xi2,
- XEvent *xevent)
+handle_raw_event (MetaDeviceManagerX11 *manager_xi2,
+ XEvent *xevent)
{
ClutterInputDevice *device;
XGenericEventCookie *cookie;
@@ -1280,28 +1263,27 @@ handle_raw_event (ClutterDeviceManagerXI2 *manager_xi2,
switch (cookie->evtype)
{
case XI_RawMotion:
- CLUTTER_NOTE (EVENT,
- "raw motion: device:%d '%s'",
- device->id,
- device->device_name);
+ g_debug ("raw motion: device:%d '%s'",
+ device->id,
+ device->device_name);
+
/* We don't get actual pointer location with raw events, and we cannot
* rely on `clutter_input_device_get_coords()` either because of
* unreparented toplevels (like all client-side decoration windows),
* so we need to explicitely query the pointer here...
*/
- if (clutter_input_device_xi2_get_pointer_location (device, &x, &y))
+ if (meta_input_device_x11_get_pointer_location (device, &x, &y))
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
break;
case XI_RawButtonPress:
case XI_RawButtonRelease:
- CLUTTER_NOTE (EVENT,
- "raw button %s: device:%d '%s' button %i",
- cookie->evtype == XI_RawButtonPress
- ? "press "
- : "release",
- device->id,
- device->device_name,
- xev->detail);
+ g_debug ("raw button %s: device:%d '%s' button %i",
+ cookie->evtype == XI_RawButtonPress
+ ? "press "
+ : "release",
+ device->id,
+ device->device_name,
+ xev->detail);
_clutter_input_pointer_a11y_on_button_event (device,
xev->detail,
(cookie->evtype == XI_RawButtonPress));
@@ -1310,20 +1292,18 @@ handle_raw_event (ClutterDeviceManagerXI2 *manager_xi2,
}
gboolean
-clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2,
- XEvent *xevent,
- ClutterEvent *event)
+meta_device_manager_x11_translate_event (MetaDeviceManagerX11 *manager_xi2,
+ XEvent *xevent,
+ ClutterEvent *event)
{
gboolean retval = FALSE;
- ClutterBackendX11 *backend_x11;
- ClutterStageX11 *stage_x11 = NULL;
+ ClutterBackend *backend = clutter_get_default_backend ();
+ MetaStageX11 *stage_x11 = NULL;
ClutterStage *stage = NULL;
ClutterInputDevice *device, *source_device;
XGenericEventCookie *cookie;
XIEvent *xi_event;
- backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
-
cookie = &xevent->xcookie;
if (cookie->type != GenericEvent ||
@@ -1351,7 +1331,7 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return FALSE;
else
- stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
+ stage_x11 = META_STAGE_X11 (_clutter_stage_get_window (stage));
}
event->any.stage = stage;
@@ -1362,7 +1342,7 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
{
XIHierarchyEvent *xev = (XIHierarchyEvent *) xi_event;
- translate_hierarchy_event (backend_x11, manager_xi2, xev);
+ translate_hierarchy_event (backend, manager_xi2, xev);
}
retval = FALSE;
break;
@@ -1378,7 +1358,7 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
if (device)
{
_clutter_input_device_reset_axes (device);
- translate_device_classes (backend_x11->xdpy,
+ translate_device_classes (clutter_x11_get_default_display (),
device,
xev->classes,
xev->num_classes);
@@ -1394,7 +1374,8 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
case XI_KeyRelease:
{
XIDeviceEvent *xev = (XIDeviceEvent *) xi_event;
- ClutterEventX11 *event_x11;
+ MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (clutter_backend_get_keymap (backend));
+ MetaEventX11 *event_x11;
char buffer[7] = { 0, };
gunichar n;
@@ -1407,30 +1388,30 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->key.time = xev->time;
event->key.stage = stage;
- _clutter_input_device_xi2_translate_state (event, &xev->mods, &xev->buttons, &xev->group);
+ meta_input_device_x11_translate_state (event, &xev->mods, &xev->buttons, &xev->group);
event->key.hardware_keycode = xev->detail;
/* keyval is the key ignoring all modifiers ('1' vs. '!') */
event->key.keyval =
- _clutter_keymap_x11_translate_key_state (backend_x11->keymap,
- event->key.hardware_keycode,
- &event->key.modifier_state,
- NULL);
+ meta_keymap_x11_translate_key_state (keymap_x11,
+ event->key.hardware_keycode,
+ &event->key.modifier_state,
+ NULL);
/* KeyEvents have platform specific data associated to them */
- event_x11 = _clutter_event_x11_new ();
+ event_x11 = meta_event_x11_new ();
_clutter_event_set_platform_data (event, event_x11);
event_x11->key_group =
- _clutter_keymap_x11_get_key_group (backend_x11->keymap,
- event->key.modifier_state);
+ meta_keymap_x11_get_key_group (keymap_x11,
+ event->key.modifier_state);
event_x11->key_is_modifier =
- _clutter_keymap_x11_get_is_modifier (backend_x11->keymap,
- event->key.hardware_keycode);
+ meta_keymap_x11_get_is_modifier (keymap_x11,
+ event->key.hardware_keycode);
event_x11->num_lock_set =
- clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
+ clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (keymap_x11));
event_x11->caps_lock_set =
- clutter_keymap_get_caps_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
+ clutter_keymap_get_caps_lock_state (CLUTTER_KEYMAP (keymap_x11));
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
@@ -1455,19 +1436,18 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->key.unicode_value = (gunichar) '\0';
}
- CLUTTER_NOTE (EVENT,
- "%s: win:0x%x device:%d source:%d, key: %12s (%d)",
- event->any.type == CLUTTER_KEY_PRESS
- ? "key press "
- : "key release",
- (unsigned int) stage_x11->xwin,
- xev->deviceid,
- xev->sourceid,
- event->key.keyval ? buffer : "(none)",
- event->key.keyval);
+ g_debug ("%s: win:0x%x device:%d source:%d, key: %12s (%d)",
+ event->any.type == CLUTTER_KEY_PRESS
+ ? "key press "
+ : "key release",
+ (unsigned int) stage_x11->xwin,
+ xev->deviceid,
+ xev->sourceid,
+ event->key.keyval ? buffer : "(none)",
+ event->key.keyval);
if (xi_event->evtype == XI_KeyPress)
- _clutter_stage_x11_set_user_time (stage_x11, event->key.time);
+ meta_stage_x11_set_user_time (stage_x11, event->key.time);
retval = TRUE;
}
@@ -1524,27 +1504,25 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
/* Pad buttons are 0-indexed */
event->pad_button.button = xev->detail - 1;
#ifdef HAVE_LIBWACOM
- clutter_input_device_xi2_update_pad_state (device,
- event->pad_button.button,
- (xi_event->evtype == XI_ButtonPress),
- &event->pad_button.group,
- &event->pad_button.mode);
+ meta_input_device_x11_update_pad_state (device,
+ event->pad_button.button,
+ (xi_event->evtype == XI_ButtonPress),
+ &event->pad_button.group,
+ &event->pad_button.mode);
#endif
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
- CLUTTER_NOTE (EVENT,
- "%s: win:0x%x, device:%d '%s', time:%d "
- "(button:%d)",
- event->any.type == CLUTTER_BUTTON_PRESS
- ? "pad button press "
- : "pad button release",
- (unsigned int) stage_x11->xwin,
- device->id,
- device->device_name,
- event->any.time,
- event->pad_button.button);
-
+ g_debug ("%s: win:0x%x, device:%d '%s', time:%d "
+ "(button:%d)",
+ event->any.type == CLUTTER_BUTTON_PRESS
+ ? "pad button press "
+ : "pad button release",
+ (unsigned int) stage_x11->xwin,
+ device->id,
+ device->device_name,
+ event->any.time,
+ event->pad_button.button);
retval = TRUE;
break;
}
@@ -1574,10 +1552,10 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->scroll.time = xev->time;
translate_coords (stage_x11, xev->event_x, xev->event_y, &event->scroll.x, &event->scroll.y);
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
@@ -1586,25 +1564,22 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->scroll.x,
event->scroll.y,
&xev->valuators);
-
- CLUTTER_NOTE (EVENT,
- "scroll: win:0x%x, device:%d '%s', time:%d "
- "(direction:%s, "
- "x:%.2f, y:%.2f, "
- "emulated:%s)",
- (unsigned int) stage_x11->xwin,
- device->id,
- device->device_name,
- event->any.time,
- event->scroll.direction == CLUTTER_SCROLL_UP ? "up" :
- event->scroll.direction == CLUTTER_SCROLL_DOWN ? "down" :
- event->scroll.direction == CLUTTER_SCROLL_LEFT ? "left" :
- event->scroll.direction == CLUTTER_SCROLL_RIGHT ? "right" :
- "invalid",
- event->scroll.x,
- event->scroll.y,
- (xev->flags & XIPointerEmulated) ? "yes" : "no"
- );
+ g_debug ("scroll: win:0x%x, device:%d '%s', time:%d "
+ "(direction:%s, "
+ "x:%.2f, y:%.2f, "
+ "emulated:%s)",
+ (unsigned int) stage_x11->xwin,
+ device->id,
+ device->device_name,
+ event->any.time,
+ event->scroll.direction == CLUTTER_SCROLL_UP ? "up" :
+ event->scroll.direction == CLUTTER_SCROLL_DOWN ? "down" :
+ event->scroll.direction == CLUTTER_SCROLL_LEFT ? "left" :
+ event->scroll.direction == CLUTTER_SCROLL_RIGHT ? "right" :
+ "invalid",
+ event->scroll.x,
+ event->scroll.y,
+ (xev->flags & XIPointerEmulated) ? "yes" : "no");
break;
default:
@@ -1617,40 +1592,37 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->button.time = xev->time;
translate_coords (stage_x11, xev->event_x, xev->event_y, &event->button.x, &event->button.y);
event->button.button = xev->detail;
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
clutter_event_set_device_tool (event,
- clutter_input_device_xi2_get_current_tool (source_device));
+ meta_input_device_x11_get_current_tool (source_device));
event->button.axes = translate_axes (event->button.device,
event->button.x,
event->button.y,
&xev->valuators);
-
- CLUTTER_NOTE (EVENT,
- "%s: win:0x%x, device:%d '%s', time:%d "
- "(button:%d, "
- "x:%.2f, y:%.2f, "
- "axes:%s, "
- "emulated:%s)",
- event->any.type == CLUTTER_BUTTON_PRESS
- ? "button press "
- : "button release",
- (unsigned int) stage_x11->xwin,
- device->id,
- device->device_name,
- event->any.time,
- event->button.button,
- event->button.x,
- event->button.y,
- event->button.axes != NULL ? "yes" : "no",
- (xev->flags & XIPointerEmulated) ? "yes" : "no"
- );
+ g_debug ("%s: win:0x%x, device:%d '%s', time:%d "
+ "(button:%d, "
+ "x:%.2f, y:%.2f, "
+ "axes:%s, "
+ "emulated:%s)",
+ event->any.type == CLUTTER_BUTTON_PRESS
+ ? "button press "
+ : "button release",
+ (unsigned int) stage_x11->xwin,
+ device->id,
+ device->device_name,
+ event->any.time,
+ event->button.button,
+ event->button.x,
+ event->button.y,
+ event->button.axes != NULL ? "yes" : "no",
+ (xev->flags & XIPointerEmulated) ? "yes" : "no");
break;
}
@@ -1661,7 +1633,7 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
_clutter_event_set_pointer_emulated (event, TRUE);
if (xi_event->evtype == XI_ButtonPress)
- _clutter_stage_x11_set_user_time (stage_x11, event->button.time);
+ meta_stage_x11_set_user_time (stage_x11, event->button.time);
retval = TRUE;
}
@@ -1702,23 +1674,22 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->scroll.stage = stage;
event->scroll.time = xev->time;
translate_coords (stage_x11, xev->event_x, xev->event_y, &event->scroll.x, &event->scroll.y);
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
clutter_event_set_scroll_delta (event, delta_x, delta_y);
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
- CLUTTER_NOTE (EVENT,
- "smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)",
- (unsigned int) stage_x11->xwin,
- event->scroll.device->id,
- event->scroll.device->device_name,
- event->scroll.x,
- event->scroll.y,
- delta_x, delta_y);
+ g_debug ("smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)",
+ (unsigned int) stage_x11->xwin,
+ event->scroll.device->id,
+ event->scroll.device->device_name,
+ event->scroll.x,
+ event->scroll.y,
+ delta_x, delta_y);
retval = TRUE;
break;
@@ -1730,15 +1701,15 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->motion.time = xev->time;
translate_coords (stage_x11, xev->event_x, xev->event_y, &event->motion.x, &event->motion.y);
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
clutter_event_set_device_tool (event,
- clutter_input_device_xi2_get_current_tool (source_device));
+ meta_input_device_x11_get_current_tool (source_device));
event->motion.axes = translate_axes (event->motion.device,
event->motion.x,
@@ -1751,13 +1722,13 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
if (xev->flags & XIPointerEmulated)
_clutter_event_set_pointer_emulated (event, TRUE);
- CLUTTER_NOTE (EVENT, "motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
- (unsigned int) stage_x11->xwin,
- event->motion.device->id,
- event->motion.device->device_name,
- event->motion.x,
- event->motion.y,
- event->motion.axes != NULL ? "yes" : "no");
+ g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
+ (unsigned int) stage_x11->xwin,
+ event->motion.device->id,
+ event->motion.device->device_name,
+ event->motion.x,
+ event->motion.y,
+ event->motion.axes != NULL ? "yes" : "no");
retval = TRUE;
}
@@ -1787,10 +1758,10 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->touch.stage = stage;
event->touch.time = xev->time;
translate_coords (stage_x11, xev->event_x, xev->event_y, &event->touch.x, &event->touch.y);
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
clutter_event_set_source_device (event, source_device);
@@ -1807,7 +1778,7 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
{
event->touch.modifier_state |= CLUTTER_BUTTON1_MASK;
- _clutter_stage_x11_set_user_time (stage_x11, event->touch.time);
+ meta_stage_x11_set_user_time (stage_x11, event->touch.time);
}
event->touch.sequence = GUINT_TO_POINTER (xev->detail);
@@ -1815,15 +1786,15 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE);
- CLUTTER_NOTE (EVENT, "touch %s: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
- event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
- (unsigned int) stage_x11->xwin,
- event->touch.device->id,
- event->touch.device->device_name,
- GPOINTER_TO_UINT (event->touch.sequence),
- event->touch.x,
- event->touch.y,
- event->touch.axes != NULL ? "yes" : "no");
+ g_debug ("touch %s: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
+ event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
+ (unsigned int) stage_x11->xwin,
+ event->touch.device->id,
+ event->touch.device->device_name,
+ GPOINTER_TO_UINT (event->touch.sequence),
+ event->touch.x,
+ event->touch.y,
+ event->touch.axes != NULL ? "yes" : "no");
retval = TRUE;
}
@@ -1853,23 +1824,23 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
event->motion.y,
&xev->valuators);
- _clutter_input_device_xi2_translate_state (event,
- &xev->mods,
- &xev->buttons,
- &xev->group);
+ meta_input_device_x11_translate_state (event,
+ &xev->mods,
+ &xev->buttons,
+ &xev->group);
event->touch.modifier_state |= CLUTTER_BUTTON1_MASK;
if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE);
- CLUTTER_NOTE (EVENT, "touch update: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
- (unsigned int) stage_x11->xwin,
- event->touch.device->id,
- event->touch.device->device_name,
- GPOINTER_TO_UINT (event->touch.sequence),
- event->touch.x,
- event->touch.y,
- event->touch.axes != NULL ? "yes" : "no");
+ g_debug ("touch update: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
+ (unsigned int) stage_x11->xwin,
+ event->touch.device->id,
+ event->touch.device->device_name,
+ GPOINTER_TO_UINT (event->touch.sequence),
+ event->touch.x,
+ event->touch.y,
+ event->touch.axes != NULL ? "yes" : "no");
retval = TRUE;
}
@@ -1903,10 +1874,8 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
{
if (device->stage == NULL)
{
- CLUTTER_NOTE (EVENT,
- "Discarding Leave for ButtonRelease "
- "event off-stage");
-
+ g_debug ("Discarding Leave for ButtonRelease "
+ "event off-stage");
retval = FALSE;
break;
}
@@ -1946,23 +1915,23 @@ clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2
}
static void
-clutter_device_manager_xi2_add_device (ClutterDeviceManager *manager,
- ClutterInputDevice *device)
+meta_device_manager_x11_add_device (ClutterDeviceManager *manager,
+ ClutterInputDevice *device)
{
/* XXX implement */
}
static void
-clutter_device_manager_xi2_remove_device (ClutterDeviceManager *manager,
- ClutterInputDevice *device)
+meta_device_manager_x11_remove_device (ClutterDeviceManager *manager,
+ ClutterInputDevice *device)
{
/* XXX implement */
}
static const GSList *
-clutter_device_manager_xi2_get_devices (ClutterDeviceManager *manager)
+meta_device_manager_x11_get_devices (ClutterDeviceManager *manager)
{
- ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (manager);
+ MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (manager);
GSList *all_devices = NULL;
GList *l;
@@ -1981,20 +1950,20 @@ clutter_device_manager_xi2_get_devices (ClutterDeviceManager *manager)
}
static ClutterInputDevice *
-clutter_device_manager_xi2_get_device (ClutterDeviceManager *manager,
- gint id)
+meta_device_manager_x11_get_device (ClutterDeviceManager *manager,
+ gint id)
{
- ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (manager);
+ MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (manager);
return g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (id));
}
static ClutterInputDevice *
-clutter_device_manager_xi2_get_core_device (ClutterDeviceManager *manager,
- ClutterInputDeviceType device_type)
+meta_device_manager_x11_get_core_device (ClutterDeviceManager *manager,
+ ClutterInputDeviceType device_type)
{
- ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (manager);
+ MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (manager);
ClutterInputDevice *pointer = NULL;
GList *l;
@@ -2031,7 +2000,7 @@ relate_masters (gpointer key,
gpointer value,
gpointer data)
{
- ClutterDeviceManagerXI2 *manager_xi2 = data;
+ MetaDeviceManagerX11 *manager_xi2 = data;
ClutterInputDevice *device, *relative;
device = g_hash_table_lookup (manager_xi2->devices_by_id, key);
@@ -2046,7 +2015,7 @@ relate_slaves (gpointer key,
gpointer value,
gpointer data)
{
- ClutterDeviceManagerXI2 *manager_xi2 = data;
+ MetaDeviceManagerX11 *manager_xi2 = data;
ClutterInputDevice *master, *slave;
slave = g_hash_table_lookup (manager_xi2->devices_by_id, key);
@@ -2057,24 +2026,22 @@ relate_slaves (gpointer key,
}
static void
-clutter_device_manager_xi2_constructed (GObject *gobject)
+meta_device_manager_x11_constructed (GObject *object)
{
- ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (gobject);
- ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (gobject);
- ClutterBackendX11 *backend_x11;
+ MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
+ ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (object);
+ ClutterBackend *backend = clutter_get_default_backend ();
GHashTable *masters, *slaves;
XIDeviceInfo *info;
XIEventMask event_mask;
unsigned char mask[(XI_LASTEVENT + 7) / 8] = { 0, };
int n_devices, i;
- backend_x11 =
- CLUTTER_BACKEND_X11 (_clutter_device_manager_get_backend (manager));
-
masters = g_hash_table_new (NULL, NULL);
slaves = g_hash_table_new (NULL, NULL);
- info = XIQueryDevice (backend_x11->xdpy, XIAllDevices, &n_devices);
+ info = XIQueryDevice (clutter_x11_get_default_display (),
+ XIAllDevices, &n_devices);
for (i = 0; i < n_devices; i++)
{
@@ -2083,7 +2050,7 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
if (!xi_device->enabled)
continue;
- add_device (manager_xi2, backend_x11, xi_device, TRUE);
+ add_device (manager_xi2, backend, xi_device, TRUE);
if (xi_device->use == XIMasterPointer ||
xi_device->use == XIMasterKeyboard)
@@ -2117,9 +2084,9 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
event_mask.mask_len = sizeof (mask);
event_mask.mask = mask;
- clutter_device_manager_xi2_select_events (manager,
- clutter_x11_get_root_window (),
- &event_mask);
+ meta_device_manager_x11_select_events (manager,
+ clutter_x11_get_root_window (),
+ &event_mask);
memset(mask, 0, sizeof (mask));
XISetMask (mask, XI_RawMotion);
@@ -2130,25 +2097,25 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
event_mask.mask_len = sizeof (mask);
event_mask.mask = mask;
- clutter_device_manager_xi2_select_events (manager,
- clutter_x11_get_root_window (),
- &event_mask);
+ meta_device_manager_x11_select_events (manager,
+ clutter_x11_get_root_window (),
+ &event_mask);
- XSync (backend_x11->xdpy, False);
+ XSync (clutter_x11_get_default_display (), False);
- clutter_device_manager_x11_a11y_init (manager);
+ meta_device_manager_x11_a11y_init (manager);
- if (G_OBJECT_CLASS (clutter_device_manager_xi2_parent_class)->constructed)
- G_OBJECT_CLASS (clutter_device_manager_xi2_parent_class)->constructed (gobject);
+ if (G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed)
+ G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed (object);
}
static void
-clutter_device_manager_xi2_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+meta_device_manager_x11_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (gobject);
+ MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
switch (prop_id)
{
@@ -2157,30 +2124,30 @@ clutter_device_manager_xi2_set_property (GObject *gobject,
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static ClutterVirtualInputDevice *
-clutter_device_manager_xi2_create_virtual_device (ClutterDeviceManager *manager,
- ClutterInputDeviceType device_type)
+meta_device_manager_x11_create_virtual_device (ClutterDeviceManager *manager,
+ ClutterInputDeviceType device_type)
{
- return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11,
+ return g_object_new (META_TYPE_VIRTUAL_INPUT_DEVICE_X11,
"device-manager", manager,
"device-type", device_type,
NULL);
}
static ClutterVirtualDeviceType
-clutter_device_manager_xi2_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
+meta_device_manager_x11_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
{
return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD |
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER);
}
static void
-clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass)
+meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
{
ClutterDeviceManagerClass *manager_class;
GObjectClass *gobject_class;
@@ -2191,30 +2158,30 @@ clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass)
"The XI2 opcode",
-1, G_MAXINT,
-1,
- CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->constructed = clutter_device_manager_xi2_constructed;
- gobject_class->set_property = clutter_device_manager_xi2_set_property;
+ gobject_class->constructed = meta_device_manager_x11_constructed;
+ gobject_class->set_property = meta_device_manager_x11_set_property;
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
- manager_class->add_device = clutter_device_manager_xi2_add_device;
- manager_class->remove_device = clutter_device_manager_xi2_remove_device;
- manager_class->get_devices = clutter_device_manager_xi2_get_devices;
- manager_class->get_core_device = clutter_device_manager_xi2_get_core_device;
- manager_class->get_device = clutter_device_manager_xi2_get_device;
- manager_class->select_stage_events = clutter_device_manager_xi2_select_stage_events;
- manager_class->create_virtual_device = clutter_device_manager_xi2_create_virtual_device;
- manager_class->get_supported_virtual_device_types =
clutter_device_manager_xi2_get_supported_virtual_device_types;
- manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings;
- manager_class->copy_event_data = clutter_device_manager_xi2_copy_event_data;
- manager_class->free_event_data = clutter_device_manager_xi2_free_event_data;
+ manager_class->add_device = meta_device_manager_x11_add_device;
+ manager_class->remove_device = meta_device_manager_x11_remove_device;
+ manager_class->get_devices = meta_device_manager_x11_get_devices;
+ manager_class->get_core_device = meta_device_manager_x11_get_core_device;
+ manager_class->get_device = meta_device_manager_x11_get_device;
+ manager_class->select_stage_events = meta_device_manager_x11_select_stage_events;
+ manager_class->create_virtual_device = meta_device_manager_x11_create_virtual_device;
+ manager_class->get_supported_virtual_device_types =
meta_device_manager_x11_get_supported_virtual_device_types;
+ manager_class->apply_kbd_a11y_settings = meta_device_manager_x11_apply_kbd_a11y_settings;
+ manager_class->copy_event_data = meta_device_manager_x11_copy_event_data;
+ manager_class->free_event_data = meta_device_manager_x11_free_event_data;
}
static void
-clutter_device_manager_xi2_init (ClutterDeviceManagerXI2 *self)
+meta_device_manager_x11_init (MetaDeviceManagerX11 *self)
{
self->devices_by_id = g_hash_table_new_full (NULL, NULL,
NULL,
diff --git a/src/backends/x11/meta-device-manager-x11.h b/src/backends/x11/meta-device-manager-x11.h
new file mode 100644
index 000000000..4bf762cdd
--- /dev/null
+++ b/src/backends/x11/meta-device-manager-x11.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2011 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Emmanuele Bassi <ebassi linux intel com>
+ */
+
+#ifndef META_DEVICE_MANAGER_X11_H
+#define META_DEVICE_MANAGER_X11_H
+
+#include <clutter/clutter.h>
+
+#ifdef HAVE_LIBWACOM
+#include <libwacom/libwacom.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define META_TYPE_DEVICE_MANAGER_X11 (meta_device_manager_x11_get_type ())
+G_DECLARE_FINAL_TYPE (MetaDeviceManagerX11, meta_device_manager_x11,
+ META, DEVICE_MANAGER_X11, ClutterDeviceManager)
+
+struct _MetaDeviceManagerX11
+{
+ ClutterDeviceManager parent_instance;
+
+ GHashTable *devices_by_id;
+ GHashTable *tools_by_serial;
+
+ GSList *all_devices;
+
+ GList *master_devices;
+ GList *slave_devices;
+
+ int opcode;
+
+#ifdef HAVE_LIBWACOM
+ WacomDeviceDatabase *wacom_db;
+#endif
+};
+
+gboolean meta_device_manager_x11_translate_event (MetaDeviceManagerX11 *manager_xi2,
+ XEvent *xevent,
+ ClutterEvent *event);
+
+G_END_DECLS
+
+#endif /* META_DEVICE_MANAGER_X11_H */
diff --git a/clutter/clutter/x11/clutter-event-x11.c b/src/backends/x11/meta-event-x11.c
similarity index 59%
rename from clutter/clutter/x11/clutter-event-x11.c
rename to src/backends/x11/meta-event-x11.c
index 9396ecee4..8b4f4fc81 100644
--- a/clutter/clutter/x11/clutter-event-x11.c
+++ b/src/backends/x11/meta-event-x11.c
@@ -1,7 +1,4 @@
-/* Clutter.
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
+/* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
* Copyright (C) 2009, 2010 Intel Corp.
*
* This library is free software; you can redistribute it and/or
@@ -24,69 +21,39 @@
* Emmanuele Bassi <ebassi linux intel com>
*/
-#include "clutter-build-config.h"
-
-#include "clutter-backend-x11.h"
-#include "clutter-x11.h"
-
-#include "clutter-backend-private.h"
-#include "clutter-debug.h"
-#include "clutter-event-private.h"
-#include "clutter-main.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
+#include "config.h"
+#include <glib.h>
#include <string.h>
-#include <glib.h>
+#include "backends/x11/meta-event-x11.h"
+#include "clutter/clutter-mutter.h"
+#include "clutter/x11/clutter-x11.h"
-#if 0
-/* XEMBED protocol support for toolkit embedding */
-#define XEMBED_MAPPED (1 << 0)
-#define MAX_SUPPORTED_XEMBED_VERSION 1
-
-#define XEMBED_EMBEDDED_NOTIFY 0
-#define XEMBED_WINDOW_ACTIVATE 1
-#define XEMBED_WINDOW_DEACTIVATE 2
-#define XEMBED_REQUEST_FOCUS 3
-#define XEMBED_FOCUS_IN 4
-#define XEMBED_FOCUS_OUT 5
-#define XEMBED_FOCUS_NEXT 6
-#define XEMBED_FOCUS_PREV 7
-/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
-#define XEMBED_MODALITY_ON 10
-#define XEMBED_MODALITY_OFF 11
-#define XEMBED_REGISTER_ACCELERATOR 12
-#define XEMBED_UNREGISTER_ACCELERATOR 13
-#define XEMBED_ACTIVATE_ACCELERATOR 14
-
-static Window ParentEmbedderWin = None;
-#endif
-
-ClutterEventX11 *
-_clutter_event_x11_new (void)
+MetaEventX11 *
+meta_event_x11_new (void)
{
- return g_slice_new0 (ClutterEventX11);
+ return g_slice_new0 (MetaEventX11);
}
-ClutterEventX11 *
-_clutter_event_x11_copy (ClutterEventX11 *event_x11)
+MetaEventX11 *
+meta_event_x11_copy (MetaEventX11 *event_x11)
{
if (event_x11 != NULL)
- return g_slice_dup (ClutterEventX11, event_x11);
+ return g_slice_dup (MetaEventX11, event_x11);
return NULL;
}
void
-_clutter_event_x11_free (ClutterEventX11 *event_x11)
+meta_event_x11_free (MetaEventX11 *event_x11)
{
if (event_x11 != NULL)
- g_slice_free (ClutterEventX11, event_x11);
+ g_slice_free (MetaEventX11, event_x11);
}
/**
- * clutter_x11_handle_event:
+ * meta_x11_handle_event:
* @xevent: pointer to XEvent structure
*
* This function processes a single X event; it can be used to hook
@@ -104,7 +71,7 @@ _clutter_event_x11_free (ClutterEventX11 *event_x11)
* Since: 0.8
*/
ClutterX11FilterReturn
-clutter_x11_handle_event (XEvent *xevent)
+meta_x11_handle_event (XEvent *xevent)
{
ClutterX11FilterReturn result;
ClutterBackend *backend;
@@ -115,12 +82,12 @@ clutter_x11_handle_event (XEvent *xevent)
gboolean allocated_event;
/* The return values here are someone approximate; we return
- * CLUTTER_X11_FILTER_REMOVE if a clutter event is
+ * META_X11_FILTER_REMOVE if a clutter event is
* generated for the event. This mostly, but not entirely,
* corresponds to whether other event processing should be
* excluded. As long as the stage window is not shared with another
* toolkit it should be safe, and never return
- * %CLUTTER_X11_FILTER_REMOVE when more processing is needed.
+ * %META_X11_FILTER_REMOVE when more processing is needed.
*/
result = CLUTTER_X11_FILTER_CONTINUE;
@@ -173,40 +140,18 @@ out:
return result;
}
-/**
- * clutter_x11_get_current_event_time: (skip)
- *
- * Retrieves the timestamp of the last X11 event processed by
- * Clutter. This might be different from the timestamp returned
- * by clutter_get_current_event_time(), as Clutter may synthesize
- * or throttle events.
- *
- * Return value: a timestamp, in milliseconds
- *
- * Since: 1.0
- */
Time
-clutter_x11_get_current_event_time (void)
+meta_x11_get_current_event_time (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
return CLUTTER_BACKEND_X11 (backend)->last_event_time;
}
-/**
- * clutter_x11_event_get_key_group:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or %CLUTTER_KEY_RELEASE
- *
- * Retrieves the group for the modifiers set in @event
- *
- * Return value: the group id
- *
- * Since: 1.4
- */
gint
-clutter_x11_event_get_key_group (const ClutterEvent *event)
+meta_x11_event_get_key_group (const ClutterEvent *event)
{
- ClutterEventX11 *event_x11;
+ MetaEventX11 *event_x11;
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS ||
@@ -219,18 +164,8 @@ clutter_x11_event_get_key_group (const ClutterEvent *event)
return event_x11->key_group;
}
-/**
- * clutter_x11_event_sequence_get_touch_detail:
- * @sequence: a #ClutterEventSequence
- *
- * Retrieves the touch detail froma #ClutterEventSequence.
- *
- * Return value: the touch detail
- *
- * Since: 1.12
- */
guint
-clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence)
+meta_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence)
{
g_return_val_if_fail (sequence != NULL, 0);
diff --git a/src/backends/x11/meta-event-x11.h b/src/backends/x11/meta-event-x11.h
new file mode 100644
index 000000000..2295ce63a
--- /dev/null
+++ b/src/backends/x11/meta-event-x11.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
+ * Copyright (C) 2009, 2010 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *
+ * Authored by:
+ * Matthew Allum <mallum openedhand com>
+ * Emmanuele Bassi <ebassi linux intel com>
+ */
+
+#ifndef META_EVENT_X11_H
+#define META_EVENT_X11_H
+
+#include <X11/Xlib.h>
+
+#include "clutter/x11/clutter-x11.h"
+
+typedef struct _MetaEventX11 MetaEventX11;
+
+struct _MetaEventX11
+{
+ /* additional fields for Key events */
+ gint key_group;
+
+ guint key_is_modifier : 1;
+ guint num_lock_set : 1;
+ guint caps_lock_set : 1;
+};
+
+MetaEventX11 * meta_event_x11_new (void);
+MetaEventX11 * meta_event_x11_copy (MetaEventX11 *event_x11);
+void meta_event_x11_free (MetaEventX11 *event_x11);
+
+Time meta_x11_get_current_event_time (void);
+
+gint meta_x11_event_get_key_group (const ClutterEvent *event);
+
+guint meta_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence);
+
+ClutterX11FilterReturn meta_x11_handle_event (XEvent *xevent);
+
+#endif /* META_EVENT_X11_H */
diff --git a/clutter/clutter/x11/clutter-input-device-tool-xi2.c
b/src/backends/x11/meta-input-device-tool-x11.c
similarity index 63%
rename from clutter/clutter/x11/clutter-input-device-tool-xi2.c
rename to src/backends/x11/meta-input-device-tool-x11.c
index 9f038b4d0..0632fea5a 100644
--- a/clutter/clutter/x11/clutter-input-device-tool-xi2.c
+++ b/src/backends/x11/meta-input-device-tool-x11.c
@@ -1,8 +1,4 @@
/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
* Copyright © 2016 Red Hat
*
* This library is free software; you can redistribute it and/or
@@ -21,28 +17,28 @@
* Author: Carlos Garnacho <carlosg gnome org>
*/
-#include "clutter-build-config.h"
+#include "config.h"
-#include "clutter-input-device-tool-xi2.h"
+#include "meta-input-device-tool-x11.h"
-G_DEFINE_TYPE (ClutterInputDeviceToolXI2, clutter_input_device_tool_xi2,
+G_DEFINE_TYPE (MetaInputDeviceToolX11, meta_input_device_tool_x11,
CLUTTER_TYPE_INPUT_DEVICE_TOOL)
static void
-clutter_input_device_tool_xi2_class_init (ClutterInputDeviceToolXI2Class *klass)
+meta_input_device_tool_x11_class_init (MetaInputDeviceToolX11Class *klass)
{
}
static void
-clutter_input_device_tool_xi2_init (ClutterInputDeviceToolXI2 *tool)
+meta_input_device_tool_x11_init (MetaInputDeviceToolX11 *tool)
{
}
ClutterInputDeviceTool *
-clutter_input_device_tool_xi2_new (guint serial,
- ClutterInputDeviceToolType type)
+meta_input_device_tool_x11_new (guint serial,
+ ClutterInputDeviceToolType type)
{
- return g_object_new (CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2,
+ return g_object_new (META_TYPE_INPUT_DEVICE_TOOL_X11,
"type", type,
"serial", serial,
NULL);
diff --git a/src/backends/x11/meta-input-device-tool-x11.h b/src/backends/x11/meta-input-device-tool-x11.h
new file mode 100644
index 000000000..ee0e711f2
--- /dev/null
+++ b/src/backends/x11/meta-input-device-tool-x11.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2016 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Carlos Garnacho <carlosg gnome org>
+ */
+
+#ifndef META_INPUT_DEVICE_TOOL_X11_H
+#define META_INPUT_DEVICE_TOOL_X11_H
+
+#include <clutter/clutter.h>
+
+#define META_TYPE_INPUT_DEVICE_TOOL_X11 (meta_input_device_tool_x11_get_type ())
+
+#define META_INPUT_DEVICE_TOOL_X11(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), META_TYPE_INPUT_DEVICE_TOOL_X11,
MetaInputDeviceToolX11))
+#define META_IS_INPUT_DEVICE_TOOL_X11(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), META_TYPE_INPUT_DEVICE_TOOL_X11))
+#define META_INPUT_DEVICE_TOOL_X11_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), META_TYPE_INPUT_DEVICE_TOOL_X11,
MetaInputDeviceToolX11Class))
+#define META_IS_INPUT_DEVICE_TOOL_X11_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c),
META_TYPE_INPUT_DEVICE_TOOL_X1))
+#define META_INPUT_DEVICE_TOOL_X11_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o),
META_TYPE_INPUT_DEVICE_TOOL_X11, MetaInputDeviceToolX11Class))
+
+typedef struct _MetaInputDeviceToolX11 MetaInputDeviceToolX11;
+typedef struct _MetaInputDeviceToolX11Class MetaInputDeviceToolX11Class;
+
+struct _MetaInputDeviceToolX11
+{
+ ClutterInputDeviceTool parent_instance;
+};
+
+struct _MetaInputDeviceToolX11Class
+{
+ ClutterInputDeviceToolClass parent_class;
+};
+
+GType meta_input_device_tool_x11_get_type (void) G_GNUC_CONST;
+
+ClutterInputDeviceTool * meta_input_device_tool_x11_new (guint serial,
+ ClutterInputDeviceToolType type);
+
+#endif /* META_INPUT_DEVICE_TOOL_X11_H */
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/src/backends/x11/meta-input-device-x11.c
similarity index 60%
rename from clutter/clutter/x11/clutter-input-device-xi2.c
rename to src/backends/x11/meta-input-device-x11.c
index 39a3c2977..cc759757d 100644
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
+++ b/src/backends/x11/meta-input-device-x11.c
@@ -1,8 +1,4 @@
/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
* Copyright © 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
@@ -21,25 +17,15 @@
* Author: Emmanuele Bassi <ebassi linux intel com>
*/
-#include "clutter-build-config.h"
-
-#include "clutter-input-device-xi2.h"
-
-#include "clutter-debug.h"
-#include "clutter-device-manager-private.h"
-#include "clutter-event-private.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-
-#include "clutter-backend-x11.h"
-#include "clutter-stage-x11.h"
+#include "config.h"
+#include <clutter/x11/clutter-x11.h>
#include <X11/extensions/XInput2.h>
-typedef struct _ClutterInputDeviceClass ClutterInputDeviceXI2Class;
+#include "clutter/clutter-mutter.h"
+#include "backends/x11/meta-input-device-x11.h"
-/* a specific XI2 input device */
-struct _ClutterInputDeviceXI2
+struct _MetaInputDeviceX11
{
ClutterInputDevice device;
@@ -57,38 +43,41 @@ struct _ClutterInputDeviceXI2
#endif
};
-#define N_BUTTONS 5
+struct _MetaInputDeviceX11Class
+{
+ ClutterInputDeviceClass device_class;
+};
-#define clutter_input_device_xi2_get_type _clutter_input_device_xi2_get_type
+#define N_BUTTONS 5
-G_DEFINE_TYPE (ClutterInputDeviceXI2,
- clutter_input_device_xi2,
- CLUTTER_TYPE_INPUT_DEVICE);
+G_DEFINE_TYPE (MetaInputDeviceX11,
+ meta_input_device_x11,
+ CLUTTER_TYPE_INPUT_DEVICE)
static void
-clutter_input_device_xi2_constructed (GObject *gobject)
+meta_input_device_x11_constructed (GObject *object)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (gobject);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (object);
- g_object_get (gobject, "id", &device_xi2->device_id, NULL);
+ g_object_get (object, "id", &device_xi2->device_id, NULL);
- if (G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->constructed)
- G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->constructed (gobject);
+ if (G_OBJECT_CLASS (meta_input_device_x11_parent_class)->constructed)
+ G_OBJECT_CLASS (meta_input_device_x11_parent_class)->constructed (object);
#ifdef HAVE_LIBWACOM
- if (clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (gobject)) == CLUTTER_PAD_DEVICE)
+ if (clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (object)) == CLUTTER_PAD_DEVICE)
{
device_xi2->group_modes = g_array_new (FALSE, TRUE, sizeof (guint));
g_array_set_size (device_xi2->group_modes,
- clutter_input_device_get_n_mode_groups (CLUTTER_INPUT_DEVICE (gobject)));
+ clutter_input_device_get_n_mode_groups (CLUTTER_INPUT_DEVICE (object)));
}
#endif
}
static gboolean
-clutter_input_device_xi2_keycode_to_evdev (ClutterInputDevice *device,
- guint hardware_keycode,
- guint *evdev_keycode)
+meta_input_device_x11_keycode_to_evdev (ClutterInputDevice *device,
+ guint hardware_keycode,
+ guint *evdev_keycode)
{
/* When using evdev under X11 the hardware keycodes are the evdev
keycodes plus 8. I haven't been able to find any documentation to
@@ -100,17 +89,17 @@ clutter_input_device_xi2_keycode_to_evdev (ClutterInputDevice *device,
}
static gboolean
-clutter_input_device_xi2_is_grouped (ClutterInputDevice *device,
- ClutterInputDevice *other_device)
+meta_input_device_x11_is_grouped (ClutterInputDevice *device,
+ ClutterInputDevice *other_device)
{
return FALSE;
}
static void
-clutter_input_device_xi2_finalize (GObject *object)
+meta_input_device_x11_finalize (GObject *object)
{
#ifdef HAVE_LIBWACOM
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (object);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (object);
if (device_xi2->wacom_device)
libwacom_destroy (device_xi2->wacom_device);
@@ -122,15 +111,15 @@ clutter_input_device_xi2_finalize (GObject *object)
g_source_remove (device_xi2->inhibit_pointer_query_timer);
#endif
- G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_input_device_x11_parent_class)->finalize (object);
}
static gint
-clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device,
- gint group)
+meta_input_device_x11_get_group_n_modes (ClutterInputDevice *device,
+ gint group)
{
#ifdef HAVE_LIBWACOM
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
if (device_xi2->wacom_device)
{
@@ -156,10 +145,10 @@ clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device,
#ifdef HAVE_LIBWACOM
static int
-clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
- guint button)
+meta_input_device_x11_get_button_group (ClutterInputDevice *device,
+ guint button)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
if (device_xi2->wacom_device)
{
@@ -175,36 +164,36 @@ clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
#endif
static gboolean
-clutter_input_device_xi2_is_mode_switch_button (ClutterInputDevice *device,
- guint group,
- guint button)
+meta_input_device_x11_is_mode_switch_button (ClutterInputDevice *device,
+ guint group,
+ guint button)
{
int button_group = -1;
#ifdef HAVE_LIBWACOM
- button_group = clutter_input_device_xi2_get_button_group (device, button);
+ button_group = meta_input_device_x11_get_button_group (device, button);
#endif
return button_group == (int) group;
}
static void
-clutter_input_device_xi2_class_init (ClutterInputDeviceXI2Class *klass)
+meta_input_device_x11_class_init (MetaInputDeviceX11Class *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass);
- gobject_class->constructed = clutter_input_device_xi2_constructed;
- gobject_class->finalize = clutter_input_device_xi2_finalize;
+ gobject_class->constructed = meta_input_device_x11_constructed;
+ gobject_class->finalize = meta_input_device_x11_finalize;
- device_class->keycode_to_evdev = clutter_input_device_xi2_keycode_to_evdev;
- device_class->is_grouped = clutter_input_device_xi2_is_grouped;
- device_class->get_group_n_modes = clutter_input_device_xi2_get_group_n_modes;
- device_class->is_mode_switch_button = clutter_input_device_xi2_is_mode_switch_button;
+ device_class->keycode_to_evdev = meta_input_device_x11_keycode_to_evdev;
+ device_class->is_grouped = meta_input_device_x11_is_grouped;
+ device_class->get_group_n_modes = meta_input_device_x11_get_group_n_modes;
+ device_class->is_mode_switch_button = meta_input_device_x11_is_mode_switch_button;
}
static void
-clutter_input_device_xi2_init (ClutterInputDeviceXI2 *self)
+meta_input_device_x11_init (MetaInputDeviceX11 *self)
{
}
@@ -229,10 +218,10 @@ get_modifier_for_button (int i)
}
void
-_clutter_input_device_xi2_translate_state (ClutterEvent *event,
- XIModifierState *modifiers_state,
- XIButtonState *buttons_state,
- XIGroupState *group_state)
+meta_input_device_x11_translate_state (ClutterEvent *event,
+ XIModifierState *modifiers_state,
+ XIButtonState *buttons_state,
+ XIGroupState *group_state)
{
guint button = 0;
guint base = 0;
@@ -287,22 +276,22 @@ _clutter_input_device_xi2_translate_state (ClutterEvent *event,
}
void
-clutter_input_device_xi2_update_tool (ClutterInputDevice *device,
- ClutterInputDeviceTool *tool)
+meta_input_device_x11_update_tool (ClutterInputDevice *device,
+ ClutterInputDeviceTool *tool)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
g_set_object (&device_xi2->current_tool, tool);
}
ClutterInputDeviceTool *
-clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device)
+meta_input_device_x11_get_current_tool (ClutterInputDevice *device)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
return device_xi2->current_tool;
}
static gboolean
-clutter_input_device_xi2_query_pointer_location (ClutterInputDeviceXI2 *device_xi2)
+meta_input_device_x11_query_pointer_location (MetaInputDeviceX11 *device_xi2)
{
Window xroot_window, xchild_window;
double xroot_x, xroot_y, xwin_x, xwin_y;
@@ -336,7 +325,7 @@ clutter_input_device_xi2_query_pointer_location (ClutterInputDeviceXI2 *device_x
static gboolean
clear_inhibit_pointer_query_cb (gpointer data)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (data);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (data);
device_xi2->inhibit_pointer_query_timer = 0;
@@ -344,22 +333,21 @@ clear_inhibit_pointer_query_cb (gpointer data)
}
gboolean
-clutter_input_device_xi2_get_pointer_location (ClutterInputDevice *device,
- float *x,
- float *y)
+meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
+ float *x,
+ float *y)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_XI2 (device_xi2), FALSE);
+ g_return_val_if_fail (META_IS_INPUT_DEVICE_X11 (device), FALSE);
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, FALSE);
/* Throttle XServer queries and roundtrips using an idle timeout */
if (device_xi2->inhibit_pointer_query_timer == 0)
{
device_xi2->query_status =
- clutter_input_device_xi2_query_pointer_location (device_xi2);
+ meta_input_device_x11_query_pointer_location (device_xi2);
device_xi2->inhibit_pointer_query_timer =
clutter_threads_add_idle (clear_inhibit_pointer_query_cb, device_xi2);
}
@@ -372,10 +360,10 @@ clutter_input_device_xi2_get_pointer_location (ClutterInputDevice *device,
#ifdef HAVE_LIBWACOM
void
-clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice *device,
- WacomDeviceDatabase *wacom_db)
+meta_input_device_x11_ensure_wacom_info (ClutterInputDevice *device,
+ WacomDeviceDatabase *wacom_db)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
const gchar *node_path;
node_path = clutter_input_device_get_device_node (device);
@@ -384,10 +372,10 @@ clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice *device,
}
guint
-clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
- guint group)
+meta_input_device_x11_get_pad_group_mode (ClutterInputDevice *device,
+ guint group)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
if (group >= device_xi2->group_modes->len)
return 0;
@@ -396,17 +384,17 @@ clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
}
void
-clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device,
- guint button,
- guint state,
- guint *group,
- guint *mode)
+meta_input_device_x11_update_pad_state (ClutterInputDevice *device,
+ guint button,
+ guint state,
+ guint *group,
+ guint *mode)
{
- ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
guint button_group, *group_mode;
gboolean is_mode_switch = FALSE;
- button_group = clutter_input_device_xi2_get_button_group (device, button);
+ button_group = meta_input_device_x11_get_button_group (device, button);
is_mode_switch = button_group >= 0;
/* Assign all non-mode-switch buttons to group 0 so far */
diff --git a/src/backends/x11/meta-input-device-x11.h b/src/backends/x11/meta-input-device-x11.h
new file mode 100644
index 000000000..12ee7cf8f
--- /dev/null
+++ b/src/backends/x11/meta-input-device-x11.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2011 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Emmanuele Bassi <ebassi linux intel com>
+ */
+
+#ifndef META_INPUT_DEVICE_X11_H
+#define META_INPUT_DEVICE_X11_H
+
+#include <clutter/clutter.h>
+#include <X11/extensions/XInput2.h>
+
+#ifdef HAVE_LIBWACOM
+#include <libwacom/libwacom.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define META_TYPE_INPUT_DEVICE_X11 (meta_input_device_x11_get_type ())
+#define META_INPUT_DEVICE_X11(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), META_TYPE_INPUT_DEVICE_X11,
MetaInputDeviceX11))
+#define META_IS_INPUT_DEVICE_X11(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), META_TYPE_INPUT_DEVICE_X11))
+#define META_INPUT_DEVICE_X11_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), META_TYPE_INPUT_DEVICE_X11,
MetaInputDeviceX11Class))
+#define META_IS_INPUT_DEVICE_X11_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), META_TYPE_INPUT_DEVICE_X11))
+#define META_INPUT_DEVICE_X11_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), META_TYPE_INPUT_DEVICE_X11,
MetaInputDeviceX11Class))
+
+typedef struct _MetaInputDeviceX11 MetaInputDeviceX11;
+typedef struct _MetaInputDeviceX11Class MetaInputDeviceX11Class;
+
+GType meta_input_device_x11_get_type (void) G_GNUC_CONST;
+
+void meta_input_device_x11_translate_state (ClutterEvent *event,
+ XIModifierState *modifiers_state,
+ XIButtonState *buttons_state,
+ XIGroupState *group_state);
+void meta_input_device_x11_update_tool (ClutterInputDevice *device,
+ ClutterInputDeviceTool *tool);
+ClutterInputDeviceTool * meta_input_device_x11_get_current_tool (ClutterInputDevice *device);
+
+#ifdef HAVE_LIBWACOM
+void meta_input_device_x11_ensure_wacom_info (ClutterInputDevice *device,
+ WacomDeviceDatabase *wacom_db);
+
+guint meta_input_device_x11_get_pad_group_mode (ClutterInputDevice *device,
+ guint group);
+
+void meta_input_device_x11_update_pad_state (ClutterInputDevice *device,
+ guint button,
+ guint state,
+ guint *group,
+ guint *mode);
+
+#endif
+
+gboolean meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
+ float *x,
+ float *y);
+
+G_END_DECLS
+
+#endif /* META_INPUT_DEVICE_X11_H */
diff --git a/clutter/clutter/x11/clutter-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c
similarity index 72%
rename from clutter/clutter/x11/clutter-keymap-x11.c
rename to src/backends/x11/meta-keymap-x11.c
index 0dbb91650..af334326c 100644
--- a/clutter/clutter/x11/clutter-keymap-x11.c
+++ b/src/backends/x11/meta-keymap-x11.c
@@ -21,18 +21,16 @@
* Author: Emmanuele Bassi <ebassi linux intel com>
*/
-#include "clutter-build-config.h"
-
-#include "clutter-keymap-x11.h"
-#include "clutter-backend-x11.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
+#include "config.h"
+#include <clutter/clutter.h>
+#include <clutter/x11/clutter-x11.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
-typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class;
+#include "backends/x11/meta-keymap-x11.h"
+#include "clutter/clutter-mutter.h"
+
typedef struct _DirectionCacheEntry DirectionCacheEntry;
typedef struct _ClutterKeymapKey ClutterKeymapKey;
@@ -50,7 +48,7 @@ struct _DirectionCacheEntry
PangoDirection direction;
};
-struct _ClutterKeymapX11
+struct _MetaKeymapX11
{
ClutterKeymap parent_instance;
@@ -88,11 +86,6 @@ struct _ClutterKeymapX11
guint have_xkb_autorepeat : 1;
};
-struct _ClutterKeymapX11Class
-{
- ClutterKeymapClass parent_class;
-};
-
enum
{
PROP_0,
@@ -104,14 +97,12 @@ enum
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-#define clutter_keymap_x11_get_type _clutter_keymap_x11_get_type
-
-G_DEFINE_TYPE (ClutterKeymapX11, clutter_keymap_x11, CLUTTER_TYPE_KEYMAP)
+G_DEFINE_TYPE (MetaKeymapX11, meta_keymap_x11, CLUTTER_TYPE_KEYMAP)
/* code adapted from gdk/x11/gdkkeys-x11.c - update_modmap */
static void
-update_modmap (Display *display,
- ClutterKeymapX11 *keymap_x11)
+update_modmap (Display *display,
+ MetaKeymapX11 *keymap_x11)
{
static struct {
const gchar *name;
@@ -150,12 +141,12 @@ update_modmap (Display *display,
}
static XkbDescPtr
-get_xkb (ClutterKeymapX11 *keymap_x11)
+get_xkb (MetaKeymapX11 *keymap_x11)
{
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
if (keymap_x11->max_keycode == 0)
- XDisplayKeycodes (backend_x11->xdpy,
+ XDisplayKeycodes (xdisplay,
&keymap_x11->min_keycode,
&keymap_x11->max_keycode);
@@ -166,7 +157,7 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
| XkbModifierMapMask
| XkbVirtualModsMask;
- keymap_x11->xkb_desc = XkbGetMap (backend_x11->xdpy, flags, XkbUseCoreKbd);
+ keymap_x11->xkb_desc = XkbGetMap (xdisplay, flags, XkbUseCoreKbd);
if (G_UNLIKELY (keymap_x11->xkb_desc == NULL))
{
g_error ("Failed to get the keymap from XKB");
@@ -174,9 +165,9 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
}
flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
- XkbGetNames (backend_x11->xdpy, flags, keymap_x11->xkb_desc);
+ XkbGetNames (xdisplay, flags, keymap_x11->xkb_desc);
- update_modmap (backend_x11->xdpy, keymap_x11);
+ update_modmap (xdisplay, keymap_x11);
}
else if (keymap_x11->xkb_map_serial != keymap_x11->keymap_serial)
{
@@ -185,35 +176,32 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
| XkbModifierMapMask
| XkbVirtualModsMask;
- CLUTTER_NOTE (BACKEND, "Updating XKB keymap");
-
- XkbGetUpdatedMap (backend_x11->xdpy, flags, keymap_x11->xkb_desc);
+ XkbGetUpdatedMap (xdisplay, flags, keymap_x11->xkb_desc);
flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
- XkbGetNames (backend_x11->xdpy, flags, keymap_x11->xkb_desc);
+ XkbGetNames (xdisplay, flags, keymap_x11->xkb_desc);
- update_modmap (backend_x11->xdpy, keymap_x11);
+ update_modmap (xdisplay, keymap_x11);
keymap_x11->xkb_map_serial = keymap_x11->keymap_serial;
}
if (keymap_x11->num_lock_mask == 0)
- keymap_x11->num_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
- XK_Num_Lock);
+ keymap_x11->num_lock_mask = XkbKeysymToModifiers (xdisplay, XK_Num_Lock);
if (keymap_x11->scroll_lock_mask == 0)
- keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
+ keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (xdisplay,
XK_Scroll_Lock);
if (keymap_x11->level3_shift_mask == 0)
- keymap_x11->level3_shift_mask = XkbKeysymToModifiers (backend_x11->xdpy,
+ keymap_x11->level3_shift_mask = XkbKeysymToModifiers (xdisplay,
XK_ISO_Level3_Shift);
return keymap_x11->xkb_desc;
}
static void
-update_locked_mods (ClutterKeymapX11 *keymap_x11,
- gint locked_mods)
+update_locked_mods (MetaKeymapX11 *keymap_x11,
+ gint locked_mods)
{
gboolean old_caps_lock_state, old_num_lock_state;
@@ -223,9 +211,9 @@ update_locked_mods (ClutterKeymapX11 *keymap_x11,
keymap_x11->caps_lock_state = (locked_mods & CLUTTER_LOCK_MASK) != 0;
keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_lock_mask) != 0;
- CLUTTER_NOTE (BACKEND, "Locks state changed - Num: %s, Caps: %s",
- keymap_x11->num_lock_state ? "set" : "unset",
- keymap_x11->caps_lock_state ? "set" : "unset");
+ g_debug ("Locks state changed - Num: %s, Caps: %s",
+ keymap_x11->num_lock_state ? "set" : "unset",
+ keymap_x11->caps_lock_state ? "set" : "unset");
if ((keymap_x11->caps_lock_state != old_caps_lock_state) ||
(keymap_x11->num_lock_state != old_num_lock_state))
@@ -274,9 +262,9 @@ get_direction (XkbDescPtr xkb,
}
static PangoDirection
-get_direction_from_cache (ClutterKeymapX11 *keymap_x11,
- XkbDescPtr xkb,
- int group)
+get_direction_from_cache (MetaKeymapX11 *keymap_x11,
+ XkbDescPtr xkb,
+ int group)
{
Atom group_atom = xkb->names->groups[group];
gboolean cache_hit = FALSE;
@@ -335,8 +323,8 @@ get_direction_from_cache (ClutterKeymapX11 *keymap_x11,
}
static void
-update_direction (ClutterKeymapX11 *keymap_x11,
- int group)
+update_direction (MetaKeymapX11 *keymap_x11,
+ int group)
{
XkbDescPtr xkb = get_xkb (keymap_x11);
Atom group_atom;
@@ -352,22 +340,21 @@ update_direction (ClutterKeymapX11 *keymap_x11,
}
static void
-clutter_keymap_x11_constructed (GObject *gobject)
+meta_keymap_x11_constructed (GObject *object)
{
- ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (gobject);
- ClutterBackendX11 *backend_x11;
+ MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (object);
+ Display *xdisplay = clutter_x11_get_default_display ();
gint xkb_major = XkbMajorVersion;
gint xkb_minor = XkbMinorVersion;
g_assert (keymap_x11->backend != NULL);
- backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
if (XkbLibraryVersion (&xkb_major, &xkb_minor))
{
xkb_major = XkbMajorVersion;
xkb_minor = XkbMinorVersion;
- if (XkbQueryExtension (backend_x11->xdpy,
+ if (XkbQueryExtension (xdisplay,
NULL,
&keymap_x11->xkb_event_base,
NULL,
@@ -377,18 +364,18 @@ clutter_keymap_x11_constructed (GObject *gobject)
keymap_x11->use_xkb = TRUE;
- XkbSelectEvents (backend_x11->xdpy,
+ XkbSelectEvents (xdisplay,
XkbUseCoreKbd,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
- XkbSelectEventDetails (backend_x11->xdpy,
+ XkbSelectEventDetails (xdisplay,
XkbUseCoreKbd, XkbStateNotify,
XkbAllStateComponentsMask,
XkbGroupLockMask | XkbModifierLockMask);
/* enable XKB autorepeat */
- XkbSetDetectableAutoRepeat (backend_x11->xdpy,
+ XkbSetDetectableAutoRepeat (xdisplay,
True,
&detectable_autorepeat_supported);
@@ -398,12 +385,12 @@ clutter_keymap_x11_constructed (GObject *gobject)
}
static void
-clutter_keymap_x11_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+meta_keymap_x11_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- ClutterKeymapX11 *keymap = CLUTTER_KEYMAP_X11 (gobject);
+ MetaKeymapX11 *keymap = META_KEYMAP_X11 (object);
switch (prop_id)
{
@@ -412,13 +399,13 @@ clutter_keymap_x11_set_property (GObject *gobject,
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-clutter_keymap_x11_refresh_reserved_keycodes (ClutterKeymapX11 *keymap_x11)
+meta_keymap_x11_refresh_reserved_keycodes (MetaKeymapX11 *keymap_x11)
{
Display *dpy = clutter_x11_get_default_display ();
GHashTableIter iter;
@@ -444,9 +431,9 @@ clutter_keymap_x11_refresh_reserved_keycodes (ClutterKeymapX11 *keymap_x11)
}
static gboolean
-clutter_keymap_x11_replace_keycode (ClutterKeymapX11 *keymap_x11,
- KeyCode keycode,
- KeySym keysym)
+meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
+ KeyCode keycode,
+ KeySym keysym)
{
if (keymap_x11->use_xkb)
{
@@ -487,20 +474,20 @@ clutter_keymap_x11_replace_keycode (ClutterKeymapX11 *keymap_x11,
}
static void
-clutter_keymap_x11_finalize (GObject *gobject)
+meta_keymap_x11_finalize (GObject *object)
{
- ClutterKeymapX11 *keymap;
+ MetaKeymapX11 *keymap;
GHashTableIter iter;
gpointer key, value;
- keymap = CLUTTER_KEYMAP_X11 (gobject);
+ keymap = META_KEYMAP_X11 (object);
- clutter_keymap_x11_refresh_reserved_keycodes (keymap);
+ meta_keymap_x11_refresh_reserved_keycodes (keymap);
g_hash_table_iter_init (&iter, keymap->reserved_keycodes);
while (g_hash_table_iter_next (&iter, &key, &value))
{
guint keycode = GPOINTER_TO_UINT (key);
- clutter_keymap_x11_replace_keycode (keymap, keycode, NoSymbol);
+ meta_keymap_x11_replace_keycode (keymap, keycode, NoSymbol);
}
g_hash_table_destroy (keymap->reserved_keycodes);
@@ -509,50 +496,50 @@ clutter_keymap_x11_finalize (GObject *gobject)
if (keymap->xkb_desc != NULL)
XkbFreeKeyboard (keymap->xkb_desc, XkbAllComponentsMask, True);
- G_OBJECT_CLASS (clutter_keymap_x11_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (meta_keymap_x11_parent_class)->finalize (object);
}
static gboolean
-clutter_keymap_x11_get_num_lock_state (ClutterKeymap *keymap)
+meta_keymap_x11_get_num_lock_state (ClutterKeymap *keymap)
{
- ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (keymap);
+ MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (keymap);
return keymap_x11->num_lock_state;
}
static gboolean
-clutter_keymap_x11_get_caps_lock_state (ClutterKeymap *keymap)
+meta_keymap_x11_get_caps_lock_state (ClutterKeymap *keymap)
{
- ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (keymap);
+ MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (keymap);
return keymap_x11->caps_lock_state;
}
static void
-clutter_keymap_x11_class_init (ClutterKeymapX11Class *klass)
+meta_keymap_x11_class_init (MetaKeymapX11Class *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterKeymapClass *keymap_class = CLUTTER_KEYMAP_CLASS (klass);
obj_props[PROP_BACKEND] =
g_param_spec_object ("backend",
- P_("Backend"),
- P_("The Clutter backend"),
+ "Backend",
+ "The Clutter backend",
CLUTTER_TYPE_BACKEND,
- CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- gobject_class->constructed = clutter_keymap_x11_constructed;
- gobject_class->set_property = clutter_keymap_x11_set_property;
- gobject_class->finalize = clutter_keymap_x11_finalize;
+ gobject_class->constructed = meta_keymap_x11_constructed;
+ gobject_class->set_property = meta_keymap_x11_set_property;
+ gobject_class->finalize = meta_keymap_x11_finalize;
- keymap_class->get_num_lock_state = clutter_keymap_x11_get_num_lock_state;
- keymap_class->get_caps_lock_state = clutter_keymap_x11_get_caps_lock_state;
+ keymap_class->get_num_lock_state = meta_keymap_x11_get_num_lock_state;
+ keymap_class->get_caps_lock_state = meta_keymap_x11_get_caps_lock_state;
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
-clutter_keymap_x11_init (ClutterKeymapX11 *keymap)
+meta_keymap_x11_init (MetaKeymapX11 *keymap)
{
keymap->current_direction = PANGO_DIRECTION_NEUTRAL;
keymap->current_group = -1;
@@ -561,8 +548,8 @@ clutter_keymap_x11_init (ClutterKeymapX11 *keymap)
}
gboolean
-clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
- XEvent *xevent)
+meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11,
+ XEvent *xevent)
{
gboolean retval;
@@ -578,7 +565,7 @@ clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
switch (xkb_event->any.xkb_type)
{
case XkbStateNotify:
- CLUTTER_NOTE (EVENT, "Updating keyboard state");
+ g_debug ("Updating keyboard state");
keymap_x11->current_group = XkbStateGroup (&xkb_event->state);
update_direction (keymap_x11, keymap_x11->current_group);
update_locked_mods (keymap_x11, xkb_event->state.locked_mods);
@@ -587,7 +574,7 @@ clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
case XkbNewKeyboardNotify:
case XkbMapNotify:
- CLUTTER_NOTE (EVENT, "Updating keyboard mapping");
+ g_debug ("Updating keyboard mapping");
XkbRefreshKeyboardMapping (&xkb_event->map);
keymap_x11->keymap_serial += 1;
retval = TRUE;
@@ -608,8 +595,8 @@ clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
}
gint
-_clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap,
- ClutterModifierType state)
+meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap,
+ ClutterModifierType state)
{
return XkbGroupForCoreState (state);
}
@@ -622,32 +609,29 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* a fallback path.
*/
static int
-translate_keysym (ClutterKeymapX11 *keymap,
- guint hardware_keycode)
+translate_keysym (MetaKeymapX11 *keymap,
+ guint hardware_keycode)
{
- ClutterBackendX11 *backend_x11;
gint retval;
- backend_x11 = CLUTTER_BACKEND_X11 (keymap->backend);
-
- retval = XKeycodeToKeysym (backend_x11->xdpy, hardware_keycode, 0);
-
+ retval = XKeycodeToKeysym (clutter_x11_get_default_display (),
+ hardware_keycode, 0);
return retval;
}
G_GNUC_END_IGNORE_DEPRECATIONS
gint
-_clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
- guint hardware_keycode,
- ClutterModifierType *modifier_state_p,
- ClutterModifierType *mods_p)
+meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap,
+ guint hardware_keycode,
+ ClutterModifierType *modifier_state_p,
+ ClutterModifierType *mods_p)
{
ClutterModifierType unconsumed_modifiers = 0;
ClutterModifierType modifier_state = *modifier_state_p;
gint retval;
- g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), 0);
+ g_return_val_if_fail (META_IS_KEYMAP_X11 (keymap), 0);
if (keymap->use_xkb)
{
@@ -677,10 +661,10 @@ _clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
}
gboolean
-_clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
- gint keycode)
+meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap,
+ gint keycode)
{
- g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), FALSE);
+ g_return_val_if_fail (META_IS_KEYMAP_X11 (keymap), FALSE);
if (keycode < keymap->min_keycode || keycode > keymap->max_keycode)
return FALSE;
@@ -697,18 +681,18 @@ _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
}
PangoDirection
-_clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
+meta_keymap_x11_get_direction (MetaKeymapX11 *keymap)
{
- g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), PANGO_DIRECTION_NEUTRAL);
+ g_return_val_if_fail (META_IS_KEYMAP_X11 (keymap), PANGO_DIRECTION_NEUTRAL);
if (keymap->use_xkb)
{
if (!keymap->has_direction)
{
- Display *xdisplay = CLUTTER_BACKEND_X11 (keymap->backend)->xdpy;
XkbStateRec state_rec;
- XkbGetState (xdisplay, XkbUseCoreKbd, &state_rec);
+ XkbGetState (clutter_x11_get_default_display (),
+ XkbUseCoreKbd, &state_rec);
update_direction (keymap, XkbStateGroup (&state_rec));
}
@@ -719,10 +703,10 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
}
static gboolean
-clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
- guint keyval,
- ClutterKeymapKey **keys,
- gint *n_keys)
+meta_keymap_x11_get_entries_for_keyval (MetaKeymapX11 *keymap_x11,
+ guint keyval,
+ ClutterKeymapKey **keys,
+ gint *n_keys)
{
if (keymap_x11->use_xkb)
{
@@ -802,11 +786,11 @@ clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
}
static guint
-clutter_keymap_x11_get_available_keycode (ClutterKeymapX11 *keymap_x11)
+meta_keymap_x11_get_available_keycode (MetaKeymapX11 *keymap_x11)
{
if (keymap_x11->use_xkb)
{
- clutter_keymap_x11_refresh_reserved_keycodes (keymap_x11);
+ meta_keymap_x11_refresh_reserved_keycodes (keymap_x11);
if (g_hash_table_size (keymap_x11->reserved_keycodes) < 5)
{
@@ -827,15 +811,16 @@ clutter_keymap_x11_get_available_keycode (ClutterKeymapX11 *keymap_x11)
return 0;
}
-gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
- guint keyval,
- guint *keycode_out)
+gboolean
+meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
+ guint keyval,
+ guint *keycode_out)
{
- g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap_x11), FALSE);
+ g_return_val_if_fail (META_IS_KEYMAP_X11 (keymap_x11), FALSE);
g_return_val_if_fail (keyval != 0, FALSE);
g_return_val_if_fail (keycode_out != NULL, FALSE);
- *keycode_out = clutter_keymap_x11_get_available_keycode (keymap_x11);
+ *keycode_out = meta_keymap_x11_get_available_keycode (keymap_x11);
if (*keycode_out == NoSymbol)
{
@@ -843,7 +828,7 @@ gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
return FALSE;
}
- if (!clutter_keymap_x11_replace_keycode (keymap_x11, *keycode_out, keyval))
+ if (!meta_keymap_x11_replace_keycode (keymap_x11, *keycode_out, keyval))
{
g_warning ("Failed to remap keycode %d to keyval %d", *keycode_out, keyval);
return FALSE;
@@ -855,10 +840,11 @@ gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
return TRUE;
}
-void clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11,
- guint keycode)
+void
+meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
+ guint keycode)
{
- g_return_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap_x11));
+ g_return_if_fail (META_IS_KEYMAP_X11 (keymap_x11));
if (!g_hash_table_contains (keymap_x11->reserved_keycodes, GUINT_TO_POINTER (keycode)) ||
g_queue_index (keymap_x11->available_keycodes, GUINT_TO_POINTER (keycode)) != -1)
@@ -868,9 +854,9 @@ void clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11,
}
void
-clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
- uint32_t level,
- gboolean enable)
+meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
+ uint32_t level,
+ gboolean enable)
{
uint32_t modifiers[] = {
0,
@@ -896,23 +882,23 @@ clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
}
static uint32_t
-clutter_keymap_x11_get_current_group (ClutterKeymapX11 *keymap_x11)
+meta_keymap_x11_get_current_group (MetaKeymapX11 *keymap_x11)
{
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
XkbStateRec state_rec;
if (keymap_x11->current_group >= 0)
return keymap_x11->current_group;
- XkbGetState (backend_x11->xdpy, XkbUseCoreKbd, &state_rec);
+ XkbGetState (clutter_x11_get_default_display (),
+ XkbUseCoreKbd, &state_rec);
return XkbStateGroup (&state_rec);
}
gboolean
-clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
- guint keyval,
- guint *keycode_out,
- guint *level_out)
+meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
+ guint keyval,
+ guint *keycode_out,
+ guint *level_out)
{
ClutterKeymapKey *keys;
gint i, n_keys, group;
@@ -921,9 +907,9 @@ clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
g_return_val_if_fail (keycode_out != NULL, FALSE);
g_return_val_if_fail (level_out != NULL, FALSE);
- group = clutter_keymap_x11_get_current_group (keymap_x11);
+ group = meta_keymap_x11_get_current_group (keymap_x11);
- if (!clutter_keymap_x11_get_entries_for_keyval (keymap_x11, keyval, &keys, &n_keys))
+ if (!meta_keymap_x11_get_entries_for_keyval (keymap_x11, keyval, &keys, &n_keys))
return FALSE;
for (i = 0; i < n_keys && !found; i++)
diff --git a/src/backends/x11/meta-keymap-x11.h b/src/backends/x11/meta-keymap-x11.h
new file mode 100644
index 000000000..e2bb52634
--- /dev/null
+++ b/src/backends/x11/meta-keymap-x11.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Emmanuele Bassi <ebassi linux intel com>
+ */
+
+#ifndef META_KEYMAP_X11_H
+#define META_KEYMAP_X11_H
+
+#include <glib-object.h>
+#include <pango/pango.h>
+#include <clutter/clutter.h>
+
+G_BEGIN_DECLS
+
+#define META_TYPE_KEYMAP_X11 (meta_keymap_x11_get_type ())
+G_DECLARE_FINAL_TYPE (MetaKeymapX11, meta_keymap_x11,
+ META, KEYMAP_X11, ClutterKeymap)
+
+gint meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap,
+ ClutterModifierType state);
+gint meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap,
+ guint hardware_keycode,
+ ClutterModifierType *modifier_state_p,
+ ClutterModifierType *mods_p);
+gboolean meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap,
+ gint keycode);
+
+PangoDirection meta_keymap_x11_get_direction (MetaKeymapX11 *keymap);
+
+gboolean meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
+ guint keyval,
+ guint *keycode_out,
+ guint *level_out);
+void meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
+ uint32_t level,
+ gboolean enable);
+gboolean meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
+ guint keyval,
+ guint *keycode_out);
+void meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
+ guint keycode);
+
+gboolean meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11,
+ XEvent *xevent);
+
+G_END_DECLS
+
+#endif /* META_KEYMAP_X11_H */
diff --git a/src/backends/x11/meta-stage-x11-nested.c b/src/backends/x11/meta-stage-x11-nested.c
index 02fef1e55..f6dc5dbcb 100644
--- a/src/backends/x11/meta-stage-x11-nested.c
+++ b/src/backends/x11/meta-stage-x11-nested.c
@@ -39,7 +39,7 @@ static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
struct _MetaStageX11Nested
{
- ClutterStageX11 parent;
+ MetaStageX11 parent;
CoglPipeline *pipeline;
};
@@ -48,11 +48,11 @@ static void
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaStageX11Nested, meta_stage_x11_nested,
- CLUTTER_TYPE_STAGE_X11,
+ META_TYPE_STAGE_X11,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
clutter_stage_window_iface_init))
-typedef struct _ClutterStageX11View
+typedef struct _MetaStageX11View
{
CoglTexture *texture;
ClutterStageViewCogl *view;
@@ -108,7 +108,7 @@ draw_crtc (MetaMonitor *monitor,
GError **error)
{
DrawCrtcData *data = user_data;
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (data->stage_nested);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (data->stage_nested);
CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
CoglTexture *texture = data->texture;
MetaLogicalMonitor *logical_monitor = data->logical_monitor;
@@ -247,7 +247,7 @@ static void
meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
{
MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (stage_window);
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
MetaBackend *backend = meta_get_backend ();
MetaRenderer *renderer = meta_backend_get_renderer (backend);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
diff --git a/src/backends/x11/meta-stage-x11-nested.h b/src/backends/x11/meta-stage-x11-nested.h
index 412aea027..b605e07e2 100644
--- a/src/backends/x11/meta-stage-x11-nested.h
+++ b/src/backends/x11/meta-stage-x11-nested.h
@@ -26,9 +26,10 @@
#define META_STAGE_X11_NESTED_H
#include "clutter/clutter-mutter.h"
+#include "meta-stage-x11.h"
#define META_TYPE_STAGE_X11_NESTED (meta_stage_x11_nested_get_type ())
G_DECLARE_FINAL_TYPE (MetaStageX11Nested, meta_stage_x11_nested,
- META, STAGE_X11_NESTED, ClutterStageX11)
+ META, STAGE_X11_NESTED, MetaStageX11)
#endif /* META_STAGE_X11_NESTED_H */
diff --git a/clutter/clutter/x11/clutter-stage-x11.c b/src/backends/x11/meta-stage-x11.c
similarity index 67%
rename from clutter/clutter/x11/clutter-stage-x11.c
rename to src/backends/x11/meta-stage-x11.c
index 9ce8139fd..d09ecdcb3 100644
--- a/clutter/clutter/x11/clutter-stage-x11.c
+++ b/src/backends/x11/meta-stage-x11.c
@@ -1,5 +1,4 @@
-/* Clutter.
- * An OpenGL based 'interactive canvas' library.
+/*
* Authored By Matthew Allum <mallum openedhand com>
* Copyright (C) 2006-2007 OpenedHand
*
@@ -16,10 +15,9 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
- *
*/
-#include "clutter-build-config.h"
+#include "config.h"
#include <math.h>
#include <stdlib.h>
@@ -28,39 +26,28 @@
#include <unistd.h>
#endif
-#include <cogl/cogl.h>
-
-#include "clutter-backend-x11.h"
-#include "clutter-stage-x11.h"
-#include "clutter-x11.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-debug.h"
-#include "clutter-device-manager-private.h"
-#include "clutter-enum-types.h"
-#include "clutter-event-private.h"
-#include "clutter-feature.h"
-#include "clutter-main.h"
-#include "clutter-mutter.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
+#include "clutter/clutter-mutter.h"
+#include "clutter/x11/clutter-x11.h"
+#include "clutter/x11/clutter-backend-x11.h"
+#include "cogl/cogl.h"
+#include "core/display-private.h"
+#include "meta/meta-x11-errors.h"
+#include "meta-backend-x11.h"
+#include "meta-stage-x11.h"
-#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
+#define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
static void
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
-static ClutterStageCogl *clutter_x11_get_stage_window_from_window (Window win);
+static ClutterStageCogl *meta_x11_get_stage_window_from_window (Window win);
static GHashTable *clutter_stages_by_xid = NULL;
-#define clutter_stage_x11_get_type _clutter_stage_x11_get_type
-
-G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
- clutter_stage_x11,
+G_DEFINE_TYPE_WITH_CODE (MetaStageX11,
+ meta_stage_x11,
CLUTTER_TYPE_STAGE_COGL,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
clutter_stage_window_iface_init));
@@ -69,7 +56,7 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
-#define CLUTTER_STAGE_X11_EVENT_MASK \
+#define META_STAGE_X11_EVENT_MASK \
StructureNotifyMask | \
FocusChangeMask | \
ExposureMask | \
@@ -83,15 +70,15 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
PointerMotionMask
static void
-clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
- gint new_width,
- gint new_height)
+meta_stage_x11_fix_window_size (MetaStageX11 *stage_x11,
+ gint new_width,
+ gint new_height)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
if (stage_x11->xwin != None)
{
+ Display *xdisplay = clutter_x11_get_default_display ();
guint min_width, min_height;
XSizeHints *size_hints;
@@ -113,31 +100,32 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
size_hints->max_height = new_height;
size_hints->flags = PMinSize | PMaxSize;
- XSetWMNormalHints (backend_x11->xdpy, stage_x11->xwin, size_hints);
+ XSetWMNormalHints (xdisplay, stage_x11->xwin, size_hints);
XFree(size_hints);
}
}
static void
-clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
+meta_stage_x11_set_wm_protocols (MetaStageX11 *stage_x11)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
Atom protocols[2];
int n = 0;
protocols[n++] = backend_x11->atom_WM_DELETE_WINDOW;
protocols[n++] = backend_x11->atom_NET_WM_PING;
- XSetWMProtocols (backend_x11->xdpy, stage_x11->xwin, protocols, n);
+ XSetWMProtocols (xdisplay, stage_x11->xwin, protocols, n);
}
static void
-clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
- cairo_rectangle_int_t *geometry)
+meta_stage_x11_get_geometry (ClutterStageWindow *stage_window,
+ cairo_rectangle_int_t *geometry)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
geometry->x = geometry->y = 0;
geometry->width = stage_x11->xwin_width;
@@ -145,13 +133,11 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
}
static void
-clutter_stage_x11_resize (ClutterStageWindow *stage_window,
- gint width,
- gint height)
+meta_stage_x11_resize (ClutterStageWindow *stage_window,
+ gint width,
+ gint height)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
- ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
if (width == 0 || height == 0)
{
@@ -163,26 +149,20 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
height = 1;
}
- CLUTTER_NOTE (BACKEND, "New size received: (%d, %d)", width, height);
-
if (stage_x11->xwin != None)
{
- clutter_stage_x11_fix_window_size (stage_x11, width, height);
+ meta_stage_x11_fix_window_size (stage_x11, width, height);
if (width != stage_x11->xwin_width ||
height != stage_x11->xwin_height)
{
- CLUTTER_NOTE (BACKEND, "%s: XResizeWindow[%x] (%d, %d)",
- G_STRLOC,
- (unsigned int) stage_x11->xwin,
- width,
- height);
+ Display *xdisplay = clutter_x11_get_default_display ();
/* XXX: in this case we can rely on a subsequent
* ConfigureNotify that will result in the stage
* being reallocated so we don't actively do anything
* to affect the stage allocation here. */
- XResizeWindow (backend_x11->xdpy,
+ XResizeWindow (xdisplay,
stage_x11->xwin,
width,
height);
@@ -199,24 +179,25 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
}
static inline void
-set_wm_pid (ClutterStageX11 *stage_x11)
+set_wm_pid (MetaStageX11 *stage_x11)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
long pid;
if (stage_x11->xwin == None)
return;
/* this will take care of WM_CLIENT_MACHINE and WM_LOCALE_NAME */
- XSetWMProperties (backend_x11->xdpy, stage_x11->xwin,
+ XSetWMProperties (xdisplay, stage_x11->xwin,
NULL,
NULL,
NULL, 0,
NULL, NULL, NULL);
pid = getpid ();
- XChangeProperty (backend_x11->xdpy,
+ XChangeProperty (xdisplay,
stage_x11->xwin,
backend_x11->atom_NET_WM_PID, XA_CARDINAL, 32,
PropModeReplace,
@@ -224,23 +205,24 @@ set_wm_pid (ClutterStageX11 *stage_x11)
}
static inline void
-set_wm_title (ClutterStageX11 *stage_x11)
+set_wm_title (MetaStageX11 *stage_x11)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
if (stage_x11->xwin == None)
return;
if (stage_x11->title == NULL)
{
- XDeleteProperty (backend_x11->xdpy,
+ XDeleteProperty (xdisplay,
stage_x11->xwin,
backend_x11->atom_NET_WM_NAME);
}
else
{
- XChangeProperty (backend_x11->xdpy,
+ XChangeProperty (xdisplay,
stage_x11->xwin,
backend_x11->atom_NET_WM_NAME,
backend_x11->atom_UTF8_STRING,
@@ -252,21 +234,20 @@ set_wm_title (ClutterStageX11 *stage_x11)
}
static inline void
-set_cursor_visible (ClutterStageX11 *stage_x11)
+set_cursor_visible (MetaStageX11 *stage_x11)
{
- ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
if (stage_x11->xwin == None)
return;
- CLUTTER_NOTE (BACKEND, "setting cursor state ('%s') over stage window (%u)",
- stage_x11->is_cursor_visible ? "visible" : "invisible",
- (unsigned int) stage_x11->xwin);
+ g_debug ("setting cursor state ('%s') over stage window (%u)",
+ stage_x11->is_cursor_visible ? "visible" : "invisible",
+ (unsigned int) stage_x11->xwin);
if (stage_x11->is_cursor_visible)
{
- XUndefineCursor (backend_x11->xdpy, stage_x11->xwin);
+ XUndefineCursor (xdisplay, stage_x11->xwin);
}
else
{
@@ -274,29 +255,25 @@ set_cursor_visible (ClutterStageX11 *stage_x11)
Pixmap pix;
Cursor curs;
- pix = XCreatePixmap (backend_x11->xdpy, stage_x11->xwin, 1, 1, 1);
+ pix = XCreatePixmap (xdisplay, stage_x11->xwin, 1, 1, 1);
memset (&col, 0, sizeof (col));
- curs = XCreatePixmapCursor (backend_x11->xdpy,
+ curs = XCreatePixmapCursor (xdisplay,
pix, pix,
&col, &col,
1, 1);
- XFreePixmap (backend_x11->xdpy, pix);
- XDefineCursor (backend_x11->xdpy, stage_x11->xwin, curs);
+ XFreePixmap (xdisplay, pix);
+ XDefineCursor (xdisplay, stage_x11->xwin, curs);
}
}
static void
-clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
+meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
if (clutter_stages_by_xid != NULL)
{
- CLUTTER_NOTE (BACKEND, "Removing X11 stage 0x%x [%p]",
- (unsigned int) stage_x11->xwin,
- stage_x11);
-
g_hash_table_remove (clutter_stages_by_xid,
GINT_TO_POINTER (stage_x11->xwin));
}
@@ -329,9 +306,9 @@ clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
}
void
-_clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
- ClutterInputDevice *device,
- ClutterDeviceManager *device_manager)
+meta_stage_x11_events_device_changed (MetaStageX11 *stage_x11,
+ ClutterInputDevice *device,
+ ClutterDeviceManager *device_manager)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
@@ -371,23 +348,18 @@ frame_cb (CoglOnscreen *onscreen,
}
static gboolean
-clutter_stage_x11_realize (ClutterStageWindow *stage_window)
+meta_stage_x11_realize (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
ClutterDeviceManager *device_manager;
gfloat width, height;
GError *error = NULL;
clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper), &width, &height);
- CLUTTER_NOTE (BACKEND, "Wrapper size: %.2f x %.2f", width, height);
-
- CLUTTER_NOTE (BACKEND, "Creating a new Cogl onscreen surface: %.2f x %.2f",
- width, height);
-
stage_x11->onscreen = cogl_onscreen_new (backend->cogl_context, width, height);
stage_x11->frame_closure =
@@ -406,7 +378,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
stage_x11->xwin_width = width;
stage_x11->xwin_height = height;
- if (!cogl_framebuffer_allocate (stage_x11->onscreen, &error))
+ if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (stage_x11->onscreen), &error))
{
g_warning ("Failed to allocate stage: %s", error->message);
g_error_free (error);
@@ -447,7 +419,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
* for an example of things that break if we do conditional event
* selection.
*/
- XSelectInput (backend_x11->xdpy, stage_x11->xwin, CLUTTER_STAGE_X11_EVENT_MASK);
+ XSelectInput (xdisplay, stage_x11->xwin, META_STAGE_X11_EVENT_MASK);
/* input events also depent on the actual device, so we need to
* use the device manager to let every device select them, using
@@ -464,31 +436,29 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
stage_window);
}
- clutter_stage_x11_fix_window_size (stage_x11,
- stage_x11->xwin_width,
- stage_x11->xwin_height);
- clutter_stage_x11_set_wm_protocols (stage_x11);
-
- CLUTTER_NOTE (BACKEND, "Successfully realized stage");
+ meta_stage_x11_fix_window_size (stage_x11,
+ stage_x11->xwin_width,
+ stage_x11->xwin_height);
+ meta_stage_x11_set_wm_protocols (stage_x11);
return TRUE;
}
static void
-clutter_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
- gboolean cursor_visible)
+meta_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
+ gboolean cursor_visible)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
stage_x11->is_cursor_visible = !!cursor_visible;
set_cursor_visible (stage_x11);
}
static void
-clutter_stage_x11_set_title (ClutterStageWindow *stage_window,
- const gchar *title)
+meta_stage_x11_set_title (ClutterStageWindow *stage_window,
+ const gchar *title)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
g_free (stage_x11->title);
stage_x11->title = g_strdup (title);
@@ -496,10 +466,9 @@ clutter_stage_x11_set_title (ClutterStageWindow *stage_window,
}
static inline void
-update_wm_hints (ClutterStageX11 *stage_x11)
+update_wm_hints (MetaStageX11 *stage_x11)
{
- ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
+ Display *xdisplay = clutter_x11_get_default_display ();
XWMHints wm_hints;
if (stage_x11->wm_state & STAGE_X11_WITHDRAWN)
@@ -509,25 +478,25 @@ update_wm_hints (ClutterStageX11 *stage_x11)
wm_hints.initial_state = NormalState;
wm_hints.input = stage_x11->accept_focus ? True : False;
- XSetWMHints (backend_x11->xdpy, stage_x11->xwin, &wm_hints);
+ XSetWMHints (xdisplay, stage_x11->xwin, &wm_hints);
}
static void
-clutter_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
- gboolean accept_focus)
+meta_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
+ gboolean accept_focus)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
stage_x11->accept_focus = !!accept_focus;
update_wm_hints (stage_x11);
}
static void
-set_stage_x11_state (ClutterStageX11 *stage_x11,
- ClutterStageX11State unset_flags,
- ClutterStageX11State set_flags)
+set_stage_x11_state (MetaStageX11 *stage_x11,
+ MetaStageX11State unset_flags,
+ MetaStageX11State set_flags)
{
- ClutterStageX11State new_stage_state, old_stage_state;
+ MetaStageX11State new_stage_state, old_stage_state;
old_stage_state = stage_x11->wm_state;
@@ -542,27 +511,23 @@ set_stage_x11_state (ClutterStageX11 *stage_x11,
}
static void
-clutter_stage_x11_show (ClutterStageWindow *stage_window,
- gboolean do_raise)
+meta_stage_x11_show (ClutterStageWindow *stage_window,
+ gboolean do_raise)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
if (stage_x11->xwin != None)
{
+ Display *xdisplay = clutter_x11_get_default_display ();
+
if (do_raise)
{
- CLUTTER_NOTE (BACKEND, "Raising stage[%lu]",
- (unsigned long) stage_x11->xwin);
- XRaiseWindow (backend_x11->xdpy, stage_x11->xwin);
+ XRaiseWindow (xdisplay, stage_x11->xwin);
}
if (!STAGE_X11_IS_MAPPED (stage_x11))
{
- CLUTTER_NOTE (BACKEND, "Mapping stage[%lu]",
- (unsigned long) stage_x11->xwin);
-
set_stage_x11_state (stage_x11, STAGE_X11_WITHDRAWN, 0);
update_wm_hints (stage_x11);
@@ -572,19 +537,20 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
clutter_actor_map (CLUTTER_ACTOR (stage_cogl->wrapper));
- XMapWindow (backend_x11->xdpy, stage_x11->xwin);
+ XMapWindow (xdisplay, stage_x11->xwin);
}
}
static void
-clutter_stage_x11_hide (ClutterStageWindow *stage_window)
+meta_stage_x11_hide (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
if (stage_x11->xwin != None)
{
+ Display *xdisplay = clutter_x11_get_default_display ();
+
if (STAGE_X11_IS_MAPPED (stage_x11))
set_stage_x11_state (stage_x11, 0, STAGE_X11_WITHDRAWN);
@@ -592,14 +558,14 @@ clutter_stage_x11_hide (ClutterStageWindow *stage_window)
clutter_actor_unmap (CLUTTER_ACTOR (stage_cogl->wrapper));
- XWithdrawWindow (backend_x11->xdpy, stage_x11->xwin, 0);
+ XWithdrawWindow (xdisplay, stage_x11->xwin, 0);
}
}
static gboolean
-clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
+meta_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
/* while resizing a window, clipped redraws are disabled in order to
* avoid artefacts.
@@ -610,7 +576,7 @@ clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
static void
ensure_legacy_view (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
cairo_rectangle_int_t view_layout;
CoglFramebuffer *framebuffer;
@@ -628,9 +594,9 @@ ensure_legacy_view (ClutterStageWindow *stage_window)
}
static GList *
-clutter_stage_x11_get_views (ClutterStageWindow *stage_window)
+meta_stage_x11_get_views (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
ensure_legacy_view (stage_window);
@@ -638,33 +604,33 @@ clutter_stage_x11_get_views (ClutterStageWindow *stage_window)
}
static int64_t
-clutter_stage_x11_get_frame_counter (ClutterStageWindow *stage_window)
+meta_stage_x11_get_frame_counter (ClutterStageWindow *stage_window)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
return cogl_onscreen_get_frame_counter (stage_x11->onscreen);
}
static void
-clutter_stage_x11_finalize (GObject *gobject)
+meta_stage_x11_finalize (GObject *object)
{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (gobject);
+ MetaStageX11 *stage_x11 = META_STAGE_X11 (object);
g_free (stage_x11->title);
- G_OBJECT_CLASS (clutter_stage_x11_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (meta_stage_x11_parent_class)->finalize (object);
}
static void
-clutter_stage_x11_class_init (ClutterStageX11Class *klass)
+meta_stage_x11_class_init (MetaStageX11Class *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = clutter_stage_x11_finalize;
+ gobject_class->finalize = meta_stage_x11_finalize;
}
static void
-clutter_stage_x11_init (ClutterStageX11 *stage)
+meta_stage_x11_init (MetaStageX11 *stage)
{
stage->xwin = None;
stage->xwin_width = 640;
@@ -683,28 +649,30 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
{
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
- iface->set_title = clutter_stage_x11_set_title;
- iface->set_cursor_visible = clutter_stage_x11_set_cursor_visible;
- iface->set_accept_focus = clutter_stage_x11_set_accept_focus;
- iface->show = clutter_stage_x11_show;
- iface->hide = clutter_stage_x11_hide;
- iface->resize = clutter_stage_x11_resize;
- iface->get_geometry = clutter_stage_x11_get_geometry;
- iface->realize = clutter_stage_x11_realize;
- iface->unrealize = clutter_stage_x11_unrealize;
- iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
- iface->get_views = clutter_stage_x11_get_views;
- iface->get_frame_counter = clutter_stage_x11_get_frame_counter;
+ iface->set_title = meta_stage_x11_set_title;
+ iface->set_cursor_visible = meta_stage_x11_set_cursor_visible;
+ iface->set_accept_focus = meta_stage_x11_set_accept_focus;
+ iface->show = meta_stage_x11_show;
+ iface->hide = meta_stage_x11_hide;
+ iface->resize = meta_stage_x11_resize;
+ iface->get_geometry = meta_stage_x11_get_geometry;
+ iface->realize = meta_stage_x11_realize;
+ iface->unrealize = meta_stage_x11_unrealize;
+ iface->can_clip_redraws = meta_stage_x11_can_clip_redraws;
+ iface->get_views = meta_stage_x11_get_views;
+ iface->get_frame_counter = meta_stage_x11_get_frame_counter;
}
static inline void
set_user_time (ClutterBackendX11 *backend_x11,
- ClutterStageX11 *stage_x11,
+ MetaStageX11 *stage_x11,
long timestamp)
{
if (timestamp != CLUTTER_CURRENT_TIME)
{
- XChangeProperty (backend_x11->xdpy,
+ Display *xdisplay = clutter_x11_get_default_display ();
+
+ XChangeProperty (xdisplay,
stage_x11->xwin,
backend_x11->atom_NET_WM_USER_TIME,
XA_CARDINAL, 32,
@@ -715,7 +683,7 @@ set_user_time (ClutterBackendX11 *backend_x11,
static gboolean
handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
- ClutterStageX11 *stage_x11,
+ MetaStageX11 *stage_x11,
XEvent *xevent)
{
Atom atom = (Atom) xevent->xclient.data.l[0];
@@ -723,20 +691,6 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
if (atom == backend_x11->atom_WM_DELETE_WINDOW &&
xevent->xany.window == stage_x11->xwin)
{
-#ifdef CLUTTER_ENABLE_DEBUG
- ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
-
- /* the WM_DELETE_WINDOW is a request: we do not destroy
- * the window right away, as it might contain vital data;
- * we relay the event to the application and we let it
- * handle the request
- */
- CLUTTER_NOTE (EVENT, "Delete stage %s[%p], win:0x%x",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage_cogl->wrapper)),
- stage_cogl->wrapper,
- (unsigned int) stage_x11->xwin);
-#endif /* CLUTTER_ENABLE_DEBUG */
-
set_user_time (backend_x11, stage_x11, xevent->xclient.data.l[1]);
return TRUE;
@@ -745,9 +699,10 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
xevent->xany.window == stage_x11->xwin)
{
XClientMessageEvent xclient = xevent->xclient;
+ Display *xdisplay = clutter_x11_get_default_display ();
xclient.window = backend_x11->xwin_root;
- XSendEvent (backend_x11->xdpy, xclient.window,
+ XSendEvent (xdisplay, xclient.window,
False,
SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent *) &xclient);
@@ -761,7 +716,7 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
static gboolean
clipped_redraws_cool_off_cb (void *data)
{
- ClutterStageX11 *stage_x11 = data;
+ MetaStageX11 *stage_x11 = data;
stage_x11->clipped_redraws_cool_off = 0;
@@ -769,23 +724,21 @@ clipped_redraws_cool_off_cb (void *data)
}
gboolean
-clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
- XEvent *xevent,
- ClutterEvent *event)
+meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
+ XEvent *xevent,
+ ClutterEvent *event)
{
ClutterStageCogl *stage_cogl;
gboolean res = FALSE;
ClutterBackendX11 *backend_x11;
- Window stage_xwindow;
ClutterStage *stage;
- stage_cogl = clutter_x11_get_stage_window_from_window (xevent->xany.window);
+ stage_cogl = meta_x11_get_stage_window_from_window (xevent->xany.window);
if (stage_cogl == NULL)
return FALSE;
stage = stage_cogl->wrapper;
backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
- stage_xwindow = stage_x11->xwin;
switch (xevent->type)
{
@@ -795,10 +748,10 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
int stage_width;
int stage_height;
- CLUTTER_NOTE (BACKEND, "ConfigureNotify[%x] (%d, %d)",
- (unsigned int) stage_x11->xwin,
- xevent->xconfigure.width,
- xevent->xconfigure.height);
+ g_debug ("ConfigureNotify[%x] (%d, %d)",
+ (unsigned int) stage_x11->xwin,
+ xevent->xconfigure.width,
+ xevent->xconfigure.height);
if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
(stage_x11->xwin_height != xevent->xconfigure.height))
@@ -914,16 +867,13 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
XExposeEvent *expose = (XExposeEvent *) xevent;
cairo_rectangle_int_t clip;
- CLUTTER_NOTE (EVENT,
- "expose for stage: %s[%p], win:0x%x - "
- "redrawing area (x: %d, y: %d, width: %d, height: %d)",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
- stage,
- (unsigned int) stage_xwindow,
- expose->x,
- expose->y,
- expose->width,
- expose->height);
+ g_debug ("expose for stage: win:0x%x - "
+ "redrawing area (x: %d, y: %d, width: %d, height: %d)",
+ (unsigned int) xevent->xany.window,
+ expose->x,
+ expose->y,
+ expose->width,
+ expose->height);
clip.x = expose->x;
clip.y = expose->y;
@@ -934,21 +884,18 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
break;
case DestroyNotify:
- CLUTTER_NOTE (EVENT,
- "Destroy notification received for stage %s[%p], win:0x%x",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
- stage,
- (unsigned int) stage_xwindow);
+ g_debug ("Destroy notification received for stage, win:0x%x",
+ (unsigned int) xevent->xany.window);
+
event->any.type = CLUTTER_DESTROY_NOTIFY;
event->any.stage = stage;
res = TRUE;
break;
case ClientMessage:
- CLUTTER_NOTE (EVENT, "Client message for stage %s[%p], win:0x%x",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
- stage,
- (unsigned int) stage_xwindow);
+ g_debug ("Client message for stage, win:0x%x",
+ (unsigned int) xevent->xany.window);
+
if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
{
event->any.type = CLUTTER_DELETE;
@@ -965,31 +912,21 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
return res;
}
-/**
- * clutter_x11_get_stage_window: (skip)
- * @stage: a #ClutterStage
- *
- * Gets the stages X Window.
- *
- * Return value: An XID for the stage window.
- *
- * Since: 0.4
- */
Window
-clutter_x11_get_stage_window (ClutterStage *stage)
+meta_x11_get_stage_window (ClutterStage *stage)
{
ClutterStageWindow *impl;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), None);
impl = _clutter_stage_get_window (stage);
- g_assert (CLUTTER_IS_STAGE_X11 (impl));
+ g_assert (META_IS_STAGE_X11 (impl));
- return CLUTTER_STAGE_X11 (impl)->xwin;
+ return META_STAGE_X11 (impl)->xwin;
}
static ClutterStageCogl *
-clutter_x11_get_stage_window_from_window (Window win)
+meta_x11_get_stage_window_from_window (Window win)
{
if (clutter_stages_by_xid == NULL)
return NULL;
@@ -998,23 +935,12 @@ clutter_x11_get_stage_window_from_window (Window win)
GINT_TO_POINTER (win));
}
-/**
- * clutter_x11_get_stage_from_window:
- * @win: an X Window ID
- *
- * Gets the stage for a particular X window.
- *
- * Return value: (transfer none): A #ClutterStage, or% NULL if a stage
- * does not exist for the window
- *
- * Since: 0.8
- */
ClutterStage *
-clutter_x11_get_stage_from_window (Window win)
+meta_x11_get_stage_from_window (Window win)
{
ClutterStageCogl *stage_cogl;
- stage_cogl = clutter_x11_get_stage_window_from_window (win);
+ stage_cogl = meta_x11_get_stage_window_from_window (win);
if (stage_cogl != NULL)
return stage_cogl->wrapper;
@@ -1023,8 +949,8 @@ clutter_x11_get_stage_from_window (Window win)
}
void
-_clutter_stage_x11_set_user_time (ClutterStageX11 *stage_x11,
- guint32 user_time)
+meta_stage_x11_set_user_time (MetaStageX11 *stage_x11,
+ guint32 user_time)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
diff --git a/src/backends/x11/meta-stage-x11.h b/src/backends/x11/meta-stage-x11.h
new file mode 100644
index 000000000..676952031
--- /dev/null
+++ b/src/backends/x11/meta-stage-x11.h
@@ -0,0 +1,101 @@
+/* Clutter.
+ * An OpenGL based 'interactive canvas' library.
+ * Authored By Matthew Allum <mallum openedhand com>
+ * Copyright (C) 2006-2007 OpenedHand
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef META_STAGE_X11_H
+#define META_STAGE_X11_H
+
+#include <clutter/clutter-mutter.h>
+#include <clutter/x11/clutter-x11.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+G_BEGIN_DECLS
+
+#define META_TYPE_STAGE_X11 (meta_stage_x11_get_type ())
+#define META_STAGE_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_STAGE_X11,
MetaStageX11))
+#define META_IS_STAGE_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_STAGE_X11))
+#define META_STAGE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_STAGE_X11,
MetaStageX11Class))
+#define META_IS_STAGE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_STAGE_X11))
+#define META_STAGE_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_STAGE_X11,
MetaStageX11Class))
+
+typedef struct _MetaStageX11 MetaStageX11;
+typedef struct _MetaStageX11Class MetaStageX11Class;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaStageX11, g_object_unref)
+
+typedef enum
+{
+ STAGE_X11_WITHDRAWN = 1 << 1
+} MetaStageX11State;
+
+struct _MetaStageX11
+{
+ ClutterStageCogl parent_instance;
+
+ CoglOnscreen *onscreen;
+ Window xwin;
+ gint xwin_width;
+ gint xwin_height; /* FIXME target_width / height */
+
+ ClutterStageView *legacy_view;
+ GList *legacy_views;
+
+ CoglFrameClosure *frame_closure;
+
+ gchar *title;
+
+ guint clipped_redraws_cool_off;
+
+ MetaStageX11State wm_state;
+
+ guint is_cursor_visible : 1;
+ guint viewport_initialized : 1;
+ guint accept_focus : 1;
+};
+
+struct _MetaStageX11Class
+{
+ ClutterStageCoglClass parent_class;
+};
+
+CLUTTER_EXPORT
+GType meta_stage_x11_get_type (void) G_GNUC_CONST;
+
+void meta_stage_x11_events_device_changed (MetaStageX11 *stage_x11,
+ ClutterInputDevice *device,
+ ClutterDeviceManager *device_manager);
+
+/* Private to subclasses */
+void meta_stage_x11_set_user_time (MetaStageX11 *stage_x11,
+ guint32 user_time);
+
+gboolean meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
+ XEvent *xevent,
+ ClutterEvent *event);
+
+ClutterStage *meta_x11_get_stage_from_window (Window win);
+
+Window meta_x11_get_stage_window (ClutterStage *stage);
+
+
+G_END_DECLS
+
+#endif /* META_STAGE_H */
diff --git a/src/backends/x11/meta-virtual-input-device-x11.c
b/src/backends/x11/meta-virtual-input-device-x11.c
new file mode 100644
index 000000000..65133ed15
--- /dev/null
+++ b/src/backends/x11/meta-virtual-input-device-x11.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2016 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Jonas Ådahl <jadahl gmail com>
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include <clutter/clutter.h>
+#include <clutter/x11/clutter-x11.h>
+#include <X11/extensions/XTest.h>
+
+#include "meta-keymap-x11.h"
+#include "meta-virtual-input-device-x11.h"
+
+struct _MetaVirtualInputDeviceX11
+{
+ ClutterVirtualInputDevice parent;
+};
+
+G_DEFINE_TYPE (MetaVirtualInputDeviceX11,
+ meta_virtual_input_device_x11,
+ CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE)
+
+static void
+meta_virtual_input_device_x11_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ double dx,
+ double dy)
+{
+ XTestFakeRelativeMotionEvent (clutter_x11_get_default_display (),
+ (int) dx,
+ (int) dy,
+ 0);
+}
+
+static void
+meta_virtual_input_device_x11_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ double x,
+ double y)
+{
+ XTestFakeMotionEvent (clutter_x11_get_default_display (),
+ clutter_x11_get_default_screen (),
+ (int) x,
+ (int) y,
+ 0);
+}
+
+static void
+meta_virtual_input_device_x11_notify_button (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ uint32_t button,
+ ClutterButtonState button_state)
+{
+ XTestFakeButtonEvent (clutter_x11_get_default_display (),
+ button, button_state == CLUTTER_BUTTON_STATE_PRESSED, 0);
+}
+
+static void
+meta_virtual_input_device_x11_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ ClutterScrollDirection direction,
+ ClutterScrollSource scroll_source)
+{
+ Display *xdisplay = clutter_x11_get_default_display ();
+ int button;
+
+ switch (direction)
+ {
+ case CLUTTER_SCROLL_UP:
+ button = 4;
+ break;
+ case CLUTTER_SCROLL_DOWN:
+ button = 5;
+ break;
+ case CLUTTER_SCROLL_LEFT:
+ button = 6;
+ break;
+ case CLUTTER_SCROLL_RIGHT:
+ button = 7;
+ break;
+ default:
+ g_warn_if_reached ();
+ return;
+ }
+
+ XTestFakeButtonEvent (xdisplay, button, True, 0);
+ XTestFakeButtonEvent (xdisplay, button, False, 0);
+}
+
+static void
+meta_virtual_input_device_x11_notify_scroll_continuous (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ double dx,
+ double dy,
+ ClutterScrollSource scroll_source,
+ ClutterScrollFinishFlags finish_flags)
+{
+}
+
+static void
+meta_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ uint32_t key,
+ ClutterKeyState key_state)
+{
+ XTestFakeKeyEvent (clutter_x11_get_default_display (),
+ key, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
+}
+
+static void
+meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ uint32_t keyval,
+ ClutterKeyState key_state)
+{
+ ClutterBackend *backend = clutter_get_default_backend ();
+ MetaKeymapX11 *keymap = META_KEYMAP_X11 (clutter_backend_get_keymap (backend));
+ uint32_t keycode, level;
+
+ if (!meta_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level))
+ {
+ level = 0;
+
+ if (!meta_keymap_x11_reserve_keycode (keymap, keyval, &keycode))
+ {
+ g_warning ("No keycode found for keyval %x in current group", keyval);
+ return;
+ }
+ }
+
+ if (!meta_keymap_x11_get_is_modifier (keymap, keycode) &&
+ key_state == CLUTTER_KEY_STATE_PRESSED)
+ meta_keymap_x11_latch_modifiers (keymap, level, TRUE);
+
+ XTestFakeKeyEvent (clutter_x11_get_default_display (),
+ (KeyCode) keycode,
+ key_state == CLUTTER_KEY_STATE_PRESSED, 0);
+
+
+ if (key_state == CLUTTER_KEY_STATE_RELEASED)
+ {
+ if (!meta_keymap_x11_get_is_modifier (keymap, keycode))
+ meta_keymap_x11_latch_modifiers (keymap, level, FALSE);
+ meta_keymap_x11_release_keycode_if_needed (keymap, keycode);
+ }
+}
+
+static void
+meta_virtual_input_device_x11_notify_touch_down (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ int device_slot,
+ double x,
+ double y)
+{
+ g_warning ("Virtual touch motion not implemented under X11");
+}
+
+static void
+meta_virtual_input_device_x11_notify_touch_motion (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ int device_slot,
+ double x,
+ double y)
+{
+ g_warning ("Virtual touch motion not implemented under X11");
+}
+
+static void
+meta_virtual_input_device_x11_notify_touch_up (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ int device_slot)
+{
+ g_warning ("Virtual touch motion not implemented under X11");
+}
+
+static void
+meta_virtual_input_device_x11_init (MetaVirtualInputDeviceX11 *virtual_device_x11)
+{
+}
+
+static void
+meta_virtual_input_device_x11_class_init (MetaVirtualInputDeviceX11Class *klass)
+{
+ ClutterVirtualInputDeviceClass *virtual_input_device_class =
+ CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass);
+
+ virtual_input_device_class->notify_relative_motion = meta_virtual_input_device_x11_notify_relative_motion;
+ virtual_input_device_class->notify_absolute_motion = meta_virtual_input_device_x11_notify_absolute_motion;
+ virtual_input_device_class->notify_button = meta_virtual_input_device_x11_notify_button;
+ virtual_input_device_class->notify_discrete_scroll = meta_virtual_input_device_x11_notify_discrete_scroll;
+ virtual_input_device_class->notify_scroll_continuous =
meta_virtual_input_device_x11_notify_scroll_continuous;
+ virtual_input_device_class->notify_key = meta_virtual_input_device_x11_notify_key;
+ virtual_input_device_class->notify_keyval = meta_virtual_input_device_x11_notify_keyval;
+ virtual_input_device_class->notify_touch_down = meta_virtual_input_device_x11_notify_touch_down;
+ virtual_input_device_class->notify_touch_motion = meta_virtual_input_device_x11_notify_touch_motion;
+ virtual_input_device_class->notify_touch_up = meta_virtual_input_device_x11_notify_touch_up;
+}
diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.h
b/src/backends/x11/meta-virtual-input-device-x11.h
similarity index 61%
rename from clutter/clutter/x11/clutter-virtual-input-device-x11.h
rename to src/backends/x11/meta-virtual-input-device-x11.h
index b1bb101bf..0db9cab64 100644
--- a/clutter/clutter/x11/clutter-virtual-input-device-x11.h
+++ b/src/backends/x11/meta-virtual-input-device-x11.h
@@ -1,8 +1,4 @@
/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
@@ -21,15 +17,15 @@
* Author: Jonas Ådahl <jadahl gmail com>
*/
-#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__
-#define __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__
+#ifndef META_VIRTUAL_INPUT_DEVICE_X11_H
+#define META_VIRTUAL_INPUT_DEVICE_X11_H
-#include "clutter-virtual-input-device.h"
+#include <clutter/clutter.h>
-#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11 (clutter_virtual_input_device_x11_get_type ())
-G_DECLARE_FINAL_TYPE (ClutterVirtualInputDeviceX11,
- clutter_virtual_input_device_x11,
- CLUTTER, VIRTUAL_INPUT_DEVICE_X11,
+#define META_TYPE_VIRTUAL_INPUT_DEVICE_X11 (meta_virtual_input_device_x11_get_type ())
+G_DECLARE_FINAL_TYPE (MetaVirtualInputDeviceX11,
+ meta_virtual_input_device_x11,
+ META, VIRTUAL_INPUT_DEVICE_X11,
ClutterVirtualInputDevice)
-#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__ */
+#endif /* META_VIRTUAL_INPUT_DEVICE_X11_H */
diff --git a/clutter/clutter/x11/clutter-xkb-a11y-x11.c b/src/backends/x11/meta-xkb-a11y-x11.c
similarity index 86%
rename from clutter/clutter/x11/clutter-xkb-a11y-x11.c
rename to src/backends/x11/meta-xkb-a11y-x11.c
index 6b782c7a5..b0e7c9af4 100644
--- a/clutter/clutter/x11/clutter-xkb-a11y-x11.c
+++ b/src/backends/x11/meta-xkb-a11y-x11.c
@@ -1,5 +1,4 @@
/*
- *
* Copyright © 2001 Ximian, Inc.
* Copyright (C) 2007 William Jon McCann <mccann jhu edu>
* Copyright (C) 2017 Red Hat
@@ -21,11 +20,15 @@
*
*/
-#include "clutter-device-manager-private.h"
-#include "clutter-xkb-a11y-x11.h"
+#include "config.h"
#include <X11/XKBlib.h>
#include <X11/extensions/XKBstr.h>
+#include <clutter/x11/clutter-x11.h>
+
+#include "backends/x11/meta-xkb-a11y-x11.h"
+#include "core/display-private.h"
+#include "meta/meta-x11-errors.h"
#define DEFAULT_XKB_SET_CONTROLS_MASK XkbSlowKeysMask | \
XkbBounceKeysMask | \
@@ -40,17 +43,17 @@
static int _xkb_event_base;
static XkbDescRec *
-get_xkb_desc_rec (ClutterBackendX11 *backend_x11)
+get_xkb_desc_rec (Display *xdisplay)
{
XkbDescRec *desc;
Status status = Success;
clutter_x11_trap_x_errors ();
- desc = XkbGetMap (backend_x11->xdpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
+ desc = XkbGetMap (xdisplay, XkbAllMapComponentsMask, XkbUseCoreKbd);
if (desc != NULL)
{
desc->ctrls = NULL;
- status = XkbGetControls (backend_x11->xdpy, XkbAllControlsMask, desc);
+ status = XkbGetControls (xdisplay, XkbAllControlsMask, desc);
}
clutter_x11_untrap_x_errors ();
@@ -62,25 +65,24 @@ get_xkb_desc_rec (ClutterBackendX11 *backend_x11)
}
static void
-set_xkb_desc_rec (ClutterBackendX11 *backend_x11,
- XkbDescRec *desc)
+set_xkb_desc_rec (Display *xdisplay,
+ XkbDescRec *desc)
{
clutter_x11_trap_x_errors ();
- XkbSetControls (backend_x11->xdpy, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
- XSync (backend_x11->xdpy, FALSE);
+ XkbSetControls (xdisplay, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
+ XSync (xdisplay, FALSE);
clutter_x11_untrap_x_errors ();
}
static void
check_settings_changed (ClutterDeviceManager *device_manager)
{
- ClutterBackendX11 *backend_x11;
+ Display *xdisplay = clutter_x11_get_default_display ();
ClutterKbdA11ySettings kbd_a11y_settings;
ClutterKeyboardA11yFlags what_changed = 0;
XkbDescRec *desc;
- backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
- desc = get_xkb_desc_rec (backend_x11);
+ desc = get_xkb_desc_rec (xdisplay);
if (!desc)
return;
@@ -145,14 +147,14 @@ xkb_a11y_event_filter (XEvent *xevent,
}
static gboolean
-is_xkb_available (ClutterBackendX11 *backend_x11)
+is_xkb_available (Display *xdisplay)
{
gint opcode, error_base, event_base, major, minor;
if (_xkb_event_base)
return TRUE;
- if (!XkbQueryExtension (backend_x11->xdpy,
+ if (!XkbQueryExtension (xdisplay,
&opcode,
&event_base,
&error_base,
@@ -160,7 +162,7 @@ is_xkb_available (ClutterBackendX11 *backend_x11)
&minor))
return FALSE;
- if (!XkbUseExtension (backend_x11->xdpy, &major, &minor))
+ if (!XkbUseExtension (xdisplay, &major, &minor))
return FALSE;
_xkb_event_base = event_base;
@@ -192,18 +194,20 @@ set_xkb_ctrl (XkbDescRec *desc,
}
void
-clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
- ClutterKbdA11ySettings *kbd_a11y_settings)
+meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
+ ClutterKbdA11ySettings *kbd_a11y_settings)
{
- ClutterBackendX11 *backend_x11;
- XkbDescRec *desc;
- gboolean enable_accessX;
+ ClutterBackend *backend;
+ Display *xdisplay = clutter_x11_get_default_display ();
+ XkbDescRec *desc;
+ gboolean enable_accessX;
- backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
- desc = get_xkb_desc_rec (backend_x11);
+ desc = get_xkb_desc_rec (xdisplay);
if (!desc)
return;
+ backend = clutter_get_default_backend ();
+
/* general */
enable_accessX = kbd_a11y_settings->controls & CLUTTER_A11Y_KEYBOARD_ENABLED;
@@ -241,7 +245,7 @@ clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *devi
}
/* mouse keys */
- if (clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (backend_x11->keymap)))
+ if (clutter_keymap_get_num_lock_state (clutter_backend_get_keymap (backend)))
{
/* Disable mousekeys when NumLock is ON */
desc->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask | XkbMouseKeysAccelMask);
@@ -307,25 +311,22 @@ clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *devi
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
- set_xkb_desc_rec (backend_x11, desc);
+ set_xkb_desc_rec (xdisplay, desc);
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
}
gboolean
-clutter_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
+meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
{
- ClutterBackendX11 *backend_x11;
+ Display *xdisplay = clutter_x11_get_default_display ();
guint event_mask;
- backend_x11 =
- CLUTTER_BACKEND_X11 (_clutter_device_manager_get_backend (device_manager));
-
- if (!is_xkb_available (backend_x11))
+ if (!is_xkb_available (xdisplay))
return FALSE;
event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask;
- XkbSelectEvents (backend_x11->xdpy, XkbUseCoreKbd, event_mask, event_mask);
+ XkbSelectEvents (xdisplay, XkbUseCoreKbd, event_mask, event_mask);
clutter_x11_add_filter (xkb_a11y_event_filter, device_manager);
diff --git a/clutter/clutter/x11/clutter-xkb-a11y-x11.h b/src/backends/x11/meta-xkb-a11y-x11.h
similarity index 66%
rename from clutter/clutter/x11/clutter-xkb-a11y-x11.h
rename to src/backends/x11/meta-xkb-a11y-x11.h
index 8446bc8ca..2e78b27b2 100644
--- a/clutter/clutter/x11/clutter-xkb-a11y-x11.h
+++ b/src/backends/x11/meta-xkb-a11y-x11.h
@@ -21,19 +21,17 @@
*
*/
-#ifndef CLUTTER_XKB_A11Y_X11_H
-#define CLUTTER_XKB_A11Y_X11_H
-
-#include "clutter-device-manager-private.h"
-#include "clutter-backend-x11.h"
+#ifndef META_XKB_A11Y_X11_H
+#define META_XKB_A11Y_X11_H
+#include <clutter/clutter.h>
#include <X11/Xlib.h>
void
-clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
- ClutterKbdA11ySettings *kbd_a11y_settings);
+meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
+ ClutterKbdA11ySettings *kbd_a11y_settings);
gboolean
-clutter_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager);
+meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager);
-#endif /* CLUTTER_XKB_A11Y_X11_H */
+#endif /* META_XKB_A11Y_X11_H */
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index d60865910..4581d50dd 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -57,6 +57,9 @@
#include <X11/extensions/Xcomposite.h>
#include "backends/meta-dnd-private.h"
+#include "backends/x11/meta-backend-x11.h"
+#include "backends/x11/meta-event-x11.h"
+#include "backends/x11/meta-stage-x11.h"
#include "clutter/clutter-mutter.h"
#include "compositor/meta-window-actor-x11.h"
#include "compositor/meta-window-actor-wayland.h"
@@ -289,7 +292,7 @@ meta_focus_stage_window (MetaDisplay *display,
if (!stage)
return;
- window = clutter_x11_get_stage_window (stage);
+ window = meta_x11_get_stage_window (stage);
if (window == None)
return;
@@ -312,7 +315,7 @@ meta_stage_is_focused (MetaDisplay *display)
if (!stage)
return FALSE;
- window = clutter_x11_get_stage_window (stage);
+ window = meta_x11_get_stage_window (stage);
if (window == None)
return FALSE;
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index 15be1169c..b4f66112d 100644
--- a/src/compositor/meta-compositor-x11.c
+++ b/src/compositor/meta-compositor-x11.c
@@ -94,7 +94,7 @@ meta_compositor_x11_process_xevent (MetaCompositorX11 *compositor_x11,
* stage is invisible
*/
if (xevent->type == MapNotify)
- clutter_x11_handle_event (xevent);
+ meta_x11_handle_event (xevent);
}
static void
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index 4139d9504..c16dfac7a 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -27,6 +27,7 @@
#include "core/display-private.h"
#include "backends/meta-dnd-private.h"
#include "backends/x11/meta-backend-x11.h"
+#include "backends/x11/meta-stage-x11.h"
#include "meta/meta-dnd.h"
#include "x11/meta-x11-display-private.h"
@@ -184,7 +185,7 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
output_window = meta_compositor_x11_get_output_xwindow (compositor_x11);
stage = meta_compositor_get_stage (compositor);
if (xev->xany.window != output_window &&
- xev->xany.window != clutter_x11_get_stage_window (stage))
+ xev->xany.window != meta_x11_get_stage_window (stage))
return FALSE;
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
diff --git a/src/core/display.c b/src/core/display.c
index 71b0fb49d..6727f3d17 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -47,6 +47,7 @@
#include "backends/meta-logical-monitor.h"
#include "backends/meta-stage-private.h"
#include "backends/x11/meta-backend-x11.h"
+#include "backends/x11/meta-event-x11.h"
#include "backends/x11/cm/meta-backend-x11-cm.h"
#include "clutter/x11/clutter-x11.h"
#include "compositor/compositor-private.h"
@@ -630,7 +631,7 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
META_VIRTUAL_CORE_POINTER_ID,
- clutter_x11_event_sequence_get_touch_detail (sequence),
+ meta_x11_event_sequence_get_touch_detail (sequence),
DefaultRootWindow (display->x11_display->xdisplay), event_mode);
}
}
diff --git a/src/meson.build b/src/meson.build
index c6c360169..e5fafc6dc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -102,6 +102,7 @@ if have_x11
xcb_randr_dep,
xcb_res_dep,
xau_dep,
+ xtst_dep,
]
if have_sm
@@ -241,18 +242,34 @@ mutter_sources = [
'backends/x11/meta-crtc-xrandr.h',
'backends/x11/meta-cursor-renderer-x11.c',
'backends/x11/meta-cursor-renderer-x11.h',
+ 'backends/x11/meta-device-manager-x11.c',
+ 'backends/x11/meta-device-manager-x11.h',
+ 'backends/x11/meta-event-x11.c',
+ 'backends/x11/meta-event-x11.h',
'backends/x11/meta-gpu-xrandr.c',
'backends/x11/meta-gpu-xrandr.h',
+ 'backends/x11/meta-input-device-x11.c',
+ 'backends/x11/meta-input-device-x11.h',
+ 'backends/x11/meta-input-device-tool-x11.c',
+ 'backends/x11/meta-input-device-tool-x11.h',
'backends/x11/meta-input-settings-x11.c',
'backends/x11/meta-input-settings-x11.h',
+ 'backends/x11/meta-keymap-x11.c',
+ 'backends/x11/meta-keymap-x11.h',
'backends/x11/meta-monitor-manager-xrandr.c',
'backends/x11/meta-monitor-manager-xrandr.h',
'backends/x11/meta-output-xrandr.c',
'backends/x11/meta-output-xrandr.h',
'backends/x11/meta-renderer-x11.c',
'backends/x11/meta-renderer-x11.h',
+ 'backends/x11/meta-stage-x11.c',
+ 'backends/x11/meta-stage-x11.h',
'backends/x11/meta-stage-x11-nested.c',
'backends/x11/meta-stage-x11-nested.h',
+ 'backends/x11/meta-virtual-input-device-x11.c',
+ 'backends/x11/meta-virtual-input-device-x11.h',
+ 'backends/x11/meta-xkb-a11y-x11.c',
+ 'backends/x11/meta-xkb-a11y-x11.h',
'backends/x11/nested/meta-backend-x11-nested.c',
'backends/x11/nested/meta-backend-x11-nested.h',
'backends/x11/nested/meta-cursor-renderer-x11-nested.c',
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 397c9610e..a200deefd 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -2226,7 +2226,7 @@ meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
g_return_if_fail (!meta_is_wayland_compositor ());
- stage_xwindow = clutter_x11_get_stage_window (stage);
+ stage_xwindow = meta_x11_get_stage_window (stage);
XFixesSetWindowShapeRegion (xdisplay, stage_xwindow,
ShapeInput, 0, 0, region);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]