Window position when toggling Borderless

Find quick help here to get you started with Hollywood
Post Reply
Posts: 118
Joined: Thu May 02, 2019 11:53 am

Window position when toggling Borderless

Post 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})
			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})
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.

User avatar
Posts: 4349
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany

Re: Window position when toggling Borderless

Post 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...

Post Reply