Comment 28 for bug 742544

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, my suggested fix won't work...

The root cause of this bug is the function gdk_screen_get_primary_monitor. Unfortunately it is designed in a way such that it returns the same value 0 if the primary monitor is the first monitor, or if there is no primary monitor set at all. So calling that function (which unity does several times) you can't possibly know if a primary monitor has been set or not. It seems the only reasonable fix is to fix GTK itself so that if no primary monitor is set, it should return the ID of the top-left monitor.

Docs: http://developer.gnome.org/gdk/stable/GdkScreen.html#gdk-screen-get-primary-monitor
NOTE: These docs are slightly wrong because they suggest monitor-related functions take a monitor number between 0 and n_monitors inclusive. However in actual fact valid monitor numbers are < n_monitors, confirmed by reviewing the GTK source code.