fix: crash with vulkanmod

This commit is contained in:
deechael 2024-10-12 14:23:47 +08:00
parent 981c21e3ce
commit 37f266f35f
4 changed files with 46 additions and 0 deletions

View File

@ -32,6 +32,8 @@ public class GLFWMixin {
ConcentrationConstants.LOGGER.info("Trying to modify window monitor"); ConcentrationConstants.LOGGER.info("Trying to modify window monitor");
Window windowInstance = Minecraft.getInstance().getWindow(); Window windowInstance = Minecraft.getInstance().getWindow();
if (windowInstance == null)
return;
WindowAccessor accessor = (WindowAccessor) (Object) windowInstance; WindowAccessor accessor = (WindowAccessor) (Object) windowInstance;
if (windowInstance.isFullscreen()) if (windowInstance.isFullscreen())
@ -175,6 +177,23 @@ public class GLFWMixin {
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
GLFW.glfwSetWindowAttrib(windowInstance.getWindow(), 0x20006, 0);
if (System.getProperty("os.name").contains("Windows")) {
long hWnd = GLFWNativeWin32.glfwGetWin32Window(windowInstance.getWindow());
if (hWnd != 0) {
User32.SetWindowPos(
hWnd,
User32.HWND_NOTOPMOST,
windowInstance.getX(),
windowInstance.getY(),
windowInstance.getScreenWidth(),
windowInstance.getScreenHeight(),
1027
);
User32.SetWindowLongPtr(hWnd, -16, 369229824);
User32.SetWindowLongPtr(hWnd, -20, 34340880);
}
}
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);

View File

@ -202,6 +202,15 @@ public abstract class WindowMixin {
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
if (System.getProperty("os.name").contains("Windows")) {
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
if (hWnd != 0) {
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
User32.SetWindowLongPtr(hWnd, -16, 369229824);
User32.SetWindowLongPtr(hWnd, -20, 34340880);
}
}
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);

View File

@ -222,6 +222,15 @@ public abstract class WindowMixin {
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
if (System.getProperty("os.name").contains("Windows")) {
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
if (hWnd != 0) {
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
User32.SetWindowLongPtr(hWnd, -16, 369229824);
User32.SetWindowLongPtr(hWnd, -20, 34340880);
}
}
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);

View File

@ -222,6 +222,15 @@ public abstract class WindowMixin {
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
if (System.getProperty("os.name").contains("Windows")) {
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
if (hWnd != 0) {
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
User32.SetWindowLongPtr(hWnd, -16, 369229824);
User32.SetWindowLongPtr(hWnd, -20, 34340880);
}
}
} }
} else { } else {
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE); GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);