Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
elif sys.platform == 'darwin':
# macOS-specific: set bundle identifier for proper .app
common_args.append('--osx-bundle-identifier=com.wowsync.app')
elif sys.platform == 'win32':
# Windows-specific: add DPI awareness manifest
manifest_path = ROOT / 'wow_sync.manifest'
if manifest_path.exists():
common_args.append(f'--manifest={manifest_path}')

print(f"Building WoW Sync for {sys.platform}...")
PyInstaller.__main__.run(common_args)
Expand Down
23 changes: 23 additions & 0 deletions wow_sync.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="WoWSync"
type="win32"
/>
<description>WoW Addon and Settings Sync</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>
</assembly>
32 changes: 32 additions & 0 deletions wow_sync/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
#!/usr/bin/env python3
import sys
import tkinter as tk
from tkinter import messagebox
from async_tkinter_loop import async_mainloop
from wow_sync.ui.main_window import MainWindow
from wow_sync.single_instance import SingleInstance


def enable_dpi_awareness():
"""Enable DPI awareness on Windows to prevent blurry UI."""
if sys.platform == 'win32':
try:
import ctypes

# Define DPI awareness constants
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = ctypes.c_void_p(-4)
PROCESS_PER_MONITOR_DPI_AWARE = 2

try:
# Try the newest API first (Windows 10 1703+)
ctypes.windll.user32.SetProcessDpiAwarenessContext(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
)
except (AttributeError, OSError):
# Fall back to SetProcessDpiAwareness (Windows 8.1+)
try:
ctypes.windll.shcore.SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)
except (AttributeError, OSError):
# Final fallback to SetProcessDPIAware (Windows Vista+)
try:
ctypes.windll.user32.SetProcessDPIAware()
except (AttributeError, OSError):
pass # DPI awareness not available
except Exception:
pass # Silently fail if DPI awareness cannot be set


def main():
# Enable DPI awareness before creating any windows
enable_dpi_awareness()
# Enforce single instance
instance_lock = SingleInstance()
if not instance_lock.acquire():
Expand Down