mirror of
https://github.com/brl/mutter.git
synced 2025-01-26 03:18:56 +00:00
compositor: Setup and use ownership chains
As with the backend commit, this means all objects can reach the MetaContext by walking up the chain, thus can e.g. get the backend from the context, instead of the global singleton. This also is a squashed commit containing: compositor: Get backend via the context The MetaCompositor instance is owned by MetaDisplay, which is owned by MetaContext. Get the backend via that chain of ownership. dnd: Don't get backend from singleton window-actor: Don't get backend from singleton dnd: Don't get Wayland compositor via singleton background: Don't get the monitor manager from the singleton plugins: Don't get backend from singleton This applies to MetaPlugin, it's manager class, and the default plugin. feedback-actor: Pass a compositor pointer when constructing This allows getting to the display. later: Keep a pointer to the manager object This allows using the non-singleton API in idle callbacks. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
parent
4cc5e6d2bd
commit
5e67e35ec5
@ -67,6 +67,7 @@
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/clutter-seat-private.h"
|
||||
#include "compositor/meta-dnd-private.h"
|
||||
#include "core/meta-context-private.h"
|
||||
#include "meta/main.h"
|
||||
#include "meta/meta-backend.h"
|
||||
@ -1210,7 +1211,7 @@ meta_backend_initable_init (GInitable *initable,
|
||||
priv->cursor_tracker =
|
||||
META_BACKEND_GET_CLASS (backend)->create_cursor_tracker (backend);
|
||||
|
||||
priv->dnd = g_object_new (META_TYPE_DND, NULL);
|
||||
priv->dnd = meta_dnd_new (backend);
|
||||
|
||||
priv->cancellable = g_cancellable_new ();
|
||||
g_bus_get (G_BUS_TYPE_SYSTEM,
|
||||
|
@ -376,10 +376,11 @@ meta_compositor_grab_end (MetaCompositor *compositor)
|
||||
}
|
||||
|
||||
static void
|
||||
redirect_windows (MetaX11Display *x11_display)
|
||||
redirect_windows (MetaCompositor *compositor,
|
||||
MetaX11Display *x11_display)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
Window xroot = meta_x11_display_get_xroot (x11_display);
|
||||
int screen_number = meta_x11_display_get_screen_number (x11_display);
|
||||
@ -427,7 +428,7 @@ meta_compositor_redirect_x11_windows (MetaCompositor *compositor)
|
||||
MetaDisplay *display = priv->display;
|
||||
|
||||
if (display->x11_display)
|
||||
redirect_windows (display->x11_display);
|
||||
redirect_windows (compositor, display->x11_display);
|
||||
}
|
||||
|
||||
static MetaCompositorView *
|
||||
|
@ -316,8 +316,11 @@ meta_background_finalize (GObject *object)
|
||||
static void
|
||||
meta_background_constructed (GObject *object)
|
||||
{
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaContext *context = meta_display_get_context (self->display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
|
||||
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
|
||||
|
||||
|
@ -141,10 +141,11 @@ meta_compositor_x11_manage (MetaCompositor *compositor,
|
||||
{
|
||||
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaX11Display *x11_display = display->x11_display;
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
int composite_version;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
Window xwindow;
|
||||
|
||||
if (!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ||
|
||||
@ -446,7 +447,10 @@ meta_compositor_x11_monotonic_to_high_res_xserver_time (MetaCompositor *composit
|
||||
static void
|
||||
meta_compositor_x11_grab_begin (MetaCompositor *compositor)
|
||||
{
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (meta_get_backend ());
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend);
|
||||
|
||||
meta_backend_x11_sync_pointer (backend_x11);
|
||||
}
|
||||
@ -454,7 +458,10 @@ meta_compositor_x11_grab_begin (MetaCompositor *compositor)
|
||||
static void
|
||||
meta_compositor_x11_grab_end (MetaCompositor *compositor)
|
||||
{
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (meta_get_backend ());
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend);
|
||||
|
||||
meta_backend_x11_sync_pointer (backend_x11);
|
||||
}
|
||||
|
@ -38,9 +38,10 @@ G_DECLARE_FINAL_TYPE (MetaDnDActor,
|
||||
MetaFeedbackActor)
|
||||
|
||||
|
||||
ClutterActor *meta_dnd_actor_new (ClutterActor *drag_origin,
|
||||
int start_x,
|
||||
int start_y);
|
||||
ClutterActor *meta_dnd_actor_new (MetaCompositor *compositor,
|
||||
ClutterActor *drag_origin,
|
||||
int start_x,
|
||||
int start_y);
|
||||
|
||||
void meta_dnd_actor_drag_finish (MetaDnDActor *self,
|
||||
gboolean success);
|
||||
|
@ -155,13 +155,15 @@ meta_dnd_actor_init (MetaDnDActor *self)
|
||||
* Return value: the newly created background actor
|
||||
*/
|
||||
ClutterActor *
|
||||
meta_dnd_actor_new (ClutterActor *drag_origin,
|
||||
int drag_start_x,
|
||||
int drag_start_y)
|
||||
meta_dnd_actor_new (MetaCompositor *compositor,
|
||||
ClutterActor *drag_origin,
|
||||
int drag_start_x,
|
||||
int drag_start_y)
|
||||
{
|
||||
MetaDnDActor *self;
|
||||
|
||||
self = g_object_new (META_TYPE_DND_ACTOR,
|
||||
"compositor", compositor,
|
||||
"drag-origin", drag_origin,
|
||||
"drag-start-x", drag_start_x,
|
||||
"drag-start-y", drag_start_y,
|
||||
|
28
src/compositor/meta-dnd-private.h
Normal file
28
src/compositor/meta-dnd-private.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Red Hat Inc.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_DND_PRIVATE_H
|
||||
#define META_DND_PRIVATE_H
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "meta/meta-dnd.h"
|
||||
|
||||
MetaDnd * meta_dnd_new (MetaBackend *backend);
|
||||
|
||||
MetaBackend * meta_dnd_get_backend (MetaDnd *dnd);
|
||||
|
||||
#endif /* META_DND_PRIVATE_H */
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "compositor/meta-dnd-private.h"
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#include "meta/meta-backend.h"
|
||||
@ -28,7 +30,6 @@
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-stage-x11.h"
|
||||
#include "meta/meta-dnd.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
struct _MetaDndClass
|
||||
@ -45,19 +46,16 @@ typedef struct _MetaDndPrivate MetaDndPrivate;
|
||||
|
||||
struct _MetaDndPrivate
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
gboolean dnd_during_modal;
|
||||
#else
|
||||
/* to avoid warnings (g_type_class_add_private: assertion `private_size > 0' failed) */
|
||||
gchar dummy;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MetaDnd
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaDndPrivate *priv;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaDnd, meta_dnd, G_TYPE_OBJECT);
|
||||
@ -108,10 +106,33 @@ meta_dnd_init (MetaDnd *dnd)
|
||||
{
|
||||
}
|
||||
|
||||
MetaDnd *
|
||||
meta_dnd_new (MetaBackend *backend)
|
||||
{
|
||||
MetaDnd *dnd;
|
||||
MetaDndPrivate *priv;
|
||||
|
||||
dnd = g_object_new (META_TYPE_DND, NULL);
|
||||
priv = meta_dnd_get_instance_private (dnd);
|
||||
priv->backend = backend;
|
||||
|
||||
return dnd;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_dnd_get_backend (MetaDnd *dnd)
|
||||
{
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
||||
void
|
||||
meta_dnd_init_xdnd (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = meta_x11_display_get_display (x11_display);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
Window xwindow, overlay_xwindow;
|
||||
long xdnd_version = 5;
|
||||
@ -226,20 +247,31 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
static MetaWaylandDataDevice *
|
||||
data_device_from_dnd (MetaDnd *dnd)
|
||||
{
|
||||
MetaBackend *backend = meta_dnd_get_backend (dnd);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
return &compositor->seat->data_device;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_dnd_wayland_on_motion_event (MetaDnd *dnd,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandDragGrab *current_grab;
|
||||
gfloat event_x, event_y;
|
||||
MetaWaylandCompositor *wl_compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandDataDevice *data_device = data_device_from_dnd (dnd);
|
||||
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
clutter_event_get_coords (event, &event_x, &event_y);
|
||||
meta_dnd_notify_dnd_position_change (dnd, (int)event_x, (int)event_y);
|
||||
|
||||
current_grab = meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device);
|
||||
current_grab = meta_wayland_data_device_get_current_grab (data_device);
|
||||
if (current_grab)
|
||||
meta_wayland_drag_grab_update_feedback_actor (current_grab, event);
|
||||
}
|
||||
@ -248,9 +280,9 @@ static void
|
||||
meta_dnd_wayland_end_notify (MetaDnd *dnd)
|
||||
{
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
MetaWaylandCompositor *wl_compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandDataDevice *data_device = data_device_from_dnd (dnd);
|
||||
|
||||
meta_wayland_data_device_end_drag (&wl_compositor->seat->data_device);
|
||||
meta_wayland_data_device_end_drag (data_device);
|
||||
|
||||
priv->dnd_during_modal = FALSE;
|
||||
|
||||
@ -280,10 +312,10 @@ void
|
||||
meta_dnd_wayland_maybe_handle_event (MetaDnd *dnd,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *wl_compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandDataDevice *data_device = data_device_from_dnd (dnd);
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
|
||||
if (!meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device))
|
||||
if (!meta_wayland_data_device_get_current_grab (data_device))
|
||||
return;
|
||||
|
||||
g_warn_if_fail (priv->dnd_during_modal);
|
||||
@ -299,12 +331,17 @@ meta_dnd_wayland_maybe_handle_event (MetaDnd *dnd,
|
||||
void
|
||||
meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
|
||||
{
|
||||
MetaWaylandCompositor *wl_compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDnd *dnd = meta_backend_get_dnd (meta_get_backend ());
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *wayland_compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
MetaWaylandDataDevice *data_device = &wayland_compositor->seat->data_device;
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaDnd *dnd = meta_backend_get_dnd (backend);
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
|
||||
if (!priv->dnd_during_modal &&
|
||||
meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device) != NULL)
|
||||
meta_wayland_data_device_get_current_grab (data_device))
|
||||
{
|
||||
priv->dnd_during_modal = TRUE;
|
||||
|
||||
@ -315,7 +352,10 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
|
||||
void
|
||||
meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
|
||||
{
|
||||
MetaDnd *dnd = meta_backend_get_dnd (meta_get_backend ());
|
||||
MetaDisplay *display = meta_compositor_get_display (compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaDnd *dnd = meta_backend_get_dnd (backend);
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
|
||||
if (!priv->dnd_during_modal)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define META_FEEDBACK_ACTOR_PRIVATE_H
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "meta/types.h"
|
||||
|
||||
/**
|
||||
* MetaFeedbackActor:
|
||||
@ -45,8 +46,9 @@ struct _MetaFeedbackActorClass
|
||||
};
|
||||
|
||||
|
||||
ClutterActor *meta_feedback_actor_new (float anchor_x,
|
||||
float anchor_y);
|
||||
ClutterActor * meta_feedback_actor_new (MetaCompositor *compositor,
|
||||
float anchor_x,
|
||||
float anchor_y);
|
||||
|
||||
void meta_feedback_actor_set_anchor (MetaFeedbackActor *actor,
|
||||
float anchor_x,
|
||||
|
@ -32,14 +32,21 @@
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_ANCHOR_X = 1,
|
||||
PROP_ANCHOR_Y
|
||||
PROP_0,
|
||||
|
||||
PROP_COMPOSITOR,
|
||||
PROP_ANCHOR_X,
|
||||
PROP_ANCHOR_Y,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
typedef struct _MetaFeedbackActorPrivate MetaFeedbackActorPrivate;
|
||||
|
||||
struct _MetaFeedbackActorPrivate
|
||||
{
|
||||
MetaCompositor *compositor;
|
||||
|
||||
float anchor_x;
|
||||
float anchor_y;
|
||||
float pos_x;
|
||||
@ -53,11 +60,13 @@ G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor, CLUTTER_TYPE
|
||||
static void
|
||||
meta_feedback_actor_constructed (GObject *object)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
|
||||
MetaFeedbackActorPrivate *priv =
|
||||
meta_feedback_actor_get_instance_private (self);
|
||||
MetaDisplay *display = meta_compositor_get_display (priv->compositor);
|
||||
ClutterActor *feedback_group;
|
||||
|
||||
display = meta_get_display ();
|
||||
feedback_group = meta_get_feedback_group_for_display (display);
|
||||
feedback_group = meta_compositor_get_feedback_group (priv->compositor);
|
||||
clutter_actor_add_child (feedback_group, CLUTTER_ACTOR (object));
|
||||
meta_disable_unredirect_for_display (display);
|
||||
}
|
||||
@ -65,7 +74,12 @@ meta_feedback_actor_constructed (GObject *object)
|
||||
static void
|
||||
meta_feedback_actor_finalize (GObject *object)
|
||||
{
|
||||
meta_enable_unredirect_for_display (meta_get_display ());
|
||||
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
|
||||
MetaFeedbackActorPrivate *priv =
|
||||
meta_feedback_actor_get_instance_private (self);
|
||||
MetaDisplay *display = meta_compositor_get_display (priv->compositor);
|
||||
|
||||
meta_enable_unredirect_for_display (display);
|
||||
|
||||
G_OBJECT_CLASS (meta_feedback_actor_parent_class)->finalize (object);
|
||||
}
|
||||
@ -93,6 +107,9 @@ meta_feedback_actor_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COMPOSITOR:
|
||||
priv->compositor = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_ANCHOR_X:
|
||||
priv->anchor_x = g_value_get_int (value);
|
||||
meta_feedback_actor_update_position (self);
|
||||
@ -118,6 +135,9 @@ meta_feedback_actor_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COMPOSITOR:
|
||||
g_value_set_object (value, priv->compositor);
|
||||
break;
|
||||
case PROP_ANCHOR_X:
|
||||
g_value_set_float (value, priv->anchor_x);
|
||||
break;
|
||||
@ -141,6 +161,18 @@ meta_feedback_actor_class_init (MetaFeedbackActorClass *klass)
|
||||
object_class->set_property = meta_feedback_actor_set_property;
|
||||
object_class->get_property = meta_feedback_actor_get_property;
|
||||
|
||||
pspec = g_param_spec_object ("compositor",
|
||||
"compositor",
|
||||
"The compositor instance",
|
||||
META_TYPE_COMPOSITOR,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COMPOSITOR,
|
||||
pspec);
|
||||
|
||||
pspec = g_param_spec_float ("anchor-x",
|
||||
"Anchor X",
|
||||
"The X axis of the anchor point",
|
||||
@ -178,12 +210,14 @@ meta_feedback_actor_init (MetaFeedbackActor *self)
|
||||
* Return value: the newly created background actor
|
||||
*/
|
||||
ClutterActor *
|
||||
meta_feedback_actor_new (float anchor_x,
|
||||
float anchor_y)
|
||||
meta_feedback_actor_new (MetaCompositor *compositor,
|
||||
float anchor_x,
|
||||
float anchor_y)
|
||||
{
|
||||
MetaFeedbackActor *self;
|
||||
|
||||
self = g_object_new (META_TYPE_FEEDBACK_ACTOR,
|
||||
"compositor", compositor,
|
||||
"anchor-x", anchor_x,
|
||||
"anchor-y", anchor_y,
|
||||
NULL);
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
typedef struct _MetaLater
|
||||
{
|
||||
MetaLaters *laters;
|
||||
|
||||
unsigned int id;
|
||||
unsigned int ref_count;
|
||||
MetaLaterType when;
|
||||
@ -198,7 +200,7 @@ invoke_later_idle (gpointer data)
|
||||
|
||||
if (!later->func (later->user_data))
|
||||
{
|
||||
meta_later_remove (later->id);
|
||||
meta_laters_remove (later->laters, later->id);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
@ -237,6 +239,7 @@ meta_laters_add (MetaLaters *laters,
|
||||
MetaLater *later = g_new0 (MetaLater, 1);
|
||||
|
||||
later->id = ++laters->last_later_id;
|
||||
later->laters = laters;
|
||||
later->ref_count = 1;
|
||||
later->when = when;
|
||||
later->func = func;
|
||||
|
@ -117,9 +117,11 @@ on_prepare_shutdown (MetaContext *context,
|
||||
MetaPluginManager *
|
||||
meta_plugin_manager_new (MetaCompositor *compositor)
|
||||
{
|
||||
MetaBackend *backend = meta_compositor_get_backend (compositor);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaPluginManager *plugin_mgr;
|
||||
MetaPlugin *plugin;
|
||||
MetaMonitorManager *monitors;
|
||||
MetaDisplay *display;
|
||||
MetaContext *context;
|
||||
|
||||
@ -130,8 +132,7 @@ meta_plugin_manager_new (MetaCompositor *compositor)
|
||||
|
||||
_meta_plugin_set_compositor (plugin, compositor);
|
||||
|
||||
monitors = meta_monitor_manager_get ();
|
||||
g_signal_connect (monitors, "confirm-display-change",
|
||||
g_signal_connect (monitor_manager, "confirm-display-change",
|
||||
G_CALLBACK (on_confirm_display_change), plugin_mgr);
|
||||
|
||||
display = meta_compositor_get_display (compositor);
|
||||
|
@ -164,8 +164,10 @@ void
|
||||
meta_plugin_complete_display_change (MetaPlugin *plugin,
|
||||
gboolean ok)
|
||||
{
|
||||
MetaMonitorManager *manager;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
MetaBackend *backend = meta_compositor_get_backend (priv->compositor);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
|
||||
manager = meta_monitor_manager_get ();
|
||||
meta_monitor_manager_confirm_configuration (manager, ok);
|
||||
meta_monitor_manager_confirm_configuration (monitor_manager, ok);
|
||||
}
|
||||
|
@ -1222,13 +1222,16 @@ meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_w
|
||||
meta_cursor_sprite_get_cogl_texture (cursor_sprite) &&
|
||||
out_cursor_scale)
|
||||
{
|
||||
MetaDisplay *display = meta_compositor_get_display (priv->compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
float view_scale;
|
||||
float cursor_texture_scale;
|
||||
|
||||
logical_monitor = meta_window_get_main_logical_monitor (window);
|
||||
|
||||
if (meta_is_stage_views_scaled ())
|
||||
if (meta_backend_is_stage_views_scaled (backend))
|
||||
view_scale = meta_logical_monitor_get_scale (logical_monitor);
|
||||
else
|
||||
view_scale = 1.0;
|
||||
@ -1436,8 +1439,11 @@ create_framebuffer_from_window_actor (MetaWindowActor *self,
|
||||
MetaRectangle *clip,
|
||||
GError **error)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = meta_window_actor_get_instance_private (self);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = meta_compositor_get_display (priv->compositor);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "meta/meta-background-actor.h"
|
||||
#include "meta/meta-background-content.h"
|
||||
#include "meta/meta-background-group.h"
|
||||
#include "meta/meta-context.h"
|
||||
#include "meta/meta-monitor-manager.h"
|
||||
#include "meta/meta-plugin.h"
|
||||
#include "meta/util.h"
|
||||
@ -413,7 +414,8 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
|
||||
}
|
||||
|
||||
static void
|
||||
init_keymap (MetaDefaultPlugin *self)
|
||||
init_keymap (MetaDefaultPlugin *self,
|
||||
MetaBackend *backend)
|
||||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autoptr (GDBusProxy) proxy = NULL;
|
||||
@ -469,8 +471,7 @@ init_keymap (MetaDefaultPlugin *self)
|
||||
if (!g_variant_lookup (props, "X11Variant", "s", &x11_variant))
|
||||
x11_variant = g_strdup ("");
|
||||
|
||||
meta_backend_set_keymap (meta_get_backend (),
|
||||
x11_layout, x11_variant, x11_options);
|
||||
meta_backend_set_keymap (backend, x11_layout, x11_variant, x11_options);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -485,8 +486,10 @@ start (MetaPlugin *plugin)
|
||||
{
|
||||
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
||||
MetaDisplay *display = meta_plugin_get_display (plugin);
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
|
||||
self->priv->background_group = meta_background_group_new ();
|
||||
clutter_actor_insert_child_below (meta_get_window_group_for_display (display),
|
||||
@ -502,7 +505,7 @@ start (MetaPlugin *plugin)
|
||||
self);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
init_keymap (self);
|
||||
init_keymap (self, backend);
|
||||
|
||||
clutter_actor_show (meta_get_stage_for_display (display));
|
||||
}
|
||||
|
@ -655,6 +655,8 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
|
||||
|
||||
if (icon_surface)
|
||||
{
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
MetaCompositor *compositor = meta_display_get_compositor (display);
|
||||
ClutterActor *drag_surface_actor;
|
||||
|
||||
drag_grab->drag_surface = icon_surface;
|
||||
@ -667,7 +669,8 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
|
||||
CLUTTER_ACTOR (meta_wayland_surface_get_actor (drag_grab->drag_surface));
|
||||
|
||||
drag_grab->feedback_actor =
|
||||
meta_dnd_actor_new (CLUTTER_ACTOR (surface_actor),
|
||||
meta_dnd_actor_new (compositor,
|
||||
CLUTTER_ACTOR (surface_actor),
|
||||
drag_grab->drag_start_x,
|
||||
drag_grab->drag_start_y);
|
||||
meta_feedback_actor_set_anchor (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
|
||||
|
Loading…
x
Reference in New Issue
Block a user