ID:98517
 
Not a bug
BYOND Version:471
Operating System:Windows XP Pro
Web Browser:Firefox 3.5.1
Applies to:Dream Seeker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary: The 'size' parameter of a window will report the former size of the window when it was in "floating" form, even after being maximized. It is not possible to get the current interior size of the window when the window is fullscreen.

(It is also not possible to get the exterior dimensions of the window at all, maximized or not, but that would be better suited for a feature request.)

Numbered Steps to Reproduce Problem:
1) Create a skin file.
2) Create a window in that skin file with dimensions of your choice.
3) Create a verb which returns the 'size' parameter of the window.
4) Run the program.
5) Use the verb. The verb will report the correct dimensions in the output.
6) Resize the window.
7) Use the verb. The verb will still report the correct, new dimensions.
8) Maximize the window using the button on the titlebar (standard Windows API).
9) Use the verb again. The verb will report the same dimensions as previously, rather than the internal screen dimensions of the maximized window.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
get_window_size()
var/window_size = winget(src,"default","size")
var/size_x = text2num(copytext(window_size,1,"x"))
var/size_y = text2num(copytext(window_size,findtext(window_size,"x")+1))
src << "Window size [size_x],[size_y]"


Expected Results:
After being maximized, the 'size' parameter of the window should still report the existing interior dimension of the window, excluding the title bar, the status bar, the border, etc.

Actual Results:
The 'size' parameter reports the last known size of the window before it was maximized. This may be a deliberate feature, so when the window is "restored" to its previous size it will retain the same dimensions, but is unintuitive from a design standpoint.

If the actual size of the window could be retained in an internal BYOND variable while the 'size' parameter would then reflect the size of the window after maximizing, it would satisfy the best of both worlds. Restoring the window would result in checking the stored parameter and resetting the size parameter to that value.

Workarounds:

The only viable workaround is to introduce a function which disables the titlebar, statusbar, etc. and forces the screen to a user-specified screen dimension. The game can then accommodate the exact dimensions as necessary. However, this is not very user-friendly and completely ignores the intuitive option of using the maximize feature of the window.
This isn't a bug. In order to get the size you must use a control on the window.
This is actually the intended behavior.
"Intended bad behaviour" or "will not fix" is still a bug in my books... unless there is a strong, justifiable reason for it to exist the current way, I find it difficult to see it as anything other than a bug. I provided a possible interpretation and appropriate internal fix in the 'Actual Results' field above.

Falacy did recommend something I'm willing to try: a hidden control anchored to top left and bottom right, whose dimensions should provide the proper interior shape of the window after maximization. Having to rely on a hacky workaround instead of having a natural value reported is very disconcerting, however.
The fact that this is established behavior means existing games may rely on it. For that reason we can't simply change it. I'm willing to add features to supply the info you want, but those are feature request topics.