graw/gdi: Fix window dimensions.
authorMichal Krol <michal@vmware.com>
Thu, 4 Nov 2010 14:12:47 +0000 (15:12 +0100)
committerMichal Krol <michal@vmware.com>
Thu, 4 Nov 2010 14:12:47 +0000 (15:12 +0100)
The requested window size is of the client area,
so account for surrounding borders and bars when
creating the window.

src/gallium/targets/graw-gdi/graw_gdi.c

index 018b15398431531afef0ef8e5efa4f5fe7b7ee1a..52a4e3cb231071630b9fdf12b2043c42ce4d20a4 100644 (file)
@@ -68,6 +68,8 @@ graw_create_window_and_screen(int x,
    struct sw_winsys *winsys = NULL;
    struct pipe_screen *screen = NULL;
    WNDCLASSEX wc = {sizeof(wc)};
+   UINT style = WS_VISIBLE | WS_TILEDWINDOW;
+   RECT rect;
    HWND hWnd = NULL;
    HDC hDC = NULL;
 
@@ -91,14 +93,17 @@ graw_create_window_and_screen(int x,
    wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    RegisterClassEx(&wc);
 
+   SetRect(&rect, 0, 0, width, height);
+   AdjustWindowRectEx(&rect, style, FALSE, 0);
+
    hWnd = CreateWindowEx(0,
                          wc.lpszClassName,
                          wc.lpszClassName,
-                         WS_VISIBLE | WS_TILEDWINDOW,
+                         style,
                          x,
                          y,
-                         width,
-                         height,
+                         rect.right - rect.left,
+                         rect.bottom - rect.top,
                          NULL,
                          NULL,
                          wc.hInstance,