mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-13 21:02:34 +08:00
make wayland impl optional
This commit is contained in:
parent
43409229a9
commit
ffeec7f1dd
@ -44,6 +44,15 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
include)
|
||||
|
||||
if (ENABLE_WAYLAND)
|
||||
message(STATUS "Wayland support is enabled!")
|
||||
add_compile_definitions(ENABLE_WAYLAND)
|
||||
set(WAYLAND_SOURCES "src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h" "src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.cpp" "src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.cpp"
|
||||
"src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.cpp" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h")
|
||||
else()
|
||||
set(WAYLAND_SOURCES "")
|
||||
endif()
|
||||
|
||||
add_executable(
|
||||
linux-wallpaperengine
|
||||
main.cpp
|
||||
@ -130,21 +139,15 @@ add_executable(
|
||||
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h
|
||||
src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h
|
||||
src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h
|
||||
|
||||
src/WallpaperEngine/Render/Drivers/Output/COutput.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Output/COutput.h
|
||||
src/WallpaperEngine/Render/Drivers/Output/CX11Output.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Output/CX11Output.h
|
||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h
|
||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.cpp
|
||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h
|
||||
src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h
|
||||
src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp
|
||||
src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h
|
||||
src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.cpp
|
||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.h
|
||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.cpp
|
||||
src/WallpaperEngine/Render/CRenderContext.h
|
||||
@ -275,6 +278,8 @@ add_executable(
|
||||
|
||||
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.cpp
|
||||
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h
|
||||
|
||||
${WAYLAND_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(linux-wallpaperengine
|
||||
@ -291,15 +296,18 @@ target_link_libraries(linux-wallpaperengine
|
||||
${FREEIMAGE_LIBRARIES}
|
||||
${MPV_LIBRARY}
|
||||
${PULSEAUDIO_LIBRARY}
|
||||
${CMAKE_SOURCE_DIR}/wlr-layer-shell-unstable-v1.o
|
||||
${CMAKE_SOURCE_DIR}/xdg-shell-protocol.o
|
||||
glfw
|
||||
GLESv2
|
||||
pthread
|
||||
wayland-cursor
|
||||
/usr/lib/libEGL.so.1
|
||||
wayland-client
|
||||
wayland-egl)
|
||||
glfw)
|
||||
|
||||
if (ENABLE_WAYLAND)
|
||||
target_link_libraries(linux-wallpaperengine ${CMAKE_SOURCE_DIR}/wlr-layer-shell-unstable-v1.o
|
||||
${CMAKE_SOURCE_DIR}/xdg-shell-protocol.o
|
||||
GLESv2
|
||||
pthread
|
||||
wayland-cursor
|
||||
/usr/lib/libEGL.so.1
|
||||
wayland-client
|
||||
wayland-egl)
|
||||
endif()
|
||||
|
||||
file(CREATE_LINK linux-wallpaperengine wallengine SYMBOLIC)
|
||||
|
||||
|
@ -263,18 +263,22 @@ namespace WallpaperEngine::Application
|
||||
void CWallpaperApplication::show ()
|
||||
{
|
||||
// initialize OpenGL driver
|
||||
#ifdef ENABLE_WAYLAND
|
||||
const bool WAYLAND = getenv("WAYLAND_DISPLAY") && this->m_context.settings.render.mode == CApplicationContext::WAYLAND_LAYER_SHELL;
|
||||
if (WAYLAND) {
|
||||
videoDriver = std::make_unique<WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver>("wallpaperengine", this->m_context, this);
|
||||
inputContext = std::make_unique<WallpaperEngine::Input::CInputContext>(*(WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver*)videoDriver.get());
|
||||
} else {
|
||||
#endif
|
||||
videoDriver = std::make_unique<WallpaperEngine::Render::Drivers::CX11OpenGLDriver>("wallpaperengine", this->m_context);
|
||||
inputContext = std::make_unique<WallpaperEngine::Input::CInputContext>(*(WallpaperEngine::Render::Drivers::CX11OpenGLDriver*)videoDriver.get());
|
||||
#ifdef ENABLE_WAYLAND
|
||||
}
|
||||
|
||||
if (WAYLAND)
|
||||
fullscreenDetector = std::make_unique<WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector>(this->m_context, *(WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver*)videoDriver.get());
|
||||
else
|
||||
#endif
|
||||
fullscreenDetector = std::make_unique<WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector>(this->m_context, *videoDriver);
|
||||
// stereo mix recorder for audio processing
|
||||
WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder audioRecorder;
|
||||
@ -296,10 +300,11 @@ namespace WallpaperEngine::Application
|
||||
case CApplicationContext::X11_BACKGROUND:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CX11Output (this->m_context, *videoDriver, *fullscreenDetector);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_WAYLAND
|
||||
case CApplicationContext::WAYLAND_LAYER_SHELL:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CWaylandOutput (this->m_context, *videoDriver, *fullscreenDetector);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// initialize render context
|
||||
@ -318,6 +323,7 @@ namespace WallpaperEngine::Application
|
||||
this->m_defaultBackground->getWallpaper (), *context, *audioContext
|
||||
));
|
||||
|
||||
#ifdef ENABLE_WAYLAND
|
||||
if (WAYLAND) {
|
||||
renderFrame();
|
||||
|
||||
@ -325,10 +331,13 @@ namespace WallpaperEngine::Application
|
||||
videoDriver->dispatchEventQueue();
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
while (!videoDriver->closeRequested () && this->m_context.state.general.keepRunning) {
|
||||
renderFrame();
|
||||
}
|
||||
#ifdef ENABLE_WAYLAND
|
||||
}
|
||||
#endif
|
||||
|
||||
// ensure this is updated as sometimes it might not come from a signal
|
||||
this->m_context.state.general.keepRunning = false;
|
||||
|
@ -9,14 +9,20 @@
|
||||
#include "WallpaperEngine/Render/CWallpaper.h"
|
||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
||||
#include "WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h"
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
||||
#endif
|
||||
|
||||
#include "WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h"
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
||||
#endif
|
||||
|
||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
||||
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
||||
#endif
|
||||
|
||||
#include "WallpaperEngine/Audio/Drivers/CSDLAudioDriver.h"
|
||||
|
||||
|
@ -10,11 +10,13 @@ CInputContext::CInputContext (CX11OpenGLDriver& videoDriver) :
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WAYLAND
|
||||
CInputContext::CInputContext (CWaylandOpenGLDriver& videoDriver) :
|
||||
m_mouse (nullptr)
|
||||
{
|
||||
// todo
|
||||
}
|
||||
#endif
|
||||
|
||||
void CInputContext::update ()
|
||||
{
|
||||
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h"
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
||||
#endif
|
||||
#include "CMouseInput.h"
|
||||
|
||||
namespace WallpaperEngine::Render::Drivers
|
||||
@ -15,7 +17,9 @@ namespace WallpaperEngine::Input
|
||||
{
|
||||
public:
|
||||
explicit CInputContext (Render::Drivers::CX11OpenGLDriver& videoDriver);
|
||||
#ifdef ENABLE_WAYLAND
|
||||
explicit CInputContext (Render::Drivers::CWaylandOpenGLDriver& videoDriver);
|
||||
#endif
|
||||
void update ();
|
||||
|
||||
[[nodiscard]] const CMouseInput& getMouseInput () const;
|
||||
|
Loading…
Reference in New Issue
Block a user