src/video/win32/SDL_win32video.h
author Daniel Wyatt <Daniel.Wyatt@gmail.com>
Tue, 23 Nov 2010 17:44:10 -0500
changeset 4912 37576cdf6751
parent 4893 b2e434e0553b
child 4919 716b2cbf4c9e
permissions -rw-r--r--
Add variables needed for win32 candidate list support.
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
Daniel@4893
    39
#ifndef __GNUC__
dewyatt@4759
    40
#include <msctf.h>
Daniel@4893
    41
#else
Daniel@4893
    42
#include "SDL_msctf.h"
Daniel@4893
    43
#endif
Daniel@4893
    44
Daniel@4892
    45
#include <imm.h>
dewyatt@4759
    46
Daniel@4912
    47
#define MAX_CANDLIST    10
Daniel@4912
    48
#define MAX_CANDLENGTH  256
Daniel@4912
    49
dewyatt@4759
    50
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
    51
//#include <d3d9.h>
dewyatt@4759
    52
#define D3D_DEBUG_INFO
dewyatt@4759
    53
#include "d3d9.h"
dewyatt@4759
    54
#endif
dewyatt@4759
    55
dewyatt@4759
    56
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
    57
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
dewyatt@4759
    58
#include <objbase.h>
dewyatt@4759
    59
#include "ddraw.h"
dewyatt@4759
    60
#endif
dewyatt@4759
    61
dewyatt@4759
    62
#include "SDL_win32clipboard.h"
dewyatt@4759
    63
#include "SDL_win32events.h"
dewyatt@4759
    64
#include "SDL_win32gamma.h"
dewyatt@4759
    65
#include "SDL_win32keyboard.h"
dewyatt@4759
    66
#include "SDL_win32modes.h"
dewyatt@4759
    67
#include "SDL_win32mouse.h"
dewyatt@4759
    68
#include "SDL_win32opengl.h"
dewyatt@4759
    69
#include "SDL_win32window.h"
dewyatt@4759
    70
#include "SDL_events.h"
dewyatt@4759
    71
dewyatt@4759
    72
#ifdef UNICODE
dewyatt@4759
    73
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
dewyatt@4759
    74
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    75
#else
dewyatt@4759
    76
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
dewyatt@4759
    77
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    78
#endif
dewyatt@4759
    79
extern void WIN_SetError(const char *prefix);
dewyatt@4759
    80
slouken@4569
    81
enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
slouken@4569
    82
slouken@4569
    83
typedef BOOL  (*PFNSHFullScreen)(HWND, DWORD);
slouken@4569
    84
typedef void  (*PFCoordTransform)(SDL_Window*, POINT*);
slouken@4569
    85
dewyatt@4759
    86
typedef struct  
dewyatt@4759
    87
{
dewyatt@4759
    88
    void **lpVtbl;
dewyatt@4759
    89
    int refcount;
dewyatt@4759
    90
    void *data;
dewyatt@4759
    91
} TSFSink;
dewyatt@4759
    92
Daniel@4892
    93
/* Definition from Win98DDK version of IMM.H */
dewyatt@4759
    94
typedef struct tagINPUTCONTEXT2 {
Daniel@4912
    95
    HWND hWnd;
Daniel@4912
    96
    BOOL fOpen;
Daniel@4912
    97
    POINT ptStatusWndPos;
Daniel@4912
    98
    POINT ptSoftKbdPos;
Daniel@4912
    99
    DWORD fdwConversion;
Daniel@4912
   100
    DWORD fdwSentence;
Daniel@4912
   101
    union {
Daniel@4912
   102
        LOGFONTA A;
Daniel@4912
   103
        LOGFONTW W;
Daniel@4892
   104
    } lfFont;
Daniel@4912
   105
    COMPOSITIONFORM cfCompForm;
Daniel@4912
   106
    CANDIDATEFORM cfCandForm[4];
Daniel@4912
   107
    HIMCC hCompStr;
Daniel@4912
   108
    HIMCC hCandInfo;
Daniel@4912
   109
    HIMCC hGuideLine;
Daniel@4912
   110
    HIMCC hPrivate;
Daniel@4912
   111
    DWORD dwNumMsgBuf;
Daniel@4912
   112
    HIMCC hMsgBuf;
Daniel@4912
   113
    DWORD fdwInit;
Daniel@4912
   114
    DWORD dwReserve[3];
Daniel@4892
   115
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
dewyatt@4759
   116
dewyatt@4759
   117
/* Private display data */
dewyatt@4759
   118
dewyatt@4759
   119
typedef struct SDL_VideoData
dewyatt@4759
   120
{
slouken@4569
   121
    int render;
slouken@4569
   122
dewyatt@4759
   123
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
   124
    HANDLE d3dDLL;
dewyatt@4759
   125
    IDirect3D9 *d3d;
dewyatt@4759
   126
#endif
dewyatt@4759
   127
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
   128
    HANDLE ddrawDLL;
dewyatt@4759
   129
    IDirectDraw *ddraw;
dewyatt@4759
   130
#endif
slouken@4569
   131
#ifdef _WIN32_WCE
slouken@4569
   132
    HMODULE hAygShell;
slouken@4569
   133
    PFNSHFullScreen SHFullScreen;
slouken@4569
   134
    PFCoordTransform CoordTransform;
slouken@4569
   135
#endif
dewyatt@4759
   136
dewyatt@4759
   137
    const SDL_scancode *key_layout;
dewyatt@4759
   138
    DWORD clipboard_count;
dewyatt@4759
   139
dewyatt@4759
   140
    SDL_bool ime_com_initialized;
dewyatt@4759
   141
    struct ITfThreadMgr *ime_threadmgr;
dewyatt@4759
   142
    SDL_bool ime_initialized;
dewyatt@4759
   143
    SDL_bool ime_enabled;
dewyatt@4759
   144
    SDL_bool ime_available;
dewyatt@4759
   145
    HWND ime_hwnd_main;
dewyatt@4759
   146
    HWND ime_hwnd_current;
dewyatt@4759
   147
    HIMC ime_himc;
dewyatt@4759
   148
dewyatt@4759
   149
    WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
dewyatt@4759
   150
    WCHAR ime_readingstring[16];
dewyatt@4759
   151
    int ime_cursor;
dewyatt@4759
   152
Daniel@4912
   153
    SDL_bool ime_candlist;
Daniel@4912
   154
    WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
Daniel@4912
   155
    DWORD ime_candcount;
Daniel@4912
   156
    DWORD ime_candref;
Daniel@4912
   157
    DWORD ime_candsel;
Daniel@4912
   158
    UINT ime_candpgsize;
Daniel@4912
   159
    int ime_candlistindexbase;
Daniel@4912
   160
    SDL_bool ime_candvertical;
Daniel@4912
   161
Daniel@4912
   162
    SDL_Texture *ime_candtex;
Daniel@4912
   163
    SDL_bool ime_dirty;
Daniel@4912
   164
    SDL_Rect ime_rect;
Daniel@4912
   165
    SDL_Rect ime_candlistrect;
Daniel@4912
   166
    int ime_winwidth;
Daniel@4912
   167
    int ime_winheight;
Daniel@4912
   168
dewyatt@4759
   169
    HKL ime_hkl;
dewyatt@4759
   170
    HMODULE ime_himm32;
dewyatt@4759
   171
    UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
dewyatt@4759
   172
    BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
dewyatt@4759
   173
    LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
dewyatt@4759
   174
    BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
dewyatt@4759
   175
    LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
dewyatt@4759
   176
    BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
dewyatt@4759
   177
dewyatt@4759
   178
    SDL_bool ime_uiless;
dewyatt@4759
   179
    struct ITfThreadMgrEx *ime_threadmgrex;
dewyatt@4759
   180
    DWORD ime_uielemsinkcookie;
dewyatt@4759
   181
    DWORD ime_alpnsinkcookie;
dewyatt@4759
   182
    DWORD ime_openmodesinkcookie;
dewyatt@4759
   183
    DWORD ime_convmodesinkcookie;
dewyatt@4759
   184
    TSFSink *ime_uielemsink;
dewyatt@4759
   185
    TSFSink *ime_ippasink;
dewyatt@4759
   186
} SDL_VideoData;
dewyatt@4759
   187
dewyatt@4759
   188
#endif /* _SDL_win32video_h */
dewyatt@4759
   189
dewyatt@4759
   190
/* vi: set ts=4 sw=4 expandtab: */