diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-01-30 16:58:37 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-01-30 17:04:57 +0100 |
commit | dddbaa7db2baed2ec3d509cf97fb9f380e72edb8 (patch) | |
tree | 4bac2523d0c2314b8bc3c5147ea4c76cd25a4ab4 | |
parent | 3205c2c9a5a1a629b716c9188f89cd5dae02bc49 (diff) |
randr: Ignored previously failed client monitor configs
If a client window is maximized or fullscreen, and we fail to set the config,
the client will keep resending the config (as a result of the attempted
changes + rollback), sending us into a loop until the window gets unmaximized.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | src/vdagent-x11-priv.h | 1 | ||||
-rw-r--r-- | src/vdagent-x11-randr.c | 13 | ||||
-rw-r--r-- | src/vdagent-x11.c | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h index 2812c3e..89c1080 100644 --- a/src/vdagent-x11-priv.h +++ b/src/vdagent-x11-priv.h @@ -121,6 +121,7 @@ struct vdagent_x11 { int max_height; int num_monitors; struct monitor_size monitor_sizes[MONITOR_SIZE_COUNT]; + VDAgentMonitorsConfig *failed_conf; } randr; /* NB: we cache this assuming the driver isn't changed under our feet */ diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c index e48e519..88abb56 100644 --- a/src/vdagent-x11-randr.c +++ b/src/vdagent-x11-randr.c @@ -756,6 +756,11 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11, goto exit; } + if (same_monitor_configs(mon_config, x11->randr.failed_conf)) { + syslog(LOG_WARNING, "Ignoring previous failed client monitor config"); + goto exit; + } + for (i = mon_config->num_of_monitors; i < x11->randr.res->noutput; i++) xrandr_disable_output(x11, i); @@ -791,6 +796,14 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11, syslog(LOG_WARNING, "Restoring previous config"); vdagent_x11_set_monitor_config(x11, curr, 1); free(curr); + /* Remember this config failed, if the client is maximized or + fullscreen it will keep sending the failing config. */ + free(x11->randr.failed_conf); + x11->randr.failed_conf = + malloc(config_size(mon_config->num_of_monitors)); + if (x11->randr.failed_conf) + memcpy(x11->randr.failed_conf, mon_config, + config_size(mon_config->num_of_monitors)); return; } } diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c index 1fd36df..401adf5 100644 --- a/src/vdagent-x11.c +++ b/src/vdagent-x11.c @@ -184,6 +184,7 @@ void vdagent_x11_destroy(struct vdagent_x11 *x11, int vdagentd_disconnected) } XCloseDisplay(x11->display); + free(x11->randr.failed_conf); free(x11); } |