backends: add 'monitors-updated-internal' signal to only update internal state
Adding an internal signal and use it to update the internal state before emitting "monitors-changed" which will be repeated by the screen to the world. https://bugzilla.gnome.org/show_bug.cgi?id=788860
This commit is contained in:
parent
fad5657eda
commit
b31e545c9d
@ -196,8 +196,6 @@ meta_backend_monitors_changed (MetaBackend *backend)
|
||||
priv->is_pointer_position_initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
meta_settings_update_ui_scaling_factor (priv->settings);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1617,7 +1617,7 @@ meta_input_settings_init (MetaInputSettings *settings)
|
||||
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) device_mapping_info_free);
|
||||
|
||||
priv->monitor_manager = g_object_ref (meta_monitor_manager_get ());
|
||||
g_signal_connect (priv->monitor_manager, "monitors-changed",
|
||||
g_signal_connect (priv->monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (monitors_changed_cb), settings);
|
||||
|
||||
#ifdef HAVE_LIBWACOM
|
||||
|
@ -59,6 +59,7 @@ enum
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
enum {
|
||||
MONITORS_CHANGED_INTERNAL,
|
||||
CONFIRM_DISPLAY_CHANGE,
|
||||
SIGNALS_LAST
|
||||
};
|
||||
@ -838,6 +839,14 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
|
||||
klass->read_edid = meta_monitor_manager_real_read_edid;
|
||||
klass->is_lid_closed = meta_monitor_manager_real_is_lid_closed;
|
||||
|
||||
signals[MONITORS_CHANGED_INTERNAL] =
|
||||
g_signal_new ("monitors-changed-internal",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
signals[CONFIRM_DISPLAY_CHANGE] =
|
||||
g_signal_new ("confirm-display-change",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
@ -2624,6 +2633,7 @@ meta_monitor_manager_notify_monitors_changed (MetaMonitorManager *manager)
|
||||
|
||||
meta_backend_monitors_changed (manager->backend);
|
||||
|
||||
g_signal_emit (manager, signals[MONITORS_CHANGED_INTERNAL], 0);
|
||||
g_signal_emit_by_name (manager, "monitors-changed");
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
||||
|
||||
monitor_stream->stage = stage;
|
||||
|
||||
g_signal_connect_object (monitor_manager, "monitors-changed",
|
||||
g_signal_connect_object (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed),
|
||||
monitor_stream, 0);
|
||||
|
||||
|
@ -343,11 +343,25 @@ meta_settings_init (MetaSettings *settings)
|
||||
update_experimental_features (settings);
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitors_changed (MetaMonitorManager *monitor_manager,
|
||||
MetaSettings *settings)
|
||||
{
|
||||
meta_settings_update_ui_scaling_factor (settings);
|
||||
}
|
||||
|
||||
void
|
||||
meta_settings_post_init (MetaSettings *settings)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (settings->backend);
|
||||
|
||||
update_ui_scaling_factor (settings);
|
||||
update_font_dpi (settings);
|
||||
|
||||
g_signal_connect_object (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed),
|
||||
settings, G_CONNECT_AFTER);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1071,7 +1071,7 @@ meta_cursor_renderer_native_new (MetaBackend *backend)
|
||||
priv =
|
||||
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
|
||||
|
||||
g_signal_connect_object (monitor_manager, "monitors-changed",
|
||||
g_signal_connect_object (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed),
|
||||
cursor_renderer_native, 0);
|
||||
|
||||
|
@ -454,7 +454,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
|
||||
META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend);
|
||||
|
||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
g_signal_connect (monitor_manager, "monitors-changed",
|
||||
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed), backend);
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,10 @@ static void prefs_changed_callback (MetaPreference pref,
|
||||
static void set_desktop_geometry_hint (MetaScreen *screen);
|
||||
static void set_desktop_viewport_hint (MetaScreen *screen);
|
||||
|
||||
static void on_monitors_changed (MetaMonitorManager *manager,
|
||||
MetaScreen *screen);
|
||||
static void on_monitors_changed_internal (MetaMonitorManager *manager,
|
||||
MetaScreen *screen);
|
||||
static void on_monitors_changed (MetaMonitorManager *manager,
|
||||
MetaScreen *screen);
|
||||
|
||||
enum
|
||||
{
|
||||
@ -710,6 +712,8 @@ meta_screen_new (MetaDisplay *display,
|
||||
screen->rect.x = screen->rect.y = 0;
|
||||
|
||||
manager = meta_monitor_manager_get ();
|
||||
g_signal_connect (manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed_internal), screen);
|
||||
g_signal_connect (manager, "monitors-changed",
|
||||
G_CALLBACK (on_monitors_changed), screen);
|
||||
|
||||
@ -2266,8 +2270,8 @@ meta_screen_resize_func (MetaWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitors_changed (MetaMonitorManager *manager,
|
||||
MetaScreen *screen)
|
||||
on_monitors_changed_internal (MetaMonitorManager *manager,
|
||||
MetaScreen *screen)
|
||||
{
|
||||
MetaBackend *backend;
|
||||
MetaCursorRenderer *cursor_renderer;
|
||||
@ -2306,7 +2310,13 @@ on_monitors_changed (MetaMonitorManager *manager,
|
||||
backend = meta_get_backend ();
|
||||
cursor_renderer = meta_backend_get_cursor_renderer (backend);
|
||||
meta_cursor_renderer_force_update (cursor_renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitors_changed (MetaMonitorManager *manager,
|
||||
MetaScreen *screen)
|
||||
{
|
||||
/* Inform the external world about what has happened */
|
||||
g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0);
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
|
||||
MetaMonitorManager *monitors;
|
||||
|
||||
monitors = meta_monitor_manager_get ();
|
||||
g_signal_connect (monitors, "monitors-changed",
|
||||
g_signal_connect (monitors, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed), compositor);
|
||||
|
||||
compositor->outputs = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);
|
||||
|
Loading…
Reference in New Issue
Block a user