Skip to content

yet more dpi shenanigans #8734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
31 changes: 26 additions & 5 deletions code/datums/browser.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/datum/browser
var/mob/user
var/client/user
var/title
var/window_id // window_id is used as the window name for browse and onclose
var/width = 0
Expand All @@ -18,6 +18,8 @@
var/static/datum/asset/simple/common/common_asset = get_asset_datum(/datum/asset/simple/common)
var/static/datum/asset/simple/other/other_asset = get_asset_datum(/datum/asset/simple/other)

var/existing_browser = FALSE


/datum/browser/New(nuser, nwindow_id, ntitle = 0, nstylesheet = "common.css", nwidth = 0, nheight = 0, atom/nref = null)
user = nuser
Expand Down Expand Up @@ -70,6 +72,15 @@
head_content += "<link rel='stylesheet' type='text/css' href='[common_asset.get_url_mappings()[stylesheet]]'>"
head_content += "<link rel='stylesheet' type='text/css' href='[other_asset.get_url_mappings()["loading.gif"]]'>"

if(user.window_scaling && user.window_scaling != 1 && !user.prefs.window_scale && width && height)
head_content += {"
<style>
body {
zoom: [100 / user.window_scaling]%;
}
</style>
"}

for (var/file in stylesheets)
head_content += "<link rel='stylesheet' type='text/css' href='[SSassets.transport.get_asset_url(file)]'>"

Expand Down Expand Up @@ -114,7 +125,10 @@
return
var/window_size = ""
if (width && height)
window_size = "size=[width]x[height];"
if(user.window_scaling && user.prefs.window_scale)
window_size = "size=[width * user?.window_scaling]x[height * user?.window_scaling];"
else
window_size = "size=[width]x[height];"
common_asset.send(user)
other_asset.send(user)
if (length(stylesheets))
Expand All @@ -124,6 +138,9 @@

user << browse(get_content(), "window=[window_id];[window_size][window_options]")

if(existing_browser)
winset(user, existing_browser, window_size)

if (use_onclose)
setup_onclose()

Expand Down Expand Up @@ -226,7 +243,7 @@
mob.unset_interaction()
return

/proc/show_browser(target, browser_content, browser_name, id = null, window_options = null, closeref)
/proc/show_browser(target, browser_content, browser_name, id = null, window_options = null, closeref, width, height, existing_container = FALSE)
var/client/C = target

if (ismob(target))
Expand All @@ -241,7 +258,11 @@
C.prefs.stylesheet = "Modern"
stylesheet = "Modern"

var/datum/browser/popup = new(C, id ? id : browser_name, browser_name, GLOB.stylesheets[stylesheet], nref = closeref)
var/datum/browser/popup = new(C, id ? id : browser_name, browser_name, GLOB.stylesheets[stylesheet], nwidth = width, nheight = height, nref = closeref)

if(existing_container)
popup.existing_browser = existing_container

popup.set_content(browser_content)
if (window_options)
popup.set_window_options(window_options)
Expand Down Expand Up @@ -324,7 +345,7 @@
set_content(output)

/datum/browser/modal/listpicker/Topic(href,href_list)
if (href_list["close"] || !user || !user.client)
if (href_list["close"] || !user)
opentime = 0
return
if (href_list["button"])
Expand Down
2 changes: 1 addition & 1 deletion code/datums/global_variables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

html += "</body></html>"

show_browser(usr, html, "View Global Variables", "global_variables", "size=475x650")
show_browser(usr, html, "View Global Variables", "global_variables", width = 475, height = 650)

return

Expand Down
2 changes: 1 addition & 1 deletion code/datums/matrix_editor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<a href='byond://?_src_=matrices;operation=delete'>Delete selected matrix</a>
"}

show_browser(usr, data, "Matrix Editor", "matrixeditor\ref[src]", "size=600x450")
show_browser(usr, data, "Matrix Editor", "matrixeditor\ref[src]", width = 600, height = 450)

/client/proc/matrix_editor_Topic(href, href_list)
if(!usr.client || !usr.client.admin_holder || !(usr.client.admin_holder.rights & (R_DEBUG|R_ADMIN)))
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ Parameters are passed from New.
return TRUE

if(href_list["desc_lore"])
show_browser(usr, "<BODY><TT>[replacetext(desc_lore, "\n", "<BR>")]</TT></BODY>", name, name, "size=500x500")
show_browser(usr, "<BODY><TT>[replacetext(desc_lore, "\n", "<BR>")]</TT></BODY>", name, name, width = 500, height = 500)
onclose(usr, "[name]")

///This proc is called on atoms when they are loaded into a shuttle
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/area_air_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<i>[zone]</i>
</body>
</html>"}
show_browser(user, dat, name, "miningshuttle", "size=400x400")
show_browser(user, dat, name, "miningshuttle", width = 400, height = 400)
status = ""

/obj/structure/machinery/computer/area_atmos/Topic(href, href_list)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
return FALSE

dat += "<BR>[(state != STATE_DEFAULT) ? "<A href='byond://?src=\ref[src];operation=main'>Main Menu</A>|" : ""]<A href='byond://?src=\ref[user];mach_close=communications'>Close</A>"
show_browser(user, dat, "Communications Console", "communications", "size=400x500")
show_browser(user, dat, "Communications Console", "communications", width = 400, height = 500)
onclose(user, "communications")
#undef STATE_DEFAULT
#undef STATE_MESSAGELIST
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/emails.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
var/datum/fluff_email/FE = mail
dat += "<A href='byond://?src=\ref[src];selectmail=[i]'>[FE.title]</A><BR>"

show_browser(user, dat, "Personal Computer", "email", "size=600x520")
show_browser(user, dat, "Personal Computer", "email", width = 600, height = 520)


/obj/structure/machinery/computer/emails/Topic(href, href_list)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/groundside_operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
dat += get_overwatch_info()

dat += "<BR><A href='byond://?src=\ref[user];mach_close=groundside_operations'>Close</A>"
show_browser(user, dat, name, "groundside_operations", "size=600x700")
show_browser(user, dat, name, "groundside_operations", width = 600, height = 700)
concurrent_users += WEAKREF(user)
onclose(user, "groundside_operations")

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
dat += "<br><A href='byond://?src=\ref[src];choice=Return'>Return to index.</A>"
else
dat += "<A href='byond://?src=\ref[src];choice=Log In'>{Log In}</A>"
show_browser(user, dat, "Employment Records", "secure_rec", "size=600x400")
show_browser(user, dat, "Employment Records", "secure_rec", width = 600, height = 400)
onclose(user, "secure_rec")
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/door_display/door_display.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

if(!uses_tgui)
user.set_interaction(src)
show_browser(user, display_contents(user), name, "computer", "size=400x500")
show_browser(user, display_contents(user), name, "computer", width = 400, height = 500)
return

/obj/structure/machinery/door_display/proc/display_contents(mob/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/medical_pod/autodoc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
else
dat += "The autodoc is empty."
dat += text("<a href='byond://?src=\ref[];mach_close=sleeper'>Close</a>", user)
show_browser(user, dat, "Auto-Doc Medical System", "sleeper", "size=300x400")
show_browser(user, dat, "Auto-Doc Medical System", "sleeper", width = 300, height = 400)
onclose(user, "sleeper")

/obj/structure/machinery/autodoc_console/Topic(href, href_list)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/suit_storage_unit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
dat += "<A href='byond://?src=\ref[src];start_UV=1'>Start Disinfection cycle</A><BR>"
dat += "<BR><BR><A href='byond://?src=\ref[user];mach_close=suit_storage_unit'>Close control panel</A>"

show_browser(user, dat, "Suit Storage Unit", "suit_storage_unit", "size=400x500")
show_browser(user, dat, "Suit Storage Unit", "suit_storage_unit", width = 400, height = 500)
return


Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/machine_interactions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

dat += "</font>"
temp = ""
show_browser(user, dat, "[src] Access", "tcommachine", "size=520x500;can_resize=0")
show_browser(user, dat, "[src] Access", "tcommachine", "can_resize=0", width = 520, height = 500)
onclose(user, "tcommachine")


Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/books/book.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
to_chat(user, SPAN_NOTICE("The pages of [title] have been cut out!"))
return
if(src.dat)
show_browser(user, "<body class='paper'><TT><I>Owner: [author].</I></TT> <BR>[dat]</body>", "window=book;size=800x600")
show_browser(user, "<body class='paper'><TT><I>Owner: [author].</I></TT> <BR>[dat]</body>", "window=book", width = 800, height = 600)
user.visible_message("[user] opens \"[src.title]\".")
onclose(user, "book")
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/dummy_tablet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
dat += "<BR>\[ <A href='byond://?src=\ref[src];operation=reset'>Reset</A> \]"
dat += "<BR><hr>"

show_browser(user, dat, "Professor DUMMY Control Tablet", "dummytablet", window_options="size=400x500")
show_browser(user, dat, "Professor DUMMY Control Tablet", "dummytablet", width = 400, height = 500)
onclose(user, "dummytablet")
updateDialog()
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Also change the icon to reflect the amount of sheets, if possible.*/
t1 += " <A href='byond://?src=\ref[src];make=[i];multiplier=[max_multiplier]'>[max_multiplier*R.res_amount]x</A>"

t1 += "</TT></body></HTML>"
show_browser(user, t1, "Construction using [src]", "stack")
show_browser(user, t1, "Construction using [src]", "stack", width = 440, height = 500)
return

/obj/item/stack/Topic(href, href_list)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/safe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ FLOOR SAFES
var/obj/item/P = contents[i]
dat += "<tr><td><a href='byond://?src=\ref[src];retrieve=\ref[P]'>[P.name]</a></td></tr>"
dat += "</table></center>"
show_browser(user, dat, name, "safe", "size=350x300")
show_browser(user, dat, name, "safe", width = 350, height = 300)
onclose(user, "safe")

/obj/structure/safe/Topic(href, href_list)
Expand Down
4 changes: 2 additions & 2 deletions code/game/supplyshuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
if(scramble)
paper_info = stars_decode_html(info)
// Tossing ref in widow id as this allows us to read multiple manifests at same time
show_browser(user, "<BODY class='paper'>[paper_info][stamps]</BODY>", null, "manifest\ref[src]", "size=550x650")
show_browser(user, "<BODY class='paper'>[paper_info][stamps]</BODY>", null, "manifest\ref[src]", width = 550, height = 650)
onclose(user, "manifest\ref[src]")

/obj/item/paper/manifest/proc/generate_contents()
Expand Down Expand Up @@ -1447,7 +1447,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
else
dat += "<a href='byond://?src=\ref[src];get_vehicle=\ref[VO]'>[VO.name]</a><br>"

show_browser(H, dat, asrs_name, "computer", "size=575x450")
show_browser(H, dat, asrs_name, "computer", width = 575, height = 450)

/obj/structure/machinery/computer/supply/asrs/vehicle/Topic(href, href_list)
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/game/verbs/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

dat += "</table>"

show_browser(usr, dat, "Your [category_text] Record", "ownrecords", "size=480x480")
show_browser(usr, dat, "Your [category_text] Record", "ownrecords", width = 480, height = 480)



Expand Down Expand Up @@ -172,7 +172,7 @@
if(can_edit || ishost(src))
dat += add_dat

show_browser(src, dat, "[target]'s [category_text] Notes", "otherplayersinfo", "size=480x480")
show_browser(src, dat, "[target]'s [category_text] Notes", "otherplayersinfo", width = 480, height = 480)

GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/NewBan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ GLOBAL_DATUM(Banlist, /savefile)

data += "</table>"

show_browser(owner, data, "Stickyban Panel", "sticky", "size=875x400")
show_browser(owner, data, "Stickyban Panel", "sticky", width = 875, height = 400)

//////////////////////////////////// DEBUG ////////////////////////////////////

Expand Down
6 changes: 3 additions & 3 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
dat += "<br><br>"
dat += "</body></html>"

show_browser(usr, dat, "Info on [key]", "allplayerinfo", "size=480x480")
show_browser(usr, dat, "Info on [key]", "allplayerinfo", width = 480, height = 480)


/datum/admins/proc/Jobbans()
Expand All @@ -128,7 +128,7 @@
u = "[c] - [r]"
dat += "<tr><td>[t] (<A href='byond://?src=\ref[src];[HrefToken(forceGlobal = TRUE)];removejobban=[u]'>unban</A>)</td></tr>"
dat += "</table>"
show_browser(usr, dat, "Job Bans", "ban", "size=400x400")
show_browser(usr, dat, "Job Bans", "ban", width = 400, height = 400)


/datum/admins/proc/Game()
Expand All @@ -148,7 +148,7 @@
<A href='byond://?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];send_tip=1'>Immediately Send Tip</A><br>
"}

show_browser(usr, dat, "Game Panel", "admin2", "size=210x280")
show_browser(usr, dat, "Game Panel", "admin2", width = 210, height = 280)
return

/////////////////////////////////////////////////////////////////////////////////////////////////admins2.dm merge
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/banjob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@ WARNING!*/

body = "<body>[jobs]</body>"
dat = "<tt>[body]</tt>"
show_browser(usr, dat, "Job-Ban Panel: [M.name]", "jobban2", "size=800x490")
show_browser(usr, dat, "Job-Ban Panel: [M.name]", "jobban2", width = 800, height = 490)
return
2 changes: 1 addition & 1 deletion code/modules/admin/create_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
create_mob_html = replacetext(create_mob_html, "null /* object types */", "\"[mobjs]\"")
create_mob_html = replacetext(create_mob_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))

show_browser(user, replacetext(create_mob_html, "/* ref src */", "\ref[src]"), "Create Mob", "create_mob", "size=450x525")
show_browser(user, replacetext(create_mob_html, "/* ref src */", "\ref[src]"), "Create Mob", "create_mob", width = 450, height = 525)
4 changes: 2 additions & 2 deletions code/modules/admin/create_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
create_object_html = replacetext(create_object_html, "null /* object types */", "\"[objectjs]\"")
create_object_html = replacetext(create_object_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))

show_browser(user, replacetext(create_object_html, "/* ref src */", "\ref[src]"), "Create Object", "create_object", "size=450x525")
show_browser(user, replacetext(create_object_html, "/* ref src */", "\ref[src]"), "Create Object", "create_object", width = 450, height = 525)


/datum/admins/proc/quick_create_object(mob/user)
Expand Down Expand Up @@ -46,4 +46,4 @@
quick_create_object_html = replacetext(quick_create_object_html, "null /* object types */", "\"[objectjs]\"")
quick_create_object_html = replacetext(quick_create_object_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))

show_browser(user, replacetext(quick_create_object_html, "/* ref src */", "\ref[src]"), "Quick Create Object", "quick_create_object", "size=450x525")
show_browser(user, replacetext(quick_create_object_html, "/* ref src */", "\ref[src]"), "Quick Create Object", "quick_create_object", width = 450, height = 525)
2 changes: 1 addition & 1 deletion code/modules/admin/create_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
create_turf_html = replacetext(create_turf_html, "null /* object types */", "\"[turfjs]\"")
create_turf_html = replacetext(create_turf_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))

show_browser(usr, replacetext(create_turf_html, "/* ref src */", "\ref[src]"), "Create Turf", "create_turf", "size=450x525")
show_browser(usr, replacetext(create_turf_html, "/* ref src */", "\ref[src]"), "Create Turf", "create_turf", width = 450, height = 525)
8 changes: 4 additions & 4 deletions code/modules/admin/player_panel/player_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
</body></html>
"}

show_browser(usr, dat, "User Panel", "players", "size=640x480")
show_browser(usr, dat, "User Panel", "players", width = 640, height = 480)

//Extended panel with ban related things
/datum/admins/proc/player_panel_extended()
Expand Down Expand Up @@ -314,7 +314,7 @@

dat += "</table></body></html>"

show_browser(usr, dat, "Player Menu", "players", "size=640x480")
show_browser(usr, dat, "Player Menu", "players", width = 640, height = 480)


/datum/admins/proc/check_antagonists()
Expand Down Expand Up @@ -367,7 +367,7 @@

dat += "</table>"

show_browser(usr, dat, "Antagonists", "antagonists", "size=600x500")
show_browser(usr, dat, "Antagonists", "antagonists", width = 600, height = 500)

/datum/admins/proc/check_round_status()
if (SSticker.current_state >= GAME_STATE_PLAYING)
Expand Down Expand Up @@ -395,7 +395,7 @@

dat += "<br><A href='byond://?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];delay_round_end=1'>[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]</A><br>"
dat += "</body></html>"
show_browser(usr, dat, "Round Status", "roundstatus", "size=600x500")
show_browser(usr, dat, "Round Status", "roundstatus", width = 600, height = 500)
else
alert("The game hasn't started yet!")

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/tabs/admin_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
dat += "<A href='byond://?src=\ref[src];[HrefToken()];add_player_info_confidential=[key]'>Add Confidential Note</A><br>"
dat += "<A href='byond://?src=\ref[src];[HrefToken()];player_notes_all=[key]'>Show Complete Record</A><br>"

show_browser(usr, dat, "Admin record for [key]", "adminplayerinfo", "size=480x480")
show_browser(usr, dat, "Admin record for [key]", "adminplayerinfo", width = 480, height = 480)

/datum/admins/proc/check_ckey(target_key as text)
set name = "Check CKey"
Expand Down
Loading