diff options
| author | Hans de Goede <hdegoede@redhat.com> | 2013-01-07 22:06:55 +0100 |
|---|---|---|
| committer | Hans de Goede <hdegoede@redhat.com> | 2013-01-07 22:24:48 +0100 |
| commit | 60aefc544c9c8a85559efcebe915dd648c0a76aa (patch) | |
| tree | ca5de6ff2c01826f78ecfa1f0eaecf8c75092859 /src | |
| parent | 18771a6b2e99c1252d847dc7f0e274fda9db62ab (diff) | |
| download | vd_agent-60aefc544c9c8a85559efcebe915dd648c0a76aa.tar.gz vd_agent-60aefc544c9c8a85559efcebe915dd648c0a76aa.tar.xz vd_agent-60aefc544c9c8a85559efcebe915dd648c0a76aa.zip | |
randr: Limit searching mode by size to the current output
Otherwise we may end up using user-modes added for one output on another one,
messing up mode-deletion.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/vdagent-x11-randr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c index 2ed5922..99a817e 100644 --- a/src/vdagent-x11-randr.c +++ b/src/vdagent-x11-randr.c @@ -193,14 +193,15 @@ find_mode_by_name (struct vdagent_x11 *x11, char *name) } static XRRModeInfo * -find_mode_by_size (struct vdagent_x11 *x11, int width, int height) +find_mode_by_size (struct vdagent_x11 *x11, int output, int width, int height) { int m; XRRModeInfo *ret = NULL; - for (m = 0; m < x11->randr.res->nmode; m++) { - XRRModeInfo *mode = &x11->randr.res->modes[m]; - if (mode->width == width && mode->height == height) { + for (m = 0; m < x11->randr.outputs[output]->nmode; m++) { + XRRModeInfo *mode = mode_from_id(x11, + x11->randr.outputs[output]->modes[m]); + if (mode && mode->width == width && mode->height == height) { ret = mode; break; } @@ -372,7 +373,7 @@ static int xrandr_add_and_set(struct vdagent_x11 *x11, int output, int x, int y, return 0; } xid = x11->randr.res->outputs[output]; - mode = find_mode_by_size(x11, width, height); + mode = find_mode_by_size(x11, output, width, height); if (!mode) { mode = create_new_mode(x11, output, width, height); } |
