more win32 wrap
This commit is contained in:
18
src/gui_2.py
18
src/gui_2.py
@@ -29,6 +29,7 @@ from src import mcp_client
|
||||
from src import markdown_helper
|
||||
from src import bg_shader
|
||||
import re
|
||||
import subprocess
|
||||
if sys.platform == "win32":
|
||||
import win32gui
|
||||
import win32con
|
||||
@@ -4024,15 +4025,16 @@ def hello():
|
||||
user_scale = theme.get_current_scale()
|
||||
self.runner_params.dpi_aware_params.dpi_window_size_factor = user_scale
|
||||
|
||||
# Detect Monitor Refresh Rate for capping
|
||||
# Detect Monitor Refresh Rate for capping (Win32 only)
|
||||
fps_cap = 60.0
|
||||
try:
|
||||
# Use PowerShell to get max refresh rate across all controllers
|
||||
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
|
||||
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
|
||||
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
|
||||
if rates: fps_cap = max(rates)
|
||||
except Exception: pass
|
||||
if sys.platform == "win32":
|
||||
try:
|
||||
# Use PowerShell to get max refresh rate across all controllers
|
||||
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
|
||||
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
|
||||
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
|
||||
if rates: fps_cap = max(rates)
|
||||
except Exception: pass
|
||||
|
||||
# Enable idling with monitor refresh rate to effectively cap FPS
|
||||
self.runner_params.fps_idling.enable_idling = True
|
||||
|
||||
Reference in New Issue
Block a user