GNOME Bugzilla – Bug 643216
Extraneous emits of GdkScreen::monitors-changed
Last modified: 2011-02-24 18:56:17 UTC
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.
Created attachment 181859 [details] [review] 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.
Review of attachment 181859 [details] [review]: Looks good to me.