Skip to content

Conversation

@Stealcase
Copy link
Contributor

Issue

SDL windows have a lot of trouble displaying properly in Wayland environments like Fedora, so much so that the SDL accesskit C-bindings example created an orphaned application that was unselectable and could not grab focus by the OS when running on Fedora 41 GNOME.

This causes the SDL example to fail, because its impossible to focus on the invisible buttons in the invisible window.
No matter what I tried, ORCA would not respond and focus on the buttons.

Sollution

By writing an all-black color to the Fill rect and updating the window surface with said rect, it forces the window to render. This also causes GNOME to render the window Decorator titled "hello world", which otherwise would not be rendered in this example.

This change also causes parity with the Windows OS example of accesskit and SDL, because the Windows example DOES create a black window containing the application example,

So this change is simply working around quirks and differences between the SDL handling of Windows, Linux Wayland and X11, and forces the app window to always be created.

Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we have to draw something on the window for it to show on Wayland, even X11 can behave strangely sometimes by filling it with whatever was drawn at that location before.

Shouldn't the surface be drawn on every frame though? I suspect not doing so would create other visual glitches.

@Stealcase
Copy link
Contributor Author

Thanks for feedback.
Reverted the change back to "SDL_WINDOW_HIDDEN". This change was needed to "trick" Wayland to draw the initial window.

Now that it's drawing surface every frame, Wayland correctly draws the initial window without needing the SDL_WINDOW_SHOWN hacky sollution.
So you're right, even in this toy example, not drawing it every frame does introduce odd glitches.

Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to use clang-format to make sure your changes are properly formatted.

Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@DataTriny DataTriny merged commit 4872478 into AccessKit:main Sep 5, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants