2007-11-15 14:45:27 +00:00
|
|
|
/* 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
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2007-11-15 14:45:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CLUTTER_BACKEND_X11_H__
|
|
|
|
#define __CLUTTER_BACKEND_X11_H__
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <clutter/clutter-event.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
|
|
|
#include "clutter-x11.h"
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
|
2010-10-21 10:49:37 +00:00
|
|
|
#include "clutter-backend-private.h"
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
#include "clutter-event-translator.h"
|
2010-07-12 16:11:30 +00:00
|
|
|
#include "clutter-keymap-x11.h"
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
|
2010-06-21 14:43:31 +00:00
|
|
|
#include "xsettings/xsettings-client.h"
|
|
|
|
|
2007-11-15 14:45:27 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-01-20 15:39:28 +00:00
|
|
|
#define CLUTTER_TYPE_BACKEND_X11 (_clutter_backend_x11_get_type ())
|
2007-11-15 14:45:27 +00:00
|
|
|
#define CLUTTER_BACKEND_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11))
|
|
|
|
#define CLUTTER_IS_BACKEND_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_X11))
|
|
|
|
#define CLUTTER_BACKEND_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11Class))
|
|
|
|
#define CLUTTER_IS_BACKEND_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_X11))
|
|
|
|
#define CLUTTER_BACKEND_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_X11, ClutterBackendX11Class))
|
|
|
|
|
|
|
|
typedef struct _ClutterBackendX11 ClutterBackendX11;
|
|
|
|
typedef struct _ClutterBackendX11Class ClutterBackendX11Class;
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
typedef struct _ClutterEventX11 ClutterEventX11;
|
|
|
|
typedef struct _ClutterX11EventFilter ClutterX11EventFilter;
|
2007-11-15 14:45:27 +00:00
|
|
|
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
struct _ClutterX11EventFilter
|
2007-11-15 14:45:27 +00:00
|
|
|
{
|
|
|
|
ClutterX11FilterFunc func;
|
|
|
|
gpointer data;
|
|
|
|
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2007-11-15 14:45:27 +00:00
|
|
|
|
|
|
|
struct _ClutterBackendX11
|
|
|
|
{
|
|
|
|
ClutterBackend parent_instance;
|
|
|
|
|
|
|
|
Display *xdpy;
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
gchar *display_name;
|
|
|
|
|
2007-11-15 14:45:27 +00:00
|
|
|
Screen *xscreen;
|
|
|
|
int xscreen_num;
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
int xscreen_width;
|
|
|
|
int xscreen_height;
|
|
|
|
|
|
|
|
Window xwin_root;
|
2007-11-15 14:45:27 +00:00
|
|
|
|
|
|
|
/* event source */
|
|
|
|
GSource *event_source;
|
|
|
|
GSList *event_filters;
|
|
|
|
|
|
|
|
/* props */
|
2009-08-04 14:06:27 +00:00
|
|
|
Atom atom_NET_WM_PID;
|
2007-11-17 18:11:14 +00:00
|
|
|
Atom atom_NET_WM_PING;
|
|
|
|
Atom atom_NET_WM_STATE;
|
|
|
|
Atom atom_NET_WM_STATE_FULLSCREEN;
|
|
|
|
Atom atom_NET_WM_USER_TIME;
|
|
|
|
Atom atom_WM_PROTOCOLS;
|
|
|
|
Atom atom_WM_DELETE_WINDOW;
|
|
|
|
Atom atom_XEMBED;
|
|
|
|
Atom atom_XEMBED_INFO;
|
|
|
|
Atom atom_NET_WM_NAME;
|
|
|
|
Atom atom_UTF8_STRING;
|
2008-06-23 09:55:42 +00:00
|
|
|
|
2009-02-18 09:45:26 +00:00
|
|
|
Time last_event_time;
|
2010-01-15 11:21:52 +00:00
|
|
|
|
2010-02-17 17:06:25 +00:00
|
|
|
ClutterDeviceManager *device_manager;
|
2011-01-18 13:15:20 +00:00
|
|
|
gboolean has_xinput;
|
2010-06-21 14:43:31 +00:00
|
|
|
|
|
|
|
XSettingsClient *xsettings;
|
2010-06-28 09:32:54 +00:00
|
|
|
Window xsettings_xwin;
|
2010-07-12 16:11:30 +00:00
|
|
|
|
|
|
|
ClutterKeymapX11 *keymap;
|
2010-07-12 17:04:03 +00:00
|
|
|
int xkb_event_base;
|
|
|
|
gboolean use_xkb;
|
|
|
|
gboolean have_xkb_autorepeat;
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
|
|
|
|
GList *event_translators;
|
2007-11-15 14:45:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _ClutterBackendX11Class
|
|
|
|
{
|
|
|
|
ClutterBackendClass parent_class;
|
2009-05-13 20:49:45 +00:00
|
|
|
|
2009-08-03 13:50:10 +00:00
|
|
|
/*
|
|
|
|
* To support foreign stage windows the we need a way to ask for an
|
|
|
|
* XVisualInfo that may be used by toolkits to create an XWindow, and this
|
|
|
|
* may need to be handled differently for different backends.
|
|
|
|
*/
|
2009-07-31 17:34:51 +00:00
|
|
|
XVisualInfo *(* get_visual_info) (ClutterBackendX11 *backend);
|
2007-11-15 14:45:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void _clutter_backend_x11_events_init (ClutterBackend *backend);
|
|
|
|
void _clutter_backend_x11_events_uninit (ClutterBackend *backend);
|
|
|
|
|
2011-01-20 15:39:28 +00:00
|
|
|
GType _clutter_backend_x11_get_type (void) G_GNUC_CONST;
|
2007-11-15 14:45:27 +00:00
|
|
|
|
|
|
|
/* Private to glx/eglx backends */
|
2009-05-13 20:49:45 +00:00
|
|
|
XVisualInfo *
|
2011-01-20 15:39:28 +00:00
|
|
|
_clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11);
|
2008-06-23 09:55:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_x11_select_events (Window xwin);
|
2007-11-15 14:45:27 +00:00
|
|
|
|
2010-07-08 14:47:18 +00:00
|
|
|
ClutterEventX11 *
|
|
|
|
_clutter_event_x11_new (void);
|
|
|
|
|
|
|
|
ClutterEventX11 *
|
|
|
|
_clutter_event_x11_copy (ClutterEventX11 *event_x11);
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_event_x11_free (ClutterEventX11 *event_x11);
|
|
|
|
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 12:32:04 +00:00
|
|
|
void
|
|
|
|
_clutter_backend_x11_add_event_translator (ClutterBackendX11 *backend_x11,
|
|
|
|
ClutterEventTranslator *translator);
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_backend_x11_remove_event_translator (ClutterBackendX11 *backend_x11,
|
|
|
|
ClutterEventTranslator *translator);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device,
|
|
|
|
gint stage_root_x,
|
|
|
|
gint stage_root_y,
|
|
|
|
guint index_,
|
|
|
|
gdouble value,
|
|
|
|
gdouble *axis_value);
|
|
|
|
|
2007-11-15 14:45:27 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __CLUTTER_BACKEND_X11_H__ */
|