summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-13 22:34:26 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-16 18:13:15 +0900
commita6bf8e7c3621b9b68da89aebe2a2f779b1968a52 (patch)
treed76adfc212957ae06f319dab5ba30eeb46a8412a
parent6488e77d8a47a3d45bb5698211716b7dbfcc7503 (diff)
downloadmpv-a6bf8e7c3621b9b68da89aebe2a2f779b1968a52.tar.bz2
mpv-a6bf8e7c3621b9b68da89aebe2a2f779b1968a52.tar.xz
x11: return a framerate even if no window is mapped
Falls back to the first display in the list returned by xrandr. Not entirely correct, but makes some people happy (see #1575). (cherry picked from commit cd6dfcbef4ef15fd7ccd387e2f3438d7e702c567)
-rw-r--r--video/out/x11_common.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 1f933bfcae..3a1b47540f 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -541,6 +541,8 @@ int vo_x11_init(struct vo *vo)
xrandr_read(x11);
+ vo_x11_update_geometry(vo);
+
return 1;
}
@@ -1539,14 +1541,15 @@ static void vo_x11_update_geometry(struct vo *vo)
int dummy_int;
Window dummy_win;
Window win = x11->parent ? x11->parent : x11->window;
- if (!win)
- return;
- XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int,
- &w, &h, &dummy_int, &dummy_uint);
- if (w > INT_MAX || h > INT_MAX)
- w = h = 0;
- XTranslateCoordinates(x11->display, win, x11->rootwin, 0, 0,
- &x, &y, &dummy_win);
+ x11->winrc = (struct mp_rect){0, 0, 0, 0};
+ if (win) {
+ XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int,
+ &w, &h, &dummy_int, &dummy_uint);
+ if (w > INT_MAX || h > INT_MAX)
+ w = h = 0;
+ XTranslateCoordinates(x11->display, win, x11->rootwin, 0, 0,
+ &x, &y, &dummy_win);
+ }
x11->winrc = (struct mp_rect){x, y, x + w, y + h};
double fps = 1000.0;
for (int n = 0; n < x11->num_displays; n++) {