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 14 void 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 */ 21 HWND winGetWindowInfo(WindowPtr pWin)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 #ifdef XWIN_MULTIWINDOWEXTWM 67 /* check for multiwindow external wm mode */ 68 if (pScreenInfo->fMWExtWM) { 69 win32RootlessWindowPtr pRLWinPriv 70 = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); 71 72 if (pRLWinPriv == NULL) { 73 ErrorF("winGetWindowInfo: window has no privates\n"); 74 return hwnd; 75 } 76 77 if (pRLWinPriv->hWnd != NULL) { 78 /* copy window handle */ 79 hwnd = pRLWinPriv->hWnd; 80 } 81 return hwnd; 82 } 83 #endif 84 } 85 else { 86 ScreenPtr pScreen = g_ScreenInfo[0].pScreen; 87 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 88 89 if (pWinScreen == NULL) { 90 ErrorF("winGetWindowInfo: screen has no privates\n"); 91 return NULL; 92 } 93 94 ErrorF("winGetWindowInfo: returning root window\n"); 95 96 return pWinScreen->hwndScreen; 97 } 98 99 return NULL; 100 } 101 102 Bool winCheckScreenAiglxIsSupported(ScreenPtr pScreen)103winCheckScreenAiglxIsSupported(ScreenPtr pScreen) 104 { 105 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 106 winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo; 107 108 if (pScreenInfo->fMultiWindow) 109 return TRUE; 110 111 #ifdef XWIN_MULTIWINDOWEXTWM 112 if (pScreenInfo->fMWExtWM) 113 return TRUE; 114 #endif 115 116 return FALSE; 117 } 118 119 void winSetScreenAiglxIsActive(ScreenPtr pScreen)120winSetScreenAiglxIsActive(ScreenPtr pScreen) 121 { 122 winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); 123 pWinScreen->fNativeGlActive = TRUE; 124 } 125