internal/glfw/glfw: Modify GLFW for Windows to make the window non-floating

Closes #1506
This commit is contained in:
Hajime Hoshi 2021-09-18 20:39:24 +09:00
parent 7be00d79e8
commit 1a7cf7b3b8
7 changed files with 47 additions and 14 deletions

View File

@ -1,6 +1,8 @@
These files are basically copy of github.com/v3.3/glfw/glfw. These files are basically copy of github.com/v3.3/glfw/glfw.
There is one change from the original files: `GLFWscrollfun` takes pointers instead of values since all arguments of C functions have to be 32bit on 32bit Windows machine. There is one change from the original files.
`GLFWscrollfun` takes pointers instead of values since all arguments of C functions have to be 32bit on 32bit Windows machine.
```diff ```diff
diff --git a/tmp/glfw-3.3.3/include/GLFW/glfw3.h b/./internal/glfw/glfw/include/GLFW/glfw3.h diff --git a/tmp/glfw-3.3.3/include/GLFW/glfw3.h b/./internal/glfw/glfw/include/GLFW/glfw3.h
@ -33,3 +35,39 @@ index 337d5cf0..4ac555cb 100644
// Notifies shared code of a mouse button click event // Notifies shared code of a mouse button click event
``` ```
A fullscreened window doesn't float (#1506, glfw/glfw#1967).
```diff
diff --git a/tmp/glfw-3.3.4/src/win32_window.c b/./internal/glfw/glfw/src/win32_window.c
index d17b6da4..17e2f842 100644
--- a/tmp/glfw-3.3.4/src/win32_window.c
+++ b/./internal/glfw/glfw/src/win32_window.c
@@ -68,7 +68,7 @@ static DWORD getWindowExStyle(const _GLFWwindow* window)
{
DWORD style = WS_EX_APPWINDOW;
- if (window->monitor || window->floating)
+ if (window->floating)
style |= WS_EX_TOPMOST;
return style;
@@ -436,7 +436,7 @@ static void fitToMonitor(_GLFWwindow* window)
{
MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(window->monitor->win32.handle, &mi);
- SetWindowPos(window->win32.handle, HWND_TOPMOST,
+ SetWindowPos(window->win32.handle, window->floating ? HWND_TOPMOST : HWND_NOTOPMOST,
mi.rcMonitor.left,
mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left,
@@ -1756,7 +1756,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
acquireMonitor(window);
GetMonitorInfo(window->monitor->win32.handle, &mi);
- SetWindowPos(window->win32.handle, HWND_TOPMOST,
+ SetWindowPos(window->win32.handle, window->floating ? HWND_TOPMOST : HWND_NOTOPMOST,
mi.rcMonitor.left,
mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left,
```

View File

@ -68,7 +68,7 @@ static DWORD getWindowExStyle(const _GLFWwindow* window)
{ {
DWORD style = WS_EX_APPWINDOW; DWORD style = WS_EX_APPWINDOW;
if (window->monitor || window->floating) if (window->floating)
style |= WS_EX_TOPMOST; style |= WS_EX_TOPMOST;
return style; return style;
@ -436,7 +436,7 @@ static void fitToMonitor(_GLFWwindow* window)
{ {
MONITORINFO mi = { sizeof(mi) }; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(window->monitor->win32.handle, &mi); GetMonitorInfo(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST, SetWindowPos(window->win32.handle, window->floating ? HWND_TOPMOST : HWND_NOTOPMOST,
mi.rcMonitor.left, mi.rcMonitor.left,
mi.rcMonitor.top, mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.right - mi.rcMonitor.left,
@ -1756,7 +1756,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
acquireMonitor(window); acquireMonitor(window);
GetMonitorInfo(window->monitor->win32.handle, &mi); GetMonitorInfo(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST, SetWindowPos(window->win32.handle, window->floating ? HWND_TOPMOST : HWND_NOTOPMOST,
mi.rcMonitor.left, mi.rcMonitor.left,
mi.rcMonitor.top, mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.right - mi.rcMonitor.left,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,4 +2,4 @@
package glfw package glfw
const glfwDLLHash = "e6422fe98c4089e2a7f8ddc41f94ecb156dfda774974326280946db1770543ba" const glfwDLLHash = "9b66cd40f92263367f0076b690cb90174cc981f0c126eb395bc4e35cd8cb767d"

View File

@ -2,4 +2,4 @@
package glfw package glfw
const glfwDLLHash = "341ab581d5dff977d7b7596a64e5a77e4e730bfce307c4dcf086ca07359a38d1" const glfwDLLHash = "654e301e14362491530e1c9e2dde434d96eb5c6b11de42af62d85d9cc170f4d8"

View File

@ -845,12 +845,7 @@ func (u *UserInterface) init() error {
glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI) glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI)
} }
// Enable auto-iconifying on Windows until some fullscreen issues are solved (#1506). glfw.WindowHint(glfw.AutoIconify, glfw.False)
if runtime.GOOS == "windows" {
glfw.WindowHint(glfw.AutoIconify, glfw.True)
} else {
glfw.WindowHint(glfw.AutoIconify, glfw.False)
}
decorated := glfw.False decorated := glfw.False
if u.isInitWindowDecorated() { if u.isInitWindowDecorated() {