src/video/win32/SDL_win32video.h
author dewyatt
Tue, 03 Aug 2010 16:57:49 -0400
changeset 4759 863ba7d1f029
parent 4755 436183eb30c8
child 4763 518d1679d2d0
permissions -rw-r--r--
Large commit with initial reading string support, TSF UILess code, etc.
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
dewyatt@4759
    31
#define UNICODE
dewyatt@4759
    32
#undef WINVER
dewyatt@4759
    33
#define WINVER  0x500           /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
dewyatt@4759
    34
#include <windows.h>
dewyatt@4759
    35
dewyatt@4759
    36
#include <msctf.h>
dewyatt@4759
    37
dewyatt@4759
    38
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
    39
//#include <d3d9.h>
dewyatt@4759
    40
#define D3D_DEBUG_INFO
dewyatt@4759
    41
#include "d3d9.h"
dewyatt@4759
    42
#endif
dewyatt@4759
    43
dewyatt@4759
    44
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
    45
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
dewyatt@4759
    46
#include <objbase.h>
dewyatt@4759
    47
#include "ddraw.h"
dewyatt@4759
    48
#endif
dewyatt@4759
    49
dewyatt@4759
    50
#include "SDL_win32clipboard.h"
dewyatt@4759
    51
#include "SDL_win32events.h"
dewyatt@4759
    52
#include "SDL_win32gamma.h"
dewyatt@4759
    53
#include "SDL_win32keyboard.h"
dewyatt@4759
    54
#include "SDL_win32modes.h"
dewyatt@4759
    55
#include "SDL_win32mouse.h"
dewyatt@4759
    56
#include "SDL_win32opengl.h"
dewyatt@4759
    57
#include "SDL_win32window.h"
dewyatt@4759
    58
#include "SDL_events.h"
dewyatt@4759
    59
dewyatt@4759
    60
#ifdef UNICODE
dewyatt@4759
    61
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
dewyatt@4759
    62
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    63
#else
dewyatt@4759
    64
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
dewyatt@4759
    65
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
dewyatt@4759
    66
#endif
dewyatt@4759
    67
extern void WIN_SetError(const char *prefix);
dewyatt@4759
    68
dewyatt@4759
    69
typedef struct  
dewyatt@4759
    70
{
dewyatt@4759
    71
    void **lpVtbl;
dewyatt@4759
    72
    int refcount;
dewyatt@4759
    73
    void *data;
dewyatt@4759
    74
} TSFSink;
dewyatt@4759
    75
dewyatt@4759
    76
// Definition from Win98DDK version of IMM.H
dewyatt@4759
    77
typedef struct tagINPUTCONTEXT2 {
dewyatt@4759
    78
    HWND                hWnd;                           
dewyatt@4759
    79
    BOOL                fOpen;                          
dewyatt@4759
    80
    POINT               ptStatusWndPos;                 
dewyatt@4759
    81
    POINT               ptSoftKbdPos;                   
dewyatt@4759
    82
    DWORD               fdwConversion;                  
dewyatt@4759
    83
    DWORD               fdwSentence;                    
dewyatt@4759
    84
    union   {                                           
dewyatt@4759
    85
        LOGFONTA        A;                              
dewyatt@4759
    86
        LOGFONTW        W;                              
dewyatt@4759
    87
    } lfFont;                                           
dewyatt@4759
    88
    COMPOSITIONFORM     cfCompForm;                     
dewyatt@4759
    89
    CANDIDATEFORM       cfCandForm[4];                  
dewyatt@4759
    90
    HIMCC               hCompStr;                       
dewyatt@4759
    91
    HIMCC               hCandInfo;                      
dewyatt@4759
    92
    HIMCC               hGuideLine;                     
dewyatt@4759
    93
    HIMCC               hPrivate;                       
dewyatt@4759
    94
    DWORD               dwNumMsgBuf;                    
dewyatt@4759
    95
    HIMCC               hMsgBuf;                        
dewyatt@4759
    96
    DWORD               fdwInit;                        
dewyatt@4759
    97
    DWORD               dwReserve[3];                   
dewyatt@4759
    98
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;  
dewyatt@4759
    99
dewyatt@4759
   100
/* Private display data */
dewyatt@4759
   101
dewyatt@4759
   102
typedef struct SDL_VideoData
dewyatt@4759
   103
{
dewyatt@4759
   104
#if SDL_VIDEO_RENDER_D3D
dewyatt@4759
   105
    HANDLE d3dDLL;
dewyatt@4759
   106
    IDirect3D9 *d3d;
dewyatt@4759
   107
#endif
dewyatt@4759
   108
#if SDL_VIDEO_RENDER_DDRAW
dewyatt@4759
   109
    HANDLE ddrawDLL;
dewyatt@4759
   110
    IDirectDraw *ddraw;
dewyatt@4759
   111
#endif
dewyatt@4759
   112
dewyatt@4759
   113
    const SDL_scancode *key_layout;
dewyatt@4759
   114
    DWORD clipboard_count;
dewyatt@4759
   115
dewyatt@4759
   116
    SDL_bool ime_com_initialized;
dewyatt@4759
   117
    struct ITfThreadMgr *ime_threadmgr;
dewyatt@4759
   118
    SDL_bool ime_initialized;
dewyatt@4759
   119
    SDL_bool ime_enabled;
dewyatt@4759
   120
    SDL_bool ime_available;
dewyatt@4759
   121
    HWND ime_hwnd_main;
dewyatt@4759
   122
    HWND ime_hwnd_current;
dewyatt@4759
   123
    HIMC ime_himc;
dewyatt@4759
   124
dewyatt@4759
   125
    WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
dewyatt@4759
   126
    WCHAR ime_readingstring[16];
dewyatt@4759
   127
    int ime_cursor;
dewyatt@4759
   128
dewyatt@4759
   129
    HKL ime_hkl;
dewyatt@4759
   130
    HMODULE ime_himm32;
dewyatt@4759
   131
    UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
dewyatt@4759
   132
    BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
dewyatt@4759
   133
    LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
dewyatt@4759
   134
    BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
dewyatt@4759
   135
    LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
dewyatt@4759
   136
    BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
dewyatt@4759
   137
dewyatt@4759
   138
    SDL_bool ime_uiless;
dewyatt@4759
   139
    struct ITfThreadMgrEx *ime_threadmgrex;
dewyatt@4759
   140
    DWORD ime_uielemsinkcookie;
dewyatt@4759
   141
    DWORD ime_alpnsinkcookie;
dewyatt@4759
   142
    DWORD ime_openmodesinkcookie;
dewyatt@4759
   143
    DWORD ime_convmodesinkcookie;
dewyatt@4759
   144
    TSFSink *ime_uielemsink;
dewyatt@4759
   145
    TSFSink *ime_ippasink;
dewyatt@4759
   146
} SDL_VideoData;
dewyatt@4759
   147
dewyatt@4759
   148
#endif /* _SDL_win32video_h */
dewyatt@4759
   149
dewyatt@4759
   150
/* vi: set ts=4 sw=4 expandtab: */