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
This commit is contained in:
LemonNexus 2026-02-08 21:40:48 +00:00
parent 6155aad694
commit 5b0c180a59
2 changed files with 16 additions and 1 deletions

View File

@ -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)

View File

@ -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."""