Comments (6)
You need to call SDL_GetWindowSurface()
before calling SDL_UpdateWindowSurface()
. If you check the return code in your example, it's actually failing and setting an error "Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface".
from sdl.
I found yet another bug:
-
With above example, let the mouse leave the window to the left. You'll see ouput similar to:
Mouse at: 1, 37 Mouse leaves window.
This is toward the left side, as the
x=1
clearly indicates, where you moved the mouse last. This makes sense. -
Wait a few seconds and keep the mouse away from the window at all cost.
-
Now move the mouse around the window without touching it, and move the mouse back in from the right side. You'll see something like this output:
Mouse enters window. Mouse at: 1, 37 Mouse at: 199, 28 Mouse at: 199, 29
The 1, 37
after the mouse was announced back inside the window by SDL2 is multiple seconds and hundreds pixels away outdated and really shouldn't be there.
from sdl.
I was going to test if with SDL_VIDEODRIVER=wayland
I get more correct results, but #5596 then makes the window not show up with above minimal code example.
from sdl.
I'll have to check this on KDE a bit later, but it sounds like a window manager bug as it doesn't happen on GNOME. SDL just forwards events from the window manager. If it's getting weird coordinates at random times, it's because something is sending them.
I was going to test if with
SDL_VIDEODRIVER=wayland
I get more correct results, but #5596 then makes the window not show up with above minimal code example.
You need to present a frame for a Wayland window to become fully mapped. That's just how it works. Trying to hack around this with subsurfaces or some other solution just to show a blank window in the most trivial of cases would become very messy and have undesirable side effects, such as potentially interfering with direct scanout on some window managers.
You can just create a renderer, clear the screen, and present for the blank window to become visible.
from sdl.
Isn't there plenty of SDL code that uses SDL_UpdateWindowSurface
instead of a renderer as the entire way of the application to work? It doesn't make sense to me that this approach would be broken. I would get it if neither SDL_RenderPresent
nor SDL_UpdateWindowSurface
was called, but one of the two surely should make the window visible. Otherwise, why does SDL_UpdateWindowSurface
even still exist at this point?
from sdl.
Thanks so much! With your help I confirmed that this bug exists also with SDL_VIDEODRIVER=wayland
, but only the 2nd part of it. The 1st part of having a bogus window enter to start with seems to be limited to X11. The 2nd part is also way harder to reproduce with wayland, I needed to try around 20 times until it happened, but then I managed multiple times. I can therefore only assume it's a race condition since it's so random.
from sdl.
Related Issues (20)
- [SDL3] C++ headers & modules HOT 4
- Rename Key-/Scan-code names: APOSTROPHE vs QUOTE, GRAVE vs BACKQUOTE HOT 8
- Is it possible to have SDL3's D3D11 renderer and Direct2D interoperability? HOT 6
- Camera: pipewire-camera back-end detects no camera HOT 3
- Rename SDL_UpdateTexture to SDL_UpdateRGBTexture and use SDL_Surface HOT 2
- testautomation: SDL_GetClipboardText leaks memory
- [SDL2][MacOS] Memory leak when opening a PS4 controller
- Rename SDL_loadso.h? HOT 2
- Replace HIDAPI license text with "original" license. HOT 1
- [SDL2][Audio] Performance issues on Linux CI builds HOT 5
- SDL_Version.h visibility and intermediate versions bumps HOT 8
- Android: build failure with ndk 27-beta1 due to use of deprecated ALooper_pollAll HOT 2
- Confused about warp requirements. HOT 2
- [SDL3] Video subsystem memory leak? HOT 3
- Android CMake 3.18.1 - configure phase fails HOT 1
- Windows: SDL reports incorrect height when window height is 0 HOT 2
- Could somebody give me a prebuilt version for ios HOT 1
- SDL 3 Cursor freeze when switching Windowed <-> Fullscreen with hidden cursor on Wayland HOT 5
- A few keycode/scancode renaming suggestions HOT 1
- SDL3 Android crash SDL_free / SDL_DelTouch HOT 14
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.