ID:2315584
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Hello! I ran into a problem with the Browse proc, and was hoping to get it resolved. Currently, the browse proc opens the window in the dead center of the monitor. However, if the game is on a second or third monitor, the browse window opens up somewhere off screen. Using keyboard shortcuts, its possible to bring it back on screen, so it's not that the window is failing to be made

I started doing some exploration of what the exact issue was, using winget and winset. I found out that using winget on the browser for its pos returned null. I also found that using winset on the browser would actually move it and make winget(pos) work. Passing in pos as an option in browse() did not set the pos, only winset does.

Using winset, I could fix the issue, but the codebase I'm working on uses a lot of browsers, and using winset as a hack to fix the issue felt wrong.

I propose a couple of solutions:

1 (not ideal), allow for pos to be set in the browser options).
2 (not ideal), set a new option that choses whether the browser opens in the middle of the monitor, or the middle of the main game window. The code I wrote currently sets the X and Y position of the browser to ((PositionOfMain + SizeOfMain - SizeOfBrowser)/2).
4 (not ideal), leave as is, use winset in a hacky way to force monitor support
3 (ideal), make it so that the browser properly opens to the middle of the second/third monitor.


What I used for reference:

http://www.byond.com/docs/ref/info.html#/proc/browse

http://www.byond.com/docs/ref/skinparams.html

code snippets:
to_chat(user,"orig [winget(user, window_id, "pos")]") //null, so prints "orig "
var/mainpos = winget(user, "mainwindow", "pos") //get position of top left corner of main window
winset(user, window_id, "pos=[mainpos]") //move browser to top left corner
to_chat(user,"new [winget(user, window_id, "pos")]") //not null, prints "new 2143, 40" etc

Login to reply.