sys: Fixed resize cursors not appearing in non-borderless window mode
This commit is contained in:
parent
de386a9927
commit
be37228dc6
4
lib/external/imgui/include/imgui_impl_glfw.h
vendored
4
lib/external/imgui/include/imgui_impl_glfw.h
vendored
@ -49,3 +49,7 @@ IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
|
||||
|
||||
// IMHEX PATCH BEGIN
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_SetBorderlessWindowMode(bool enabled);
|
||||
// IMHEX PATCH END
|
||||
|
10
lib/external/imgui/source/imgui_impl_glfw.cpp
vendored
10
lib/external/imgui/source/imgui_impl_glfw.cpp
vendored
@ -128,6 +128,7 @@ struct ImGui_ImplGlfw_Data
|
||||
bool WantUpdateMonitors;
|
||||
#ifdef _WIN32
|
||||
WNDPROC GlfwWndProc;
|
||||
bool BorderlessWindow; // IMHEX PATCH
|
||||
#endif
|
||||
|
||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||
@ -495,6 +496,11 @@ void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor*, int)
|
||||
bd->WantUpdateMonitors = true;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_SetBorderlessWindowMode(bool enabled) {
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
bd->BorderlessWindow = enabled;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
@ -741,12 +747,12 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
|
||||
else
|
||||
{
|
||||
// IMHEX PATCH BEGIN
|
||||
#ifndef _WIN32
|
||||
if (!bd->BorderlessWindow) {
|
||||
// Show OS mouse cursor
|
||||
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
|
||||
glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
#endif
|
||||
}
|
||||
// IMHEX PATCH END
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <dwmapi.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <imgui_impl_glfw.h>
|
||||
|
||||
namespace hex {
|
||||
|
||||
static LONG_PTR g_oldWndProc;
|
||||
@ -244,7 +246,12 @@ namespace hex {
|
||||
// Setup borderless window
|
||||
auto hwnd = glfwGetWin32Window(this->m_window);
|
||||
|
||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||
bool borderlessWindowMode = ImHexApi::System::isBorderlessWindowModeEnabled();
|
||||
|
||||
ImGui_ImplGlfw_SetBorderlessWindowMode(borderlessWindowMode);
|
||||
|
||||
|
||||
if (borderlessWindowMode) {
|
||||
g_oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc);
|
||||
|
||||
MARGINS borderless = { 1, 1, 1, 1 };
|
||||
@ -263,6 +270,9 @@ namespace hex {
|
||||
}
|
||||
|
||||
void Window::endNativeWindowFrame() {
|
||||
if (!ImHexApi::System::isBorderlessWindowModeEnabled())
|
||||
return;
|
||||
|
||||
if (g_mouseCursorIcon != ImGuiMouseCursor_None) {
|
||||
ImGui::SetMouseCursor(g_mouseCursorIcon);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ namespace hex::plugin::builtin {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::array<float, 4> m_currColor;
|
||||
std::array<float, 4> m_currColor = { 0 };
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user