aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-12-01 19:01:42 +0000
committermarha <marha@users.sourceforge.net>2009-12-01 19:01:42 +0000
commitc8a15397749bed81dce209704b75c2f1a413ab7a (patch)
tree76c61396cad0802f1ec15d1d19c84e55ee088281 /xorg-server/hw
parent0b8dc9dc465f6c396d96be1fa4c42121129beb6c (diff)
downloadvcxsrv-c8a15397749bed81dce209704b75c2f1a413ab7a.tar.gz
vcxsrv-c8a15397749bed81dce209704b75c2f1a413ab7a.tar.bz2
vcxsrv-c8a15397749bed81dce209704b75c2f1a413ab7a.zip
Enabled native opengl for xdmcp
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c72
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.c62
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.h2
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwindow.c1
-rw-r--r--xorg-server/hw/xwin/winwindow.h1
5 files changed, 129 insertions, 9 deletions
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index d6a2a2cd4..252e5993e 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -78,7 +78,9 @@
#include <winpriv.h>
#include <wgl_ext_api.h>
+#include "win.h"
+extern Bool g_fXdmcpEnabled;
extern Bool g_fNativeGl;
#define NUM_ELEMENTS(x) (sizeof(x)/ sizeof(x[1]))
@@ -98,6 +100,7 @@ struct __GLXWinContext {
HGLRC ctx; /* Windows GL Context */
__GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
HWND hwnd; /* For detecting when HWND has changed */
+ BOOL GlCtxWnd; /* TRUE when we should destroy the window when the context is destroyed. */
};
struct __GLXWinDrawable
@@ -132,6 +135,7 @@ struct __GLXWinScreen
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
CopyWindowProcPtr CopyWindow;
+ PositionWindowProcPtr PositionWindow;
};
struct __GLXWinConfig
@@ -387,6 +391,7 @@ static __GLXdrawable *glxWinCreateDrawable(__GLXscreen *screen,
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+static Bool glxWinPositionWindow(WindowPtr pWindow, int x, int y);
static HDC glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HDC *hdc, HWND *hwnd);
static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable *draw);
@@ -438,6 +443,16 @@ glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval)
return ret;
}
+static LRESULT CALLBACK GlxWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ if (uMsg== WM_NCHITTEST)
+ {
+ return HTTRANSPARENT;
+ }
+ else
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
+}
+
/* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */
static __GLXscreen *
glxWinScreenProbe(ScreenPtr pScreen)
@@ -474,27 +489,29 @@ glxWinScreenProbe(ScreenPtr pScreen)
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
screen->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = glxWinCopyWindow;
+ screen->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = glxWinPositionWindow;
/* Dump out some useful information about the native renderer */
// create window class
-#define WIN_GL_TEST_WINDOW_CLASS "XWinGLTest"
{
static wATOM glTestWndClass = 0;
if (glTestWndClass == 0)
{
WNDCLASSEX wc;
+ glTestWndClass=1;
wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = DefWindowProc;
+ wc.style = CS_OWNDC ;
+ wc.lpfnWndProc = GlxWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = 0;
wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
+ wc.lpszClassName = WIN_GL_WINDOW_CLASS;
wc.hIconSm = 0;
RegisterClassEx (&wc);
}
@@ -502,7 +519,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
// create an invisible window for a scratch DC
hwnd = CreateWindowExA(0,
- WIN_GL_TEST_WINDOW_CLASS,
+ WIN_GL_WINDOW_CLASS,
"XWin GL Renderer Capabilities Test Window",
0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
if (hwnd == NULL)
@@ -698,6 +715,7 @@ glxWinRealizeWindow(WindowPtr pWin)
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
+ winWindowPriv(pWin);
GLWIN_DEBUG_MSG("glxWinRealizeWindow");
@@ -705,7 +723,12 @@ glxWinRealizeWindow(WindowPtr pWin)
pScreen->RealizeWindow = screenPriv->RealizeWindow;
result = pScreen->RealizeWindow(pWin);
pScreen->RealizeWindow = glxWinRealizeWindow;
-
+
+ // Check if ze need to move the window\n
+ if (g_fXdmcpEnabled && pWinPriv->hWnd)
+ {
+ ShowWindow(pWinPriv->hWnd,SW_SHOW);
+ }
return result;
}
@@ -741,14 +764,42 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
pScreen->CopyWindow = screenPriv->CopyWindow;
pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
pScreen->CopyWindow = glxWinCopyWindow;
+
+}
+
+static Bool
+glxWinPositionWindow(WindowPtr pWin, int x, int y)
+{
+ Bool result;
+ __GLXWinDrawable *pGlxDraw;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
+ winWindowPriv(pWin);
+
+ pScreen->PositionWindow = screenPriv->PositionWindow;
+ result = pScreen->PositionWindow(pWin, x, y);
+ pScreen->PositionWindow = glxWinPositionWindow;
+
+ if (g_fXdmcpEnabled && pWinPriv->hWnd)
+ {
+ MoveWindow(pWinPriv->hWnd,
+ pWin->drawable.x,
+ pWin->drawable.y,
+ pWin->drawable.width,
+ pWin->drawable.height,
+ FALSE);
+ }
+ return result;
}
+
static Bool
glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *)glxGetScreen(pScreen);
+ winWindowPriv(pWin);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
@@ -756,6 +807,9 @@ glxWinUnrealizeWindow(WindowPtr pWin)
result = pScreen->UnrealizeWindow(pWin);
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
+ if (g_fXdmcpEnabled && pWinPriv->hWnd)
+ ShowWindow(pWinPriv->hWnd,SW_HIDE);
+
return result;
}
@@ -1162,6 +1216,7 @@ glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
{
HDC dc;
HWND hwnd;
+ winWindowPriv(((WindowPtr) draw->base.pDraw));
GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: attach context %p to drawable %p", gc, draw);
switch (draw->base.type)
@@ -1297,6 +1352,8 @@ glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
dc = glxWinMakeDC(gc, draw, &dc, &hwnd);
gc->ctx = wglCreateContext(dc);
+ gc->GlCtxWnd = pWinPriv->GlCtxWnd;
+
glxWinReleaseDC(hwnd, dc, draw);
if (gc->ctx == NULL)
@@ -1471,6 +1528,7 @@ glxWinContextDestroy(__GLXcontext *base)
if (!ret)
ErrorF("wglDeleteContext error: %s\n", glxWinErrorMessage());
gc->ctx = NULL;
+ if (gc->GlCtxWnd) DestroyWindow(gc->hwnd);
}
xfree(gc);
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index 65477afb2..671d81a5b 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);
/**
@@ -72,8 +74,8 @@ void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
winCreateWindowsWindow(pWin);
ErrorF("winGetWindowInfo: forcing window to exist...\n");
}
- if (pWinPriv->hWnd != NULL) {
-
+ if (pWinPriv->hWnd != NULL)
+ {
/* copy size and window handle */
pWinInfo->rect = rect_extends;
pWinInfo->hwnd = pWinPriv->hWnd;
@@ -98,6 +100,59 @@ void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
return;
}
+ else if (g_fXdmcpEnabled)
+ {
+ winWindowPriv(pWin);
+
+ if (pWinPriv == NULL)
+ {
+ ErrorF("winGetWindowInfo: window has no privates\n");
+ return;
+ }
+ 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 */
+ pWinInfo->hwnd = pWinPriv->hWnd;
+ }
+ else
+ {
+ pWinInfo->hwnd = pWinScreen->hwndScreen;
+ }
+ pWinInfo->rect = rect_extends;
+ if (pWinInfo->hrgn)
+ {
+ DeleteObject(pWinInfo->hrgn);
+ pWinInfo->hrgn = NULL;
+ }
+ }
+ else
+ {
+ pWinInfo->rect = rect_extends;
+ pWinInfo->hwnd = pWinPriv->hWnd;
+ pWinInfo->hrgn = NULL;
+ }
+ }
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* check for multiwindow external wm mode */
@@ -160,5 +215,8 @@ winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
return TRUE;
#endif
+ if (g_fXdmcpEnabled)
+ return TRUE;
+
return FALSE;
}
diff --git a/xorg-server/hw/xwin/glx/winpriv.h b/xorg-server/hw/xwin/glx/winpriv.h
index d6cdfee74..b3a2c606b 100644
--- a/xorg-server/hw/xwin/glx/winpriv.h
+++ b/xorg-server/hw/xwin/glx/winpriv.h
@@ -7,6 +7,8 @@
#include <X11/Xwindows.h>
#include <windowstr.h>
+#define WIN_GL_WINDOW_CLASS "XWinGLTest"
+
typedef struct
{
HWND hwnd;
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index ac4b2b26a..a3ac6466a 100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -117,6 +117,7 @@ winCreateWindowMultiWindow (WindowPtr pWin)
/* Initialize some privates values */
pWinPriv->hRgn = NULL;
pWinPriv->hWnd = NULL;
+ pWinPriv->GlCtxWnd = FALSE;
pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
pWinPriv->fXKilled = FALSE;
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
index 3bd619ad3..6055d561c 100644
--- a/xorg-server/hw/xwin/winwindow.h
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -70,6 +70,7 @@ typedef struct
DWORD dwDummy;
HRGN hRgn;
HWND hWnd;
+ BOOL GlCtxWnd;
winPrivScreenPtr pScreenPriv;
Bool fXKilled;