xenocara/xserver/hw/xwin/glx/winpriv.c

122 lines
3.1 KiB
C
Raw Normal View History

2006-11-26 11:13:41 -07:00
/*
* Export window information for the Windows-OpenGL GLX implementation.
*
* Authors: Alexander Gottwald
*/
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "win.h"
#include "winpriv.h"
#include "winwindow.h"
void
winCreateWindowsWindow(WindowPtr pWin);
2006-11-26 11:13:41 -07:00
/**
* Return size and handles of a window.
* If pWin is NULL, then the information for the root window is requested.
*/
HWND
winGetWindowInfo(WindowPtr pWin)
2006-11-26 11:13:41 -07:00
{
2011-11-05 07:32:40 -06:00
winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, pWin->drawable.id);
2006-11-26 11:13:41 -07:00
/* a real window was requested */
if (pWin != NULL) {
2006-11-26 11:13:41 -07:00
/* Get the window and screen privates */
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = NULL;
HWND hwnd = NULL;
2006-11-26 11:13:41 -07:00
if (pWinScreen == NULL) {
2006-11-26 11:13:41 -07:00
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
2006-11-26 11:13:41 -07:00
}
hwnd = pWinScreen->hwndScreen;
2006-11-26 11:13:41 -07:00
pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
/* check for multiwindow mode */
if (pScreenInfo->fMultiWindow) {
2006-11-26 11:13:41 -07:00
winWindowPriv(pWin);
if (pWinPriv == NULL) {
2006-11-26 11:13:41 -07:00
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
2006-11-26 11:13:41 -07:00
}
if (pWinPriv->hWnd == NULL) {
winCreateWindowsWindow(pWin);
ErrorF("winGetWindowInfo: forcing window to exist...\n");
2006-11-26 11:13:41 -07:00
}
if (pWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pWinPriv->hWnd;
2011-11-05 07:32:40 -06:00
/* mark GLX active on that hwnd */
pWinPriv->fWglUsed = TRUE;
}
return hwnd;
2006-11-26 11:13:41 -07:00
}
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* check for multiwindow external wm mode */
if (pScreenInfo->fMWExtWM) {
2006-11-26 11:13:41 -07:00
win32RootlessWindowPtr pRLWinPriv
= (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
2006-11-26 11:13:41 -07:00
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
2006-11-26 11:13:41 -07:00
}
if (pRLWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pRLWinPriv->hWnd;
2006-11-26 11:13:41 -07:00
}
return hwnd;
2006-11-26 11:13:41 -07:00
}
#endif
}
else {
2006-11-26 11:13:41 -07:00
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
if (pWinScreen == NULL) {
2006-11-26 11:13:41 -07:00
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
2006-11-26 11:13:41 -07:00
}
ErrorF("winGetWindowInfo: returning root window\n");
return pWinScreen->hwndScreen;
2006-11-26 11:13:41 -07:00
}
return NULL;
}
Bool
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
{
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
if (pScreenInfo->fMultiWindow)
return TRUE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
if (pScreenInfo->fMWExtWM)
return TRUE;
#endif
return FALSE;
2006-11-26 11:13:41 -07:00
}