src/video/win32/SDL_win32window.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 17 Jul 2006 06:47:33 +0000
changeset 1913 83420da906a5
parent 1895 c121d94672cb
child 1951 7177581dc9fa
permissions -rw-r--r--
Implemented Windows OpenGL support
Fixed slowdown enumerating display modes, which was hosing OpenGL as well...
Removed SDL_ from the render driver prefixes
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@1895
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@1895
     4
slouken@1895
     5
    This library is free software; you can redistribute it and/or
slouken@1895
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1895
     7
    License as published by the Free Software Foundation; either
slouken@1895
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1895
     9
slouken@1895
    10
    This library is distributed in the hope that it will be useful,
slouken@1895
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1895
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1895
    13
    Lesser General Public License for more details.
slouken@1895
    14
slouken@1895
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1895
    16
    License along with this library; if not, write to the Free Software
slouken@1895
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1895
    18
slouken@1895
    19
    Sam Lantinga
slouken@1895
    20
    slouken@libsdl.org
slouken@1895
    21
*/
slouken@1895
    22
#include "SDL_config.h"
slouken@1895
    23
slouken@1895
    24
#include "../SDL_sysvideo.h"
slouken@1895
    25
#include "../../events/SDL_keyboard_c.h"
slouken@1895
    26
slouken@1895
    27
#include "SDL_win32video.h"
slouken@1895
    28
slouken@1895
    29
/* This is included after SDL_win32video.h, which includes windows.h */
slouken@1895
    30
#include "SDL_syswm.h"
slouken@1895
    31
slouken@1895
    32
slouken@1895
    33
static int
slouken@1895
    34
SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created)
slouken@1895
    35
{
slouken@1895
    36
    SDL_WindowData *data;
slouken@1895
    37
slouken@1895
    38
    /* Allocate the window data */
slouken@1895
    39
    data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
slouken@1895
    40
    if (!data) {
slouken@1895
    41
        SDL_OutOfMemory();
slouken@1895
    42
        return -1;
slouken@1895
    43
    }
slouken@1895
    44
    data->windowID = window->id;
slouken@1895
    45
    data->hwnd = hwnd;
slouken@1913
    46
    data->hdc = GetDC(hwnd);
slouken@1895
    47
    data->created = created;
slouken@1895
    48
    data->mouse_pressed = SDL_FALSE;
slouken@1895
    49
    data->videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
slouken@1895
    50
slouken@1895
    51
    /* Associate the data with the window */
slouken@1895
    52
    if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
slouken@1913
    53
        ReleaseDC(hwnd, data->hdc);
slouken@1895
    54
        SDL_free(data);
slouken@1895
    55
        WIN_SetError("SetProp() failed");
slouken@1895
    56
        return -1;
slouken@1895
    57
    }
slouken@1895
    58
slouken@1895
    59
    /* Set up the window proc function */
slouken@1895
    60
    data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
slouken@1895
    61
    if (data->wndproc == NULL) {
slouken@1895
    62
        data->wndproc = DefWindowProc;
slouken@1895
    63
    } else {
slouken@1895
    64
        SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc);
slouken@1895
    65
    }
slouken@1895
    66
slouken@1895
    67
    /* Fill in the SDL window with the window data */
slouken@1895
    68
    {
slouken@1895
    69
        POINT point;
slouken@1895
    70
        point.x = 0;
slouken@1895
    71
        point.y = 0;
slouken@1895
    72
        if (ClientToScreen(hwnd, &point)) {
slouken@1895
    73
            window->x = point.x;
slouken@1895
    74
            window->y = point.y;
slouken@1895
    75
        }
slouken@1895
    76
    }
slouken@1895
    77
    {
slouken@1895
    78
        RECT rect;
slouken@1895
    79
        if (GetClientRect(hwnd, &rect)) {
slouken@1895
    80
            window->w = rect.right;
slouken@1895
    81
            window->h = rect.bottom;
slouken@1895
    82
        }
slouken@1895
    83
    }
slouken@1895
    84
    {
slouken@1895
    85
        DWORD style = GetWindowLong(hwnd, GWL_STYLE);
slouken@1895
    86
        if (style & WS_VISIBLE) {
slouken@1895
    87
            window->flags |= SDL_WINDOW_SHOWN;
slouken@1895
    88
        } else {
slouken@1895
    89
            window->flags &= ~SDL_WINDOW_SHOWN;
slouken@1895
    90
        }
slouken@1895
    91
        if (style & (WS_BORDER | WS_THICKFRAME)) {
slouken@1895
    92
            window->flags &= ~SDL_WINDOW_BORDERLESS;
slouken@1895
    93
        } else {
slouken@1895
    94
            window->flags |= SDL_WINDOW_BORDERLESS;
slouken@1895
    95
        }
slouken@1895
    96
        if (style & WS_THICKFRAME) {
slouken@1895
    97
            window->flags |= SDL_WINDOW_RESIZABLE;
slouken@1895
    98
        } else {
slouken@1895
    99
            window->flags &= ~SDL_WINDOW_RESIZABLE;
slouken@1895
   100
        }
slouken@1895
   101
        if (style & WS_MAXIMIZE) {
slouken@1895
   102
            window->flags |= SDL_WINDOW_MAXIMIZED;
slouken@1895
   103
        } else {
slouken@1895
   104
            window->flags &= ~SDL_WINDOW_MAXIMIZED;
slouken@1895
   105
        }
slouken@1895
   106
        if (style & WS_MINIMIZE) {
slouken@1895
   107
            window->flags |= SDL_WINDOW_MINIMIZED;
slouken@1895
   108
        } else {
slouken@1895
   109
            window->flags &= ~SDL_WINDOW_MINIMIZED;
slouken@1895
   110
        }
slouken@1895
   111
    }
slouken@1895
   112
    if (GetFocus() == hwnd) {
slouken@1895
   113
        int index = data->videodata->keyboard;
slouken@1895
   114
        window->flags |= SDL_WINDOW_INPUT_FOCUS;
slouken@1895
   115
        SDL_SetKeyboardFocus(index, data->windowID);
slouken@1895
   116
slouken@1895
   117
        if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
slouken@1895
   118
            RECT rect;
slouken@1895
   119
            GetClientRect(hwnd, &rect);
slouken@1895
   120
            ClientToScreen(hwnd, (LPPOINT) & rect);
slouken@1895
   121
            ClientToScreen(hwnd, (LPPOINT) & rect + 1);
slouken@1895
   122
            ClipCursor(&rect);
slouken@1895
   123
        }
slouken@1895
   124
    }
slouken@1895
   125
slouken@1895
   126
    /* All done! */
slouken@1895
   127
    window->driverdata = data;
slouken@1895
   128
    return 0;
slouken@1895
   129
}
slouken@1895
   130
slouken@1895
   131
int
slouken@1895
   132
WIN_CreateWindow(_THIS, SDL_Window * window)
slouken@1895
   133
{
slouken@1895
   134
    HWND hwnd;
slouken@1895
   135
    LPTSTR title = NULL;
slouken@1895
   136
    HWND top;
slouken@1895
   137
    RECT rect;
slouken@1913
   138
    DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
slouken@1895
   139
    int x, y;
slouken@1895
   140
    int w, h;
slouken@1895
   141
slouken@1895
   142
    if (window->title) {
slouken@1895
   143
        title = WIN_UTF8ToString(window->title);
slouken@1895
   144
    } else {
slouken@1895
   145
        title = NULL;
slouken@1895
   146
    }
slouken@1895
   147
slouken@1895
   148
    if (window->flags & SDL_WINDOW_SHOWN) {
slouken@1895
   149
        style |= WS_VISIBLE;
slouken@1895
   150
    }
slouken@1895
   151
    if ((window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS))) {
slouken@1895
   152
        style |= WS_POPUP;
slouken@1895
   153
    } else {
slouken@1895
   154
        style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
slouken@1895
   155
    }
slouken@1895
   156
    if (window->flags & SDL_WINDOW_RESIZABLE) {
slouken@1895
   157
        style |= (WS_THICKFRAME | WS_MAXIMIZEBOX);
slouken@1895
   158
    }
slouken@1895
   159
    if (window->flags & SDL_WINDOW_MAXIMIZED) {
slouken@1895
   160
        style |= WS_MAXIMIZE;
slouken@1895
   161
    }
slouken@1895
   162
    if (window->flags & SDL_WINDOW_MINIMIZED) {
slouken@1895
   163
        style |= WS_MINIMIZE;
slouken@1895
   164
    }
slouken@1895
   165
slouken@1895
   166
    /* Figure out what the window area will be */
slouken@1895
   167
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
slouken@1895
   168
        top = HWND_TOPMOST;
slouken@1895
   169
    } else {
slouken@1895
   170
        top = HWND_NOTOPMOST;
slouken@1895
   171
    }
slouken@1895
   172
    rect.left = 0;
slouken@1895
   173
    rect.top = 0;
slouken@1895
   174
    rect.right = window->w;
slouken@1895
   175
    rect.bottom = window->h;
slouken@1895
   176
    AdjustWindowRectEx(&rect, style, FALSE, 0);
slouken@1895
   177
    w = (rect.right - rect.left);
slouken@1895
   178
    h = (rect.bottom - rect.top);
slouken@1895
   179
slouken@1895
   180
    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
slouken@1895
   181
        window->x == SDL_WINDOWPOS_CENTERED) {
slouken@1895
   182
        x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
slouken@1895
   183
    } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
slouken@1895
   184
        x = CW_USEDEFAULT;
slouken@1895
   185
    } else {
slouken@1895
   186
        x = window->x + rect.left;
slouken@1895
   187
    }
slouken@1895
   188
    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
slouken@1895
   189
        window->y == SDL_WINDOWPOS_CENTERED) {
slouken@1895
   190
        y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
slouken@1895
   191
    } else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
slouken@1895
   192
        y = CW_USEDEFAULT;
slouken@1895
   193
    } else {
slouken@1895
   194
        y = window->y + rect.top;
slouken@1895
   195
    }
slouken@1895
   196
slouken@1895
   197
    hwnd = CreateWindow(SDL_Appname,
slouken@1895
   198
                        title ? title : TEXT(""),
slouken@1895
   199
                        style, x, y, w, h, NULL, NULL, SDL_Instance, NULL);
slouken@1895
   200
    WIN_PumpEvents(_this);
slouken@1895
   201
slouken@1895
   202
    if (title) {
slouken@1895
   203
        SDL_free(title);
slouken@1895
   204
    }
slouken@1895
   205
slouken@1895
   206
    if (!hwnd) {
slouken@1895
   207
        WIN_SetError("Couldn't create window");
slouken@1895
   208
        return -1;
slouken@1895
   209
    }
slouken@1895
   210
slouken@1895
   211
    if (SetupWindowData(window, hwnd, TRUE) < 0) {
slouken@1895
   212
        DestroyWindow(hwnd);
slouken@1895
   213
        return -1;
slouken@1895
   214
    }
slouken@1913
   215
#ifdef SDL_VIDEO_OPENGL
slouken@1913
   216
    if (window->flags & SDL_WINDOW_OPENGL) {
slouken@1913
   217
        if (WIN_GL_SetupWindow(_this, window) < 0) {
slouken@1913
   218
            WIN_DestroyWindow(_this, window);
slouken@1913
   219
            return -1;
slouken@1913
   220
        }
slouken@1913
   221
    }
slouken@1913
   222
#endif
slouken@1895
   223
    return 0;
slouken@1895
   224
}
slouken@1895
   225
slouken@1895
   226
int
slouken@1895
   227
WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
slouken@1895
   228
{
slouken@1895
   229
    HWND hwnd = (HWND) data;
slouken@1895
   230
    LPTSTR title;
slouken@1895
   231
    int titleLen;
slouken@1895
   232
slouken@1895
   233
    /* Query the title from the existing window */
slouken@1895
   234
    titleLen = GetWindowTextLength(hwnd);
slouken@1895
   235
    title = SDL_stack_alloc(TCHAR, titleLen + 1);
slouken@1895
   236
    if (title) {
slouken@1895
   237
        titleLen = GetWindowText(hwnd, title, titleLen);
slouken@1895
   238
    } else {
slouken@1895
   239
        titleLen = 0;
slouken@1895
   240
    }
slouken@1895
   241
    if (titleLen > 0) {
slouken@1895
   242
        window->title = WIN_StringToUTF8(title);
slouken@1895
   243
    }
slouken@1895
   244
    if (title) {
slouken@1895
   245
        SDL_stack_free(title);
slouken@1895
   246
    }
slouken@1895
   247
slouken@1895
   248
    if (SetupWindowData(window, hwnd, FALSE) < 0) {
slouken@1895
   249
        return -1;
slouken@1895
   250
    }
slouken@1895
   251
    return 0;
slouken@1895
   252
}
slouken@1895
   253
slouken@1895
   254
void
slouken@1895
   255
WIN_SetWindowTitle(_THIS, SDL_Window * window)
slouken@1895
   256
{
slouken@1895
   257
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   258
    LPTSTR title;
slouken@1895
   259
slouken@1895
   260
    if (window->title) {
slouken@1895
   261
        title = WIN_UTF8ToString(window->title);
slouken@1895
   262
    } else {
slouken@1895
   263
        title = NULL;
slouken@1895
   264
    }
slouken@1895
   265
    SetWindowText(hwnd, title ? title : TEXT(""));
slouken@1895
   266
    if (title) {
slouken@1895
   267
        SDL_free(title);
slouken@1895
   268
    }
slouken@1895
   269
}
slouken@1895
   270
slouken@1895
   271
void
slouken@1895
   272
WIN_SetWindowPosition(_THIS, SDL_Window * window)
slouken@1895
   273
{
slouken@1895
   274
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   275
    RECT rect;
slouken@1895
   276
    DWORD style;
slouken@1895
   277
    HWND top;
slouken@1895
   278
    int x, y;
slouken@1895
   279
    int w, h;
slouken@1895
   280
slouken@1895
   281
    /* Figure out what the window area will be */
slouken@1895
   282
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
slouken@1895
   283
        top = HWND_TOPMOST;
slouken@1895
   284
    } else {
slouken@1895
   285
        top = HWND_NOTOPMOST;
slouken@1895
   286
    }
slouken@1895
   287
    style = GetWindowLong(hwnd, GWL_STYLE);
slouken@1895
   288
    rect.left = 0;
slouken@1895
   289
    rect.top = 0;
slouken@1895
   290
    rect.right = window->w;
slouken@1895
   291
    rect.bottom = window->h;
slouken@1895
   292
    AdjustWindowRectEx(&rect, style,
slouken@1895
   293
                       (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) !=
slouken@1895
   294
                                                           NULL), 0);
slouken@1895
   295
    w = (rect.right - rect.left);
slouken@1895
   296
    h = (rect.bottom - rect.top);
slouken@1895
   297
slouken@1895
   298
    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
slouken@1895
   299
        window->x == SDL_WINDOWPOS_CENTERED) {
slouken@1895
   300
        x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
slouken@1895
   301
        window->x = x - rect.left;
slouken@1895
   302
    } else {
slouken@1895
   303
        x = window->x + rect.left;
slouken@1895
   304
    }
slouken@1895
   305
    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
slouken@1895
   306
        window->y == SDL_WINDOWPOS_CENTERED) {
slouken@1895
   307
        y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
slouken@1895
   308
        window->y = y - rect.top;
slouken@1895
   309
    } else {
slouken@1895
   310
        y = window->y + rect.top;
slouken@1895
   311
    }
slouken@1895
   312
    SetWindowPos(hwnd, top, x, y, h, w, (SWP_NOCOPYBITS | SWP_NOSIZE));
slouken@1895
   313
}
slouken@1895
   314
slouken@1895
   315
void
slouken@1895
   316
WIN_SetWindowSize(_THIS, SDL_Window * window)
slouken@1895
   317
{
slouken@1895
   318
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   319
    RECT rect;
slouken@1895
   320
    DWORD style;
slouken@1895
   321
    HWND top;
slouken@1895
   322
    int w, h;
slouken@1895
   323
slouken@1895
   324
    /* Figure out what the window area will be */
slouken@1895
   325
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
slouken@1895
   326
        top = HWND_TOPMOST;
slouken@1895
   327
    } else {
slouken@1895
   328
        top = HWND_NOTOPMOST;
slouken@1895
   329
    }
slouken@1895
   330
    style = GetWindowLong(hwnd, GWL_STYLE);
slouken@1895
   331
    rect.left = 0;
slouken@1895
   332
    rect.top = 0;
slouken@1895
   333
    rect.right = window->w;
slouken@1895
   334
    rect.bottom = window->h;
slouken@1895
   335
    AdjustWindowRectEx(&rect, style,
slouken@1895
   336
                       (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) !=
slouken@1895
   337
                                                           NULL), 0);
slouken@1895
   338
    w = (rect.right - rect.left);
slouken@1895
   339
    h = (rect.bottom - rect.top);
slouken@1895
   340
slouken@1895
   341
    SetWindowPos(hwnd, top, 0, 0, h, w, (SWP_NOCOPYBITS | SWP_NOMOVE));
slouken@1895
   342
}
slouken@1895
   343
slouken@1895
   344
void
slouken@1895
   345
WIN_ShowWindow(_THIS, SDL_Window * window)
slouken@1895
   346
{
slouken@1895
   347
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   348
slouken@1895
   349
    ShowWindow(hwnd, SW_SHOW);
slouken@1895
   350
}
slouken@1895
   351
slouken@1895
   352
void
slouken@1895
   353
WIN_HideWindow(_THIS, SDL_Window * window)
slouken@1895
   354
{
slouken@1895
   355
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   356
slouken@1895
   357
    ShowWindow(hwnd, SW_HIDE);
slouken@1895
   358
}
slouken@1895
   359
slouken@1895
   360
void
slouken@1895
   361
WIN_RaiseWindow(_THIS, SDL_Window * window)
slouken@1895
   362
{
slouken@1895
   363
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   364
    HWND top;
slouken@1895
   365
slouken@1895
   366
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
slouken@1895
   367
        top = HWND_TOPMOST;
slouken@1895
   368
    } else {
slouken@1895
   369
        top = HWND_NOTOPMOST;
slouken@1895
   370
    }
slouken@1895
   371
    SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE));
slouken@1895
   372
}
slouken@1895
   373
slouken@1895
   374
void
slouken@1895
   375
WIN_MaximizeWindow(_THIS, SDL_Window * window)
slouken@1895
   376
{
slouken@1895
   377
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   378
slouken@1895
   379
    ShowWindow(hwnd, SW_MAXIMIZE);
slouken@1895
   380
}
slouken@1895
   381
slouken@1895
   382
void
slouken@1895
   383
WIN_MinimizeWindow(_THIS, SDL_Window * window)
slouken@1895
   384
{
slouken@1895
   385
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   386
slouken@1895
   387
    ShowWindow(hwnd, SW_MINIMIZE);
slouken@1895
   388
}
slouken@1895
   389
slouken@1895
   390
void
slouken@1895
   391
WIN_RestoreWindow(_THIS, SDL_Window * window)
slouken@1895
   392
{
slouken@1895
   393
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   394
slouken@1895
   395
    ShowWindow(hwnd, SW_RESTORE);
slouken@1895
   396
}
slouken@1895
   397
slouken@1895
   398
void
slouken@1895
   399
WIN_SetWindowGrab(_THIS, SDL_Window * window)
slouken@1895
   400
{
slouken@1895
   401
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   402
slouken@1895
   403
    if ((window->flags & SDL_WINDOW_INPUT_GRABBED) &&
slouken@1895
   404
        (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
slouken@1895
   405
        RECT rect;
slouken@1895
   406
        GetClientRect(hwnd, &rect);
slouken@1895
   407
        ClientToScreen(hwnd, (LPPOINT) & rect);
slouken@1895
   408
        ClientToScreen(hwnd, (LPPOINT) & rect + 1);
slouken@1895
   409
        ClipCursor(&rect);
slouken@1895
   410
    } else {
slouken@1895
   411
        ClipCursor(NULL);
slouken@1895
   412
    }
slouken@1895
   413
}
slouken@1895
   414
slouken@1895
   415
void
slouken@1895
   416
WIN_DestroyWindow(_THIS, SDL_Window * window)
slouken@1895
   417
{
slouken@1895
   418
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
slouken@1895
   419
slouken@1895
   420
    if (data) {
slouken@1913
   421
#ifdef SDL_VIDEO_OPENGL
slouken@1913
   422
        if (window->flags & SDL_WINDOW_OPENGL) {
slouken@1913
   423
            WIN_GL_CleanupWindow(_this, window);
slouken@1913
   424
        }
slouken@1913
   425
#endif
slouken@1913
   426
        ReleaseDC(data->hwnd, data->hdc);
slouken@1895
   427
        if (data->created) {
slouken@1895
   428
            DestroyWindow(data->hwnd);
slouken@1895
   429
        }
slouken@1895
   430
        SDL_free(data);
slouken@1895
   431
    }
slouken@1895
   432
}
slouken@1895
   433
slouken@1895
   434
SDL_bool
slouken@1895
   435
WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
slouken@1895
   436
{
slouken@1895
   437
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
slouken@1895
   438
    if (info->version.major <= SDL_MAJOR_VERSION) {
slouken@1895
   439
        info->window = hwnd;
slouken@1895
   440
        /* FIXME! */
slouken@1895
   441
        info->hglrc = NULL;
slouken@1895
   442
        return SDL_TRUE;
slouken@1895
   443
    } else {
slouken@1895
   444
        SDL_SetError("Application not compiled with SDL %d.%d\n",
slouken@1895
   445
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
slouken@1895
   446
        return SDL_FALSE;
slouken@1895
   447
    }
slouken@1895
   448
}
slouken@1895
   449
slouken@1895
   450
/* vi: set ts=4 sw=4 expandtab: */