Mercurial > mplayer.hg
comparison libvo/gl_common.c @ 29679:465247b46e39
Also check GLX client and server strings for extensions
author | reimar |
---|---|
date | Sun, 27 Sep 2009 14:24:15 +0000 |
parents | 0f1b5b68af32 |
children | ac3e6e27f2c7 |
comparison
equal
deleted
inserted
replaced
29678:b6f4746cedab | 29679:465247b46e39 |
---|---|
1561 XGetWindowAttributes(mDisplay, win, &xw_attr); | 1561 XGetWindowAttributes(mDisplay, win, &xw_attr); |
1562 vinfo_template.visualid = XVisualIDFromVisual(xw_attr.visual); | 1562 vinfo_template.visualid = XVisualIDFromVisual(xw_attr.visual); |
1563 return XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp); | 1563 return XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp); |
1564 } | 1564 } |
1565 | 1565 |
1566 static void appendstr(char **dst, const char *str) | |
1567 { | |
1568 int newsize; | |
1569 char *newstr; | |
1570 if (!str) | |
1571 return; | |
1572 newsize = strlen(*dst) + 1 + strlen(str) + 1; | |
1573 newstr = realloc(*dst, newsize); | |
1574 if (!newstr) | |
1575 return; | |
1576 *dst = newstr; | |
1577 strcat(*dst, " "); | |
1578 strcat(*dst, str); | |
1579 } | |
1580 | |
1566 /** | 1581 /** |
1567 * \brief Changes the window in which video is displayed. | 1582 * \brief Changes the window in which video is displayed. |
1568 * If possible only transfers the context to the new window, otherwise | 1583 * If possible only transfers the context to the new window, otherwise |
1569 * creates a new one, which must be initialized by the caller. | 1584 * creates a new one, which must be initialized by the caller. |
1570 * \param vinfo Currently used visual. | 1585 * \param vinfo Currently used visual. |
1617 vo_window = win; | 1632 vo_window = win; |
1618 vo_x11_update_geometry(); | 1633 vo_x11_update_geometry(); |
1619 if (!keep_context) { | 1634 if (!keep_context) { |
1620 void *(*getProcAddress)(const GLubyte *); | 1635 void *(*getProcAddress)(const GLubyte *); |
1621 const char *(*glXExtStr)(Display *, int); | 1636 const char *(*glXExtStr)(Display *, int); |
1637 char *glxstr = strdup(""); | |
1622 if (*context) | 1638 if (*context) |
1623 glXDestroyContext(mDisplay, *context); | 1639 glXDestroyContext(mDisplay, *context); |
1624 *context = new_context; | 1640 *context = new_context; |
1625 if (*vinfo) | 1641 if (*vinfo) |
1626 XFree(*vinfo); | 1642 XFree(*vinfo); |
1629 if (!getProcAddress) | 1645 if (!getProcAddress) |
1630 getProcAddress = getdladdr("glXGetProcAddressARB"); | 1646 getProcAddress = getdladdr("glXGetProcAddressARB"); |
1631 if (!getProcAddress) | 1647 if (!getProcAddress) |
1632 getProcAddress = (void *)getdladdr; | 1648 getProcAddress = (void *)getdladdr; |
1633 glXExtStr = getdladdr("glXQueryExtensionsString"); | 1649 glXExtStr = getdladdr("glXQueryExtensionsString"); |
1634 getFunctions(getProcAddress, !glXExtStr ? NULL : | 1650 if (glXExtStr) |
1635 glXExtStr(mDisplay, DefaultScreen(mDisplay))); | 1651 appendstr(&glxstr, glXExtStr(mDisplay, DefaultScreen(mDisplay))); |
1652 glXExtStr = getdladdr("glXGetClientString"); | |
1653 if (glXExtStr) | |
1654 appendstr(&glxstr, glXExtStr(mDisplay, GLX_EXTENSIONS)); | |
1655 glXExtStr = getdladdr("glXGetServerString"); | |
1656 if (glXExtStr) | |
1657 appendstr(&glxstr, glXExtStr(mDisplay, GLX_EXTENSIONS)); | |
1658 | |
1659 getFunctions(getProcAddress, glxstr); | |
1660 free(glxstr); | |
1636 | 1661 |
1637 // and inform that reinit is neccessary | 1662 // and inform that reinit is neccessary |
1638 return SET_WINDOW_REINIT; | 1663 return SET_WINDOW_REINIT; |
1639 } | 1664 } |
1640 return SET_WINDOW_OK; | 1665 return SET_WINDOW_OK; |