mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
cursor-tracker: Add X11 cursor tracker backend
The intention is to use this to actively track the cursor position given a fixed interval when needed, e.g. when screen casting. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
This commit is contained in:
parent
fcf7c4d0c7
commit
3abbfef66e
@ -68,6 +68,7 @@ struct _MetaBackendClass
|
||||
MetaMonitorManager * (* create_monitor_manager) (MetaBackend *backend,
|
||||
GError **error);
|
||||
MetaCursorRenderer * (* create_cursor_renderer) (MetaBackend *backend);
|
||||
MetaCursorTracker * (* create_cursor_tracker) (MetaBackend *backend);
|
||||
MetaRenderer * (* create_renderer) (MetaBackend *backend,
|
||||
GError **error);
|
||||
MetaInputSettings * (* create_input_settings) (MetaBackend *backend);
|
||||
|
@ -592,6 +592,14 @@ meta_backend_real_is_lid_closed (MetaBackend *backend)
|
||||
return priv->lid_is_closed;
|
||||
}
|
||||
|
||||
static MetaCursorTracker *
|
||||
meta_backend_real_create_cursor_tracker (MetaBackend *backend)
|
||||
{
|
||||
return g_object_new (META_TYPE_CURSOR_TRACKER,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_backend_is_lid_closed (MetaBackend *backend)
|
||||
{
|
||||
@ -745,6 +753,7 @@ meta_backend_class_init (MetaBackendClass *klass)
|
||||
klass->ungrab_device = meta_backend_real_ungrab_device;
|
||||
klass->select_stage_events = meta_backend_real_select_stage_events;
|
||||
klass->is_lid_closed = meta_backend_real_is_lid_closed;
|
||||
klass->create_cursor_tracker = meta_backend_real_create_cursor_tracker;
|
||||
|
||||
signals[KEYMAP_CHANGED] =
|
||||
g_signal_new ("keymap-changed",
|
||||
@ -988,9 +997,8 @@ meta_backend_initable_init (GInitable *initable,
|
||||
if (!priv->renderer)
|
||||
return FALSE;
|
||||
|
||||
priv->cursor_tracker = g_object_new (META_TYPE_CURSOR_TRACKER,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
priv->cursor_tracker =
|
||||
META_BACKEND_GET_CLASS (backend)->create_cursor_tracker (backend);
|
||||
|
||||
priv->dnd = g_object_new (META_TYPE_DND, NULL);
|
||||
|
||||
|
@ -27,6 +27,11 @@
|
||||
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
|
||||
#include "meta/meta-cursor-tracker.h"
|
||||
|
||||
struct _MetaCursorTrackerClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||
XEvent *xevent);
|
||||
|
||||
|
@ -56,11 +56,6 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[N_PROPS];
|
||||
|
||||
struct _MetaCursorTracker
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct _MetaCursorTrackerPrivate
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-dnd-private.h"
|
||||
#include "backends/x11/meta-cursor-renderer-x11.h"
|
||||
#include "backends/x11/meta-cursor-tracker-x11.h"
|
||||
#include "backends/x11/meta-gpu-xrandr.h"
|
||||
#include "backends/x11/meta-input-settings-x11.h"
|
||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||
@ -122,6 +123,14 @@ meta_backend_x11_cm_create_cursor_renderer (MetaBackend *backend)
|
||||
NULL);
|
||||
}
|
||||
|
||||
static MetaCursorTracker *
|
||||
meta_backend_x11_cm_create_cursor_tracker (MetaBackend *backend)
|
||||
{
|
||||
return g_object_new (META_TYPE_CURSOR_TRACKER_X11,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static MetaInputSettings *
|
||||
meta_backend_x11_cm_create_input_settings (MetaBackend *backend)
|
||||
{
|
||||
@ -436,6 +445,7 @@ meta_backend_x11_cm_class_init (MetaBackendX11CmClass *klass)
|
||||
backend_class->create_renderer = meta_backend_x11_cm_create_renderer;
|
||||
backend_class->create_monitor_manager = meta_backend_x11_cm_create_monitor_manager;
|
||||
backend_class->create_cursor_renderer = meta_backend_x11_cm_create_cursor_renderer;
|
||||
backend_class->create_cursor_tracker = meta_backend_x11_cm_create_cursor_tracker;
|
||||
backend_class->create_input_settings = meta_backend_x11_cm_create_input_settings;
|
||||
backend_class->update_screen_size = meta_backend_x11_cm_update_screen_size;
|
||||
backend_class->select_stage_events = meta_backend_x11_cm_select_stage_events;
|
||||
|
41
src/backends/x11/meta-cursor-tracker-x11.c
Normal file
41
src/backends/x11/meta-cursor-tracker-x11.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "backends/x11/meta-cursor-tracker-x11.h"
|
||||
|
||||
struct _MetaCursorTrackerX11
|
||||
{
|
||||
MetaCursorTracker parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaCursorTrackerX11, meta_cursor_tracker_x11,
|
||||
META_TYPE_CURSOR_TRACKER)
|
||||
|
||||
static void
|
||||
meta_cursor_tracker_x11_init (MetaCursorTrackerX11 *tracker_x11)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_cursor_tracker_x11_class_init (MetaCursorTrackerX11Class *klass)
|
||||
{
|
||||
}
|
31
src/backends/x11/meta-cursor-tracker-x11.h
Normal file
31
src/backends/x11/meta-cursor-tracker-x11.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef META_CURSOR_TRACKER_X11_H
|
||||
#define META_CURSOR_TRACKER_X11_H
|
||||
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
|
||||
#define META_TYPE_CURSOR_TRACKER_X11 (meta_cursor_tracker_x11_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaCursorTrackerX11, meta_cursor_tracker_x11,
|
||||
META, CURSOR_TRACKER_X11,
|
||||
MetaCursorTracker)
|
||||
|
||||
#endif /* META_CURSOR_TRACKER_X11_H */
|
@ -249,6 +249,8 @@ mutter_sources = [
|
||||
'backends/x11/meta-crtc-xrandr.h',
|
||||
'backends/x11/meta-cursor-renderer-x11.c',
|
||||
'backends/x11/meta-cursor-renderer-x11.h',
|
||||
'backends/x11/meta-cursor-tracker-x11.c',
|
||||
'backends/x11/meta-cursor-tracker-x11.h',
|
||||
'backends/x11/meta-event-x11.c',
|
||||
'backends/x11/meta-event-x11.h',
|
||||
'backends/x11/meta-gpu-xrandr.c',
|
||||
|
@ -32,11 +32,10 @@
|
||||
#define META_TYPE_CURSOR_TRACKER (meta_cursor_tracker_get_type ())
|
||||
|
||||
META_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (MetaCursorTracker,
|
||||
meta_cursor_tracker,
|
||||
META, CURSOR_TRACKER,
|
||||
GObject)
|
||||
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaCursorTracker,
|
||||
meta_cursor_tracker,
|
||||
META, CURSOR_TRACKER,
|
||||
GObject)
|
||||
|
||||
META_EXPORT
|
||||
MetaCursorTracker *meta_cursor_tracker_get_for_display (MetaDisplay *display);
|
||||
|
Loading…
Reference in New Issue
Block a user