Skip to content

Commit cfea613

Browse files
committed
WIP
1 parent 540f525 commit cfea613

3 files changed

Lines changed: 25 additions & 20 deletions

File tree

.github/workflows/manylinux_wheels.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
python: [ '3.9', '3.10', '3.11', '3.12', '3.13', '3.14' ]
141141
env:
142142
DISPLAY: ':99.0'
143+
SDL_VIDEO_X11_VISUALID: 0x00
143144
steps:
144145
- uses: actions/checkout@v6
145146
- name: Set up Python
@@ -185,6 +186,7 @@ jobs:
185186
runs-on: ubuntu-latest
186187
env:
187188
DISPLAY: ':99.0'
189+
SDL_VIDEO_X11_VISUALID: 0x00
188190
KIVY_SPLIT_EXAMPLES: 0
189191
steps:
190192
- uses: actions/checkout@v6

.github/workflows/test_ubuntu_python.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
python: [ '3.13', '3.14' ]
2929
env:
3030
DISPLAY: ':99.0'
31+
SDL_VIDEO_X11_VISUALID: 0x00
3132
# TODO: Only run tests on 3.14 once "ffpyplayer" works with Python 3.14
3233
KIVY_TEST_AUDIO: ${{ matrix.python == '3.14' && '0' || '1' }}
3334
steps:
@@ -53,17 +54,6 @@ jobs:
5354
source .ci/ubuntu_ci.sh
5455
export KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies
5556
install_kivy
56-
- name: Install xvfb
57-
run: |
58-
sudo apt-get install -y xvfb
59-
- name: Print OpenGL info
60-
run: |
61-
sudo apt install -y mesa-utils
62-
glxinfo
63-
- name: Test example app
64-
run: |
65-
source .ci/ubuntu_ci.sh
66-
SDL_LOGGING="video=verbose,*=verbose" python examples/demo/touchtracer/main.py
6757
- name: Test Kivy
6858
run: |
6959
source .ci/ubuntu_ci.sh

kivy/core/window/_window_sdl3.pyx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ cdef class _WindowSDL3Storage:
9393
cdef SDL_Window *win
9494
cdef int _win_flags = self.win_flags
9595

96+
if multisamples:
97+
if self.sdl_manages_egl_context:
98+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1)
99+
SDL_GL_SetAttribute(
100+
SDL_GL_MULTISAMPLESAMPLES, min(multisamples, 4)
101+
)
102+
else:
103+
# Non-SDL GL context, so we can't set the multisample
104+
# attributes.
105+
return NULL
106+
else:
107+
if self.sdl_manages_egl_context:
108+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0)
109+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0)
110+
96111
if shaped:
97112
_win_flags |= SDL_WINDOW_TRANSPARENT
98113

@@ -150,6 +165,7 @@ cdef class _WindowSDL3Storage:
150165
config_alpha_size = Config.getint('graphics', 'alpha_size')
151166
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, config_alpha_size)
152167

168+
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0)
153169
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1)
154170

155171
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2)
@@ -211,9 +227,7 @@ cdef class _WindowSDL3Storage:
211227
SDL_HINT_OVERRIDE)
212228

213229
if SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0:
214-
logger.error("WindowSDL: SDL_Init failed")
215230
self.die()
216-
print("WindowSDL: SDL initialized with video and joystick support")
217231

218232
# Set default orientation (force landscape for now)
219233
orientations = 'LandscapeLeft LandscapeRight'
@@ -254,12 +268,12 @@ cdef class _WindowSDL3Storage:
254268
# 3. Ordinary window with multisampling
255269
# 4. Ordinary window without multisampling
256270
sdl_window_configs = []
257-
# if config_multisamples and config_shaped:
258-
# sdl_window_configs.append((config_multisamples, config_shaped))
259-
# if config_shaped:
260-
# sdl_window_configs.append((0, config_shaped))
261-
# if config_multisamples:
262-
# sdl_window_configs.append((config_multisamples, 0))
271+
if config_multisamples and config_shaped:
272+
sdl_window_configs.append((config_multisamples, config_shaped))
273+
if config_shaped:
274+
sdl_window_configs.append((0, config_shaped))
275+
if config_multisamples:
276+
sdl_window_configs.append((config_multisamples, 0))
263277
sdl_window_configs.append((0, 0))
264278

265279
for multisamples, shaped in sdl_window_configs:
@@ -273,7 +287,6 @@ cdef class _WindowSDL3Storage:
273287
break
274288

275289
if not self.win:
276-
logger.error("WindowSDL: SDL_Init failed at end")
277290
self.die()
278291

279292
# Set shape in case the user requested a shaped window and the window

0 commit comments

Comments
 (0)