randr: remove monitors.xml on auto-configuration

GNOME will restore monitors.xml configuration whenever the timestamp
"config > change". The "change" timestamp is the last user applied
configuration, whereas the "config" timestamp is updated when
the screen is updated or ouput/crtc modes are added/removed.

These condition are triggered by vdagent during monitor config. Since we
can't control the timestamps (playing with delay will be inherently
event more racy), the only sane way I can think of is to disable gsd
behaviour. This can be achieved by deleting the ~/.config/monitors.xml,
which is the intended configuration to restore, so vdagent will override
whatever configuration was saved previously.

Somehow, if vdagent would be better integrated with gnome2, it would use
the gnome-rr and/or org.gnome.SettingsDaemon.XRANDR dbus
API. Thanksfully, in gnome3, the monitor auto-configuration has been
merged in.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
This commit is contained in:
Marc-Andre Lureau authored and Fabiano Fidêncio committed 2015-04-10 15:57:46 +02:00
1 parent 21f4927531
commit 28618682ae
1 file changed
+5
+5
View File
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include <string.h>
#include <syslog.h>
#include <stdlib.h>
@@ -747,6 +748,10 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11,
goto exit;
}
gchar *config = g_build_filename (g_get_user_config_dir (), "monitors.xml", NULL);
g_unlink(config);
g_free(config);
for (i = mon_config->num_of_monitors; i < x11->randr.res->noutput; i++)
xrandr_disable_output(x11, i);