Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************
- * glxdrv_SetPixelFormat
- */
- static BOOL glxdrv_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
- {
- struct glx_physdev *physdev = get_glxdrv_dev( dev );
- WineGLPixelFormat *fmt;
- int value;
- HWND hwnd;
- TRACE("(%p,%d,%p)\n", dev->hdc, iPixelFormat, ppfd);
- if (!has_opengl()) return FALSE;
- if(physdev->pixel_format) /* cannot change it if already set */
- return (physdev->pixel_format == iPixelFormat);
- /* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */
- if(physdev->x11dev->drawable == root_window)
- {
- ERR("Invalid operation on root_window\n");
- return FALSE;
- }
- /* Check if iPixelFormat is in our list of supported formats to see if it is supported. */
- fmt = ConvertPixelFormatWGLtoGLX(gdi_display, iPixelFormat, FALSE /* Offscreen */, &value);
- if(!fmt) {
- ERR("Invalid iPixelFormat: %d\n", iPixelFormat);
- return FALSE;
- }
- wine_tsx11_lock();
- pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
- wine_tsx11_unlock();
- hwnd = WindowFromDC(physdev->dev.hdc);
- if(hwnd) {
- if(!(value&GLX_WINDOW_BIT)) {
- WARN("Pixel format %d is not compatible for window rendering\n", iPixelFormat);
- return FALSE;
- }
- if(!SendMessageW(hwnd, WM_X11DRV_SET_WIN_FORMAT, fmt->fmt_id, 0)) {
- ERR("Couldn't set format of the window, returning failure\n");
- return FALSE;
- }
- /* physDev->current_pf will be set by the DCE update */
- }
- else if (GetObjectType( physdev->dev.hdc ) == OBJ_MEMDC) {
- if(!(value&GLX_PIXMAP_BIT)) {
- WARN("Pixel format %d is not compatible for bitmap rendering\n", iPixelFormat);
- return FALSE;
- }
- physdev->pixel_format = iPixelFormat;
- physdev->type = DC_GL_BITMAP;
- }
- else {
- FIXME("called on a non-window, non-bitmap object?\n");
- }
- if (TRACE_ON(wgl)) {
- int gl_test = 0;
- wine_tsx11_lock();
- gl_test = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_FBCONFIG_ID, &value);
- if (gl_test) {
- ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
- } else {
- TRACE(" FBConfig have :\n");
- TRACE(" - FBCONFIG_ID 0x%x\n", value);
- pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_VISUAL_ID, &value);
- TRACE(" - VISUAL_ID 0x%x\n", value);
- pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
- TRACE(" - DRAWABLE_TYPE 0x%x\n", value);
- }
- wine_tsx11_unlock();
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement