Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] SDL2 --> SDL3 Migration #8666

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/Dockerfile.armv7l
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN /bin/bash -c 'pip install auditwheel'
RUN ./tools/build_linux_dependencies.sh

# Build the wheel.
RUN KIVY_SPLIT_EXAMPLES=1 USE_X11=1 USE_SDL2=1 USE_PANGOFT2=0 USE_GSTREAMER=0 KIVY_SDL_GL_ALPHA_SIZE=0 KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies KIVY_CROSS_PLATFORM="$KIVY_CROSS_PLATFORM" python3 -m pip -v wheel --extra-index-url https://www.piwheels.org/simple . -w /kivy-wheel
RUN KIVY_SPLIT_EXAMPLES=1 USE_X11=1 USE_SDL3=1 USE_PANGOFT2=0 USE_GSTREAMER=0 KIVY_SDL_GL_ALPHA_SIZE=0 KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies KIVY_CROSS_PLATFORM="$KIVY_CROSS_PLATFORM" python3 -m pip -v wheel --extra-index-url https://www.piwheels.org/simple . -w /kivy-wheel

# Delocate the wheel.
# buster: manylinux_2_28_armv7l, bullseye: manylinux_2_31_armv7l, bookworm: manylinux_2_35_armv7l
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manylinux_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

manylinux_wheel_create:
env:
CIBW_ENVIRONMENT_LINUX: "KIVY_SPLIT_EXAMPLES=1 USE_X11=1 USE_SDL2=1 USE_PANGOFT2=0 USE_GSTREAMER=0 KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies LD_LIBRARY_PATH=$(pwd)/kivy-dependencies/dist/lib:$(pwd)/kivy-dependencies/dist/lib64"
CIBW_ENVIRONMENT_LINUX: "KIVY_SPLIT_EXAMPLES=1 USE_X11=1 USE_SDL3=1 USE_PANGOFT2=0 USE_GSTREAMER=0 KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies LD_LIBRARY_PATH=$(pwd)/kivy-dependencies/dist/lib:$(pwd)/kivy-dependencies/dist/lib64"
CIBW_BUILD_VERBOSITY_LINUX: 3
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/osx_wheels_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
CC: clang
CXX: clang
FFLAGS: '-ff2c'
USE_SDL2: 1
USE_SDL3: 1

jobs:
kivy_examples_create:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_osx_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CC: clang
CXX: clang
FFLAGS: '-ff2c'
USE_SDL2: 1
USE_SDL3: 1

jobs:
unit_test:
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ kivy-dependencies
MANIFEST

kivy/core/image/img_imageio.c
kivy/core/audio/audio_sdl2.c
kivy/core/audio_output/audio_sdl3.c
kivy/core/text/text_sdlttf.c
kivy/core/window/window_x11.c
kivy/lib/vidcore_lite/bcm.c
kivy/lib/vidcore_lite/bcm.h
kivy/lib/vidcore_lite/egl.c
kivy/core/image/_img_sdl2.c
kivy/core/text/_text_sdl2.c
kivy/core/window/_window_sdl2.c
kivy/core/image/_img_sdl3.c
kivy/core/text/_text_sdl3.c
kivy/core/window/_window_sdl3.c

# PyDev
.project
Expand All @@ -83,4 +83,4 @@ venv

kivy/setupconfig.py

kivy/core/clipboard/_clipboard_sdl2.c
kivy/core/clipboard/_clipboard_sdl3.c
2 changes: 1 addition & 1 deletion examples/audio/pitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class Test(App):
def build(self):
self.sound = SoundLoader.load(
'/usr/lib64/python{}.{}/test/audiodata/pluck-pcm32.wav'
'examples/audio/12908_sweet_trip_mm_clap_hi.wav'
.format(*version_info[0:2])
)
root = BoxLayout()
Expand Down
4 changes: 4 additions & 0 deletions examples/demo/touchtracer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
'''
__version__ = '1.0'

import os

import kivy
kivy.require('1.0.6')

Expand Down Expand Up @@ -65,6 +67,8 @@ def normalize_pressure(self, pressure):

def on_touch_down(self, touch):
win = self.get_parent_window()
# print(win._win.get_window_info().surface)
# print(win._win.get_window_info().display)
ud = touch.ud
ud['group'] = g = str(touch.uid)
pointsize = 5
Expand Down
10 changes: 5 additions & 5 deletions kivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,20 @@ def kivy_usage():

#: Global settings options for kivy
kivy_options = {
'window': ('egl_rpi', 'sdl2', 'sdl', 'x11'),
'text': ('pil', 'sdl2', 'sdlttf'),
'window': ('egl_rpi', 'sdl3', 'sdl', 'x11'),
'text': ('pil', 'sdl3', 'sdlttf'),
'video': (
'gstplayer', 'ffmpeg', 'ffpyplayer', 'null'),
'audio_output': (
'gstplayer', 'ffpyplayer', 'sdl2',
'gstplayer', 'ffpyplayer', 'sdl3',
'avplayer'),
'image': ('tex', 'imageio', 'dds', 'sdl2', 'pil', 'ffpy', 'gif'),
'image': ('tex', 'imageio', 'dds', 'sdl3', 'pil', 'ffpy', 'gif'),
'camera': ('opencv', 'gi', 'avfoundation',
'android', 'picamera'),
'spelling': ('enchant', 'osxappkit', ),
'clipboard': (
'android', 'winctypes', 'xsel', 'xclip', 'dbusklipper', 'nspaste',
'sdl2', 'dummy', 'gtk3', )}
'sdl3', 'dummy', 'gtk3', )}

# Read environment
for option in kivy_options:
Expand Down
2 changes: 1 addition & 1 deletion kivy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def on_resume(self):
from kivy.utils import platform
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty, StringProperty
from kivy.setupconfig import USE_SDL2
from kivy.setupconfig import USE_SDL3


class App(EventDispatcher):
Expand Down
2 changes: 1 addition & 1 deletion kivy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def remove_postproc_module(self, mod):
self.postproc_modules.remove(mod)

def remove_android_splash(self, *args):
'''Remove android presplash in SDL2 bootstrap.'''
'''Remove android presplash in SDL3 bootstrap.'''
try:
from android import remove_presplash
remove_presplash()
Expand Down
14 changes: 7 additions & 7 deletions kivy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
or 'minimized'

Sets the window state, defaults to 'visible'. This option is available
only for the SDL2 window provider and it should be used on desktop
only for the SDL3 window provider and it should be used on desktop
OSes.
`fbo`: string, one of 'hardware', 'software' or 'force-hardware'
Selects the FBO backend to use.
Expand Down Expand Up @@ -239,9 +239,9 @@
Width of the :class:`~kivy.core.window.Window`, not used if
`fullscreen` is set to `auto`.
`minimum_width`: int
Minimum width to restrict the window to. (sdl2 only)
Minimum width to restrict the window to. (sdl3 only)
`minimum_height`: int
Minimum height to restrict the window to. (sdl2 only)
Minimum height to restrict the window to. (sdl3 only)
`min_state_time`: float, defaults to .035
Minimum time for widgets to display a given visual state.
This attrib is currently used by widgets like
Expand All @@ -251,18 +251,18 @@
time.
`always_on_top`: int, one of ``0`` or ``1``, defaults to ``0``
When enabled, the window will be brought to the front and will keep
the window above the rest. Only works for the sdl2 window provider.
the window above the rest. Only works for the sdl3 window provider.
``0`` is disabled, ``1`` is enabled.
`show_taskbar_icon`: int, one of ``0`` or ``1``, defaults to ``1``
Determines whether the app's icon will be added to the taskbar. Only
applicable for the SDL2 window provider.
applicable for the SDL3 window provider.
``0`` means the icon will not be shown in the taskbar and ``1`` means
it will.
`allow_screensaver`: int, one of 0 or 1, defaults to 1
Allow the device to show a screen saver, or to go to sleep
on mobile devices. Only works for the sdl2 window provider.
on mobile devices. Only works for the sdl3 window provider.
`vsync`: `none`, empty value, or integers
Whether vsync is enabled, currently only used with sdl2 window.
Whether vsync is enabled, currently only used with sdl3 window.
Possible values are `none` or empty value -- leaves it unchanged,
``0`` -- disables vsync, ``1`` or larger -- sets vsync interval,
``-1`` sets adaptive vsync. It falls back to 1 if setting to ``2+``
Expand Down
8 changes: 4 additions & 4 deletions kivy/core/audio_output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from kivy.properties import StringProperty, NumericProperty, OptionProperty, \
AliasProperty, BooleanProperty, BoundedNumericProperty
from kivy.utils import platform
from kivy.setupconfig import USE_SDL2
from kivy.setupconfig import USE_SDL3

from sys import float_info

Expand Down Expand Up @@ -122,7 +122,7 @@ class Sound(EventDispatcher):

pitch = BoundedNumericProperty(1., min=float_info.epsilon)
'''Pitch of a sound. 2 is an octave higher, .5 one below. This is only
implemented for SDL2 audio provider yet.
implemented for SDL3 audio provider yet.

.. versionadded:: 1.10.0

Expand Down Expand Up @@ -215,7 +215,7 @@ def on_stop(self):
except ImportError:
pass
audio_libs += [('ffpyplayer', 'audio_ffpyplayer')]
if USE_SDL2:
audio_libs += [('sdl2', 'audio_sdl2')]
if USE_SDL3:
audio_libs += [('sdl3', 'audio_sdl3')]

libs_loaded = core_register_libs('audio_output', audio_libs)
4 changes: 2 additions & 2 deletions kivy/core/audio_output/audio_ffpyplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
while bin contains the actual dlls. The include directory holds the headers.
The bin directory is only needed if the shared libraries are not already on
the path. In the environment define FFMPEG_ROOT and SDL_ROOT, each pointing to
the ffmpeg, and SDL directories, respectively. (If you're using SDL2,
the include directory will contain a directory called SDL2, which then holds
the ffmpeg, and SDL directories, respectively. (If you're using SDL3,
the include directory will contain a directory called SDL3, which then holds
the headers).

Once defined, download the ffpyplayer git and run
Expand Down
Loading
Loading