src/video/win32/SDL_win32video.h
author Daniel Wyatt <Daniel.Wyatt@gmail.com>
Sun, 19 Sep 2010 14:41:18 -0400
changeset 4892 9e1f6d3fb870
parent 4868 d6adaafcfb10
child 4893 b2e434e0553b
permissions -rw-r--r--
Added imm.h include, will be needed on MinGW.
Changed comment to c-style and removed some end-of-line whitespace.
dewyatt@4759
     1
/*
dewyatt@4759
     2
    SDL - Simple DirectMedia Layer
dewyatt@4759
     3
    Copyright (C) 1997-2010 Sam Lantinga
dewyatt@4759
     4
dewyatt@4759
     5
    This library is free software; you can redistribute it and/or
dewyatt@4759
     6
    modify it under the terms of the GNU Lesser General Public
dewyatt@4759
     7
    License as published by the Free Software Foundation; either
dewyatt@4759
     8
    version 2.1 of the License, or (at your option) any later version.
dewyatt@4759
     9
dewyatt@4759
    10
    This library is distributed in the hope that it will be useful,
dewyatt@4759
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
dewyatt@4759
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dewyatt@4759
    13
    Lesser General Public License for more details.
dewyatt@4759
    14
dewyatt@4759
    15
    You should have received a copy of the GNU Lesser General Public
dewyatt@4759
    16
    License along with this library; if not, write to the Free Software
dewyatt@4759
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
dewyatt@4759
    18
dewyatt@4759
    19
    Sam Lantinga
dewyatt@4759
    20
    slouken@libsdl.org
dewyatt@4759
    21
*/
dewyatt@4759
    22
#include "SDL_config.h"
dewyatt@4759
    23
dewyatt@4759
    24
#ifndef _SDL_win32video_h
dewyatt@4759
    25
#define _SDL_win32video_h
dewyatt@4759
    26
dewyatt@4759
    27
#include "../SDL_sysvideo.h"
dewyatt@4759
    28
dewyatt@4759
    29
#define WIN32_LEAN_AND_MEAN
dewyatt@4759
    30
#define STRICT
slouken@4569
    31
#ifndef UNICODE
dewyatt@4759
    32
#define UNICODE
slouken@4569
    33
#endif
dewyatt@4759
    34
#undef WINVER
slouken@4868
    35
#define WINVER  0x500           /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
jimtla@4650
    36
dewyatt@4759
    37
#include <windows.h>
dewyatt@4759
    38
dewyatt@4759
    39
#include <msctf.h>
Daniel@4892
    40
#include <imm.h>
dewyatt@4759
    41
dewyatt@4759
    42
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
    43
//#include <d3d9.h>
dewyatt@4759
    44
#define D3D_DEBUG_INFO
dewyatt@4759
    45
#include "d3d9.h"
dewyatt@4759
    46
#endif
dewyatt@4759
    47
dewyatt@4759
    48
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
    49
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
dewyatt@4759
    50
#include <objbase.h>
dewyatt@4759
    51
#include "ddraw.h"
dewyatt@4759
    52
#endif
dewyatt@4759
    53
dewyatt@4759
    54
#include "SDL_win32clipboard.h"
dewyatt@4759
    55
#include "SDL_win32events.h"
dewyatt@4759
    56
#include "SDL_win32gamma.h"
dewyatt@4759
    57
#include "SDL_win32keyboard.h"
dewyatt@4759
    58
#include "SDL_win32modes.h"
dewyatt@4759
    59
#include "SDL_win32mouse.h"
dewyatt@4759
    60
#include "SDL_win32opengl.h"
dewyatt@4759
    61
#include "SDL_win32window.h"
dewyatt@4759
    62
#include "SDL_events.h"
dewyatt@4759
    63
dewyatt@4759
    64
#ifdef UNICODE
dewyatt@4759
    65
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
dewyatt@4759
    66
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    67
#else
dewyatt@4759
    68
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
dewyatt@4759
    69
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    70
#endif
dewyatt@4759
    71
extern void WIN_SetError(const char *prefix);
dewyatt@4759
    72
slouken@4569
    73
enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
slouken@4569
    74
slouken@4569
    75
typedef BOOL  (*PFNSHFullScreen)(HWND, DWORD);
slouken@4569
    76
typedef void  (*PFCoordTransform)(SDL_Window*, POINT*);
slouken@4569
    77
dewyatt@4759
    78
typedef struct  
dewyatt@4759
    79
{
dewyatt@4759
    80
    void **lpVtbl;
dewyatt@4759
    81
    int refcount;
dewyatt@4759
    82
    void *data;
dewyatt@4759
    83
} TSFSink;
dewyatt@4759
    84
Daniel@4892
    85
/* Definition from Win98DDK version of IMM.H */
dewyatt@4759
    86
typedef struct tagINPUTCONTEXT2 {
Daniel@4892
    87
    HWND                hWnd;
Daniel@4892
    88
    BOOL                fOpen;
Daniel@4892
    89
    POINT               ptStatusWndPos;
Daniel@4892
    90
    POINT               ptSoftKbdPos;
Daniel@4892
    91
    DWORD               fdwConversion;
Daniel@4892
    92
    DWORD               fdwSentence;
Daniel@4892
    93
    union   {
Daniel@4892
    94
        LOGFONTA        A;
Daniel@4892
    95
        LOGFONTW        W;
Daniel@4892
    96
    } lfFont;
Daniel@4892
    97
    COMPOSITIONFORM     cfCompForm;
Daniel@4892
    98
    CANDIDATEFORM       cfCandForm[4];
Daniel@4892
    99
    HIMCC               hCompStr;
Daniel@4892
   100
    HIMCC               hCandInfo;
Daniel@4892
   101
    HIMCC               hGuideLine;
Daniel@4892
   102
    HIMCC               hPrivate;
Daniel@4892
   103
    DWORD               dwNumMsgBuf;
Daniel@4892
   104
    HIMCC               hMsgBuf;
Daniel@4892
   105
    DWORD               fdwInit;
Daniel@4892
   106
    DWORD               dwReserve[3];
Daniel@4892
   107
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
dewyatt@4759
   108
dewyatt@4759
   109
/* Private display data */
dewyatt@4759
   110
dewyatt@4759
   111
typedef struct SDL_VideoData
dewyatt@4759
   112
{
slouken@4569
   113
    int render;
slouken@4569
   114
dewyatt@4759
   115
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
   116
    HANDLE d3dDLL;
dewyatt@4759
   117
    IDirect3D9 *d3d;
dewyatt@4759
   118
#endif
dewyatt@4759
   119
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
   120
    HANDLE ddrawDLL;
dewyatt@4759
   121
    IDirectDraw *ddraw;
dewyatt@4759
   122
#endif
slouken@4569
   123
#ifdef _WIN32_WCE
slouken@4569
   124
    HMODULE hAygShell;
slouken@4569
   125
    PFNSHFullScreen SHFullScreen;
slouken@4569
   126
    PFCoordTransform CoordTransform;
slouken@4569
   127
#endif
dewyatt@4759
   128
dewyatt@4759
   129
    const SDL_scancode *key_layout;
dewyatt@4759
   130
    DWORD clipboard_count;
dewyatt@4759
   131
dewyatt@4759
   132
    SDL_bool ime_com_initialized;
dewyatt@4759
   133
    struct ITfThreadMgr *ime_threadmgr;
dewyatt@4759
   134
    SDL_bool ime_initialized;
dewyatt@4759
   135
    SDL_bool ime_enabled;
dewyatt@4759
   136
    SDL_bool ime_available;
dewyatt@4759
   137
    HWND ime_hwnd_main;
dewyatt@4759
   138
    HWND ime_hwnd_current;
dewyatt@4759
   139
    HIMC ime_himc;
dewyatt@4759
   140
dewyatt@4759
   141
    WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
dewyatt@4759
   142
    WCHAR ime_readingstring[16];
dewyatt@4759
   143
    int ime_cursor;
dewyatt@4759
   144
dewyatt@4759
   145
    HKL ime_hkl;
dewyatt@4759
   146
    HMODULE ime_himm32;
dewyatt@4759
   147
    UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
dewyatt@4759
   148
    BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
dewyatt@4759
   149
    LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
dewyatt@4759
   150
    BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
dewyatt@4759
   151
    LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
dewyatt@4759
   152
    BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
dewyatt@4759
   153
dewyatt@4759
   154
    SDL_bool ime_uiless;
dewyatt@4759
   155
    struct ITfThreadMgrEx *ime_threadmgrex;
dewyatt@4759
   156
    DWORD ime_uielemsinkcookie;
dewyatt@4759
   157
    DWORD ime_alpnsinkcookie;
dewyatt@4759
   158
    DWORD ime_openmodesinkcookie;
dewyatt@4759
   159
    DWORD ime_convmodesinkcookie;
dewyatt@4759
   160
    TSFSink *ime_uielemsink;
dewyatt@4759
   161
    TSFSink *ime_ippasink;
dewyatt@4759
   162
} SDL_VideoData;
dewyatt@4759
   163
dewyatt@4759
   164
#endif /* _SDL_win32video_h */
dewyatt@4759
   165
dewyatt@4759
   166
/* vi: set ts=4 sw=4 expandtab: */