mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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
This commit is contained in:
parent
fa4580de53
commit
ad72fa46b0
@ -128,6 +128,7 @@ void _clutter_backend_copy_event_data (Clutter
|
|||||||
ClutterEvent *dest);
|
ClutterEvent *dest);
|
||||||
void _clutter_backend_free_event_data (ClutterBackend *backend,
|
void _clutter_backend_free_event_data (ClutterBackend *backend,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
|
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
|
||||||
gpointer native,
|
gpointer native,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
@ -534,14 +534,6 @@ clutter_backend_real_init_events (ClutterBackend *backend)
|
|||||||
if (input_backend != NULL)
|
if (input_backend != NULL)
|
||||||
input_backend = g_intern_string (input_backend);
|
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
|
#ifdef CLUTTER_INPUT_EVDEV
|
||||||
/* Evdev can be used regardless of the windowing system */
|
/* Evdev can be used regardless of the windowing system */
|
||||||
if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0)
|
if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0)
|
||||||
|
@ -194,11 +194,14 @@ struct _ClutterInputDeviceClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* device manager */
|
/* device manager */
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
|
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
|
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
|
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
|
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
|
||||||
ClutterStage *stage);
|
ClutterStage *stage);
|
||||||
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
|
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
|
||||||
@ -208,23 +211,31 @@ void _clutter_device_manager_compress_motion (ClutterDeviceMa
|
|||||||
const ClutterEvent *to_discard);
|
const ClutterEvent *to_discard);
|
||||||
|
|
||||||
/* input device */
|
/* input device */
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
|
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence);
|
ClutterEventSequence *sequence);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_coords (ClutterInputDevice *device,
|
void _clutter_input_device_set_coords (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
gfloat x,
|
gfloat x,
|
||||||
gfloat y,
|
gfloat y,
|
||||||
ClutterStage *stage);
|
ClutterStage *stage);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_state (ClutterInputDevice *device,
|
void _clutter_input_device_set_state (ClutterInputDevice *device,
|
||||||
ClutterModifierType state);
|
ClutterModifierType state);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_time (ClutterInputDevice *device,
|
void _clutter_input_device_set_time (ClutterInputDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
||||||
ClutterStage *stage);
|
ClutterStage *stage);
|
||||||
|
CLUTTER_EXPORT
|
||||||
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
||||||
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
@ -233,44 +244,57 @@ void _clutter_input_device_set_actor (ClutterInputDev
|
|||||||
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
|
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
gboolean emit_crossing);
|
gboolean emit_crossing);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
||||||
guint n_keys);
|
guint n_keys);
|
||||||
|
CLUTTER_EXPORT
|
||||||
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
|
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
|
||||||
ClutterInputAxis axis,
|
ClutterInputAxis axis,
|
||||||
gdouble min_value,
|
gdouble min_value,
|
||||||
gdouble max_value,
|
gdouble max_value,
|
||||||
gdouble resolution);
|
gdouble resolution);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
||||||
ClutterInputDevice *associated);
|
ClutterInputDevice *associated);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_add_slave (ClutterInputDevice *master,
|
void _clutter_input_device_add_slave (ClutterInputDevice *master,
|
||||||
ClutterInputDevice *slave);
|
ClutterInputDevice *slave);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
||||||
ClutterInputDevice *slave);
|
ClutterInputDevice *slave);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
gdouble *axis_value);
|
gdouble *axis_value);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
|
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
ClutterScrollDirection direction,
|
ClutterScrollDirection direction,
|
||||||
gdouble increment);
|
gdouble increment);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
|
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
|
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
ClutterScrollDirection *direction_p,
|
ClutterScrollDirection *direction_p,
|
||||||
gdouble *delta_p);
|
gdouble *delta_p);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
|
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
|
||||||
guint64 serial,
|
guint64 serial,
|
||||||
ClutterInputDeviceToolType type);
|
ClutterInputDeviceToolType type);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void clutter_input_device_add_tool (ClutterInputDevice *device,
|
void clutter_input_device_add_tool (ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool);
|
ClutterInputDeviceTool *tool);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool);
|
ClutterInputDeviceTool *tool);
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ clutter_device_manager_get_default (void)
|
|||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
|
|
||||||
return backend->device_manager;
|
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_event_set_pointer_emulated (ClutterEvent *event,
|
void _clutter_event_set_pointer_emulated (ClutterEvent *event,
|
||||||
gboolean is_emulated);
|
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 (void);
|
||||||
void _clutter_clear_events_queue_for_stage (ClutterStage *stage);
|
void _clutter_clear_events_queue_for_stage (ClutterStage *stage);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_event_set_platform_data (ClutterEvent *event,
|
void _clutter_event_set_platform_data (ClutterEvent *event,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gpointer _clutter_event_get_platform_data (const ClutterEvent *event);
|
gpointer _clutter_event_get_platform_data (const ClutterEvent *event);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_event_set_state_full (ClutterEvent *event,
|
void _clutter_event_set_state_full (ClutterEvent *event,
|
||||||
ClutterModifierType button_state,
|
ClutterModifierType button_state,
|
||||||
ClutterModifierType base_state,
|
ClutterModifierType base_state,
|
||||||
@ -28,6 +32,7 @@ void _clutter_event_set_state_full (ClutterEvent *ev
|
|||||||
ClutterModifierType locked_state,
|
ClutterModifierType locked_state,
|
||||||
ClutterModifierType effective_state);
|
ClutterModifierType effective_state);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_event_push (const ClutterEvent *event,
|
void _clutter_event_push (const ClutterEvent *event,
|
||||||
gboolean do_copy);
|
gboolean do_copy);
|
||||||
|
|
||||||
|
@ -27,14 +27,19 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device);
|
void _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device);
|
void _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
|
void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
|
||||||
float x,
|
float x,
|
||||||
float y);
|
float y);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
|
void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
|
||||||
int button,
|
int button,
|
||||||
gboolean pressed);
|
gboolean pressed);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
|
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -26,10 +26,15 @@
|
|||||||
#define __CLUTTER_H_INSIDE__
|
#define __CLUTTER_H_INSIDE__
|
||||||
|
|
||||||
#include "clutter-backend.h"
|
#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-macros.h"
|
||||||
|
#include "clutter-private.h"
|
||||||
|
#include "clutter-stage-private.h"
|
||||||
#include "clutter-stage-view.h"
|
#include "clutter-stage-view.h"
|
||||||
#include "cogl/clutter-stage-cogl.h"
|
#include "cogl/clutter-stage-cogl.h"
|
||||||
#include "x11/clutter-stage-x11.h"
|
#include "clutter/x11/clutter-backend-x11.h"
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
||||||
|
@ -181,7 +181,9 @@ typedef struct
|
|||||||
gboolean _clutter_threads_dispatch (gpointer data);
|
gboolean _clutter_threads_dispatch (gpointer data);
|
||||||
void _clutter_threads_dispatch_free (gpointer data);
|
void _clutter_threads_dispatch_free (gpointer data);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_threads_acquire_lock (void);
|
void _clutter_threads_acquire_lock (void);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_threads_release_lock (void);
|
void _clutter_threads_release_lock (void);
|
||||||
|
|
||||||
ClutterMainContext * _clutter_context_get_default (void);
|
ClutterMainContext * _clutter_context_get_default (void);
|
||||||
@ -290,6 +292,7 @@ gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
|||||||
ClutterVertex *translate_p,
|
ClutterVertex *translate_p,
|
||||||
ClutterVertex4 *perspective_p);
|
ClutterVertex4 *perspective_p);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
||||||
|
|
||||||
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
|
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
|
||||||
|
@ -41,8 +41,11 @@ void _clutter_stage_paint_view (ClutterStage
|
|||||||
const cairo_rectangle_int_t *clip);
|
const cairo_rectangle_int_t *clip);
|
||||||
|
|
||||||
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_set_window (ClutterStage *stage,
|
void _clutter_stage_set_window (ClutterStage *stage,
|
||||||
ClutterStageWindow *stage_window);
|
ClutterStageWindow *stage_window);
|
||||||
|
CLUTTER_EXPORT
|
||||||
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
||||||
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
||||||
CoglMatrix *projection);
|
CoglMatrix *projection);
|
||||||
@ -64,6 +67,7 @@ void _clutter_stage_maybe_relayout (ClutterActor
|
|||||||
gboolean _clutter_stage_needs_update (ClutterStage *stage);
|
gboolean _clutter_stage_needs_update (ClutterStage *stage);
|
||||||
gboolean _clutter_stage_do_update (ClutterStage *stage);
|
gboolean _clutter_stage_do_update (ClutterStage *stage);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_queue_event (ClutterStage *stage,
|
void _clutter_stage_queue_event (ClutterStage *stage,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gboolean copy_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,
|
void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
|
||||||
ClutterEventSequence *sequence);
|
ClutterEventSequence *sequence);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
|
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_stage_is_activated (ClutterStage *stage);
|
gboolean _clutter_stage_is_activated (ClutterStage *stage);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_stage_update_state (ClutterStage *stage,
|
gboolean _clutter_stage_update_state (ClutterStage *stage,
|
||||||
ClutterStageState unset_state,
|
ClutterStageState unset_state,
|
||||||
ClutterStageState set_state);
|
ClutterStageState set_state);
|
||||||
|
@ -92,6 +92,7 @@ void _clutter_stage_window_hide (ClutterStageWin
|
|||||||
void _clutter_stage_window_resize (ClutterStageWindow *window,
|
void _clutter_stage_window_resize (ClutterStageWindow *window,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
||||||
cairo_rectangle_int_t *geometry);
|
cairo_rectangle_int_t *geometry);
|
||||||
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
||||||
|
@ -271,21 +271,9 @@ clutter_backend_private_headers = [
|
|||||||
if have_x11
|
if have_x11
|
||||||
clutter_x11_sources = [
|
clutter_x11_sources = [
|
||||||
'x11/clutter-backend-x11.c',
|
'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_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 = [
|
clutter_x11_headers = [
|
||||||
'x11/clutter-x11.h',
|
'x11/clutter-x11.h',
|
||||||
]
|
]
|
||||||
@ -293,14 +281,7 @@ if have_x11
|
|||||||
|
|
||||||
clutter_x11_private_headers = [
|
clutter_x11_private_headers = [
|
||||||
'x11/clutter-backend-x11.h',
|
'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-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
|
clutter_backend_private_headers += clutter_x11_private_headers
|
||||||
|
|
||||||
|
@ -34,9 +34,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "clutter-backend-x11.h"
|
#include "clutter-backend-x11.h"
|
||||||
#include "clutter-device-manager-xi2.h"
|
|
||||||
#include "clutter-settings-x11.h"
|
#include "clutter-settings-x11.h"
|
||||||
#include "clutter-stage-x11.h"
|
|
||||||
#include "clutter-x11.h"
|
#include "clutter-x11.h"
|
||||||
|
|
||||||
#include "xsettings/xsettings-common.h"
|
#include "xsettings/xsettings-common.h"
|
||||||
@ -54,7 +52,6 @@
|
|||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-settings-private.h"
|
#include "clutter-settings-private.h"
|
||||||
#include "clutter-xkb-a11y-x11.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND)
|
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));
|
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
|
static gboolean
|
||||||
clutter_backend_x11_pre_parse (ClutterBackend *backend,
|
clutter_backend_x11_pre_parse (ClutterBackend *backend,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -444,21 +372,6 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
|
|||||||
return TRUE;
|
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[] =
|
static const GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -578,8 +491,6 @@ clutter_backend_x11_translate_event (ClutterBackend *backend,
|
|||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||||
ClutterDeviceManagerXI2 *device_manager_x11;
|
|
||||||
ClutterStageX11 *stage_x11;
|
|
||||||
XEvent *xevent = native;
|
XEvent *xevent = native;
|
||||||
|
|
||||||
/* X11 filter functions have a higher priority */
|
/* 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);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,45 +646,6 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
|
|||||||
return display;
|
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
|
static void
|
||||||
clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
|
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->dispose = clutter_backend_x11_dispose;
|
||||||
gobject_class->finalize = clutter_backend_x11_finalize;
|
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->pre_parse = clutter_backend_x11_pre_parse;
|
||||||
backend_class->post_parse = clutter_backend_x11_post_parse;
|
backend_class->post_parse = clutter_backend_x11_post_parse;
|
||||||
backend_class->add_options = clutter_backend_x11_add_options;
|
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_renderer = clutter_backend_x11_get_renderer;
|
||||||
backend_class->get_display = clutter_backend_x11_get_display;
|
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
|
static void
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "clutter-x11.h"
|
#include "clutter-x11.h"
|
||||||
|
|
||||||
#include "clutter-backend-private.h"
|
#include "clutter-backend-private.h"
|
||||||
#include "clutter-keymap-x11.h"
|
|
||||||
|
|
||||||
#include "xsettings/xsettings-client.h"
|
#include "xsettings/xsettings-client.h"
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _ClutterBackendX11 ClutterBackendX11;
|
typedef struct _ClutterBackendX11 ClutterBackendX11;
|
||||||
typedef struct _ClutterBackendX11Class ClutterBackendX11Class;
|
typedef struct _ClutterBackendX11Class ClutterBackendX11Class;
|
||||||
typedef struct _ClutterEventX11 ClutterEventX11;
|
|
||||||
typedef struct _ClutterX11EventFilter ClutterX11EventFilter;
|
typedef struct _ClutterX11EventFilter ClutterX11EventFilter;
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackendX11, g_object_unref)
|
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
|
struct _ClutterBackendX11
|
||||||
{
|
{
|
||||||
ClutterBackend parent_instance;
|
ClutterBackend parent_instance;
|
||||||
@ -102,8 +90,6 @@ struct _ClutterBackendX11
|
|||||||
|
|
||||||
XSettingsClient *xsettings;
|
XSettingsClient *xsettings;
|
||||||
Window xsettings_xwin;
|
Window xsettings_xwin;
|
||||||
|
|
||||||
ClutterKeymapX11 *keymap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterBackendX11Class
|
struct _ClutterBackendX11Class
|
||||||
@ -116,17 +102,12 @@ GType clutter_backend_x11_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
ClutterBackend *clutter_backend_x11_new (void);
|
ClutterBackend *clutter_backend_x11_new (void);
|
||||||
|
|
||||||
void _clutter_backend_x11_events_init (ClutterBackend *backend);
|
|
||||||
|
|
||||||
/* Private to glx/eglx backends */
|
/* Private to glx/eglx backends */
|
||||||
|
CLUTTER_EXPORT
|
||||||
XVisualInfo * _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11);
|
XVisualInfo * _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11);
|
||||||
|
|
||||||
void _clutter_x11_select_events (Window xwin);
|
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,
|
gboolean _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device,
|
||||||
gint stage_root_x,
|
gint stage_root_x,
|
||||||
gint stage_root_y,
|
gint stage_root_y,
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* 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 __CLUTTER_DEVICE_MANAGER_XI2_H__
|
|
||||||
#define __CLUTTER_DEVICE_MANAGER_XI2_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-device-manager.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
|
||||||
#include <libwacom/libwacom.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_DEVICE_MANAGER_XI2 (_clutter_device_manager_xi2_get_type ())
|
|
||||||
#define CLUTTER_DEVICE_MANAGER_XI2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2))
|
|
||||||
#define CLUTTER_IS_DEVICE_MANAGER_XI2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2))
|
|
||||||
#define CLUTTER_DEVICE_MANAGER_XI2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class))
|
|
||||||
#define CLUTTER_IS_DEVICE_MANAGER_XI2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2))
|
|
||||||
#define CLUTTER_DEVICE_MANAGER_XI2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class))
|
|
||||||
|
|
||||||
typedef struct _ClutterDeviceManagerXI2 ClutterDeviceManagerXI2;
|
|
||||||
typedef struct _ClutterDeviceManagerXI2Class ClutterDeviceManagerXI2Class;
|
|
||||||
|
|
||||||
struct _ClutterDeviceManagerXI2
|
|
||||||
{
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ClutterDeviceManagerXI2Class
|
|
||||||
{
|
|
||||||
ClutterDeviceManagerClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType _clutter_device_manager_xi2_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
gboolean clutter_device_manager_xi2_translate_event (ClutterDeviceManagerXI2 *manager_xi2,
|
|
||||||
XEvent *xevent,
|
|
||||||
ClutterEvent *event);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_DEVICE_MANAGER_XI2_H__ */
|
|
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* 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 __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__
|
|
||||||
#define __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-input-device-tool.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2 (clutter_input_device_tool_xi2_get_type ())
|
|
||||||
|
|
||||||
#define CLUTTER_INPUT_DEVICE_TOOL_XI2(o) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((o), \
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2))
|
|
||||||
|
|
||||||
#define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2(o) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((o), \
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2))
|
|
||||||
|
|
||||||
#define CLUTTER_INPUT_DEVICE_TOOL_XI2_CLASS(c) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((c), \
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class))
|
|
||||||
|
|
||||||
#define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2_CLASS(c) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((c), \
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2))
|
|
||||||
|
|
||||||
#define CLUTTER_INPUT_DEVICE_TOOL_XI2_GET_CLASS(o) \
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((o), \
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class))
|
|
||||||
|
|
||||||
typedef struct _ClutterInputDeviceToolXI2 ClutterInputDeviceToolXI2;
|
|
||||||
typedef struct _ClutterInputDeviceToolXI2Class ClutterInputDeviceToolXI2Class;
|
|
||||||
|
|
||||||
struct _ClutterInputDeviceToolXI2
|
|
||||||
{
|
|
||||||
ClutterInputDeviceTool parent_instance;
|
|
||||||
struct libinput_tablet_tool *tool;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ClutterInputDeviceToolXI2Class
|
|
||||||
{
|
|
||||||
ClutterInputDeviceToolClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType clutter_input_device_tool_xi2_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
ClutterInputDeviceTool * clutter_input_device_tool_xi2_new (guint serial,
|
|
||||||
ClutterInputDeviceToolType type);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ */
|
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* 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 __CLUTTER_INPUT_DEVICE_XI2_H__
|
|
||||||
#define __CLUTTER_INPUT_DEVICE_XI2_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-input-device.h>
|
|
||||||
#include <X11/extensions/XInput2.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
|
||||||
#include <libwacom/libwacom.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_INPUT_DEVICE_XI2 (_clutter_input_device_xi2_get_type ())
|
|
||||||
#define CLUTTER_INPUT_DEVICE_XI2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2, ClutterInputDeviceXI2))
|
|
||||||
#define CLUTTER_IS_INPUT_DEVICE_XI2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2))
|
|
||||||
|
|
||||||
typedef struct _ClutterInputDeviceXI2 ClutterInputDeviceXI2;
|
|
||||||
|
|
||||||
GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
void _clutter_input_device_xi2_translate_state (ClutterEvent *event,
|
|
||||||
XIModifierState *modifiers_state,
|
|
||||||
XIButtonState *buttons_state,
|
|
||||||
XIGroupState *group_state);
|
|
||||||
void clutter_input_device_xi2_update_tool (ClutterInputDevice *device,
|
|
||||||
ClutterInputDeviceTool *tool);
|
|
||||||
ClutterInputDeviceTool * clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device);
|
|
||||||
gboolean clutter_input_device_xi2_get_pointer_location (ClutterInputDevice *device,
|
|
||||||
float *x,
|
|
||||||
float *y);
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
|
||||||
void clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice *device,
|
|
||||||
WacomDeviceDatabase *wacom_db);
|
|
||||||
|
|
||||||
guint clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
|
|
||||||
guint group);
|
|
||||||
|
|
||||||
void clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device,
|
|
||||||
guint button,
|
|
||||||
guint state,
|
|
||||||
guint *group,
|
|
||||||
guint *mode);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_INPUT_DEVICE_XI2_H__ */
|
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* 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 __CLUTTER_KEYMAP_X11_H__
|
|
||||||
#define __CLUTTER_KEYMAP_X11_H__
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <pango/pango.h>
|
|
||||||
#include <clutter/clutter-event.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_KEYMAP_X11 (_clutter_keymap_x11_get_type ())
|
|
||||||
#define CLUTTER_KEYMAP_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_KEYMAP_X11, ClutterKeymapX11))
|
|
||||||
#define CLUTTER_IS_KEYMAP_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_KEYMAP_X11))
|
|
||||||
|
|
||||||
typedef struct _ClutterKeymapX11 ClutterKeymapX11;
|
|
||||||
|
|
||||||
GType _clutter_keymap_x11_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
gint _clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap,
|
|
||||||
ClutterModifierType state);
|
|
||||||
gboolean _clutter_keymap_x11_get_num_lock_state (ClutterKeymapX11 *keymap);
|
|
||||||
gboolean _clutter_keymap_x11_get_caps_lock_state (ClutterKeymapX11 *keymap);
|
|
||||||
gint _clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
|
|
||||||
guint hardware_keycode,
|
|
||||||
ClutterModifierType *modifier_state_p,
|
|
||||||
ClutterModifierType *mods_p);
|
|
||||||
gboolean _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
|
|
||||||
gint keycode);
|
|
||||||
|
|
||||||
PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap);
|
|
||||||
|
|
||||||
gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
|
|
||||||
guint keyval,
|
|
||||||
guint *keycode_out,
|
|
||||||
guint *level_out);
|
|
||||||
void clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
|
|
||||||
uint32_t level,
|
|
||||||
gboolean enable);
|
|
||||||
gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
|
|
||||||
guint keyval,
|
|
||||||
guint *keycode_out);
|
|
||||||
void clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11,
|
|
||||||
guint keycode);
|
|
||||||
|
|
||||||
gboolean clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap,
|
|
||||||
XEvent *xevent);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_KEYMAP_X11_H__ */
|
|
@ -1,99 +0,0 @@
|
|||||||
/* 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 __CLUTTER_STAGE_X11_H__
|
|
||||||
#define __CLUTTER_STAGE_X11_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-group.h>
|
|
||||||
#include <clutter/clutter-stage.h>
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
|
|
||||||
#include "clutter-backend-x11.h"
|
|
||||||
#include "cogl/clutter-stage-cogl.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_STAGE_X11 (_clutter_stage_x11_get_type ())
|
|
||||||
#define CLUTTER_STAGE_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11))
|
|
||||||
#define CLUTTER_IS_STAGE_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_X11))
|
|
||||||
#define CLUTTER_STAGE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class))
|
|
||||||
#define CLUTTER_IS_STAGE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_X11))
|
|
||||||
#define CLUTTER_STAGE_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class))
|
|
||||||
|
|
||||||
typedef struct _ClutterStageX11 ClutterStageX11;
|
|
||||||
typedef struct _ClutterStageX11Class ClutterStageX11Class;
|
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStageX11, g_object_unref)
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
STAGE_X11_WITHDRAWN = 1 << 1
|
|
||||||
} ClutterStageX11State;
|
|
||||||
|
|
||||||
struct _ClutterStageX11
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
ClutterStageX11State wm_state;
|
|
||||||
|
|
||||||
guint is_cursor_visible : 1;
|
|
||||||
guint viewport_initialized : 1;
|
|
||||||
guint accept_focus : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ClutterStageX11Class
|
|
||||||
{
|
|
||||||
ClutterStageCoglClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType _clutter_stage_x11_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
void _clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
|
|
||||||
ClutterInputDevice *device,
|
|
||||||
ClutterDeviceManager *device_manager);
|
|
||||||
|
|
||||||
/* Private to subclasses */
|
|
||||||
void _clutter_stage_x11_set_user_time (ClutterStageX11 *stage_x11,
|
|
||||||
guint32 user_time);
|
|
||||||
|
|
||||||
gboolean clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
|
||||||
XEvent *xevent,
|
|
||||||
ClutterEvent *event);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_H__ */
|
|
@ -1,219 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* 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 "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
#include "clutter-x11.h"
|
|
||||||
#include "X11/extensions/XTest.h"
|
|
||||||
|
|
||||||
#include "clutter-virtual-input-device.h"
|
|
||||||
#include "x11/clutter-virtual-input-device-x11.h"
|
|
||||||
#include "x11/clutter-backend-x11.h"
|
|
||||||
#include "x11/clutter-keymap-x11.h"
|
|
||||||
|
|
||||||
struct _ClutterVirtualInputDeviceX11
|
|
||||||
{
|
|
||||||
ClutterVirtualInputDevice parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterVirtualInputDeviceX11,
|
|
||||||
clutter_virtual_input_device_x11,
|
|
||||||
CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE)
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device,
|
|
||||||
uint64_t time_us,
|
|
||||||
uint32_t keyval,
|
|
||||||
ClutterKeyState key_state)
|
|
||||||
{
|
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
|
|
||||||
ClutterKeymapX11 *keymap = backend_x11->keymap;
|
|
||||||
uint32_t keycode, level;
|
|
||||||
|
|
||||||
if (!clutter_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level))
|
|
||||||
{
|
|
||||||
level = 0;
|
|
||||||
|
|
||||||
if (!clutter_keymap_x11_reserve_keycode (keymap, keyval, &keycode))
|
|
||||||
{
|
|
||||||
g_warning ("No keycode found for keyval %x in current group", keyval);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) &&
|
|
||||||
key_state == CLUTTER_KEY_STATE_PRESSED)
|
|
||||||
clutter_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 (!_clutter_keymap_x11_get_is_modifier (keymap, keycode))
|
|
||||||
clutter_keymap_x11_latch_modifiers (keymap, level, FALSE);
|
|
||||||
clutter_keymap_x11_release_keycode_if_needed (keymap, keycode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_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
|
|
||||||
clutter_virtual_input_device_x11_init (ClutterVirtualInputDeviceX11 *virtual_device_x11)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_virtual_input_device_x11_class_init (ClutterVirtualInputDeviceX11Class *klass)
|
|
||||||
{
|
|
||||||
ClutterVirtualInputDeviceClass *virtual_input_device_class =
|
|
||||||
CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass);
|
|
||||||
|
|
||||||
virtual_input_device_class->notify_relative_motion = clutter_virtual_input_device_x11_notify_relative_motion;
|
|
||||||
virtual_input_device_class->notify_absolute_motion = clutter_virtual_input_device_x11_notify_absolute_motion;
|
|
||||||
virtual_input_device_class->notify_button = clutter_virtual_input_device_x11_notify_button;
|
|
||||||
virtual_input_device_class->notify_discrete_scroll = clutter_virtual_input_device_x11_notify_discrete_scroll;
|
|
||||||
virtual_input_device_class->notify_scroll_continuous = clutter_virtual_input_device_x11_notify_scroll_continuous;
|
|
||||||
virtual_input_device_class->notify_key = clutter_virtual_input_device_x11_notify_key;
|
|
||||||
virtual_input_device_class->notify_keyval = clutter_virtual_input_device_x11_notify_keyval;
|
|
||||||
virtual_input_device_class->notify_touch_down = clutter_virtual_input_device_x11_notify_touch_down;
|
|
||||||
virtual_input_device_class->notify_touch_motion = clutter_virtual_input_device_x11_notify_touch_motion;
|
|
||||||
virtual_input_device_class->notify_touch_up = clutter_virtual_input_device_x11_notify_touch_up;
|
|
||||||
}
|
|
@ -104,9 +104,6 @@ XVisualInfo *clutter_x11_get_visual_info (void);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_x11_set_display (Display * xdpy);
|
void clutter_x11_set_display (Display * xdpy);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
Window clutter_x11_get_stage_window (ClutterStage *stage);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_x11_add_filter (ClutterX11FilterFunc func,
|
void clutter_x11_add_filter (ClutterX11FilterFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
@ -114,12 +111,6 @@ CLUTTER_EXPORT
|
|||||||
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterStage *clutter_x11_get_stage_from_window (Window win);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_x11_has_composite_extension (void);
|
gboolean clutter_x11_has_composite_extension (void);
|
||||||
|
|
||||||
@ -133,15 +124,6 @@ void clutter_x11_set_use_stereo_stage (gboolean use_stereo);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_x11_get_use_stereo_stage (void);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_X11_H__ */
|
#endif /* __CLUTTER_X11_H__ */
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
#include "backends/meta-idle-monitor-private.h"
|
#include "backends/meta-idle-monitor-private.h"
|
||||||
#include "backends/meta-stage-private.h"
|
#include "backends/meta-stage-private.h"
|
||||||
#include "backends/x11/meta-clutter-backend-x11.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 "backends/x11/meta-renderer-x11.h"
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "clutter/x11/clutter-x11.h"
|
#include "clutter/x11/clutter-x11.h"
|
||||||
@ -382,7 +384,7 @@ handle_host_xevent (MetaBackend *backend,
|
|||||||
if (!bypass_clutter)
|
if (!bypass_clutter)
|
||||||
{
|
{
|
||||||
handle_input_event (x11, event);
|
handle_input_event (x11, event);
|
||||||
clutter_x11_handle_event (event);
|
meta_x11_handle_event (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFreeEventData (priv->xdisplay, &event->xcookie);
|
XFreeEventData (priv->xdisplay, &event->xcookie);
|
||||||
@ -807,7 +809,7 @@ Window
|
|||||||
meta_backend_x11_get_xwindow (MetaBackendX11 *x11)
|
meta_backend_x11_get_xwindow (MetaBackendX11 *x11)
|
||||||
{
|
{
|
||||||
ClutterActor *stage = meta_backend_get_stage (META_BACKEND (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
|
void
|
||||||
|
@ -29,7 +29,10 @@
|
|||||||
#include "backends/meta-backend-private.h"
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-renderer.h"
|
#include "backends/meta-renderer.h"
|
||||||
#include "backends/x11/meta-clutter-backend-x11.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-stage-x11-nested.h"
|
||||||
|
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "core/bell.h"
|
#include "core/bell.h"
|
||||||
@ -38,6 +41,8 @@
|
|||||||
struct _MetaClutterBackendX11
|
struct _MetaClutterBackendX11
|
||||||
{
|
{
|
||||||
ClutterBackendX11 parent;
|
ClutterBackendX11 parent;
|
||||||
|
MetaKeymapX11 *keymap;
|
||||||
|
MetaDeviceManagerX11 *device_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
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 ())
|
if (meta_is_wayland_compositor ())
|
||||||
stage_type = META_TYPE_STAGE_X11_NESTED;
|
stage_type = META_TYPE_STAGE_X11_NESTED;
|
||||||
else
|
else
|
||||||
stage_type = CLUTTER_TYPE_STAGE_X11;
|
stage_type = META_TYPE_STAGE_X11;
|
||||||
|
|
||||||
stage = g_object_new (stage_type,
|
stage = g_object_new (stage_type,
|
||||||
"backend", backend,
|
"backend", backend,
|
||||||
@ -81,6 +86,116 @@ meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
|
|||||||
meta_bell_notify (display, NULL);
|
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
|
static void
|
||||||
meta_clutter_backend_x11_init (MetaClutterBackendX11 *clutter_backend_x11)
|
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->get_renderer = meta_clutter_backend_x11_get_renderer;
|
||||||
clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage;
|
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->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;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
60
src/backends/x11/meta-device-manager-x11.h
Normal file
60
src/backends/x11/meta-device-manager-x11.h
Normal file
@ -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 */
|
@ -1,7 +1,4 @@
|
|||||||
/* Clutter.
|
/* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
|
|
||||||
* Copyright (C) 2009, 2010 Intel Corp.
|
* Copyright (C) 2009, 2010 Intel Corp.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -24,69 +21,39 @@
|
|||||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "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 <string.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#if 0
|
#include "backends/x11/meta-event-x11.h"
|
||||||
/* XEMBED protocol support for toolkit embedding */
|
#include "clutter/clutter-mutter.h"
|
||||||
#define XEMBED_MAPPED (1 << 0)
|
#include "clutter/x11/clutter-x11.h"
|
||||||
#define MAX_SUPPORTED_XEMBED_VERSION 1
|
|
||||||
|
|
||||||
#define XEMBED_EMBEDDED_NOTIFY 0
|
MetaEventX11 *
|
||||||
#define XEMBED_WINDOW_ACTIVATE 1
|
meta_event_x11_new (void)
|
||||||
#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)
|
|
||||||
{
|
{
|
||||||
return g_slice_new0 (ClutterEventX11);
|
return g_slice_new0 (MetaEventX11);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterEventX11 *
|
MetaEventX11 *
|
||||||
_clutter_event_x11_copy (ClutterEventX11 *event_x11)
|
meta_event_x11_copy (MetaEventX11 *event_x11)
|
||||||
{
|
{
|
||||||
if (event_x11 != NULL)
|
if (event_x11 != NULL)
|
||||||
return g_slice_dup (ClutterEventX11, event_x11);
|
return g_slice_dup (MetaEventX11, event_x11);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_event_x11_free (ClutterEventX11 *event_x11)
|
meta_event_x11_free (MetaEventX11 *event_x11)
|
||||||
{
|
{
|
||||||
if (event_x11 != NULL)
|
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
|
* @xevent: pointer to XEvent structure
|
||||||
*
|
*
|
||||||
* This function processes a single X event; it can be used to hook
|
* 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
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
ClutterX11FilterReturn
|
ClutterX11FilterReturn
|
||||||
clutter_x11_handle_event (XEvent *xevent)
|
meta_x11_handle_event (XEvent *xevent)
|
||||||
{
|
{
|
||||||
ClutterX11FilterReturn result;
|
ClutterX11FilterReturn result;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
@ -115,12 +82,12 @@ clutter_x11_handle_event (XEvent *xevent)
|
|||||||
gboolean allocated_event;
|
gboolean allocated_event;
|
||||||
|
|
||||||
/* The return values here are someone approximate; we return
|
/* 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,
|
* generated for the event. This mostly, but not entirely,
|
||||||
* corresponds to whether other event processing should be
|
* corresponds to whether other event processing should be
|
||||||
* excluded. As long as the stage window is not shared with another
|
* excluded. As long as the stage window is not shared with another
|
||||||
* toolkit it should be safe, and never return
|
* 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;
|
result = CLUTTER_X11_FILTER_CONTINUE;
|
||||||
@ -173,40 +140,18 @@ out:
|
|||||||
return result;
|
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
|
Time
|
||||||
clutter_x11_get_current_event_time (void)
|
meta_x11_get_current_event_time (void)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
|
|
||||||
return CLUTTER_BACKEND_X11 (backend)->last_event_time;
|
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
|
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 != NULL, 0);
|
||||||
g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS ||
|
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;
|
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
|
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);
|
g_return_val_if_fail (sequence != NULL, 0);
|
||||||
|
|
55
src/backends/x11/meta-event-x11.h
Normal file
55
src/backends/x11/meta-event-x11.h
Normal file
@ -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 */
|
@ -1,8 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright © 2016 Red Hat
|
* Copyright © 2016 Red Hat
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -21,28 +17,28 @@
|
|||||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
* 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)
|
CLUTTER_TYPE_INPUT_DEVICE_TOOL)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_input_device_tool_xi2_class_init (ClutterInputDeviceToolXI2Class *klass)
|
meta_input_device_tool_x11_class_init (MetaInputDeviceToolX11Class *klass)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_input_device_tool_xi2_init (ClutterInputDeviceToolXI2 *tool)
|
meta_input_device_tool_x11_init (MetaInputDeviceToolX11 *tool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterInputDeviceTool *
|
ClutterInputDeviceTool *
|
||||||
clutter_input_device_tool_xi2_new (guint serial,
|
meta_input_device_tool_x11_new (guint serial,
|
||||||
ClutterInputDeviceToolType type)
|
ClutterInputDeviceToolType type)
|
||||||
{
|
{
|
||||||
return g_object_new (CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2,
|
return g_object_new (META_TYPE_INPUT_DEVICE_TOOL_X11,
|
||||||
"type", type,
|
"type", type,
|
||||||
"serial", serial,
|
"serial", serial,
|
||||||
NULL);
|
NULL);
|
51
src/backends/x11/meta-input-device-tool-x11.h
Normal file
51
src/backends/x11/meta-input-device-tool-x11.h
Normal file
@ -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 */
|
@ -1,8 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright © 2011 Intel Corp.
|
* Copyright © 2011 Intel Corp.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -21,25 +17,15 @@
|
|||||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "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 <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
|
|
||||||
typedef struct _ClutterInputDeviceClass ClutterInputDeviceXI2Class;
|
#include "clutter/clutter-mutter.h"
|
||||||
|
#include "clutter/x11/clutter-x11.h"
|
||||||
|
#include "backends/x11/meta-input-device-x11.h"
|
||||||
|
|
||||||
/* a specific XI2 input device */
|
struct _MetaInputDeviceX11
|
||||||
struct _ClutterInputDeviceXI2
|
|
||||||
{
|
{
|
||||||
ClutterInputDevice device;
|
ClutterInputDevice device;
|
||||||
|
|
||||||
@ -57,38 +43,41 @@ struct _ClutterInputDeviceXI2
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _MetaInputDeviceX11Class
|
||||||
|
{
|
||||||
|
ClutterInputDeviceClass device_class;
|
||||||
|
};
|
||||||
|
|
||||||
#define N_BUTTONS 5
|
#define N_BUTTONS 5
|
||||||
|
|
||||||
#define clutter_input_device_xi2_get_type _clutter_input_device_xi2_get_type
|
G_DEFINE_TYPE (MetaInputDeviceX11,
|
||||||
|
meta_input_device_x11,
|
||||||
G_DEFINE_TYPE (ClutterInputDeviceXI2,
|
CLUTTER_TYPE_INPUT_DEVICE)
|
||||||
clutter_input_device_xi2,
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE);
|
|
||||||
|
|
||||||
static void
|
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)
|
if (G_OBJECT_CLASS (meta_input_device_x11_parent_class)->constructed)
|
||||||
G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->constructed (gobject);
|
G_OBJECT_CLASS (meta_input_device_x11_parent_class)->constructed (object);
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#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));
|
device_xi2->group_modes = g_array_new (FALSE, TRUE, sizeof (guint));
|
||||||
g_array_set_size (device_xi2->group_modes,
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_input_device_xi2_keycode_to_evdev (ClutterInputDevice *device,
|
meta_input_device_x11_keycode_to_evdev (ClutterInputDevice *device,
|
||||||
guint hardware_keycode,
|
guint hardware_keycode,
|
||||||
guint *evdev_keycode)
|
guint *evdev_keycode)
|
||||||
{
|
{
|
||||||
/* When using evdev under X11 the hardware keycodes are the evdev
|
/* When using evdev under X11 the hardware keycodes are the evdev
|
||||||
keycodes plus 8. I haven't been able to find any documentation to
|
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
|
static gboolean
|
||||||
clutter_input_device_xi2_is_grouped (ClutterInputDevice *device,
|
meta_input_device_x11_is_grouped (ClutterInputDevice *device,
|
||||||
ClutterInputDevice *other_device)
|
ClutterInputDevice *other_device)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_input_device_xi2_finalize (GObject *object)
|
meta_input_device_x11_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (object);
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (object);
|
||||||
|
|
||||||
if (device_xi2->wacom_device)
|
if (device_xi2->wacom_device)
|
||||||
libwacom_destroy (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);
|
g_source_remove (device_xi2->inhibit_pointer_query_timer);
|
||||||
#endif
|
#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
|
static gint
|
||||||
clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device,
|
meta_input_device_x11_get_group_n_modes (ClutterInputDevice *device,
|
||||||
gint group)
|
gint group)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||||
|
|
||||||
if (device_xi2->wacom_device)
|
if (device_xi2->wacom_device)
|
||||||
{
|
{
|
||||||
@ -156,10 +145,10 @@ clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device,
|
|||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
static int
|
static int
|
||||||
clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
|
meta_input_device_x11_get_button_group (ClutterInputDevice *device,
|
||||||
guint button)
|
guint button)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||||
|
|
||||||
if (device_xi2->wacom_device)
|
if (device_xi2->wacom_device)
|
||||||
{
|
{
|
||||||
@ -175,36 +164,36 @@ clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_input_device_xi2_is_mode_switch_button (ClutterInputDevice *device,
|
meta_input_device_x11_is_mode_switch_button (ClutterInputDevice *device,
|
||||||
guint group,
|
guint group,
|
||||||
guint button)
|
guint button)
|
||||||
{
|
{
|
||||||
int button_group = -1;
|
int button_group = -1;
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#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
|
#endif
|
||||||
|
|
||||||
return button_group == (int) group;
|
return button_group == (int) group;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass);
|
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->constructed = clutter_input_device_xi2_constructed;
|
gobject_class->constructed = meta_input_device_x11_constructed;
|
||||||
gobject_class->finalize = clutter_input_device_xi2_finalize;
|
gobject_class->finalize = meta_input_device_x11_finalize;
|
||||||
|
|
||||||
device_class->keycode_to_evdev = clutter_input_device_xi2_keycode_to_evdev;
|
device_class->keycode_to_evdev = meta_input_device_x11_keycode_to_evdev;
|
||||||
device_class->is_grouped = clutter_input_device_xi2_is_grouped;
|
device_class->is_grouped = meta_input_device_x11_is_grouped;
|
||||||
device_class->get_group_n_modes = clutter_input_device_xi2_get_group_n_modes;
|
device_class->get_group_n_modes = meta_input_device_x11_get_group_n_modes;
|
||||||
device_class->is_mode_switch_button = clutter_input_device_xi2_is_mode_switch_button;
|
device_class->is_mode_switch_button = meta_input_device_x11_is_mode_switch_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
void
|
||||||
_clutter_input_device_xi2_translate_state (ClutterEvent *event,
|
meta_input_device_x11_translate_state (ClutterEvent *event,
|
||||||
XIModifierState *modifiers_state,
|
XIModifierState *modifiers_state,
|
||||||
XIButtonState *buttons_state,
|
XIButtonState *buttons_state,
|
||||||
XIGroupState *group_state)
|
XIGroupState *group_state)
|
||||||
{
|
{
|
||||||
guint button = 0;
|
guint button = 0;
|
||||||
guint base = 0;
|
guint base = 0;
|
||||||
@ -287,22 +276,22 @@ _clutter_input_device_xi2_translate_state (ClutterEvent *event,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_input_device_xi2_update_tool (ClutterInputDevice *device,
|
meta_input_device_x11_update_tool (ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool)
|
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);
|
g_set_object (&device_xi2->current_tool, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterInputDeviceTool *
|
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;
|
return device_xi2->current_tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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;
|
Window xroot_window, xchild_window;
|
||||||
double xroot_x, xroot_y, xwin_x, xwin_y;
|
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
|
static gboolean
|
||||||
clear_inhibit_pointer_query_cb (gpointer data)
|
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;
|
device_xi2->inhibit_pointer_query_timer = 0;
|
||||||
|
|
||||||
@ -344,22 +333,21 @@ clear_inhibit_pointer_query_cb (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_input_device_xi2_get_pointer_location (ClutterInputDevice *device,
|
meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
|
||||||
float *x,
|
float *x,
|
||||||
float *y)
|
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 (META_IS_INPUT_DEVICE_X11 (device), FALSE);
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_XI2 (device_xi2), FALSE);
|
|
||||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, FALSE);
|
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, FALSE);
|
||||||
|
|
||||||
/* Throttle XServer queries and roundtrips using an idle timeout */
|
/* Throttle XServer queries and roundtrips using an idle timeout */
|
||||||
if (device_xi2->inhibit_pointer_query_timer == 0)
|
if (device_xi2->inhibit_pointer_query_timer == 0)
|
||||||
{
|
{
|
||||||
device_xi2->query_status =
|
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 =
|
device_xi2->inhibit_pointer_query_timer =
|
||||||
clutter_threads_add_idle (clear_inhibit_pointer_query_cb, device_xi2);
|
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
|
#ifdef HAVE_LIBWACOM
|
||||||
void
|
void
|
||||||
clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice *device,
|
meta_input_device_x11_ensure_wacom_info (ClutterInputDevice *device,
|
||||||
WacomDeviceDatabase *wacom_db)
|
WacomDeviceDatabase *wacom_db)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||||
const gchar *node_path;
|
const gchar *node_path;
|
||||||
|
|
||||||
node_path = clutter_input_device_get_device_node (device);
|
node_path = clutter_input_device_get_device_node (device);
|
||||||
@ -384,10 +372,10 @@ clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
|
meta_input_device_x11_get_pad_group_mode (ClutterInputDevice *device,
|
||||||
guint group)
|
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)
|
if (group >= device_xi2->group_modes->len)
|
||||||
return 0;
|
return 0;
|
||||||
@ -396,17 +384,17 @@ clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device,
|
meta_input_device_x11_update_pad_state (ClutterInputDevice *device,
|
||||||
guint button,
|
guint button,
|
||||||
guint state,
|
guint state,
|
||||||
guint *group,
|
guint *group,
|
||||||
guint *mode)
|
guint *mode)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||||
guint button_group, *group_mode;
|
guint button_group, *group_mode;
|
||||||
gboolean is_mode_switch = FALSE;
|
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;
|
is_mode_switch = button_group >= 0;
|
||||||
|
|
||||||
/* Assign all non-mode-switch buttons to group 0 so far */
|
/* Assign all non-mode-switch buttons to group 0 so far */
|
74
src/backends/x11/meta-input-device-x11.h
Normal file
74
src/backends/x11/meta-input-device-x11.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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 <X11/extensions/XInput2.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBWACOM
|
||||||
|
#include <libwacom/libwacom.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
|
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 */
|
@ -21,18 +21,16 @@
|
|||||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "clutter-keymap-x11.h"
|
|
||||||
#include "clutter-backend-x11.h"
|
|
||||||
|
|
||||||
#include "clutter-debug.h"
|
|
||||||
#include "clutter-private.h"
|
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
|
||||||
typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class;
|
#include "backends/x11/meta-keymap-x11.h"
|
||||||
|
#include "clutter/clutter.h"
|
||||||
|
#include "clutter/clutter-mutter.h"
|
||||||
|
#include "clutter/x11/clutter-x11.h"
|
||||||
|
|
||||||
typedef struct _DirectionCacheEntry DirectionCacheEntry;
|
typedef struct _DirectionCacheEntry DirectionCacheEntry;
|
||||||
typedef struct _ClutterKeymapKey ClutterKeymapKey;
|
typedef struct _ClutterKeymapKey ClutterKeymapKey;
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ struct _DirectionCacheEntry
|
|||||||
PangoDirection direction;
|
PangoDirection direction;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterKeymapX11
|
struct _MetaKeymapX11
|
||||||
{
|
{
|
||||||
ClutterKeymap parent_instance;
|
ClutterKeymap parent_instance;
|
||||||
|
|
||||||
@ -88,11 +86,6 @@ struct _ClutterKeymapX11
|
|||||||
guint have_xkb_autorepeat : 1;
|
guint have_xkb_autorepeat : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterKeymapX11Class
|
|
||||||
{
|
|
||||||
ClutterKeymapClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@ -104,14 +97,12 @@ enum
|
|||||||
|
|
||||||
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
|
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
|
||||||
|
|
||||||
#define clutter_keymap_x11_get_type _clutter_keymap_x11_get_type
|
G_DEFINE_TYPE (MetaKeymapX11, meta_keymap_x11, CLUTTER_TYPE_KEYMAP)
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterKeymapX11, clutter_keymap_x11, CLUTTER_TYPE_KEYMAP)
|
|
||||||
|
|
||||||
/* code adapted from gdk/x11/gdkkeys-x11.c - update_modmap */
|
/* code adapted from gdk/x11/gdkkeys-x11.c - update_modmap */
|
||||||
static void
|
static void
|
||||||
update_modmap (Display *display,
|
update_modmap (Display *display,
|
||||||
ClutterKeymapX11 *keymap_x11)
|
MetaKeymapX11 *keymap_x11)
|
||||||
{
|
{
|
||||||
static struct {
|
static struct {
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
@ -150,12 +141,12 @@ update_modmap (Display *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static XkbDescPtr
|
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)
|
if (keymap_x11->max_keycode == 0)
|
||||||
XDisplayKeycodes (backend_x11->xdpy,
|
XDisplayKeycodes (xdisplay,
|
||||||
&keymap_x11->min_keycode,
|
&keymap_x11->min_keycode,
|
||||||
&keymap_x11->max_keycode);
|
&keymap_x11->max_keycode);
|
||||||
|
|
||||||
@ -166,7 +157,7 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
|
|||||||
| XkbModifierMapMask
|
| XkbModifierMapMask
|
||||||
| XkbVirtualModsMask;
|
| 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))
|
if (G_UNLIKELY (keymap_x11->xkb_desc == NULL))
|
||||||
{
|
{
|
||||||
g_error ("Failed to get the keymap from XKB");
|
g_error ("Failed to get the keymap from XKB");
|
||||||
@ -174,9 +165,9 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
|
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)
|
else if (keymap_x11->xkb_map_serial != keymap_x11->keymap_serial)
|
||||||
{
|
{
|
||||||
@ -185,35 +176,32 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
|
|||||||
| XkbModifierMapMask
|
| XkbModifierMapMask
|
||||||
| XkbVirtualModsMask;
|
| XkbVirtualModsMask;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "Updating XKB keymap");
|
XkbGetUpdatedMap (xdisplay, flags, keymap_x11->xkb_desc);
|
||||||
|
|
||||||
XkbGetUpdatedMap (backend_x11->xdpy, flags, keymap_x11->xkb_desc);
|
|
||||||
|
|
||||||
flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
|
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;
|
keymap_x11->xkb_map_serial = keymap_x11->keymap_serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keymap_x11->num_lock_mask == 0)
|
if (keymap_x11->num_lock_mask == 0)
|
||||||
keymap_x11->num_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
|
keymap_x11->num_lock_mask = XkbKeysymToModifiers (xdisplay, XK_Num_Lock);
|
||||||
XK_Num_Lock);
|
|
||||||
|
|
||||||
if (keymap_x11->scroll_lock_mask == 0)
|
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);
|
XK_Scroll_Lock);
|
||||||
if (keymap_x11->level3_shift_mask == 0)
|
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);
|
XK_ISO_Level3_Shift);
|
||||||
|
|
||||||
return keymap_x11->xkb_desc;
|
return keymap_x11->xkb_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_locked_mods (ClutterKeymapX11 *keymap_x11,
|
update_locked_mods (MetaKeymapX11 *keymap_x11,
|
||||||
gint locked_mods)
|
gint locked_mods)
|
||||||
{
|
{
|
||||||
gboolean old_caps_lock_state, old_num_lock_state;
|
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->caps_lock_state = (locked_mods & CLUTTER_LOCK_MASK) != 0;
|
||||||
keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_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",
|
g_debug ("Locks state changed - Num: %s, Caps: %s",
|
||||||
keymap_x11->num_lock_state ? "set" : "unset",
|
keymap_x11->num_lock_state ? "set" : "unset",
|
||||||
keymap_x11->caps_lock_state ? "set" : "unset");
|
keymap_x11->caps_lock_state ? "set" : "unset");
|
||||||
|
|
||||||
if ((keymap_x11->caps_lock_state != old_caps_lock_state) ||
|
if ((keymap_x11->caps_lock_state != old_caps_lock_state) ||
|
||||||
(keymap_x11->num_lock_state != old_num_lock_state))
|
(keymap_x11->num_lock_state != old_num_lock_state))
|
||||||
@ -274,9 +262,9 @@ get_direction (XkbDescPtr xkb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PangoDirection
|
static PangoDirection
|
||||||
get_direction_from_cache (ClutterKeymapX11 *keymap_x11,
|
get_direction_from_cache (MetaKeymapX11 *keymap_x11,
|
||||||
XkbDescPtr xkb,
|
XkbDescPtr xkb,
|
||||||
int group)
|
int group)
|
||||||
{
|
{
|
||||||
Atom group_atom = xkb->names->groups[group];
|
Atom group_atom = xkb->names->groups[group];
|
||||||
gboolean cache_hit = FALSE;
|
gboolean cache_hit = FALSE;
|
||||||
@ -335,8 +323,8 @@ get_direction_from_cache (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_direction (ClutterKeymapX11 *keymap_x11,
|
update_direction (MetaKeymapX11 *keymap_x11,
|
||||||
int group)
|
int group)
|
||||||
{
|
{
|
||||||
XkbDescPtr xkb = get_xkb (keymap_x11);
|
XkbDescPtr xkb = get_xkb (keymap_x11);
|
||||||
Atom group_atom;
|
Atom group_atom;
|
||||||
@ -352,22 +340,21 @@ update_direction (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_keymap_x11_constructed (GObject *gobject)
|
meta_keymap_x11_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (gobject);
|
MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (object);
|
||||||
ClutterBackendX11 *backend_x11;
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
gint xkb_major = XkbMajorVersion;
|
gint xkb_major = XkbMajorVersion;
|
||||||
gint xkb_minor = XkbMinorVersion;
|
gint xkb_minor = XkbMinorVersion;
|
||||||
|
|
||||||
g_assert (keymap_x11->backend != NULL);
|
g_assert (keymap_x11->backend != NULL);
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
|
|
||||||
|
|
||||||
if (XkbLibraryVersion (&xkb_major, &xkb_minor))
|
if (XkbLibraryVersion (&xkb_major, &xkb_minor))
|
||||||
{
|
{
|
||||||
xkb_major = XkbMajorVersion;
|
xkb_major = XkbMajorVersion;
|
||||||
xkb_minor = XkbMinorVersion;
|
xkb_minor = XkbMinorVersion;
|
||||||
|
|
||||||
if (XkbQueryExtension (backend_x11->xdpy,
|
if (XkbQueryExtension (xdisplay,
|
||||||
NULL,
|
NULL,
|
||||||
&keymap_x11->xkb_event_base,
|
&keymap_x11->xkb_event_base,
|
||||||
NULL,
|
NULL,
|
||||||
@ -377,18 +364,18 @@ clutter_keymap_x11_constructed (GObject *gobject)
|
|||||||
|
|
||||||
keymap_x11->use_xkb = TRUE;
|
keymap_x11->use_xkb = TRUE;
|
||||||
|
|
||||||
XkbSelectEvents (backend_x11->xdpy,
|
XkbSelectEvents (xdisplay,
|
||||||
XkbUseCoreKbd,
|
XkbUseCoreKbd,
|
||||||
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
|
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
|
||||||
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
|
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
|
||||||
|
|
||||||
XkbSelectEventDetails (backend_x11->xdpy,
|
XkbSelectEventDetails (xdisplay,
|
||||||
XkbUseCoreKbd, XkbStateNotify,
|
XkbUseCoreKbd, XkbStateNotify,
|
||||||
XkbAllStateComponentsMask,
|
XkbAllStateComponentsMask,
|
||||||
XkbGroupLockMask | XkbModifierLockMask);
|
XkbGroupLockMask | XkbModifierLockMask);
|
||||||
|
|
||||||
/* enable XKB autorepeat */
|
/* enable XKB autorepeat */
|
||||||
XkbSetDetectableAutoRepeat (backend_x11->xdpy,
|
XkbSetDetectableAutoRepeat (xdisplay,
|
||||||
True,
|
True,
|
||||||
&detectable_autorepeat_supported);
|
&detectable_autorepeat_supported);
|
||||||
|
|
||||||
@ -398,12 +385,12 @@ clutter_keymap_x11_constructed (GObject *gobject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_keymap_x11_set_property (GObject *gobject,
|
meta_keymap_x11_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterKeymapX11 *keymap = CLUTTER_KEYMAP_X11 (gobject);
|
MetaKeymapX11 *keymap = META_KEYMAP_X11 (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -412,13 +399,13 @@ clutter_keymap_x11_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 ();
|
Display *dpy = clutter_x11_get_default_display ();
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
@ -444,9 +431,9 @@ clutter_keymap_x11_refresh_reserved_keycodes (ClutterKeymapX11 *keymap_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_keymap_x11_replace_keycode (ClutterKeymapX11 *keymap_x11,
|
meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
|
||||||
KeyCode keycode,
|
KeyCode keycode,
|
||||||
KeySym keysym)
|
KeySym keysym)
|
||||||
{
|
{
|
||||||
if (keymap_x11->use_xkb)
|
if (keymap_x11->use_xkb)
|
||||||
{
|
{
|
||||||
@ -487,20 +474,20 @@ clutter_keymap_x11_replace_keycode (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_keymap_x11_finalize (GObject *gobject)
|
meta_keymap_x11_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
ClutterKeymapX11 *keymap;
|
MetaKeymapX11 *keymap;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer key, value;
|
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);
|
g_hash_table_iter_init (&iter, keymap->reserved_keycodes);
|
||||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||||
{
|
{
|
||||||
guint keycode = GPOINTER_TO_UINT (key);
|
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);
|
g_hash_table_destroy (keymap->reserved_keycodes);
|
||||||
@ -509,50 +496,50 @@ clutter_keymap_x11_finalize (GObject *gobject)
|
|||||||
if (keymap->xkb_desc != NULL)
|
if (keymap->xkb_desc != NULL)
|
||||||
XkbFreeKeyboard (keymap->xkb_desc, XkbAllComponentsMask, True);
|
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
|
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;
|
return keymap_x11->num_lock_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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;
|
return keymap_x11->caps_lock_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_keymap_x11_class_init (ClutterKeymapX11Class *klass)
|
meta_keymap_x11_class_init (MetaKeymapX11Class *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterKeymapClass *keymap_class = CLUTTER_KEYMAP_CLASS (klass);
|
ClutterKeymapClass *keymap_class = CLUTTER_KEYMAP_CLASS (klass);
|
||||||
|
|
||||||
obj_props[PROP_BACKEND] =
|
obj_props[PROP_BACKEND] =
|
||||||
g_param_spec_object ("backend",
|
g_param_spec_object ("backend",
|
||||||
P_("Backend"),
|
"Backend",
|
||||||
P_("The Clutter backend"),
|
"The Clutter backend",
|
||||||
CLUTTER_TYPE_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->constructed = meta_keymap_x11_constructed;
|
||||||
gobject_class->set_property = clutter_keymap_x11_set_property;
|
gobject_class->set_property = meta_keymap_x11_set_property;
|
||||||
gobject_class->finalize = clutter_keymap_x11_finalize;
|
gobject_class->finalize = meta_keymap_x11_finalize;
|
||||||
|
|
||||||
keymap_class->get_num_lock_state = clutter_keymap_x11_get_num_lock_state;
|
keymap_class->get_num_lock_state = meta_keymap_x11_get_num_lock_state;
|
||||||
keymap_class->get_caps_lock_state = clutter_keymap_x11_get_caps_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);
|
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_keymap_x11_init (ClutterKeymapX11 *keymap)
|
meta_keymap_x11_init (MetaKeymapX11 *keymap)
|
||||||
{
|
{
|
||||||
keymap->current_direction = PANGO_DIRECTION_NEUTRAL;
|
keymap->current_direction = PANGO_DIRECTION_NEUTRAL;
|
||||||
keymap->current_group = -1;
|
keymap->current_group = -1;
|
||||||
@ -561,8 +548,8 @@ clutter_keymap_x11_init (ClutterKeymapX11 *keymap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
|
meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
|
||||||
@ -578,7 +565,7 @@ clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
|
|||||||
switch (xkb_event->any.xkb_type)
|
switch (xkb_event->any.xkb_type)
|
||||||
{
|
{
|
||||||
case XkbStateNotify:
|
case XkbStateNotify:
|
||||||
CLUTTER_NOTE (EVENT, "Updating keyboard state");
|
g_debug ("Updating keyboard state");
|
||||||
keymap_x11->current_group = XkbStateGroup (&xkb_event->state);
|
keymap_x11->current_group = XkbStateGroup (&xkb_event->state);
|
||||||
update_direction (keymap_x11, keymap_x11->current_group);
|
update_direction (keymap_x11, keymap_x11->current_group);
|
||||||
update_locked_mods (keymap_x11, xkb_event->state.locked_mods);
|
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 XkbNewKeyboardNotify:
|
||||||
case XkbMapNotify:
|
case XkbMapNotify:
|
||||||
CLUTTER_NOTE (EVENT, "Updating keyboard mapping");
|
g_debug ("Updating keyboard mapping");
|
||||||
XkbRefreshKeyboardMapping (&xkb_event->map);
|
XkbRefreshKeyboardMapping (&xkb_event->map);
|
||||||
keymap_x11->keymap_serial += 1;
|
keymap_x11->keymap_serial += 1;
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
@ -608,8 +595,8 @@ clutter_keymap_x11_handle_event (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
_clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap,
|
meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap,
|
||||||
ClutterModifierType state)
|
ClutterModifierType state)
|
||||||
{
|
{
|
||||||
return XkbGroupForCoreState (state);
|
return XkbGroupForCoreState (state);
|
||||||
}
|
}
|
||||||
@ -622,32 +609,29 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|||||||
* a fallback path.
|
* a fallback path.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
translate_keysym (ClutterKeymapX11 *keymap,
|
translate_keysym (MetaKeymapX11 *keymap,
|
||||||
guint hardware_keycode)
|
guint hardware_keycode)
|
||||||
{
|
{
|
||||||
ClutterBackendX11 *backend_x11;
|
|
||||||
gint retval;
|
gint retval;
|
||||||
|
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (keymap->backend);
|
retval = XKeycodeToKeysym (clutter_x11_get_default_display (),
|
||||||
|
hardware_keycode, 0);
|
||||||
retval = XKeycodeToKeysym (backend_x11->xdpy, hardware_keycode, 0);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
gint
|
gint
|
||||||
_clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
|
meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap,
|
||||||
guint hardware_keycode,
|
guint hardware_keycode,
|
||||||
ClutterModifierType *modifier_state_p,
|
ClutterModifierType *modifier_state_p,
|
||||||
ClutterModifierType *mods_p)
|
ClutterModifierType *mods_p)
|
||||||
{
|
{
|
||||||
ClutterModifierType unconsumed_modifiers = 0;
|
ClutterModifierType unconsumed_modifiers = 0;
|
||||||
ClutterModifierType modifier_state = *modifier_state_p;
|
ClutterModifierType modifier_state = *modifier_state_p;
|
||||||
gint retval;
|
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)
|
if (keymap->use_xkb)
|
||||||
{
|
{
|
||||||
@ -677,10 +661,10 @@ _clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
|
meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap,
|
||||||
gint keycode)
|
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)
|
if (keycode < keymap->min_keycode || keycode > keymap->max_keycode)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -697,18 +681,18 @@ _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PangoDirection
|
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->use_xkb)
|
||||||
{
|
{
|
||||||
if (!keymap->has_direction)
|
if (!keymap->has_direction)
|
||||||
{
|
{
|
||||||
Display *xdisplay = CLUTTER_BACKEND_X11 (keymap->backend)->xdpy;
|
|
||||||
XkbStateRec state_rec;
|
XkbStateRec state_rec;
|
||||||
|
|
||||||
XkbGetState (xdisplay, XkbUseCoreKbd, &state_rec);
|
XkbGetState (clutter_x11_get_default_display (),
|
||||||
|
XkbUseCoreKbd, &state_rec);
|
||||||
update_direction (keymap, XkbStateGroup (&state_rec));
|
update_direction (keymap, XkbStateGroup (&state_rec));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,10 +703,10 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
|
meta_keymap_x11_get_entries_for_keyval (MetaKeymapX11 *keymap_x11,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
ClutterKeymapKey **keys,
|
ClutterKeymapKey **keys,
|
||||||
gint *n_keys)
|
gint *n_keys)
|
||||||
{
|
{
|
||||||
if (keymap_x11->use_xkb)
|
if (keymap_x11->use_xkb)
|
||||||
{
|
{
|
||||||
@ -802,11 +786,11 @@ clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
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)
|
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)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
|
gboolean
|
||||||
guint keyval,
|
meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
|
||||||
guint *keycode_out)
|
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 (keyval != 0, FALSE);
|
||||||
g_return_val_if_fail (keycode_out != NULL, 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)
|
if (*keycode_out == NoSymbol)
|
||||||
{
|
{
|
||||||
@ -843,7 +828,7 @@ gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
|
|||||||
return FALSE;
|
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);
|
g_warning ("Failed to remap keycode %d to keyval %d", *keycode_out, keyval);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -855,10 +840,11 @@ gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11,
|
void
|
||||||
guint keycode)
|
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)) ||
|
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)
|
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
|
void
|
||||||
clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
|
meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
|
||||||
uint32_t level,
|
uint32_t level,
|
||||||
gboolean enable)
|
gboolean enable)
|
||||||
{
|
{
|
||||||
uint32_t modifiers[] = {
|
uint32_t modifiers[] = {
|
||||||
0,
|
0,
|
||||||
@ -896,23 +882,23 @@ clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
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;
|
XkbStateRec state_rec;
|
||||||
|
|
||||||
if (keymap_x11->current_group >= 0)
|
if (keymap_x11->current_group >= 0)
|
||||||
return keymap_x11->current_group;
|
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);
|
return XkbStateGroup (&state_rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
|
meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
guint *keycode_out,
|
guint *keycode_out,
|
||||||
guint *level_out)
|
guint *level_out)
|
||||||
{
|
{
|
||||||
ClutterKeymapKey *keys;
|
ClutterKeymapKey *keys;
|
||||||
gint i, n_keys, group;
|
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 (keycode_out != NULL, FALSE);
|
||||||
g_return_val_if_fail (level_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;
|
return FALSE;
|
||||||
|
|
||||||
for (i = 0; i < n_keys && !found; i++)
|
for (i = 0; i < n_keys && !found; i++)
|
63
src/backends/x11/meta-keymap-x11.h
Normal file
63
src/backends/x11/meta-keymap-x11.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* 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 */
|
@ -39,7 +39,7 @@ static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
|
|||||||
|
|
||||||
struct _MetaStageX11Nested
|
struct _MetaStageX11Nested
|
||||||
{
|
{
|
||||||
ClutterStageX11 parent;
|
MetaStageX11 parent;
|
||||||
|
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
};
|
};
|
||||||
@ -48,11 +48,11 @@ static void
|
|||||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (MetaStageX11Nested, meta_stage_x11_nested,
|
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,
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||||
clutter_stage_window_iface_init))
|
clutter_stage_window_iface_init))
|
||||||
|
|
||||||
typedef struct _ClutterStageX11View
|
typedef struct _MetaStageX11View
|
||||||
{
|
{
|
||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
ClutterStageViewCogl *view;
|
ClutterStageViewCogl *view;
|
||||||
@ -108,7 +108,7 @@ draw_crtc (MetaMonitor *monitor,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
DrawCrtcData *data = user_data;
|
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);
|
CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
|
||||||
CoglTexture *texture = data->texture;
|
CoglTexture *texture = data->texture;
|
||||||
MetaLogicalMonitor *logical_monitor = data->logical_monitor;
|
MetaLogicalMonitor *logical_monitor = data->logical_monitor;
|
||||||
@ -247,7 +247,7 @@ static void
|
|||||||
meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
|
meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
|
||||||
{
|
{
|
||||||
MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (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 ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
#define META_STAGE_X11_NESTED_H
|
#define META_STAGE_X11_NESTED_H
|
||||||
|
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
|
#include "meta-stage-x11.h"
|
||||||
|
|
||||||
#define META_TYPE_STAGE_X11_NESTED (meta_stage_x11_nested_get_type ())
|
#define META_TYPE_STAGE_X11_NESTED (meta_stage_x11_nested_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (MetaStageX11Nested, meta_stage_x11_nested,
|
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 */
|
#endif /* META_STAGE_X11_NESTED_H */
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* Clutter.
|
/*
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||||
* Copyright (C) 2006-2007 OpenedHand
|
* Copyright (C) 2006-2007 OpenedHand
|
||||||
*
|
*
|
||||||
@ -16,10 +15,9 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* 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 <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -28,39 +26,28 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cogl/cogl.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"
|
||||||
|
|
||||||
#include "clutter-backend-x11.h"
|
#define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
|
||||||
#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"
|
|
||||||
|
|
||||||
#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
|
|
||||||
|
|
||||||
static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
|
static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
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;
|
static GHashTable *clutter_stages_by_xid = NULL;
|
||||||
|
|
||||||
#define clutter_stage_x11_get_type _clutter_stage_x11_get_type
|
G_DEFINE_TYPE_WITH_CODE (MetaStageX11,
|
||||||
|
meta_stage_x11,
|
||||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
|
|
||||||
clutter_stage_x11,
|
|
||||||
CLUTTER_TYPE_STAGE_COGL,
|
CLUTTER_TYPE_STAGE_COGL,
|
||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||||
clutter_stage_window_iface_init));
|
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_ADD 1 /* add/set property */
|
||||||
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
||||||
|
|
||||||
#define CLUTTER_STAGE_X11_EVENT_MASK \
|
#define META_STAGE_X11_EVENT_MASK \
|
||||||
StructureNotifyMask | \
|
StructureNotifyMask | \
|
||||||
FocusChangeMask | \
|
FocusChangeMask | \
|
||||||
ExposureMask | \
|
ExposureMask | \
|
||||||
@ -83,15 +70,15 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
|
|||||||
PointerMotionMask
|
PointerMotionMask
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
meta_stage_x11_fix_window_size (MetaStageX11 *stage_x11,
|
||||||
gint new_width,
|
gint new_width,
|
||||||
gint new_height)
|
gint new_height)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
|
||||||
|
|
||||||
if (stage_x11->xwin != None)
|
if (stage_x11->xwin != None)
|
||||||
{
|
{
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
guint min_width, min_height;
|
guint min_width, min_height;
|
||||||
XSizeHints *size_hints;
|
XSizeHints *size_hints;
|
||||||
|
|
||||||
@ -113,31 +100,32 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
|||||||
size_hints->max_height = new_height;
|
size_hints->max_height = new_height;
|
||||||
size_hints->flags = PMinSize | PMaxSize;
|
size_hints->flags = PMinSize | PMaxSize;
|
||||||
|
|
||||||
XSetWMNormalHints (backend_x11->xdpy, stage_x11->xwin, size_hints);
|
XSetWMNormalHints (xdisplay, stage_x11->xwin, size_hints);
|
||||||
|
|
||||||
XFree(size_hints);
|
XFree(size_hints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
Atom protocols[2];
|
Atom protocols[2];
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
protocols[n++] = backend_x11->atom_WM_DELETE_WINDOW;
|
protocols[n++] = backend_x11->atom_WM_DELETE_WINDOW;
|
||||||
protocols[n++] = backend_x11->atom_NET_WM_PING;
|
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
|
static void
|
||||||
clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
meta_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
||||||
cairo_rectangle_int_t *geometry)
|
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->x = geometry->y = 0;
|
||||||
geometry->width = stage_x11->xwin_width;
|
geometry->width = stage_x11->xwin_width;
|
||||||
@ -145,13 +133,11 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
meta_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
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 (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
{
|
{
|
||||||
@ -163,26 +149,20 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
|||||||
height = 1;
|
height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "New size received: (%d, %d)", width, height);
|
|
||||||
|
|
||||||
if (stage_x11->xwin != None)
|
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 ||
|
if (width != stage_x11->xwin_width ||
|
||||||
height != stage_x11->xwin_height)
|
height != stage_x11->xwin_height)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BACKEND, "%s: XResizeWindow[%x] (%d, %d)",
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
G_STRLOC,
|
|
||||||
(unsigned int) stage_x11->xwin,
|
|
||||||
width,
|
|
||||||
height);
|
|
||||||
|
|
||||||
/* XXX: in this case we can rely on a subsequent
|
/* XXX: in this case we can rely on a subsequent
|
||||||
* ConfigureNotify that will result in the stage
|
* ConfigureNotify that will result in the stage
|
||||||
* being reallocated so we don't actively do anything
|
* being reallocated so we don't actively do anything
|
||||||
* to affect the stage allocation here. */
|
* to affect the stage allocation here. */
|
||||||
XResizeWindow (backend_x11->xdpy,
|
XResizeWindow (xdisplay,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
@ -199,24 +179,25 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_wm_pid (ClutterStageX11 *stage_x11)
|
set_wm_pid (MetaStageX11 *stage_x11)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
long pid;
|
long pid;
|
||||||
|
|
||||||
if (stage_x11->xwin == None)
|
if (stage_x11->xwin == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* this will take care of WM_CLIENT_MACHINE and WM_LOCALE_NAME */
|
/* 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,
|
NULL,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
XChangeProperty (backend_x11->xdpy,
|
XChangeProperty (xdisplay,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
backend_x11->atom_NET_WM_PID, XA_CARDINAL, 32,
|
backend_x11->atom_NET_WM_PID, XA_CARDINAL, 32,
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
@ -224,23 +205,24 @@ set_wm_pid (ClutterStageX11 *stage_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_wm_title (ClutterStageX11 *stage_x11)
|
set_wm_title (MetaStageX11 *stage_x11)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
if (stage_x11->xwin == None)
|
if (stage_x11->xwin == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (stage_x11->title == NULL)
|
if (stage_x11->title == NULL)
|
||||||
{
|
{
|
||||||
XDeleteProperty (backend_x11->xdpy,
|
XDeleteProperty (xdisplay,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
backend_x11->atom_NET_WM_NAME);
|
backend_x11->atom_NET_WM_NAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XChangeProperty (backend_x11->xdpy,
|
XChangeProperty (xdisplay,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
backend_x11->atom_NET_WM_NAME,
|
backend_x11->atom_NET_WM_NAME,
|
||||||
backend_x11->atom_UTF8_STRING,
|
backend_x11->atom_UTF8_STRING,
|
||||||
@ -252,21 +234,20 @@ set_wm_title (ClutterStageX11 *stage_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_cursor_visible (ClutterStageX11 *stage_x11)
|
set_cursor_visible (MetaStageX11 *stage_x11)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
|
||||||
|
|
||||||
if (stage_x11->xwin == None)
|
if (stage_x11->xwin == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "setting cursor state ('%s') over stage window (%u)",
|
g_debug ("setting cursor state ('%s') over stage window (%u)",
|
||||||
stage_x11->is_cursor_visible ? "visible" : "invisible",
|
stage_x11->is_cursor_visible ? "visible" : "invisible",
|
||||||
(unsigned int) stage_x11->xwin);
|
(unsigned int) stage_x11->xwin);
|
||||||
|
|
||||||
if (stage_x11->is_cursor_visible)
|
if (stage_x11->is_cursor_visible)
|
||||||
{
|
{
|
||||||
XUndefineCursor (backend_x11->xdpy, stage_x11->xwin);
|
XUndefineCursor (xdisplay, stage_x11->xwin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -274,29 +255,25 @@ set_cursor_visible (ClutterStageX11 *stage_x11)
|
|||||||
Pixmap pix;
|
Pixmap pix;
|
||||||
Cursor curs;
|
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));
|
memset (&col, 0, sizeof (col));
|
||||||
curs = XCreatePixmapCursor (backend_x11->xdpy,
|
curs = XCreatePixmapCursor (xdisplay,
|
||||||
pix, pix,
|
pix, pix,
|
||||||
&col, &col,
|
&col, &col,
|
||||||
1, 1);
|
1, 1);
|
||||||
XFreePixmap (backend_x11->xdpy, pix);
|
XFreePixmap (xdisplay, pix);
|
||||||
XDefineCursor (backend_x11->xdpy, stage_x11->xwin, curs);
|
XDefineCursor (xdisplay, stage_x11->xwin, curs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
|
meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (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)
|
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,
|
g_hash_table_remove (clutter_stages_by_xid,
|
||||||
GINT_TO_POINTER (stage_x11->xwin));
|
GINT_TO_POINTER (stage_x11->xwin));
|
||||||
}
|
}
|
||||||
@ -329,9 +306,9 @@ clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
|
meta_stage_x11_events_device_changed (MetaStageX11 *stage_x11,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
ClutterDeviceManager *device_manager)
|
ClutterDeviceManager *device_manager)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
|
|
||||||
@ -371,23 +348,18 @@ frame_cb (CoglOnscreen *onscreen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
|
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
ClutterDeviceManager *device_manager;
|
ClutterDeviceManager *device_manager;
|
||||||
gfloat width, height;
|
gfloat width, height;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper), &width, &height);
|
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->onscreen = cogl_onscreen_new (backend->cogl_context, width, height);
|
||||||
|
|
||||||
stage_x11->frame_closure =
|
stage_x11->frame_closure =
|
||||||
@ -406,7 +378,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
|
|||||||
stage_x11->xwin_width = width;
|
stage_x11->xwin_width = width;
|
||||||
stage_x11->xwin_height = height;
|
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_warning ("Failed to allocate stage: %s", error->message);
|
||||||
g_error_free (error);
|
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
|
* for an example of things that break if we do conditional event
|
||||||
* selection.
|
* 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
|
/* input events also depent on the actual device, so we need to
|
||||||
* use the device manager to let every device select them, using
|
* use the device manager to let every device select them, using
|
||||||
@ -464,31 +436,29 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
|
|||||||
stage_window);
|
stage_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_stage_x11_fix_window_size (stage_x11,
|
meta_stage_x11_fix_window_size (stage_x11,
|
||||||
stage_x11->xwin_width,
|
stage_x11->xwin_width,
|
||||||
stage_x11->xwin_height);
|
stage_x11->xwin_height);
|
||||||
clutter_stage_x11_set_wm_protocols (stage_x11);
|
meta_stage_x11_set_wm_protocols (stage_x11);
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "Successfully realized stage");
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
|
meta_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||||
gboolean cursor_visible)
|
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;
|
stage_x11->is_cursor_visible = !!cursor_visible;
|
||||||
set_cursor_visible (stage_x11);
|
set_cursor_visible (stage_x11);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_set_title (ClutterStageWindow *stage_window,
|
meta_stage_x11_set_title (ClutterStageWindow *stage_window,
|
||||||
const gchar *title)
|
const gchar *title)
|
||||||
{
|
{
|
||||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
|
||||||
|
|
||||||
g_free (stage_x11->title);
|
g_free (stage_x11->title);
|
||||||
stage_x11->title = g_strdup (title);
|
stage_x11->title = g_strdup (title);
|
||||||
@ -496,10 +466,9 @@ clutter_stage_x11_set_title (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
update_wm_hints (ClutterStageX11 *stage_x11)
|
update_wm_hints (MetaStageX11 *stage_x11)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
|
||||||
XWMHints wm_hints;
|
XWMHints wm_hints;
|
||||||
|
|
||||||
if (stage_x11->wm_state & STAGE_X11_WITHDRAWN)
|
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.initial_state = NormalState;
|
||||||
wm_hints.input = stage_x11->accept_focus ? True : False;
|
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
|
static void
|
||||||
clutter_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
|
meta_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
|
||||||
gboolean accept_focus)
|
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;
|
stage_x11->accept_focus = !!accept_focus;
|
||||||
update_wm_hints (stage_x11);
|
update_wm_hints (stage_x11);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_stage_x11_state (ClutterStageX11 *stage_x11,
|
set_stage_x11_state (MetaStageX11 *stage_x11,
|
||||||
ClutterStageX11State unset_flags,
|
MetaStageX11State unset_flags,
|
||||||
ClutterStageX11State set_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;
|
old_stage_state = stage_x11->wm_state;
|
||||||
|
|
||||||
@ -542,27 +511,23 @@ set_stage_x11_state (ClutterStageX11 *stage_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
meta_stage_x11_show (ClutterStageWindow *stage_window,
|
||||||
gboolean do_raise)
|
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);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
|
||||||
|
|
||||||
if (stage_x11->xwin != None)
|
if (stage_x11->xwin != None)
|
||||||
{
|
{
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
if (do_raise)
|
if (do_raise)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BACKEND, "Raising stage[%lu]",
|
XRaiseWindow (xdisplay, stage_x11->xwin);
|
||||||
(unsigned long) stage_x11->xwin);
|
|
||||||
XRaiseWindow (backend_x11->xdpy, stage_x11->xwin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!STAGE_X11_IS_MAPPED (stage_x11))
|
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);
|
set_stage_x11_state (stage_x11, STAGE_X11_WITHDRAWN, 0);
|
||||||
|
|
||||||
update_wm_hints (stage_x11);
|
update_wm_hints (stage_x11);
|
||||||
@ -572,19 +537,20 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
|||||||
|
|
||||||
clutter_actor_map (CLUTTER_ACTOR (stage_cogl->wrapper));
|
clutter_actor_map (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||||
|
|
||||||
XMapWindow (backend_x11->xdpy, stage_x11->xwin);
|
XMapWindow (xdisplay, stage_x11->xwin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
|
||||||
|
|
||||||
if (stage_x11->xwin != None)
|
if (stage_x11->xwin != None)
|
||||||
{
|
{
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
if (STAGE_X11_IS_MAPPED (stage_x11))
|
if (STAGE_X11_IS_MAPPED (stage_x11))
|
||||||
set_stage_x11_state (stage_x11, 0, STAGE_X11_WITHDRAWN);
|
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));
|
clutter_actor_unmap (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||||
|
|
||||||
XWithdrawWindow (backend_x11->xdpy, stage_x11->xwin, 0);
|
XWithdrawWindow (xdisplay, stage_x11->xwin, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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
|
/* while resizing a window, clipped redraws are disabled in order to
|
||||||
* avoid artefacts.
|
* avoid artefacts.
|
||||||
@ -610,7 +576,7 @@ clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
|
|||||||
static void
|
static void
|
||||||
ensure_legacy_view (ClutterStageWindow *stage_window)
|
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;
|
cairo_rectangle_int_t view_layout;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
|
|
||||||
@ -628,9 +594,9 @@ ensure_legacy_view (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
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);
|
ensure_legacy_view (stage_window);
|
||||||
|
|
||||||
@ -638,33 +604,33 @@ clutter_stage_x11_get_views (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
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);
|
return cogl_onscreen_get_frame_counter (stage_x11->onscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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_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
|
static void
|
||||||
clutter_stage_x11_class_init (ClutterStageX11Class *klass)
|
meta_stage_x11_class_init (MetaStageX11Class *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->finalize = clutter_stage_x11_finalize;
|
gobject_class->finalize = meta_stage_x11_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_init (ClutterStageX11 *stage)
|
meta_stage_x11_init (MetaStageX11 *stage)
|
||||||
{
|
{
|
||||||
stage->xwin = None;
|
stage->xwin = None;
|
||||||
stage->xwin_width = 640;
|
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);
|
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||||
|
|
||||||
iface->set_title = clutter_stage_x11_set_title;
|
iface->set_title = meta_stage_x11_set_title;
|
||||||
iface->set_cursor_visible = clutter_stage_x11_set_cursor_visible;
|
iface->set_cursor_visible = meta_stage_x11_set_cursor_visible;
|
||||||
iface->set_accept_focus = clutter_stage_x11_set_accept_focus;
|
iface->set_accept_focus = meta_stage_x11_set_accept_focus;
|
||||||
iface->show = clutter_stage_x11_show;
|
iface->show = meta_stage_x11_show;
|
||||||
iface->hide = clutter_stage_x11_hide;
|
iface->hide = meta_stage_x11_hide;
|
||||||
iface->resize = clutter_stage_x11_resize;
|
iface->resize = meta_stage_x11_resize;
|
||||||
iface->get_geometry = clutter_stage_x11_get_geometry;
|
iface->get_geometry = meta_stage_x11_get_geometry;
|
||||||
iface->realize = clutter_stage_x11_realize;
|
iface->realize = meta_stage_x11_realize;
|
||||||
iface->unrealize = clutter_stage_x11_unrealize;
|
iface->unrealize = meta_stage_x11_unrealize;
|
||||||
iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
|
iface->can_clip_redraws = meta_stage_x11_can_clip_redraws;
|
||||||
iface->get_views = clutter_stage_x11_get_views;
|
iface->get_views = meta_stage_x11_get_views;
|
||||||
iface->get_frame_counter = clutter_stage_x11_get_frame_counter;
|
iface->get_frame_counter = meta_stage_x11_get_frame_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_user_time (ClutterBackendX11 *backend_x11,
|
set_user_time (ClutterBackendX11 *backend_x11,
|
||||||
ClutterStageX11 *stage_x11,
|
MetaStageX11 *stage_x11,
|
||||||
long timestamp)
|
long timestamp)
|
||||||
{
|
{
|
||||||
if (timestamp != CLUTTER_CURRENT_TIME)
|
if (timestamp != CLUTTER_CURRENT_TIME)
|
||||||
{
|
{
|
||||||
XChangeProperty (backend_x11->xdpy,
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
|
XChangeProperty (xdisplay,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
backend_x11->atom_NET_WM_USER_TIME,
|
backend_x11->atom_NET_WM_USER_TIME,
|
||||||
XA_CARDINAL, 32,
|
XA_CARDINAL, 32,
|
||||||
@ -715,7 +683,7 @@ set_user_time (ClutterBackendX11 *backend_x11,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
||||||
ClutterStageX11 *stage_x11,
|
MetaStageX11 *stage_x11,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
Atom atom = (Atom) xevent->xclient.data.l[0];
|
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 &&
|
if (atom == backend_x11->atom_WM_DELETE_WINDOW &&
|
||||||
xevent->xany.window == stage_x11->xwin)
|
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]);
|
set_user_time (backend_x11, stage_x11, xevent->xclient.data.l[1]);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -745,9 +699,10 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
|||||||
xevent->xany.window == stage_x11->xwin)
|
xevent->xany.window == stage_x11->xwin)
|
||||||
{
|
{
|
||||||
XClientMessageEvent xclient = xevent->xclient;
|
XClientMessageEvent xclient = xevent->xclient;
|
||||||
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
xclient.window = backend_x11->xwin_root;
|
xclient.window = backend_x11->xwin_root;
|
||||||
XSendEvent (backend_x11->xdpy, xclient.window,
|
XSendEvent (xdisplay, xclient.window,
|
||||||
False,
|
False,
|
||||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||||
(XEvent *) &xclient);
|
(XEvent *) &xclient);
|
||||||
@ -761,7 +716,7 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
|||||||
static gboolean
|
static gboolean
|
||||||
clipped_redraws_cool_off_cb (void *data)
|
clipped_redraws_cool_off_cb (void *data)
|
||||||
{
|
{
|
||||||
ClutterStageX11 *stage_x11 = data;
|
MetaStageX11 *stage_x11 = data;
|
||||||
|
|
||||||
stage_x11->clipped_redraws_cool_off = 0;
|
stage_x11->clipped_redraws_cool_off = 0;
|
||||||
|
|
||||||
@ -769,23 +724,21 @@ clipped_redraws_cool_off_cb (void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
|
||||||
XEvent *xevent,
|
XEvent *xevent,
|
||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl;
|
ClutterStageCogl *stage_cogl;
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
ClutterBackendX11 *backend_x11;
|
ClutterBackendX11 *backend_x11;
|
||||||
Window stage_xwindow;
|
|
||||||
ClutterStage *stage;
|
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)
|
if (stage_cogl == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
stage = stage_cogl->wrapper;
|
stage = stage_cogl->wrapper;
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||||
stage_xwindow = stage_x11->xwin;
|
|
||||||
|
|
||||||
switch (xevent->type)
|
switch (xevent->type)
|
||||||
{
|
{
|
||||||
@ -795,10 +748,10 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
|||||||
int stage_width;
|
int stage_width;
|
||||||
int stage_height;
|
int stage_height;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "ConfigureNotify[%x] (%d, %d)",
|
g_debug ("ConfigureNotify[%x] (%d, %d)",
|
||||||
(unsigned int) stage_x11->xwin,
|
(unsigned int) stage_x11->xwin,
|
||||||
xevent->xconfigure.width,
|
xevent->xconfigure.width,
|
||||||
xevent->xconfigure.height);
|
xevent->xconfigure.height);
|
||||||
|
|
||||||
if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
||||||
(stage_x11->xwin_height != xevent->xconfigure.height))
|
(stage_x11->xwin_height != xevent->xconfigure.height))
|
||||||
@ -914,16 +867,13 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
|||||||
XExposeEvent *expose = (XExposeEvent *) xevent;
|
XExposeEvent *expose = (XExposeEvent *) xevent;
|
||||||
cairo_rectangle_int_t clip;
|
cairo_rectangle_int_t clip;
|
||||||
|
|
||||||
CLUTTER_NOTE (EVENT,
|
g_debug ("expose for stage: win:0x%x - "
|
||||||
"expose for stage: %s[%p], win:0x%x - "
|
"redrawing area (x: %d, y: %d, width: %d, height: %d)",
|
||||||
"redrawing area (x: %d, y: %d, width: %d, height: %d)",
|
(unsigned int) xevent->xany.window,
|
||||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
|
expose->x,
|
||||||
stage,
|
expose->y,
|
||||||
(unsigned int) stage_xwindow,
|
expose->width,
|
||||||
expose->x,
|
expose->height);
|
||||||
expose->y,
|
|
||||||
expose->width,
|
|
||||||
expose->height);
|
|
||||||
|
|
||||||
clip.x = expose->x;
|
clip.x = expose->x;
|
||||||
clip.y = expose->y;
|
clip.y = expose->y;
|
||||||
@ -934,21 +884,18 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
CLUTTER_NOTE (EVENT,
|
g_debug ("Destroy notification received for stage, win:0x%x",
|
||||||
"Destroy notification received for stage %s[%p], win:0x%x",
|
(unsigned int) xevent->xany.window);
|
||||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
|
|
||||||
stage,
|
|
||||||
(unsigned int) stage_xwindow);
|
|
||||||
event->any.type = CLUTTER_DESTROY_NOTIFY;
|
event->any.type = CLUTTER_DESTROY_NOTIFY;
|
||||||
event->any.stage = stage;
|
event->any.stage = stage;
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
CLUTTER_NOTE (EVENT, "Client message for stage %s[%p], win:0x%x",
|
g_debug ("Client message for stage, win:0x%x",
|
||||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
|
(unsigned int) xevent->xany.window);
|
||||||
stage,
|
|
||||||
(unsigned int) stage_xwindow);
|
|
||||||
if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
|
if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
|
||||||
{
|
{
|
||||||
event->any.type = CLUTTER_DELETE;
|
event->any.type = CLUTTER_DELETE;
|
||||||
@ -965,31 +912,21 @@ clutter_stage_x11_translate_event (ClutterStageX11 *stage_x11,
|
|||||||
return res;
|
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
|
Window
|
||||||
clutter_x11_get_stage_window (ClutterStage *stage)
|
meta_x11_get_stage_window (ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterStageWindow *impl;
|
ClutterStageWindow *impl;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), None);
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), None);
|
||||||
|
|
||||||
impl = _clutter_stage_get_window (stage);
|
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 *
|
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)
|
if (clutter_stages_by_xid == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -998,23 +935,12 @@ clutter_x11_get_stage_window_from_window (Window win)
|
|||||||
GINT_TO_POINTER (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 *
|
ClutterStage *
|
||||||
clutter_x11_get_stage_from_window (Window win)
|
meta_x11_get_stage_from_window (Window win)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl;
|
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)
|
if (stage_cogl != NULL)
|
||||||
return stage_cogl->wrapper;
|
return stage_cogl->wrapper;
|
||||||
@ -1023,8 +949,8 @@ clutter_x11_get_stage_from_window (Window win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_x11_set_user_time (ClutterStageX11 *stage_x11,
|
meta_stage_x11_set_user_time (MetaStageX11 *stage_x11,
|
||||||
guint32 user_time)
|
guint32 user_time)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
102
src/backends/x11/meta-stage-x11.h
Normal file
102
src/backends/x11/meta-stage-x11.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/* 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 <X11/Xlib.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
#include "clutter/clutter-mutter.h"
|
||||||
|
#include "clutter/x11/clutter-x11.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 */
|
214
src/backends/x11/meta-virtual-input-device-x11.c
Normal file
214
src/backends/x11/meta-virtual-input-device-x11.c
Normal file
@ -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 <X11/extensions/XTest.h>
|
||||||
|
|
||||||
|
#include "clutter/clutter.h"
|
||||||
|
#include "clutter/x11/clutter-x11.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;
|
||||||
|
}
|
@ -1,8 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2016 Red Hat Inc.
|
* Copyright (C) 2016 Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -21,15 +17,15 @@
|
|||||||
* Author: Jonas Ådahl <jadahl@gmail.com>
|
* Author: Jonas Ådahl <jadahl@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__
|
#ifndef META_VIRTUAL_INPUT_DEVICE_X11_H
|
||||||
#define __CLUTTER_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 ())
|
#define META_TYPE_VIRTUAL_INPUT_DEVICE_X11 (meta_virtual_input_device_x11_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (ClutterVirtualInputDeviceX11,
|
G_DECLARE_FINAL_TYPE (MetaVirtualInputDeviceX11,
|
||||||
clutter_virtual_input_device_x11,
|
meta_virtual_input_device_x11,
|
||||||
CLUTTER, VIRTUAL_INPUT_DEVICE_X11,
|
META, VIRTUAL_INPUT_DEVICE_X11,
|
||||||
ClutterVirtualInputDevice)
|
ClutterVirtualInputDevice)
|
||||||
|
|
||||||
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__ */
|
#endif /* META_VIRTUAL_INPUT_DEVICE_X11_H */
|
@ -1,5 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
*
|
|
||||||
* Copyright © 2001 Ximian, Inc.
|
* Copyright © 2001 Ximian, Inc.
|
||||||
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
|
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
|
||||||
* Copyright (C) 2017 Red Hat
|
* Copyright (C) 2017 Red Hat
|
||||||
@ -21,12 +20,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-device-manager-private.h"
|
#include "config.h"
|
||||||
#include "clutter-xkb-a11y-x11.h"
|
|
||||||
|
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/extensions/XKBstr.h>
|
#include <X11/extensions/XKBstr.h>
|
||||||
|
|
||||||
|
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||||
|
#include "clutter/x11/clutter-x11.h"
|
||||||
|
#include "core/display-private.h"
|
||||||
|
#include "meta/meta-x11-errors.h"
|
||||||
|
|
||||||
#define DEFAULT_XKB_SET_CONTROLS_MASK XkbSlowKeysMask | \
|
#define DEFAULT_XKB_SET_CONTROLS_MASK XkbSlowKeysMask | \
|
||||||
XkbBounceKeysMask | \
|
XkbBounceKeysMask | \
|
||||||
XkbStickyKeysMask | \
|
XkbStickyKeysMask | \
|
||||||
@ -40,17 +43,17 @@
|
|||||||
static int _xkb_event_base;
|
static int _xkb_event_base;
|
||||||
|
|
||||||
static XkbDescRec *
|
static XkbDescRec *
|
||||||
get_xkb_desc_rec (ClutterBackendX11 *backend_x11)
|
get_xkb_desc_rec (Display *xdisplay)
|
||||||
{
|
{
|
||||||
XkbDescRec *desc;
|
XkbDescRec *desc;
|
||||||
Status status = Success;
|
Status status = Success;
|
||||||
|
|
||||||
clutter_x11_trap_x_errors ();
|
clutter_x11_trap_x_errors ();
|
||||||
desc = XkbGetMap (backend_x11->xdpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
|
desc = XkbGetMap (xdisplay, XkbAllMapComponentsMask, XkbUseCoreKbd);
|
||||||
if (desc != NULL)
|
if (desc != NULL)
|
||||||
{
|
{
|
||||||
desc->ctrls = NULL;
|
desc->ctrls = NULL;
|
||||||
status = XkbGetControls (backend_x11->xdpy, XkbAllControlsMask, desc);
|
status = XkbGetControls (xdisplay, XkbAllControlsMask, desc);
|
||||||
}
|
}
|
||||||
clutter_x11_untrap_x_errors ();
|
clutter_x11_untrap_x_errors ();
|
||||||
|
|
||||||
@ -62,25 +65,24 @@ get_xkb_desc_rec (ClutterBackendX11 *backend_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_xkb_desc_rec (ClutterBackendX11 *backend_x11,
|
set_xkb_desc_rec (Display *xdisplay,
|
||||||
XkbDescRec *desc)
|
XkbDescRec *desc)
|
||||||
{
|
{
|
||||||
clutter_x11_trap_x_errors ();
|
clutter_x11_trap_x_errors ();
|
||||||
XkbSetControls (backend_x11->xdpy, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
|
XkbSetControls (xdisplay, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
|
||||||
XSync (backend_x11->xdpy, FALSE);
|
XSync (xdisplay, FALSE);
|
||||||
clutter_x11_untrap_x_errors ();
|
clutter_x11_untrap_x_errors ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_settings_changed (ClutterDeviceManager *device_manager)
|
check_settings_changed (ClutterDeviceManager *device_manager)
|
||||||
{
|
{
|
||||||
ClutterBackendX11 *backend_x11;
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||||
ClutterKeyboardA11yFlags what_changed = 0;
|
ClutterKeyboardA11yFlags what_changed = 0;
|
||||||
XkbDescRec *desc;
|
XkbDescRec *desc;
|
||||||
|
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
|
desc = get_xkb_desc_rec (xdisplay);
|
||||||
desc = get_xkb_desc_rec (backend_x11);
|
|
||||||
if (!desc)
|
if (!desc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -145,14 +147,14 @@ xkb_a11y_event_filter (XEvent *xevent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_xkb_available (ClutterBackendX11 *backend_x11)
|
is_xkb_available (Display *xdisplay)
|
||||||
{
|
{
|
||||||
gint opcode, error_base, event_base, major, minor;
|
gint opcode, error_base, event_base, major, minor;
|
||||||
|
|
||||||
if (_xkb_event_base)
|
if (_xkb_event_base)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!XkbQueryExtension (backend_x11->xdpy,
|
if (!XkbQueryExtension (xdisplay,
|
||||||
&opcode,
|
&opcode,
|
||||||
&event_base,
|
&event_base,
|
||||||
&error_base,
|
&error_base,
|
||||||
@ -160,7 +162,7 @@ is_xkb_available (ClutterBackendX11 *backend_x11)
|
|||||||
&minor))
|
&minor))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!XkbUseExtension (backend_x11->xdpy, &major, &minor))
|
if (!XkbUseExtension (xdisplay, &major, &minor))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
_xkb_event_base = event_base;
|
_xkb_event_base = event_base;
|
||||||
@ -192,18 +194,20 @@ set_xkb_ctrl (XkbDescRec *desc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||||
ClutterKbdA11ySettings *kbd_a11y_settings)
|
ClutterKbdA11ySettings *kbd_a11y_settings)
|
||||||
{
|
{
|
||||||
ClutterBackendX11 *backend_x11;
|
ClutterBackend *backend;
|
||||||
XkbDescRec *desc;
|
Display *xdisplay = clutter_x11_get_default_display ();
|
||||||
gboolean enable_accessX;
|
XkbDescRec *desc;
|
||||||
|
gboolean enable_accessX;
|
||||||
|
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
|
desc = get_xkb_desc_rec (xdisplay);
|
||||||
desc = get_xkb_desc_rec (backend_x11);
|
|
||||||
if (!desc)
|
if (!desc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
backend = clutter_get_default_backend ();
|
||||||
|
|
||||||
/* general */
|
/* general */
|
||||||
enable_accessX = kbd_a11y_settings->controls & CLUTTER_A11Y_KEYBOARD_ENABLED;
|
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 */
|
/* 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 */
|
/* Disable mousekeys when NumLock is ON */
|
||||||
desc->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask | XkbMouseKeysAccelMask);
|
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,
|
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED,
|
||||||
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
|
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
|
||||||
|
|
||||||
set_xkb_desc_rec (backend_x11, desc);
|
set_xkb_desc_rec (xdisplay, desc);
|
||||||
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
|
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
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;
|
guint event_mask;
|
||||||
|
|
||||||
backend_x11 =
|
if (!is_xkb_available (xdisplay))
|
||||||
CLUTTER_BACKEND_X11 (_clutter_device_manager_get_backend (device_manager));
|
|
||||||
|
|
||||||
if (!is_xkb_available (backend_x11))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask;
|
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);
|
clutter_x11_add_filter (xkb_a11y_event_filter, device_manager);
|
||||||
|
|
@ -21,19 +21,18 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CLUTTER_XKB_A11Y_X11_H
|
#ifndef META_XKB_A11Y_X11_H
|
||||||
#define CLUTTER_XKB_A11Y_X11_H
|
#define META_XKB_A11Y_X11_H
|
||||||
|
|
||||||
#include "clutter-device-manager-private.h"
|
|
||||||
#include "clutter-backend-x11.h"
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||||
ClutterKbdA11ySettings *kbd_a11y_settings);
|
ClutterKbdA11ySettings *kbd_a11y_settings);
|
||||||
|
|
||||||
gboolean
|
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 */
|
@ -57,6 +57,9 @@
|
|||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
|
|
||||||
#include "backends/meta-dnd-private.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 "clutter/clutter-mutter.h"
|
||||||
#include "compositor/meta-window-actor-x11.h"
|
#include "compositor/meta-window-actor-x11.h"
|
||||||
#include "compositor/meta-window-actor-wayland.h"
|
#include "compositor/meta-window-actor-wayland.h"
|
||||||
@ -289,7 +292,7 @@ meta_focus_stage_window (MetaDisplay *display,
|
|||||||
if (!stage)
|
if (!stage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window = clutter_x11_get_stage_window (stage);
|
window = meta_x11_get_stage_window (stage);
|
||||||
|
|
||||||
if (window == None)
|
if (window == None)
|
||||||
return;
|
return;
|
||||||
@ -312,7 +315,7 @@ meta_stage_is_focused (MetaDisplay *display)
|
|||||||
if (!stage)
|
if (!stage)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
window = clutter_x11_get_stage_window (stage);
|
window = meta_x11_get_stage_window (stage);
|
||||||
|
|
||||||
if (window == None)
|
if (window == None)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
|
|
||||||
#include "backends/x11/meta-backend-x11.h"
|
#include "backends/x11/meta-backend-x11.h"
|
||||||
|
#include "backends/x11/meta-event-x11.h"
|
||||||
#include "clutter/x11/clutter-x11.h"
|
#include "clutter/x11/clutter-x11.h"
|
||||||
#include "compositor/meta-sync-ring.h"
|
#include "compositor/meta-sync-ring.h"
|
||||||
#include "core/display-private.h"
|
#include "core/display-private.h"
|
||||||
@ -94,7 +95,7 @@ meta_compositor_x11_process_xevent (MetaCompositorX11 *compositor_x11,
|
|||||||
* stage is invisible
|
* stage is invisible
|
||||||
*/
|
*/
|
||||||
if (xevent->type == MapNotify)
|
if (xevent->type == MapNotify)
|
||||||
clutter_x11_handle_event (xevent);
|
meta_x11_handle_event (xevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "core/display-private.h"
|
#include "core/display-private.h"
|
||||||
#include "backends/meta-dnd-private.h"
|
#include "backends/meta-dnd-private.h"
|
||||||
#include "backends/x11/meta-backend-x11.h"
|
#include "backends/x11/meta-backend-x11.h"
|
||||||
|
#include "backends/x11/meta-stage-x11.h"
|
||||||
#include "meta/meta-dnd.h"
|
#include "meta/meta-dnd.h"
|
||||||
#include "x11/meta-x11-display-private.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);
|
output_window = meta_compositor_x11_get_output_xwindow (compositor_x11);
|
||||||
stage = meta_compositor_get_stage (compositor);
|
stage = meta_compositor_get_stage (compositor);
|
||||||
if (xev->xany.window != output_window &&
|
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;
|
return FALSE;
|
||||||
|
|
||||||
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
|
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "backends/meta-logical-monitor.h"
|
#include "backends/meta-logical-monitor.h"
|
||||||
#include "backends/meta-stage-private.h"
|
#include "backends/meta-stage-private.h"
|
||||||
#include "backends/x11/meta-backend-x11.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 "backends/x11/cm/meta-backend-x11-cm.h"
|
||||||
#include "clutter/x11/clutter-x11.h"
|
#include "clutter/x11/clutter-x11.h"
|
||||||
#include "compositor/compositor-private.h"
|
#include "compositor/compositor-private.h"
|
||||||
@ -630,7 +631,7 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
|
|||||||
|
|
||||||
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
|
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
|
||||||
META_VIRTUAL_CORE_POINTER_ID,
|
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);
|
DefaultRootWindow (display->x11_display->xdisplay), event_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ if have_x11
|
|||||||
xcb_randr_dep,
|
xcb_randr_dep,
|
||||||
xcb_res_dep,
|
xcb_res_dep,
|
||||||
xau_dep,
|
xau_dep,
|
||||||
|
xtst_dep,
|
||||||
]
|
]
|
||||||
|
|
||||||
if have_sm
|
if have_sm
|
||||||
@ -241,18 +242,34 @@ mutter_sources = [
|
|||||||
'backends/x11/meta-crtc-xrandr.h',
|
'backends/x11/meta-crtc-xrandr.h',
|
||||||
'backends/x11/meta-cursor-renderer-x11.c',
|
'backends/x11/meta-cursor-renderer-x11.c',
|
||||||
'backends/x11/meta-cursor-renderer-x11.h',
|
'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.c',
|
||||||
'backends/x11/meta-gpu-xrandr.h',
|
'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.c',
|
||||||
'backends/x11/meta-input-settings-x11.h',
|
'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.c',
|
||||||
'backends/x11/meta-monitor-manager-xrandr.h',
|
'backends/x11/meta-monitor-manager-xrandr.h',
|
||||||
'backends/x11/meta-output-xrandr.c',
|
'backends/x11/meta-output-xrandr.c',
|
||||||
'backends/x11/meta-output-xrandr.h',
|
'backends/x11/meta-output-xrandr.h',
|
||||||
'backends/x11/meta-renderer-x11.c',
|
'backends/x11/meta-renderer-x11.c',
|
||||||
'backends/x11/meta-renderer-x11.h',
|
'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.c',
|
||||||
'backends/x11/meta-stage-x11-nested.h',
|
'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.c',
|
||||||
'backends/x11/nested/meta-backend-x11-nested.h',
|
'backends/x11/nested/meta-backend-x11-nested.h',
|
||||||
'backends/x11/nested/meta-cursor-renderer-x11-nested.c',
|
'backends/x11/nested/meta-cursor-renderer-x11-nested.c',
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "backends/meta-logical-monitor.h"
|
#include "backends/meta-logical-monitor.h"
|
||||||
#include "backends/meta-settings-private.h"
|
#include "backends/meta-settings-private.h"
|
||||||
#include "backends/x11/meta-backend-x11.h"
|
#include "backends/x11/meta-backend-x11.h"
|
||||||
|
#include "backends/x11/meta-stage-x11.h"
|
||||||
#include "core/frame.h"
|
#include "core/frame.h"
|
||||||
#include "core/meta-workspace-manager-private.h"
|
#include "core/meta-workspace-manager-private.h"
|
||||||
#include "core/util-private.h"
|
#include "core/util-private.h"
|
||||||
@ -2225,7 +2226,7 @@ meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
|
|||||||
|
|
||||||
g_return_if_fail (!meta_is_wayland_compositor ());
|
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,
|
XFixesSetWindowShapeRegion (xdisplay, stage_xwindow,
|
||||||
ShapeInput, 0, 0, region);
|
ShapeInput, 0, 0, region);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user