Skip to content
  • Alexander Larsson's avatar
    Avoid spurious emissions of monitors-changed · 0b0f1101
    Alexander Larsson authored
    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
    0b0f1101