mirror of
https://github.com/mpv-player/mpv
synced 2025-02-19 22:36:55 +00:00
vo_gl: fix crash with backends lacking control() features
Some functionality provided by the windowing backend (such as x11, win32) is optional. The function pointers in MPGLContext are NULL if the functionality is not implemented. Check them before calling them, instead of crashing. This happened at least on Windows with the "vo_ontop" command.
This commit is contained in:
parent
2123bff6fa
commit
b200583403
@ -1401,6 +1401,8 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_ONTOP:
|
||||
if (!p->glctx->ontop)
|
||||
break;
|
||||
p->glctx->ontop(vo);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_FULLSCREEN:
|
||||
@ -1408,6 +1410,8 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
resize(vo, vo->dwidth, vo->dheight);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_BORDER:
|
||||
if (!p->glctx->border)
|
||||
break;
|
||||
p->glctx->border(vo);
|
||||
resize(vo, vo->dwidth, vo->dheight);
|
||||
return VO_TRUE;
|
||||
@ -1444,6 +1448,8 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
*(struct mp_csp_details *)data = p->colorspace;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_UPDATE_SCREENINFO:
|
||||
if (!p->glctx->update_xinerama_info)
|
||||
break;
|
||||
p->glctx->update_xinerama_info(vo);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_REDRAW_OSD:
|
||||
|
Loading…
Reference in New Issue
Block a user