From 5b0c180a59f41d29e5fdb565cb7bca596a56ba25 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Sun, 8 Feb 2026 21:40:48 +0000 Subject: [PATCH] fix(hud): session tracking and drag improvements - main_window: Actually call hud.start_session() to reset stats and start timer - hud_overlay: Add SetWindowPos refresh after WinAPI style changes - This fixes stats not resetting and drag not working on Windows --- ui/hud_overlay.py | 13 +++++++++++++ ui/main_window.py | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/hud_overlay.py b/ui/hud_overlay.py index 0be2a07..40150a1 100644 --- a/ui/hud_overlay.py +++ b/ui/hud_overlay.py @@ -495,6 +495,13 @@ class HUDOverlay(QWidget): WS_EX_TRANSPARENT = 0x00000020 WS_EX_LAYERED = 0x00080000 + # Window refresh flags + SWP_FRAMECHANGED = 0x0020 + SWP_NOMOVE = 0x0002 + SWP_NOSIZE = 0x0001 + SWP_NOZORDER = 0x0004 + SWP_SHOWWINDOW = 0x0040 + try: hwnd = self.winId().__int__() @@ -507,6 +514,12 @@ class HUDOverlay(QWidget): style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED) ctypes.windll.user32.SetWindowLongW(hwnd, GWL_EXSTYLE, style) + + # Refresh the window to apply style changes + ctypes.windll.user32.SetWindowPos( + hwnd, 0, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_SHOWWINDOW + ) except Exception: # Fallback to Qt method if WinAPI fails self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents, enabled) diff --git a/ui/main_window.py b/ui/main_window.py index fed851d..13459d1 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -891,8 +891,10 @@ class MainWindow(QMainWindow): self.log_info("Session", f"Started session for project: {project.name}") self.session_info_label.setText(f"Session active: {project.name}") - # Show HUD + # Show HUD and start session tracking self.hud.show() + self.hud.start_session(weapon="Unknown", loadout="Default") + self.log_info("HUD", "HUD overlay shown and session tracking started") def on_start_session(self): """Handle start session button."""