Adding WM_POINTER family to win32_window.h + changing WINVER in win32_platform.h

This commit is contained in:
Raja 2017-10-17 20:11:31 -04:00
parent 56ecd62f58
commit 04d5e94eb0
3 changed files with 1491 additions and 1431 deletions

View File

@ -49,13 +49,13 @@
#endif #endif
// GLFW requires Windows XP or later // GLFW requires Windows XP or later
#if WINVER < 0x0501 #if WINVER < 0x0604
#undef WINVER #undef WINVER
#define WINVER 0x0501 #define WINVER 0x0604
#endif #endif
#if _WIN32_WINNT < 0x0501 #if _WIN32_WINNT < 0x0604
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0604
#endif #endif
// GLFW uses DirectInput8 interfaces // GLFW uses DirectInput8 interfaces
@ -104,7 +104,7 @@
#define _WIN32_WINNT_WINBLUE 0x0602 #define _WIN32_WINNT_WINBLUE 0x0602
#endif #endif
#if WINVER < 0x0601 #if WINVER < 0x0400
typedef struct tagCHANGEFILTERSTRUCT typedef struct tagCHANGEFILTERSTRUCT
{ {
DWORD cbSize; DWORD cbSize;
@ -116,7 +116,7 @@ typedef struct tagCHANGEFILTERSTRUCT
#endif #endif
#endif /*Windows 7*/ #endif /*Windows 7*/
#if WINVER < 0x0600 #if WINVER > 0x0400 //Changed from 0x0600 to 0x0400
#define DWM_BB_ENABLE 0x00000001 #define DWM_BB_ENABLE 0x00000001
#define DWM_BB_BLURREGION 0x00000002 #define DWM_BB_BLURREGION 0x00000002
typedef struct typedef struct

View File

@ -31,8 +31,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <WinUser.h>
#include <windowsx.h> #include <windowsx.h>
#include <shellapi.h> #include <shellapi.h>
#include <stdio.h>
#define _GLFW_KEY_INVALID -2 #define _GLFW_KEY_INVALID -2
@ -561,6 +563,63 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
break; break;
} }
case WM_POINTERDOWN:
{
POINTER_TOUCH_INFO touchInfo;
POINTER_PEN_INFO penInfo;
POINTER_INFO pointerInfo;
UINT32 pointerId = GET_POINTERID_WPARAM(wParam);
POINTER_INPUT_TYPE pointerType = PT_POINTER;
// default to unhandled to enable call to DefWindowProc
BOOL fHandled = FALSE;
// Retrieve common pointer information
if (!GetPointerType(pointerId, &pointerType))
{
// failure, call
GetLastError();
// set PT_POINTER to fall to default case below
pointerType = PT_POINTER;
}
switch (pointerType)
{
case (PT_PEN):
//Retrieve pen information
if (!GetPointerPenInfo(pointerId, &penInfo))
{
// failure, call
GetLastError();
}
else
{
// success, process penInfo
int xPos = GET_X_LPARAM(lParam);
int yPos = GET_Y_LPARAM(lParam);
if (IS_POINTER_INCONTACT_WPARAM(wParam))
{
printf("The pen pressure is = %d", penInfo.pressure);
}
// mark as handled to skip call to DefWindowProc
fHandled = TRUE;
}
break;
}
default:
if (!GetPointerInfo(pointerId, &pointerInfo))
{
// failure.
GetLastError();
}
else
{
// success, proceed with pointerInfo.
// fHandled = HandleGenericPointerMessage(&pointerInfo);
}
break;
}
case WM_CAPTURECHANGED: case WM_CAPTURECHANGED:
{ {
// HACK: Disable the cursor once the caption button action has been // HACK: Disable the cursor once the caption button action has been

View File

@ -27,7 +27,8 @@
//======================================================================== //========================================================================
#include "internal.h" #include "internal.h"
#include <WinUser.h>
#include <windowsx.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>