mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
context: Move 'replace-current-wm' tracking to the context
This move yet another scattered global static variable into the context's control. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
parent
50ed027b6f
commit
ff0afb186a
@ -27,6 +27,7 @@
|
||||
#include "backends/meta-idle-monitor-private.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "meta/main.h"
|
||||
#include "meta/meta-context.h"
|
||||
#include "meta/meta-idle-monitor.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
@ -338,6 +339,7 @@ create_device_monitors (MetaIdleManager *idle_manager,
|
||||
MetaIdleManager *
|
||||
meta_idle_manager_new (MetaBackend *backend)
|
||||
{
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
ClutterSeat *seat = meta_backend_get_default_seat (backend);
|
||||
MetaIdleManager *idle_manager;
|
||||
|
||||
@ -348,8 +350,9 @@ meta_idle_manager_new (MetaBackend *backend)
|
||||
g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
"org.gnome.Mutter.IdleMonitor",
|
||||
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
|
||||
(meta_get_replace_current_wm () ?
|
||||
G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
|
||||
(meta_context_is_replacing (context) ?
|
||||
G_BUS_NAME_OWNER_FLAGS_REPLACE :
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE),
|
||||
on_bus_acquired,
|
||||
on_name_acquired,
|
||||
on_name_lost,
|
||||
|
@ -2623,11 +2623,15 @@ on_name_lost (GDBusConnection *connection,
|
||||
static void
|
||||
initialize_dbus_interface (MetaMonitorManager *manager)
|
||||
{
|
||||
manager->dbus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
MetaContext *context = meta_backend_get_context (manager->backend);
|
||||
|
||||
manager->dbus_name_id =
|
||||
g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
"org.gnome.Mutter.DisplayConfig",
|
||||
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
|
||||
(meta_get_replace_current_wm () ?
|
||||
G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
|
||||
(meta_context_is_replacing (context) ?
|
||||
G_BUS_NAME_OWNER_FLAGS_REPLACE :
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE),
|
||||
on_bus_acquired,
|
||||
on_name_acquired,
|
||||
on_name_lost,
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "meta/meta-backend.h"
|
||||
#include "meta/meta-background-actor.h"
|
||||
#include "meta/meta-background-group.h"
|
||||
#include "meta/meta-context.h"
|
||||
#include "meta/meta-shadow-factory.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
#include "meta/prefs.h"
|
||||
@ -477,13 +478,15 @@ meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
static void
|
||||
redirect_windows (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
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);
|
||||
guint n_retries;
|
||||
guint max_retries;
|
||||
|
||||
if (meta_get_replace_current_wm ())
|
||||
if (meta_context_is_replacing (context))
|
||||
max_retries = 5;
|
||||
else
|
||||
max_retries = 1;
|
||||
|
@ -329,6 +329,14 @@ meta_context_main_get_x11_display_policy (MetaContext *context)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_context_main_is_replacing (MetaContext *context)
|
||||
{
|
||||
MetaContextMain *context_main = META_CONTEXT_MAIN (context);
|
||||
|
||||
return context_main->options.x11.replace;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
static gboolean
|
||||
add_persistent_virtual_monitors (MetaContextMain *context_main,
|
||||
@ -382,7 +390,6 @@ meta_context_main_setup (MetaContext *context,
|
||||
return FALSE;
|
||||
|
||||
meta_set_syncing (context_main->options.x11.sync || g_getenv ("MUTTER_SYNC"));
|
||||
meta_set_replace_current_wm (context_main->options.x11.replace);
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
if (!add_persistent_virtual_monitors (context_main, error))
|
||||
@ -682,6 +689,7 @@ meta_context_main_class_init (MetaContextMainClass *klass)
|
||||
context_class->get_compositor_type = meta_context_main_get_compositor_type;
|
||||
context_class->get_x11_display_policy =
|
||||
meta_context_main_get_x11_display_policy;
|
||||
context_class->is_replacing = meta_context_main_is_replacing;
|
||||
context_class->setup = meta_context_main_setup;
|
||||
context_class->create_backend = meta_context_main_create_backend;
|
||||
context_class->notify_ready = meta_context_main_notify_ready;
|
||||
|
@ -39,6 +39,8 @@ struct _MetaContextClass
|
||||
|
||||
MetaX11DisplayPolicy (* get_x11_display_policy) (MetaContext *context);
|
||||
|
||||
gboolean (* is_replacing) (MetaContext *context);
|
||||
|
||||
gboolean (* setup) (MetaContext *context,
|
||||
GError **error);
|
||||
|
||||
|
@ -212,6 +212,12 @@ meta_context_get_compositor_type (MetaContext *context)
|
||||
return META_CONTEXT_GET_CLASS (context)->get_compositor_type (context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_context_is_replacing (MetaContext *context)
|
||||
{
|
||||
return META_CONTEXT_GET_CLASS (context)->is_replacing (context);
|
||||
}
|
||||
|
||||
MetaX11DisplayPolicy
|
||||
meta_context_get_x11_display_policy (MetaContext *context)
|
||||
{
|
||||
|
@ -80,7 +80,6 @@ meta_topic_real_valist (MetaDebugTopic topic,
|
||||
#endif
|
||||
|
||||
static gint verbose_topics = 0;
|
||||
static gboolean replace_current = FALSE;
|
||||
static int no_prefix = 0;
|
||||
static gboolean is_wayland_compositor = FALSE;
|
||||
static int debug_paint_flags = 0;
|
||||
@ -218,18 +217,6 @@ meta_init_debug_utils (void)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_get_replace_current_wm (void)
|
||||
{
|
||||
return replace_current;
|
||||
}
|
||||
|
||||
void
|
||||
meta_set_replace_current_wm (gboolean setting)
|
||||
{
|
||||
replace_current = setting;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_is_wayland_compositor (void)
|
||||
{
|
||||
|
@ -26,9 +26,6 @@
|
||||
|
||||
#include <meta/common.h>
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_get_replace_current_wm (void); /* Actually defined in util.c */
|
||||
|
||||
META_EXPORT
|
||||
void meta_restart (const char *message);
|
||||
|
||||
|
@ -89,6 +89,9 @@ void meta_context_terminate_with_error (MetaContext *context,
|
||||
META_EXPORT
|
||||
MetaCompositorType meta_context_get_compositor_type (MetaContext *context);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_context_is_replacing (MetaContext *context);
|
||||
|
||||
META_EXPORT
|
||||
MetaBackend * meta_context_get_backend (MetaContext *context);
|
||||
|
||||
|
@ -102,6 +102,12 @@ meta_context_test_get_x11_display_policy (MetaContext *context)
|
||||
return META_X11_DISPLAY_POLICY_ON_DEMAND;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_context_test_is_replacing (MetaContext *context)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_context_test_setup (MetaContext *context,
|
||||
GError **error)
|
||||
@ -263,6 +269,7 @@ meta_context_test_class_init (MetaContextTestClass *klass)
|
||||
context_class->get_compositor_type = meta_context_test_get_compositor_type;
|
||||
context_class->get_x11_display_policy =
|
||||
meta_context_test_get_x11_display_policy;
|
||||
context_class->is_replacing = meta_context_test_is_replacing;
|
||||
context_class->setup = meta_context_test_setup;
|
||||
context_class->create_backend = meta_context_test_create_backend;
|
||||
context_class->notify_ready = meta_context_test_notify_ready;
|
||||
|
@ -1157,7 +1157,8 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
||||
if (meta_is_syncing ())
|
||||
XSynchronize (xdisplay, True);
|
||||
|
||||
replace_current_wm = meta_get_replace_current_wm ();
|
||||
replace_current_wm =
|
||||
meta_context_is_replacing (meta_backend_get_context (backend));
|
||||
|
||||
/* According to _gdk_x11_display_open (), this will be returned
|
||||
* by gdk_display_get_default_screen ()
|
||||
|
Loading…
Reference in New Issue
Block a user