makes various uis more compatible with high dpi monitors, adds a preference for smaller windows (#90418)

## About The Pull Request
various uis (tgui-say, vv, player panel, anything using
`/datum/browser`) would not correct for dpi. they now do

we also have a preference to allow you to have smaller windows that are
zoomed out, instead of larger windows that are not zoomed

#### of note, this does require a small change to the usage of css
viewport units, like `vh` and `vw`. they need to be fed through the
`vp(100vw)` function first. there was only one such unit in the codebase

on 4k monitor with 200% scaling:

fixed (pref on default)

![BiygmRan0QqxOMqL@2x](https://github.com/user-attachments/assets/1bdbc93c-1cd4-4a17-bf18-6cca7a5df032)

pref disabled

![DUWSVJNXt3xuQJEy@2x](https://github.com/user-attachments/assets/1b87ed9e-0498-44c4-ab1b-2c0321e70ce0)


## Why It's Good For The Game
516 fucked with uis again and this unfucks them a bit

## Changelog
🆑
qol: there's a new UI preference called UI scale which allows people
that use windows scaling to have their UIs original size with the
contents zoomed out, instead of the default, which is the UIs being
larger with the contents "normal" size
fix: various UIs did not respect windows scaling, they now do
/🆑

---------

Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
This commit is contained in:
harry
2025-04-29 17:41:07 -06:00
committed by Shadow-Quill
co-authored by harryob
parent 5785fc15d1
commit 9aefd83689
17 changed files with 136 additions and 36 deletions
+3
View File
@@ -269,3 +269,6 @@
///Which ambient sound this client is currently being provided.
var/current_ambient_sound
/// The DPI scale of the client. 1 is equivalent to 100% window scaling, 2 will be 200% window scaling
var/window_scaling
+8
View File
@@ -412,6 +412,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
)
addtimer(CALLBACK(src, PROC_REF(check_panel_loaded)), 30 SECONDS)
INVOKE_ASYNC(src, PROC_REF(acquire_dpi))
// Initialize tgui panel
tgui_panel.initialize()
@@ -1287,6 +1289,12 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
send2adminchat("Server", jointext(message_to_send, " "))
/// This grabs the DPI of the user per their skin
/client/proc/acquire_dpi()
window_scaling = text2num(winget(src, null, "dpi"))
debug_admins("scalies: [window_scaling]")
#undef ADMINSWARNED_AT
#undef CURRENT_MINUTE
#undef CURRENT_SECOND
+13
View File
@@ -82,3 +82,16 @@
/datum/preference/toggle/tgui_say_light_mode/apply_to_client(client/client)
client.tgui_say?.load()
/datum/preference/toggle/ui_scale
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "ui_scale"
savefile_identifier = PREFERENCE_PLAYER
default_value = TRUE
/datum/preference/toggle/ui_scale/apply_to_client(client/client, value)
if(!istype(client))
return
INVOKE_ASYNC(client, TYPE_VERB_REF(/client, refresh_tgui))
client.tgui_say?.load()