src/video/windows/SDL_windowsvideo.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 24 Jan 2011 21:20:30 -0800
changeset 5090 327f181542f1
parent 5086 c2539ff054c8
child 5139 57851a238c8f
permissions -rw-r--r--
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.

I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
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
slouken@5062
    24
#ifndef _SDL_windowsvideo_h
slouken@5062
    25
#define _SDL_windowsvideo_h
dewyatt@4759
    26
dewyatt@4759
    27
#include "../SDL_sysvideo.h"
dewyatt@4759
    28
slouken@5090
    29
#include "../../core/windows/SDL_windows.h"
dewyatt@4759
    30
slouken@5086
    31
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
dewyatt@4759
    32
#include <msctf.h>
Daniel@4893
    33
#else
Daniel@4893
    34
#include "SDL_msctf.h"
Daniel@4893
    35
#endif
Daniel@4893
    36
Daniel@4892
    37
#include <imm.h>
dewyatt@4759
    38
Daniel@4912
    39
#define MAX_CANDLIST    10
Daniel@4912
    40
#define MAX_CANDLENGTH  256
Daniel@4912
    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
slouken@5062
    54
#include "SDL_windowsclipboard.h"
slouken@5062
    55
#include "SDL_windowsevents.h"
slouken@5062
    56
#include "SDL_windowsgamma.h"
slouken@5062
    57
#include "SDL_windowskeyboard.h"
slouken@5062
    58
#include "SDL_windowsmodes.h"
slouken@5062
    59
#include "SDL_windowsmouse.h"
slouken@5062
    60
#include "SDL_windowsopengl.h"
slouken@5062
    61
#include "SDL_windowswindow.h"
dewyatt@4759
    62
#include "SDL_events.h"
slouken@5090
    63
#include "SDL_loadso.h"
dewyatt@4759
    64
dewyatt@4759
    65
slouken@4569
    66
enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
slouken@4569
    67
slouken@4919
    68
#if WINVER < 0x0601
slouken@4919
    69
/* Touch input definitions */
slouken@4919
    70
#define TWF_FINETOUCH	1
slouken@4919
    71
#define TWF_WANTPALM	2
slouken@4919
    72
slouken@4919
    73
#define TOUCHEVENTF_MOVE 0x0001
slouken@4919
    74
#define TOUCHEVENTF_DOWN 0x0002
slouken@4919
    75
#define TOUCHEVENTF_UP   0x0004
slouken@4919
    76
slouken@4919
    77
DECLARE_HANDLE(HTOUCHINPUT);
slouken@4919
    78
slouken@5038
    79
typedef struct _TOUCHINPUT {
slouken@5038
    80
	LONG      x;
slouken@5038
    81
	LONG      y;
slouken@5038
    82
	HANDLE    hSource;
slouken@5038
    83
	DWORD     dwID;
slouken@5038
    84
	DWORD     dwFlags;
slouken@5038
    85
	DWORD     dwMask;
slouken@5038
    86
	DWORD     dwTime;
slouken@5038
    87
	ULONG_PTR dwExtraInfo;
slouken@5038
    88
	DWORD     cxContact;
slouken@5038
    89
	DWORD     cyContact;
slouken@4919
    90
} TOUCHINPUT, *PTOUCHINPUT;
slouken@4919
    91
slouken@4919
    92
#endif /* WINVER < 0x0601 */
slouken@4919
    93
slouken@4569
    94
typedef BOOL  (*PFNSHFullScreen)(HWND, DWORD);
slouken@4569
    95
typedef void  (*PFCoordTransform)(SDL_Window*, POINT*);
slouken@4569
    96
dewyatt@4759
    97
typedef struct  
dewyatt@4759
    98
{
dewyatt@4759
    99
    void **lpVtbl;
dewyatt@4759
   100
    int refcount;
dewyatt@4759
   101
    void *data;
dewyatt@4759
   102
} TSFSink;
dewyatt@4759
   103
Daniel@4892
   104
/* Definition from Win98DDK version of IMM.H */
dewyatt@4759
   105
typedef struct tagINPUTCONTEXT2 {
Daniel@4912
   106
    HWND hWnd;
Daniel@4912
   107
    BOOL fOpen;
Daniel@4912
   108
    POINT ptStatusWndPos;
Daniel@4912
   109
    POINT ptSoftKbdPos;
Daniel@4912
   110
    DWORD fdwConversion;
Daniel@4912
   111
    DWORD fdwSentence;
Daniel@4912
   112
    union {
Daniel@4912
   113
        LOGFONTA A;
Daniel@4912
   114
        LOGFONTW W;
Daniel@4892
   115
    } lfFont;
Daniel@4912
   116
    COMPOSITIONFORM cfCompForm;
Daniel@4912
   117
    CANDIDATEFORM cfCandForm[4];
Daniel@4912
   118
    HIMCC hCompStr;
Daniel@4912
   119
    HIMCC hCandInfo;
Daniel@4912
   120
    HIMCC hGuideLine;
Daniel@4912
   121
    HIMCC hPrivate;
Daniel@4912
   122
    DWORD dwNumMsgBuf;
Daniel@4912
   123
    HIMCC hMsgBuf;
Daniel@4912
   124
    DWORD fdwInit;
Daniel@4912
   125
    DWORD dwReserve[3];
Daniel@4892
   126
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
dewyatt@4759
   127
dewyatt@4759
   128
/* Private display data */
dewyatt@4759
   129
dewyatt@4759
   130
typedef struct SDL_VideoData
dewyatt@4759
   131
{
slouken@4569
   132
    int render;
slouken@4569
   133
dewyatt@4759
   134
#if SDL_VIDEO_RENDER_D3D
slouken@5090
   135
    void* d3dDLL;
dewyatt@4759
   136
    IDirect3D9 *d3d;
dewyatt@4759
   137
#endif
dewyatt@4759
   138
#if SDL_VIDEO_RENDER_DDRAW
slouken@5090
   139
    void* ddrawDLL;
dewyatt@4759
   140
    IDirectDraw *ddraw;
dewyatt@4759
   141
#endif
slouken@4569
   142
#ifdef _WIN32_WCE
slouken@5090
   143
    void* hAygShell;
slouken@4569
   144
    PFNSHFullScreen SHFullScreen;
slouken@4569
   145
    PFCoordTransform CoordTransform;
slouken@4569
   146
#endif
dewyatt@4759
   147
krogoway@5081
   148
    const SDL_ScanCode *key_layout;
slouken@4919
   149
	DWORD clipboard_count;
slouken@4919
   150
slouken@4919
   151
	/* Touch input functions */
slouken@5090
   152
	void* userDLL;
slouken@4919
   153
	BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
slouken@4919
   154
	BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
slouken@5038
   155
	BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
dewyatt@4759
   156
dewyatt@4759
   157
    SDL_bool ime_com_initialized;
dewyatt@4759
   158
    struct ITfThreadMgr *ime_threadmgr;
dewyatt@4759
   159
    SDL_bool ime_initialized;
dewyatt@4759
   160
    SDL_bool ime_enabled;
dewyatt@4759
   161
    SDL_bool ime_available;
dewyatt@4759
   162
    HWND ime_hwnd_main;
dewyatt@4759
   163
    HWND ime_hwnd_current;
dewyatt@4759
   164
    HIMC ime_himc;
dewyatt@4759
   165
dewyatt@4759
   166
    WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
dewyatt@4759
   167
    WCHAR ime_readingstring[16];
dewyatt@4759
   168
    int ime_cursor;
dewyatt@4759
   169
Daniel@4912
   170
    SDL_bool ime_candlist;
Daniel@4912
   171
    WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
Daniel@4912
   172
    DWORD ime_candcount;
Daniel@4912
   173
    DWORD ime_candref;
Daniel@4912
   174
    DWORD ime_candsel;
Daniel@4912
   175
    UINT ime_candpgsize;
Daniel@4912
   176
    int ime_candlistindexbase;
Daniel@4912
   177
    SDL_bool ime_candvertical;
Daniel@4912
   178
Daniel@4912
   179
    SDL_Texture *ime_candtex;
Daniel@4912
   180
    SDL_bool ime_dirty;
Daniel@4912
   181
    SDL_Rect ime_rect;
Daniel@4912
   182
    SDL_Rect ime_candlistrect;
Daniel@4912
   183
    int ime_winwidth;
Daniel@4912
   184
    int ime_winheight;
Daniel@4912
   185
dewyatt@4759
   186
    HKL ime_hkl;
slouken@5090
   187
    void* ime_himm32;
dewyatt@4759
   188
    UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
dewyatt@4759
   189
    BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
dewyatt@4759
   190
    LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
dewyatt@4759
   191
    BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
dewyatt@4759
   192
    LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
dewyatt@4759
   193
    BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
dewyatt@4759
   194
dewyatt@4759
   195
    SDL_bool ime_uiless;
dewyatt@4759
   196
    struct ITfThreadMgrEx *ime_threadmgrex;
dewyatt@4759
   197
    DWORD ime_uielemsinkcookie;
dewyatt@4759
   198
    DWORD ime_alpnsinkcookie;
dewyatt@4759
   199
    DWORD ime_openmodesinkcookie;
dewyatt@4759
   200
    DWORD ime_convmodesinkcookie;
dewyatt@4759
   201
    TSFSink *ime_uielemsink;
dewyatt@4759
   202
    TSFSink *ime_ippasink;
dewyatt@4759
   203
} SDL_VideoData;
dewyatt@4759
   204
slouken@5062
   205
#endif /* _SDL_windowsvideo_h */
dewyatt@4759
   206
dewyatt@4759
   207
/* vi: set ts=4 sw=4 expandtab: */