backend: Set up and use ownership chains
This means objects have an owner, where the chain eventually always leads to a MetaContext. This also means that all objects can find their way to other object instances via the chain, instead of scattered global singletons. This is a squashed commit originally containing the following: cursor-tracker: Don't get backend from singleton idle-manager: Don't get backend from singleton input-device: Pass pointer to backend during construction The backend is needed during construction to get the wacom database. input-mapper: Pass backend when constructing monitor: Don't get backend from singleton monitor-manager: Get backend directly from monitor manager remote: Get backend from manager class For the remote desktop and screen cast implementations, replace getting the backend from singletons with getting it via the manager classes. launcher: Pass backend during construction device-pool: Pass backend during construction Instead of passing the (maybe null) launcher, pass the backend, and get the launcher from there. That way we always have a way to some known context from the device pool. drm-buffer/gbm: Get backend via device pool cursor-renderer: Get backend directly from renderer input-device: Get backend getter input-settings: Add backend construct property and getter input-settings/x11: Don't get backend from singleton renderer: Get backend from renderer itself seat-impl: Add backend getter seat/native: Get backend from instance struct stage-impl: Get backend from stage impl itself x11/xkb-a11y: Don't get backend from singleton backend/x11/nested: Don't get Wayland compositor from singleton crtc: Add backend property Adding a link to the GPU isn't enough; the virtual CRTCs of virtual monitors doesn't have one. cursor-tracker: Don't get display from singleton remote: Don't get display from singleton seat: Don't get display from singleton backend/x11: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
parent
c45ab10c0e
commit
c390f70edc
@ -556,7 +556,7 @@ meta_backend_real_post_init (MetaBackend *backend)
|
||||
G_CALLBACK (on_device_removed), backend,
|
||||
G_CONNECT_AFTER);
|
||||
|
||||
priv->input_mapper = meta_input_mapper_new ();
|
||||
priv->input_mapper = meta_input_mapper_new (backend);
|
||||
|
||||
input_settings = meta_backend_get_input_settings (backend);
|
||||
|
||||
|
@ -28,6 +28,7 @@ enum
|
||||
PROP_0,
|
||||
|
||||
PROP_ID,
|
||||
PROP_BACKEND,
|
||||
PROP_GPU,
|
||||
PROP_ALL_TRANSFORMS,
|
||||
|
||||
@ -40,6 +41,7 @@ typedef struct _MetaCrtcPrivate
|
||||
{
|
||||
uint64_t id;
|
||||
|
||||
MetaBackend *backend;
|
||||
MetaGpu *gpu;
|
||||
|
||||
MetaMonitorTransform all_transforms;
|
||||
@ -58,6 +60,14 @@ meta_crtc_get_id (MetaCrtc *crtc)
|
||||
return priv->id;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_crtc_get_backend (MetaCrtc *crtc)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
||||
MetaGpu *
|
||||
meta_crtc_get_gpu (MetaCrtc *crtc)
|
||||
{
|
||||
@ -179,6 +189,9 @@ meta_crtc_set_property (GObject *object,
|
||||
case PROP_ID:
|
||||
priv->id = g_value_get_uint64 (value);
|
||||
break;
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_GPU:
|
||||
priv->gpu = g_value_get_object (value);
|
||||
break;
|
||||
@ -204,6 +217,9 @@ meta_crtc_get_property (GObject *object,
|
||||
case PROP_ID:
|
||||
g_value_set_uint64 (value, priv->id);
|
||||
break;
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, priv->backend);
|
||||
break;
|
||||
case PROP_GPU:
|
||||
g_value_set_object (value, priv->gpu);
|
||||
break;
|
||||
@ -252,6 +268,14 @@ meta_crtc_class_init (MetaCrtcClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"backend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_GPU] =
|
||||
g_param_spec_object ("gpu",
|
||||
"gpu",
|
||||
|
@ -54,6 +54,9 @@ struct _MetaCrtcClass
|
||||
META_EXPORT_TEST
|
||||
uint64_t meta_crtc_get_id (MetaCrtc *crtc);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaBackend * meta_crtc_get_backend (MetaCrtc *crtc);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaGpu * meta_crtc_get_gpu (MetaCrtc *crtc);
|
||||
|
||||
|
@ -478,3 +478,12 @@ meta_cursor_renderer_get_input_device (MetaCursorRenderer *renderer)
|
||||
|
||||
return priv->device;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_cursor_renderer_get_backend (MetaCursorRenderer *renderer)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv =
|
||||
meta_cursor_renderer_get_instance_private (renderer);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
@ -77,4 +77,6 @@ ClutterInputDevice * meta_cursor_renderer_get_input_device (MetaCursorRenderer *
|
||||
void meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
||||
MetaBackend * meta_cursor_renderer_get_backend (MetaCursorRenderer *renderer);
|
||||
|
||||
#endif /* META_CURSOR_RENDERER_H */
|
||||
|
@ -109,7 +109,8 @@ update_displayed_cursor (MetaCursorTracker *tracker)
|
||||
{
|
||||
MetaCursorTrackerPrivate *priv =
|
||||
meta_cursor_tracker_get_instance_private (tracker);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaContext *context = meta_backend_get_context (priv->backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaCursorSprite *cursor = NULL;
|
||||
|
||||
if (display && meta_display_windows_are_interactable (display) &&
|
||||
@ -323,7 +324,8 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
|
||||
MetaCursorTracker *
|
||||
meta_cursor_tracker_get_for_display (MetaDisplay *display)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaCursorTracker *tracker = meta_backend_get_cursor_tracker (backend);
|
||||
|
||||
g_assert (tracker);
|
||||
|
@ -266,7 +266,7 @@ meta_idle_manager_get_monitor (MetaIdleManager *idle_manager,
|
||||
MetaIdleMonitor *
|
||||
meta_idle_manager_get_core_monitor (MetaIdleManager *idle_manager)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = idle_manager->backend;
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <libwacom/libwacom.h>
|
||||
#endif
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
|
||||
typedef struct _MetaInputDeviceClass MetaInputDeviceClass;
|
||||
@ -45,4 +46,6 @@ G_DECLARE_DERIVABLE_TYPE (MetaInputDevice,
|
||||
WacomDevice * meta_input_device_get_wacom_device (MetaInputDevice *input_device);
|
||||
#endif
|
||||
|
||||
MetaBackend * meta_input_device_get_backend (MetaInputDevice *input_device);
|
||||
|
||||
#endif /* META_INPUT_DEVICE_H */
|
||||
|
@ -26,6 +26,8 @@ typedef struct _MetaInputDevicePrivate MetaInputDevicePrivate;
|
||||
|
||||
struct _MetaInputDevicePrivate
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
||||
#ifdef HAVE_LIBWACOM
|
||||
WacomDevice *wacom_device;
|
||||
#else
|
||||
@ -38,6 +40,7 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
PROP_WACOM_DEVICE,
|
||||
|
||||
N_PROPS
|
||||
@ -69,7 +72,7 @@ meta_input_device_constructed (GObject *object)
|
||||
#ifdef HAVE_LIBWACOM
|
||||
input_device = META_INPUT_DEVICE (object);
|
||||
priv = meta_input_device_get_instance_private (input_device);
|
||||
wacom_db = meta_backend_get_wacom_database (meta_get_backend ());
|
||||
wacom_db = meta_backend_get_wacom_database (priv->backend);
|
||||
node = clutter_input_device_get_device_node (CLUTTER_INPUT_DEVICE (input_device));
|
||||
priv->wacom_device = libwacom_new_from_path (wacom_db, node,
|
||||
WFALLBACK_NONE, NULL);
|
||||
@ -90,6 +93,26 @@ meta_input_device_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (meta_input_device_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_device_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaInputDevicePrivate *priv;
|
||||
|
||||
priv = meta_input_device_get_instance_private (META_INPUT_DEVICE (object));
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_device_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -117,8 +140,17 @@ meta_input_device_class_init (MetaInputDeviceClass *klass)
|
||||
|
||||
object_class->constructed = meta_input_device_constructed;
|
||||
object_class->finalize = meta_input_device_finalize;
|
||||
object_class->set_property = meta_input_device_set_property;
|
||||
object_class->get_property = meta_input_device_get_property;
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"backend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
props[PROP_WACOM_DEVICE] =
|
||||
g_param_spec_pointer ("wacom-device",
|
||||
"Wacom device",
|
||||
@ -140,3 +172,12 @@ meta_input_device_get_wacom_device (MetaInputDevice *input_device)
|
||||
return priv->wacom_device;
|
||||
}
|
||||
#endif /* HAVE_LIBWACOM */
|
||||
|
||||
MetaBackend *
|
||||
meta_input_device_get_backend (MetaInputDevice *input_device)
|
||||
{
|
||||
MetaInputDevicePrivate *priv =
|
||||
meta_input_device_get_instance_private (input_device);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ G_DECLARE_FINAL_TYPE (MetaInputMapper, meta_input_mapper,
|
||||
META, INPUT_MAPPER,
|
||||
MetaDBusInputMappingSkeleton)
|
||||
|
||||
MetaInputMapper * meta_input_mapper_new (void);
|
||||
MetaInputMapper * meta_input_mapper_new (MetaBackend *backend);
|
||||
|
||||
void meta_input_mapper_add_device (MetaInputMapper *mapper,
|
||||
ClutterInputDevice *device);
|
||||
|
@ -33,6 +33,17 @@
|
||||
|
||||
#define MAX_SIZE_MATCH_DIFF 0.05
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[N_PROPS];
|
||||
|
||||
typedef struct _MetaMapperInputInfo MetaMapperInputInfo;
|
||||
typedef struct _MetaMapperOutputInfo MetaMapperOutputInfo;
|
||||
typedef struct _MappingHelper MappingHelper;
|
||||
@ -42,6 +53,8 @@ typedef struct _DeviceMatch DeviceMatch;
|
||||
struct _MetaInputMapper
|
||||
{
|
||||
MetaDBusInputMappingSkeleton parent_instance;
|
||||
|
||||
MetaBackend *backend;
|
||||
MetaMonitorManager *monitor_manager;
|
||||
ClutterSeat *seat;
|
||||
GHashTable *input_devices; /* ClutterInputDevice -> MetaMapperInputInfo */
|
||||
@ -682,6 +695,44 @@ input_mapper_device_removed_cb (ClutterSeat *seat,
|
||||
meta_input_mapper_remove_device (mapper, device);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_mapper_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaInputMapper *mapper = META_INPUT_MAPPER (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
mapper->backend = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_mapper_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaInputMapper *mapper = META_INPUT_MAPPER (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, mapper->backend);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_mapper_finalize (GObject *object)
|
||||
{
|
||||
@ -706,7 +757,6 @@ static void
|
||||
meta_input_mapper_constructed (GObject *object)
|
||||
{
|
||||
MetaInputMapper *mapper = META_INPUT_MAPPER (object);
|
||||
MetaBackend *backend;
|
||||
|
||||
G_OBJECT_CLASS (meta_input_mapper_parent_class)->constructed (object);
|
||||
|
||||
@ -714,8 +764,7 @@ meta_input_mapper_constructed (GObject *object)
|
||||
g_signal_connect (mapper->seat, "device-removed",
|
||||
G_CALLBACK (input_mapper_device_removed_cb), mapper);
|
||||
|
||||
backend = meta_get_backend ();
|
||||
mapper->monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
mapper->monitor_manager = meta_backend_get_monitor_manager (mapper->backend);
|
||||
g_signal_connect (mapper->monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (input_mapper_monitors_changed_cb), mapper);
|
||||
g_signal_connect (mapper->monitor_manager, "power-save-mode-changed",
|
||||
@ -732,6 +781,18 @@ meta_input_mapper_class_init (MetaInputMapperClass *klass)
|
||||
|
||||
object_class->constructed = meta_input_mapper_constructed;
|
||||
object_class->finalize = meta_input_mapper_finalize;
|
||||
object_class->set_property = meta_input_mapper_set_property;
|
||||
object_class->get_property = meta_input_mapper_get_property;
|
||||
|
||||
obj_props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"backend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||
|
||||
signals[DEVICE_MAPPED] =
|
||||
g_signal_new ("device-mapped",
|
||||
@ -882,9 +943,11 @@ meta_input_mapping_init_iface (MetaDBusInputMappingIface *iface)
|
||||
|
||||
|
||||
MetaInputMapper *
|
||||
meta_input_mapper_new (void)
|
||||
meta_input_mapper_new (MetaBackend *backend)
|
||||
{
|
||||
return g_object_new (META_TYPE_INPUT_MAPPER, NULL);
|
||||
return g_object_new (META_TYPE_INPUT_MAPPER,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -182,4 +182,6 @@ void meta_input_settings_notify_kbd_a11y_change (MetaInputSettings *input_se
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed);
|
||||
|
||||
MetaBackend * meta_input_settings_get_backend (MetaInputSettings *input_settings);
|
||||
|
||||
#endif /* META_INPUT_SETTINGS_PRIVATE_H */
|
||||
|
@ -39,6 +39,17 @@
|
||||
#include "core/display-private.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPS] = { 0 };
|
||||
|
||||
static GQuark quark_tool_settings = 0;
|
||||
|
||||
typedef struct _MetaInputSettingsPrivate MetaInputSettingsPrivate;
|
||||
@ -66,6 +77,8 @@ struct _DeviceMappingInfo
|
||||
|
||||
struct _MetaInputSettingsPrivate
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
||||
ClutterSeat *seat;
|
||||
gulong monitors_changed_id;
|
||||
|
||||
@ -1711,6 +1724,26 @@ meta_input_settings_constructed (GObject *object)
|
||||
load_keyboard_a11y_settings (input_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaInputSettings *settings = META_INPUT_SETTINGS (object);
|
||||
MetaInputSettingsPrivate *priv =
|
||||
meta_input_settings_get_instance_private (settings);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_class_init (MetaInputSettingsClass *klass)
|
||||
{
|
||||
@ -1718,6 +1751,17 @@ meta_input_settings_class_init (MetaInputSettingsClass *klass)
|
||||
|
||||
object_class->dispose = meta_input_settings_dispose;
|
||||
object_class->constructed = meta_input_settings_constructed;
|
||||
object_class->set_property = meta_input_settings_set_property;
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"backend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
|
||||
quark_tool_settings =
|
||||
g_quark_from_static_string ("meta-input-settings-tool-settings");
|
||||
@ -1864,3 +1908,12 @@ meta_input_settings_get_kbd_a11y_settings (MetaInputSettings *input_settings,
|
||||
|
||||
*a11y_settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_input_settings_get_backend (MetaInputSettings *settings)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv =
|
||||
meta_input_settings_get_instance_private (settings);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
@ -209,6 +209,7 @@ append_monitor (MetaMonitorManager *manager,
|
||||
|
||||
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
|
||||
"id", (uint64_t) g_list_length (*crtcs) + 1,
|
||||
"backend", meta_gpu_get_backend (gpu),
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
*crtcs = g_list_append (*crtcs, crtc);
|
||||
@ -295,6 +296,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
||||
|
||||
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
|
||||
"id", (uint64_t) g_list_length (*crtcs) + i + 1,
|
||||
"backend", meta_gpu_get_backend (gpu),
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
new_crtcs = g_list_append (new_crtcs, crtc);
|
||||
@ -674,9 +676,9 @@ meta_monitor_manager_dummy_calculate_supported_scales (MetaMonitorManager
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_monitor_framebuffers_scaled (void)
|
||||
is_monitor_framebuffers_scaled (MetaMonitorManager *manager)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
|
||||
return meta_settings_is_experimental_feature_enabled (
|
||||
@ -687,7 +689,7 @@ is_monitor_framebuffers_scaled (void)
|
||||
static MetaMonitorManagerCapability
|
||||
meta_monitor_manager_dummy_get_capabilities (MetaMonitorManager *manager)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
MetaMonitorManagerCapability capabilities =
|
||||
META_MONITOR_MANAGER_CAPABILITY_NONE;
|
||||
@ -711,7 +713,7 @@ meta_monitor_manager_dummy_get_max_screen_size (MetaMonitorManager *manager,
|
||||
static MetaLogicalMonitorLayoutMode
|
||||
meta_monitor_manager_dummy_get_default_layout_mode (MetaMonitorManager *manager)
|
||||
{
|
||||
if (is_monitor_framebuffers_scaled ())
|
||||
if (is_monitor_framebuffers_scaled (manager))
|
||||
return META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
|
||||
else
|
||||
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
|
||||
|
@ -1879,7 +1879,7 @@ meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
MetaMonitorScalesConstraint constraints)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_monitor_get_backend (monitor);
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
int global_scaling_factor;
|
||||
|
||||
|
@ -124,6 +124,16 @@ G_DEFINE_TYPE (MetaRemoteDesktopSessionHandle,
|
||||
static MetaRemoteDesktopSessionHandle *
|
||||
meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session);
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_session (MetaRemoteDesktopSession *session)
|
||||
{
|
||||
MetaRemoteDesktop *remote_desktop = session->remote_desktop;
|
||||
MetaBackend *backend = meta_remote_desktop_get_backend (remote_desktop);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session)
|
||||
{
|
||||
@ -133,7 +143,8 @@ meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session)
|
||||
static void
|
||||
init_remote_access_handle (MetaRemoteDesktopSession *session)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRemoteDesktop *remote_desktop = session->remote_desktop;
|
||||
MetaBackend *backend = meta_remote_desktop_get_backend (remote_desktop);
|
||||
MetaRemoteAccessController *remote_access_controller;
|
||||
MetaRemoteAccessHandle *remote_access_handle;
|
||||
|
||||
@ -1076,7 +1087,7 @@ handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||
GVariant *mime_types_variant;
|
||||
g_autoptr (GError) error = NULL;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
MetaSelection *selection = meta_display_get_selection (display);
|
||||
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
||||
|
||||
@ -1188,7 +1199,7 @@ transfer_request_cleanup_timout (gpointer user_data)
|
||||
static void
|
||||
reset_current_selection_source (MetaRemoteDesktopSession *session)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
MetaSelection *selection = meta_display_get_selection (display);
|
||||
|
||||
if (!session->current_source)
|
||||
@ -1218,7 +1229,7 @@ handle_disable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
MetaSelection *selection = meta_display_get_selection (display);
|
||||
|
||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||
@ -1273,7 +1284,7 @@ handle_set_selection (MetaDBusRemoteDesktopSession *skeleton,
|
||||
if (mime_types_variant)
|
||||
{
|
||||
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
|
||||
source_remote = create_remote_desktop_source (session,
|
||||
mime_types_variant,
|
||||
@ -1545,7 +1556,7 @@ handle_selection_read (MetaDBusRemoteDesktopSession *skeleton,
|
||||
const char *mime_type)
|
||||
{
|
||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
MetaSelection *selection = meta_display_get_selection (display);
|
||||
MetaSelectionSource *source;
|
||||
g_autoptr (GError) error = NULL;
|
||||
@ -1680,7 +1691,7 @@ static void
|
||||
meta_remote_desktop_session_finalize (GObject *object)
|
||||
{
|
||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (object);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_session (session);
|
||||
MetaSelection *selection = meta_display_get_selection (display);
|
||||
|
||||
g_assert (!meta_remote_desktop_session_is_running (session));
|
||||
|
@ -138,7 +138,7 @@ static void
|
||||
meta_renderer_real_rebuild_views (MetaRenderer *renderer)
|
||||
{
|
||||
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = priv->backend;
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
GList *logical_monitors, *l;
|
||||
|
@ -86,7 +86,8 @@ meta_screen_cast_session_handle_new (MetaScreenCastSession *session);
|
||||
static void
|
||||
init_remote_access_handle (MetaScreenCastSession *session)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend =
|
||||
meta_screen_cast_get_backend (session->screen_cast);
|
||||
MetaRemoteAccessController *remote_access_controller;
|
||||
MetaRemoteAccessHandle *remote_access_handle;
|
||||
|
||||
@ -323,7 +324,8 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
|
||||
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (skeleton);
|
||||
GDBusInterfaceSkeleton *interface_skeleton;
|
||||
GDBusConnection *connection;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend =
|
||||
meta_screen_cast_get_backend (session->screen_cast);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitor *monitor;
|
||||
@ -422,6 +424,10 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
||||
GVariant *properties_variant)
|
||||
{
|
||||
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (skeleton);
|
||||
MetaBackend *backend =
|
||||
meta_screen_cast_get_backend (session->screen_cast);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
GDBusInterfaceSkeleton *interface_skeleton;
|
||||
GDBusConnection *connection;
|
||||
MetaWindow *window;
|
||||
@ -429,7 +435,6 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
||||
gboolean is_recording;
|
||||
MetaScreenCastFlag flags;
|
||||
GError *error = NULL;
|
||||
MetaDisplay *display;
|
||||
GVariant *window_id_variant = NULL;
|
||||
MetaScreenCastWindowStream *window_stream;
|
||||
MetaScreenCastStream *stream;
|
||||
@ -448,7 +453,6 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
||||
"window-id",
|
||||
G_VARIANT_TYPE ("t"));
|
||||
|
||||
display = meta_get_display ();
|
||||
if (window_id_variant)
|
||||
{
|
||||
uint64_t window_id;
|
||||
|
@ -789,12 +789,14 @@ meta_backend_native_initable_init (GInitable *initable,
|
||||
break;
|
||||
}
|
||||
|
||||
native->launcher = meta_launcher_new (session_id, seat_id, error);
|
||||
native->launcher = meta_launcher_new (backend,
|
||||
session_id, seat_id,
|
||||
error);
|
||||
if (!native->launcher)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
native->device_pool = meta_device_pool_new (native->launcher);
|
||||
native->device_pool = meta_device_pool_new (native);
|
||||
native->udev = meta_udev_new (native);
|
||||
|
||||
kms_flags = META_KMS_FLAG_NONE;
|
||||
|
@ -525,6 +525,7 @@ meta_crtc_kms_new (MetaGpuKms *gpu_kms,
|
||||
kms_crtc);
|
||||
crtc_kms = g_object_new (META_TYPE_CRTC_KMS,
|
||||
"id", (uint64_t) meta_kms_crtc_get_id (kms_crtc),
|
||||
"backend", meta_gpu_get_backend (gpu),
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
|
||||
|
@ -31,9 +31,11 @@ struct _MetaCrtcVirtual
|
||||
G_DEFINE_TYPE (MetaCrtcVirtual, meta_crtc_virtual, META_TYPE_CRTC_NATIVE)
|
||||
|
||||
MetaCrtcVirtual *
|
||||
meta_crtc_virtual_new (uint64_t id)
|
||||
meta_crtc_virtual_new (MetaBackend *backend,
|
||||
uint64_t id)
|
||||
{
|
||||
return g_object_new (META_TYPE_CRTC_VIRTUAL,
|
||||
"backend", backend,
|
||||
"id", META_CRTC_VIRTUAL_ID_BIT | id,
|
||||
NULL);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ G_DECLARE_FINAL_TYPE (MetaCrtcVirtual, meta_crtc_virtual,
|
||||
META, CRTC_VIRTUAL,
|
||||
MetaCrtcNative)
|
||||
|
||||
MetaCrtcVirtual * meta_crtc_virtual_new (uint64_t id);
|
||||
MetaCrtcVirtual * meta_crtc_virtual_new (MetaBackend *backend,
|
||||
uint64_t id);
|
||||
|
||||
#endif /* META_CRTC_VIRTUAL_H */
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "backends/native/meta-backend-native-types.h"
|
||||
#include "backends/native/meta-device-pool.h"
|
||||
#include "backends/native/meta-launcher.h"
|
||||
|
||||
@ -30,6 +31,6 @@ G_DECLARE_FINAL_TYPE (MetaDevicePool, meta_device_pool,
|
||||
META, DEVICE_POOL,
|
||||
GObject)
|
||||
|
||||
MetaDevicePool * meta_device_pool_new (MetaLauncher *launcher);
|
||||
MetaDevicePool * meta_device_pool_new (MetaBackendNative *backend_native);
|
||||
|
||||
#endif /* META_DEVICE_POOL_PRIVATE_H */
|
||||
|
@ -27,7 +27,9 @@
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#include "backends/native/meta-launcher.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
#include "meta-dbus-login1.h"
|
||||
@ -50,6 +52,8 @@ struct _MetaDevicePool
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaBackend *backend;
|
||||
|
||||
MetaDbusLogin1Session *session_proxy;
|
||||
|
||||
GMutex mutex;
|
||||
@ -351,12 +355,16 @@ release_device_file (MetaDevicePool *pool,
|
||||
}
|
||||
|
||||
MetaDevicePool *
|
||||
meta_device_pool_new (MetaLauncher *launcher)
|
||||
meta_device_pool_new (MetaBackendNative *backend_native)
|
||||
{
|
||||
MetaDevicePool *pool;
|
||||
MetaLauncher *launcher;
|
||||
|
||||
pool = g_object_new (META_TYPE_DEVICE_POOL, NULL);
|
||||
|
||||
pool->backend = META_BACKEND (backend_native);
|
||||
|
||||
launcher = meta_backend_native_get_launcher (backend_native);
|
||||
if (launcher)
|
||||
pool->session_proxy = meta_launcher_get_session_proxy (launcher);
|
||||
|
||||
@ -387,3 +395,9 @@ meta_device_pool_class_init (MetaDevicePoolClass *klass)
|
||||
|
||||
object_class->finalize = meta_device_pool_finalize;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_device_pool_get_backend (MetaDevicePool *pool)
|
||||
{
|
||||
return pool->backend;
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ MetaDeviceFile * meta_device_pool_open (MetaDevicePool *pool,
|
||||
MetaDeviceFileFlags flags,
|
||||
GError **error);
|
||||
|
||||
MetaBackend * meta_device_pool_get_backend (MetaDevicePool *pool);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaDeviceFile, meta_device_file_release)
|
||||
|
||||
#endif /* META_DEVICE_FILE_POOL_H */
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/native/meta-cogl-utils.h"
|
||||
#include "backends/native/meta-device-pool.h"
|
||||
#include "backends/native/meta-drm-buffer-private.h"
|
||||
|
||||
struct _MetaDrmBufferGbm
|
||||
@ -236,7 +237,9 @@ meta_drm_buffer_gbm_fill_timings (MetaDrmBuffer *buffer,
|
||||
GError **error)
|
||||
{
|
||||
MetaDrmBufferGbm *buffer_gbm = META_DRM_BUFFER_GBM (buffer);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDeviceFile *device_file = meta_drm_buffer_get_device_file (buffer);
|
||||
MetaDevicePool *device_pool = meta_device_file_get_pool (device_file);
|
||||
MetaBackend *backend = meta_device_pool_get_backend (device_pool);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend =
|
||||
meta_backend_get_clutter_backend (backend);
|
||||
@ -354,7 +357,10 @@ meta_drm_buffer_gbm_blit_to_framebuffer (CoglScanout *scanout,
|
||||
GError **error)
|
||||
{
|
||||
MetaDrmBufferGbm *buffer_gbm = META_DRM_BUFFER_GBM (scanout);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDrmBuffer *buffer = META_DRM_BUFFER (buffer_gbm);
|
||||
MetaDeviceFile *device_file = meta_drm_buffer_get_device_file (buffer);
|
||||
MetaDevicePool *device_pool = meta_device_file_get_pool (device_file);
|
||||
MetaBackend *backend = meta_device_pool_get_backend (device_pool);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend =
|
||||
meta_backend_get_clutter_backend (backend);
|
||||
|
@ -1461,6 +1461,7 @@ meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
|
||||
}
|
||||
|
||||
device = g_object_new (META_TYPE_INPUT_DEVICE_NATIVE,
|
||||
"backend", meta_seat_impl_get_backend (seat_impl),
|
||||
"name", libinput_device_get_name (libinput_device),
|
||||
"device-type", type,
|
||||
"capabilities", capabilities,
|
||||
@ -1532,6 +1533,7 @@ meta_input_device_native_new_virtual (MetaSeatImpl *seat_impl,
|
||||
};
|
||||
|
||||
device = g_object_new (META_TYPE_INPUT_DEVICE_NATIVE,
|
||||
"backend", meta_seat_impl_get_backend (seat_impl),
|
||||
"name", name,
|
||||
"device-type", type,
|
||||
"device-mode", mode,
|
||||
|
@ -831,6 +831,7 @@ MetaInputSettings *
|
||||
meta_input_settings_native_new_in_impl (MetaSeatImpl *seat_impl)
|
||||
{
|
||||
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE,
|
||||
"backend", meta_seat_impl_get_backend (seat_impl),
|
||||
"seat-impl", seat_impl,
|
||||
NULL);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@
|
||||
|
||||
struct _MetaLauncher
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
||||
MetaDbusLogin1Session *session_proxy;
|
||||
MetaDbusLogin1Seat *seat_proxy;
|
||||
char *seat_id;
|
||||
@ -309,7 +311,7 @@ get_seat_proxy (gchar *seat_id,
|
||||
static void
|
||||
sync_active (MetaLauncher *self)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = self->backend;
|
||||
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
||||
MetaDbusLogin1Session *session_proxy = self->session_proxy;
|
||||
gboolean active;
|
||||
@ -371,9 +373,10 @@ meta_launcher_get_session_proxy (MetaLauncher *launcher)
|
||||
}
|
||||
|
||||
MetaLauncher *
|
||||
meta_launcher_new (const char *fallback_session_id,
|
||||
const char *fallback_seat_id,
|
||||
GError **error)
|
||||
meta_launcher_new (MetaBackend *backend,
|
||||
const char *fallback_session_id,
|
||||
const char *fallback_seat_id,
|
||||
GError **error)
|
||||
{
|
||||
MetaLauncher *self = NULL;
|
||||
g_autoptr (MetaDbusLogin1Session) session_proxy = NULL;
|
||||
@ -420,6 +423,7 @@ meta_launcher_new (const char *fallback_session_id,
|
||||
goto fail;
|
||||
|
||||
self = g_new0 (MetaLauncher, 1);
|
||||
self->backend = backend;
|
||||
self->session_proxy = g_object_ref (session_proxy);
|
||||
self->seat_proxy = g_object_ref (seat_proxy);
|
||||
self->seat_id = g_steal_pointer (&seat_id);
|
||||
@ -455,3 +459,9 @@ meta_launcher_activate_vt (MetaLauncher *launcher,
|
||||
return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt,
|
||||
NULL, error);
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_launcher_get_backend (MetaLauncher *launcher)
|
||||
{
|
||||
return launcher->backend;
|
||||
}
|
||||
|
@ -22,10 +22,13 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
|
||||
typedef struct _MetaLauncher MetaLauncher;
|
||||
typedef struct _MetaDbusLogin1Session MetaDbusLogin1Session;
|
||||
|
||||
MetaLauncher *meta_launcher_new (const char *session_id,
|
||||
MetaLauncher *meta_launcher_new (MetaBackend *backend,
|
||||
const char *session_id,
|
||||
const char *custom_seat_id,
|
||||
GError **error);
|
||||
void meta_launcher_free (MetaLauncher *self);
|
||||
@ -38,5 +41,7 @@ const char * meta_launcher_get_seat_id (MetaLauncher *launcher)
|
||||
|
||||
MetaDbusLogin1Session * meta_launcher_get_session_proxy (MetaLauncher *launcher);
|
||||
|
||||
MetaBackend * meta_launcher_get_backend (MetaLauncher *launcher);
|
||||
|
||||
|
||||
#endif /* META_LAUNCHER_H */
|
||||
|
@ -310,7 +310,7 @@ meta_monitor_manager_native_apply_monitors_config (MetaMonitorManager *ma
|
||||
{
|
||||
if (!manager->in_init)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
meta_renderer_native_reset_modes (META_RENDERER_NATIVE (renderer));
|
||||
@ -628,13 +628,14 @@ meta_monitor_manager_native_create_virtual_monitor (MetaMonitorManager
|
||||
const MetaVirtualMonitorInfo *info,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
MetaMonitorManagerNative *manager_native =
|
||||
META_MONITOR_MANAGER_NATIVE (manager);
|
||||
MetaVirtualMonitorNative *virtual_monitor_native;
|
||||
uint64_t id;
|
||||
|
||||
id = allocate_virtual_monitor_id (manager_native);
|
||||
virtual_monitor_native = meta_virtual_monitor_native_new (id, info);
|
||||
virtual_monitor_native = meta_virtual_monitor_native_new (backend, id, info);
|
||||
g_signal_connect (virtual_monitor_native, "notify::crtc-mode",
|
||||
G_CALLBACK (on_virtual_monitor_mode_changed),
|
||||
manager);
|
||||
|
@ -415,7 +415,8 @@ meta_renderer_native_choose_egl_config (CoglDisplay *cogl_display,
|
||||
{
|
||||
CoglRenderer *cogl_renderer = cogl_display->renderer;
|
||||
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRenderer *renderer = cogl_renderer->custom_winsys_user_data;
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform;
|
||||
EGLDisplay egl_display = cogl_renderer_egl->edpy;
|
||||
@ -486,10 +487,12 @@ meta_renderer_native_destroy_egl_display (CoglDisplay *cogl_display)
|
||||
}
|
||||
|
||||
static EGLSurface
|
||||
create_dummy_pbuffer_surface (EGLDisplay egl_display,
|
||||
GError **error)
|
||||
create_dummy_pbuffer_surface (CoglRenderer *cogl_renderer,
|
||||
EGLDisplay egl_display,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRenderer *renderer = cogl_renderer->custom_winsys_user_data;
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
EGLConfig pbuffer_config;
|
||||
static const EGLint pbuffer_config_attribs[] = {
|
||||
@ -528,7 +531,9 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display,
|
||||
COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) == 0)
|
||||
{
|
||||
cogl_display_egl->dummy_surface =
|
||||
create_dummy_pbuffer_surface (cogl_renderer_egl->edpy, error);
|
||||
create_dummy_pbuffer_surface (cogl_renderer,
|
||||
cogl_renderer_egl->edpy,
|
||||
error);
|
||||
if (cogl_display_egl->dummy_surface == EGL_NO_SURFACE)
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3747,3 +3747,9 @@ meta_seat_impl_get_input_settings (MetaSeatImpl *seat_impl)
|
||||
{
|
||||
return seat_impl->input_settings;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_seat_impl_get_backend (MetaSeatImpl *seat_impl)
|
||||
{
|
||||
return meta_seat_native_get_backend (seat_impl->seat_native);
|
||||
}
|
||||
|
@ -252,4 +252,6 @@ void meta_seat_impl_queue_main_thread_idle (MetaSeatImpl *seat_impl,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
MetaBackend * meta_seat_impl_get_backend (MetaSeatImpl *seat_impl);
|
||||
|
||||
#endif /* META_SEAT_IMPL_H */
|
||||
|
@ -261,7 +261,9 @@ meta_seat_native_peek_devices (ClutterSeat *seat)
|
||||
static void
|
||||
meta_seat_native_bell_notify (ClutterSeat *seat)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
|
||||
MetaContext *context = meta_backend_get_context (seat_native->backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_bell_notify (display, NULL);
|
||||
}
|
||||
@ -595,7 +597,7 @@ meta_seat_native_maybe_ensure_cursor_renderer (MetaSeatNative *seat_native,
|
||||
MetaCursorRendererNative *cursor_renderer_native;
|
||||
|
||||
cursor_renderer_native =
|
||||
meta_cursor_renderer_native_new (meta_get_backend (),
|
||||
meta_cursor_renderer_native_new (seat_native->backend,
|
||||
seat_native->core_pointer);
|
||||
seat_native->cursor_renderer =
|
||||
META_CURSOR_RENDERER (cursor_renderer_native);
|
||||
@ -622,7 +624,7 @@ meta_seat_native_maybe_ensure_cursor_renderer (MetaSeatNative *seat_native,
|
||||
|
||||
if (!cursor_renderer)
|
||||
{
|
||||
cursor_renderer = meta_cursor_renderer_new (meta_get_backend (),
|
||||
cursor_renderer = meta_cursor_renderer_new (seat_native->backend,
|
||||
device);
|
||||
g_hash_table_insert (seat_native->tablet_cursors,
|
||||
device, cursor_renderer);
|
||||
|
@ -59,7 +59,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaStageNative, meta_stage_native,
|
||||
void
|
||||
meta_stage_native_rebuild_views (MetaStageNative *stage_native)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_native);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||
|
||||
@ -77,7 +78,8 @@ static void
|
||||
meta_stage_native_get_geometry (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *geometry)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
|
||||
@ -103,7 +105,8 @@ meta_stage_native_get_geometry (ClutterStageWindow *stage_window,
|
||||
static GList *
|
||||
meta_stage_native_get_views (ClutterStageWindow *stage_window)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
return meta_renderer_get_views (renderer);
|
||||
@ -114,7 +117,8 @@ meta_stage_native_prepare_frame (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *stage_view,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
@ -152,7 +156,8 @@ meta_stage_native_finish_frame (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *stage_view,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
meta_renderer_native_finish_frame (META_RENDERER_NATIVE (renderer),
|
||||
|
@ -72,7 +72,8 @@ meta_virtual_monitor_native_get_id (MetaVirtualMonitorNative *virtual_monitor_na
|
||||
}
|
||||
|
||||
MetaVirtualMonitorNative *
|
||||
meta_virtual_monitor_native_new (uint64_t id,
|
||||
meta_virtual_monitor_native_new (MetaBackend *backend,
|
||||
uint64_t id,
|
||||
const MetaVirtualMonitorInfo *info)
|
||||
{
|
||||
MetaVirtualMonitorNative *virtual_monitor_native;
|
||||
@ -80,7 +81,7 @@ meta_virtual_monitor_native_new (uint64_t id,
|
||||
MetaCrtcModeVirtual *crtc_mode_virtual;
|
||||
MetaOutputVirtual *output_virtual;
|
||||
|
||||
crtc_virtual = meta_crtc_virtual_new (id);
|
||||
crtc_virtual = meta_crtc_virtual_new (backend, id);
|
||||
crtc_mode_virtual = meta_crtc_mode_virtual_new (mode_id++, &info->mode_info);
|
||||
output_virtual = meta_output_virtual_new (id, info,
|
||||
crtc_virtual,
|
||||
|
@ -39,7 +39,8 @@ MetaCrtc * meta_virtual_monitor_native_get_crtc (MetaVirtualMonitorNative *virtu
|
||||
|
||||
MetaOutput * meta_virtual_monitor_native_get_output (MetaVirtualMonitorNative *virtual_monitor_native);
|
||||
|
||||
MetaVirtualMonitorNative * meta_virtual_monitor_native_new (uint64_t id,
|
||||
MetaVirtualMonitorNative * meta_virtual_monitor_native_new (MetaBackend *backend,
|
||||
uint64_t id,
|
||||
const MetaVirtualMonitorInfo *info);
|
||||
|
||||
#endif /* META_VIRTUAL_MONITOR_NATIVE_H */
|
||||
|
@ -110,7 +110,9 @@ meta_backend_x11_cm_post_init (MetaBackend *backend)
|
||||
g_signal_connect_object (seat, "device-added",
|
||||
G_CALLBACK (on_device_added), backend, 0);
|
||||
|
||||
x11_cm->input_settings = g_object_new (META_TYPE_INPUT_SETTINGS_X11, NULL);
|
||||
x11_cm->input_settings = g_object_new (META_TYPE_INPUT_SETTINGS_X11,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
|
||||
parent_backend_class->post_init (backend);
|
||||
take_touch_grab (backend);
|
||||
|
@ -346,6 +346,7 @@ handle_host_xevent (MetaBackend *backend,
|
||||
{
|
||||
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
||||
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
gboolean bypass_clutter = FALSE;
|
||||
MetaDisplay *display;
|
||||
|
||||
@ -362,7 +363,7 @@ handle_host_xevent (MetaBackend *backend,
|
||||
|
||||
XGetEventData (priv->xdisplay, &event->xcookie);
|
||||
|
||||
display = meta_get_display ();
|
||||
display = meta_context_get_display (context);
|
||||
if (display)
|
||||
{
|
||||
MetaCompositor *compositor = display->compositor;
|
||||
|
@ -245,6 +245,7 @@ meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||
crtc_xrandr = g_object_new (META_TYPE_CRTC_XRANDR,
|
||||
"id", (uint64_t) crtc_id,
|
||||
"backend", backend,
|
||||
"gpu", gpu,
|
||||
"all-transforms", all_transforms,
|
||||
NULL);
|
||||
|
@ -46,10 +46,10 @@ meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer,
|
||||
{
|
||||
MetaCursorRendererX11 *x11 = META_CURSOR_RENDERER_X11 (renderer);
|
||||
MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11);
|
||||
|
||||
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
||||
Window xwindow = meta_backend_x11_get_xwindow (backend);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
|
||||
MetaBackend *backend = meta_cursor_renderer_get_backend (renderer);
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend);
|
||||
Window xwindow = meta_backend_x11_get_xwindow (backend_x11);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
|
||||
|
||||
if (xwindow == None)
|
||||
{
|
||||
|
@ -49,7 +49,11 @@ gboolean
|
||||
meta_cursor_tracker_x11_handle_xevent (MetaCursorTrackerX11 *tracker_x11,
|
||||
XEvent *xevent)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaCursorTracker *tracker = META_CURSOR_TRACKER (tracker_x11);
|
||||
MetaBackend *backend = meta_cursor_tracker_get_backend (tracker);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
||||
XFixesCursorNotifyEvent *notify_event;
|
||||
|
||||
if (xevent->xany.type != x11_display->xfixes_event_base + XFixesCursorNotify)
|
||||
@ -76,7 +80,10 @@ update_position (MetaCursorTrackerX11 *tracker_x11)
|
||||
static gboolean
|
||||
ensure_xfixes_cursor (MetaCursorTrackerX11 *tracker_x11)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaCursorTracker *tracker = META_CURSOR_TRACKER (tracker_x11);
|
||||
MetaBackend *backend = meta_cursor_tracker_get_backend (tracker);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaCursorTracker *cursor_tracker;
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
|
@ -36,6 +36,12 @@
|
||||
#include "core/display-private.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MetaInputSettings *settings;
|
||||
XDevice *xdev;
|
||||
} DeviceHandle;
|
||||
|
||||
G_DEFINE_TYPE (MetaInputSettingsX11, meta_input_settings_x11,
|
||||
META_TYPE_INPUT_SETTINGS)
|
||||
|
||||
@ -47,24 +53,44 @@ typedef enum
|
||||
SCROLL_METHOD_NUM_FIELDS
|
||||
} ScrollMethod;
|
||||
|
||||
static void
|
||||
device_free_xdevice (gpointer user_data)
|
||||
static MetaBackend *
|
||||
get_backend (MetaInputSettings *settings)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
return meta_input_settings_get_backend (settings);
|
||||
}
|
||||
|
||||
static MetaDisplay *
|
||||
get_display (MetaInputSettings *settings)
|
||||
{
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
device_handle_free (gpointer user_data)
|
||||
{
|
||||
DeviceHandle *handle = user_data;
|
||||
MetaInputSettings *settings = handle->settings;
|
||||
MetaDisplay *display = get_display (settings);
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
XDevice *xdev = user_data;
|
||||
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
XCloseDevice (xdisplay, xdev);
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
|
||||
g_free (handle);
|
||||
}
|
||||
|
||||
static XDevice *
|
||||
device_ensure_xdevice (ClutterInputDevice *device)
|
||||
device_ensure_xdevice (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = get_display (settings);
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
int device_id = meta_input_device_x11_get_device_id (device);
|
||||
XDevice *xdev = NULL;
|
||||
@ -79,9 +105,14 @@ device_ensure_xdevice (ClutterInputDevice *device)
|
||||
|
||||
if (xdev)
|
||||
{
|
||||
DeviceHandle *handle;
|
||||
|
||||
handle = g_new0 (DeviceHandle, 1);
|
||||
handle->settings = settings;
|
||||
handle->xdev = xdev;
|
||||
g_object_set_data_full (G_OBJECT (device),
|
||||
"meta-input-settings-xdevice",
|
||||
xdev, device_free_xdevice);
|
||||
handle, device_handle_free);
|
||||
}
|
||||
|
||||
return xdev;
|
||||
@ -94,7 +125,8 @@ get_property (ClutterInputDevice *device,
|
||||
int format,
|
||||
gulong nitems)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaInputDevice *input_device = META_INPUT_DEVICE (device);
|
||||
MetaBackend *backend = meta_input_device_get_backend (input_device);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
gulong nitems_ret, bytes_after_ret;
|
||||
int rc, device_id, format_ret;
|
||||
@ -126,14 +158,15 @@ get_property (ClutterInputDevice *device,
|
||||
}
|
||||
|
||||
static void
|
||||
change_property (ClutterInputDevice *device,
|
||||
change_property (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
const gchar *property,
|
||||
Atom type,
|
||||
int format,
|
||||
void *data,
|
||||
gulong nitems)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
int device_id;
|
||||
Atom property_atom;
|
||||
@ -183,7 +216,7 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
|
||||
g_warning ("Device '%s' does not support sendevents mode %d",
|
||||
clutter_input_device_get_device_name (device), mode);
|
||||
else
|
||||
change_property (device, "libinput Send Events Mode Enabled",
|
||||
change_property (settings, device, "libinput Send Events Mode Enabled",
|
||||
XA_INTEGER, 8, &values, 2);
|
||||
|
||||
meta_XFree (available);
|
||||
@ -194,13 +227,13 @@ meta_input_settings_x11_set_matrix (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
const float matrix[6])
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
gfloat full_matrix[9] = { matrix[0], matrix[1], matrix[2],
|
||||
matrix[3], matrix[4], matrix[5],
|
||||
0, 0, 1 };
|
||||
|
||||
change_property (device, "Coordinate Transformation Matrix",
|
||||
change_property (settings, device, "Coordinate Transformation Matrix",
|
||||
XInternAtom (xdisplay, "FLOAT", False),
|
||||
32, &full_matrix, 9);
|
||||
}
|
||||
@ -210,11 +243,11 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gdouble speed)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
gfloat value = speed;
|
||||
|
||||
change_property (device, "libinput Accel Speed",
|
||||
change_property (settings, device, "libinput Accel Speed",
|
||||
XInternAtom (xdisplay, "FLOAT", False),
|
||||
32, &value, 1);
|
||||
}
|
||||
@ -234,13 +267,13 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
|
||||
device_type == CLUTTER_ERASER_DEVICE)
|
||||
{
|
||||
value = enabled ? 3 : 0;
|
||||
change_property (device, "Wacom Rotation",
|
||||
change_property (settings, device, "Wacom Rotation",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = enabled ? 1 : 0;
|
||||
change_property (device, "libinput Left Handed Enabled",
|
||||
change_property (settings, device, "libinput Left Handed Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
}
|
||||
@ -252,7 +285,7 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
|
||||
{
|
||||
guchar value = (enabled) ? 1 : 0;
|
||||
|
||||
change_property (device, "libinput Disable While Typing Enabled",
|
||||
change_property (settings, device, "libinput Disable While Typing Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -263,7 +296,7 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
|
||||
{
|
||||
guchar value = (enabled) ? 1 : 0;
|
||||
|
||||
change_property (device, "libinput Tapping Enabled",
|
||||
change_property (settings, device, "libinput Tapping Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -274,7 +307,7 @@ meta_input_settings_x11_set_tap_and_drag_enabled (MetaInputSettings *settings,
|
||||
{
|
||||
guchar value = (enabled) ? 1 : 0;
|
||||
|
||||
change_property (device, "libinput Tapping Drag Enabled",
|
||||
change_property (settings, device, "libinput Tapping Drag Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -285,7 +318,7 @@ meta_input_settings_x11_set_tap_and_drag_lock_enabled (MetaInputSettings *setti
|
||||
{
|
||||
guchar value = (enabled) ? 1 : 0;
|
||||
|
||||
change_property (device, "libinput Tapping Drag Lock Enabled",
|
||||
change_property (settings, device, "libinput Tapping Drag Lock Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -296,14 +329,15 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
|
||||
{
|
||||
guchar value = (inverted) ? 1 : 0;
|
||||
|
||||
change_property (device, "libinput Natural Scrolling Enabled",
|
||||
change_property (settings, device, "libinput Natural Scrolling Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
change_scroll_method (ClutterInputDevice *device,
|
||||
ScrollMethod method,
|
||||
gboolean enabled)
|
||||
change_scroll_method (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ScrollMethod method,
|
||||
gboolean enabled)
|
||||
{
|
||||
guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The last value is unused */
|
||||
guchar *current = NULL;
|
||||
@ -322,7 +356,7 @@ change_scroll_method (ClutterInputDevice *device,
|
||||
memcpy (values, current, SCROLL_METHOD_NUM_FIELDS);
|
||||
|
||||
values[method] = !!enabled;
|
||||
change_property (device, "libinput Scroll Method Enabled",
|
||||
change_property (settings, device, "libinput Scroll Method Enabled",
|
||||
XA_INTEGER, 8, &values, SCROLL_METHOD_NUM_FIELDS);
|
||||
out:
|
||||
meta_XFree (current);
|
||||
@ -334,7 +368,8 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean edge_scroll_enabled)
|
||||
{
|
||||
change_scroll_method (device, SCROLL_METHOD_FIELD_EDGE, edge_scroll_enabled);
|
||||
change_scroll_method (settings, device,
|
||||
SCROLL_METHOD_FIELD_EDGE, edge_scroll_enabled);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -342,7 +377,8 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
|
||||
ClutterInputDevice *device,
|
||||
gboolean two_finger_scroll_enabled)
|
||||
{
|
||||
change_scroll_method (device, SCROLL_METHOD_FIELD_2FG, two_finger_scroll_enabled);
|
||||
change_scroll_method (settings, device,
|
||||
SCROLL_METHOD_FIELD_2FG, two_finger_scroll_enabled);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -369,10 +405,11 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
|
||||
{
|
||||
gchar lock = button_lock;
|
||||
|
||||
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
|
||||
change_property (device, "libinput Button Scrolling Button",
|
||||
change_scroll_method (settings, device,
|
||||
SCROLL_METHOD_FIELD_BUTTON, button != 0);
|
||||
change_property (settings, device, "libinput Button Scrolling Button",
|
||||
XA_CARDINAL, 32, &button, 1);
|
||||
change_property (device, "libinput Button Scrolling Button Lock Enabled",
|
||||
change_property (settings, device, "libinput Button Scrolling Button Lock Enabled",
|
||||
XA_INTEGER, 8, &lock, 1);
|
||||
}
|
||||
|
||||
@ -416,7 +453,7 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
|
||||
g_warning ("Device '%s' does not support click method %d",
|
||||
clutter_input_device_get_device_name (device), mode);
|
||||
else
|
||||
change_property (device, "libinput Click Method Enabled",
|
||||
change_property (settings, device, "libinput Click Method Enabled",
|
||||
XA_INTEGER, 8, &values, 2);
|
||||
|
||||
meta_XFree(available);
|
||||
@ -452,7 +489,7 @@ meta_input_settings_x11_set_tap_button_map (MetaInputSettings *settin
|
||||
}
|
||||
|
||||
if (values[0] || values[1])
|
||||
change_property (device, "libinput Tapping Button Mapping Enabled",
|
||||
change_property (settings, device, "libinput Tapping Button Mapping Enabled",
|
||||
XA_INTEGER, 8, &values, 2);
|
||||
}
|
||||
|
||||
@ -462,7 +499,7 @@ meta_input_settings_x11_set_keyboard_repeat (MetaInputSettings *settings,
|
||||
guint delay,
|
||||
guint interval)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
|
||||
if (enabled)
|
||||
@ -477,8 +514,9 @@ meta_input_settings_x11_set_keyboard_repeat (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
set_device_accel_profile (ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
set_device_accel_profile (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
{
|
||||
guchar *defaults, *available;
|
||||
guchar values[2] = { 0 }; /* adaptive, flat */
|
||||
@ -512,7 +550,7 @@ set_device_accel_profile (ClutterInputDevice *device,
|
||||
break;
|
||||
}
|
||||
|
||||
change_property (device, "libinput Accel Profile Enabled",
|
||||
change_property (settings, device, "libinput Accel Profile Enabled",
|
||||
XA_INTEGER, 8, &values, 2);
|
||||
|
||||
meta_XFree (available);
|
||||
@ -535,7 +573,7 @@ meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *set
|
||||
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
|
||||
return;
|
||||
|
||||
set_device_accel_profile (device, profile);
|
||||
set_device_accel_profile (settings, device, profile);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -548,7 +586,7 @@ meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings
|
||||
if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) == 0)
|
||||
return;
|
||||
|
||||
set_device_accel_profile (device, profile);
|
||||
set_device_accel_profile (settings, device, profile);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -556,8 +594,8 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTabletMapping mapping)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = get_display (settings);
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
XDevice *xdev;
|
||||
|
||||
@ -566,7 +604,7 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
|
||||
/* Grab the puke bucket! */
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
xdev = device_ensure_xdevice (device);
|
||||
xdev = device_ensure_xdevice (settings, device);
|
||||
if (xdev)
|
||||
{
|
||||
XSetDeviceMode (xdisplay, xdev,
|
||||
@ -582,13 +620,14 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
device_query_area (ClutterInputDevice *device,
|
||||
device_query_area (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
gint device_id, n_devices, i;
|
||||
XIDeviceInfo *info;
|
||||
@ -630,7 +669,7 @@ update_tablet_area (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gint32 *area)
|
||||
{
|
||||
change_property (device, "Wacom Tablet Area",
|
||||
change_property (settings, device, "Wacom Tablet Area",
|
||||
XA_INTEGER, 32, area, 4);
|
||||
}
|
||||
|
||||
@ -644,7 +683,7 @@ meta_input_settings_x11_set_tablet_area (MetaInputSettings *settings,
|
||||
{
|
||||
gint32 x, y, width, height, area[4] = { 0 };
|
||||
|
||||
if (!device_query_area (device, &x, &y, &width, &height))
|
||||
if (!device_query_area (settings, device, &x, &y, &width, &height))
|
||||
return;
|
||||
|
||||
area[0] = (width * padding_left) + x;
|
||||
@ -661,7 +700,8 @@ meta_input_settings_x11_set_tablet_aspect_ratio (MetaInputSettings *settings,
|
||||
{
|
||||
int32_t dev_x, dev_y, dev_width, dev_height, area[4] = { 0 };
|
||||
|
||||
if (!device_query_area (device, &dev_x, &dev_y, &dev_width, &dev_height))
|
||||
if (!device_query_area (settings, device,
|
||||
&dev_x, &dev_y, &dev_width, &dev_height))
|
||||
return;
|
||||
|
||||
if (aspect_ratio > 0)
|
||||
@ -711,8 +751,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
||||
GDesktopStylusButtonAction secondary,
|
||||
GDesktopStylusButtonAction tertiary)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = get_display (settings);
|
||||
MetaBackend *backend = get_backend (settings);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
XDevice *xdev;
|
||||
|
||||
@ -721,7 +761,7 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
||||
|
||||
/* Grab the puke bucket! */
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
xdev = device_ensure_xdevice (device);
|
||||
xdev = device_ensure_xdevice (settings, device);
|
||||
if (xdev)
|
||||
{
|
||||
guchar map[8] = {
|
||||
@ -761,7 +801,7 @@ meta_input_settings_x11_set_mouse_middle_click_emulation (MetaInputSettings *se
|
||||
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
|
||||
return;
|
||||
|
||||
change_property (device, "libinput Middle Emulation Enabled",
|
||||
change_property (settings, device, "libinput Middle Emulation Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -776,7 +816,7 @@ meta_input_settings_x11_set_touchpad_middle_click_emulation (MetaInputSettings
|
||||
if ((caps & CLUTTER_INPUT_CAPABILITY_TOUCHPAD) == 0)
|
||||
return;
|
||||
|
||||
change_property (device, "libinput Middle Emulation Enabled",
|
||||
change_property (settings, device, "libinput Middle Emulation Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -791,7 +831,7 @@ meta_input_settings_x11_set_trackball_middle_click_emulation (MetaInputSettings
|
||||
if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) == 0)
|
||||
return;
|
||||
|
||||
change_property (device, "libinput Middle Emulation Enabled",
|
||||
change_property (settings, device, "libinput Middle Emulation Enabled",
|
||||
XA_INTEGER, 8, &value, 1);
|
||||
}
|
||||
|
||||
@ -803,7 +843,7 @@ meta_input_settings_x11_set_stylus_pressure (MetaInputSettings *settings,
|
||||
{
|
||||
guint32 values[4] = { pressure[0], pressure[1], pressure[2], pressure[3] };
|
||||
|
||||
change_property (device, "Wacom Pressurecurve", XA_INTEGER, 32,
|
||||
change_property (settings, device, "Wacom Pressurecurve", XA_INTEGER, 32,
|
||||
&values, G_N_ELEMENTS (values));
|
||||
}
|
||||
|
||||
|
@ -645,6 +645,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
get_pad_features (info, &num_rings, &num_strips);
|
||||
|
||||
retval = g_object_new (META_TYPE_INPUT_DEVICE_X11,
|
||||
"backend", seat_x11->backend,
|
||||
"name", info->name,
|
||||
"id", info->deviceid,
|
||||
"has-cursor", (info->use == XIMasterPointer),
|
||||
@ -1604,7 +1605,9 @@ meta_seat_x11_peek_devices (ClutterSeat *seat)
|
||||
static void
|
||||
meta_seat_x11_bell_notify (ClutterSeat *seat)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaContext *context = meta_backend_get_context (seat_x11->backend);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_bell_notify (display, NULL);
|
||||
}
|
||||
@ -1798,7 +1801,7 @@ meta_seat_x11_grab (ClutterSeat *seat,
|
||||
uint32_t time)
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = seat_x11->backend;
|
||||
ClutterGrabState state = CLUTTER_GRAB_STATE_NONE;
|
||||
|
||||
g_return_val_if_fail (seat_x11->grab_state == CLUTTER_GRAB_STATE_NONE,
|
||||
@ -1824,7 +1827,7 @@ meta_seat_x11_ungrab (ClutterSeat *seat,
|
||||
uint32_t time)
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = seat_x11->backend;
|
||||
|
||||
if ((seat_x11->grab_state & CLUTTER_GRAB_STATE_POINTER) != 0)
|
||||
{
|
||||
|
@ -498,8 +498,9 @@ meta_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
static GList *
|
||||
meta_stage_x11_get_views (ClutterStageWindow *stage_window)
|
||||
{
|
||||
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (stage_x11->backend);
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
return meta_renderer_get_views (renderer);
|
||||
}
|
||||
@ -541,9 +542,6 @@ meta_stage_x11_init (MetaStageX11 *stage)
|
||||
stage->wm_state = STAGE_X11_WITHDRAWN;
|
||||
|
||||
stage->title = NULL;
|
||||
|
||||
stage->backend = meta_get_backend ();
|
||||
g_assert (stage->backend);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -52,8 +52,6 @@ struct _MetaStageX11
|
||||
{
|
||||
MetaStageImpl parent_instance;
|
||||
|
||||
MetaBackend *backend;
|
||||
|
||||
CoglOnscreen *onscreen;
|
||||
Window xwin;
|
||||
gint xwin_width;
|
||||
|
@ -89,6 +89,8 @@ set_xkb_desc_rec (Display *xdisplay,
|
||||
static void
|
||||
check_settings_changed (ClutterSeat *seat)
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaBackend *backend = meta_seat_x11_get_backend (META_SEAT_X11 (seat_x11));
|
||||
Display *xdisplay = xdisplay_from_seat (seat);
|
||||
MetaKbdA11ySettings kbd_a11y_settings;
|
||||
MetaKeyboardA11yFlags what_changed = 0;
|
||||
@ -99,7 +101,7 @@ check_settings_changed (ClutterSeat *seat)
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
input_settings = meta_backend_get_input_settings (meta_get_backend ());
|
||||
input_settings = meta_backend_get_input_settings (backend);
|
||||
meta_input_settings_get_kbd_a11y_settings (input_settings,
|
||||
&kbd_a11y_settings);
|
||||
|
||||
@ -335,7 +337,8 @@ meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
gboolean
|
||||
meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaBackend *backend = meta_seat_x11_get_backend (META_SEAT_X11 (seat_x11));
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
MetaClutterBackendX11 *clutter_backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||
|
@ -95,7 +95,9 @@ meta_backend_x11_nested_get_input_settings (MetaBackend *backend)
|
||||
if (!priv->input_settings)
|
||||
{
|
||||
priv->input_settings =
|
||||
g_object_new (META_TYPE_INPUT_SETTINGS_DUMMY, NULL);
|
||||
g_object_new (META_TYPE_INPUT_SETTINGS_DUMMY,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return priv->input_settings;
|
||||
@ -191,8 +193,10 @@ meta_backend_x11_nested_handle_host_xevent (MetaBackendX11 *x11,
|
||||
|
||||
if (event->xfocus.window == xwin)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (x11);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_compositor_get_default ();
|
||||
meta_context_get_wayland_compositor (context);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (x11);
|
||||
|
||||
/*
|
||||
|
@ -71,11 +71,15 @@ create_empty_cursor (Display *xdisplay)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
|
||||
meta_cursor_renderer_x11_nested_constructed (GObject *object)
|
||||
{
|
||||
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
||||
Window xwindow = meta_backend_x11_get_xwindow (backend);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
|
||||
MetaCursorRendererX11Nested *x11_nested =
|
||||
META_CURSOR_RENDERER_X11_NESTED (object);
|
||||
MetaCursorRenderer *cursor_renderer = META_CURSOR_RENDERER (x11_nested);
|
||||
MetaBackend *backend = meta_cursor_renderer_get_backend (cursor_renderer);
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend);
|
||||
Window xwindow = meta_backend_x11_get_xwindow (backend_x11);
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
|
||||
|
||||
Cursor empty_xcursor = create_empty_cursor (xdisplay);
|
||||
XDefineCursor (xdisplay, xwindow, empty_xcursor);
|
||||
@ -85,7 +89,15 @@ meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
|
||||
static void
|
||||
meta_cursor_renderer_x11_nested_class_init (MetaCursorRendererX11NestedClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MetaCursorRendererClass *renderer_class = META_CURSOR_RENDERER_CLASS (klass);
|
||||
|
||||
object_class->constructed = meta_cursor_renderer_x11_nested_constructed;
|
||||
|
||||
renderer_class->update_cursor = meta_cursor_renderer_x11_nested_update_cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
|
||||
{
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11
|
||||
int height)
|
||||
{
|
||||
MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
MetaRendererView *legacy_view;
|
||||
@ -142,7 +142,7 @@ meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11
|
||||
int height)
|
||||
{
|
||||
MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
cairo_rectangle_int_t view_layout;
|
||||
|
@ -75,7 +75,8 @@ meta_stage_x11_nested_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
static GList *
|
||||
meta_stage_x11_nested_get_views (ClutterStageWindow *stage_window)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
return meta_renderer_get_views (renderer);
|
||||
@ -153,7 +154,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window,
|
||||
{
|
||||
MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (stage_window);
|
||||
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window);
|
||||
MetaBackend *backend = meta_stage_impl_get_backend (stage_impl);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
|
||||
|
@ -102,6 +102,7 @@ meta_test_headless_monitor_connect (void)
|
||||
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
|
||||
crtc = g_object_new (META_TYPE_CRTC_TEST,
|
||||
"id", (uint64_t) 1,
|
||||
"backend", backend,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
test_setup->crtcs = g_list_append (NULL, crtc);
|
||||
|
@ -664,6 +664,7 @@ meta_create_monitor_test_setup (MetaBackend *backend,
|
||||
|
||||
crtc = g_object_new (META_TYPE_CRTC_TEST,
|
||||
"id", (uint64_t) i + 1,
|
||||
"backend", backend,
|
||||
"gpu", meta_test_get_gpu (backend),
|
||||
NULL);
|
||||
if (setup->crtcs[i].disable_gamma_lut)
|
||||
|
Loading…
Reference in New Issue
Block a user