Comments (6)
What is happening here is that SDL adjusts the window position to report the origin of the content area, and when the window is recreated after already being mapped, it is being placed at the origin of the previous content location, and is then offset again by the title bar height. The solution is to subtract the old left and top border widths from the window position when recreating the window, but this will need to be tested against Win and Mac as well to ensure that nothing breaks.
from sdl.
It looks like it's not the title bar at work here, the window manager is moving windows down below the status bar at the top of the desktop.
I'd like to revisit setting the OPENGL flag by default so that windows don't need to be recreated when the renderer is instantiated.
from sdl.
I'd like to revisit setting the OPENGL flag by default so that windows don't need to be recreated when the renderer is instantiated.
Never mind, I forgot how complex setting up the OpenGL context and visual is, and the window attributes are highly dependent on the renderer's needs.
from sdl.
@akallabeth, a good workaround is to create the window hidden and then show it after creating the renderer.
from sdl.
It looks like it's not the title bar at work here, the window manager is moving windows down below the status bar at the top of the desktop.
To elaborate a bit, usually applications will create a window and immediately create a renderer, so the window is recreated before the window manager actually maps anything onto the desktop, and the coordinates used for recreating the window are the original ones passed at window creation time.
If the application creates a window and doesn't immediately create a renderer, however, the window can end up being mapped onto the desktop and sent a moved event, which sets the current window coordinates to reflect the window content area offset by the desktop toolbar and window decorations. If the window is recreated after this happens, the current origin of the content area, adjusted for any desktop toolbars and window decorations, will be used as the origin for recreating the window, and the window manager can then push the content area down again by the height of the window decorations so that the origin of the window, including decorations, is at the requested position. This can be replicated in the tests by adding SDL_PumpEvents()
between window and renderer creation in the test apps.
In the case of FreeRDP, it looks like they are initially creating a window, then calling SDL_GetWindowSurface()
at a later time, which implicitly creates an OpenGL backing texture for output that requires window recreation if the OpenGL flag isn't present, so the above is likely what is happening.
from sdl.
So I can reproduce this here on GNOME with testsprite, before dc7baa4.
In this case, the window is created and shown, the window manager immediately offsets the window Y position by the height of the status bar (not the window title bar), and then the renderer is created, which recreates the window at that new position, and the window manager offsets that again. There is no explicit pump events between the window creation and the renderer creation in this case.
from sdl.
Related Issues (20)
- [sdl3, X11] CMake does not detect X11 anymore HOT 5
- SDL3 macOS build no longer a universal library HOT 11
- Direct2D12 no longer works with ImGui's SDL3+SDL_Renderer correctly HOT 7
- SDL3 Request: Date and Time API HOT 2
- `JoyDeviceEvent`'s `SDL_EVENT_JOYSTICK_ADDED` `which` field does not refer to a `SDL_JoystickID` HOT 9
- No `arm-linux-gnueabihf-gcc` cmake toolchain HOT 1
- Clip rect automated test fails with the Vulkan renderer
- UWP SDL3: SDL_GetWindowSizeInPixels returns points not pixels
- SDL3, Steam Deck is reported as Steam Virtual Gamepad HOT 16
- SDL2 - Emscripten / HTML5 - manageAspectRatioFitting AND HighDPI HOT 1
- cmake: SDL_RENDER_VULKAN reported as OFF in final summary even though enabled HOT 1
- testffmpeg link failure in absence of EGL libs HOT 5
- Incorrect SDL_WINDOWEVENT_ENTER and SDL_MOUSEMOTION events with KDE Plasma HOT 6
- Some tests do signed integer overflow, which is undefined behavior
- SDL3 Request: qsort_r HOT 6
- SDL3 request: SDL_ShowCursor and SDL_SetCursor should probably have a window parameter (consistency nitpick) HOT 2
- SDL_SetWindowGrab doesn't work with mouse not hidden (SDL2, X11 video driver only) HOT 6
- Make `SDL_TouchDevicesAvailable` return actual number of touch devices, instead of a bool HOT 2
- Feature Request: Control/Set Player LED without Overwriting Player Index HOT 1
- Reopening pulse capture device does not always work out correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdl.