Skip to content

Commit

Permalink
WIP: SDL display support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuman committed Jan 23, 2025
1 parent 612cecf commit 991a97c
Show file tree
Hide file tree
Showing 10 changed files with 749 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ dependent_option(BUILD_XINPUT "Build Xinput 2 support (slow)" false
"BUILD_X11" false
"Xinput 2 support requires X11")

option(BUILD_SDL "Build SDL 1.2 support" false)
if(BUILD_SDL)
endif(BUILD_SDL)

# if we build with any GUI support
if(BUILD_X11)
set(BUILD_GUI true)
Expand All @@ -233,6 +237,9 @@ endif(BUILD_X11)
if(BUILD_WAYLAND)
set(BUILD_GUI true)
endif(BUILD_WAYLAND)
if(BUILD_SDL)
set(BUILD_GUI true)
endif(BUILD_SDL)

dependent_option(BUILD_MOUSE_EVENTS "Enable mouse event support" true
"BUILD_WAYLAND OR BUILD_X11" false
Expand Down
23 changes: 23 additions & 0 deletions cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,29 @@ if(BUILD_LUA_RSVG)
set(luarsvg_includes ${RSVG_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})
endif(BUILD_LUA_RSVG)

# check for SDL
if(BUILD_SDL)
include(FindSDL)
include(FindSDL_ttf)
find_package(SDL)
if(SDL_FOUND)
set(conky_includes ${conky_includes} ${SDL_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${SDL_LIBRARIES})
find_package(SDL_ttf)
if(SDLTTF_FOUND)
set(conky_includes ${conky_includes} ${SDL_TTF_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${SDL_TTF_LIBRARIES})
else(SDLTTL_FOUND)
message(FATAL_ERROR "Unable to find SDL_ttf library")
endif(SDLTTF_FOUND)
check_include_files(SDL/SDL_gfxPrimitives.h HAVE_SDL_GFXPRIMITIVES_H)
find_library(SDLGFX_LIBRARY SDL_gfx)
else(SDL_FOUND)
message(FATAL_ERROR "Unable to find SDL library")
endif(SDL_FOUND)
check_include_files(ftw.h HAVE_FTW_H)
endif(BUILD_SDL)

if(BUILD_AUDACIOUS)
set(WANT_GLIB true)
pkg_check_modules(NEW_AUDACIOUS audacious>=1.4.0)
Expand Down
4 changes: 4 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#cmakedefine HAVE_SOUNDCARD_H 1

#cmakedefine HAVE_FTW_H 1

#cmakedefine HAVE_STRNDUP 1

#cmakedefine HAVE_FOPENCOOKIE 1
Expand Down Expand Up @@ -121,6 +123,8 @@

#cmakedefine BUILD_HTTP 1

#cmakedefine BUILD_SDL 1

#cmakedefine BUILD_GUI 1

#cmakedefine BUILD_ICONV 1
Expand Down
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ if(BUILD_GUI)
endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)
endif(BUILD_GUI)

if(BUILD_SDL)
set(sdl_srcs
output/display-sdl.cc
output/display-sdl.hh
)
set(optional_sources ${optional_sources} ${sdl_srcs})
endif(BUILD_SDL)

if(BUILD_WAYLAND)
set(wl_sources
output/wl.cc
Expand Down
7 changes: 7 additions & 0 deletions src/output/display-output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ void register_output<output_t::NCURSES>(display_outputs_t &outputs) {
log_missing("ncurses", "BUILD_NCURSES");
}
#endif
#ifndef BUILD_SDL
template <>
void register_output<output_t::SDL>(display_outputs_t &outputs) {
log_missing("SDL", "BUILD_SDL");
}
#endif
#ifndef BUILD_WAYLAND
template <>
void register_output<output_t::WAYLAND>(display_outputs_t &outputs) {
Expand Down Expand Up @@ -87,6 +93,7 @@ bool initialize_display_outputs() {
// - Newer outputs go before older (e.g. NCurses before (hypothetical) Curses).
// - Fallbacks go last (in group)
register_output<output_t::WAYLAND>(outputs);
register_output<output_t::SDL>(outputs);
register_output<output_t::X11>(outputs);
register_output<output_t::HTTP>(outputs);
register_output<output_t::FILE>(outputs);
Expand Down
1 change: 1 addition & 0 deletions src/output/display-output.hh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ enum class output_t : uint32_t {
HTTP,
X11,
WAYLAND,
SDL,
OUTPUT_COUNT
};
template <output_t Output>
Expand Down
Loading

0 comments on commit 991a97c

Please sign in to comment.