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 Jul 6, 2024
1 parent b0e2ec4 commit 7f55591
Show file tree
Hide file tree
Showing 10 changed files with 725 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 @@ -201,6 +201,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 @@ -209,6 +213,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 @@ -533,6 +533,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_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 @@ -29,6 +29,8 @@
#cmakedefine HAVE_SYS_INOTIFY_H 1
#cmakedefine HAVE_DIRENT_H 1

#cmakedefine HAVE_FTW_H 1

#cmakedefine HAVE_SOME_SOUNDCARD_H 1
#cmakedefine HAVE_LINUX_SOUNDCARD_H 1

Expand Down Expand Up @@ -122,6 +124,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 @@ -272,6 +272,14 @@ if(BUILD_GUI)
endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)
endif(BUILD_GUI)

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

if(BUILD_WAYLAND)
set(wl_srcs
wl.cc
Expand Down
7 changes: 7 additions & 0 deletions src/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 @@ -86,6 +92,7 @@ bool initialize_display_outputs() {
register_output<output_t::HTTP>(outputs);
register_output<output_t::X11>(outputs);
register_output<output_t::WAYLAND>(outputs);
register_output<output_t::SDL>(outputs);

for (auto out : outputs) { NORM_ERR("FOUND: %s", out->name.c_str()); }

Expand Down
1 change: 1 addition & 0 deletions src/display-output.hh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ enum class output_t : uint32_t {
HTTP,
X11,
WAYLAND,
SDL,
OUTPUT_COUNT
};
template <output_t Output>
Expand Down
Loading

0 comments on commit 7f55591

Please sign in to comment.