| 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 |
| 22 | winGetWindowInfo(WindowPtr pWin) |
| 23 | { |
| 24 | winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, 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 | #ifdef XWIN_MULTIWINDOW |
| 43 | /* check for multiwindow mode */ |
| 44 | if (pScreenInfo->fMultiWindow) { |
| 45 | winWindowPriv(pWin); |
| 46 | |
| 47 | if (pWinPriv == NULL) { |
| 48 | ErrorF("winGetWindowInfo: window has no privates\n"); |
| 49 | return hwnd; |
| 50 | } |
| 51 | |
| 52 | if (pWinPriv->hWnd == NULL) { |
| 53 | winCreateWindowsWindow(pWin); |
| 54 | ErrorF("winGetWindowInfo: forcing window to exist...\n"); |
| 55 | } |
| 56 | |
| 57 | if (pWinPriv->hWnd != NULL) { |
| 58 | /* copy window handle */ |
| 59 | hwnd = pWinPriv->hWnd; |
| 60 | |
| 61 | /* mark GLX active on that hwnd */ |
| 62 | pWinPriv->fWglUsed = TRUE; |
| 63 | } |
| 64 | |
| 65 | return hwnd; |
| 66 | } |
| 67 | #endif |
| 68 | #ifdef XWIN_MULTIWINDOWEXTWM |
| 69 | /* check for multiwindow external wm mode */ |
| 70 | if (pScreenInfo->fMWExtWM) { |
| 71 | win32RootlessWindowPtr pRLWinPriv |
| 72 | = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); |
| 73 | |
| 74 | if (pRLWinPriv == NULL) { |
| 75 | ErrorF("winGetWindowInfo: window has no privates\n"); |
| 76 | return hwnd; |
| 77 | } |
| 78 | |
| 79 | if (pRLWinPriv->hWnd != NULL) { |
| 80 | /* copy window handle */ |
| 81 | hwnd = pRLWinPriv->hWnd; |
| 82 | } |
| 83 | return hwnd; |
| 84 | } |
| 85 | #endif |
| 86 | } |
| 87 | else { |
| 88 | ScreenPtr pScreen = g_ScreenInfo[0].pScreen; |
| 89 | winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); |
| 90 | |
| 91 | if (pWinScreen == NULL) { |
| 92 | ErrorF("winGetWindowInfo: screen has no privates\n"); |
| 93 | return NULL; |
| 94 | } |
| 95 | |
| 96 | ErrorF("winGetWindowInfo: returning root window\n"); |
| 97 | |
| 98 | return pWinScreen->hwndScreen; |
| 99 | } |
| 100 | |
| 101 | return NULL; |
| 102 | } |
| 103 | |
| 104 | Bool |
| 105 | winCheckScreenAiglxIsSupported(ScreenPtr pScreen) |
| 106 | { |
| 107 | winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); |
| 108 | winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo; |
| 109 | |
| 110 | #ifdef XWIN_MULTIWINDOW |
| 111 | if (pScreenInfo->fMultiWindow) |
| 112 | return TRUE; |
| 113 | #endif |
| 114 | |
| 115 | #ifdef XWIN_MULTIWINDOWEXTWM |
| 116 | if (pScreenInfo->fMWExtWM) |
| 117 | return TRUE; |
| 118 | #endif |
| 119 | |
| 120 | return FALSE; |
| 121 | } |