Changed how borderless setting works.
This commit is contained in:
@@ -15,6 +15,7 @@ from .paths import AppPaths
|
|||||||
|
|
||||||
|
|
||||||
SETTINGS_SCHEMA = 1
|
SETTINGS_SCHEMA = 1
|
||||||
|
_TITLE_FRAME_DEFAULT_MIGRATION_KEY = "title_frame_default_migrated"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@@ -26,7 +27,7 @@ class Settings:
|
|||||||
output_height: int = 900
|
output_height: int = 900
|
||||||
refresh_rate: int = 60
|
refresh_rate: int = 60
|
||||||
fullscreen: bool = False
|
fullscreen: bool = False
|
||||||
borderless: bool = True
|
borderless: bool = False
|
||||||
suppress_unresponsive_warnings: bool = True
|
suppress_unresponsive_warnings: bool = True
|
||||||
scaler: str = "fit"
|
scaler: str = "fit"
|
||||||
filter: str = "linear"
|
filter: str = "linear"
|
||||||
@@ -141,7 +142,7 @@ def _settings_from_object(value: dict[str, object]) -> Settings:
|
|||||||
output_height=_integer(value, "output_height", 900),
|
output_height=_integer(value, "output_height", 900),
|
||||||
refresh_rate=_integer(value, "refresh_rate", 60),
|
refresh_rate=_integer(value, "refresh_rate", 60),
|
||||||
fullscreen=_boolean(value, "fullscreen", False),
|
fullscreen=_boolean(value, "fullscreen", False),
|
||||||
borderless=_boolean(value, "borderless", True),
|
borderless=_migrated_borderless(value),
|
||||||
suppress_unresponsive_warnings=_boolean(
|
suppress_unresponsive_warnings=_boolean(
|
||||||
value,
|
value,
|
||||||
"suppress_unresponsive_warnings",
|
"suppress_unresponsive_warnings",
|
||||||
@@ -158,6 +159,22 @@ def _settings_from_object(value: dict[str, object]) -> Settings:
|
|||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
|
||||||
|
def _migrated_borderless(value: dict[str, object]) -> bool:
|
||||||
|
"""Retire the old implicit borderless default exactly once.
|
||||||
|
|
||||||
|
Older releases wrote ``borderless=true`` for every default installation, so
|
||||||
|
they cannot distinguish an inherited value from an explicit choice. The
|
||||||
|
migration marker keeps schema 1 backward compatible while letting users opt
|
||||||
|
back into Borderless after the decorated default has been applied.
|
||||||
|
"""
|
||||||
|
|
||||||
|
borderless = _boolean(value, "borderless", False)
|
||||||
|
migrated = _boolean(value, _TITLE_FRAME_DEFAULT_MIGRATION_KEY, False)
|
||||||
|
if not migrated:
|
||||||
|
return False
|
||||||
|
return borderless
|
||||||
|
|
||||||
|
|
||||||
def _decode_settings(content: bytes) -> str:
|
def _decode_settings(content: bytes) -> str:
|
||||||
"""Accept native UTF-8 plus settings saved by common Windows editors."""
|
"""Accept native UTF-8 plus settings saved by common Windows editors."""
|
||||||
|
|
||||||
@@ -174,6 +191,7 @@ def _settings_need_migration(value: dict[str, object]) -> bool:
|
|||||||
return (
|
return (
|
||||||
value.get("schema") != SETTINGS_SCHEMA
|
value.get("schema") != SETTINGS_SCHEMA
|
||||||
or not _SETTINGS_FIELD_NAMES.issubset(value)
|
or not _SETTINGS_FIELD_NAMES.issubset(value)
|
||||||
|
or value.get(_TITLE_FRAME_DEFAULT_MIGRATION_KEY) is not True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -185,6 +203,7 @@ def _write_settings(
|
|||||||
payload = dict(existing or {})
|
payload = dict(existing or {})
|
||||||
payload.update(asdict(settings))
|
payload.update(asdict(settings))
|
||||||
payload["schema"] = SETTINGS_SCHEMA
|
payload["schema"] = SETTINGS_SCHEMA
|
||||||
|
payload[_TITLE_FRAME_DEFAULT_MIGRATION_KEY] = True
|
||||||
temporary = paths.settings_file.with_name(
|
temporary = paths.settings_file.with_name(
|
||||||
f".{paths.settings_file.name}.{os.getpid()}.{threading.get_ident()}."
|
f".{paths.settings_file.name}.{os.getpid()}.{threading.get_ident()}."
|
||||||
f"{secrets.token_hex(8)}.tmp"
|
f"{secrets.token_hex(8)}.tmp"
|
||||||
|
|||||||
@@ -3411,12 +3411,14 @@ def run_dashboard(paths: AppPaths) -> None:
|
|||||||
speed_text.set("")
|
speed_text.set("")
|
||||||
progress_bar.stop()
|
progress_bar.stop()
|
||||||
close_game_preloader()
|
close_game_preloader()
|
||||||
root.deiconify()
|
if not ready:
|
||||||
|
root.deiconify()
|
||||||
set_busy(False)
|
set_busy(False)
|
||||||
refresh_primary_action(update_activity=False)
|
refresh_primary_action(update_activity=False)
|
||||||
if ready:
|
if ready:
|
||||||
status.set("Ready for another account.")
|
status.set("Ready for another account.")
|
||||||
progress_text.set("Click Play to open another game window.")
|
progress_text.set("Click Play to open another game window.")
|
||||||
|
dashboard_chrome.minimize()
|
||||||
elif cancelled:
|
elif cancelled:
|
||||||
root.lift()
|
root.lift()
|
||||||
status.set("Game launch cancelled.")
|
status.set("Game launch cancelled.")
|
||||||
@@ -4093,8 +4095,8 @@ def run_dashboard(paths: AppPaths) -> None:
|
|||||||
ttk.Label(
|
ttk.Label(
|
||||||
display_card,
|
display_card,
|
||||||
text=(
|
text=(
|
||||||
"The launcher uses the proven client resolution and can remove the "
|
"The launcher keeps the game window's title bar by default. Enable "
|
||||||
"new game window's host decorations."
|
"Borderless only when you want to remove its host decorations."
|
||||||
),
|
),
|
||||||
style="SettingsHint.TLabel",
|
style="SettingsHint.TLabel",
|
||||||
wraplength=360,
|
wraplength=360,
|
||||||
@@ -4103,7 +4105,7 @@ def run_dashboard(paths: AppPaths) -> None:
|
|||||||
presentation.grid(row=1, column=0, columnspan=2, sticky="w")
|
presentation.grid(row=1, column=0, columnspan=2, sticky="w")
|
||||||
ttk.Checkbutton(
|
ttk.Checkbutton(
|
||||||
presentation,
|
presentation,
|
||||||
text="Borderless",
|
text="Remove title bar and borders (Borderless)",
|
||||||
variable=borderless_value,
|
variable=borderless_value,
|
||||||
style="Settings.TCheckbutton",
|
style="Settings.TCheckbutton",
|
||||||
).pack(anchor="w")
|
).pack(anchor="w")
|
||||||
|
|||||||
Reference in New Issue
Block a user