aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
Diffstat (limited to 'make')
-rw-r--r--make/stub_includes/win32/windows.h1
-rw-r--r--make/stub_includes/win32/wingdi.h34
-rwxr-xr-xmake/wgl-CustomCCode.c77
3 files changed, 41 insertions, 71 deletions
diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/windows.h
index fa4ae1c95..e2d78deef 100644
--- a/make/stub_includes/win32/windows.h
+++ b/make/stub_includes/win32/windows.h
@@ -4,6 +4,7 @@
#define FAR
#define WINBASEAPI
#define WINGDIAPI
+#define WINUSERAPI
#define WINAPI
#define APIENTRY
#define CONST const
diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h
index 2141135e7..35f754178 100644
--- a/make/stub_includes/win32/wingdi.h
+++ b/make/stub_includes/win32/wingdi.h
@@ -144,6 +144,25 @@ typedef struct tagPIXELFORMATDESCRIPTOR
#define ERROR_PROC_NOT_FOUND 127
#define ERROR_INVALID_WINDOW_HANDLE 1400
+/*
+ * ShowWindow() Commands
+ */
+#define SW_HIDE 0
+#define SW_SHOWNORMAL 1
+#define SW_NORMAL 1
+#define SW_SHOWMINIMIZED 2
+#define SW_SHOWMAXIMIZED 3
+#define SW_MAXIMIZE 3
+#define SW_SHOWNOACTIVATE 4
+#define SW_SHOW 5
+#define SW_MINIMIZE 6
+#define SW_SHOWMINNOACTIVE 7
+#define SW_SHOWNA 8
+#define SW_RESTORE 9
+#define SW_SHOWDEFAULT 10
+#define SW_FORCEMINIMIZE 11
+#define SW_MAX 11
+
// Windows routines
WINBASEAPI DWORD WINAPI GetLastError(VOID);
WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName);
@@ -183,10 +202,11 @@ WINGDIAPI BOOL WINAPI DeleteDC(HDC);
WINGDIAPI BOOL WINAPI DeleteObject(HGDIOBJ);
WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC, HGDIOBJ);
-// Routines for creation of a dummy device context and OpenGL context
-// for the purposes of getting wglChoosePixelFormatARB and associated
-// routines
-WINGDIAPI HDC WINAPI GetDC(HDC);
-WINGDIAPI HDC WINAPI CreateDummyWindow(int,int,int,int);
-WINGDIAPI VOID WINAPI DestroyDummyWindow(HWND,HDC);
-WINGDIAPI VOID WINAPI NativeEventLoop();
+// Routines for creation of a dummy window, device context and OpenGL
+// context for the purposes of getting wglChoosePixelFormatARB and
+// associated routines
+HDC CreateDummyWindow(int,int,int,int);
+WINUSERAPI BOOL WINAPI ShowWindow(HWND hWnd, int nCmdShow);
+WINUSERAPI HDC WINAPI GetDC(HWND);
+WINUSERAPI int WINAPI ReleaseDC(HWND hWnd, HDC hDC);
+WINUSERAPI BOOL WINAPI DestroyWindow(HWND hWnd);
diff --git a/make/wgl-CustomCCode.c b/make/wgl-CustomCCode.c
index be233fd9a..0fe9ee628 100755
--- a/make/wgl-CustomCCode.c
+++ b/make/wgl-CustomCCode.c
@@ -1,37 +1,25 @@
#include <stdio.h>
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+#define JOGL_DUMMY_WINDOW_NAME "__jogl_dummy_window"
+
+LRESULT CALLBACK DummyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ return DefWindowProc(hWnd,uMsg,wParam,lParam);
+}
+
ATOM oglClass = 0;
HWND CreateDummyWindow( int x, int y, int width, int height ) {
- RECT rect;
HINSTANCE hInstance;
DWORD dwExStyle;
DWORD dwStyle;
HWND hWnd;
- ZeroMemory( &rect, sizeof( rect ) );
- // I don't know if we need this but it can't hurt
- if( width < 0 ) {
- rect.left = x + width;
- rect.right = x;
- } else {
- rect.left = x;
- rect.right = x + width;
- }
- if( height < 0 ) {
- rect.top = y + height;
- rect.bottom = y;
- } else {
- rect.top = y;
- rect.bottom = y + height;
- }
+
hInstance = GetModuleHandle(NULL);
-
if( !oglClass ) {
WNDCLASS wc;
ZeroMemory( &wc, sizeof( wc ) );
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
- wc.lpfnWndProc = (WNDPROC) WndProc;
+ wc.lpfnWndProc = (WNDPROC) DummyWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
@@ -39,7 +27,7 @@ HWND CreateDummyWindow( int x, int y, int width, int height ) {
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
- wc.lpszClassName = "OpenGL";
+ wc.lpszClassName = JOGL_DUMMY_WINDOW_NAME;
if( !(oglClass = RegisterClass( &wc )) ) {
printf( "RegisterClass Failed: %d\n", GetLastError() );
return( 0 );
@@ -48,52 +36,13 @@ HWND CreateDummyWindow( int x, int y, int width, int height ) {
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW;
- if( !(hWnd=CreateWindowEx( dwExStyle, "OpenGL", "OpenGL",
+ if( !(hWnd=CreateWindowEx( dwExStyle,
+ JOGL_DUMMY_WINDOW_NAME,
+ JOGL_DUMMY_WINDOW_NAME,
dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
+ x, y, width, height,
NULL, NULL, hInstance, NULL ) ) ) {
return( 0 );
}
return( hWnd );
}
-
-void NativeEventLoop() {
- MSG msg;
- BOOL ret;
- // Grab windows system messages from queue
- while( ( ret = GetMessage( &msg, NULL, 0, 0 ) ) != 0 ) {
- if( ret == -1 ) {
- printf( "Error GetMessage: %d", GetLastError() );
- } else {
- DispatchMessage( &msg );
- }
- }
-}
-
-void DestroyDummyWindow(HWND handle, HDC hdc) {
- // Post a close window message from shutdown hook thread to
- // window message pump thread
- if( !PostMessage( handle, WM_CLOSE, 0, (LPARAM) hdc ) ) {
- printf( "PostMessage Failed: %d\n", GetLastError() );
- }
-}
-
-LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- switch( uMsg ) {
- case WM_CLOSE:
- // Destroy HDC
- if( ReleaseDC( hWnd, (HDC) lParam ) != 1 ) {
- printf( "Error Releasing DC: %d\n", GetLastError() );
- }
- // Destroy HWND
- if( DestroyWindow( hWnd ) == 0 ) {
- printf( "Error Destroying Window: %d\n", GetLastError() );
- }
- break;
- case WM_DESTROY:
- // Terminate Dummy Window
- PostQuitMessage(0);
- return(0);
- }
- return DefWindowProc(hWnd,uMsg,wParam,lParam);
-}