src/video/windows/SDL_windowsvideo.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5262 b530ef003506
child 6138 4c64952a58fb
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "SDL_config.h"
    22 
    23 #ifndef _SDL_windowsvideo_h
    24 #define _SDL_windowsvideo_h
    25 
    26 #include "../SDL_sysvideo.h"
    27 
    28 #include "../../core/windows/SDL_windows.h"
    29 
    30 #if defined(_MSC_VER) && !defined(_WIN32_WCE)
    31 #include <msctf.h>
    32 #else
    33 #include "SDL_msctf.h"
    34 #endif
    35 
    36 #include <imm.h>
    37 
    38 #define MAX_CANDLIST    10
    39 #define MAX_CANDLENGTH  256
    40 
    41 #include "SDL_windowsclipboard.h"
    42 #include "SDL_windowsevents.h"
    43 #include "SDL_windowskeyboard.h"
    44 #include "SDL_windowsmodes.h"
    45 #include "SDL_windowsmouse.h"
    46 #include "SDL_windowsopengl.h"
    47 #include "SDL_windowswindow.h"
    48 #include "SDL_events.h"
    49 #include "SDL_loadso.h"
    50 
    51 
    52 #if WINVER < 0x0601
    53 /* Touch input definitions */
    54 #define TWF_FINETOUCH	1
    55 #define TWF_WANTPALM	2
    56 
    57 #define TOUCHEVENTF_MOVE 0x0001
    58 #define TOUCHEVENTF_DOWN 0x0002
    59 #define TOUCHEVENTF_UP   0x0004
    60 
    61 DECLARE_HANDLE(HTOUCHINPUT);
    62 
    63 typedef struct _TOUCHINPUT {
    64 	LONG      x;
    65 	LONG      y;
    66 	HANDLE    hSource;
    67 	DWORD     dwID;
    68 	DWORD     dwFlags;
    69 	DWORD     dwMask;
    70 	DWORD     dwTime;
    71 	ULONG_PTR dwExtraInfo;
    72 	DWORD     cxContact;
    73 	DWORD     cyContact;
    74 } TOUCHINPUT, *PTOUCHINPUT;
    75 
    76 #endif /* WINVER < 0x0601 */
    77 
    78 typedef BOOL  (*PFNSHFullScreen)(HWND, DWORD);
    79 typedef void  (*PFCoordTransform)(SDL_Window*, POINT*);
    80 
    81 typedef struct  
    82 {
    83     void **lpVtbl;
    84     int refcount;
    85     void *data;
    86 } TSFSink;
    87 
    88 /* Definition from Win98DDK version of IMM.H */
    89 typedef struct tagINPUTCONTEXT2 {
    90     HWND hWnd;
    91     BOOL fOpen;
    92     POINT ptStatusWndPos;
    93     POINT ptSoftKbdPos;
    94     DWORD fdwConversion;
    95     DWORD fdwSentence;
    96     union {
    97         LOGFONTA A;
    98         LOGFONTW W;
    99     } lfFont;
   100     COMPOSITIONFORM cfCompForm;
   101     CANDIDATEFORM cfCandForm[4];
   102     HIMCC hCompStr;
   103     HIMCC hCandInfo;
   104     HIMCC hGuideLine;
   105     HIMCC hPrivate;
   106     DWORD dwNumMsgBuf;
   107     HIMCC hMsgBuf;
   108     DWORD fdwInit;
   109     DWORD dwReserve[3];
   110 } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
   111 
   112 /* Private display data */
   113 
   114 typedef struct SDL_VideoData
   115 {
   116     int render;
   117 
   118 #ifdef _WIN32_WCE
   119     void* hAygShell;
   120     PFNSHFullScreen SHFullScreen;
   121     PFCoordTransform CoordTransform;
   122 #endif
   123 
   124     const SDL_Scancode *key_layout;
   125 	DWORD clipboard_count;
   126 
   127 	/* Touch input functions */
   128 	void* userDLL;
   129 	BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
   130 	BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
   131 	BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
   132 
   133     SDL_bool ime_com_initialized;
   134     struct ITfThreadMgr *ime_threadmgr;
   135     SDL_bool ime_initialized;
   136     SDL_bool ime_enabled;
   137     SDL_bool ime_available;
   138     HWND ime_hwnd_main;
   139     HWND ime_hwnd_current;
   140     HIMC ime_himc;
   141 
   142     WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
   143     WCHAR ime_readingstring[16];
   144     int ime_cursor;
   145 
   146     SDL_bool ime_candlist;
   147     WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
   148     DWORD ime_candcount;
   149     DWORD ime_candref;
   150     DWORD ime_candsel;
   151     UINT ime_candpgsize;
   152     int ime_candlistindexbase;
   153     SDL_bool ime_candvertical;
   154 
   155     SDL_bool ime_dirty;
   156     SDL_Rect ime_rect;
   157     SDL_Rect ime_candlistrect;
   158     int ime_winwidth;
   159     int ime_winheight;
   160 
   161     HKL ime_hkl;
   162     void* ime_himm32;
   163     UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
   164     BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
   165     LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
   166     BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
   167     LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
   168     BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
   169 
   170     SDL_bool ime_uiless;
   171     struct ITfThreadMgrEx *ime_threadmgrex;
   172     DWORD ime_uielemsinkcookie;
   173     DWORD ime_alpnsinkcookie;
   174     DWORD ime_openmodesinkcookie;
   175     DWORD ime_convmodesinkcookie;
   176     TSFSink *ime_uielemsink;
   177     TSFSink *ime_ippasink;
   178 } SDL_VideoData;
   179 
   180 #endif /* _SDL_windowsvideo_h */
   181 
   182 /* vi: set ts=4 sw=4 expandtab: */