[gtk+] inspector: Use the new monitor change signals
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Use the new monitor change signals
- Date: Mon, 30 Oct 2017 01:40:12 +0000 (UTC)
commit 481189867a852da6d9fe1652a2982fdfe1aad8c9
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 30 01:53:09 2017 +0100
inspector: Use the new monitor change signals
And on't use the GdkScreen anymore now that the GdkDisplay provides all
the information we care about.
gtk/inspector/general.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index 45a386e..1c8e18d 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -506,12 +506,11 @@ translate_subpixel_layout (GdkSubpixelLayout subpixel)
}
static void
-populate_display (GdkScreen *screen, GtkInspectorGeneral *gen)
+populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
{
gint i;
GList *children, *l;
GtkWidget *child;
- GdkDisplay *display;
int n_monitors;
GtkListBox *list;
@@ -530,8 +529,6 @@ populate_display (GdkScreen *screen, GtkInspectorGeneral *gen)
}
g_list_free (children);
- display = gdk_screen_get_display (screen);
-
gtk_label_set_label (GTK_LABEL (gen->priv->display_name), gdk_display_get_name (display));
gtk_widget_set_visible (gen->priv->display_rgba,
@@ -600,22 +597,29 @@ populate_display_notify_cb (GdkDisplay *display,
GParamSpec *pspec,
GtkInspectorGeneral *gen)
{
- populate_display (gdk_display_get_default_screen (display), gen);
+ populate_display (display, gen);
+}
+
+static void
+populate_display_monitor_cb (GdkDisplay *display,
+ GdkMonitor *monitor,
+ GtkInspectorGeneral *gen)
+{
+ populate_display (display, gen);
}
static void
init_display (GtkInspectorGeneral *gen)
{
- GdkScreen *screen;
GdkDisplay *display;
display = gdk_display_get_default ();
- screen = gdk_screen_get_default ();
g_signal_connect (display, "notify", G_CALLBACK (populate_display_notify_cb), gen);
- g_signal_connect (screen, "monitors-changed", G_CALLBACK (populate_display), gen);
+ g_signal_connect (display, "monitor-added", G_CALLBACK (populate_display_monitor_cb), gen);
+ g_signal_connect (display, "monitor-removed", G_CALLBACK (populate_display_monitor_cb), gen);
- populate_display (screen, gen);
+ populate_display (display, gen);
}
static void populate_seats (GtkInspectorGeneral *gen);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]