17# define _WIN32_IE 0x0501
24#include <shellscalingapi.h>
45#ifdef WITH_OPENGL_BACKEND
48#ifdef WITH_VULKAN_BACKEND
61# define VK_SEMICOLON 0xBA
64# define VK_PERIOD 0xBE
70# define VK_BACK_QUOTE 0xC0
76# define VK_BACK_SLASH 0xDC
79# define VK_EQUALS 0xBB
81#ifndef VK_OPEN_BRACKET
82# define VK_OPEN_BRACKET 0xDB
84#ifndef VK_CLOSE_BRACKET
85# define VK_CLOSE_BRACKET 0xDD
88# define VK_GR_LESS 0xE2
101#define BROKEN_PEEK_TOUCHPAD
134#ifdef WITH_INPUT_NDOF
135# define DEVICE_COUNT 2
137# define DEVICE_COUNT 1
141 memset(devices, 0,
DEVICE_COUNT *
sizeof(RAWINPUTDEVICE));
145 devices[0].usUsagePage = 0x01;
146 devices[0].usUsage = 0x06;
148#ifdef WITH_INPUT_NDOF
150 devices[1].usUsagePage = 0x01;
151 devices[1].usUsage = 0x08;
154 if (RegisterRawInputDevices(devices,
DEVICE_COUNT,
sizeof(RAWINPUTDEVICE))) {
158 GHOST_PRINTF(
"could not register for RawInput: %d\n",
int(GetLastError()));
171 SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
175 SetCurrentProcessExplicitAppUserModelID(BLENDER_WIN_APPID_16);
185#ifdef WITH_INPUT_NDOF
207 __int64 delta = perf_ticks * 1000;
217 return ::GetTickCount64();
222 ::QueryPerformanceCounter((LARGE_INTEGER *)&count);
235 int64_t t_delta = GetMessageTime() - GetTickCount();
248 return ::GetSystemMetrics(SM_CMONITORS);
253 width = ::GetSystemMetrics(SM_CXSCREEN);
254 height = ::GetSystemMetrics(SM_CYSCREEN);
259 width = ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
260 height = ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
271 const bool is_dialog,
294 GHOST_PRINT(
"GHOST_SystemWin32::createWindow(): window invalid\n");
313#ifdef WITH_VULKAN_BACKEND
314 case GHOST_kDrawingContextTypeVulkan: {
317 if (context->initializeDrawingContext()) {
325#ifdef WITH_OPENGL_BACKEND
326 case GHOST_kDrawingContextTypeOpenGL: {
328 HGLRC prev_context = wglGetCurrentContext();
329 HDC prev_hdc = wglGetCurrentDC();
331 for (
int minor = 6; minor >= 3; --minor) {
333 context_params_offscreen,
337 WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
340 (context_params_offscreen.
is_debug ? WGL_CONTEXT_DEBUG_BIT_ARB : 0),
343 if (context->initializeDrawingContext()) {
344 wglMakeCurrent(prev_hdc, prev_context);
349 wglMakeCurrent(prev_hdc, prev_context);
380 HWND wnd = CreateWindowA(
"STATIC",
382 WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
389 GetModuleHandle(
nullptr),
393 if (context->initializeDrawingContext()) {
410 bool hasEventHandled =
false;
415 if (waitForEvent && !::PeekMessage(&msg,
nullptr, 0, 0, PM_NOREMOVE)) {
425 else if (maxSleep >= 0.0) {
426 ::SetTimer(
nullptr, 0, maxSleep,
nullptr);
428 ::KillTimer(
nullptr, 0);
434 hasEventHandled =
true;
440 while (::PeekMessageW(&msg,
nullptr, 0, 0, PM_REMOVE) != 0) {
443 ::TranslateMessage(&msg);
444 ::DispatchMessageW(&msg);
445 hasEventHandled =
true;
455 }
while (waitForEvent && !hasEventHandled);
457 return hasEventHandled;
463 if (::GetCursorPos(&point)) {
473 if (!::GetActiveWindow()) {
482 if (!GetCursorPos(&point)) {
486 HDC dc = GetDC(NULL);
491 COLORREF color = GetPixel(dc, point.x, point.y);
494 if (color == CLR_INVALID) {
498 r_color[0] = GetRValue(color) / 255.0f;
499 r_color[1] = GetGValue(color) / 255.0f;
500 r_color[2] = GetBValue(color) / 255.0f;
509 if (RegOpenKeyEx(HKEY_CURRENT_USER,
"Control Panel\\Cursors", 0, KEY_READ, &hKey) ==
512 DWORD cursorSizeSetting;
513 DWORD setting_size =
sizeof(cursorSizeSetting);
514 if (RegQueryValueEx(hKey,
518 reinterpret_cast<BYTE *
>(&cursorSizeSetting),
519 &setting_size) == ERROR_SUCCESS &&
520 setting_size ==
sizeof(cursorSizeSetting))
522 size = cursorSizeSetting;
528 size = GetSystemMetrics(SM_CXCURSOR);
533 size = int(
roundf(
float(size) * 0.65f));
543 if (!GetCursorPos(&point)) {
547 HWND win = WindowFromPoint(point);
560 bool down = HIBYTE(::GetAsyncKeyState(VK_LSHIFT)) != 0;
562 down = HIBYTE(::GetAsyncKeyState(VK_RSHIFT)) != 0;
565 down = HIBYTE(::GetAsyncKeyState(VK_LMENU)) != 0;
567 down = HIBYTE(::GetAsyncKeyState(VK_RMENU)) != 0;
570 down = HIBYTE(::GetAsyncKeyState(VK_LCONTROL)) != 0;
572 down = HIBYTE(::GetAsyncKeyState(VK_RCONTROL)) != 0;
575 down = HIBYTE(::GetAsyncKeyState(VK_LWIN)) != 0;
577 down = HIBYTE(::GetAsyncKeyState(VK_RWIN)) != 0;
588 bool swapped = ::GetSystemMetrics(SM_SWAPBUTTON) == TRUE;
590 bool down = HIBYTE(::GetAsyncKeyState(VK_LBUTTON)) != 0;
593 down = HIBYTE(::GetAsyncKeyState(VK_MBUTTON)) != 0;
596 down = HIBYTE(::GetAsyncKeyState(VK_RBUTTON)) != 0;
621 InitCommonControls();
624 SetProcessDPIAware();
632 wc.style = CS_HREDRAW | CS_VREDRAW;
636 wc.hInstance = ::GetModuleHandle(0);
637 wc.hIcon = ::LoadIcon(wc.hInstance,
"APPICON");
640 ::LoadIcon(
nullptr, IDI_APPLICATION);
642 wc.hCursor = ::LoadCursor(0, IDC_ARROW);
643 wc.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
645 wc.lpszClassName =
L"GHOST_WindowClass";
648 if (::RegisterClassW(&wc) == 0) {
660 ::UnregisterClassW(
L"GHOST_WindowClass", ::GetModuleHandle(0));
667 uint msg = raw.data.keyboard.Message;
668 *r_key_down = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP;
670 return this->
convertKey(raw.data.keyboard.VKey,
671 raw.data.keyboard.MakeCode,
672 (raw.data.keyboard.Flags & (RI_KEY_E1 | RI_KEY_E0)));
689 char ch = char(MapVirtualKeyA(vKey, MAPVK_VK_TO_CHAR));
710 if (vKey == VK_OEM_7) {
713 else if (vKey == VK_OEM_8) {
714 if (PRIMARYLANGID(
lang_id_) == LANG_FRENCH) {
729 if ((vKey >=
'0') && (vKey <=
'9')) {
733 else if ((vKey >=
'A') && (vKey <=
'Z')) {
737 else if ((vKey >= VK_F1) && (vKey <= VK_F24)) {
859 if (scanCode == 0x36) {
862 else if (scanCode == 0x2a) {
896 case VK_MEDIA_PLAY_PAUSE:
902 case VK_MEDIA_PREV_TRACK:
905 case VK_MEDIA_NEXT_TRACK:
931 DWORD msgPos = ::GetMessagePos();
932 int msgPosX = GET_X_LPARAM(msgPos);
933 int msgPosY = GET_Y_LPARAM(msgPos);
934 system->
pushEvent(std::make_unique<GHOST_EventCursor>(
946 return std::make_unique<GHOST_EventButton>(event_ms, type, window,
mask, td);
958 std::vector<GHOST_WintabInfoWin32> wintabInfo;
967 bool mouseMoveHandled;
979 system->
pushEvent(std::make_unique<GHOST_EventCursor>(
988 switch (info.button) {
990 message = WM_LBUTTONDOWN;
993 message = WM_RBUTTONDOWN;
996 message = WM_MBUTTONDOWN;
1006 if (PeekMessage(&msg, window->
getHWND(), message, message, PM_NOYIELD) &&
1007 msg.message != WM_QUIT)
1011 useWintabPos = wt->
testCoordinates(msg.pt.x, msg.pt.y, info.x, info.y);
1012 if (!useWintabPos) {
1013 WINTAB_PRINTF(
" ... but associated system button mismatched position\n");
1020 PeekMessage(&msg, window->
getHWND(), message, message, PM_REMOVE | PM_NOYIELD);
1025 system->
pushEvent(std::make_unique<GHOST_EventCursor>(
1029 system->
pushEvent(std::make_unique<GHOST_EventButton>(
1030 info.time, info.type, window, info.button, info.tabletData));
1032 mouseMoveHandled =
true;
1041 if (!useWintabPos) {
1047 switch (info.button) {
1049 message = WM_LBUTTONUP;
1052 message = WM_RBUTTONUP;
1055 message = WM_MBUTTONUP;
1065 if (PeekMessage(&msg, window->
getHWND(), message, message, PM_REMOVE | PM_NOYIELD) &&
1066 msg.message != WM_QUIT)
1071 system->
pushEvent(std::make_unique<GHOST_EventButton>(
1072 info.time, info.type, window, info.button, info.tabletData));
1085 if (!mouseMoveHandled) {
1086 DWORD pos = GetMessagePos();
1087 int x = GET_X_LPARAM(pos);
1088 int y = GET_Y_LPARAM(pos);
1091 system->
pushEvent(std::make_unique<GHOST_EventCursor>(
1097 uint type,
GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam,
bool &eventHandled)
1106 std::vector<GHOST_PointerInfoWin32> pointerInfo;
1113 case WM_POINTERUPDATE: {
1116 for (uint32_t i = pointerInfo.size(); i-- > 0;) {
1117 system->
pushEvent(std::make_unique<GHOST_EventCursor>(pointerInfo[i].time,
1120 pointerInfo[i].pixelLocation.x,
1121 pointerInfo[i].pixelLocation.y,
1122 pointerInfo[i].tabletData));
1129 case WM_POINTERDOWN: {
1131 system->
pushEvent(std::make_unique<GHOST_EventCursor>(pointerInfo[0].time,
1134 pointerInfo[0].pixelLocation.x,
1135 pointerInfo[0].pixelLocation.y,
1136 pointerInfo[0].tabletData));
1137 system->
pushEvent(std::make_unique<GHOST_EventButton>(pointerInfo[0].time,
1140 pointerInfo[0].buttonMask,
1141 pointerInfo[0].tabletData));
1145 eventHandled =
true;
1149 case WM_POINTERUP: {
1150 system->
pushEvent(std::make_unique<GHOST_EventButton>(pointerInfo[0].time,
1153 pointerInfo[0].buttonMask,
1154 pointerInfo[0].tabletData));
1158 eventHandled =
true;
1178 int32_t x_screen = screen_co[0], y_screen = screen_co[1];
1183 static bool is_warping_x =
false;
1184 static bool is_warping_y =
false;
1212 bounds.
wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
1216 if (x_new != x_screen || y_new != y_screen) {
1220 if (!is_warping_x) {
1221 is_warping_x = x_new != x_screen;
1223 x_accum += (x_screen - x_new);
1227 if (!is_warping_y) {
1228 is_warping_y = y_new != y_screen;
1230 y_accum += (y_screen - y_new);
1240 is_warping_x =
false;
1241 is_warping_y =
false;
1242 x_screen += x_accum;
1243 y_screen += y_accum;
1246 return std::make_unique<GHOST_EventCursor>(
getMessageTime(system),
1251 GHOST_TABLET_DATA_NONE);
1261 int delta = GET_WHEEL_DELTA_WPARAM(wParam);
1263 if (acc * delta < 0) {
1268 int direction = (acc >= 0) ? 1 : -1;
1271 while (acc >= WHEEL_DELTA) {
1272 system->
pushEvent(std::make_unique<GHOST_EventWheel>(
1287 int delta = GET_WHEEL_DELTA_WPARAM(wParam);
1289 if (acc * delta < 0) {
1294 int direction = (acc >= 0) ? 1 : -1;
1297 while (acc >= WHEEL_DELTA) {
1298 system->
pushEvent(std::make_unique<GHOST_EventWheel>(
1306 RAWINPUT
const &raw)
1308 const char vk = raw.data.keyboard.VKey;
1309 bool key_down =
false;
1312 std::unique_ptr<GHOST_EventKey> event;
1316 constexpr USHORT ALTGR_MAKE_CODE = 0x38;
1321 if (system->
has_alt_gr_ && vk == VK_CONTROL && raw.data.keyboard.MakeCode == ALTGR_MAKE_CODE &&
1322 (raw.data.keyboard.Flags & RI_KEY_E0))
1333 bool is_repeat =
false;
1334 bool is_repeated_modifier =
false;
1336 if (HIBYTE(::GetKeyState(vk)) != 0) {
1346 if (!is_repeated_modifier) {
1347 char utf8_char[6] = {0};
1349 const BOOL has_state = GetKeyboardState((PBYTE)
state);
1350 const bool ctrl_pressed = has_state &&
state[VK_CONTROL] & 0x80;
1351 const bool alt_pressed = has_state &&
state[VK_MENU] & 0x80;
1352 const bool win_pressed = has_state && (
state[VK_LWIN] |
state[VK_RWIN]) & 0x80;
1357 if (ctrl_pressed && !alt_pressed) {
1360 else if (win_pressed) {
1366 else if (MapVirtualKeyW(vk, MAPVK_VK_TO_CHAR) != 0) {
1367 wchar_t utf16[3] = {0};
1371 if ((r = ToUnicodeEx(
1372 vk, raw.data.keyboard.MakeCode,
state, utf16, 2, 0, system->
keylayout_)))
1374 if ((r > 0 && r < 3)) {
1379 utf8_char[0] =
'\0';
1384 utf8_char[0] =
'\0';
1388#ifdef WITH_INPUT_IME
1389 if (key_down && ((utf8_char[0] & 0x80) == 0)) {
1390 const char ascii = utf8_char[0];
1391 if (window->getImeInput()->IsImeKeyEvent(ascii, key)) {
1418 auto sizeEvent = std::make_unique<GHOST_Event>(
1423 system->
pushEvent(std::move(sizeEvent));
1444 return std::make_unique<GHOST_Event>(
getMessageTime(system), type, window);
1447#ifdef WITH_INPUT_IME
1448std::unique_ptr<GHOST_Event> GHOST_SystemWin32::processImeEvent(
GHOST_TEventType type,
1453 return std::make_unique<GHOST_EventIME>(
getMessageTime(system), type, window, data);
1465 return system->
pushEvent(std::make_unique<GHOST_EventDragnDrop>(
1466 getMessageTime(system), eventType, draggedObjectType, window, mouseX, mouseY, data));
1502 minmax->ptMinTrackSize.x = 320;
1503 minmax->ptMinTrackSize.y = 240;
1506#ifdef WITH_INPUT_NDOF
1507bool GHOST_SystemWin32::processNDOF(RAWINPUT
const &raw)
1509 bool eventSent =
false;
1512 RID_DEVICE_INFO info;
1513 unsigned infoSize =
sizeof(RID_DEVICE_INFO);
1514 info.cbSize = infoSize;
1516 GetRawInputDeviceInfo(raw.header.hDevice, RIDI_DEVICEINFO, &info, &infoSize);
1518 if (info.dwType == RIM_TYPEHID) {
1519 ndof_manager_->setDevice(info.hid.dwVendorId, info.hid.dwProductId);
1522 GHOST_PRINT(
"<!> not a HID device... mouse/kb perhaps?\n");
1529 BYTE
const *
data = raw.data.hid.bRawData;
1531 BYTE packetType =
data[0];
1532 switch (packetType) {
1534 const short *axis = (
short *)(data + 1);
1536 const int t[3] = {axis[0], -axis[2], axis[1]};
1537 ndof_manager_->updateTranslation(t, now);
1539 if (raw.data.hid.dwSizeHid == 13) {
1541 const int r[3] = {-axis[3], axis[5], -axis[4]};
1542 ndof_manager_->updateRotation(r, now);
1551 const short *axis = (
short *)(data + 1);
1552 const int r[3] = {-axis[0], axis[2], -axis[1]};
1553 ndof_manager_->updateRotation(r, now);
1558 memcpy(&button_bits, data + 1,
sizeof(button_bits));
1559 ndof_manager_->updateButtonsBitmask(button_bits, now);
1565 for (
int i = 0; i < buttons.size(); i++) {
1574 for (
int i = 0; i < buttons.size(); i++) {
1589 if (active_window) {
1599 if (!active_window) {
1609 if (trackpad_info.
x != 0 || trackpad_info.
y != 0) {
1620 if (trackpad_info.
scale != 0) {
1626 trackpad_info.
scale,
1634 std::unique_ptr<GHOST_Event>
event =
nullptr;
1635 bool eventHandled =
false;
1637 LRESULT lResult = 0;
1639#ifdef WITH_INPUT_IME
1642 GHOST_ASSERT(system,
"GHOST_SystemWin32::s_wndProc(): system not initialized");
1646 if (msg == WM_NCCREATE) {
1649 HMODULE user32_ = ::LoadLibrary(
"User32.dll");
1653 "EnableNonClientDpiScaling");
1654 if (fpEnableNonClientDpiScaling) {
1655 fpEnableNonClientDpiScaling(hwnd);
1664 case WM_INPUTLANGCHANGE: {
1666#ifdef WITH_INPUT_IME
1667 window->getImeInput()->UpdateInputLanguage();
1668 window->getImeInput()->UpdateConversionStatus(hwnd);
1677 RAWINPUT *raw_ptr = &raw;
1678 uint rawSize =
sizeof(RAWINPUT);
1680 GetRawInputData((HRAWINPUT)lParam, RID_INPUT, raw_ptr, &rawSize,
sizeof(RAWINPUTHEADER));
1682 switch (raw.header.dwType) {
1683 case RIM_TYPEKEYBOARD: {
1686 GHOST_PRINT(
"GHOST_SystemWin32::wndProc: key event ");
1692#ifdef WITH_INPUT_NDOF
1694 if (system->processNDOF(raw)) {
1695 eventHandled =
true;
1703#ifdef WITH_INPUT_IME
1707 case WM_IME_NOTIFY: {
1709 if (wParam == IMN_SETOPENSTATUS || wParam == IMN_SETCONVERSIONMODE) {
1710 window->getImeInput()->UpdateConversionStatus(hwnd);
1714 case WM_IME_SETCONTEXT: {
1715 GHOST_ImeWin32 *ime = window->getImeInput();
1716 ime->UpdateInputLanguage();
1717 ime->UpdateConversionStatus(hwnd);
1718 ime->CreateImeWindow(hwnd);
1719 ime->CleanupComposition(hwnd);
1720 ime->CheckFirst(hwnd);
1723 case WM_IME_STARTCOMPOSITION: {
1724 GHOST_ImeWin32 *ime = window->getImeInput();
1725 eventHandled =
true;
1726 ime->CreateImeWindow(hwnd);
1727 ime->ResetComposition(hwnd);
1731 case WM_IME_COMPOSITION: {
1732 GHOST_ImeWin32 *ime = window->getImeInput();
1733 eventHandled =
true;
1734 ime->UpdateImeWindow(hwnd);
1735 ime->UpdateInfo(hwnd);
1736 if (ime->eventImeData.result.size()) {
1743 case WM_IME_ENDCOMPOSITION: {
1744 GHOST_ImeWin32 *ime = window->getImeInput();
1745 eventHandled =
true;
1748 ime->ResetComposition(hwnd);
1749 ime->DestroyImeWindow(hwnd);
1775 case WM_SYSDEADCHAR:
1788 case WM_SYSCOMMAND: {
1796 switch (wParam & 0xFFF0) {
1798 eventHandled =
true;
1802 ::ShowWindow(hwnd, SW_RESTORE);
1810 eventHandled =
true;
1835 case WT_CSRCHANGE: {
1841 eventHandled =
true;
1844 case WT_PROXIMITY: {
1846 if (LOWORD(lParam)) {
1852 if (HIWORD(lParam)) {
1853 WINTAB_PRINTF(
" Cursor entering or leaving hardware proximity.\n");
1856 WINTAB_PRINTF(
" Cursor neither entering nor leaving hardware proximity.\n");
1861 bool inRange = LOWORD(lParam);
1870 eventHandled =
true;
1873 case WT_INFOCHANGE: {
1883 eventHandled =
true;
1888 eventHandled =
true;
1902 case WT_CTXUPDATE: {
1906 case WT_CTXOVERLAP: {
1909 case CXS_DISABLED: {
1913 case CXS_OBSCURED: {
1927 case WM_POINTERUPDATE:
1928 case WM_POINTERDOWN:
1929 case WM_POINTERUP: {
1933 case WM_POINTERLEAVE: {
1935 POINTER_INFO pointerInfo;
1936 if (!GetPointerInfo(pointerId, &pointerInfo)) {
1941 if (pointerInfo.pointerType == PT_PEN) {
1943 eventHandled =
true;
1950 case WM_LBUTTONDOWN: {
1954 case WM_MBUTTONDOWN: {
1958 case WM_RBUTTONDOWN: {
1962 case WM_XBUTTONDOWN: {
1963 if (
short(HIWORD(wParam)) == XBUTTON1) {
1966 else if (
short(HIWORD(wParam)) == XBUTTON2) {
1971 case WM_LBUTTONUP: {
1975 case WM_MBUTTONUP: {
1979 case WM_RBUTTONUP: {
1983 case WM_XBUTTONUP: {
1984 if (
short(HIWORD(wParam)) == XBUTTON1) {
1987 else if (
short(HIWORD(wParam)) == XBUTTON2) {
1992 case WM_MOUSEMOVE: {
1995 TRACKMOUSEEVENT tme = {
sizeof(tme)};
1997 tme.dwFlags = TME_LEAVE;
2000 tme.dwFlags |= TME_HOVER;
2001 tme.dwHoverTime = 100;
2003 tme.hwndTrack = hwnd;
2004 TrackMouseEvent(&tme);
2012 const int32_t window_co[2] = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
2019 case WM_MOUSEHOVER: {
2025 HWND old_hwnd = ::GetFocus();
2026 if (old_hwnd && hwnd != old_hwnd) {
2027 HWND new_parent = ::GetParent(hwnd);
2028 HWND old_parent = ::GetParent(old_hwnd);
2029 if (hwnd == old_parent || old_hwnd == new_parent) {
2033 else if (new_parent != HWND_DESKTOP && new_parent == old_parent) {
2037 else if (!new_parent && !old_parent) {
2039 RECT new_rect, old_rect, dest_rect;
2042 DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &new_rect,
sizeof(RECT));
2043 ::InflateRect(&new_rect, -1, -1);
2044 DwmGetWindowAttribute(
2045 old_hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &old_rect,
sizeof(RECT));
2046 ::InflateRect(&old_rect, -1, -1);
2048 if (!IntersectRect(&dest_rect, &new_rect, &old_rect)) {
2055 case WM_MOUSEWHEEL: {
2064 eventHandled =
true;
2065#ifdef BROKEN_PEEK_TOUCHPAD
2066 PostMessage(hwnd, WM_USER, 0, 0);
2070 case WM_MOUSEHWHEEL: {
2072 eventHandled =
true;
2075 case WM_SETCURSOR: {
2082 if (LOWORD(lParam) == HTCLIENT) {
2094 case WM_MOUSELEAVE: {
2099 int32_t screen_co[2] = {0, 0};
2112 case WM_NCMOUSEMOVE: {
2118 case WM_NCHITTEST: {
2132 if (IsIconic(hwnd)) {
2133 ShowWindow(hwnd, SW_RESTORE);
2152 if (LOWORD(wParam) == WA_INACTIVE) {
2159 lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
2162 case WM_ENTERSIZEMOVE: {
2173 case WM_EXITSIZEMOVE: {
2187 ::ValidateRect(hwnd,
nullptr);
2190 eventHandled =
true;
2194 case WM_GETMINMAXINFO: {
2218 case WM_CAPTURECHANGED: {
2245 case WM_DPICHANGED: {
2252 RECT *
const suggestedWindowRect = (RECT *)lParam;
2257 eventHandled =
true;
2262 suggestedWindowRect->left,
2263 suggestedWindowRect->top,
2264 suggestedWindowRect->right - suggestedWindowRect->left,
2265 suggestedWindowRect->bottom - suggestedWindowRect->top,
2266 SWP_NOZORDER | SWP_NOACTIVATE);
2271 case WM_DISPLAYCHANGE: {
2279 case WM_KILLFOCUS: {
2283 if (!wParam && hwnd == ::GetActiveWindow()) {
2288 case WM_SETTINGCHANGE: {
2291 if (((
void *)lParam !=
nullptr) && (wcscmp(LPCWSTR(lParam),
L"ImmersiveColorSet") == 0))
2301 case WM_WINDOWPOSCHANGED:
2315 HBRUSH bgBrush = (HBRUSH)GetClassLongPtr(hwnd, GCLP_HBRBACKGROUND);
2318 GetClientRect(hwnd, &rect);
2319 FillRect((HDC)(wParam), &rect, bgBrush);
2322 SetClassLongPtr(hwnd, GCLP_HBRBACKGROUND, (LONG_PTR)
nullptr);
2338 case WM_NCDESTROY: {
2349 case WM_WINDOWPOSCHANGING:
2364 case WM_ACTIVATEAPP:
2380 case DM_POINTERHITTEST: {
2393 GHOST_PRINT(
"GHOST_SystemWin32::wndProc: GHOST window event before creation\n");
2405 GHOST_PRINT(
"GHOST_SystemWin32::wndProc: event without window\n");
2410 eventHandled =
true;
2413 if (!eventHandled) {
2414 lResult = ::DefWindowProcW(hwnd, msg, wParam, lParam);
2422 if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(
nullptr)) {
2424 HANDLE hData = GetClipboardData(CF_UNICODETEXT);
2425 if (hData ==
nullptr) {
2429 buffer = (
wchar_t *)GlobalLock(hData);
2439 GlobalUnlock(hData);
2444 if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(
nullptr)) {
2447 HANDLE hData = GetClipboardData(CF_TEXT);
2448 if (hData ==
nullptr) {
2452 buffer = (
char *)GlobalLock(hData);
2458 len = strlen(buffer);
2459 char *temp_buff = (
char *)malloc(
len + 1);
2460 memcpy(temp_buff, buffer,
len + 1);
2464 GlobalUnlock(hData);
2474 if (selection || !buffer) {
2478 if (OpenClipboard(
nullptr)) {
2484 HGLOBAL clipbuffer = GlobalAlloc(GMEM_MOVEABLE,
sizeof(
wchar_t) *
len);
2486 wchar_t *data = (
wchar_t *)GlobalLock(clipbuffer);
2490 GlobalUnlock(clipbuffer);
2491 SetClipboardData(CF_UNICODETEXT, clipbuffer);
2500 if (IsClipboardFormatAvailable(CF_DIBV5) ||
2501 IsClipboardFormatAvailable(RegisterClipboardFormat(
"PNG")))
2508 if (IsClipboardFormatAvailable(CF_HDROP)) {
2509 if (OpenClipboard(
nullptr)) {
2510 if (HANDLE hGlobal = GetClipboardData(CF_HDROP)) {
2511 if (HDROP hDrop =
static_cast<HDROP
>(GlobalLock(hGlobal))) {
2512 UINT fileCount = DragQueryFile(hDrop, 0xffffffff,
nullptr, 0);
2513 if (fileCount == 1) {
2514 WCHAR lpszFile[MAX_PATH] = {0};
2515 DragQueryFileW(hDrop, 0, lpszFile, MAX_PATH);
2527 GlobalUnlock(hGlobal);
2538 char *filepath =
nullptr;
2540 if (OpenClipboard(
nullptr)) {
2541 if (HANDLE hGlobal = GetClipboardData(CF_HDROP)) {
2542 if (HDROP hDrop =
static_cast<HDROP
>(GlobalLock(hGlobal))) {
2543 UINT fileCount = DragQueryFile(hDrop, 0xffffffff,
nullptr, 0);
2544 if (fileCount == 1) {
2545 WCHAR lpszFile[MAX_PATH] = {0};
2546 DragQueryFileW(hDrop, 0, lpszFile, MAX_PATH);
2549 GlobalUnlock(hGlobal);
2561 *r_height = ibuf->
y;
2563 uint *rgba =
static_cast<uint *
>(malloc(byte_count));
2565 memcpy(rgba, ibuf->
byte_data(), byte_count);
2577 HANDLE hGlobal = GetClipboardData(CF_DIBV5);
2578 if (hGlobal ==
nullptr) {
2582 BITMAPV5HEADER *bitmapV5Header = (BITMAPV5HEADER *)GlobalLock(hGlobal);
2583 if (bitmapV5Header ==
nullptr) {
2587 int offset = bitmapV5Header->bV5Size + bitmapV5Header->bV5ClrUsed *
sizeof(RGBQUAD);
2589 BYTE *buffer = (BYTE *)bitmapV5Header + offset;
2590 int bitcount = bitmapV5Header->bV5BitCount;
2591 int width = bitmapV5Header->bV5Width;
2592 int height = bitmapV5Header->bV5Height;
2596 if (
uint64_t(width) *
uint64_t(height) > (std::numeric_limits<DWORD>::max() / 4)) {
2597 GlobalUnlock(hGlobal);
2605 uint *rgba = (uint *)malloc(
uint64_t(width) * height * 4);
2606 uint8_t *target = (uint8_t *)rgba;
2608 if (bitmapV5Header->bV5Compression == BI_BITFIELDS && bitcount == 32) {
2614 const SIZE_T mask_size =
sizeof(DWORD) * 3;
2615 const SIZE_T actual_size = GlobalSize(hGlobal);
2616 const SIZE_T expected_size = offset + (SIZE_T(width) * height * 4);
2617 if (expected_size == actual_size - mask_size) {
2618 source += mask_size;
2621 DWORD ColorMasks[4];
2622 ColorMasks[0] = bitmapV5Header->bV5RedMask ? bitmapV5Header->bV5RedMask : 0xff;
2623 ColorMasks[1] = bitmapV5Header->bV5GreenMask ? bitmapV5Header->bV5GreenMask : 0xff00;
2624 ColorMasks[2] = bitmapV5Header->bV5BlueMask ? bitmapV5Header->bV5BlueMask : 0xff0000;
2625 ColorMasks[3] = bitmapV5Header->bV5AlphaMask ? bitmapV5Header->bV5AlphaMask : 0xff000000;
2628 DWORD ColorShifts[4];
2629 for (
int i = 0; i < 4; i++) {
2630 _BitScanForward(&ColorShifts[i], ColorMasks[i]);
2633 for (
int h = 0; h < height; h++) {
2634 for (
int w = 0;
w < width;
w++, target += 4, source += 4) {
2635 const DWORD *pix = (DWORD *)source;
2636 target[0] = uint8_t((*pix & ColorMasks[0]) >> ColorShifts[0]);
2637 target[1] = uint8_t((*pix & ColorMasks[1]) >> ColorShifts[1]);
2638 target[2] = uint8_t((*pix & ColorMasks[2]) >> ColorShifts[2]);
2639 target[3] = uint8_t((*pix & ColorMasks[3]) >> ColorShifts[3]);
2643 else if (bitmapV5Header->bV5Compression == BI_RGB && bitcount == 32) {
2644 for (
int h = 0; h < height; h++) {
2645 for (
int w = 0;
w < width;
w++, target += 4, source += 4) {
2646 const RGBQUAD *quad = (RGBQUAD *)source;
2647 target[0] = uint8_t(quad->rgbRed);
2648 target[1] = uint8_t(quad->rgbGreen);
2649 target[2] = uint8_t(quad->rgbBlue);
2650 target[3] = (bitmapV5Header->bV5AlphaMask) ? uint8_t(quad->rgbReserved) : 255;
2654 else if (bitmapV5Header->bV5Compression == BI_RGB && bitcount == 24) {
2655 int bytes_per_row = ((((width * bitcount) + 31) & ~31) >> 3);
2656 int slack = bytes_per_row - (width * 3);
2657 for (
int h = 0; h < height; h++, source += slack) {
2658 for (
int w = 0;
w < width;
w++, target += 4, source += 3) {
2659 const RGBTRIPLE *
triple = (RGBTRIPLE *)source;
2660 target[0] = uint8_t(
triple->rgbtRed);
2661 target[1] = uint8_t(
triple->rgbtGreen);
2662 target[2] = uint8_t(
triple->rgbtBlue);
2668 GlobalUnlock(hGlobal);
2675 HANDLE hGlobal = GetClipboardData(format);
2676 if (hGlobal ==
nullptr) {
2680 LPVOID pMem = GlobalLock(hGlobal);
2685 uint *rgba =
nullptr;
2692 *r_height = ibuf->
y;
2694 rgba = (uint *)malloc(byte_count);
2695 memcpy(rgba, ibuf->
byte_data(), byte_count);
2699 GlobalUnlock(hGlobal);
2705 if (IsClipboardFormatAvailable(CF_HDROP)) {
2709 if (!OpenClipboard(
nullptr)) {
2714 UINT cfPNG = RegisterClipboardFormat(
"PNG");
2716 for (
int cf = EnumClipboardFormats(0); cf; cf = EnumClipboardFormats(cf)) {
2717 if (
ELEM(cf, CF_DIBV5, cfPNG)) {
2720 if (cf == CF_DIBV5 || (cf == CF_BITMAP && format == cfPNG)) {
2725 uint *rgba =
nullptr;
2727 if (format == CF_DIBV5) {
2730 else if (format == cfPNG) {
2747 if (
uint64_t(width) *
uint64_t(height) > (std::numeric_limits<DWORD>::max() / 4)) {
2751 DWORD size_pixels = width * height * 4;
2753 HGLOBAL hMem = GlobalAlloc(GHND,
sizeof(BITMAPV5HEADER) + size_pixels);
2758 BITMAPV5HEADER *hdr = (BITMAPV5HEADER *)GlobalLock(hMem);
2764 hdr->bV5Size =
sizeof(BITMAPV5HEADER);
2765 hdr->bV5Width = width;
2766 hdr->bV5Height = height;
2768 hdr->bV5BitCount = 32;
2769 hdr->bV5SizeImage = size_pixels;
2770 hdr->bV5Compression = BI_BITFIELDS;
2771 hdr->bV5RedMask = 0x000000ff;
2772 hdr->bV5GreenMask = 0x0000ff00;
2773 hdr->bV5BlueMask = 0x00ff0000;
2774 hdr->bV5AlphaMask = 0xff000000;
2775 hdr->bV5CSType = LCS_sRGB;
2776 hdr->bV5Intent = LCS_GM_IMAGES;
2777 hdr->bV5ClrUsed = 0;
2779 memcpy((
char *)hdr +
sizeof(BITMAPV5HEADER), rgba, size_pixels);
2783 if (!SetClipboardData(CF_DIBV5, hMem)) {
2793 UINT cf = RegisterClipboardFormat(
"PNG");
2797 reinterpret_cast<uint8_t *
>(rgba),
nullptr, width, height, 32);
2807 HGLOBAL hMem = GlobalAlloc(GHND, encoded.
size());
2813 LPVOID pMem = GlobalLock(hMem);
2820 memcpy(pMem, encoded.
data(), encoded.
size());
2825 if (!SetClipboardData(cf, hMem)) {
2835 if (!OpenClipboard(
nullptr) || !EmptyClipboard()) {
2852 const char *message,
2853 const char *help_label,
2854 const char *continue_label,
2863 int nButtonPressed = 0;
2864 TASKDIALOGCONFIG config = {0};
2865 const TASKDIALOG_BUTTON buttons[] = {{IDOK, help_label_16}, {IDCONTINUE, continue_label_16}};
2867 config.cbSize =
sizeof(config);
2868 config.hInstance = 0;
2869 config.dwCommonButtons = 0;
2872 TD_INFORMATION_ICON);
2873 config.pszWindowTitle =
L"Blender";
2874 config.pszMainInstruction = title_16;
2875 config.pszContent = message_16;
2876 const bool has_link = link && strlen(link);
2877 config.pButtons = has_link ? buttons : buttons + 1;
2878 config.cButtons = has_link ? 2 : 1;
2880 TaskDialogIndirect(&config, &nButtonPressed,
nullptr,
nullptr);
2881 switch (nButtonPressed) {
2883 ShellExecute(
nullptr,
"open", link,
nullptr,
nullptr, SW_SHOWNORMAL);
2891 free((
void *)title_16);
2892 free((
void *)message_16);
2893 free((
void *)help_label_16);
2894 free((
void *)continue_label_16);
2904 PROCESSENTRY32 pe32 = {0};
2905 DWORD ppid = 0, pid = GetCurrentProcessId();
2906 snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
2907 if (snapshot == INVALID_HANDLE_VALUE) {
2910 pe32.dwSize =
sizeof(pe32);
2911 if (!Process32First(snapshot, &pe32)) {
2912 CloseHandle(snapshot);
2916 if (pe32.th32ProcessID == pid) {
2917 ppid = pe32.th32ParentProcessID;
2920 }
while (Process32Next(snapshot, &pe32));
2921 CloseHandle(snapshot);
2927 bool result =
false;
2928 HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
2930 GetModuleFileNameEx(handle, 0, buffer, max_len);
2933 CloseHandle(handle);
2939 HWND hwnd = GetConsoleWindow();
2942 DWORD pid = (DWORD)-1;
2944 char parent_name[MAX_PATH];
2945 bool start_from_launcher =
false;
2947 GetWindowThreadProcessId(hwnd, &pid);
2949 char *filename = strrchr(parent_name,
'\\');
2950 if (filename !=
nullptr) {
2951 start_from_launcher = strstr(filename,
"blender.exe") !=
nullptr;
2956 if (pid != (start_from_launcher ? ppid : GetCurrentProcessId())) {
2966 HWND wnd = GetConsoleWindow();
2971 ShowWindow(wnd, SW_HIDE);
2977 ShowWindow(wnd, SW_HIDE);
2982 ShowWindow(wnd, SW_SHOW);
2984 DeleteMenu(GetSystemMenu(wnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
2993 DeleteMenu(GetSystemMenu(wnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
#define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
#define GHOST_PRINTF(x,...)
#define GHOST_ASSERT(x, info)
std::array< GHOST_NDOF_ButtonT, 6 > NDOF_Button_Array
static uint * getClipboardImageFilepath(int *r_width, int *r_height)
static void initRawInput()
static bool putClipboardImageDibV5(uint *rgba, int width, int height)
static uint * getClipboardImageImBuf(int *r_width, int *r_height, UINT format)
static const std::map< uint16_t, GHOST_NDOF_ButtonT > longButtonHIDsToGHOST_NDOFButtons
static GHOST_NDOF_ButtonT translateLongButtonToNDOFButton(uint16_t longKey)
static bool isStartedFromCommandPrompt()
BOOL(API *) GHOST_WIN32_EnableNonClientDpiScaling(HWND)
static uint * getClipboardImageDibV5(int *r_width, int *r_height)
static bool putClipboardImagePNG(uint *rgba, int width, int height)
static uint64_t getMessageTime(GHOST_SystemWin32 *system)
static DWORD GetParentProcessID(void)
static bool getProcessName(int pid, char *buffer, int max_len)
@ GHOST_kEventWheelAxisVertical
@ GHOST_kEventWheelAxisHorizontal
@ GHOST_kTrackpadEventMagnify
@ GHOST_kTrackpadEventScroll
@ GHOST_kWindowStateMinimized
@ GHOST_kStandardCursorDefault
@ GHOST_NDOF_BUTTON_TILT_CCW
@ GHOST_NDOF_BUTTON_SAVE_V1
@ GHOST_NDOF_BUTTON_ROLL_CCW
@ GHOST_NDOF_BUTTON_SPIN_CCW
@ GHOST_NDOF_BUTTON_SAVE_V3
@ GHOST_NDOF_BUTTON_SAVE_V2
@ GHOST_NDOF_BUTTON_BOTTOM
@ GHOST_kEventWindowClose
@ GHOST_kEventImeComposition
@ GHOST_kEventWindowActivate
@ GHOST_kEventWindowUpdate
@ GHOST_kEventWindowDeactivate
@ GHOST_kEventImeCompositionStart
@ GHOST_kEventImeCompositionEnd
@ GHOST_kEventWindowDPIHintChanged
#define GHOST_KEY_MODIFIER_CHECK(key)
@ GHOST_kCapabilityClipboardPrimary
@ GHOST_kCapabilityKeyboardHyperKey
@ GHOST_kCapabilityCursorGenerator
@ GHOST_kCapabilityWindowPath
#define GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS(gpu_settings)
#define GHOST_CAPABILITY_FLAG_ALL
@ GHOST_kKeyNumpadAsterisk
@ GHOST_kModifierKeyRightControl
@ GHOST_kModifierKeyLeftControl
@ GHOST_kModifierKeyRightAlt
@ GHOST_kModifierKeyRightShift
@ GHOST_kModifierKeyLeftAlt
@ GHOST_kModifierKeyLeftShift
@ GHOST_kModifierKeyLeftOS
@ GHOST_kModifierKeyRightOS
#define GHOST_CONTEXT_PARAMS_NONE
#define GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS_OFFSCREEN(gpu_settings)
@ GHOST_kButtonMaskButton4
@ GHOST_kButtonMaskButton5
@ GHOST_kButtonMaskMiddle
GHOST_TConsoleWindowState
@ GHOST_kConsoleWindowStateShow
@ GHOST_kConsoleWindowStateHideForNonConsoleLaunch
@ GHOST_kConsoleWindowStateHide
@ GHOST_kConsoleWindowStateToggle
@ GHOST_kTabletWinPointer
#define GET_POINTERID_WPARAM(wParam)
#define WINTAB_PRINTF(x,...)
unsigned long long int uint64_t
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar triple(const btVector3 &v1, const btVector3 &v2) const
GHOST_ContextD3D(const GHOST_ContextParams &context_params, HWND hWnd)
GHOST_ContextVK(const GHOST_ContextParams &context_params, GHOST_TVulkanPlatformType platform, Window window, Display *display, wl_surface *wayland_surface, wl_display *wayland_display, const GHOST_ContextVK_WindowInfo *wayland_window_info, int contextMajorVersion, int contextMinorVersion, const GHOST_GPUDevice &preferred_device, const GHOST_WindowHDRInfo *hdr_info_=nullptr)
GHOST_ContextWGL(const GHOST_ContextParams &context_params, bool alphaBackground, HWND hWnd, HDC hDC, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, int contextFlags, int contextResetNotificationStrategy)
void removeTypeEvents(GHOST_TEventType type, const GHOST_IWindow *window=nullptr)
static GHOST_ISystem * getSystem()
GHOST_NDOFManagerWin32(GHOST_System &)
virtual void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
virtual int32_t getWidth() const
GHOST_TKey hardKey(RAWINPUT const &raw, bool *r_key_down)
void setTabletAPI(GHOST_TTabletAPI api) override
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override
GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_GPUSettings gpu_settings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parent_window=nullptr) override
GHOST_TKey processSpecialKey(short vKey, short scanCode) const
GHOST_TKey convertKey(short vKey, short ScanCode, short extend) const
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override
int wheel_delta_accum_horizontal_
GHOST_TSuccess showMessageBox(const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options) const override
static void processWheelEventHorizontal(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override
static GHOST_ContextD3D * createOffscreenContextD3D()
static GHOST_TSuccess disposeContextD3D(GHOST_ContextD3D *context)
GHOST_TSuccess hasClipboardImage() const override
static void processWintabEvent(GHOST_WindowWin32 *window)
bool has_performance_counter_
uint64_t performanceCounterToMillis(__int64 perf_ticks) const
static std::unique_ptr< GHOST_EventButton > processButtonEvent(GHOST_TEventType type, GHOST_WindowWin32 *window, GHOST_TButton mask)
uint * getClipboardImage(int *r_width, int *r_height) const override
GHOST_TCapabilityFlag getCapabilities() const override
void initDebug(GHOST_Debug debug) override
char * getClipboard(bool selection) const override
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override
uint8_t getNumDisplays() const override
static std::unique_ptr< GHOST_Event > processWindowEvent(GHOST_TEventType type, GHOST_WindowWin32 *window)
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override
static void processMinMaxInfo(MINMAXINFO *minmax)
static void processWheelEventVertical(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
void putClipboard(const char *buffer, bool selection) const override
static std::unique_ptr< GHOST_EventCursor > processCursorEvent(GHOST_WindowWin32 *window, const int32_t screen_co[2])
uint32_t getCursorPreferredLogicalSize() const override
static std::unique_ptr< GHOST_EventKey > processKeyEvent(GHOST_WindowWin32 *window, RAWINPUT const &raw)
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override
GHOST_TSuccess init() override
bool setConsoleWindowState(GHOST_TConsoleWindowState action) override
GHOST_TSuccess exit() override
bool processEvents(bool waitForEvent) override
static void processPointerEvent(UINT type, GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam, bool &eventhandled)
~GHOST_SystemWin32() override
uint64_t getMilliSeconds() const override
void handleKeyboardChange()
int wheel_delta_accum_vertical_
GHOST_IWindow * getWindowUnderCursor(int32_t, int32_t) override
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override
static LRESULT WINAPI s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
static std::unique_ptr< GHOST_Event > processWindowSizeEvent(GHOST_WindowWin32 *window)
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowWin32 *window, int mouseX, int mouseY, void *data)
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override
GHOST_TSuccess disposeContext(GHOST_IContext *context) override
GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpu_settings) override
GHOST_EventManager * getEventManager() const
GHOST_WindowManager * getWindowManager() const
GHOST_WindowManager * window_manager_
GHOST_TSuccess init() override
GHOST_TimerManager * getTimerManager() const
void initDebug(GHOST_Debug debug) override
void setTabletAPI(GHOST_TTabletAPI api) override
GHOST_TSuccess pushEvent(std::unique_ptr< const GHOST_IEvent > event)
bool multitouch_gestures_
GHOST_TSuccess exit() override
GHOST_EventManager * event_manager_
void dispatchEvents() override
bool fireTimers(uint64_t time)
GHOST_TSuccess addWindow(GHOST_IWindow *window)
GHOST_IWindow * getWindowAssociatedWithOSWindow(const void *osWindow)
const std::vector< GHOST_IWindow * > & getWindows() const
GHOST_IWindow * getActiveWindow() const
GHOST_TSuccess setActiveWindow(GHOST_IWindow *window)
void setWindowInactive(const GHOST_IWindow *window)
void resetPointerPenInfo()
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TTrackpadInfo getTrackpadInfo()
void updateDirectManipulation()
bool getValid() const override
void getClientBounds(GHOST_Rect &bounds) const override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
bool usingTabletAPI(GHOST_TTabletAPI api) const
GHOST_TSuccess getPointerInfo(std::vector< GHOST_PointerInfoWin32 > &outPointerInfo, WPARAM wParam, LPARAM lParam)
void loadWintab(bool enable)
GHOST_TabletData getTabletData()
GHOST_Wintab * getWintab() const
void updateMouseCapture(GHOST_MouseCaptureEventWin32 event)
GHOST_TWindowState getState() const override
void onPointerHitTest(WPARAM wParam)
GHOST_WindowWin32(GHOST_SystemWin32 *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, const GHOST_ContextParams &context_params, GHOST_WindowWin32 *parent_window, bool dialog, const GHOST_GPUDevice &preferred_device)
void loadCursor(bool visible, GHOST_TStandardCursor cursor_shape) const
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const
void setCursorGrabAccum(int32_t x, int32_t y)
GHOST_TAxisFlag getCursorGrabAxis() const
GHOST_TStandardCursor getCursorShape() const override
bool getCursorVisibility() const override
GHOST_TGrabCursorMode getCursorGrabMode() const
bool getCursorGrabModeIsWarp() const
void getCursorGrabAccum(int32_t &x, int32_t &y) const
void mapWintabToSysCoordinates(int x_in, int y_in, int &x_out, int &y_out)
GHOST_TabletData getLastTabletData()
void getInput(std::vector< GHOST_WintabInfoWin32 > &outWintabInfo)
void processInfoChange(LPARAM lParam)
bool testCoordinates(int sysX, int sysY, int wtX, int wtY)
static void setDebug(bool debug)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
Vector< uint8_t > IMB_save_image_to_buffer(ImBuf *ibuf, ImBufFlags flags)
ImBuf * IMB_load_image_from_filepath(const char *filepath, ImBufFlags flags, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
void IMB_freeImBuf(ImBuf *ibuf)
BMesh const char void * data
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, size_t size, ImBufFlags flags, const char *descr, const char *filepath=nullptr, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
ImBuf * IMB_allocFromBuffer(const uint8_t *byte_buffer, const float *float_buffer, unsigned int w, unsigned int h, unsigned int channels)
GHOST_TDrawingContextType context_type
GHOST_GPUDevice preferred_device
void set(GHOST_TModifierKey mask, bool down)
bool isScrollDirectionInverted
ImbFormatOptions foptions
const uint8_t * byte_data() const
wchar_t * alloc_utf16_from_8(const char *in8, size_t add)
char * alloc_utf_8_from_16(const wchar_t *in16, size_t add)
int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8)
size_t count_utf_16_from_8(const char *string8)
#define UTF16_ENCODE(in8str)
#define UTF16_UN_ENCODE(in8str)