1/* 2 * Export window information for the Windows-OpenGL GLX implementation. 3 * 4 * Authors: Alexander Gottwald 5 */ 6 7#ifdef HAVE_XWIN_CONFIG_H 8#include <xwin-config.h> 9#endif 10#include "win.h" 11#include "winpriv.h" 12#include "winwindow.h" 13 14void 15 winCreateWindowsWindow(WindowPtr pWin); 16 17/** 18 * Return size and handles of a window. 19 * If pWin is NULL, then the information for the root window is requested. 20 */ 21HWND 22winGetWindowInfo(WindowPtr pWin) 23{ 24 winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, (unsigned int)pWin->drawable.id); 25 26 /* a real window was requested */ 27 if (pWin != NULL) { 28 /* Get the window and screen privates */ 29 ScreenPtr pScreen = pWin->drawable.pScreen; 30 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 31 winScreenInfoPtr pScreenInfo = NULL; 32 HWND hwnd = NULL; 33 34 if (pWinScreen == NULL) { 35 ErrorF("winGetWindowInfo: screen has no privates\n"); 36 return NULL; 37 } 38 39 hwnd = pWinScreen->hwndScreen; 40 41 pScreenInfo = pWinScreen->pScreenInfo; 42 /* check for multiwindow mode */ 43 if (pScreenInfo->fMultiWindow) { 44 winWindowPriv(pWin); 45 46 if (pWinPriv == NULL) { 47 ErrorF("winGetWindowInfo: window has no privates\n"); 48 return hwnd; 49 } 50 51 if (pWinPriv->hWnd == NULL) { 52 winCreateWindowsWindow(pWin); 53 winDebug("winGetWindowInfo: forcing window to exist\n"); 54 } 55 56 if (pWinPriv->hWnd != NULL) { 57 /* copy window handle */ 58 hwnd = pWinPriv->hWnd; 59 60 /* mark GLX active on that hwnd */ 61 pWinPriv->fWglUsed = TRUE; 62 } 63 64 return hwnd; 65 } 66 } 67 else { 68 ScreenPtr pScreen = g_ScreenInfo[0].pScreen; 69 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 70 71 if (pWinScreen == NULL) { 72 ErrorF("winGetWindowInfo: screen has no privates\n"); 73 return NULL; 74 } 75 76 ErrorF("winGetWindowInfo: returning root window\n"); 77 78 return pWinScreen->hwndScreen; 79 } 80 81 return NULL; 82} 83 84Bool 85winCheckScreenAiglxIsSupported(ScreenPtr pScreen) 86{ 87 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 88 winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo; 89 90 if (pScreenInfo->fMultiWindow) 91 return TRUE; 92 93 return FALSE; 94} 95 96void 97winSetScreenAiglxIsActive(ScreenPtr pScreen) 98{ 99 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 100 pWinScreen->fNativeGlActive = TRUE; 101} 102