ui: Fix cursor and title bar issue for sure. Fixes #302
This commit is contained in:
parent
28805bae65
commit
243820ca95
@ -26,6 +26,7 @@
|
|||||||
static LONG_PTR oldWndProc;
|
static LONG_PTR oldWndProc;
|
||||||
static float titleBarHeight;
|
static float titleBarHeight;
|
||||||
static ImGuiMouseCursor mouseCursorIcon;
|
static ImGuiMouseCursor mouseCursorIcon;
|
||||||
|
static BOOL compositionEnabled = false;
|
||||||
|
|
||||||
static bool isTaskbarAutoHideEnabled(UINT edge, RECT monitor) {
|
static bool isTaskbarAutoHideEnabled(UINT edge, RECT monitor) {
|
||||||
APPBARDATA data = { .cbSize = sizeof(APPBARDATA), .uEdge = edge, .rc = monitor };
|
APPBARDATA data = { .cbSize = sizeof(APPBARDATA), .uEdge = edge, .rc = monitor };
|
||||||
@ -156,6 +157,11 @@
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WM_NCACTIVATE:
|
||||||
|
case WM_NCPAINT:
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,11 +188,14 @@
|
|||||||
|
|
||||||
oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc);
|
oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc);
|
||||||
|
|
||||||
MARGINS borderless = {1,1,1,1};
|
MARGINS borderless = { 1, 1, 1, 1 };
|
||||||
::DwmExtendFrameIntoClientArea(hwnd, &borderless);
|
::DwmExtendFrameIntoClientArea(hwnd, &borderless);
|
||||||
|
|
||||||
|
DWORD attribute = DWMNCRP_ENABLED;
|
||||||
|
::DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &attribute, sizeof(attribute));
|
||||||
|
|
||||||
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE);
|
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE);
|
||||||
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU);
|
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW);
|
||||||
|
|
||||||
bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0;
|
bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0;
|
||||||
EventManager::subscribe<EventOSThemeChanged>(this, [themeFollowSystem]{
|
EventManager::subscribe<EventOSThemeChanged>(this, [themeFollowSystem]{
|
||||||
|
@ -84,6 +84,7 @@ namespace hex {
|
|||||||
|
|
||||||
this->initGLFW();
|
this->initGLFW();
|
||||||
this->initImGui();
|
this->initImGui();
|
||||||
|
this->setupNativeWindow();
|
||||||
|
|
||||||
EventManager::subscribe<EventSettingsChanged>(this, [this]() {
|
EventManager::subscribe<EventSettingsChanged>(this, [this]() {
|
||||||
{
|
{
|
||||||
@ -707,6 +708,8 @@ namespace hex {
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
|
||||||
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
|
||||||
this->m_windowTitle = "ImHex";
|
this->m_windowTitle = "ImHex";
|
||||||
this->m_window = glfwCreateWindow(1280 * SharedData::globalScale, 720 * SharedData::globalScale, this->m_windowTitle.c_str(), nullptr, nullptr);
|
this->m_window = glfwCreateWindow(1280 * SharedData::globalScale, 720 * SharedData::globalScale, this->m_windowTitle.c_str(), nullptr, nullptr);
|
||||||
@ -719,7 +722,19 @@ namespace hex {
|
|||||||
glfwMakeContextCurrent(this->m_window);
|
glfwMakeContextCurrent(this->m_window);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
this->setupNativeWindow();
|
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||||
|
if (monitor != nullptr) {
|
||||||
|
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||||
|
if (mode != nullptr) {
|
||||||
|
int monitorX, monitorY;
|
||||||
|
glfwGetMonitorPos(monitor, &monitorX, &monitorY);
|
||||||
|
|
||||||
|
int windowWidth, windowHeight;
|
||||||
|
glfwGetWindowSize(this->m_window, &windowWidth, &windowHeight);
|
||||||
|
|
||||||
|
glfwSetWindowPos(this->m_window, monitorX + (mode->width - windowWidth) / 2, monitorY + (mode->height - windowHeight) / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
@ -819,6 +834,8 @@ namespace hex {
|
|||||||
});
|
});
|
||||||
|
|
||||||
glfwSetWindowSizeLimits(this->m_window, 720 * SharedData::globalScale, 480 * SharedData::globalScale, GLFW_DONT_CARE, GLFW_DONT_CARE);
|
glfwSetWindowSizeLimits(this->m_window, 720 * SharedData::globalScale, 480 * SharedData::globalScale, GLFW_DONT_CARE, GLFW_DONT_CARE);
|
||||||
|
|
||||||
|
glfwShowWindow(this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::initImGui() {
|
void Window::initImGui() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user