mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 21:32:23 +08:00
feat: conditionally enable wayland and x11 support
This commit is contained in:
parent
a14ded12d7
commit
953ef01749
2
.github/workflows/cmake.yml
vendored
2
.github/workflows/cmake.yml
vendored
@ -48,7 +48,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libfreeimage-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv1 libpulse-dev libpulse0 wayland-scanner++ wayland-protocols libwayland-dev libwayland-egl-backend-dev
|
run: sudo apt-get update && sudo apt-get -y install libfreeimage-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv1 libpulse-dev libpulse0 wayland-scanner++ wayland-protocols libwayland-dev libwayland-egl-backend-dev
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||||
|
@ -18,8 +18,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
|
|||||||
add_compile_definitions(ERRORONLY=${ERRORONLY})
|
add_compile_definitions(ERRORONLY=${ERRORONLY})
|
||||||
add_compile_definitions(DATADIR="${DATADIR}")
|
add_compile_definitions(DATADIR="${DATADIR}")
|
||||||
|
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11)
|
||||||
find_package(Xrandr REQUIRED)
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(GLEW REQUIRED)
|
find_package(GLEW REQUIRED)
|
||||||
find_package(GLUT REQUIRED)
|
find_package(GLUT REQUIRED)
|
||||||
@ -90,7 +89,6 @@ add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${MPV_INCLUDE_DIR}
|
${MPV_INCLUDE_DIR}
|
||||||
${X11_INCLUDE_DIR}
|
|
||||||
${XRANDR_INCLUDE_DIR}
|
${XRANDR_INCLUDE_DIR}
|
||||||
${GLEW_INCLUDE_DIR}
|
${GLEW_INCLUDE_DIR}
|
||||||
${LZ4_INCLUDE_DIR}
|
${LZ4_INCLUDE_DIR}
|
||||||
@ -155,6 +153,28 @@ if(WAYLAND_SUPPORT_FOUND)
|
|||||||
"wlr-layer-shell-unstable-v1-protocol.c")
|
"wlr-layer-shell-unstable-v1-protocol.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(X11_FOUND)
|
||||||
|
if(NOT X11_Xrandr_FOUND)
|
||||||
|
message(WARNING "X11 support disabled. Xrandr package is missing")
|
||||||
|
endif()
|
||||||
|
if(NOT X11_xf86vmode_FOUND)
|
||||||
|
message(WARNING "X11 support disabled. Xxf86vm package is missing")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(X11_SUPPORT_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(X11_SUPPORT_FOUND)
|
||||||
|
include_directories(${X11_INCLUDE_DIR})
|
||||||
|
add_compile_definitions(ENABLE_X11)
|
||||||
|
|
||||||
|
set(X11_SOURCES
|
||||||
|
"src/WallpaperEngine/Render/Drivers/Output/CX11Output.cpp"
|
||||||
|
"src/WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
||||||
|
"src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.cpp"
|
||||||
|
"src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
linux-wallpaperengine
|
linux-wallpaperengine
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -241,21 +261,17 @@ add_executable(
|
|||||||
|
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.cpp
|
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h
|
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/Output/COutput.cpp
|
src/WallpaperEngine/Render/Drivers/Output/COutput.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutput.h
|
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/CGLFWWindowOutput.cpp
|
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h
|
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h
|
||||||
|
src/WallpaperEngine/Render/Drivers/Output/CGLFWOutputViewport.cpp
|
||||||
|
src/WallpaperEngine/Render/Drivers/Output/CGLFWOutputViewport.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.cpp
|
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.h
|
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CX11OutputViewport.cpp
|
src/WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CX11OutputViewport.h
|
src/WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h
|
|
||||||
src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp
|
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.h
|
src/WallpaperEngine/Render/Drivers/CVideoDriver.h
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.cpp
|
src/WallpaperEngine/Render/Drivers/CVideoDriver.cpp
|
||||||
src/WallpaperEngine/Render/CRenderContext.h
|
src/WallpaperEngine/Render/CRenderContext.h
|
||||||
@ -295,8 +311,8 @@ add_executable(
|
|||||||
src/WallpaperEngine/Render/Objects/Effects/CMaterial.h
|
src/WallpaperEngine/Render/Objects/Effects/CMaterial.h
|
||||||
src/WallpaperEngine/Render/Objects/Effects/CMaterial.cpp
|
src/WallpaperEngine/Render/Objects/Effects/CMaterial.cpp
|
||||||
|
|
||||||
src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.cpp
|
src/WallpaperEngine/WebBrowser/CWebBrowserContext.cpp
|
||||||
src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.h
|
src/WallpaperEngine/WebBrowser/CWebBrowserContext.h
|
||||||
|
|
||||||
src/WallpaperEngine/FileSystem/FileSystem.cpp
|
src/WallpaperEngine/FileSystem/FileSystem.cpp
|
||||||
src/WallpaperEngine/FileSystem/FileSystem.h
|
src/WallpaperEngine/FileSystem/FileSystem.h
|
||||||
@ -397,6 +413,7 @@ add_executable(
|
|||||||
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h
|
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h
|
||||||
|
|
||||||
${WAYLAND_SOURCES}
|
${WAYLAND_SOURCES}
|
||||||
|
${X11_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
|
COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
|
||||||
@ -409,9 +426,6 @@ add_dependencies(linux-wallpaperengine libcef_dll_wrapper)
|
|||||||
# /usr/bin/ld: /usr/lib/libmpv.so: undefined reference to `vkCreateXlibSurfaceKHR'
|
# /usr/bin/ld: /usr/lib/libmpv.so: undefined reference to `vkCreateXlibSurfaceKHR'
|
||||||
file(REMOVE "${CEF_BINARY_DIR_DEBUG}/libvulkan.so.1" "${CEF_BINARY_DIR_RELEASE}/libvulkan.so.1")
|
file(REMOVE "${CEF_BINARY_DIR_DEBUG}/libvulkan.so.1" "${CEF_BINARY_DIR_RELEASE}/libvulkan.so.1")
|
||||||
target_link_libraries (linux-wallpaperengine PUBLIC
|
target_link_libraries (linux-wallpaperengine PUBLIC
|
||||||
${X11_LIBRARIES}
|
|
||||||
${Xrandr_LIBRARIES}
|
|
||||||
${X11_Xxf86vm_LIB}
|
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
${GLUT_LIBRARIES}
|
${GLUT_LIBRARIES}
|
||||||
@ -435,7 +449,10 @@ if (WAYLAND_SUPPORT_FOUND)
|
|||||||
${OPENGL_egl_LIBRARY})
|
${OPENGL_egl_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(CREATE_LINK linux-wallpaperengine wallengine SYMBOLIC)
|
if(X11_SUPPORT_FOUND)
|
||||||
|
target_link_libraries (linux-wallpaperengine PUBLIC
|
||||||
|
${X11_LIBRARIES} ${X11_Xrandr_LIB})
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${X11_LIBRARIES})
|
set(CMAKE_REQUIRED_LIBRARIES ${X11_LIBRARIES})
|
||||||
|
|
||||||
@ -445,6 +462,9 @@ check_function_exists(XSetIOErrorExitHandler HAVE_XSETIOERROREXITHANDLER)
|
|||||||
if(HAVE_XSETIOERROREXITHANDLER)
|
if(HAVE_XSETIOERROREXITHANDLER)
|
||||||
add_compile_definitions(HAVE_XSETIOERROREXITHANDLER=1)
|
add_compile_definitions(HAVE_XSETIOERROREXITHANDLER=1)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(CREATE_LINK linux-wallpaperengine wallengine SYMBOLIC)
|
||||||
|
|
||||||
# set some install parameters if not in debug mode
|
# set some install parameters if not in debug mode
|
||||||
install(TARGETS linux-wallpaperengine)
|
install(TARGETS linux-wallpaperengine)
|
||||||
|
2
main.cpp
2
main.cpp
@ -4,7 +4,7 @@
|
|||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/CApplicationContext.h"
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Core/Wallpapers/CWeb.h"
|
#include "WallpaperEngine/Core/Wallpapers/CWeb.h"
|
||||||
#include "WallpaperEngine/WebBrowsesr/CWebBrowserContext.h"
|
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
WallpaperEngine::Application::CWallpaperApplication* appPointer;
|
WallpaperEngine::Application::CWallpaperApplication* appPointer;
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Input/Drivers/CWaylandMouseInput.h"
|
#include "WallpaperEngine/Input/Drivers/CWaylandMouseInput.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
||||||
|
#include "WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h"
|
||||||
|
|
||||||
|
#define FULLSCREEN_CHECK_WAIT_TIME 250
|
||||||
|
|
||||||
float g_Time;
|
float g_Time;
|
||||||
float g_TimeLast;
|
float g_TimeLast;
|
||||||
@ -255,26 +258,67 @@ void CWallpaperApplication::takeScreenshot (const Render::CRenderContext& contex
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::show () {
|
void CWallpaperApplication::show () {
|
||||||
|
const char* XDG_SESSION_TYPE = getenv ("XDG_SESSION_TYPE");
|
||||||
|
|
||||||
|
if (!XDG_SESSION_TYPE) {
|
||||||
|
sLog.exception("Cannot read environment variable XDG_SESSION_TYPE, window server detection failed. Please ensure proper values are set");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
const bool WAYLAND_DISPLAY = getenv ("WAYLAND_DISPLAY");
|
bool isWayland = strncmp("wayland", XDG_SESSION_TYPE, strlen("wayland")) == 0;
|
||||||
|
#endif // ENABLE_WAYLAND
|
||||||
|
#ifdef ENABLE_X11
|
||||||
|
bool isX11 = strncmp("x11", XDG_SESSION_TYPE, strlen("x11")) == 0;
|
||||||
|
#endif // ENABLE_X11
|
||||||
|
|
||||||
// setup the right video driver based on the environment and the startup mode requested
|
if (this->m_context.settings.render.mode == CApplicationContext::DESKTOP_BACKGROUND) {
|
||||||
if (WAYLAND_DISPLAY && this->m_context.settings.render.mode == CApplicationContext::DESKTOP_BACKGROUND) {
|
#ifdef ENABLE_WAYLAND
|
||||||
const auto waylandDriver = new WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver (this->m_context, *this);
|
if (isWayland) {
|
||||||
|
videoDriver = new WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver (this->m_context, *this);
|
||||||
inputContext = new WallpaperEngine::Input::CInputContext (
|
inputContext = new WallpaperEngine::Input::CInputContext (
|
||||||
new WallpaperEngine::Input::Drivers::CWaylandMouseInput (waylandDriver));
|
new WallpaperEngine::Input::Drivers::CWaylandMouseInput (reinterpret_cast<WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver*>(videoDriver)));
|
||||||
|
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector(this->m_context);
|
||||||
videoDriver = waylandDriver;
|
}
|
||||||
} else
|
#endif // ENABLE_WAYLAND
|
||||||
#endif
|
#ifdef ENABLE_X11
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
|
else
|
||||||
|
#endif // ENABLE_WAYLAND
|
||||||
|
if (isX11)
|
||||||
{
|
{
|
||||||
const auto x11Driver =
|
videoDriver = new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
||||||
new WallpaperEngine::Render::Drivers::CX11OpenGLDriver ("wallpaperengine", this->m_context, *this);
|
|
||||||
// no wayland detected, try the old X11 method
|
|
||||||
inputContext = new WallpaperEngine::Input::CInputContext (
|
inputContext = new WallpaperEngine::Input::CInputContext (
|
||||||
new WallpaperEngine::Input::Drivers::CGLFWMouseInput (x11Driver));
|
new WallpaperEngine::Input::Drivers::CGLFWMouseInput (reinterpret_cast <Render::Drivers::CGLFWOpenGLDriver*>(videoDriver)));
|
||||||
|
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (this->m_context, *reinterpret_cast <Render::Drivers::CGLFWOpenGLDriver*>(videoDriver));
|
||||||
|
}
|
||||||
|
#endif // ENABLE_X11
|
||||||
|
else {
|
||||||
|
sLog.exception("Cannot run in background mode, window server could not be detected. XDG_SESSION_TYPE must be wayland or x11");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
videoDriver = new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
||||||
|
|
||||||
videoDriver = x11Driver;
|
#ifdef ENABLE_WAYLAND
|
||||||
|
if (isWayland) {
|
||||||
|
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector(this->m_context);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_WAYLAND
|
||||||
|
#ifdef ENABLE_X11
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
|
else
|
||||||
|
#endif // ENABLE_WAYLAND
|
||||||
|
if(isX11)
|
||||||
|
{
|
||||||
|
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (this->m_context, *reinterpret_cast <Render::Drivers::CGLFWOpenGLDriver*>(videoDriver));
|
||||||
|
}
|
||||||
|
#endif // ENABLE_X11
|
||||||
|
else {
|
||||||
|
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector (this->m_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
inputContext = new WallpaperEngine::Input::CInputContext (
|
||||||
|
new WallpaperEngine::Input::Drivers::CGLFWMouseInput (reinterpret_cast <Render::Drivers::CGLFWOpenGLDriver*>(videoDriver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->m_context.settings.audio.audioprocessing) {
|
if (this->m_context.settings.audio.audioprocessing) {
|
||||||
@ -285,7 +329,7 @@ void CWallpaperApplication::show () {
|
|||||||
|
|
||||||
// audio playing detector
|
// audio playing detector
|
||||||
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (
|
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (
|
||||||
this->m_context, videoDriver->getFullscreenDetector ());
|
this->m_context, *this->fullScreenDetector);
|
||||||
// initialize sdl audio driver
|
// initialize sdl audio driver
|
||||||
audioDriver =
|
audioDriver =
|
||||||
new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, *this->audioRecorder);
|
new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, *this->audioRecorder);
|
||||||
@ -345,6 +389,10 @@ void CWallpaperApplication::show () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::update (Render::Drivers::Output::COutputViewport* viewport) {
|
void CWallpaperApplication::update (Render::Drivers::Output::COutputViewport* viewport) {
|
||||||
|
// check for fullscreen windows and wait until there's none fullscreen
|
||||||
|
while (this->fullScreenDetector->anythingFullscreen () && this->m_context.state.general.keepRunning)
|
||||||
|
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
||||||
|
|
||||||
// render the scene
|
// render the scene
|
||||||
context->render (viewport);
|
context->render (viewport);
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,23 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
#include "WallpaperEngine/Render/CRenderContext.h"
|
||||||
#include "WallpaperEngine/Render/CWallpaper.h"
|
#include "WallpaperEngine/Render/CWallpaper.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
||||||
|
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_X11
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h"
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
||||||
|
#ifdef ENABLE_X11
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
||||||
#endif
|
#endif
|
||||||
@ -27,7 +32,7 @@
|
|||||||
#include "WallpaperEngine/Audio/Drivers/CSDLAudioDriver.h"
|
#include "WallpaperEngine/Audio/Drivers/CSDLAudioDriver.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Input/CInputContext.h"
|
#include "WallpaperEngine/Input/CInputContext.h"
|
||||||
#include "WallpaperEngine/WebBrowsesr/CWebBrowserContext.h"
|
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
/**
|
/**
|
||||||
@ -117,12 +122,13 @@ class CWallpaperApplication {
|
|||||||
/** Maps screens to backgrounds */
|
/** Maps screens to backgrounds */
|
||||||
std::map<std::string, Core::CProject*> m_backgrounds;
|
std::map<std::string, Core::CProject*> m_backgrounds;
|
||||||
|
|
||||||
WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder* audioRecorder;
|
|
||||||
WallpaperEngine::Render::Drivers::CVideoDriver* videoDriver;
|
|
||||||
WallpaperEngine::Input::CInputContext* inputContext;
|
|
||||||
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* audioDriver;
|
|
||||||
WallpaperEngine::Render::CRenderContext* context;
|
|
||||||
WallpaperEngine::Audio::CAudioContext* audioContext;
|
WallpaperEngine::Audio::CAudioContext* audioContext;
|
||||||
|
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* audioDriver;
|
||||||
|
WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder* audioRecorder;
|
||||||
|
WallpaperEngine::Input::CInputContext* inputContext;
|
||||||
|
WallpaperEngine::Render::CRenderContext* context;
|
||||||
|
WallpaperEngine::Render::Drivers::CVideoDriver* videoDriver;
|
||||||
|
WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector* fullScreenDetector;
|
||||||
WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext;
|
WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "CGLFWMouseInput.h"
|
#include "CGLFWMouseInput.h"
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Input::Drivers;
|
using namespace WallpaperEngine::Input::Drivers;
|
||||||
|
|
||||||
CGLFWMouseInput::CGLFWMouseInput (Render::Drivers::CX11OpenGLDriver* driver) :
|
CGLFWMouseInput::CGLFWMouseInput (Render::Drivers::CGLFWOpenGLDriver* driver) :
|
||||||
m_reportedPosition (),
|
m_reportedPosition (),
|
||||||
m_mousePosition (),
|
m_mousePosition (),
|
||||||
m_driver (driver) {}
|
m_driver (driver) {}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CX11OpenGLDriver;
|
class CGLFWOpenGLDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Input::Drivers {
|
namespace WallpaperEngine::Input::Drivers {
|
||||||
@ -14,7 +14,7 @@ namespace WallpaperEngine::Input::Drivers {
|
|||||||
*/
|
*/
|
||||||
class CGLFWMouseInput final : public CMouseInput {
|
class CGLFWMouseInput final : public CMouseInput {
|
||||||
public:
|
public:
|
||||||
explicit CGLFWMouseInput (Render::Drivers::CX11OpenGLDriver* driver);
|
explicit CGLFWMouseInput (Render::Drivers::CGLFWOpenGLDriver* driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes current mouse position and updates it
|
* Takes current mouse position and updates it
|
||||||
@ -27,7 +27,7 @@ class CGLFWMouseInput final : public CMouseInput {
|
|||||||
[[nodiscard]] glm::dvec2 position () const override;
|
[[nodiscard]] glm::dvec2 position () const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Render::Drivers::CX11OpenGLDriver* m_driver;
|
Render::Drivers::CGLFWOpenGLDriver* m_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current mouse position
|
* The current mouse position
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
#include "WallpaperEngine/Render/CRenderContext.h"
|
||||||
#include "WallpaperEngine/Render/Helpers/CContextAware.h"
|
#include "WallpaperEngine/Render/Helpers/CContextAware.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/WebBrowsesr/CWebBrowserContext.h"
|
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
|
||||||
|
|
||||||
#include "CWallpaperState.h"
|
#include "CWallpaperState.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "CX11OpenGLDriver.h"
|
#include "CGLFWOpenGLDriver.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <FreeImage.h>
|
#include <FreeImage.h>
|
||||||
@ -14,9 +14,8 @@ void CustomGLFWErrorHandler (int errorCode, const char* reason) {
|
|||||||
sLog.error ("GLFW error ", errorCode, ": ", reason);
|
sLog.error ("GLFW error ", errorCode, ": ", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app) :
|
CGLFWOpenGLDriver::CGLFWOpenGLDriver (const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app) :
|
||||||
m_frameCounter (0),
|
m_frameCounter (0),
|
||||||
m_fullscreenDetector (context, *this),
|
|
||||||
m_context (context),
|
m_context (context),
|
||||||
CVideoDriver (app) {
|
CVideoDriver (app) {
|
||||||
glfwSetErrorCallback (CustomGLFWErrorHandler);
|
glfwSetErrorCallback (CustomGLFWErrorHandler);
|
||||||
@ -68,50 +67,53 @@ CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle, CApplicationContext
|
|||||||
if (context.settings.render.mode == CApplicationContext::EXPLICIT_WINDOW ||
|
if (context.settings.render.mode == CApplicationContext::EXPLICIT_WINDOW ||
|
||||||
context.settings.render.mode == CApplicationContext::NORMAL_WINDOW) {
|
context.settings.render.mode == CApplicationContext::NORMAL_WINDOW) {
|
||||||
m_output = new WallpaperEngine::Render::Drivers::Output::CGLFWWindowOutput (context, *this);
|
m_output = new WallpaperEngine::Render::Drivers::Output::CGLFWWindowOutput (context, *this);
|
||||||
} else {
|
}
|
||||||
|
#ifdef ENABLE_X11
|
||||||
|
else {
|
||||||
m_output = new WallpaperEngine::Render::Drivers::Output::CX11Output (context, *this);
|
m_output = new WallpaperEngine::Render::Drivers::Output::CX11Output (context, *this);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
else {
|
||||||
|
sLog.exception("Trying to start GLFW in background mode without X11 support installed. Bailing out");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11OpenGLDriver::~CX11OpenGLDriver () {
|
CGLFWOpenGLDriver::~CGLFWOpenGLDriver () {
|
||||||
glfwTerminate ();
|
glfwTerminate ();
|
||||||
FreeImage_DeInitialise ();
|
FreeImage_DeInitialise ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Detectors::CFullScreenDetector& CX11OpenGLDriver::getFullscreenDetector () {
|
Output::COutput& CGLFWOpenGLDriver::getOutput () {
|
||||||
return this->m_fullscreenDetector;
|
|
||||||
}
|
|
||||||
|
|
||||||
Output::COutput& CX11OpenGLDriver::getOutput () {
|
|
||||||
return *this->m_output;
|
return *this->m_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CX11OpenGLDriver::getRenderTime () const {
|
float CGLFWOpenGLDriver::getRenderTime () const {
|
||||||
return static_cast<float> (glfwGetTime ());
|
return static_cast<float> (glfwGetTime ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CX11OpenGLDriver::closeRequested () {
|
bool CGLFWOpenGLDriver::closeRequested () {
|
||||||
return glfwWindowShouldClose (this->m_window);
|
return glfwWindowShouldClose (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11OpenGLDriver::resizeWindow (glm::ivec2 size) {
|
void CGLFWOpenGLDriver::resizeWindow (glm::ivec2 size) {
|
||||||
glfwSetWindowSize (this->m_window, size.x, size.y);
|
glfwSetWindowSize (this->m_window, size.x, size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11OpenGLDriver::resizeWindow (glm::ivec4 sizeandpos) {
|
void CGLFWOpenGLDriver::resizeWindow (glm::ivec4 sizeandpos) {
|
||||||
glfwSetWindowPos (this->m_window, sizeandpos.x, sizeandpos.y);
|
glfwSetWindowPos (this->m_window, sizeandpos.x, sizeandpos.y);
|
||||||
glfwSetWindowSize (this->m_window, sizeandpos.z, sizeandpos.w);
|
glfwSetWindowSize (this->m_window, sizeandpos.z, sizeandpos.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11OpenGLDriver::showWindow () {
|
void CGLFWOpenGLDriver::showWindow () {
|
||||||
glfwShowWindow (this->m_window);
|
glfwShowWindow (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11OpenGLDriver::hideWindow () {
|
void CGLFWOpenGLDriver::hideWindow () {
|
||||||
glfwHideWindow (this->m_window);
|
glfwHideWindow (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::ivec2 CX11OpenGLDriver::getFramebufferSize () const {
|
glm::ivec2 CGLFWOpenGLDriver::getFramebufferSize () const {
|
||||||
glm::ivec2 size;
|
glm::ivec2 size;
|
||||||
|
|
||||||
glfwGetFramebufferSize (this->m_window, &size.x, &size.y);
|
glfwGetFramebufferSize (this->m_window, &size.x, &size.y);
|
||||||
@ -119,11 +121,11 @@ glm::ivec2 CX11OpenGLDriver::getFramebufferSize () const {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CX11OpenGLDriver::getFrameCounter () const {
|
uint32_t CGLFWOpenGLDriver::getFrameCounter () const {
|
||||||
return this->m_frameCounter;
|
return this->m_frameCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11OpenGLDriver::dispatchEventQueue () {
|
void CGLFWOpenGLDriver::dispatchEventQueue () {
|
||||||
static float startTime, endTime, minimumTime = 1.0f / this->m_context.settings.render.maximumFPS;
|
static float startTime, endTime, minimumTime = 1.0f / this->m_context.settings.render.maximumFPS;
|
||||||
// get the start time of the frame
|
// get the start time of the frame
|
||||||
startTime = this->getRenderTime ();
|
startTime = this->getRenderTime ();
|
||||||
@ -156,10 +158,10 @@ void CX11OpenGLDriver::dispatchEventQueue () {
|
|||||||
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CX11OpenGLDriver::getProcAddress (const char* name) const {
|
void* CGLFWOpenGLDriver::getProcAddress (const char* name) const {
|
||||||
return reinterpret_cast<void*> (glfwGetProcAddress (name));
|
return reinterpret_cast<void*> (glfwGetProcAddress (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWwindow* CX11OpenGLDriver::getWindow () {
|
GLFWwindow* CGLFWOpenGLDriver::getWindow () {
|
||||||
return this->m_window;
|
return this->m_window;
|
||||||
}
|
}
|
@ -4,8 +4,6 @@
|
|||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h"
|
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
@ -17,12 +15,11 @@ class CWallpaperApplication;
|
|||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
|
|
||||||
class CX11OpenGLDriver final : public CVideoDriver {
|
class CGLFWOpenGLDriver final : public CVideoDriver {
|
||||||
public:
|
public:
|
||||||
explicit CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app);
|
explicit CGLFWOpenGLDriver (const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app);
|
||||||
~CX11OpenGLDriver () override;
|
~CGLFWOpenGLDriver () override;
|
||||||
|
|
||||||
[[nodiscard]] Detectors::CFullScreenDetector& getFullscreenDetector () override;
|
|
||||||
[[nodiscard]] Output::COutput& getOutput () override;
|
[[nodiscard]] Output::COutput& getOutput () override;
|
||||||
[[nodiscard]] float getRenderTime () const override;
|
[[nodiscard]] float getRenderTime () const override;
|
||||||
bool closeRequested () override;
|
bool closeRequested () override;
|
||||||
@ -38,7 +35,6 @@ class CX11OpenGLDriver final : public CVideoDriver {
|
|||||||
GLFWwindow* getWindow ();
|
GLFWwindow* getWindow ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Detectors::CX11FullScreenDetector m_fullscreenDetector;
|
|
||||||
CApplicationContext& m_context;
|
CApplicationContext& m_context;
|
||||||
Output::COutput* m_output;
|
Output::COutput* m_output;
|
||||||
GLFWwindow* m_window;
|
GLFWwindow* m_window;
|
@ -19,10 +19,6 @@ class CVideoDriver {
|
|||||||
explicit CVideoDriver (CWallpaperApplication& app);
|
explicit CVideoDriver (CWallpaperApplication& app);
|
||||||
virtual ~CVideoDriver ();
|
virtual ~CVideoDriver ();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The fullscreen detector this video driver uses
|
|
||||||
*/
|
|
||||||
[[nodiscard]] virtual Detectors::CFullScreenDetector& getFullscreenDetector () = 0;
|
|
||||||
/**
|
/**
|
||||||
* @return The current output in use
|
* @return The current output in use
|
||||||
*/
|
*/
|
||||||
|
@ -214,7 +214,6 @@ void CWaylandOpenGLDriver::onLayerClose (Output::CWaylandOutputViewport* viewpor
|
|||||||
|
|
||||||
CWaylandOpenGLDriver::CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app) :
|
CWaylandOpenGLDriver::CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app) :
|
||||||
m_frameCounter (0),
|
m_frameCounter (0),
|
||||||
m_fullscreenDetector (context, *this),
|
|
||||||
m_output (context, *this),
|
m_output (context, *this),
|
||||||
m_requestedExit (false),
|
m_requestedExit (false),
|
||||||
m_context (context),
|
m_context (context),
|
||||||
@ -305,10 +304,6 @@ void CWaylandOpenGLDriver::dispatchEventQueue () {
|
|||||||
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
Detectors::CFullScreenDetector& CWaylandOpenGLDriver::getFullscreenDetector () {
|
|
||||||
return this->m_fullscreenDetector;
|
|
||||||
}
|
|
||||||
|
|
||||||
Output::COutput& CWaylandOpenGLDriver::getOutput () {
|
Output::COutput& CWaylandOpenGLDriver::getOutput () {
|
||||||
return this->m_output;
|
return this->m_output;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ class CWaylandOpenGLDriver final : public CVideoDriver {
|
|||||||
explicit CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app);
|
explicit CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app);
|
||||||
~CWaylandOpenGLDriver ();
|
~CWaylandOpenGLDriver ();
|
||||||
|
|
||||||
[[nodiscard]] Detectors::CFullScreenDetector& getFullscreenDetector () override;
|
|
||||||
[[nodiscard]] Output::COutput& getOutput () override;
|
[[nodiscard]] Output::COutput& getOutput () override;
|
||||||
float getRenderTime () const override;
|
float getRenderTime () const override;
|
||||||
bool closeRequested () override;
|
bool closeRequested () override;
|
||||||
@ -87,8 +86,6 @@ class CWaylandOpenGLDriver final : public CVideoDriver {
|
|||||||
std::vector<Output::CWaylandOutputViewport*> m_screens;
|
std::vector<Output::CWaylandOutputViewport*> m_screens;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Fullscreen detection used by this driver */
|
|
||||||
Detectors::CWaylandFullScreenDetector m_fullscreenDetector;
|
|
||||||
/** The output used by the driver */
|
/** The output used by the driver */
|
||||||
Output::CWaylandOutput m_output;
|
Output::CWaylandOutput m_output;
|
||||||
/** The EGL context in use */
|
/** The EGL context in use */
|
||||||
|
@ -9,3 +9,9 @@ CFullScreenDetector::CFullScreenDetector (Application::CApplicationContext& appC
|
|||||||
Application::CApplicationContext& CFullScreenDetector::getApplicationContext () const {
|
Application::CApplicationContext& CFullScreenDetector::getApplicationContext () const {
|
||||||
return this->m_applicationContext;
|
return this->m_applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CFullScreenDetector::anythingFullscreen () const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFullScreenDetector::reset () {}
|
@ -11,12 +11,11 @@ class CFullScreenDetector {
|
|||||||
/**
|
/**
|
||||||
* @return If anything is fullscreen
|
* @return If anything is fullscreen
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual bool anythingFullscreen () const = 0;
|
[[nodiscard]] virtual bool anythingFullscreen () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restarts the fullscreen detector, specially useful if there's any resources tied to the output driver
|
* Restarts the fullscreen detector, specially useful if there's any resources tied to the output driver
|
||||||
*/
|
*/
|
||||||
virtual void reset () = 0;
|
virtual void reset ();
|
||||||
/**
|
/**
|
||||||
* @return The application context using this detector
|
* @return The application context using this detector
|
||||||
*/
|
*/
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Detectors;
|
using namespace WallpaperEngine::Render::Drivers::Detectors;
|
||||||
|
|
||||||
CWaylandFullScreenDetector::CWaylandFullScreenDetector (Application::CApplicationContext& appContext,
|
CWaylandFullScreenDetector::CWaylandFullScreenDetector (Application::CApplicationContext& appContext) :
|
||||||
CWaylandOpenGLDriver& driver) :
|
|
||||||
CFullScreenDetector (appContext) {}
|
CFullScreenDetector (appContext) {}
|
||||||
|
|
||||||
bool CWaylandFullScreenDetector::anythingFullscreen () const {
|
bool CWaylandFullScreenDetector::anythingFullscreen () const {
|
||||||
|
@ -15,7 +15,7 @@ class CWaylandOpenGLDriver;
|
|||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CWaylandFullScreenDetector final : public CFullScreenDetector {
|
class CWaylandFullScreenDetector final : public CFullScreenDetector {
|
||||||
public:
|
public:
|
||||||
CWaylandFullScreenDetector (Application::CApplicationContext& appContext, CWaylandOpenGLDriver& driver);
|
CWaylandFullScreenDetector (Application::CApplicationContext& appContext);
|
||||||
~CWaylandFullScreenDetector () override = default;
|
~CWaylandFullScreenDetector () override = default;
|
||||||
|
|
||||||
[[nodiscard]] bool anythingFullscreen () const override;
|
[[nodiscard]] bool anythingFullscreen () const override;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Detectors {
|
namespace WallpaperEngine::Render::Drivers::Detectors {
|
||||||
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
||||||
@ -29,7 +29,7 @@ int CustomXIOErrorHandler (Display* dsp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CX11FullScreenDetector::CX11FullScreenDetector (Application::CApplicationContext& appContext,
|
CX11FullScreenDetector::CX11FullScreenDetector (Application::CApplicationContext& appContext,
|
||||||
CX11OpenGLDriver& driver) :
|
CGLFWOpenGLDriver& driver) :
|
||||||
CFullScreenDetector (appContext),
|
CFullScreenDetector (appContext),
|
||||||
m_driver (driver) {
|
m_driver (driver) {
|
||||||
// do not use previous handler, it might stop the app under weird circumstances
|
// do not use previous handler, it might stop the app under weird circumstances
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CX11OpenGLDriver;
|
class CGLFWOpenGLDriver;
|
||||||
|
|
||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CX11FullScreenDetector final : public CFullScreenDetector {
|
class CX11FullScreenDetector final : public CFullScreenDetector {
|
||||||
public:
|
public:
|
||||||
CX11FullScreenDetector (Application::CApplicationContext& appContext, CX11OpenGLDriver& driver);
|
CX11FullScreenDetector (Application::CApplicationContext& appContext, CGLFWOpenGLDriver& driver);
|
||||||
~CX11FullScreenDetector () override;
|
~CX11FullScreenDetector () override;
|
||||||
|
|
||||||
[[nodiscard]] bool anythingFullscreen () const override;
|
[[nodiscard]] bool anythingFullscreen () const override;
|
||||||
@ -31,7 +31,7 @@ class CX11FullScreenDetector final : public CFullScreenDetector {
|
|||||||
Display* m_display;
|
Display* m_display;
|
||||||
Window m_root;
|
Window m_root;
|
||||||
std::vector<ScreenInfo> m_screens;
|
std::vector<ScreenInfo> m_screens;
|
||||||
CX11OpenGLDriver& m_driver;
|
CGLFWOpenGLDriver& m_driver;
|
||||||
};
|
};
|
||||||
} // namespace Detectors
|
} // namespace Detectors
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
@ -0,0 +1,12 @@
|
|||||||
|
#include "CGLFWOutputViewport.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
|
CGLFWOutputViewport::CGLFWOutputViewport (glm::ivec4 viewport, std::string name) :
|
||||||
|
COutputViewport (viewport, std::move (name)) {}
|
||||||
|
|
||||||
|
void CGLFWOutputViewport::makeCurrent () {}
|
||||||
|
|
||||||
|
void CGLFWOutputViewport::swapOutput () {}
|
@ -3,9 +3,9 @@
|
|||||||
#include "COutputViewport.h"
|
#include "COutputViewport.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Output {
|
namespace WallpaperEngine::Render::Drivers::Output {
|
||||||
class CX11OutputViewport final : public COutputViewport {
|
class CGLFWOutputViewport final : public COutputViewport {
|
||||||
public:
|
public:
|
||||||
CX11OutputViewport (glm::ivec4 viewport, std::string name);
|
CGLFWOutputViewport (glm::ivec4 viewport, std::string name);
|
||||||
|
|
||||||
void makeCurrent () override;
|
void makeCurrent () override;
|
||||||
void swapOutput () override;
|
void swapOutput () override;
|
@ -1,13 +1,11 @@
|
|||||||
#include "CGLFWWindowOutput.h"
|
#include "CGLFWWindowOutput.h"
|
||||||
#include "CX11OutputViewport.h"
|
#include "CGLFWOutputViewport.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/CLog.h"
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define FULLSCREEN_CHECK_WAIT_TIME 250
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver& driver) : COutput (context, driver) {
|
CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver& driver) : COutput (context, driver) {
|
||||||
@ -29,7 +27,7 @@ CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register the default viewport
|
// register the default viewport
|
||||||
this->m_viewports ["default"] = new CX11OutputViewport {{0, 0, this->m_fullWidth, this->m_fullHeight}, "default"};
|
this->m_viewports ["default"] = new CGLFWOutputViewport {{0, 0, this->m_fullWidth, this->m_fullHeight}, "default"};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWWindowOutput::repositionWindow () {
|
void CGLFWWindowOutput::repositionWindow () {
|
||||||
@ -68,8 +66,4 @@ void CGLFWWindowOutput::updateRender () const {
|
|||||||
|
|
||||||
// update the default viewport
|
// update the default viewport
|
||||||
this->m_viewports ["default"]->viewport = {0, 0, this->m_fullWidth, this->m_fullHeight};
|
this->m_viewports ["default"]->viewport = {0, 0, this->m_fullWidth, this->m_fullHeight};
|
||||||
|
|
||||||
// check for fullscreen windows and wait until there's none fullscreen
|
|
||||||
while (this->m_driver.getFullscreenDetector ().anythingFullscreen () && this->m_context.state.general.keepRunning)
|
|
||||||
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#include "CX11Output.h"
|
#include "CX11Output.h"
|
||||||
#include "CX11OutputViewport.h"
|
#include "CGLFWOutputViewport.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
@ -7,8 +7,6 @@
|
|||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define FULLSCREEN_CHECK_WAIT_TIME 250
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
||||||
@ -50,7 +48,8 @@ void CX11Output::reset () {
|
|||||||
// re-load screen info
|
// re-load screen info
|
||||||
this->loadScreenInfo ();
|
this->loadScreenInfo ();
|
||||||
// do the same for the detector
|
// do the same for the detector
|
||||||
this->m_driver.getFullscreenDetector ().reset ();
|
// TODO: BRING BACK THIS FUNCTIONALITY
|
||||||
|
// this->m_driver.getFullscreenDetector ().reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11Output::free () {
|
void CX11Output::free () {
|
||||||
@ -125,7 +124,7 @@ void CX11Output::loadScreenInfo () {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// add the screen to the list of screens
|
// add the screen to the list of screens
|
||||||
this->m_screens.push_back (new CX11OutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name});
|
this->m_screens.push_back (new CGLFWOutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name});
|
||||||
|
|
||||||
// only keep info of registered screens
|
// only keep info of registered screens
|
||||||
if (this->m_context.settings.general.screenBackgrounds.find (info->name) !=
|
if (this->m_context.settings.general.screenBackgrounds.find (info->name) !=
|
||||||
@ -134,7 +133,7 @@ void CX11Output::loadScreenInfo () {
|
|||||||
crtc->height);
|
crtc->height);
|
||||||
|
|
||||||
this->m_viewports [info->name] =
|
this->m_viewports [info->name] =
|
||||||
new CX11OutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name};
|
new CGLFWOutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name};
|
||||||
}
|
}
|
||||||
|
|
||||||
XRRFreeCrtcInfo (crtc);
|
XRRFreeCrtcInfo (crtc);
|
||||||
@ -189,8 +188,4 @@ void CX11Output::updateRender () const {
|
|||||||
|
|
||||||
XClearWindow (this->m_display, this->m_root);
|
XClearWindow (this->m_display, this->m_root);
|
||||||
XFlush (this->m_display);
|
XFlush (this->m_display);
|
||||||
|
|
||||||
// check for fullscreen windows and wait until there's none fullscreen
|
|
||||||
while (this->m_driver.getFullscreenDetector ().anythingFullscreen () && this->m_context.state.general.keepRunning)
|
|
||||||
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#include "CX11OutputViewport.h"
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
|
||||||
|
|
||||||
CX11OutputViewport::CX11OutputViewport (glm::ivec4 viewport, std::string name) :
|
|
||||||
COutputViewport (viewport, std::move (name)) {}
|
|
||||||
|
|
||||||
void CX11OutputViewport::makeCurrent () {}
|
|
||||||
|
|
||||||
void CX11OutputViewport::swapOutput () {}
|
|
Loading…
Reference in New Issue
Block a user