aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/glx/winpriv.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/glx/winpriv.c')
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.c123
1 files changed, 107 insertions, 16 deletions
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index a35392b26..c689bae08 100644
--- a/xorg-server/hw/xwin/glx/winpriv.c
+++ b/xorg-server/hw/xwin/glx/winpriv.c
@@ -11,6 +11,8 @@
#include "winpriv.h"
#include "winwindow.h"
+extern Bool g_fXdmcpEnabled;
+
void
winCreateWindowsWindow (WindowPtr pWin);
/**
@@ -19,7 +21,8 @@ winCreateWindowsWindow (WindowPtr pWin);
*/
HWND winGetWindowInfo(WindowPtr pWin)
{
- winDebug("%s: pWin=%p\n", __FUNCTION__, pWin);
+ HWND hwnd = NULL;
+ winDebug("%s:%d pWin=%p\n", __FUNCTION__, __LINE__, pWin);
/* a real window was requested */
if (pWin != NULL)
@@ -28,12 +31,11 @@ HWND winGetWindowInfo(WindowPtr pWin)
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = NULL;
- HWND hwnd = NULL;
if (pWinScreen == NULL)
{
ErrorF("winGetWindowInfo: screen has no privates\n");
- return NULL;
+ return hwnd;
}
hwnd = pWinScreen->hwndScreen;
@@ -53,17 +55,104 @@ HWND winGetWindowInfo(WindowPtr pWin)
if (pWinPriv->hWnd == NULL)
{
- winCreateWindowsWindow(pWin);
- ErrorF("winGetWindowInfo: forcing window to exist...\n");
+ if (pWin->parent && pWin->parent->parent)
+ {
+ int offsetx;
+ int offsety;
+ int ExtraClass=(pWin->realized)?WS_VISIBLE:0;
+ HWND hWndParent;
+ WindowPtr pParent=pWin->parent;
+ while (pParent)
+ {
+ winWindowPriv(pParent);
+ hWndParent=pWinPriv->hWnd;
+ if (hWndParent)
+ break;
+ pParent=pParent->parent;
+ }
+ if (!hWndParent)
+ hWndParent=hwnd;
+ if (pParent)
+ {
+ offsetx=pParent->drawable.x;
+ offsety=pParent->drawable.y;
+ }
+ else
+ {
+ offsetx=0;
+ offsety=0;
+ }
+ pWinPriv->hWnd=CreateWindowExA(WS_EX_TRANSPARENT,
+ WIN_GL_WINDOW_CLASS,
+ "",
+ WS_CHILD |WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ExtraClass,
+ pWin->drawable.x-offsetx,
+ pWin->drawable.y-offsety,
+ pWin->drawable.width,
+ pWin->drawable.height,
+ hWndParent,
+ NULL,
+ GetModuleHandle(NULL),
+ NULL);
+ winDebug("Window created %x %x %d %d %d %d\n",pWinPriv->hWnd,hWndParent,pWin->drawable.x-offsetx,pWin->drawable.y-offsety,pWin->drawable.width, pWin->drawable.height);
+ pWinPriv->GlCtxWnd=TRUE;
+ }
+ else
+ {
+ winCreateWindowsWindow(pWin);
+ winDebug("winGetWindowInfo: forcing window to exist...\n");
+ }
}
-
if (pWinPriv->hWnd != NULL)
- {
+ {
/* copy window handle */
hwnd = pWinPriv->hWnd;
- }
+ }
+ }
+ else if (g_fXdmcpEnabled)
+ {
+ winWindowPriv(pWin);
- return hwnd;
+ if (pWinPriv == NULL)
+ {
+ ErrorF("winGetWindowInfo: window has no privates\n");
+ return hwnd;
+ }
+ if (pWinPriv->hWnd == NULL)
+ {
+ if (!((pWin->drawable.x==0) &&
+ (pWin->drawable.y==0) &&
+ (pWin->drawable.width==pScreen->width) &&
+ (pWin->drawable.height==pScreen->height)
+ )
+ )
+ {
+ int ExtraClass=(pWin->realized)?WS_VISIBLE:0;
+ pWinPriv->hWnd=CreateWindowExA(WS_EX_TRANSPARENT,
+ WIN_GL_WINDOW_CLASS,
+ "",
+ WS_CHILD |WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ExtraClass,
+ pWin->drawable.x,
+ pWin->drawable.y,
+ pWin->drawable.width,
+ pWin->drawable.height,
+ pWinScreen->hwndScreen,
+ NULL,
+ GetModuleHandle(NULL),
+ NULL);
+ pWinPriv->GlCtxWnd=TRUE;
+ /* copy size and window handle */
+ hwnd = pWinPriv->hWnd;
+ }
+ else
+ {
+ hwnd = pWinScreen->hwndScreen;
+ }
+ }
+ else
+ {
+ hwnd = pWinPriv->hWnd;
+ }
}
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
@@ -75,7 +164,6 @@ HWND winGetWindowInfo(WindowPtr pWin)
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
- return hwnd;
}
if (pRLWinPriv->hWnd != NULL)
@@ -83,7 +171,6 @@ HWND winGetWindowInfo(WindowPtr pWin)
/* copy window handle */
hwnd = pRLWinPriv->hWnd;
}
- return hwnd;
}
#endif
}
@@ -95,15 +182,16 @@ HWND winGetWindowInfo(WindowPtr pWin)
if (pWinScreen == NULL)
{
ErrorF("winGetWindowInfo: screen has no privates\n");
- return NULL;
}
+ else
+ {
+ winDebug("winGetWindowInfo: returning root window\n");
- ErrorF("winGetWindowInfo: returning root window\n");
-
- return pWinScreen->hwndScreen;
+ hwnd=pWinScreen->hwndScreen;
+ }
}
- return NULL;
+ return hwnd;
}
Bool
@@ -122,5 +210,8 @@ winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
return TRUE;
#endif
+ if (g_fXdmcpEnabled)
+ return TRUE;
+
return FALSE;
}