[gtk+/gtk-2-24] Avoid spurious emissions of monitors-changed
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Avoid spurious emissions of monitors-changed
- Date: Thu, 24 Feb 2011 19:06:21 +0000 (UTC)
commit b0d0bf7f7db06126427eeab64f1df01320b2e1ad
Author: Alexander Larsson <alexl redhat com>
Date: Thu Feb 24 19:59:00 2011 +0100
Avoid spurious emissions of monitors-changed
The monitor change detection code in _gdk_x11_screen_size_changed() and
process_monitors_change() goes to some length to make sure its only emitted
when there is an actual change to the data visible via the GdkScreen monitors
api.
However, commit 662e69ad added some code that always emits "monitors-changed"
in _gdk_x11_screen_size_changed when we have randr13 and get a ConfigureNotify
on the root window (even though we may already have emitted it in the
RRScreenChangesNotify event!).
As far as I can tell this is due to a comment in the bug referenced by the
commit (https://bugzilla.gnome.org/show_bug.cgi?id=601712#c4) where it says:
This version of the patch changes GdkDisplay to emit "monitors-changed" when
the primary monitor changes (see the change in _gdk_x11_screen_size_changed).
And, if you remove this part of the change the signal is not emitted when just
the primary is changed. However, this is not really the right approach. We
should just also check for if the primary changes in process_monitors_change()
to avoid spurious signal emissions.
https://bugzilla.gnome.org/show_bug.cgi?id=643216
(cherry picked from commit 0b0f110152df40795f473c805afd8548facf7377)
Conflicts:
gdk/x11/gdkscreen-x11.c
gdk/x11/gdkscreen-x11.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index f627603..66a0d96 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -1139,9 +1139,11 @@ process_monitors_change (GdkScreen *screen)
{
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
gint n_monitors;
+ gint primary_monitor;
GdkX11Monitor *monitors;
gboolean changed;
+ primary_monitor = screen_x11->primary_monitor;
n_monitors = screen_x11->n_monitors;
monitors = screen_x11->monitors;
@@ -1150,8 +1152,10 @@ process_monitors_change (GdkScreen *screen)
init_multihead (screen);
- changed = !compare_monitors (monitors, n_monitors,
- screen_x11->monitors, screen_x11->n_monitors);
+ changed =
+ !compare_monitors (monitors, n_monitors,
+ screen_x11->monitors, screen_x11->n_monitors) ||
+ screen_x11->primary_monitor != primary_monitor;
free_monitors (monitors, n_monitors);
@@ -1175,10 +1179,7 @@ _gdk_x11_screen_size_changed (GdkScreen *screen,
display_x11 = GDK_DISPLAY_X11 (gdk_screen_get_display (screen));
if (display_x11->have_randr13 && event->type == ConfigureNotify)
- {
- g_signal_emit_by_name (screen, "monitors-changed");
- return;
- }
+ return;
XRRUpdateConfiguration (event);
#else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]