Lines Matching refs:window

39 // Returns the window style for the specified window
41 static DWORD getWindowStyle(const _GLFWwindow* window)
45 if (window->monitor)
51 if (window->decorated)
55 if (window->resizable)
65 // Returns the extended window style for the specified window
67 static DWORD getWindowExStyle(const _GLFWwindow* window)
71 if (window->monitor || window->floating)
190 static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
193 const float ratio = (float) window->numer / (float) window->denom;
194 const DWORD style = getWindowStyle(window);
195 const DWORD exStyle = getWindowExStyle(window);
200 GetDpiForWindow(window->win32.handle));
225 static void updateCursorImage(_GLFWwindow* window)
227 if (window->cursorMode == GLFW_CURSOR_NORMAL ||
228 window->cursorMode == GLFW_CURSOR_CAPTURED)
230 if (window->cursor)
231 SetCursor(window->cursor->win32.handle);
244 // Sets the cursor clip rect to the window content area
246 static void captureCursor(_GLFWwindow* window)
249 GetClientRect(window->win32.handle, &clipRect);
250 ClientToScreen(window->win32.handle, (POINT*) &clipRect.left);
251 ClientToScreen(window->win32.handle, (POINT*) &clipRect.right);
253 _glfw.win32.capturedCursorWindow = window;
264 // Enables WM_INPUT messages for the mouse for the specified window
266 static void enableRawMouseMotion(_GLFWwindow* window)
268 const RAWINPUTDEVICE rid = { 0x01, 0x02, 0, window->win32.handle };
279 static void disableRawMouseMotion(_GLFWwindow* window)
290 // Apply disabled cursor mode to a focused window
292 static void disableCursor(_GLFWwindow* window)
294 _glfw.win32.disabledCursorWindow = window;
295 _glfwGetCursorPosWin32(window,
298 updateCursorImage(window);
299 _glfwCenterCursorInContentArea(window);
300 captureCursor(window);
302 if (window->rawMouseMotion)
303 enableRawMouseMotion(window);
306 // Exit disabled cursor mode for the specified window
308 static void enableCursor(_GLFWwindow* window)
310 if (window->rawMouseMotion)
311 disableRawMouseMotion(window);
315 _glfwSetCursorPosWin32(window,
318 updateCursorImage(window);
321 // Returns whether the cursor is in the content area of the specified window
323 static GLFWbool cursorInContentArea(_GLFWwindow* window)
331 if (WindowFromPoint(pos) != window->win32.handle)
334 GetClientRect(window->win32.handle, &area);
335 ClientToScreen(window->win32.handle, (POINT*) &area.left);
336 ClientToScreen(window->win32.handle, (POINT*) &area.right);
341 // Update native window styles to match attributes
343 static void updateWindowStyles(const _GLFWwindow* window)
346 DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
348 style |= getWindowStyle(window);
350 GetClientRect(window->win32.handle, &rect);
355 getWindowExStyle(window),
356 GetDpiForWindow(window->win32.handle));
359 AdjustWindowRectEx(&rect, style, FALSE, getWindowExStyle(window));
361 ClientToScreen(window->win32.handle, (POINT*) &rect.left);
362 ClientToScreen(window->win32.handle, (POINT*) &rect.right);
363 SetWindowLongW(window->win32.handle, GWL_STYLE, style);
364 SetWindowPos(window->win32.handle, HWND_TOP,
370 // Update window framebuffer transparency
372 static void updateFramebufferTransparency(const _GLFWwindow* window)
392 DwmEnableBlurBehindWindow(window->win32.handle, &bb);
398 // colorization color is opaque, because otherwise the window
403 DwmEnableBlurBehindWindow(window->win32.handle, &bb);
429 static void fitToMonitor(_GLFWwindow* window)
432 GetMonitorInfoW(window->monitor->win32.handle, &mi);
433 SetWindowPos(window->win32.handle, HWND_TOPMOST,
441 // Make the specified window and its video mode active on its monitor
443 static void acquireMonitor(_GLFWwindow* window)
455 if (!window->monitor->window)
458 _glfwSetVideoModeWin32(window->monitor, &window->videoMode);
459 _glfwInputMonitorWindow(window->monitor, window);
462 // Remove the window and restore the original video mode
464 static void releaseMonitor(_GLFWwindow* window)
466 if (window->monitor->window != window)
478 _glfwInputMonitorWindow(window->monitor, NULL);
479 _glfwRestoreVideoModeWin32(window->monitor);
482 // Manually maximize the window, for when SW_MAXIMIZE cannot be used
484 static void maximizeWindowManually(_GLFWwindow* window)
490 GetMonitorInfoW(MonitorFromWindow(window->win32.handle,
495 if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
497 rect.right = _glfw_min(rect.right, rect.left + window->maxwidth);
498 rect.bottom = _glfw_min(rect.bottom, rect.top + window->maxheight);
501 style = GetWindowLongW(window->win32.handle, GWL_STYLE);
503 SetWindowLongW(window->win32.handle, GWL_STYLE, style);
505 if (window->decorated)
507 const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
511 const UINT dpi = GetDpiForWindow(window->win32.handle);
524 SetWindowPos(window->win32.handle, HWND_TOP,
536 _GLFWwindow* window = GetPropW(hWnd, L"GLFW");
537 if (!window)
562 // HACK: Postpone cursor disabling when the window was activated by
567 window->win32.frameAction = GLFW_TRUE;
577 if (lParam == 0 && window->win32.frameAction)
579 if (window->cursorMode == GLFW_CURSOR_DISABLED)
580 disableCursor(window);
581 else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
582 captureCursor(window);
584 window->win32.frameAction = GLFW_FALSE;
592 _glfwInputWindowFocus(window, GLFW_TRUE);
596 if (window->win32.frameAction)
599 if (window->cursorMode == GLFW_CURSOR_DISABLED)
600 disableCursor(window);
601 else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
602 captureCursor(window);
609 if (window->cursorMode == GLFW_CURSOR_DISABLED)
610 enableCursor(window);
611 else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
614 if (window->monitor && window->autoIconify)
615 _glfwIconifyWindowWin32(window);
617 _glfwInputWindowFocus(window, GLFW_FALSE);
628 if (window->monitor)
641 if (!window->win32.keymenu)
652 _glfwInputWindowCloseRequest(window);
666 window->win32.highSurrogate = (WCHAR) wParam;
673 if (window->win32.highSurrogate)
675 codepoint += (window->win32.highSurrogate - 0xd800) << 10;
683 window->win32.highSurrogate = 0;
684 _glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
687 if (uMsg == WM_SYSCHAR && window->win32.keymenu)
703 _glfwInputChar(window, (uint32_t) wParam, getKeyMods(), GLFW_TRUE);
788 _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, action, mods);
789 _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, action, mods);
794 _glfwInputKey(window, key, scancode, GLFW_PRESS, mods);
795 _glfwInputKey(window, key, scancode, GLFW_RELEASE, mods);
798 _glfwInputKey(window, key, scancode, action, mods);
835 if (window->mouseButtons[i] == GLFW_PRESS)
842 _glfwInputMouseClick(window, button, action, getKeyMods());
846 if (window->mouseButtons[i] == GLFW_PRESS)
864 if (!window->win32.cursorTracked)
870 tme.hwndTrack = window->win32.handle;
873 window->win32.cursorTracked = GLFW_TRUE;
874 _glfwInputCursorEnter(window, GLFW_TRUE);
877 if (window->cursorMode == GLFW_CURSOR_DISABLED)
879 const int dx = x - window->win32.lastCursorPosX;
880 const int dy = y - window->win32.lastCursorPosY;
882 if (_glfw.win32.disabledCursorWindow != window)
884 if (window->rawMouseMotion)
887 _glfwInputCursorPos(window,
888 window->virtualCursorPosX + dx,
889 window->virtualCursorPosY + dy);
892 _glfwInputCursorPos(window, x, y);
894 window->win32.lastCursorPosX = x;
895 window->win32.lastCursorPosY = y;
907 if (_glfw.win32.disabledCursorWindow != window)
909 if (!window->rawMouseMotion)
951 ScreenToClient(window->win32.handle, &pos);
953 dx = pos.x - window->win32.lastCursorPosX;
954 dy = pos.y - window->win32.lastCursorPosY;
962 _glfwInputCursorPos(window,
963 window->virtualCursorPosX + dx,
964 window->virtualCursorPosY + dy);
966 window->win32.lastCursorPosX += dx;
967 window->win32.lastCursorPosY += dy;
973 window->win32.cursorTracked = GLFW_FALSE;
974 _glfwInputCursorEnter(window, GLFW_FALSE);
980 _glfwInputScroll(window, 0.0, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA);
988 _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0);
995 if (window->win32.frameAction)
999 // resizing the window or using the window menu
1000 if (window->cursorMode == GLFW_CURSOR_DISABLED)
1001 enableCursor(window);
1002 else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
1011 if (window->win32.frameAction)
1015 // resizing the window or using the menu
1016 if (window->cursorMode == GLFW_CURSOR_DISABLED)
1017 disableCursor(window);
1018 else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
1019 captureCursor(window);
1030 (window->win32.maximized &&
1033 if (_glfw.win32.capturedCursorWindow == window)
1034 captureCursor(window);
1036 if (window->win32.iconified != iconified)
1037 _glfwInputWindowIconify(window, iconified);
1039 if (window->win32.maximized != maximized)
1040 _glfwInputWindowMaximize(window, maximized);
1042 if (width != window->win32.width || height != window->win32.height)
1044 window->win32.width = width;
1045 window->win32.height = height;
1047 _glfwInputFramebufferSize(window, width, height);
1048 _glfwInputWindowSize(window, width, height);
1051 if (window->monitor && window->win32.iconified != iconified)
1054 releaseMonitor(window);
1057 acquireMonitor(window);
1058 fitToMonitor(window);
1062 window->win32.iconified = iconified;
1063 window->win32.maximized = maximized;
1069 if (_glfw.win32.capturedCursorWindow == window)
1070 captureCursor(window);
1073 // those macros do not handle negative window positions correctly
1074 _glfwInputWindowPos(window,
1082 if (window->numer == GLFW_DONT_CARE ||
1083 window->denom == GLFW_DONT_CARE)
1088 applyAspectRatio(window, (int) wParam, (RECT*) lParam);
1096 const DWORD style = getWindowStyle(window);
1097 const DWORD exStyle = getWindowExStyle(window);
1099 if (window->monitor)
1105 GetDpiForWindow(window->win32.handle));
1110 if (window->minwidth != GLFW_DONT_CARE &&
1111 window->minheight != GLFW_DONT_CARE)
1113 mmi->ptMinTrackSize.x = window->minwidth + frame.right - frame.left;
1114 mmi->ptMinTrackSize.y = window->minheight + frame.bottom - frame.top;
1117 if (window->maxwidth != GLFW_DONT_CARE &&
1118 window->maxheight != GLFW_DONT_CARE)
1120 mmi->ptMaxTrackSize.x = window->maxwidth + frame.right - frame.left;
1121 mmi->ptMaxTrackSize.y = window->maxheight + frame.bottom - frame.top;
1124 if (!window->decorated)
1127 const HMONITOR mh = MonitorFromWindow(window->win32.handle,
1145 _glfwInputWindowDamage(window);
1158 // undecorated window
1159 if (!window->decorated)
1168 if (window->win32.transparent)
1169 updateFramebufferTransparency(window);
1175 if (window->win32.scaleToMonitor)
1178 // Adjust the window size to keep the content area size constant
1184 AdjustWindowRectExForDpi(&source, getWindowStyle(window),
1185 FALSE, getWindowExStyle(window),
1186 GetDpiForWindow(window->win32.handle));
1187 AdjustWindowRectExForDpi(&target, getWindowStyle(window),
1188 FALSE, getWindowExStyle(window),
1208 if (!window->monitor &&
1209 (window->win32.scaleToMonitor ||
1213 SetWindowPos(window->win32.handle, HWND_TOP,
1221 _glfwInputWindowContentScale(window, xscale, yscale);
1229 updateCursorImage(window);
1247 _glfwInputCursorPos(window, pt.x, pt.y);
1260 _glfwInputDrop(window, count, (const char**) paths);
1274 // Creates the GLFW window
1276 static int createNativeWindow(_GLFWwindow* window,
1282 DWORD style = getWindowStyle(window);
1283 DWORD exStyle = getWindowExStyle(window);
1313 "Win32: Failed to register window class");
1346 if (window->monitor)
1349 GetMonitorInfoW(window->monitor->win32.handle, &mi);
1351 // NOTE: This window placement is temporary and approximate, as the
1363 window->win32.maximized = wndconfig->maximized;
1388 window->win32.handle = CreateWindowExW(exStyle,
1394 NULL, // No parent window
1395 NULL, // No window menu
1401 if (!window->win32.handle)
1404 "Win32: Failed to create window");
1408 SetPropW(window->win32.handle, L"GLFW", window);
1412 ChangeWindowMessageFilterEx(window->win32.handle,
1414 ChangeWindowMessageFilterEx(window->win32.handle,
1416 ChangeWindowMessageFilterEx(window->win32.handle,
1420 window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
1421 window->win32.keymenu = wndconfig->win32.keymenu;
1422 window->win32.showDefault = wndconfig->win32.showDefault;
1424 if (!window->monitor)
1428 const HMONITOR mh = MonitorFromWindow(window->win32.handle,
1431 // Adjust window rect to account for DPI scaling of the window frame and
1433 // This cannot be done until we know what monitor the window was placed on
1434 // Only update the restored window rect as the window may be maximized
1451 GetDpiForWindow(window->win32.handle));
1456 GetWindowPlacement(window->win32.handle, &wp);
1463 SetWindowPlacement(window->win32.handle, &wp);
1465 // Adjust rect of maximized undecorated window, because by default Windows will
1466 // make such a window cover the whole monitor instead of its workarea
1473 SetWindowPos(window->win32.handle, HWND_TOP,
1482 DragAcceptFiles(window->win32.handle, TRUE);
1486 updateFramebufferTransparency(window);
1487 window->win32.transparent = GLFW_TRUE;
1490 _glfwGetWindowSizeWin32(window, &window->win32.width, &window->win32.height);
1495 GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
1500 if (!createNativeWindow(window, wndconfig, fbconfig))
1509 if (!_glfwCreateContextWGL(window, ctxconfig, fbconfig))
1516 if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
1523 if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
1527 if (!_glfwRefreshContextAttribs(window, ctxconfig))
1532 _glfwSetWindowMousePassthroughWin32(window, GLFW_TRUE);
1534 if (window->monitor)
1536 _glfwShowWindowWin32(window);
1537 _glfwFocusWindowWin32(window);
1538 acquireMonitor(window);
1539 fitToMonitor(window);
1542 _glfwCenterCursorInContentArea(window);
1548 _glfwShowWindowWin32(window);
1550 _glfwFocusWindowWin32(window);
1557 void _glfwDestroyWindowWin32(_GLFWwindow* window)
1559 if (window->monitor)
1560 releaseMonitor(window);
1562 if (window->context.destroy)
1563 window->context.destroy(window);
1565 if (_glfw.win32.disabledCursorWindow == window)
1566 enableCursor(window);
1568 if (_glfw.win32.capturedCursorWindow == window)
1571 if (window->win32.handle)
1573 RemovePropW(window->win32.handle, L"GLFW");
1574 DestroyWindow(window->win32.handle);
1575 window->win32.handle = NULL;
1578 if (window->win32.bigIcon)
1579 DestroyIcon(window->win32.bigIcon);
1581 if (window->win32.smallIcon)
1582 DestroyIcon(window->win32.smallIcon);
1585 void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title)
1591 SetWindowTextW(window->win32.handle, wideTitle);
1595 void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images)
1613 bigIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICON);
1614 smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
1617 SendMessageW(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
1618 SendMessageW(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
1620 if (window->win32.bigIcon)
1621 DestroyIcon(window->win32.bigIcon);
1623 if (window->win32.smallIcon)
1624 DestroyIcon(window->win32.smallIcon);
1628 window->win32.bigIcon = bigIcon;
1629 window->win32.smallIcon = smallIcon;
1633 void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos)
1636 ClientToScreen(window->win32.handle, &pos);
1644 void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos)
1650 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
1651 FALSE, getWindowExStyle(window),
1652 GetDpiForWindow(window->win32.handle));
1656 AdjustWindowRectEx(&rect, getWindowStyle(window),
1657 FALSE, getWindowExStyle(window));
1660 SetWindowPos(window->win32.handle, NULL, rect.left, rect.top, 0, 0,
1664 void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height)
1667 GetClientRect(window->win32.handle, &area);
1675 void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
1677 if (window->monitor)
1679 if (window->monitor->window == window)
1681 acquireMonitor(window);
1682 fitToMonitor(window);
1691 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
1692 FALSE, getWindowExStyle(window),
1693 GetDpiForWindow(window->win32.handle));
1697 AdjustWindowRectEx(&rect, getWindowStyle(window),
1698 FALSE, getWindowExStyle(window));
1701 SetWindowPos(window->win32.handle, HWND_TOP,
1707 void _glfwSetWindowSizeLimitsWin32(_GLFWwindow* window,
1719 GetWindowRect(window->win32.handle, &area);
1720 MoveWindow(window->win32.handle,
1726 void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom)
1733 GetWindowRect(window->win32.handle, &area);
1734 applyAspectRatio(window, WMSZ_BOTTOMRIGHT, &area);
1735 MoveWindow(window->win32.handle,
1741 void _glfwGetFramebufferSizeWin32(_GLFWwindow* window, int* width, int* height)
1743 _glfwGetWindowSizeWin32(window, width, height);
1746 void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window,
1753 _glfwGetWindowSizeWin32(window, &width, &height);
1758 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
1759 FALSE, getWindowExStyle(window),
1760 GetDpiForWindow(window->win32.handle));
1764 AdjustWindowRectEx(&rect, getWindowStyle(window),
1765 FALSE, getWindowExStyle(window));
1778 void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float* yscale)
1780 const HANDLE handle = MonitorFromWindow(window->win32.handle,
1785 void _glfwIconifyWindowWin32(_GLFWwindow* window)
1787 ShowWindow(window->win32.handle, SW_MINIMIZE);
1790 void _glfwRestoreWindowWin32(_GLFWwindow* window)
1792 ShowWindow(window->win32.handle, SW_RESTORE);
1795 void _glfwMaximizeWindowWin32(_GLFWwindow* window)
1797 if (IsWindowVisible(window->win32.handle))
1798 ShowWindow(window->win32.handle, SW_MAXIMIZE);
1800 maximizeWindowManually(window);
1803 void _glfwShowWindowWin32(_GLFWwindow* window)
1807 if (window->win32.showDefault)
1810 // a main window, so even SW_SHOWDEFAULT does nothing
1818 window->win32.showDefault = GLFW_FALSE;
1821 ShowWindow(window->win32.handle, showCommand);
1824 void _glfwHideWindowWin32(_GLFWwindow* window)
1826 ShowWindow(window->win32.handle, SW_HIDE);
1829 void _glfwRequestWindowAttentionWin32(_GLFWwindow* window)
1831 FlashWindow(window->win32.handle, TRUE);
1834 void _glfwFocusWindowWin32(_GLFWwindow* window)
1836 BringWindowToTop(window->win32.handle);
1837 SetForegroundWindow(window->win32.handle);
1838 SetFocus(window->win32.handle);
1841 void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
1847 if (window->monitor == monitor)
1851 if (monitor->window == window)
1853 acquireMonitor(window);
1854 fitToMonitor(window);
1863 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
1864 FALSE, getWindowExStyle(window),
1865 GetDpiForWindow(window->win32.handle));
1869 AdjustWindowRectEx(&rect, getWindowStyle(window),
1870 FALSE, getWindowExStyle(window));
1873 SetWindowPos(window->win32.handle, HWND_TOP,
1882 if (window->monitor)
1883 releaseMonitor(window);
1885 _glfwInputWindowMonitor(window, monitor);
1887 if (window->monitor)
1892 if (window->decorated)
1894 DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
1896 style |= getWindowStyle(window);
1897 SetWindowLongW(window->win32.handle, GWL_STYLE, style);
1901 acquireMonitor(window);
1903 GetMonitorInfoW(window->monitor->win32.handle, &mi);
1904 SetWindowPos(window->win32.handle, HWND_TOPMOST,
1915 DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
1918 if (window->decorated)
1921 style |= getWindowStyle(window);
1922 SetWindowLongW(window->win32.handle, GWL_STYLE, style);
1927 if (window->floating)
1934 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
1935 FALSE, getWindowExStyle(window),
1936 GetDpiForWindow(window->win32.handle));
1940 AdjustWindowRectEx(&rect, getWindowStyle(window),
1941 FALSE, getWindowExStyle(window));
1944 SetWindowPos(window->win32.handle, after,
1951 GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window)
1953 return window->win32.handle == GetActiveWindow();
1956 GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window)
1958 return IsIconic(window->win32.handle);
1961 GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window)
1963 return IsWindowVisible(window->win32.handle);
1966 GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window)
1968 return IsZoomed(window->win32.handle);
1971 GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window)
1973 return cursorInContentArea(window);
1976 GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window)
1981 if (!window->win32.transparent)
1993 // colorization color is opaque, because otherwise the window
2003 void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled)
2005 updateWindowStyles(window);
2008 void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled)
2010 updateWindowStyles(window);
2013 void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled)
2016 SetWindowPos(window->win32.handle, after, 0, 0, 0, 0,
2020 void _glfwSetWindowMousePassthroughWin32(_GLFWwindow* window, GLFWbool enabled)
2025 DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
2028 GetLayeredWindowAttributes(window->win32.handle, &key, &alpha, &flags);
2035 // NOTE: Window opacity also needs the layered window style so do not
2036 // remove it if the window is alpha blended
2044 SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
2047 SetLayeredWindowAttributes(window->win32.handle, key, alpha, flags);
2050 float _glfwGetWindowOpacityWin32(_GLFWwindow* window)
2055 if ((GetWindowLongW(window->win32.handle, GWL_EXSTYLE) & WS_EX_LAYERED) &&
2056 GetLayeredWindowAttributes(window->win32.handle, NULL, &alpha, &flags))
2065 void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity)
2067 LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
2072 SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
2073 SetLayeredWindowAttributes(window->win32.handle, 0, alpha, LWA_ALPHA);
2077 SetLayeredWindowAttributes(window->win32.handle, 0, 0, 0);
2082 SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
2086 void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled)
2088 if (_glfw.win32.disabledCursorWindow != window)
2092 enableRawMouseMotion(window);
2094 disableRawMouseMotion(window);
2106 _GLFWwindow* window;
2116 window = _glfw.windowListHead;
2117 while (window)
2119 _glfwInputWindowCloseRequest(window);
2120 window = window->next;
2140 window = GetPropW(handle, L"GLFW");
2141 if (window)
2160 if (window->keys[key] != GLFW_PRESS)
2163 _glfwInputKey(window, key, scancode, GLFW_RELEASE, getKeyMods());
2168 window = _glfw.win32.disabledCursorWindow;
2169 if (window)
2172 _glfwGetWindowSizeWin32(window, &width, &height);
2177 if (window->win32.lastCursorPosX != width / 2 ||
2178 window->win32.lastCursorPosY != height / 2)
2180 _glfwSetCursorPosWin32(window, width / 2, height / 2);
2204 void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos)
2210 ScreenToClient(window->win32.handle, &pos);
2219 void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos)
2224 window->win32.lastCursorPosX = pos.x;
2225 window->win32.lastCursorPosY = pos.y;
2227 ClientToScreen(window->win32.handle, &pos);
2231 void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode)
2233 if (_glfwWindowFocusedWin32(window))
2237 _glfwGetCursorPosWin32(window,
2240 _glfwCenterCursorInContentArea(window);
2241 if (window->rawMouseMotion)
2242 enableRawMouseMotion(window);
2244 else if (_glfw.win32.disabledCursorWindow == window)
2246 if (window->rawMouseMotion)
2247 disableRawMouseMotion(window);
2251 captureCursor(window);
2256 _glfw.win32.disabledCursorWindow = window;
2257 else if (_glfw.win32.disabledCursorWindow == window)
2260 _glfwSetCursorPosWin32(window,
2266 if (cursorInContentArea(window))
2267 updateCursorImage(window);
2361 void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
2363 if (cursorInContentArea(window))
2364 updateCursorImage(window);
2512 EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window)
2514 return window->win32.handle;
2545 _GLFWwindow* window,
2565 sci.hwnd = window->win32.handle;
2589 _GLFWwindow* window = (_GLFWwindow*) handle;
2590 assert(window != NULL);
2592 return window->win32.handle;