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).
This commit is contained in:
wm4
2015-02-13 22:34:26 +01:00
parent db167cd438
commit cd6dfcbef4
+11 -8
View File
@@ -541,6 +541,8 @@ int vo_x11_init(struct vo *vo)
xrandr_read(x11); xrandr_read(x11);
vo_x11_update_geometry(vo);
return 1; return 1;
} }
@@ -1539,14 +1541,15 @@ static void vo_x11_update_geometry(struct vo *vo)
int dummy_int; int dummy_int;
Window dummy_win; Window dummy_win;
Window win = x11->parent ? x11->parent : x11->window; Window win = x11->parent ? x11->parent : x11->window;
if (!win) x11->winrc = (struct mp_rect){0, 0, 0, 0};
return; if (win) {
XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int, XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int,
&w, &h, &dummy_int, &dummy_uint); &w, &h, &dummy_int, &dummy_uint);
if (w > INT_MAX || h > INT_MAX) if (w > INT_MAX || h > INT_MAX)
w = h = 0; w = h = 0;
XTranslateCoordinates(x11->display, win, x11->rootwin, 0, 0, XTranslateCoordinates(x11->display, win, x11->rootwin, 0, 0,
&x, &y, &dummy_win); &x, &y, &dummy_win);
}
x11->winrc = (struct mp_rect){x, y, x + w, y + h}; x11->winrc = (struct mp_rect){x, y, x + w, y + h};
double fps = 1000.0; double fps = 1000.0;
for (int n = 0; n < x11->num_displays; n++) { for (int n = 0; n < x11->num_displays; n++) {