From 4f367b077b7d5a4f3e7762dfd9e0c89062abea4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 28 Apr 2011 20:31:55 +0100 Subject: [PATCH] Allow to resize the window to be larger than the desktop. --- glws_wgl.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/glws_wgl.cpp b/glws_wgl.cpp index 3ac2a6d..bc4dd27 100644 --- a/glws_wgl.cpp +++ b/glws_wgl.cpp @@ -30,6 +30,27 @@ namespace glws { +static LRESULT CALLBACK +WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + MINMAXINFO *pMMI; + switch (uMsg) { + case WM_GETMINMAXINFO: + // Allow to create a window bigger than the desktop + pMMI = (MINMAXINFO *)lParam; + pMMI->ptMaxSize.x = 60000; + pMMI->ptMaxSize.y = 60000; + pMMI->ptMaxTrackSize.x = 60000; + pMMI->ptMaxTrackSize.y = 60000; + break; + default: + break; + } + + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} + + class WglDrawable : public Drawable { public: @@ -52,7 +73,7 @@ public: wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.lpfnWndProc = DefWindowProc; + wc.lpfnWndProc = WndProc; wc.lpszClassName = "glretrace"; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClass(&wc); @@ -75,8 +96,8 @@ public: "glretrace", /* wc.lpszClassName */ NULL, dwStyle, - CW_USEDEFAULT, /* x */ - CW_USEDEFAULT, /* y */ + 0, /* x */ + 0, /* y */ rect.right - rect.left, /* width */ rect.bottom - rect.top, /* height */ NULL, @@ -120,7 +141,7 @@ public: GetWindowRect(hWnd, &rWindow); w += (rWindow.right - rWindow.left) - rClient.right; h += (rWindow.bottom - rWindow.top) - rClient.bottom; - MoveWindow(hWnd, rWindow.left, rWindow.top, w, h, TRUE); + SetWindowPos(hWnd, NULL, rWindow.left, rWindow.top, w, h, SWP_NOMOVE); } void swapBuffers(void) { -- 2.45.2