Page 1 of 1

Window position when toggling Borderless

Posted: Sat May 23, 2020 1:03 pm
by amyren
When running the included Hollywood example named DisplayStyle you can tick and untick the borderless flag.
For each cycle the window will move up and left the same number of pixels that the size of the borders.
Repeating this and it will eventually move until you no longer can reach that button.
If the flag is assigned to a key, you can move the window as far out of the screen as you wish (at least on OS's that allow this). Apearently with not other option than to force quit the program.

Ideally I would prefer the content of the window to stay exactly at the current position, and just remove or add the border without moving the content. I made this piece of code to acheive that.

Code: Select all

borderless = GetAttribute(#DISPLAY, 0, #ATTRBORDERLESS)
		If borderless
			wxpos = GetAttribute(#DISPLAY, 0, #ATTRXPOS)
			wypos = GetAttribute(#DISPLAY, 0, #ATTRYPOS)
			SetDisplayAttributes({Borderless = False, X = wxpos, Y = wypos})
		Else
			wxpos = GetAttribute(#DISPLAY, 0, #ATTRXPOS)
			wypos = GetAttribute(#DISPLAY, 0, #ATTRYPOS)
			lbw = GetAttribute(#DISPLAY, 0, #ATTRBORDERLEFT)
			tbw = GetAttribute(#DISPLAY, 0, #ATTRBORDERTOP)
			SetDisplayAttributes({Borderless = True, X = wxpos+lbw, Y = wypos+tbw})
		EndIf
But I still think that it would be better that there was a default position like center, or similar behaviour as in my example when toggling the border on /off.

Re: Window position when toggling Borderless

Posted: Sun May 24, 2020 11:28 am
by airsoftsoftwair
I agree that this is currently rather inconvenient but SetDisplayAttributes() is one of those commands that I try to avoid to touch because they're complex as hell so I only touch them if it's really necessary. This thing is just a minor nuisance so I'll keep it as it is...