mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
backends: Shuffle ClutterBackendX11 code into MetaClutterBackendX11
We have a Clutter implementation of the X11, just to subclass it in our backends. Move the implementation entirely to src/backends/x11. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
This commit is contained in:
@ -52,7 +52,6 @@
|
||||
#include "backends/x11/meta-renderer-x11.h"
|
||||
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "compositor/compositor-private.h"
|
||||
#include "core/display-private.h"
|
||||
#include "meta/meta-cursor-tracker.h"
|
||||
@ -868,7 +867,7 @@ meta_backend_x11_initable_init (GInitable *initable,
|
||||
|
||||
priv->xdisplay = xdisplay;
|
||||
priv->xcb = XGetXCBConnection (priv->xdisplay);
|
||||
clutter_x11_set_display (xdisplay);
|
||||
meta_clutter_x11_set_display (xdisplay);
|
||||
|
||||
init_xkb_state (x11);
|
||||
|
||||
|
@ -35,16 +35,374 @@
|
||||
#include "backends/x11/nested/meta-stage-x11-nested.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "cogl/cogl-xlib.h"
|
||||
#include "core/bell.h"
|
||||
#include "meta/meta-backend.h"
|
||||
|
||||
struct _MetaClutterBackendX11
|
||||
typedef struct _MetaX11EventFilter MetaX11EventFilter;
|
||||
|
||||
struct _MetaX11EventFilter
|
||||
{
|
||||
ClutterBackendX11 parent;
|
||||
MetaX11FilterFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
||||
CLUTTER_TYPE_BACKEND_X11)
|
||||
CLUTTER_TYPE_BACKEND)
|
||||
|
||||
|
||||
/* atoms; remember to add the code that assigns the atom value to
|
||||
* the member of the MetaClutterBackendX11 structure if you add an
|
||||
* atom name here. do not change the order!
|
||||
*/
|
||||
static const gchar *atom_names[] = {
|
||||
"_NET_WM_PID",
|
||||
"_NET_WM_PING",
|
||||
"_NET_WM_STATE",
|
||||
"_NET_WM_USER_TIME",
|
||||
"WM_PROTOCOLS",
|
||||
"WM_DELETE_WINDOW",
|
||||
"_XEMBED",
|
||||
"_XEMBED_INFO",
|
||||
"_NET_WM_NAME",
|
||||
"UTF8_STRING",
|
||||
};
|
||||
|
||||
#define N_ATOM_NAMES G_N_ELEMENTS (atom_names)
|
||||
|
||||
/* various flags corresponding to pre init setup calls */
|
||||
static gboolean clutter_enable_xinput = TRUE;
|
||||
static gboolean clutter_enable_stereo = FALSE;
|
||||
static Display *_foreign_dpy = NULL;
|
||||
|
||||
/* options */
|
||||
static gchar *clutter_display_name = NULL;
|
||||
static gint clutter_screen = -1;
|
||||
static gboolean clutter_synchronise = FALSE;
|
||||
|
||||
/* X error trap */
|
||||
static int TrappedErrorCode = 0;
|
||||
static int (* old_error_handler) (Display *, XErrorEvent *);
|
||||
|
||||
static MetaX11FilterReturn
|
||||
cogl_xlib_filter (XEvent *xevent,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterBackend *backend = data;
|
||||
MetaX11FilterReturn retval;
|
||||
CoglFilterReturn ret;
|
||||
|
||||
ret = cogl_xlib_renderer_handle_event (backend->cogl_renderer, xevent);
|
||||
switch (ret)
|
||||
{
|
||||
case COGL_FILTER_REMOVE:
|
||||
retval = META_X11_FILTER_REMOVE;
|
||||
break;
|
||||
|
||||
case COGL_FILTER_CONTINUE:
|
||||
default:
|
||||
retval = META_X11_FILTER_CONTINUE;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_clutter_backend_x11_pre_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *env_string;
|
||||
|
||||
/* we don't fail here if DISPLAY is not set, as the user
|
||||
* might pass the --display command line switch
|
||||
*/
|
||||
env_string = g_getenv ("DISPLAY");
|
||||
if (env_string)
|
||||
{
|
||||
clutter_display_name = g_strdup (env_string);
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("CLUTTER_DISABLE_XINPUT");
|
||||
if (env_string)
|
||||
{
|
||||
clutter_enable_xinput = FALSE;
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_clutter_backend_x11_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||
Atom atoms[N_ATOM_NAMES];
|
||||
|
||||
if (_foreign_dpy)
|
||||
backend_x11->xdisplay = _foreign_dpy;
|
||||
|
||||
/* Only open connection if not already set by prior call to
|
||||
* clutter_x11_set_display()
|
||||
*/
|
||||
if (backend_x11->xdisplay == NULL)
|
||||
{
|
||||
if (clutter_display_name != NULL &&
|
||||
*clutter_display_name != '\0')
|
||||
{
|
||||
g_debug ("XOpenDisplay on '%s'", clutter_display_name);
|
||||
|
||||
backend_x11->xdisplay = XOpenDisplay (clutter_display_name);
|
||||
if (backend_x11->xdisplay == NULL)
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Unable to open display '%s'",
|
||||
clutter_display_name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Unable to open display. You have to set the "
|
||||
"DISPLAY environment variable, or use the "
|
||||
"--display command line argument");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
g_assert (backend_x11->xdisplay != NULL);
|
||||
|
||||
g_debug ("Getting the X screen");
|
||||
|
||||
/* add event filter for Cogl events */
|
||||
meta_clutter_x11_add_filter (cogl_xlib_filter, backend);
|
||||
|
||||
if (clutter_screen == -1)
|
||||
backend_x11->xscreen = DefaultScreenOfDisplay (backend_x11->xdisplay);
|
||||
else
|
||||
backend_x11->xscreen = ScreenOfDisplay (backend_x11->xdisplay,
|
||||
clutter_screen);
|
||||
|
||||
backend_x11->xscreen_num = XScreenNumberOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_width = WidthOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_height = HeightOfScreen (backend_x11->xscreen);
|
||||
|
||||
backend_x11->xwin_root = RootWindow (backend_x11->xdisplay,
|
||||
backend_x11->xscreen_num);
|
||||
|
||||
backend_x11->display_name = g_strdup (clutter_display_name);
|
||||
|
||||
if (clutter_synchronise)
|
||||
XSynchronize (backend_x11->xdisplay, True);
|
||||
|
||||
XInternAtoms (backend_x11->xdisplay,
|
||||
(char **) atom_names, N_ATOM_NAMES,
|
||||
False, atoms);
|
||||
|
||||
backend_x11->atom_NET_WM_PID = atoms[0];
|
||||
backend_x11->atom_NET_WM_PING = atoms[1];
|
||||
backend_x11->atom_NET_WM_STATE = atoms[2];
|
||||
backend_x11->atom_NET_WM_USER_TIME = atoms[3];
|
||||
backend_x11->atom_WM_PROTOCOLS = atoms[4];
|
||||
backend_x11->atom_WM_DELETE_WINDOW = atoms[5];
|
||||
backend_x11->atom_XEMBED = atoms[6];
|
||||
backend_x11->atom_XEMBED_INFO = atoms[7];
|
||||
backend_x11->atom_NET_WM_NAME = atoms[8];
|
||||
backend_x11->atom_UTF8_STRING = atoms[9];
|
||||
|
||||
g_free (clutter_display_name);
|
||||
|
||||
g_debug ("X Display '%s'[%p] opened (screen:%d, root:%u, dpi:%f)",
|
||||
backend_x11->display_name,
|
||||
backend_x11->xdisplay,
|
||||
backend_x11->xscreen_num,
|
||||
(unsigned int) backend_x11->xwin_root,
|
||||
clutter_backend_get_resolution (backend));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const GOptionEntry entries[] =
|
||||
{
|
||||
{
|
||||
"display", 0,
|
||||
G_OPTION_FLAG_IN_MAIN,
|
||||
G_OPTION_ARG_STRING, &clutter_display_name,
|
||||
N_("X display to use"), "DISPLAY"
|
||||
},
|
||||
{
|
||||
"screen", 0,
|
||||
G_OPTION_FLAG_IN_MAIN,
|
||||
G_OPTION_ARG_INT, &clutter_screen,
|
||||
N_("X screen to use"), "SCREEN"
|
||||
},
|
||||
{ "synch", 0,
|
||||
0,
|
||||
G_OPTION_ARG_NONE, &clutter_synchronise,
|
||||
N_("Make X calls synchronous"), NULL
|
||||
},
|
||||
{
|
||||
"disable-xinput", 0,
|
||||
G_OPTION_FLAG_REVERSE,
|
||||
G_OPTION_ARG_NONE, &clutter_enable_xinput,
|
||||
N_("Disable XInput support"), NULL
|
||||
},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
meta_clutter_backend_x11_add_options (ClutterBackend *backend,
|
||||
GOptionGroup *group)
|
||||
{
|
||||
g_option_group_add_entries (group, entries);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_clutter_backend_x11_finalize (GObject *gobject)
|
||||
{
|
||||
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (gobject);
|
||||
|
||||
g_free (backend_x11->display_name);
|
||||
|
||||
meta_clutter_x11_remove_filter (cogl_xlib_filter, gobject);
|
||||
|
||||
XCloseDisplay (backend_x11->xdisplay);
|
||||
|
||||
G_OBJECT_CLASS (meta_clutter_backend_x11_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static ClutterFeatureFlags
|
||||
meta_clutter_backend_x11_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
|
||||
flags |=
|
||||
CLUTTER_BACKEND_CLASS (meta_clutter_backend_x11_parent_class)->get_features (backend);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void
|
||||
update_last_event_time (MetaClutterBackendX11 *backend_x11,
|
||||
XEvent *xevent)
|
||||
{
|
||||
Time current_time = CurrentTime;
|
||||
Time last_time = backend_x11->last_event_time;
|
||||
|
||||
switch (xevent->type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
current_time = xevent->xkey.time;
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
current_time = xevent->xbutton.time;
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
current_time = xevent->xmotion.time;
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
current_time = xevent->xcrossing.time;
|
||||
break;
|
||||
|
||||
case PropertyNotify:
|
||||
current_time = xevent->xproperty.time;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* only change the current event time if it's after the previous event
|
||||
* time, or if it is at least 30 seconds earlier - in case the system
|
||||
* clock was changed
|
||||
*/
|
||||
if ((current_time != CurrentTime) &&
|
||||
(current_time > last_time || (last_time - current_time > (30 * 1000))))
|
||||
backend_x11->last_event_time = current_time;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_onscreen_template (CoglRenderer *renderer,
|
||||
CoglOnscreenTemplate *onscreen_template,
|
||||
gboolean enable_stereo,
|
||||
GError **error)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
cogl_onscreen_template_set_stereo_enabled (onscreen_template,
|
||||
clutter_enable_stereo);
|
||||
|
||||
/* cogl_renderer_check_onscreen_template() is actually just a
|
||||
* shorthand for creating a CoglDisplay, and calling
|
||||
* cogl_display_setup() on it, then throwing the display away. If we
|
||||
* could just return that display, then it would be more efficient
|
||||
* not to use cogl_renderer_check_onscreen_template(). However, the
|
||||
* backend API requires that we return an CoglDisplay that has not
|
||||
* yet been setup, so one way or the other we'll have to discard the
|
||||
* first display and make a new fresh one.
|
||||
*/
|
||||
if (cogl_renderer_check_onscreen_template (renderer, onscreen_template, &internal_error))
|
||||
{
|
||||
clutter_enable_stereo = enable_stereo;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
internal_error != NULL
|
||||
? internal_error->message
|
||||
: "Creation of a CoglDisplay failed");
|
||||
|
||||
g_clear_error (&internal_error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static CoglDisplay *
|
||||
meta_clutter_backend_x11_get_display (ClutterBackend *backend,
|
||||
CoglRenderer *renderer,
|
||||
CoglSwapChain *swap_chain,
|
||||
GError **error)
|
||||
{
|
||||
CoglOnscreenTemplate *onscreen_template;
|
||||
CoglDisplay *display = NULL;
|
||||
gboolean res = FALSE;
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
|
||||
/* It's possible that the current renderer doesn't support transparency
|
||||
* or doesn't support stereo, so we try the different combinations.
|
||||
*/
|
||||
if (clutter_enable_stereo)
|
||||
res = check_onscreen_template (renderer, onscreen_template,
|
||||
TRUE, error);
|
||||
|
||||
if (!res)
|
||||
res = check_onscreen_template (renderer, onscreen_template,
|
||||
FALSE, error);
|
||||
|
||||
if (res)
|
||||
display = cogl_display_new (renderer, onscreen_template);
|
||||
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
static CoglRenderer *
|
||||
meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend,
|
||||
@ -76,21 +434,65 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
return stage;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_clutter_backend_x11_process_event_filters (MetaClutterBackendX11 *backend_x11,
|
||||
gpointer native,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
XEvent *xevent = native;
|
||||
|
||||
/* X11 filter functions have a higher priority */
|
||||
if (backend_x11->event_filters != NULL)
|
||||
{
|
||||
GSList *node = backend_x11->event_filters;
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
MetaX11EventFilter *filter = node->data;
|
||||
|
||||
switch (filter->func (xevent, event, filter->data))
|
||||
{
|
||||
case META_X11_FILTER_CONTINUE:
|
||||
break;
|
||||
|
||||
case META_X11_FILTER_TRANSLATE:
|
||||
return TRUE;
|
||||
|
||||
case META_X11_FILTER_REMOVE:
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_clutter_backend_x11_translate_event (ClutterBackend *clutter_backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
MetaClutterBackendX11 *backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageX11 *stage_x11;
|
||||
ClutterBackendClass *clutter_backend_class;
|
||||
ClutterSeat *seat;
|
||||
|
||||
clutter_backend_class =
|
||||
CLUTTER_BACKEND_CLASS (meta_clutter_backend_x11_parent_class);
|
||||
if (clutter_backend_class->translate_event (clutter_backend, native, event))
|
||||
if (meta_clutter_backend_x11_process_event_filters (backend_x11,
|
||||
native,
|
||||
event))
|
||||
return TRUE;
|
||||
|
||||
/* we update the event time only for events that can
|
||||
* actually reach Clutter's event queue
|
||||
*/
|
||||
update_last_event_time (backend_x11, native);
|
||||
|
||||
stage_x11 =
|
||||
META_STAGE_X11 (clutter_backend_get_stage_window (clutter_backend));
|
||||
if (meta_stage_x11_translate_event (stage_x11, native, event))
|
||||
@ -120,16 +522,224 @@ meta_clutter_backend_x11_is_display_server (ClutterBackend *backend)
|
||||
static void
|
||||
meta_clutter_backend_x11_init (MetaClutterBackendX11 *clutter_backend_x11)
|
||||
{
|
||||
clutter_backend_x11->last_event_time = CurrentTime;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = meta_clutter_backend_x11_finalize;
|
||||
|
||||
clutter_backend_class->pre_parse = meta_clutter_backend_x11_pre_parse;
|
||||
clutter_backend_class->post_parse = meta_clutter_backend_x11_post_parse;
|
||||
clutter_backend_class->add_options = meta_clutter_backend_x11_add_options;
|
||||
clutter_backend_class->get_features = meta_clutter_backend_x11_get_features;
|
||||
|
||||
clutter_backend_class->get_display = meta_clutter_backend_x11_get_display;
|
||||
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->translate_event = meta_clutter_backend_x11_translate_event;
|
||||
clutter_backend_class->get_default_seat = meta_clutter_backend_x11_get_default_seat;
|
||||
clutter_backend_class->is_display_server = meta_clutter_backend_x11_is_display_server;
|
||||
}
|
||||
|
||||
static int
|
||||
error_handler (Display *xdisplay,
|
||||
XErrorEvent *error)
|
||||
{
|
||||
TrappedErrorCode = error->error_code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_trap_x_errors (void)
|
||||
{
|
||||
TrappedErrorCode = 0;
|
||||
old_error_handler = XSetErrorHandler (error_handler);
|
||||
}
|
||||
|
||||
gint
|
||||
meta_clutter_x11_untrap_x_errors (void)
|
||||
{
|
||||
XSetErrorHandler (old_error_handler);
|
||||
|
||||
return TrappedErrorCode;
|
||||
}
|
||||
|
||||
Display *
|
||||
meta_clutter_x11_get_default_display (void)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return META_CLUTTER_BACKEND_X11 (backend)->xdisplay;
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_set_display (Display *xdisplay)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
_foreign_dpy= xdisplay;
|
||||
}
|
||||
|
||||
int
|
||||
meta_clutter_x11_get_default_screen (void)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return META_CLUTTER_BACKEND_X11 (backend)->xscreen_num;
|
||||
}
|
||||
|
||||
Window
|
||||
meta_clutter_x11_get_root_window (void)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return None;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return None;
|
||||
}
|
||||
|
||||
return META_CLUTTER_BACKEND_X11 (backend)->xwin_root;
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_add_filter (MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
MetaX11EventFilter *filter;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
MetaClutterBackendX11 *backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
filter = g_new0 (MetaX11EventFilter, 1);
|
||||
filter->func = func;
|
||||
filter->data = data;
|
||||
|
||||
backend_x11->event_filters =
|
||||
g_slist_append (backend_x11->event_filters, filter);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_remove_filter (MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *tmp_list, *this;
|
||||
MetaX11EventFilter *filter;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
MetaClutterBackendX11 *backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
tmp_list = backend_x11->event_filters;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
filter = tmp_list->data;
|
||||
this = tmp_list;
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
if (filter->func == func && filter->data == data)
|
||||
{
|
||||
backend_x11->event_filters =
|
||||
g_slist_remove_link (backend_x11->event_filters, this);
|
||||
|
||||
g_slist_free_1 (this);
|
||||
g_free (filter);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_set_use_stereo_stage (gboolean use_stereo)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("STEREO stages are %s",
|
||||
use_stereo ? "enabled" : "disabled");
|
||||
|
||||
clutter_enable_stereo = use_stereo;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_clutter_x11_get_use_stereo_stage (void)
|
||||
{
|
||||
return clutter_enable_stereo;
|
||||
}
|
||||
|
@ -27,12 +27,70 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/x11/clutter-backend-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
|
||||
struct _MetaClutterBackendX11
|
||||
{
|
||||
ClutterBackend parent_instance;
|
||||
|
||||
Display *xdisplay;
|
||||
char *display_name;
|
||||
|
||||
Screen *xscreen;
|
||||
int xscreen_num;
|
||||
int xscreen_width;
|
||||
int xscreen_height;
|
||||
|
||||
Window xwin_root;
|
||||
|
||||
/* event source */
|
||||
GSList *event_filters;
|
||||
|
||||
/* props */
|
||||
Atom atom_NET_WM_PID;
|
||||
Atom atom_NET_WM_PING;
|
||||
Atom atom_NET_WM_STATE;
|
||||
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;
|
||||
|
||||
Time last_event_time;
|
||||
};
|
||||
|
||||
#define META_TYPE_CLUTTER_BACKEND_X11 (meta_clutter_backend_x11_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
||||
META, CLUTTER_BACKEND_X11,
|
||||
ClutterBackendX11)
|
||||
ClutterBackend)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_X11_FILTER_CONTINUE,
|
||||
META_X11_FILTER_TRANSLATE,
|
||||
META_X11_FILTER_REMOVE
|
||||
} MetaX11FilterReturn;
|
||||
|
||||
typedef MetaX11FilterReturn (*MetaX11FilterFunc) (XEvent *xev,
|
||||
ClutterEvent *cev,
|
||||
gpointer data);
|
||||
|
||||
void meta_clutter_x11_trap_x_errors (void);
|
||||
gint meta_clutter_x11_untrap_x_errors (void);
|
||||
|
||||
Display *meta_clutter_x11_get_default_display (void);
|
||||
int meta_clutter_x11_get_default_screen (void);
|
||||
Window meta_clutter_x11_get_root_window (void);
|
||||
void meta_clutter_x11_set_display (Display * xdpy);
|
||||
|
||||
void meta_clutter_x11_add_filter (MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
void meta_clutter_x11_remove_filter (MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
void meta_clutter_x11_set_use_stereo_stage (gboolean use_stereo);
|
||||
gboolean meta_clutter_x11_get_use_stereo_stage (void);
|
||||
|
||||
#endif /* META_CLUTTER_BACKEND_X11_H */
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include "backends/x11/meta-event-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
|
||||
/**
|
||||
* meta_x11_handle_event:
|
||||
@ -38,44 +37,44 @@
|
||||
* into external X11 event processing (for example, a GDK filter
|
||||
* function).
|
||||
*
|
||||
* Return value: #ClutterX11FilterReturn. %CLUTTER_X11_FILTER_REMOVE
|
||||
* Return value: #MetaX11FilterReturn. %META_X11_FILTER_REMOVE
|
||||
* indicates that Clutter has internally handled the event and the
|
||||
* caller should do no further processing. %CLUTTER_X11_FILTER_CONTINUE
|
||||
* caller should do no further processing. %META_X11_FILTER_CONTINUE
|
||||
* indicates that Clutter is either not interested in the event,
|
||||
* or has used the event to update internal state without taking
|
||||
* any exclusive action. %CLUTTER_X11_FILTER_TRANSLATE will not
|
||||
* any exclusive action. %META_X11_FILTER_TRANSLATE will not
|
||||
* occur.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterX11FilterReturn
|
||||
MetaX11FilterReturn
|
||||
meta_x11_handle_event (XEvent *xevent)
|
||||
{
|
||||
ClutterX11FilterReturn result;
|
||||
MetaX11FilterReturn result;
|
||||
ClutterBackend *backend;
|
||||
ClutterEvent *event;
|
||||
gint spin = 1;
|
||||
ClutterBackendX11 *backend_x11;
|
||||
MetaClutterBackendX11 *backend_x11;
|
||||
Display *xdisplay;
|
||||
gboolean allocated_event;
|
||||
|
||||
/* The return values here are someone approximate; we return
|
||||
* CLUTTER_X11_FILTER_REMOVE if a clutter event is
|
||||
* META_X11_FILTER_REMOVE if a clutter event is
|
||||
* generated for the event. This mostly, but not entirely,
|
||||
* corresponds to whether other event processing should be
|
||||
* excluded. As long as the stage window is not shared with another
|
||||
* toolkit it should be safe, and never return
|
||||
* %CLUTTER_X11_FILTER_REMOVE when more processing is needed.
|
||||
* %META_X11_FILTER_REMOVE when more processing is needed.
|
||||
*/
|
||||
|
||||
result = CLUTTER_X11_FILTER_CONTINUE;
|
||||
result = META_X11_FILTER_CONTINUE;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
|
||||
event = clutter_event_new (CLUTTER_NOTHING);
|
||||
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
xdisplay = backend_x11->xdpy;
|
||||
backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||
xdisplay = backend_x11->xdisplay;
|
||||
|
||||
allocated_event = XGetEventData (xdisplay, &xevent->xcookie);
|
||||
|
||||
@ -83,7 +82,7 @@ meta_x11_handle_event (XEvent *xevent)
|
||||
{
|
||||
_clutter_event_push (event, FALSE);
|
||||
|
||||
result = CLUTTER_X11_FILTER_REMOVE;
|
||||
result = META_X11_FILTER_REMOVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
|
||||
ClutterX11FilterReturn meta_x11_handle_event (XEvent *xevent);
|
||||
MetaX11FilterReturn meta_x11_handle_event (XEvent *xevent);
|
||||
|
||||
#endif /* META_EVENT_X11_H */
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <X11/extensions/XInput2.h>
|
||||
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
|
||||
struct _MetaInputDeviceX11
|
||||
@ -406,10 +406,10 @@ meta_input_device_x11_query_pointer_location (MetaInputDeviceX11 *device_xi2)
|
||||
XIGroupState group_state;
|
||||
int result;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
result = XIQueryPointer (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
result = XIQueryPointer (meta_clutter_x11_get_default_display (),
|
||||
device_xi2->device_id,
|
||||
clutter_x11_get_root_window (),
|
||||
meta_clutter_x11_get_root_window (),
|
||||
&xroot_window,
|
||||
&xchild_window,
|
||||
&xroot_x, &xroot_y,
|
||||
@ -417,7 +417,7 @@ meta_input_device_x11_query_pointer_location (MetaInputDeviceX11 *device_xi2)
|
||||
&button_state,
|
||||
&mod_state,
|
||||
&group_state);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
g_free (button_state.mask);
|
||||
|
||||
|
@ -118,11 +118,11 @@ get_property (ClutterInputDevice *device,
|
||||
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (xdisplay, device_id, property_atom,
|
||||
0, 10, False, type, &type_ret, &format_ret,
|
||||
&nitems_ret, &bytes_after_ret, &data_ret);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
if (rc == Success && type_ret == type && format_ret == format && nitems_ret >= nitems)
|
||||
{
|
||||
|
@ -28,11 +28,11 @@
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-input-settings-private.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-keymap-x11.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/clutter-keymap-private.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
|
||||
typedef struct _DirectionCacheEntry DirectionCacheEntry;
|
||||
typedef struct _ClutterKeymapKey ClutterKeymapKey;
|
||||
@ -144,7 +144,7 @@ update_modmap (Display *display,
|
||||
static XkbDescPtr
|
||||
get_xkb (MetaKeymapX11 *keymap_x11)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
if (keymap_x11->max_keycode == 0)
|
||||
XDisplayKeycodes (xdisplay,
|
||||
@ -356,7 +356,7 @@ static void
|
||||
meta_keymap_x11_constructed (GObject *object)
|
||||
{
|
||||
MetaKeymapX11 *keymap_x11 = META_KEYMAP_X11 (object);
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
int xkb_major = XkbMajorVersion;
|
||||
int xkb_minor = XkbMinorVersion;
|
||||
|
||||
@ -420,7 +420,7 @@ meta_keymap_x11_set_property (GObject *object,
|
||||
static void
|
||||
meta_keymap_x11_refresh_reserved_keycodes (MetaKeymapX11 *keymap_x11)
|
||||
{
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
@ -429,7 +429,7 @@ meta_keymap_x11_refresh_reserved_keycodes (MetaKeymapX11 *keymap_x11)
|
||||
{
|
||||
uint32_t reserved_keycode = GPOINTER_TO_UINT (key);
|
||||
uint32_t reserved_keysym = GPOINTER_TO_UINT (value);
|
||||
uint32_t actual_keysym = XkbKeycodeToKeysym (dpy, reserved_keycode, 0, 0);
|
||||
uint32_t actual_keysym = XkbKeycodeToKeysym (xdisplay, reserved_keycode, 0, 0);
|
||||
|
||||
/* If an available keycode is no longer mapped to the stored keysym, then
|
||||
* the keycode should not be considered available anymore and should be
|
||||
@ -450,11 +450,11 @@ meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
|
||||
{
|
||||
if (keymap_x11->use_xkb)
|
||||
{
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
XkbDescPtr xkb = get_xkb (keymap_x11);
|
||||
XkbMapChangesRec changes;
|
||||
|
||||
XFlush (dpy);
|
||||
XFlush (xdisplay);
|
||||
|
||||
xkb->device_spec = XkbUseCoreKbd;
|
||||
memset (&changes, 0, sizeof(changes));
|
||||
@ -476,9 +476,9 @@ meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
|
||||
changes.num_key_syms = 1;
|
||||
changes.first_type = 0;
|
||||
changes.num_types = xkb->map->num_types;
|
||||
XkbChangeMap (dpy, xkb, &changes);
|
||||
XkbChangeMap (xdisplay, xkb, &changes);
|
||||
|
||||
XFlush (dpy);
|
||||
XFlush (xdisplay);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -527,7 +527,7 @@ meta_keymap_x11_get_direction (ClutterKeymap *keymap)
|
||||
{
|
||||
XkbStateRec state_rec;
|
||||
|
||||
XkbGetState (clutter_x11_get_default_display (),
|
||||
XkbGetState (meta_clutter_x11_get_default_display (),
|
||||
XkbUseCoreKbd, &state_rec);
|
||||
update_direction (keymap_x11, XkbStateGroup (&state_rec));
|
||||
}
|
||||
@ -638,7 +638,7 @@ translate_keysym (MetaKeymapX11 *keymap,
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = XKeycodeToKeysym (clutter_x11_get_default_display (),
|
||||
retval = XKeycodeToKeysym (meta_clutter_x11_get_default_display (),
|
||||
hardware_keycode, 0);
|
||||
return retval;
|
||||
}
|
||||
@ -796,13 +796,13 @@ meta_keymap_x11_get_available_keycode (MetaKeymapX11 *keymap_x11)
|
||||
|
||||
if (g_hash_table_size (keymap_x11->reserved_keycodes) < 5)
|
||||
{
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
XkbDescPtr xkb = get_xkb (keymap_x11);
|
||||
uint32_t i;
|
||||
|
||||
for (i = xkb->max_key_code; i >= xkb->min_key_code; --i)
|
||||
{
|
||||
if (XkbKeycodeToKeysym (dpy, i, 0, 0) == NoSymbol)
|
||||
if (XkbKeycodeToKeysym (xdisplay, i, 0, 0) == NoSymbol)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -878,7 +878,7 @@ meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
else
|
||||
value = 0;
|
||||
|
||||
XkbLatchModifiers (clutter_x11_get_default_display (),
|
||||
XkbLatchModifiers (meta_clutter_x11_get_default_display (),
|
||||
XkbUseCoreKbd, modifiers[level],
|
||||
value);
|
||||
}
|
||||
@ -891,7 +891,7 @@ meta_keymap_x11_get_current_group (MetaKeymapX11 *keymap_x11)
|
||||
if (keymap_x11->current_group >= 0)
|
||||
return keymap_x11->current_group;
|
||||
|
||||
XkbGetState (clutter_x11_get_default_display (),
|
||||
XkbGetState (meta_clutter_x11_get_default_display (),
|
||||
XkbUseCoreKbd, &state_rec);
|
||||
return XkbStateGroup (&state_rec);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-renderer-view.h"
|
||||
#include "backends/meta-renderer.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-renderer-x11.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "cogl/cogl-xlib.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/boxes-private.h"
|
||||
@ -82,7 +82,7 @@ static CoglRenderer *
|
||||
meta_renderer_x11_create_cogl_renderer (MetaRenderer *renderer)
|
||||
{
|
||||
CoglRenderer *cogl_renderer;
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
cogl_renderer = cogl_renderer_new ();
|
||||
cogl_renderer_set_custom_winsys (cogl_renderer, get_x11_cogl_winsys_vtable,
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "backends/meta-input-settings-private.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-event-x11.h"
|
||||
#include "backends/x11/meta-input-device-tool-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
@ -32,7 +33,6 @@
|
||||
#include "backends/x11/meta-virtual-input-device-x11.h"
|
||||
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "core/bell.h"
|
||||
#include "meta-seat-x11.h"
|
||||
|
||||
@ -254,17 +254,18 @@ is_touchpad_device (XIDeviceInfo *info)
|
||||
Atom type;
|
||||
Atom prop;
|
||||
|
||||
prop = XInternAtom (clutter_x11_get_default_display (), "libinput Tapping Enabled", True);
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
"libinput Tapping Enabled", True);
|
||||
if (prop == None)
|
||||
return FALSE;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
info->deviceid,
|
||||
prop,
|
||||
0, 1, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
/* We don't care about the data */
|
||||
XFree (data);
|
||||
@ -285,13 +286,13 @@ get_device_ids (XIDeviceInfo *info,
|
||||
int rc, format;
|
||||
Atom type;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
info->deviceid,
|
||||
XInternAtom (clutter_x11_get_default_display (), "Device Product ID", False),
|
||||
XInternAtom (meta_clutter_x11_get_default_display (), "Device Product ID", False),
|
||||
0, 2, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
if (rc != Success || type != XA_INTEGER || format != 32 || nitems != 2)
|
||||
{
|
||||
@ -318,18 +319,18 @@ get_device_node_path (XIDeviceInfo *info)
|
||||
Atom prop, type;
|
||||
char *node_path;
|
||||
|
||||
prop = XInternAtom (clutter_x11_get_default_display (), "Device Node", False);
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (), "Device Node", False);
|
||||
if (prop == None)
|
||||
return NULL;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
info->deviceid, prop, 0, 1024, False,
|
||||
XA_STRING, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
|
||||
if (clutter_x11_untrap_x_errors ())
|
||||
if (meta_clutter_x11_untrap_x_errors ())
|
||||
return NULL;
|
||||
|
||||
if (rc != Success || type != XA_STRING || format != 8)
|
||||
@ -388,17 +389,17 @@ guess_source_from_wacom_type (XIDeviceInfo *info,
|
||||
Atom device_type;
|
||||
Atom types[N_WACOM_TYPE_ATOMS];
|
||||
|
||||
prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Tool Type", True);
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (), "Wacom Tool Type", True);
|
||||
if (prop == None)
|
||||
return FALSE;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
info->deviceid,
|
||||
prop,
|
||||
0, 1, False, XA_ATOM, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
if (rc != Success || type != XA_ATOM || format != 32 || nitems != 1)
|
||||
{
|
||||
@ -412,7 +413,7 @@ guess_source_from_wacom_type (XIDeviceInfo *info,
|
||||
if (device_type == 0)
|
||||
return FALSE;
|
||||
|
||||
rc = XInternAtoms (clutter_x11_get_default_display (),
|
||||
rc = XInternAtoms (meta_clutter_x11_get_default_display (),
|
||||
(char **)wacom_type_atoms,
|
||||
N_WACOM_TYPE_ATOMS,
|
||||
False,
|
||||
@ -544,7 +545,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
"seat", seat_x11,
|
||||
NULL);
|
||||
|
||||
translate_device_classes (clutter_x11_get_default_display (), retval,
|
||||
translate_device_classes (meta_clutter_x11_get_default_display (), retval,
|
||||
info->classes,
|
||||
info->num_classes);
|
||||
|
||||
@ -577,10 +578,10 @@ pad_passive_button_grab (ClutterInputDevice *device)
|
||||
XISetMask (xi_event_mask.mask, XI_ButtonPress);
|
||||
XISetMask (xi_event_mask.mask, XI_ButtonRelease);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGrabButton (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGrabButton (meta_clutter_x11_get_default_display (),
|
||||
device_id, XIAnyButton,
|
||||
clutter_x11_get_root_window (), None,
|
||||
meta_clutter_x11_get_root_window (), None,
|
||||
XIGrabModeSync, XIGrabModeSync,
|
||||
True, &xi_event_mask, 1, &xi_grab_mods);
|
||||
if (rc != 0)
|
||||
@ -590,12 +591,12 @@ pad_passive_button_grab (ClutterInputDevice *device)
|
||||
}
|
||||
else
|
||||
{
|
||||
XIAllowEvents (clutter_x11_get_default_display (),
|
||||
XIAllowEvents (meta_clutter_x11_get_default_display (),
|
||||
device_id, XIAsyncDevice,
|
||||
CLUTTER_CURRENT_TIME);
|
||||
}
|
||||
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
g_free (xi_event_mask.mask);
|
||||
}
|
||||
@ -737,16 +738,17 @@ device_get_tool_serial (ClutterInputDevice *device)
|
||||
Atom type;
|
||||
Atom prop;
|
||||
|
||||
prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Serial IDs", True);
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
"Wacom Serial IDs", True);
|
||||
if (prop == None)
|
||||
return 0;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
prop, 0, 4, FALSE, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
if (rc == Success && type == XA_INTEGER && format == 32 && nitems >= 4)
|
||||
serial_id = data[3];
|
||||
@ -776,11 +778,11 @@ translate_hierarchy_event (ClutterBackend *backend,
|
||||
|
||||
g_debug ("Hierarchy event: device enabled");
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
info = XIQueryDevice (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
info = XIQueryDevice (meta_clutter_x11_get_default_display (),
|
||||
ev->info[i].deviceid,
|
||||
&n_devices);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
if (info != NULL)
|
||||
{
|
||||
ClutterInputDevice *device;
|
||||
@ -834,9 +836,14 @@ translate_property_event (MetaSeatX11 *seat_x11,
|
||||
XIEvent *event)
|
||||
{
|
||||
XIPropertyEvent *xev = (XIPropertyEvent *) event;
|
||||
Atom serial_ids_prop = XInternAtom (clutter_x11_get_default_display (), "Wacom Serial IDs", True);
|
||||
Atom serial_ids_prop;
|
||||
ClutterInputDevice *device;
|
||||
|
||||
serial_ids_prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
"Wacom Serial IDs", True);
|
||||
if (serial_ids_prop == None)
|
||||
return;
|
||||
|
||||
device = g_hash_table_lookup (seat_x11->devices_by_id,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
if (!device)
|
||||
@ -1362,10 +1369,9 @@ meta_seat_x11_constructed (GObject *object)
|
||||
int n_devices, i;
|
||||
Display *xdisplay;
|
||||
|
||||
xdisplay = clutter_x11_get_default_display ();
|
||||
xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
info = XIQueryDevice (clutter_x11_get_default_display (),
|
||||
XIAllDevices, &n_devices);
|
||||
info = XIQueryDevice (xdisplay, XIAllDevices, &n_devices);
|
||||
|
||||
for (i = 0; i < n_devices; i++)
|
||||
{
|
||||
@ -1387,7 +1393,7 @@ meta_seat_x11_constructed (GObject *object)
|
||||
event_mask.mask_len = sizeof (mask);
|
||||
event_mask.mask = mask;
|
||||
|
||||
XISelectEvents (xdisplay, clutter_x11_get_root_window (),
|
||||
XISelectEvents (xdisplay, meta_clutter_x11_get_root_window (),
|
||||
&event_mask, 1);
|
||||
|
||||
memset(mask, 0, sizeof (mask));
|
||||
@ -1399,7 +1405,7 @@ meta_seat_x11_constructed (GObject *object)
|
||||
event_mask.mask_len = sizeof (mask);
|
||||
event_mask.mask = mask;
|
||||
|
||||
XISelectEvents (xdisplay, clutter_x11_get_root_window (),
|
||||
XISelectEvents (xdisplay, meta_clutter_x11_get_root_window (),
|
||||
&event_mask, 1);
|
||||
|
||||
XSync (xdisplay, False);
|
||||
@ -1493,14 +1499,14 @@ meta_seat_x11_warp_pointer (ClutterSeat *seat,
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
XIWarpPointer (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
XIWarpPointer (meta_clutter_x11_get_default_display (),
|
||||
seat_x11->pointer_id,
|
||||
None,
|
||||
clutter_x11_get_root_window (),
|
||||
meta_clutter_x11_get_root_window (),
|
||||
0, 0, 0, 0,
|
||||
x, y);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
@ -1565,14 +1571,14 @@ meta_seat_x11_query_state (ClutterSeat *seat,
|
||||
XIModifierState modifier_state;
|
||||
XIGroupState group_state;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
XIQueryPointer (clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
XIQueryPointer (meta_clutter_x11_get_default_display (),
|
||||
seat_x11->pointer_id,
|
||||
meta_backend_x11_get_xwindow (backend_x11),
|
||||
&root_ret, &child_ret,
|
||||
&root_x, &root_y, &win_x, &win_y,
|
||||
&button_state, &modifier_state, &group_state);
|
||||
if (clutter_x11_untrap_x_errors ())
|
||||
if (meta_clutter_x11_untrap_x_errors ())
|
||||
{
|
||||
g_free (button_state.mask);
|
||||
return FALSE;
|
||||
@ -1831,7 +1837,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
if (device)
|
||||
{
|
||||
meta_input_device_x11_reset_axes (device);
|
||||
translate_device_classes (clutter_x11_get_default_display (),
|
||||
translate_device_classes (meta_clutter_x11_get_default_display (),
|
||||
device,
|
||||
xev->classes,
|
||||
xev->num_classes);
|
||||
@ -1930,7 +1936,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
if (clutter_input_device_get_device_type (source_device) == CLUTTER_PAD_DEVICE)
|
||||
{
|
||||
/* We got these events because of the passive button grab */
|
||||
XIAllowEvents (clutter_x11_get_default_display (),
|
||||
XIAllowEvents (meta_clutter_x11_get_default_display (),
|
||||
xev->sourceid,
|
||||
XIAsyncDevice,
|
||||
xev->time);
|
||||
@ -2409,7 +2415,7 @@ meta_seat_x11_select_stage_events (MetaSeatX11 *seat,
|
||||
xi_event_mask.mask = mask;
|
||||
xi_event_mask.mask_len = len;
|
||||
|
||||
XISelectEvents (clutter_x11_get_default_display (),
|
||||
XISelectEvents (meta_clutter_x11_get_default_display (),
|
||||
stage_x11->xwin, &xi_event_mask, 1);
|
||||
|
||||
g_free (mask);
|
||||
|
@ -30,12 +30,11 @@
|
||||
#include "backends/x11/cm/meta-backend-x11-cm.h"
|
||||
#include "backends/x11/cm/meta-renderer-x11-cm.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-seat-x11.h"
|
||||
#include "backends/x11/meta-stage-x11.h"
|
||||
#include "backends/x11/nested/meta-stage-x11-nested.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "clutter/x11/clutter-backend-x11.h"
|
||||
#include "cogl/cogl-mutter.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/display-private.h"
|
||||
@ -85,7 +84,7 @@ meta_stage_x11_fix_window_size (MetaStageX11 *stage_x11,
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
uint32_t min_width, min_height;
|
||||
XSizeHints *size_hints;
|
||||
|
||||
@ -117,8 +116,9 @@ static void
|
||||
meta_stage_x11_set_wm_protocols (MetaStageX11 *stage_x11)
|
||||
{
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
MetaClutterBackendX11 *backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
Atom protocols[2];
|
||||
int n = 0;
|
||||
|
||||
@ -163,7 +163,7 @@ meta_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
if (width != stage_x11->xwin_width ||
|
||||
height != stage_x11->xwin_height)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
/* XXX: in this case we can rely on a subsequent
|
||||
* ConfigureNotify that will result in the stage
|
||||
@ -189,8 +189,9 @@ static inline void
|
||||
set_wm_pid (MetaStageX11 *stage_x11)
|
||||
{
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
MetaClutterBackendX11 *backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
long pid;
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
@ -215,8 +216,9 @@ static inline void
|
||||
set_wm_title (MetaStageX11 *stage_x11)
|
||||
{
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
MetaClutterBackendX11 *backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
return;
|
||||
@ -295,7 +297,7 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (stage_impl->backend);
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (clutter_backend_get_default_seat (backend));
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
float width, height;
|
||||
GError *error = NULL;
|
||||
|
||||
@ -345,7 +347,7 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
/* we unconditionally select input events even with event retrieval
|
||||
* disabled because we need to guarantee that the Clutter internal
|
||||
* state is maintained when calling clutter_x11_handle_event() without
|
||||
* state is maintained when calling meta_clutter_x11_handle_event() without
|
||||
* requiring applications or embedding toolkits to select events
|
||||
* themselves. if we did that, we'd have to document the events to be
|
||||
* selected, and also update applications and embedding toolkits each
|
||||
@ -386,7 +388,7 @@ meta_stage_x11_set_title (ClutterStageWindow *stage_window,
|
||||
static inline void
|
||||
update_wm_hints (MetaStageX11 *stage_x11)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
XWMHints wm_hints;
|
||||
|
||||
if (stage_x11->wm_state & STAGE_X11_WITHDRAWN)
|
||||
@ -427,7 +429,7 @@ meta_stage_x11_show (ClutterStageWindow *stage_window,
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
if (do_raise)
|
||||
{
|
||||
@ -457,7 +459,7 @@ meta_stage_x11_hide (ClutterStageWindow *stage_window)
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
if (STAGE_X11_IS_MAPPED (stage_x11))
|
||||
set_stage_x11_state (stage_x11, 0, STAGE_X11_WITHDRAWN);
|
||||
@ -550,13 +552,13 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_user_time (ClutterBackendX11 *backend_x11,
|
||||
MetaStageX11 *stage_x11,
|
||||
long timestamp)
|
||||
set_user_time (MetaClutterBackendX11 *backend_x11,
|
||||
MetaStageX11 *stage_x11,
|
||||
long timestamp)
|
||||
{
|
||||
if (timestamp != CLUTTER_CURRENT_TIME)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
XChangeProperty (xdisplay,
|
||||
stage_x11->xwin,
|
||||
@ -568,9 +570,9 @@ set_user_time (ClutterBackendX11 *backend_x11,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
||||
MetaStageX11 *stage_x11,
|
||||
XEvent *xevent)
|
||||
handle_wm_protocols_event (MetaClutterBackendX11 *backend_x11,
|
||||
MetaStageX11 *stage_x11,
|
||||
XEvent *xevent)
|
||||
{
|
||||
Atom atom = (Atom) xevent->xclient.data.l[0];
|
||||
|
||||
@ -585,7 +587,7 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
||||
xevent->xany.window == stage_x11->xwin)
|
||||
{
|
||||
XClientMessageEvent xclient = xevent->xclient;
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
xclient.window = backend_x11->xwin_root;
|
||||
XSendEvent (xdisplay, xclient.window,
|
||||
@ -616,7 +618,7 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
|
||||
{
|
||||
MetaStageImpl *stage_impl;
|
||||
gboolean res = FALSE;
|
||||
ClutterBackendX11 *clutter_backend_x11;
|
||||
MetaClutterBackendX11 *clutter_backend_x11;
|
||||
ClutterStage *stage;
|
||||
MetaBackend *backend;
|
||||
|
||||
@ -626,7 +628,7 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
|
||||
|
||||
stage = stage_impl->wrapper;
|
||||
backend = stage_x11->backend;
|
||||
clutter_backend_x11 = CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
clutter_backend_x11 = META_CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
|
||||
switch (xevent->type)
|
||||
{
|
||||
@ -844,7 +846,8 @@ meta_stage_x11_set_user_time (MetaStageX11 *stage_x11,
|
||||
uint32_t user_time)
|
||||
{
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
MetaClutterBackendX11 *backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (stage_impl->backend);
|
||||
|
||||
set_user_time (backend_x11, stage_x11, user_time);
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "meta-keymap-x11.h"
|
||||
#include "meta-virtual-input-device-x11.h"
|
||||
|
||||
@ -48,7 +48,7 @@ meta_virtual_input_device_x11_notify_relative_motion (ClutterVirtualInputDevice
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
XTestFakeRelativeMotionEvent (clutter_x11_get_default_display (),
|
||||
XTestFakeRelativeMotionEvent (meta_clutter_x11_get_default_display (),
|
||||
(int) dx,
|
||||
(int) dy,
|
||||
0);
|
||||
@ -60,8 +60,8 @@ meta_virtual_input_device_x11_notify_absolute_motion (ClutterVirtualInputDevice
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
XTestFakeMotionEvent (clutter_x11_get_default_display (),
|
||||
clutter_x11_get_default_screen (),
|
||||
XTestFakeMotionEvent (meta_clutter_x11_get_default_display (),
|
||||
meta_clutter_x11_get_default_screen (),
|
||||
(int) x,
|
||||
(int) y,
|
||||
0);
|
||||
@ -73,7 +73,7 @@ meta_virtual_input_device_x11_notify_button (ClutterVirtualInputDevice *virtual_
|
||||
uint32_t button,
|
||||
ClutterButtonState button_state)
|
||||
{
|
||||
XTestFakeButtonEvent (clutter_x11_get_default_display (),
|
||||
XTestFakeButtonEvent (meta_clutter_x11_get_default_display (),
|
||||
button, button_state == CLUTTER_BUTTON_STATE_PRESSED, 0);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ meta_virtual_input_device_x11_notify_discrete_scroll (ClutterVirtualInputDevice
|
||||
ClutterScrollDirection direction,
|
||||
ClutterScrollSource scroll_source)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
int button;
|
||||
|
||||
switch (direction)
|
||||
@ -158,7 +158,7 @@ meta_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_dev
|
||||
uint32_t key,
|
||||
ClutterKeyState key_state)
|
||||
{
|
||||
XTestFakeKeyEvent (clutter_x11_get_default_display (),
|
||||
XTestFakeKeyEvent (meta_clutter_x11_get_default_display (),
|
||||
key + 8, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_
|
||||
key_state == CLUTTER_KEY_STATE_PRESSED)
|
||||
meta_keymap_x11_latch_modifiers (keymap, level, TRUE);
|
||||
|
||||
XTestFakeKeyEvent (clutter_x11_get_default_display (),
|
||||
XTestFakeKeyEvent (meta_clutter_x11_get_default_display (),
|
||||
(KeyCode) keycode,
|
||||
key_state == CLUTTER_KEY_STATE_PRESSED, 0);
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKBstr.h>
|
||||
|
||||
#include "backends/x11/meta-clutter-backend-x11.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"
|
||||
|
||||
@ -48,14 +48,14 @@ get_xkb_desc_rec (Display *xdisplay)
|
||||
XkbDescRec *desc;
|
||||
Status status = Success;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
desc = XkbGetMap (xdisplay, XkbAllMapComponentsMask, XkbUseCoreKbd);
|
||||
if (desc != NULL)
|
||||
{
|
||||
desc->ctrls = NULL;
|
||||
status = XkbGetControls (xdisplay, XkbAllControlsMask, desc);
|
||||
}
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
|
||||
g_return_val_if_fail (desc != NULL, NULL);
|
||||
g_return_val_if_fail (desc->ctrls != NULL, NULL);
|
||||
@ -68,16 +68,16 @@ static void
|
||||
set_xkb_desc_rec (Display *xdisplay,
|
||||
XkbDescRec *desc)
|
||||
{
|
||||
clutter_x11_trap_x_errors ();
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
XkbSetControls (xdisplay, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
|
||||
XSync (xdisplay, FALSE);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
}
|
||||
|
||||
static void
|
||||
check_settings_changed (ClutterSeat *seat)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
MetaKbdA11ySettings kbd_a11y_settings;
|
||||
MetaKeyboardA11yFlags what_changed = 0;
|
||||
MetaInputSettings *input_settings;
|
||||
@ -131,7 +131,7 @@ check_settings_changed (ClutterSeat *seat)
|
||||
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
|
||||
}
|
||||
|
||||
static ClutterX11FilterReturn
|
||||
static MetaX11FilterReturn
|
||||
xkb_a11y_event_filter (XEvent *xevent,
|
||||
ClutterEvent *clutter_event,
|
||||
gpointer data)
|
||||
@ -151,7 +151,7 @@ xkb_a11y_event_filter (XEvent *xevent,
|
||||
xkbev->any.xkb_type == XkbControlsNotify && xkbev->ctrls.event_type != 0)
|
||||
check_settings_changed (seat);
|
||||
|
||||
return CLUTTER_X11_FILTER_CONTINUE;
|
||||
return META_X11_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -205,7 +205,7 @@ void
|
||||
meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
MetaKbdA11ySettings *kbd_a11y_settings)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
XkbDescRec *desc;
|
||||
gboolean enable_accessX;
|
||||
|
||||
@ -323,7 +323,7 @@ meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
gboolean
|
||||
meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
guint event_mask;
|
||||
|
||||
if (!is_xkb_available (xdisplay))
|
||||
@ -333,7 +333,7 @@ meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
|
||||
XkbSelectEvents (xdisplay, XkbUseCoreKbd, event_mask, event_mask);
|
||||
|
||||
clutter_x11_add_filter (xkb_a11y_event_filter, seat);
|
||||
meta_clutter_x11_add_filter (xkb_a11y_event_filter, seat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -26,12 +26,12 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/meta-renderer.h"
|
||||
#include "backends/meta-renderer-view.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "core/boxes-private.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "meta/util.h"
|
||||
|
Reference in New Issue
Block a user