mirror of
https://github.com/brl/mutter.git
synced 2025-01-08 10:42:33 +00:00
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
65d3e47987
commit
0a3549da06
@ -196,8 +196,6 @@ meta_backend_monitors_changed (MetaBackend *backend)
|
|||||||
priv->is_pointer_position_initialized = TRUE;
|
priv->is_pointer_position_initialized = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_settings_update_ui_scaling_factor (priv->settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1617,7 +1617,7 @@ meta_input_settings_init (MetaInputSettings *settings)
|
|||||||
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) device_mapping_info_free);
|
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) device_mapping_info_free);
|
||||||
|
|
||||||
priv->monitor_manager = g_object_ref (meta_monitor_manager_get ());
|
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);
|
G_CALLBACK (monitors_changed_cb), settings);
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#define DEFAULT_DISPLAY_CONFIGURATION_TIMEOUT 20
|
#define DEFAULT_DISPLAY_CONFIGURATION_TIMEOUT 20
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
MONITORS_CHANGED_INTERNAL,
|
||||||
CONFIRM_DISPLAY_CHANGE,
|
CONFIRM_DISPLAY_CHANGE,
|
||||||
SIGNALS_LAST
|
SIGNALS_LAST
|
||||||
};
|
};
|
||||||
@ -851,6 +852,14 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
|
|||||||
klass->read_edid = meta_monitor_manager_real_read_edid;
|
klass->read_edid = meta_monitor_manager_real_read_edid;
|
||||||
klass->is_lid_closed = meta_monitor_manager_real_is_lid_closed;
|
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] =
|
signals[CONFIRM_DISPLAY_CHANGE] =
|
||||||
g_signal_new ("confirm-display-change",
|
g_signal_new ("confirm-display-change",
|
||||||
G_TYPE_FROM_CLASS (object_class),
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
@ -2574,6 +2583,8 @@ meta_monitor_manager_notify_monitors_changed (MetaMonitorManager *manager)
|
|||||||
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
|
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
|
||||||
|
|
||||||
meta_backend_monitors_changed (backend);
|
meta_backend_monitors_changed (backend);
|
||||||
|
|
||||||
|
g_signal_emit (manager, signals[MONITORS_CHANGED_INTERNAL], 0);
|
||||||
g_signal_emit_by_name (manager, "monitors-changed");
|
g_signal_emit_by_name (manager, "monitors-changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
|||||||
|
|
||||||
monitor_stream->stage = stage;
|
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),
|
G_CALLBACK (on_monitors_changed),
|
||||||
monitor_stream, 0);
|
monitor_stream, 0);
|
||||||
|
|
||||||
|
@ -343,11 +343,25 @@ meta_settings_init (MetaSettings *settings)
|
|||||||
update_experimental_features (settings);
|
update_experimental_features (settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_monitors_changed (MetaMonitorManager *monitor_manager,
|
||||||
|
MetaSettings *settings)
|
||||||
|
{
|
||||||
|
meta_settings_update_ui_scaling_factor (settings);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_settings_post_init (MetaSettings *settings)
|
meta_settings_post_init (MetaSettings *settings)
|
||||||
{
|
{
|
||||||
|
MetaMonitorManager *monitor_manager =
|
||||||
|
meta_backend_get_monitor_manager (settings->backend);
|
||||||
|
|
||||||
update_ui_scaling_factor (settings);
|
update_ui_scaling_factor (settings);
|
||||||
update_font_dpi (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
|
static void
|
||||||
|
@ -850,7 +850,7 @@ meta_cursor_renderer_native_init (MetaCursorRendererNative *native)
|
|||||||
MetaMonitorManager *monitors;
|
MetaMonitorManager *monitors;
|
||||||
|
|
||||||
monitors = meta_monitor_manager_get ();
|
monitors = meta_monitor_manager_get ();
|
||||||
g_signal_connect_object (monitors, "monitors-changed",
|
g_signal_connect_object (monitors, "monitors-changed-internal",
|
||||||
G_CALLBACK (on_monitors_changed), native, 0);
|
G_CALLBACK (on_monitors_changed), native, 0);
|
||||||
|
|
||||||
priv->hw_state_invalidated = TRUE;
|
priv->hw_state_invalidated = TRUE;
|
||||||
|
@ -454,7 +454,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
|
|||||||
META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend);
|
META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend);
|
||||||
|
|
||||||
monitor_manager = meta_backend_get_monitor_manager (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);
|
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_geometry_hint (MetaScreen *screen);
|
||||||
static void set_desktop_viewport_hint (MetaScreen *screen);
|
static void set_desktop_viewport_hint (MetaScreen *screen);
|
||||||
|
|
||||||
static void on_monitors_changed (MetaMonitorManager *manager,
|
static void on_monitors_changed_internal (MetaMonitorManager *manager,
|
||||||
MetaScreen *screen);
|
MetaScreen *screen);
|
||||||
|
static void on_monitors_changed (MetaMonitorManager *manager,
|
||||||
|
MetaScreen *screen);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -710,6 +712,8 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
screen->rect.x = screen->rect.y = 0;
|
screen->rect.x = screen->rect.y = 0;
|
||||||
|
|
||||||
manager = meta_monitor_manager_get ();
|
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_signal_connect (manager, "monitors-changed",
|
||||||
G_CALLBACK (on_monitors_changed), screen);
|
G_CALLBACK (on_monitors_changed), screen);
|
||||||
|
|
||||||
@ -2266,8 +2270,8 @@ meta_screen_resize_func (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_monitors_changed (MetaMonitorManager *manager,
|
on_monitors_changed_internal (MetaMonitorManager *manager,
|
||||||
MetaScreen *screen)
|
MetaScreen *screen)
|
||||||
{
|
{
|
||||||
MetaBackend *backend;
|
MetaBackend *backend;
|
||||||
MetaCursorRenderer *cursor_renderer;
|
MetaCursorRenderer *cursor_renderer;
|
||||||
@ -2306,7 +2310,13 @@ on_monitors_changed (MetaMonitorManager *manager,
|
|||||||
backend = meta_get_backend ();
|
backend = meta_get_backend ();
|
||||||
cursor_renderer = meta_backend_get_cursor_renderer (backend);
|
cursor_renderer = meta_backend_get_cursor_renderer (backend);
|
||||||
meta_cursor_renderer_force_update (cursor_renderer);
|
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);
|
g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
|
|||||||
MetaMonitorManager *monitors;
|
MetaMonitorManager *monitors;
|
||||||
|
|
||||||
monitors = meta_monitor_manager_get ();
|
monitors = meta_monitor_manager_get ();
|
||||||
g_signal_connect (monitors, "monitors-changed",
|
g_signal_connect (monitors, "monitors-changed-internal",
|
||||||
G_CALLBACK (on_monitors_changed), compositor);
|
G_CALLBACK (on_monitors_changed), compositor);
|
||||||
|
|
||||||
compositor->outputs = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);
|
compositor->outputs = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);
|
||||||
|
Loading…
Reference in New Issue
Block a user