summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-04-29 13:51:56 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:39:40 +0900
commit4a6fdb7361e2f03f3879268bc9e7328637fc1720 (patch)
treed14a28406998652d055437c74b6629a82d6a9d54 /video
parentf6158c324e38ad2a0d59ec3c521b5486985289fa (diff)
downloadmpv-4a6fdb7361e2f03f3879268bc9e7328637fc1720.tar.bz2
mpv-4a6fdb7361e2f03f3879268bc9e7328637fc1720.tar.xz
x11: query ICC profile based on center of window
Right now, the default behavior is to pick the numerically lowest screen ID that overlaps the window in any way - but this means that mpv will decide to pick an ICC profile in a pretty arbitrary way even if the window only overlaps another screen by a single pixel. The new behavior is to query it based on the center of the window instead. (cherry picked from commit daf4334697145f771c5085fb183e64dc65a967bd)
Diffstat (limited to 'video')
-rw-r--r--video/out/x11_common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 36a497055a..aca492953f 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1752,10 +1752,12 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
case VOCTRL_GET_ICC_PROFILE: {
if (!x11->pseudo_mapped)
return VO_NOTAVAIL;
+ int cx = x11->winrc.x0 + (x11->winrc.x1 - x11->winrc.x0)/2,
+ cy = x11->winrc.y0 + (x11->winrc.y1 - x11->winrc.y0)/2;
int screen = 0; // xinerama screen number
for (int n = 0; n < x11->num_displays; n++) {
struct xrandr_display *disp = &x11->displays[n];
- if (disp->overlaps) {
+ if (mp_rect_contains(&disp->rc, cx, cy)) {
screen = n;
break;
}