-#define _WIN32_WINNT 0x0601
+#define _WIN32_WINNT 0x0601 // Windows 7
#include "window.h"
#include "window_private.h"
#include <windowsx.h>
+#include <versionhelpers.h>
#include <msp/core/application.h>
#include <msp/core/systemerror.h>
wndcl.cbClsExtra = 0;
wndcl.cbWndExtra = sizeof(Window *);
wndcl.hInstance = reinterpret_cast<HINSTANCE>(Application::get_data());
- wndcl.hIcon = 0;
- wndcl.hCursor = LoadCursor(0, IDC_ARROW);
- wndcl.hbrBackground = 0;
- wndcl.lpszMenuName = 0;
+ wndcl.hIcon = nullptr;
+ wndcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wndcl.hbrBackground = nullptr;
+ wndcl.lpszMenuName = nullptr;
wndcl.lpszClassName = "mspgui";
- wndcl.hIconSm = 0;
+ wndcl.hIconSm = nullptr;
if(!RegisterClassEx(&wndcl))
throw system_error("RegisterClassEx");
this);
if(!priv->window)
throw system_error("CreateWindowEx");
-
- priv->cursor_in_client_area = false;
- priv->cursor_visible = true;
}
void Window::platform_cleanup()
}
if(options.fullscreen)
- SetWindowPos(priv->window, 0, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
+ SetWindowPos(priv->window, nullptr, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
else if(options.user_position)
- SetWindowPos(priv->window, 0, options.x, options.y, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
+ SetWindowPos(priv->window, nullptr, options.x, options.y, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
else
- SetWindowPos(priv->window, 0, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE|SWP_NOZORDER);
+ SetWindowPos(priv->window, nullptr, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE|SWP_NOZORDER);
}
void Window::show_cursor(bool s)
{
priv->cursor_visible = s;
if(priv->cursor_in_client_area && !s)
- SetCursor(NULL);
+ SetCursor(nullptr);
}
void Window::warp_pointer(int, int)
void Window::platform_set_touch_input()
{
- WORD winver = LOWORD(GetVersion);
- if(winver<_WIN32_WINNT)
+ if(!IsWindows7OrGreater())
{
touch_input = false;
throw runtime_error("no touch support");
case WM_SETCURSOR:
priv->cursor_in_client_area = (LOWORD(evnt.lparam)==HTCLIENT);
if(priv->cursor_in_client_area && !priv->cursor_visible)
- SetCursor(NULL);
+ SetCursor(nullptr);
else
return false;
break;