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