We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2791

Summary: SDL_SetWindowBorder - window size and position changes on repeated use
Product: SDL Reporter: Iain <iain>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED ABANDONED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.3   
Hardware: x86_64   
OS: Windows 7   
Attachments: Minimal test case

Description Iain 2014-11-23 18:02:26 UTC
using SDL_SetWindowBordered to remove and re-instate window borders ONCE each works fine.
But, each subsequent time the window border is removed, the size of the window is increased (by the size of the border?)
The window position is shifted also.

To test, the following code was used - On each mouse button down, the state of the SDL_WINDOW_BORDERLESS flag is checked and reversed. The position and size of the window are reported before and after each change.



First:
======
Got a Mouse Button down
Window before making window borderless xPos:360   yPos:150 (xSize:1200   ySize:900)
set window borderless (SDL_FALSE)
Window after making window borderless xPos:360   yPos:150 (xSize:1200   ySize:900)

Got a Mouse Button down
Window before reinstating window border xPos:360   y:150 (xSize:1200   ySize:900)
reinstate window border  (SDL_TRUE)
Window after reinstating window border xPos:360   y:150 (xSize:1200   ySize:900)



Second:
=======
Got a Mouse Button down
Window before making window borderless xPos:360   yPos:150 (xSize:1200   ySize:900)
set window borderless (SDL_FALSE)
Window after making window borderless xPos:357   yPos:125 (xSize:1206   ySize:928)

Got a Mouse Button down
Window before reinstating window border xPos:357   y:125 (xSize:1206   ySize:928)
reinstate window border  (SDL_TRUE)
Window after reinstating window border xPos:357   y:125 (xSize:1206   ySize:928)

Got a Mouse Button down
Window before making window borderless xPos:357   yPos:125 (xSize:1206   ySize:928)
set window borderless (SDL_FALSE)
Window after making window borderless xPos:354   yPos:100 (xSize:1212   ySize:956)

Got a Mouse Button down
Window before reinstating window border xPos:354   y:100 (xSize:1212   ySize:956)
reinstate window border  (SDL_TRUE)
Window after reinstating window border xPos:354   y:100 (xSize:1212   ySize:956)

Got a Mouse Button down
Window before making window borderless xPos:354   yPos:100 (xSize:1212   ySize:956)
set window borderless (SDL_FALSE)
Window after making window borderless xPos:351   yPos:75 (xSize:1218   ySize:984)


Code Snippet:
=============
		case	SDL_MOUSEBUTTONDOWN:
			cout << "Got a Mouse Button down" << endl;
			if(SDL_GetWindowFlags(m_window) & SDL_WINDOW_BORDERLESS){
				int xPos;
				int yPos;
				int xSize;
				int ySize;

				SDL_GetWindowPosition(m_window, &xPos,&yPos);
				SDL_GetWindowSize(m_window, &xSize,&ySize);
				cout << "Window before reinstating window border xPos:" << xPos << "   y:" << yPos << " (xSize:" << xSize << "   ySize:" << ySize << ")" << endl;

				SDL_SetWindowBordered(m_window,SDL_TRUE);
				cout << "reinstate window border  (SDL_TRUE)" << endl;

				SDL_GetWindowPosition(m_window, &xPos,&yPos);
				SDL_GetWindowSize(m_window, &xSize,&ySize);
				cout << "Window after reinstating window border xPos:" << xPos << "   y:" << yPos << " (xSize:" << xSize << "   ySize:" << ySize << ")" <<  endl;

			}

			else {
				int xPos;
				int yPos;
				int xSize;
				int ySize;

				SDL_GetWindowPosition(m_window, &xPos, &yPos);
				SDL_GetWindowSize(m_window, &xSize,&ySize);
				cout << "Window before making window borderless xPos:" << xPos << "   yPos:" << yPos << " (xSize:" << xSize << "   ySize:" << ySize << ")" << endl;

				SDL_SetWindowBordered(m_window,SDL_FALSE);
				cout << "set window borderless (SDL_FALSE)" << endl;

				SDL_GetWindowPosition(m_window, &xPos,&yPos);
				SDL_GetWindowSize(m_window, &xSize,&ySize);
				cout << "Window after making window borderless xPos:" << xPos << "   yPos:" <<  yPos  << " (xSize:" << xSize << "   ySize:" << ySize << ")" << endl;

			}
			break;
Comment 1 Sam Lantinga 2017-08-14 04:32:28 UTC
I just tried this with the latest SDL snapshot and it worked fine:
http://www.libsdl.org/tmp/SDL-2.0.zip

Is it fixed for you as well?
Comment 2 Sam Lantinga 2017-08-14 04:33:08 UTC
Created attachment 2844 [details]
Minimal test case
Comment 3 Ryan C. Gordon 2018-08-06 21:20:18 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.