sugarlabs / sugar

Sugar GTK shell
GNU General Public License v3.0
255 stars 241 forks source link

Fix screen resize race #732

Closed quozl closed 7 years ago

quozl commented 7 years ago

When an external monitor is connected or disconnected, about 25% of the time the Sugar shell does not resize correctly; a size-changed signal occurs but the workarea geometry has not changed.

Underlying problem is an update race in get_monitor_workarea, so the fix is to call get_monitor_geometry for obtaining the width and height, but continue to use the workarea offset for the later call to self.move().

Can be reproduced easily without an external monitor by switching display panel resolution repeatedly;

    xrandr --output eDP1 --mode 1024x768
    xrandr --output eDP1 --mode 1366x768

Part of a fix for https://bugs.sugarlabs.org/ticket/4968


Rename size changed callback. Callbacks are to be named according to the signal, or the purpose to which we put the signal. This callback was nearly named according to the signal. A similar callback is in sugar-toolkit-gtk3 and is correctly named.


Related pull request https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/343 can be merged in any order with this pull request; the patches are independent but solve the same problem in two different contexts.

quozl commented 7 years ago

Rebased to master.