mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
chore: remove C prefix from most classes + fix namespace for textures
This commit is contained in:
parent
1411ad6c5e
commit
a86f258c6c
219
CMakeLists.txt
219
CMakeLists.txt
@ -158,16 +158,16 @@ if(WAYLAND_SUPPORT_FOUND)
|
|||||||
wayland-egl
|
wayland-egl
|
||||||
${OPENGL_egl_LIBRARY})
|
${OPENGL_egl_LIBRARY})
|
||||||
set(WAYLAND_SOURCES
|
set(WAYLAND_SOURCES
|
||||||
src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h
|
src/WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.h
|
||||||
src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.cpp
|
src/WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.cpp
|
src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h
|
src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.cpp
|
src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h
|
src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutputViewport.cpp
|
src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CWaylandOutputViewport.h
|
src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.h
|
||||||
src/WallpaperEngine/Input/Drivers/CWaylandMouseInput.cpp
|
src/WallpaperEngine/Input/Drivers/WaylandMouseInput.cpp
|
||||||
src/WallpaperEngine/Input/Drivers/CWaylandMouseInput.h
|
src/WallpaperEngine/Input/Drivers/WaylandMouseInput.h
|
||||||
${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.c
|
${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.c
|
||||||
${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.h
|
${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.h
|
||||||
${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.c
|
${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.c
|
||||||
@ -197,10 +197,10 @@ if(X11_SUPPORT_FOUND)
|
|||||||
${X11_LIBRARIES}
|
${X11_LIBRARIES}
|
||||||
${X11_Xrandr_LIB})
|
${X11_Xrandr_LIB})
|
||||||
set(X11_SOURCES
|
set(X11_SOURCES
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CX11Output.cpp
|
src/WallpaperEngine/Render/Drivers/Output/X11Output.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CX11Output.h
|
src/WallpaperEngine/Render/Drivers/Output/X11Output.h
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.cpp
|
src/WallpaperEngine/Render/Drivers/Detectors/X11FullScreenDetector.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CX11FullScreenDetector.h)
|
src/WallpaperEngine/Render/Drivers/Detectors/X11FullScreenDetector.h)
|
||||||
SET(X11_INCLUDES
|
SET(X11_INCLUDES
|
||||||
${X11_INCLUDE_DIR}
|
${X11_INCLUDE_DIR}
|
||||||
${XRANDR_INCLUDE_DIR})
|
${XRANDR_INCLUDE_DIR})
|
||||||
@ -259,16 +259,16 @@ add_executable(
|
|||||||
src/Steam/FileSystem/FileSystem.cpp
|
src/Steam/FileSystem/FileSystem.cpp
|
||||||
src/Steam/FileSystem/FileSystem.h
|
src/Steam/FileSystem/FileSystem.h
|
||||||
|
|
||||||
src/WallpaperEngine/Logging/CLog.cpp
|
src/WallpaperEngine/Logging/Log.cpp
|
||||||
src/WallpaperEngine/Logging/CLog.h
|
src/WallpaperEngine/Logging/Log.h
|
||||||
|
|
||||||
src/WallpaperEngine/Application/CApplicationContext.cpp
|
src/WallpaperEngine/Application/ApplicationContext.cpp
|
||||||
src/WallpaperEngine/Application/CApplicationContext.h
|
src/WallpaperEngine/Application/ApplicationContext.h
|
||||||
src/WallpaperEngine/Application/CWallpaperApplication.cpp
|
src/WallpaperEngine/Application/WallpaperApplication.cpp
|
||||||
src/WallpaperEngine/Application/CWallpaperApplication.h
|
src/WallpaperEngine/Application/WallpaperApplication.h
|
||||||
|
|
||||||
src/WallpaperEngine/Assets/CAssetLoadException.cpp
|
src/WallpaperEngine/Assets/AssetLoadException.cpp
|
||||||
src/WallpaperEngine/Assets/CAssetLoadException.h
|
src/WallpaperEngine/Assets/AssetLoadException.h
|
||||||
|
|
||||||
src/WallpaperEngine/FileSystem/Container.h
|
src/WallpaperEngine/FileSystem/Container.h
|
||||||
src/WallpaperEngine/FileSystem/Container.cpp
|
src/WallpaperEngine/FileSystem/Container.cpp
|
||||||
@ -280,100 +280,99 @@ add_executable(
|
|||||||
src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp
|
src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp
|
||||||
src/WallpaperEngine/FileSystem/Adapters/Virtual.h
|
src/WallpaperEngine/FileSystem/Adapters/Virtual.h
|
||||||
|
|
||||||
src/WallpaperEngine/Audio/Drivers/Recorders/CPulseAudioPlaybackRecorder.cpp
|
src/WallpaperEngine/Audio/Drivers/Recorders/PulseAudioPlaybackRecorder.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/Recorders/CPulseAudioPlaybackRecorder.h
|
src/WallpaperEngine/Audio/Drivers/Recorders/PulseAudioPlaybackRecorder.h
|
||||||
src/WallpaperEngine/Audio/Drivers/Recorders/CPlaybackRecorder.cpp
|
src/WallpaperEngine/Audio/Drivers/Recorders/PlaybackRecorder.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/Recorders/CPlaybackRecorder.h
|
src/WallpaperEngine/Audio/Drivers/Recorders/PlaybackRecorder.h
|
||||||
|
|
||||||
src/WallpaperEngine/Audio/Drivers/Detectors/CPulseAudioPlayingDetector.cpp
|
src/WallpaperEngine/Audio/Drivers/Detectors/PulseAudioPlayingDetector.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/Detectors/CPulseAudioPlayingDetector.h
|
src/WallpaperEngine/Audio/Drivers/Detectors/PulseAudioPlayingDetector.h
|
||||||
src/WallpaperEngine/Audio/Drivers/Detectors/CAudioPlayingDetector.cpp
|
src/WallpaperEngine/Audio/Drivers/Detectors/AudioPlayingDetector.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/Detectors/CAudioPlayingDetector.h
|
src/WallpaperEngine/Audio/Drivers/Detectors/AudioPlayingDetector.h
|
||||||
|
|
||||||
src/WallpaperEngine/Audio/Drivers/CAudioDriver.cpp
|
src/WallpaperEngine/Audio/Drivers/AudioDriver.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/CAudioDriver.h
|
src/WallpaperEngine/Audio/Drivers/AudioDriver.h
|
||||||
src/WallpaperEngine/Audio/Drivers/CSDLAudioDriver.cpp
|
src/WallpaperEngine/Audio/Drivers/SDLAudioDriver.cpp
|
||||||
src/WallpaperEngine/Audio/Drivers/CSDLAudioDriver.h
|
src/WallpaperEngine/Audio/Drivers/SDLAudioDriver.h
|
||||||
src/WallpaperEngine/Audio/CAudioContext.cpp
|
src/WallpaperEngine/Audio/AudioContext.cpp
|
||||||
src/WallpaperEngine/Audio/CAudioContext.h
|
src/WallpaperEngine/Audio/AudioContext.h
|
||||||
src/WallpaperEngine/Audio/CAudioStream.cpp
|
src/WallpaperEngine/Audio/AudioStream.cpp
|
||||||
src/WallpaperEngine/Audio/CAudioStream.h
|
src/WallpaperEngine/Audio/AudioStream.h
|
||||||
|
|
||||||
src/WallpaperEngine/Input/CInputContext.cpp
|
src/WallpaperEngine/Input/InputContext.cpp
|
||||||
src/WallpaperEngine/Input/CInputContext.h
|
src/WallpaperEngine/Input/InputContext.h
|
||||||
src/WallpaperEngine/Input/CMouseInput.cpp
|
src/WallpaperEngine/Input/MouseInput.h
|
||||||
src/WallpaperEngine/Input/CMouseInput.h
|
src/WallpaperEngine/Input/Drivers/GLFWMouseInput.cpp
|
||||||
src/WallpaperEngine/Input/Drivers/CGLFWMouseInput.cpp
|
src/WallpaperEngine/Input/Drivers/GLFWMouseInput.h
|
||||||
src/WallpaperEngine/Input/Drivers/CGLFWMouseInput.h
|
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariable.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariable.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableFloat.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableFloat.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableInteger.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableInteger.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableInteger.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableInteger.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector2.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector2.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector3.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector3.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector4.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector4.cpp
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Shaders/CShader.h
|
src/WallpaperEngine/Render/Shaders/Shader.h
|
||||||
src/WallpaperEngine/Render/Shaders/CShader.cpp
|
src/WallpaperEngine/Render/Shaders/Shader.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/CShaderUnit.cpp
|
src/WallpaperEngine/Render/Shaders/ShaderUnit.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/CShaderUnit.h
|
src/WallpaperEngine/Render/Shaders/ShaderUnit.h
|
||||||
src/WallpaperEngine/Render/Shaders/CGLSLContext.cpp
|
src/WallpaperEngine/Render/Shaders/GLSLContext.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/CGLSLContext.h
|
src/WallpaperEngine/Render/Shaders/GLSLContext.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Helpers/CContextAware.cpp
|
src/WallpaperEngine/Render/Helpers/ContextAware.cpp
|
||||||
src/WallpaperEngine/Render/Helpers/CContextAware.h
|
src/WallpaperEngine/Render/Helpers/ContextAware.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoFactories.cpp
|
src/WallpaperEngine/Render/Drivers/VideoFactories.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoFactories.h
|
src/WallpaperEngine/Render/Drivers/VideoFactories.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.cpp
|
src/WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h
|
src/WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutput.cpp
|
src/WallpaperEngine/Render/Drivers/Output/Output.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutput.h
|
src/WallpaperEngine/Render/Drivers/Output/Output.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.cpp
|
src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h
|
src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWOutputViewport.cpp
|
src/WallpaperEngine/Render/Drivers/Output/GLFWOutputViewport.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/CGLFWOutputViewport.h
|
src/WallpaperEngine/Render/Drivers/Output/GLFWOutputViewport.h
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.cpp
|
src/WallpaperEngine/Render/Drivers/Output/OutputViewport.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/Output/COutputViewport.h
|
src/WallpaperEngine/Render/Drivers/Output/OutputViewport.h
|
||||||
src/WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h
|
src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h
|
||||||
src/WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.cpp
|
src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.cpp
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.h
|
src/WallpaperEngine/Render/Drivers/VideoDriver.h
|
||||||
src/WallpaperEngine/Render/Drivers/CVideoDriver.cpp
|
src/WallpaperEngine/Render/Drivers/VideoDriver.cpp
|
||||||
src/WallpaperEngine/Render/CRenderContext.h
|
src/WallpaperEngine/Render/RenderContext.h
|
||||||
src/WallpaperEngine/Render/CRenderContext.cpp
|
src/WallpaperEngine/Render/RenderContext.cpp
|
||||||
src/WallpaperEngine/Render/CTextureCache.h
|
src/WallpaperEngine/Render/TextureCache.h
|
||||||
src/WallpaperEngine/Render/CTextureCache.cpp
|
src/WallpaperEngine/Render/TextureCache.cpp
|
||||||
src/WallpaperEngine/Render/CFBOProvider.cpp
|
src/WallpaperEngine/Render/FBOProvider.cpp
|
||||||
src/WallpaperEngine/Render/CFBOProvider.h
|
src/WallpaperEngine/Render/FBOProvider.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Helpers/CContextAware.cpp
|
src/WallpaperEngine/Render/Helpers/ContextAware.cpp
|
||||||
src/WallpaperEngine/Render/Helpers/CContextAware.h
|
src/WallpaperEngine/Render/Helpers/ContextAware.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/CWallpaper.h
|
src/WallpaperEngine/Render/CWallpaper.h
|
||||||
src/WallpaperEngine/Render/CWallpaper.cpp
|
src/WallpaperEngine/Render/CWallpaper.cpp
|
||||||
src/WallpaperEngine/Render/CWallpaperState.h
|
src/WallpaperEngine/Render/WallpaperState.h
|
||||||
src/WallpaperEngine/Render/CWallpaperState.cpp
|
src/WallpaperEngine/Render/WallpaperState.cpp
|
||||||
src/WallpaperEngine/Render/Wallpapers/CScene.h
|
src/WallpaperEngine/Render/Wallpapers/CScene.h
|
||||||
src/WallpaperEngine/Render/Wallpapers/CScene.cpp
|
src/WallpaperEngine/Render/Wallpapers/CScene.cpp
|
||||||
src/WallpaperEngine/Render/Wallpapers/CVideo.h
|
src/WallpaperEngine/Render/Wallpapers/CVideo.h
|
||||||
src/WallpaperEngine/Render/Wallpapers/CVideo.cpp
|
src/WallpaperEngine/Render/Wallpapers/CVideo.cpp
|
||||||
src/WallpaperEngine/Render/Wallpapers/CWeb.h
|
src/WallpaperEngine/Render/Wallpapers/CWeb.h
|
||||||
src/WallpaperEngine/Render/Wallpapers/CWeb.cpp
|
src/WallpaperEngine/Render/Wallpapers/CWeb.cpp
|
||||||
src/WallpaperEngine/Render/CCamera.h
|
src/WallpaperEngine/Render/Camera.h
|
||||||
src/WallpaperEngine/Render/CCamera.cpp
|
src/WallpaperEngine/Render/Camera.cpp
|
||||||
src/WallpaperEngine/Render/CObject.h
|
src/WallpaperEngine/Render/CObject.h
|
||||||
src/WallpaperEngine/Render/CObject.cpp
|
src/WallpaperEngine/Render/CObject.cpp
|
||||||
src/WallpaperEngine/Render/CTexture.cpp
|
src/WallpaperEngine/Render/CTexture.cpp
|
||||||
src/WallpaperEngine/Render/CTexture.h
|
src/WallpaperEngine/Render/CTexture.h
|
||||||
src/WallpaperEngine/Render/ITexture.h
|
src/WallpaperEngine/Render/TextureProvider.h
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Objects/CImage.h
|
src/WallpaperEngine/Render/Objects/CImage.h
|
||||||
src/WallpaperEngine/Render/Objects/CImage.cpp
|
src/WallpaperEngine/Render/Objects/CImage.cpp
|
||||||
@ -385,20 +384,20 @@ add_executable(
|
|||||||
src/WallpaperEngine/Render/Objects/Effects/CPass.h
|
src/WallpaperEngine/Render/Objects/Effects/CPass.h
|
||||||
src/WallpaperEngine/Render/Objects/Effects/CPass.cpp
|
src/WallpaperEngine/Render/Objects/Effects/CPass.cpp
|
||||||
|
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CRenderHandler.cpp
|
src/WallpaperEngine/WebBrowser/CEF/RenderHandler.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CRenderHandler.h
|
src/WallpaperEngine/WebBrowser/CEF/RenderHandler.h
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CBrowserClient.cpp
|
src/WallpaperEngine/WebBrowser/CEF/BrowserClient.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CBrowserClient.h
|
src/WallpaperEngine/WebBrowser/CEF/BrowserClient.h
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CBrowserApp.cpp
|
src/WallpaperEngine/WebBrowser/CEF/BrowserApp.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CBrowserApp.h
|
src/WallpaperEngine/WebBrowser/CEF/BrowserApp.h
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CSubprocessApp.cpp
|
src/WallpaperEngine/WebBrowser/CEF/SubprocessApp.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CSubprocessApp.h
|
src/WallpaperEngine/WebBrowser/CEF/SubprocessApp.h
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CWPSchemeHandlerFactory.cpp
|
src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandlerFactory.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CWPSchemeHandlerFactory.h
|
src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandlerFactory.h
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CWPSchemeHandler.cpp
|
src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandler.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CEF/CWPSchemeHandler.h
|
src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandler.h
|
||||||
src/WallpaperEngine/WebBrowser/CWebBrowserContext.cpp
|
src/WallpaperEngine/WebBrowser/WebBrowserContext.cpp
|
||||||
src/WallpaperEngine/WebBrowser/CWebBrowserContext.h
|
src/WallpaperEngine/WebBrowser/WebBrowserContext.h
|
||||||
|
|
||||||
src/WallpaperEngine/Data/Assets/Types.h
|
src/WallpaperEngine/Data/Assets/Types.h
|
||||||
src/WallpaperEngine/Data/Assets/Texture.h
|
src/WallpaperEngine/Data/Assets/Texture.h
|
||||||
@ -451,11 +450,7 @@ add_executable(
|
|||||||
|
|
||||||
${WAYLAND_SOURCES}
|
${WAYLAND_SOURCES}
|
||||||
${X11_SOURCES}
|
${X11_SOURCES}
|
||||||
${DEMOMODE_SOURCES}
|
${DEMOMODE_SOURCES})
|
||||||
src/WallpaperEngine/FileSystem/Adapters/Package.h
|
|
||||||
src/WallpaperEngine/FileSystem/Adapters/Package.cpp
|
|
||||||
src/WallpaperEngine/FileSystem/Adapters/Virtual.h
|
|
||||||
src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp)
|
|
||||||
|
|
||||||
target_link_libraries (linux-wallpaperengine PUBLIC
|
target_link_libraries (linux-wallpaperengine PUBLIC
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "CApplicationContext.h"
|
#include "ApplicationContext.h"
|
||||||
|
|
||||||
#include "Steam/FileSystem/FileSystem.h"
|
#include "Steam/FileSystem/FileSystem.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
|
|
||||||
CApplicationContext::CApplicationContext (int argc, char* argv []) :
|
ApplicationContext::ApplicationContext (int argc, char* argv []) :
|
||||||
m_argc (argc),
|
m_argc (argc),
|
||||||
m_argv (argv) {
|
m_argv (argv) {
|
||||||
std::string lastScreen;
|
std::string lastScreen;
|
||||||
@ -93,16 +93,16 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
|
|||||||
.help ("Scaling mode to use when rendering the background, this applies to the previous --window or --screen-root output, or the default background if no other background is specified")
|
.help ("Scaling mode to use when rendering the background, this applies to the previous --window or --screen-root output, or the default background if no other background is specified")
|
||||||
.choices ("stretch", "fit", "fill", "default")
|
.choices ("stretch", "fit", "fill", "default")
|
||||||
.action([this, &lastScreen](const std::string& value) -> void {
|
.action([this, &lastScreen](const std::string& value) -> void {
|
||||||
WallpaperEngine::Render::CWallpaperState::TextureUVsScaling mode;
|
WallpaperEngine::Render::WallpaperState::TextureUVsScaling mode;
|
||||||
|
|
||||||
if (value == "stretch") {
|
if (value == "stretch") {
|
||||||
mode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::StretchUVs;
|
mode = WallpaperEngine::Render::WallpaperState::TextureUVsScaling::StretchUVs;
|
||||||
} else if (value == "fit") {
|
} else if (value == "fit") {
|
||||||
mode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::ZoomFitUVs;
|
mode = WallpaperEngine::Render::WallpaperState::TextureUVsScaling::ZoomFitUVs;
|
||||||
} else if (value == "fill") {
|
} else if (value == "fill") {
|
||||||
mode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::ZoomFillUVs;
|
mode = WallpaperEngine::Render::WallpaperState::TextureUVsScaling::ZoomFillUVs;
|
||||||
} else if (value == "default") {
|
} else if (value == "default") {
|
||||||
mode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs;
|
mode = WallpaperEngine::Render::WallpaperState::TextureUVsScaling::DefaultUVs;
|
||||||
} else {
|
} else {
|
||||||
sLog.exception ("Invalid scaling mode: ", value);
|
sLog.exception ("Invalid scaling mode: ", value);
|
||||||
}
|
}
|
||||||
@ -299,22 +299,22 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CApplicationContext::getArgc () const {
|
int ApplicationContext::getArgc () const {
|
||||||
return this->m_argc;
|
return this->m_argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
char** CApplicationContext::getArgv () const {
|
char** ApplicationContext::getArgv () const {
|
||||||
return this->m_argv;
|
return this->m_argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path CApplicationContext::translateBackground (const std::string& bgIdOrPath) {
|
std::filesystem::path ApplicationContext::translateBackground (const std::string& bgIdOrPath) {
|
||||||
if (bgIdOrPath.find ('/') == std::string::npos)
|
if (bgIdOrPath.find ('/') == std::string::npos)
|
||||||
return Steam::FileSystem::workshopDirectory (WORKSHOP_APP_ID, bgIdOrPath);
|
return Steam::FileSystem::workshopDirectory (WORKSHOP_APP_ID, bgIdOrPath);
|
||||||
|
|
||||||
return bgIdOrPath;
|
return bgIdOrPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplicationContext::validateAssets () {
|
void ApplicationContext::validateAssets () {
|
||||||
if (!this->settings.general.assets.empty ()) {
|
if (!this->settings.general.assets.empty ()) {
|
||||||
sLog.out ("Using wallpaper engine's assets at ", this->settings.general.assets,
|
sLog.out ("Using wallpaper engine's assets at ", this->settings.general.assets,
|
||||||
" based on --assets-dir parameter");
|
" based on --assets-dir parameter");
|
||||||
@ -329,7 +329,7 @@ void CApplicationContext::validateAssets () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplicationContext::validateScreenshot () const {
|
void ApplicationContext::validateScreenshot () const {
|
||||||
if (!this->settings.screenshot.take)
|
if (!this->settings.screenshot.take)
|
||||||
return;
|
return;
|
||||||
|
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include <glm/vec4.hpp>
|
#include <glm/vec4.hpp>
|
||||||
|
|
||||||
#include "CApplicationState.h"
|
#include "ApplicationState.h"
|
||||||
|
|
||||||
#include "../Render/ITexture.h"
|
#include "../Render/TextureProvider.h"
|
||||||
#include "WallpaperEngine/Render/CWallpaperState.h"
|
#include "WallpaperEngine/Render/WallpaperState.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Model/Project.h"
|
#include "WallpaperEngine/Data/Model/Project.h"
|
||||||
|
|
||||||
@ -19,9 +19,9 @@ using namespace WallpaperEngine::Data::Assets;
|
|||||||
/**
|
/**
|
||||||
* Application information as parsed off the command line arguments
|
* Application information as parsed off the command line arguments
|
||||||
*/
|
*/
|
||||||
class CApplicationContext {
|
class ApplicationContext {
|
||||||
public:
|
public:
|
||||||
CApplicationContext (int argc, char* argv []);
|
ApplicationContext (int argc, char* argv []);
|
||||||
|
|
||||||
enum WINDOW_MODE {
|
enum WINDOW_MODE {
|
||||||
/** Default window mode */
|
/** Default window mode */
|
||||||
@ -50,7 +50,7 @@ class CApplicationContext {
|
|||||||
/** Properties to change values for */
|
/** Properties to change values for */
|
||||||
std::map<std::string, std::string> properties;
|
std::map<std::string, std::string> properties;
|
||||||
/** The scaling mode for different screens */
|
/** The scaling mode for different screens */
|
||||||
std::map<std::string, WallpaperEngine::Render::CWallpaperState::TextureUVsScaling> screenScalings;
|
std::map<std::string, WallpaperEngine::Render::WallpaperState::TextureUVsScaling> screenScalings;
|
||||||
/** The clamping mode for different screens */
|
/** The clamping mode for different screens */
|
||||||
std::map<std::string, TextureFlags> screenClamps;
|
std::map<std::string, TextureFlags> screenClamps;
|
||||||
} general;
|
} general;
|
||||||
@ -70,7 +70,7 @@ class CApplicationContext {
|
|||||||
/** The window size used in explicit window */
|
/** The window size used in explicit window */
|
||||||
glm::ivec4 geometry;
|
glm::ivec4 geometry;
|
||||||
TextureFlags clamp;
|
TextureFlags clamp;
|
||||||
WallpaperEngine::Render::CWallpaperState::TextureUVsScaling scalingMode;
|
WallpaperEngine::Render::WallpaperState::TextureUVsScaling scalingMode;
|
||||||
} window;
|
} window;
|
||||||
} render;
|
} render;
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ class CApplicationContext {
|
|||||||
.window = {
|
.window = {
|
||||||
.geometry = {},
|
.geometry = {},
|
||||||
.clamp = TextureFlags_ClampUVs,
|
.clamp = TextureFlags_ClampUVs,
|
||||||
.scalingMode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs,
|
.scalingMode = WallpaperEngine::Render::WallpaperState::TextureUVsScaling::DefaultUVs,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.audio = {
|
.audio = {
|
||||||
@ -147,7 +147,7 @@ class CApplicationContext {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
CApplicationState state;
|
ApplicationState state;
|
||||||
|
|
||||||
[[nodiscard]] int getArgc() const;
|
[[nodiscard]] int getArgc() const;
|
||||||
[[nodiscard]] char** getArgv() const;
|
[[nodiscard]] char** getArgv() const;
|
@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CApplicationContext.h"
|
#include "ApplicationContext.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
/**
|
/**
|
||||||
* Represents current application state
|
* Represents current application state
|
||||||
*/
|
*/
|
||||||
class CApplicationState {
|
class ApplicationState {
|
||||||
public:
|
public:
|
||||||
struct {
|
struct {
|
||||||
bool keepRunning;
|
bool keepRunning;
|
@ -1,16 +1,16 @@
|
|||||||
#include "CWallpaperApplication.h"
|
#include "WallpaperApplication.h"
|
||||||
|
|
||||||
#include "Steam/FileSystem/FileSystem.h"
|
#include "Steam/FileSystem/FileSystem.h"
|
||||||
#include "WallpaperEngine/Application/CApplicationState.h"
|
#include "WallpaperEngine/Application/ApplicationState.h"
|
||||||
#include "WallpaperEngine/Assets/CAssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
#include "WallpaperEngine/Audio/Drivers/Detectors/CPulseAudioPlayingDetector.h"
|
#include "WallpaperEngine/Audio/Drivers/Detectors/PulseAudioPlayingDetector.h"
|
||||||
#include "WallpaperEngine/FileSystem/Container.h"
|
#include "WallpaperEngine/FileSystem/Container.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
#include "WallpaperEngine/Render/Drivers/VideoFactories.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoFactories.h"
|
#include "WallpaperEngine/Render/RenderContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Parsers/ProjectParser.h"
|
|
||||||
#include "WallpaperEngine/Data/Dumpers/StringPrinter.h"
|
#include "WallpaperEngine/Data/Dumpers/StringPrinter.h"
|
||||||
|
#include "WallpaperEngine/Data/Parsers/ProjectParser.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
||||||
#include "WallpaperEngine/Data/Model/Property.h"
|
#include "WallpaperEngine/Data/Model/Property.h"
|
||||||
@ -33,14 +33,14 @@ using namespace WallpaperEngine::Application;
|
|||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
|
|
||||||
CWallpaperApplication::CWallpaperApplication (CApplicationContext& context) :
|
WallpaperApplication::WallpaperApplication (ApplicationContext& context) :
|
||||||
m_context (context) {
|
m_context (context) {
|
||||||
this->loadBackgrounds ();
|
this->loadBackgrounds ();
|
||||||
this->setupProperties ();
|
this->setupProperties ();
|
||||||
this->setupBrowser();
|
this->setupBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) const {
|
ContainerUniquePtr WallpaperApplication::setupContainer (const std::string& bg) const {
|
||||||
auto container = std::make_unique <Container> ();
|
auto container = std::make_unique <Container> ();
|
||||||
|
|
||||||
std::filesystem::path path (bg);
|
std::filesystem::path path (bg);
|
||||||
@ -196,9 +196,9 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::loadBackgrounds () {
|
void WallpaperApplication::loadBackgrounds () {
|
||||||
if (this->m_context.settings.render.mode == CApplicationContext::NORMAL_WINDOW ||
|
if (this->m_context.settings.render.mode == ApplicationContext::NORMAL_WINDOW ||
|
||||||
this->m_context.settings.render.mode == CApplicationContext::EXPLICIT_WINDOW) {
|
this->m_context.settings.render.mode == ApplicationContext::EXPLICIT_WINDOW) {
|
||||||
this->m_backgrounds ["default"] = this->loadBackground (this->m_context.settings.general.defaultBackground);
|
this->m_backgrounds ["default"] = this->loadBackground (this->m_context.settings.general.defaultBackground);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -213,14 +213,14 @@ void CWallpaperApplication::loadBackgrounds () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectUniquePtr CWallpaperApplication::loadBackground (const std::string& bg) {
|
ProjectUniquePtr WallpaperApplication::loadBackground (const std::string& bg) {
|
||||||
auto container = this->setupContainer (bg);
|
auto container = this->setupContainer (bg);
|
||||||
auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readString ("project.json"));
|
auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readString ("project.json"));
|
||||||
|
|
||||||
return WallpaperEngine::Data::Parsers::ProjectParser::parse (json, std::move(container));
|
return WallpaperEngine::Data::Parsers::ProjectParser::parse (json, std::move(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupPropertiesForProject (const Project& project) {
|
void WallpaperApplication::setupPropertiesForProject (const Project& project) {
|
||||||
// show properties if required
|
// show properties if required
|
||||||
for (const auto& [key, cur] : project.properties) {
|
for (const auto& [key, cur] : project.properties) {
|
||||||
// update the value of the property
|
// update the value of the property
|
||||||
@ -237,12 +237,12 @@ void CWallpaperApplication::setupPropertiesForProject (const Project& project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupProperties () {
|
void WallpaperApplication::setupProperties () {
|
||||||
for (const auto& [background, info] : this->m_backgrounds)
|
for (const auto& [background, info] : this->m_backgrounds)
|
||||||
this->setupPropertiesForProject (*info);
|
this->setupPropertiesForProject (*info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupBrowser () {
|
void WallpaperApplication::setupBrowser () {
|
||||||
bool anyWebProject = std::any_of (
|
bool anyWebProject = std::any_of (
|
||||||
this->m_backgrounds.begin (), this->m_backgrounds.end (),
|
this->m_backgrounds.begin (), this->m_backgrounds.end (),
|
||||||
[](const std::pair<const std::string, ProjectUniquePtr>& pair) -> bool {
|
[](const std::pair<const std::string, ProjectUniquePtr>& pair) -> bool {
|
||||||
@ -255,10 +255,10 @@ void CWallpaperApplication::setupBrowser () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_browserContext = std::make_unique <WebBrowser::CWebBrowserContext> (*this);
|
this->m_browserContext = std::make_unique <WebBrowser::WebBrowserContext> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::takeScreenshot (const std::filesystem::path& filename) const {
|
void WallpaperApplication::takeScreenshot (const std::filesystem::path& filename) const {
|
||||||
// this should be getting called at the end of the frame, so the right thing should be bound already
|
// this should be getting called at the end of the frame, so the right thing should be bound already
|
||||||
const int width = this->m_renderContext->getOutput ().getFullWidth ();
|
const int width = this->m_renderContext->getOutput ().getFullWidth ();
|
||||||
const int height = this->m_renderContext->getOutput ().getFullHeight ();
|
const int height = this->m_renderContext->getOutput ().getFullHeight ();
|
||||||
@ -328,7 +328,7 @@ void CWallpaperApplication::takeScreenshot (const std::filesystem::path& filenam
|
|||||||
delete [] bitmap;
|
delete [] bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupOutput () {
|
void WallpaperApplication::setupOutput () {
|
||||||
const char* XDG_SESSION_TYPE = getenv ("XDG_SESSION_TYPE");
|
const char* XDG_SESSION_TYPE = getenv ("XDG_SESSION_TYPE");
|
||||||
|
|
||||||
if (!XDG_SESSION_TYPE) {
|
if (!XDG_SESSION_TYPE) {
|
||||||
@ -347,7 +347,7 @@ void CWallpaperApplication::setupOutput () {
|
|||||||
this->m_fullScreenDetector = sVideoFactories.createFullscreenDetector (XDG_SESSION_TYPE, this->m_context, *this->m_videoDriver);
|
this->m_fullScreenDetector = sVideoFactories.createFullscreenDetector (XDG_SESSION_TYPE, this->m_context, *this->m_videoDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupAudio () {
|
void WallpaperApplication::setupAudio () {
|
||||||
// ensure audioprocessing is required by any background, and we have it enabled
|
// ensure audioprocessing is required by any background, and we have it enabled
|
||||||
bool audioProcessingRequired = std::any_of (
|
bool audioProcessingRequired = std::any_of (
|
||||||
this->m_backgrounds.begin (), this->m_backgrounds.end (),
|
this->m_backgrounds.begin (), this->m_backgrounds.end (),
|
||||||
@ -357,26 +357,26 @@ void CWallpaperApplication::setupAudio () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (audioProcessingRequired && this->m_context.settings.audio.audioprocessing) {
|
if (audioProcessingRequired && this->m_context.settings.audio.audioprocessing) {
|
||||||
this->m_audioRecorder = std::make_unique <WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder> ();
|
this->m_audioRecorder = std::make_unique <WallpaperEngine::Audio::Drivers::Recorders::PulseAudioPlaybackRecorder> ();
|
||||||
} else {
|
} else {
|
||||||
this->m_audioRecorder = std::make_unique <WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder> ();
|
this->m_audioRecorder = std::make_unique <WallpaperEngine::Audio::Drivers::Recorders::PlaybackRecorder> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->m_context.settings.audio.automute) {
|
if (this->m_context.settings.audio.automute) {
|
||||||
m_audioDetector = std::make_unique <WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector> (this->m_context, *this->m_fullScreenDetector);
|
m_audioDetector = std::make_unique <WallpaperEngine::Audio::Drivers::Detectors::PulseAudioPlayingDetector> (this->m_context, *this->m_fullScreenDetector);
|
||||||
} else {
|
} else {
|
||||||
m_audioDetector = std::make_unique <WallpaperEngine::Audio::Drivers::Detectors::CAudioPlayingDetector> (this->m_context, *this->m_fullScreenDetector);
|
m_audioDetector = std::make_unique <WallpaperEngine::Audio::Drivers::Detectors::AudioPlayingDetector> (this->m_context, *this->m_fullScreenDetector);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize sdl audio driver
|
// initialize sdl audio driver
|
||||||
m_audioDriver = std::make_unique <WallpaperEngine::Audio::Drivers::CSDLAudioDriver> (this->m_context, *this->m_audioDetector, *this->m_audioRecorder);
|
m_audioDriver = std::make_unique <WallpaperEngine::Audio::Drivers::SDLAudioDriver> (this->m_context, *this->m_audioDetector, *this->m_audioRecorder);
|
||||||
// initialize audio context
|
// initialize audio context
|
||||||
m_audioContext = std::make_unique <WallpaperEngine::Audio::CAudioContext> (*m_audioDriver);
|
m_audioContext = std::make_unique <WallpaperEngine::Audio::AudioContext> (*m_audioDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::prepareOutputs () {
|
void WallpaperApplication::prepareOutputs () {
|
||||||
// initialize render context
|
// initialize render context
|
||||||
m_renderContext = std::make_unique <WallpaperEngine::Render::CRenderContext> (*m_videoDriver, *this);
|
m_renderContext = std::make_unique <WallpaperEngine::Render::RenderContext> (*m_videoDriver, *this);
|
||||||
// create a new background for each screen
|
// create a new background for each screen
|
||||||
|
|
||||||
// set all the specific wallpapers required
|
// set all the specific wallpapers required
|
||||||
@ -392,7 +392,7 @@ void CWallpaperApplication::prepareOutputs () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::show () {
|
void WallpaperApplication::show () {
|
||||||
this->setupOutput ();
|
this->setupOutput ();
|
||||||
this->setupAudio ();
|
this->setupAudio ();
|
||||||
this->prepareOutputs ();
|
this->prepareOutputs ();
|
||||||
@ -498,24 +498,24 @@ void CWallpaperApplication::show () {
|
|||||||
SDL_Quit ();
|
SDL_Quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::update (Render::Drivers::Output::COutputViewport* viewport) {
|
void WallpaperApplication::update (Render::Drivers::Output::OutputViewport* viewport) {
|
||||||
// render the scene
|
// render the scene
|
||||||
m_renderContext->render (viewport);
|
m_renderContext->render (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::signal (int signal) {
|
void WallpaperApplication::signal (int signal) {
|
||||||
sLog.out ("Stop requested by signal ", signal);
|
sLog.out ("Stop requested by signal ", signal);
|
||||||
this->m_context.state.general.keepRunning = false;
|
this->m_context.state.general.keepRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<std::string, ProjectUniquePtr>& CWallpaperApplication::getBackgrounds () const {
|
const std::map<std::string, ProjectUniquePtr>& WallpaperApplication::getBackgrounds () const {
|
||||||
return this->m_backgrounds;
|
return this->m_backgrounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
CApplicationContext& CWallpaperApplication::getContext () const {
|
ApplicationContext& WallpaperApplication::getContext () const {
|
||||||
return this->m_context;
|
return this->m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WallpaperEngine::Render::Drivers::Output::COutput& CWallpaperApplication::getOutput () const {
|
const WallpaperEngine::Render::Drivers::Output::Output& WallpaperApplication::getOutput () const {
|
||||||
return this->m_renderContext->getOutput ();
|
return this->m_renderContext->getOutput ();
|
||||||
}
|
}
|
@ -1,17 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
|
||||||
#include "WallpaperEngine/Render/CWallpaper.h"
|
#include "WallpaperEngine/Render/CWallpaper.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h"
|
||||||
|
#include "WallpaperEngine/Render/RenderContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Audio/Drivers/CSDLAudioDriver.h"
|
#include "WallpaperEngine/Audio/Drivers/SDLAudioDriver.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Input/CInputContext.h"
|
#include "WallpaperEngine/Input/InputContext.h"
|
||||||
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
|
#include "WallpaperEngine/WebBrowser/WebBrowserContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Model/Types.h"
|
#include "WallpaperEngine/Data/Model/Types.h"
|
||||||
|
|
||||||
@ -19,12 +19,10 @@ namespace WallpaperEngine::Application {
|
|||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
/**
|
/**
|
||||||
* Small wrapper class over the actual wallpaper's main application skeleton
|
* Small wrapper class over the actual wallpaper's main application skeleton
|
||||||
*
|
|
||||||
* @author Alexis Maiquez <almamu@almamu.com>
|
|
||||||
*/
|
*/
|
||||||
class CWallpaperApplication {
|
class WallpaperApplication {
|
||||||
public:
|
public:
|
||||||
explicit CWallpaperApplication (CApplicationContext& context);
|
explicit WallpaperApplication (ApplicationContext& context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the application until it's closed
|
* Shows the application until it's closed
|
||||||
@ -43,15 +41,15 @@ class CWallpaperApplication {
|
|||||||
/**
|
/**
|
||||||
* @return The current application context
|
* @return The current application context
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] CApplicationContext& getContext () const;
|
[[nodiscard]] ApplicationContext& getContext () const;
|
||||||
/**
|
/**
|
||||||
* Renders a frame
|
* Renders a frame
|
||||||
*/
|
*/
|
||||||
void update (Render::Drivers::Output::COutputViewport* viewport);
|
void update (Render::Drivers::Output::OutputViewport* viewport);
|
||||||
/**
|
/**
|
||||||
* Gets the output
|
* Gets the output
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] const WallpaperEngine::Render::Drivers::Output::COutput& getOutput () const;
|
[[nodiscard]] const WallpaperEngine::Render::Drivers::Output::Output& getOutput () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -106,17 +104,17 @@ class CWallpaperApplication {
|
|||||||
void takeScreenshot (const std::filesystem::path& filename) const;
|
void takeScreenshot (const std::filesystem::path& filename) const;
|
||||||
|
|
||||||
/** The application context that contains the current app settings */
|
/** The application context that contains the current app settings */
|
||||||
CApplicationContext& m_context;
|
ApplicationContext& m_context;
|
||||||
/** Maps screens to backgrounds */
|
/** Maps screens to backgrounds */
|
||||||
std::map<std::string, ProjectUniquePtr> m_backgrounds {};
|
std::map<std::string, ProjectUniquePtr> m_backgrounds {};
|
||||||
|
|
||||||
std::unique_ptr <WallpaperEngine::Audio::Drivers::Detectors::CAudioPlayingDetector> m_audioDetector = nullptr;
|
std::unique_ptr <WallpaperEngine::Audio::Drivers::Detectors::AudioPlayingDetector> m_audioDetector = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Audio::CAudioContext> m_audioContext = nullptr;
|
std::unique_ptr <WallpaperEngine::Audio::AudioContext> m_audioContext = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Audio::Drivers::CSDLAudioDriver> m_audioDriver = nullptr;
|
std::unique_ptr <WallpaperEngine::Audio::Drivers::SDLAudioDriver> m_audioDriver = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder> m_audioRecorder = nullptr;
|
std::unique_ptr <WallpaperEngine::Audio::Drivers::Recorders::PlaybackRecorder> m_audioRecorder = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Render::CRenderContext> m_renderContext = nullptr;
|
std::unique_ptr <WallpaperEngine::Render::RenderContext> m_renderContext = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Render::Drivers::CVideoDriver> m_videoDriver = nullptr;
|
std::unique_ptr <WallpaperEngine::Render::Drivers::VideoDriver> m_videoDriver = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector> m_fullScreenDetector = nullptr;
|
std::unique_ptr <WallpaperEngine::Render::Drivers::Detectors::FullScreenDetector> m_fullScreenDetector = nullptr;
|
||||||
std::unique_ptr <WallpaperEngine::WebBrowser::CWebBrowserContext> m_browserContext = nullptr;
|
std::unique_ptr <WallpaperEngine::WebBrowser::WebBrowserContext> m_browserContext = nullptr;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
10
src/WallpaperEngine/Assets/AssetLoadException.cpp
Normal file
10
src/WallpaperEngine/Assets/AssetLoadException.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "AssetLoadException.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
|
AssetLoadException::AssetLoadException (const std::string& filename, const std::string& extrainfo) :
|
||||||
|
m_message ("Cannot find file " + filename + ": " + extrainfo) {}
|
||||||
|
|
||||||
|
const char* AssetLoadException::what () const noexcept {
|
||||||
|
return this->m_message.c_str ();
|
||||||
|
}
|
@ -4,10 +4,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// TODO: REWRITE THIS ONE TO MAKE MORE SENSE, IT REALLY MEANS "FILE-RELATED EXCEPTION"
|
// TODO: REWRITE THIS ONE TO MAKE MORE SENSE, IT REALLY MEANS "FILE-RELATED EXCEPTION"
|
||||||
namespace WallpaperEngine::Assets {
|
namespace WallpaperEngine::Render {
|
||||||
class CAssetLoadException final : public std::exception {
|
class AssetLoadException final : public std::exception {
|
||||||
public:
|
public:
|
||||||
explicit CAssetLoadException (const std::string& filename, const std::string& extrainfo = "");
|
explicit AssetLoadException (const std::string& filename, const std::string& extrainfo = "");
|
||||||
[[nodiscard]] const char* what () const noexcept override;
|
[[nodiscard]] const char* what () const noexcept override;
|
||||||
|
|
||||||
private:
|
private:
|
@ -1,10 +0,0 @@
|
|||||||
#include "CAssetLoadException.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
|
||||||
|
|
||||||
CAssetLoadException::CAssetLoadException (const std::string& filename, const std::string& extrainfo) :
|
|
||||||
m_message ("Cannot find file " + filename + ": " + extrainfo) {}
|
|
||||||
|
|
||||||
const char* CAssetLoadException::what () const noexcept {
|
|
||||||
return this->m_message.c_str ();
|
|
||||||
}
|
|
30
src/WallpaperEngine/Audio/AudioContext.cpp
Normal file
30
src/WallpaperEngine/Audio/AudioContext.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "AudioContext.h"
|
||||||
|
#include "WallpaperEngine/Audio/Drivers/AudioDriver.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Audio {
|
||||||
|
AudioContext::AudioContext (Drivers::AudioDriver& driver) : m_driver (driver) {}
|
||||||
|
|
||||||
|
void AudioContext::addStream (AudioStream* stream) {
|
||||||
|
this->m_driver.addStream (stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSampleFormat AudioContext::getFormat () const {
|
||||||
|
return this->m_driver.getFormat ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int AudioContext::getSampleRate () const {
|
||||||
|
return this->m_driver.getSampleRate ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int AudioContext::getChannels () const {
|
||||||
|
return this->m_driver.getChannels ();
|
||||||
|
}
|
||||||
|
|
||||||
|
Application::ApplicationContext& AudioContext::getApplicationContext () {
|
||||||
|
return this->m_driver.getApplicationContext ();
|
||||||
|
}
|
||||||
|
|
||||||
|
Drivers::Recorders::PlaybackRecorder& AudioContext::getRecorder () {
|
||||||
|
return this->m_driver.getRecorder ();
|
||||||
|
}
|
||||||
|
} // namespace WallpaperEngine::Audio
|
@ -3,35 +3,35 @@
|
|||||||
#include <libavutil/samplefmt.h>
|
#include <libavutil/samplefmt.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Audio/Drivers/Recorders/CPulseAudioPlaybackRecorder.h"
|
#include "WallpaperEngine/Audio/Drivers/Recorders/PulseAudioPlaybackRecorder.h"
|
||||||
|
|
||||||
namespace WallpaperEngine {
|
namespace WallpaperEngine {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
namespace Drivers {
|
namespace Drivers {
|
||||||
class CAudioDriver;
|
class AudioDriver;
|
||||||
|
|
||||||
namespace Recorders {
|
namespace Recorders {
|
||||||
class CPulseAudioPlaybackRecorder;
|
class PulseAudioPlaybackRecorder;
|
||||||
}
|
}
|
||||||
} // namespace Drivers
|
} // namespace Drivers
|
||||||
|
|
||||||
class CAudioStream;
|
class AudioStream;
|
||||||
|
|
||||||
class CAudioContext {
|
class AudioContext {
|
||||||
public:
|
public:
|
||||||
explicit CAudioContext (Drivers::CAudioDriver& driver);
|
explicit AudioContext (Drivers::AudioDriver& driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the given stream in the driver for playing
|
* Registers the given stream in the driver for playing
|
||||||
*
|
*
|
||||||
* @param stream
|
* @param stream
|
||||||
*/
|
*/
|
||||||
void addStream (CAudioStream* stream);
|
void addStream (AudioStream* stream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
||||||
@ -50,15 +50,15 @@ class CAudioContext {
|
|||||||
/**
|
/**
|
||||||
* @return The application context under which the audio driver is initialized
|
* @return The application context under which the audio driver is initialized
|
||||||
*/
|
*/
|
||||||
Application::CApplicationContext& getApplicationContext ();
|
Application::ApplicationContext& getApplicationContext ();
|
||||||
/**
|
/**
|
||||||
* @return The audio recorder to use to capture stereo mix data
|
* @return The audio recorder to use to capture stereo mix data
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Drivers::Recorders::CPlaybackRecorder& getRecorder ();
|
[[nodiscard]] Drivers::Recorders::PlaybackRecorder& getRecorder ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The audio driver in use */
|
/** The audio driver in use */
|
||||||
Drivers::CAudioDriver& m_driver;
|
Drivers::AudioDriver& m_driver;
|
||||||
};
|
};
|
||||||
} // namespace Audio
|
} // namespace Audio
|
||||||
} // namespace WallpaperEngine
|
} // namespace WallpaperEngine
|
@ -1,5 +1,5 @@
|
|||||||
#include "CAudioStream.h"
|
#include "AudioStream.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -10,7 +10,7 @@ using namespace WallpaperEngine::Audio;
|
|||||||
|
|
||||||
int audio_read_thread (void* arg) {
|
int audio_read_thread (void* arg) {
|
||||||
SDL_mutex* waitMutex = SDL_CreateMutex ();
|
SDL_mutex* waitMutex = SDL_CreateMutex ();
|
||||||
auto* stream = static_cast<CAudioStream*> (arg);
|
auto* stream = static_cast<AudioStream*> (arg);
|
||||||
AVPacket* packet = av_packet_alloc ();
|
AVPacket* packet = av_packet_alloc ();
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ int audio_read_thread (void* arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int audio_read_data_callback (void* streamarg, uint8_t* buffer, int buffer_size) {
|
static int audio_read_data_callback (void* streamarg, uint8_t* buffer, int buffer_size) {
|
||||||
const auto stream = static_cast<CAudioStream*> (streamarg);
|
const auto stream = static_cast<AudioStream*> (streamarg);
|
||||||
|
|
||||||
stream->getBuffer ()->read (reinterpret_cast<std::istream::char_type*> (buffer), buffer_size);
|
stream->getBuffer ()->read (reinterpret_cast<std::istream::char_type*> (buffer), buffer_size);
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ static int audio_read_data_callback (void* streamarg, uint8_t* buffer, int buffe
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t audio_seek_data_callback (void* streamarg, int64_t offset, int whence) {
|
int64_t audio_seek_data_callback (void* streamarg, int64_t offset, int whence) {
|
||||||
const auto stream = static_cast<CAudioStream*> (streamarg);
|
const auto stream = static_cast<AudioStream*> (streamarg);
|
||||||
|
|
||||||
// this was supported before, now we don't as there's no easy way to tell length
|
// this was supported before, now we don't as there's no easy way to tell length
|
||||||
// so returning <0 signals no support for it
|
// so returning <0 signals no support for it
|
||||||
@ -84,12 +84,12 @@ int64_t audio_seek_data_callback (void* streamarg, int64_t offset, int whence) {
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioStream::CAudioStream (CAudioContext& context, const std::string& filename) :
|
AudioStream::AudioStream (AudioContext& context, const std::string& filename) :
|
||||||
m_audioContext (context) {
|
m_audioContext (context) {
|
||||||
this->loadCustomContent (filename.c_str ());
|
this->loadCustomContent (filename.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioStream::CAudioStream (CAudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length) :
|
AudioStream::AudioStream (AudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length) :
|
||||||
m_audioContext (context) {
|
m_audioContext (context) {
|
||||||
// setup a custom context first
|
// setup a custom context first
|
||||||
this->m_formatContext = avformat_alloc_context ();
|
this->m_formatContext = avformat_alloc_context ();
|
||||||
@ -111,14 +111,14 @@ CAudioStream::CAudioStream (CAudioContext& context, const ReadStreamSharedPtr& b
|
|||||||
this->loadCustomContent ();
|
this->loadCustomContent ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioStream::CAudioStream (CAudioContext& audioContext, AVCodecContext* context) :
|
AudioStream::AudioStream (AudioContext& audioContext, AVCodecContext* context) :
|
||||||
m_audioContext (audioContext),
|
m_audioContext (audioContext),
|
||||||
m_context (context),
|
m_context (context),
|
||||||
m_queue (new PacketQueue) {
|
m_queue (new PacketQueue) {
|
||||||
this->initialize ();
|
this->initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioStream::~CAudioStream () {
|
AudioStream::~AudioStream () {
|
||||||
if (this->m_swrctx != nullptr && swr_is_initialized (this->m_swrctx) == true)
|
if (this->m_swrctx != nullptr && swr_is_initialized (this->m_swrctx) == true)
|
||||||
swr_close (this->m_swrctx);
|
swr_close (this->m_swrctx);
|
||||||
if (this->m_swrctx != nullptr)
|
if (this->m_swrctx != nullptr)
|
||||||
@ -127,7 +127,7 @@ CAudioStream::~CAudioStream () {
|
|||||||
// TODO: FREE EVERYTHING ELSE THAT THIS CLASS HOLDS!
|
// TODO: FREE EVERYTHING ELSE THAT THIS CLASS HOLDS!
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::loadCustomContent (const char* filename) {
|
void AudioStream::loadCustomContent (const char* filename) {
|
||||||
if (avformat_open_input (&this->m_formatContext, filename, nullptr, nullptr) != 0)
|
if (avformat_open_input (&this->m_formatContext, filename, nullptr, nullptr) != 0)
|
||||||
sLog.exception ("Cannot open audio file: ", filename);
|
sLog.exception ("Cannot open audio file: ", filename);
|
||||||
if (avformat_find_stream_info (this->m_formatContext, nullptr) < 0)
|
if (avformat_find_stream_info (this->m_formatContext, nullptr) < 0)
|
||||||
@ -170,7 +170,7 @@ void CAudioStream::loadCustomContent (const char* filename) {
|
|||||||
SDL_CreateThread (audio_read_thread, filename, this);
|
SDL_CreateThread (audio_read_thread, filename, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::initialize () {
|
void AudioStream::initialize () {
|
||||||
// allocate the FIFO buffer
|
// allocate the FIFO buffer
|
||||||
#if FF_API_FIFO_OLD_API
|
#if FF_API_FIFO_OLD_API
|
||||||
this->m_queue->packetList = av_fifo_alloc (sizeof (MyAVPacketList));
|
this->m_queue->packetList = av_fifo_alloc (sizeof (MyAVPacketList));
|
||||||
@ -226,7 +226,7 @@ void CAudioStream::initialize () {
|
|||||||
this->m_initialized = true;
|
this->m_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::queuePacket (AVPacket* pkt) {
|
void AudioStream::queuePacket (AVPacket* pkt) {
|
||||||
// clone the packet
|
// clone the packet
|
||||||
AVPacket* clone = av_packet_alloc ();
|
AVPacket* clone = av_packet_alloc ();
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ void CAudioStream::queuePacket (AVPacket* pkt) {
|
|||||||
av_packet_free (&pkt);
|
av_packet_free (&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::doQueue (AVPacket* pkt) {
|
bool AudioStream::doQueue (AVPacket* pkt) {
|
||||||
MyAVPacketList entry {pkt};
|
MyAVPacketList entry {pkt};
|
||||||
|
|
||||||
#if FF_API_FIFO_OLD_API
|
#if FF_API_FIFO_OLD_API
|
||||||
@ -269,7 +269,7 @@ bool CAudioStream::doQueue (AVPacket* pkt) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::dequeuePacket (AVPacket* output) {
|
void AudioStream::dequeuePacket (AVPacket* output) {
|
||||||
MyAVPacketList entry{};
|
MyAVPacketList entry{};
|
||||||
|
|
||||||
SDL_LockMutex (this->m_queue->mutex);
|
SDL_LockMutex (this->m_queue->mutex);
|
||||||
@ -303,51 +303,51 @@ void CAudioStream::dequeuePacket (AVPacket* output) {
|
|||||||
SDL_UnlockMutex (this->m_queue->mutex);
|
SDL_UnlockMutex (this->m_queue->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVCodecContext* CAudioStream::getContext () {
|
AVCodecContext* AudioStream::getContext () {
|
||||||
return this->m_context;
|
return this->m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVFormatContext* CAudioStream::getFormatContext () {
|
AVFormatContext* AudioStream::getFormatContext () {
|
||||||
return this->m_formatContext;
|
return this->m_formatContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getAudioStream () const {
|
int AudioStream::getAudioStream () const {
|
||||||
return this->m_audioStream;
|
return this->m_audioStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::isInitialized () const {
|
bool AudioStream::isInitialized () const {
|
||||||
return this->m_initialized;
|
return this->m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::setRepeat (bool newRepeat) {
|
void AudioStream::setRepeat (bool newRepeat) {
|
||||||
this->m_repeat = newRepeat;
|
this->m_repeat = newRepeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::isRepeat () const {
|
bool AudioStream::isRepeat () const {
|
||||||
return this->m_repeat;
|
return this->m_repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadStreamSharedPtr& CAudioStream::getBuffer () {
|
ReadStreamSharedPtr& AudioStream::getBuffer () {
|
||||||
return this->m_buffer;
|
return this->m_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CAudioStream::getLength () const {
|
uint32_t AudioStream::getLength () const {
|
||||||
return this->m_length;
|
return this->m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_cond* CAudioStream::getWaitCondition () {
|
SDL_cond* AudioStream::getWaitCondition () {
|
||||||
return this->m_queue->wait;
|
return this->m_queue->wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getQueueSize () {
|
int AudioStream::getQueueSize () {
|
||||||
return this->m_queue->size;
|
return this->m_queue->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getQueuePacketCount () {
|
int AudioStream::getQueuePacketCount () {
|
||||||
return this->m_queue->nb_packets;
|
return this->m_queue->nb_packets;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVRational CAudioStream::getTimeBase () {
|
AVRational AudioStream::getTimeBase () {
|
||||||
if (this->m_audioStream == NO_AUDIO_STREAM) {
|
if (this->m_audioStream == NO_AUDIO_STREAM) {
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
@ -355,19 +355,19 @@ AVRational CAudioStream::getTimeBase () {
|
|||||||
return this->m_formatContext->streams [this->m_audioStream]->time_base;
|
return this->m_formatContext->streams [this->m_audioStream]->time_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t CAudioStream::getQueueDuration () {
|
int64_t AudioStream::getQueueDuration () {
|
||||||
return this->m_queue->duration;
|
return this->m_queue->duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::isQueueEmpty () {
|
bool AudioStream::isQueueEmpty () {
|
||||||
return this->m_queue->nb_packets == 0;
|
return this->m_queue->nb_packets == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_mutex* CAudioStream::getMutex () {
|
SDL_mutex* AudioStream::getMutex () {
|
||||||
return this->m_queue->mutex;
|
return this->m_queue->mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::stop () {
|
void AudioStream::stop () {
|
||||||
if (!this->isInitialized ())
|
if (!this->isInitialized ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ void CAudioStream::stop () {
|
|||||||
this->m_initialized = false;
|
this->m_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::resampleAudio (const AVFrame* decoded_audio_frame, uint8_t* out_buf) {
|
int AudioStream::resampleAudio (const AVFrame* decoded_audio_frame, uint8_t* out_buf) {
|
||||||
int out_linesize = 0;
|
int out_linesize = 0;
|
||||||
int ret;
|
int ret;
|
||||||
int out_nb_channels;
|
int out_nb_channels;
|
||||||
@ -487,7 +487,7 @@ int CAudioStream::resampleAudio (const AVFrame* decoded_audio_frame, uint8_t* ou
|
|||||||
return resampled_data_size;
|
return resampled_data_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize) {
|
int AudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize) {
|
||||||
AVPacket* pkt = av_packet_alloc ();
|
AVPacket* pkt = av_packet_alloc ();
|
||||||
static uint8_t* audio_pkt_data = nullptr;
|
static uint8_t* audio_pkt_data = nullptr;
|
||||||
static int audio_pkt_size = 0;
|
static int audio_pkt_size = 0;
|
||||||
@ -553,6 +553,6 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioContext& CAudioStream::getAudioContext () const {
|
AudioContext& AudioStream::getAudioContext () const {
|
||||||
return this->m_audioContext;
|
return this->m_audioContext;
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ extern "C" {
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_thread.h>
|
#include <SDL_thread.h>
|
||||||
|
|
||||||
#include "WallpaperEngine/Audio/CAudioContext.h"
|
#include "WallpaperEngine/Audio/AudioContext.h"
|
||||||
|
|
||||||
// TODO: FIND A BETTER PLACE TO DO THIS? OLD_API MIGHT EXIST BUT THIS DEFINE MIGHT NOT BE DEFINED...
|
// TODO: FIND A BETTER PLACE TO DO THIS? OLD_API MIGHT EXIST BUT THIS DEFINE MIGHT NOT BE DEFINED...
|
||||||
#ifndef FF_API_FIFO_OLD_API
|
#ifndef FF_API_FIFO_OLD_API
|
||||||
@ -29,19 +29,19 @@ extern "C" {
|
|||||||
#define NO_AUDIO_STREAM (-1)
|
#define NO_AUDIO_STREAM (-1)
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio {
|
namespace WallpaperEngine::Audio {
|
||||||
class CAudioContext;
|
class AudioContext;
|
||||||
|
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a playable audio stream for the audio driver
|
* Represents a playable audio stream for the audio driver
|
||||||
*/
|
*/
|
||||||
class CAudioStream {
|
class AudioStream {
|
||||||
public:
|
public:
|
||||||
CAudioStream (CAudioContext& context, const std::string& filename);
|
AudioStream (AudioContext& context, const std::string& filename);
|
||||||
CAudioStream (CAudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length);
|
AudioStream (AudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length);
|
||||||
CAudioStream (CAudioContext& audioContext, AVCodecContext* context);
|
AudioStream (AudioContext& audioContext, AVCodecContext* context);
|
||||||
~CAudioStream ();
|
~AudioStream ();
|
||||||
|
|
||||||
void queuePacket (AVPacket* pkt);
|
void queuePacket (AVPacket* pkt);
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class CAudioStream {
|
|||||||
/**
|
/**
|
||||||
* @return The audio context in use for this audio stream
|
* @return The audio context in use for this audio stream
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] CAudioContext& getAudioContext () const;
|
[[nodiscard]] AudioContext& getAudioContext () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return to the codec context, which provides information on the audio stream's format
|
* @return to the codec context, which provides information on the audio stream's format
|
||||||
@ -165,7 +165,7 @@ class CAudioStream {
|
|||||||
/** The SwrContext that handles resampling */
|
/** The SwrContext that handles resampling */
|
||||||
SwrContext* m_swrctx = nullptr;
|
SwrContext* m_swrctx = nullptr;
|
||||||
/** The audio context this stream will be played under */
|
/** The audio context this stream will be played under */
|
||||||
CAudioContext& m_audioContext;
|
AudioContext& m_audioContext;
|
||||||
/** If this stream was properly initialized or not */
|
/** If this stream was properly initialized or not */
|
||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
/** Repeat enabled? */
|
/** Repeat enabled? */
|
@ -1,30 +0,0 @@
|
|||||||
#include "CAudioContext.h"
|
|
||||||
#include "WallpaperEngine/Audio/Drivers/CAudioDriver.h"
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio {
|
|
||||||
CAudioContext::CAudioContext (Drivers::CAudioDriver& driver) : m_driver (driver) {}
|
|
||||||
|
|
||||||
void CAudioContext::addStream (CAudioStream* stream) {
|
|
||||||
this->m_driver.addStream (stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
AVSampleFormat CAudioContext::getFormat () const {
|
|
||||||
return this->m_driver.getFormat ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CAudioContext::getSampleRate () const {
|
|
||||||
return this->m_driver.getSampleRate ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CAudioContext::getChannels () const {
|
|
||||||
return this->m_driver.getChannels ();
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::CApplicationContext& CAudioContext::getApplicationContext () {
|
|
||||||
return this->m_driver.getApplicationContext ();
|
|
||||||
}
|
|
||||||
|
|
||||||
Drivers::Recorders::CPlaybackRecorder& CAudioContext::getRecorder () {
|
|
||||||
return this->m_driver.getRecorder ();
|
|
||||||
}
|
|
||||||
} // namespace WallpaperEngine::Audio
|
|
28
src/WallpaperEngine/Audio/Drivers/AudioDriver.cpp
Normal file
28
src/WallpaperEngine/Audio/Drivers/AudioDriver.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include "AudioDriver.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Audio::Drivers {
|
||||||
|
AudioDriver::AudioDriver (
|
||||||
|
Application::ApplicationContext& applicationContext, Detectors::AudioPlayingDetector& detector,
|
||||||
|
Recorders::PlaybackRecorder& recorder
|
||||||
|
) :
|
||||||
|
m_applicationContext (applicationContext),
|
||||||
|
m_detector (detector),
|
||||||
|
m_recorder (recorder) {}
|
||||||
|
|
||||||
|
void AudioDriver::update () {
|
||||||
|
this->m_recorder.update ();
|
||||||
|
this->m_detector.update ();
|
||||||
|
}
|
||||||
|
|
||||||
|
Application::ApplicationContext& AudioDriver::getApplicationContext () {
|
||||||
|
return this->m_applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
Detectors::AudioPlayingDetector& AudioDriver::getAudioDetector () {
|
||||||
|
return this->m_detector;
|
||||||
|
}
|
||||||
|
|
||||||
|
Recorders::PlaybackRecorder& AudioDriver::getRecorder () {
|
||||||
|
return this->m_recorder;
|
||||||
|
}
|
||||||
|
} // namespace WallpaperEngine::Audio::Drivers
|
@ -2,44 +2,44 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Audio/CAudioStream.h"
|
#include "WallpaperEngine/Audio/AudioStream.h"
|
||||||
#include "WallpaperEngine/Audio/Drivers/Detectors/CAudioPlayingDetector.h"
|
#include "WallpaperEngine/Audio/Drivers/Detectors/AudioPlayingDetector.h"
|
||||||
#include "WallpaperEngine/Audio/Drivers/Recorders/CPlaybackRecorder.h"
|
#include "WallpaperEngine/Audio/Drivers/Recorders/PlaybackRecorder.h"
|
||||||
|
|
||||||
namespace WallpaperEngine {
|
namespace WallpaperEngine {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
class CAudioStream;
|
class AudioStream;
|
||||||
|
|
||||||
namespace Drivers {
|
namespace Drivers {
|
||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CAudioPlayingDetector;
|
class AudioPlayingDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Recorders {
|
namespace Recorders {
|
||||||
class CPulseAudioPlaybackRecorder;
|
class PulseAudioPlaybackRecorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for audio driver implementations
|
* Base class for audio driver implementations
|
||||||
*/
|
*/
|
||||||
class CAudioDriver {
|
class AudioDriver {
|
||||||
public:
|
public:
|
||||||
explicit CAudioDriver (
|
explicit AudioDriver (
|
||||||
Application::CApplicationContext& applicationContext, Detectors::CAudioPlayingDetector& detector,
|
Application::ApplicationContext& applicationContext, Detectors::AudioPlayingDetector& detector,
|
||||||
Recorders::CPlaybackRecorder& recorder);
|
Recorders::PlaybackRecorder& recorder);
|
||||||
|
|
||||||
virtual ~CAudioDriver () = default;
|
virtual ~AudioDriver () = default;
|
||||||
/**
|
/**
|
||||||
* Registers the given stream in the driver for playing
|
* Registers the given stream in the driver for playing
|
||||||
*
|
*
|
||||||
* @param stream
|
* @param stream
|
||||||
*/
|
*/
|
||||||
virtual void addStream (CAudioStream* stream) = 0;
|
virtual void addStream (AudioStream* stream) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates status of the different audio settings
|
* Updates status of the different audio settings
|
||||||
@ -63,20 +63,20 @@ class CAudioDriver {
|
|||||||
/**
|
/**
|
||||||
* @return The application context under which the audio driver is initialized
|
* @return The application context under which the audio driver is initialized
|
||||||
*/
|
*/
|
||||||
Application::CApplicationContext& getApplicationContext ();
|
Application::ApplicationContext& getApplicationContext ();
|
||||||
/**
|
/**
|
||||||
* @return The audio playing detector to use to stop playing sound when something else starts playing
|
* @return The audio playing detector to use to stop playing sound when something else starts playing
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Detectors::CAudioPlayingDetector& getAudioDetector ();
|
[[nodiscard]] Detectors::AudioPlayingDetector& getAudioDetector ();
|
||||||
/**
|
/**
|
||||||
* @return The audio recorder to use to capture stereo mix data
|
* @return The audio recorder to use to capture stereo mix data
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Recorders::CPlaybackRecorder& getRecorder ();
|
[[nodiscard]] Recorders::PlaybackRecorder& getRecorder ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Application::CApplicationContext& m_applicationContext;
|
Application::ApplicationContext& m_applicationContext;
|
||||||
Detectors::CAudioPlayingDetector& m_detector;
|
Detectors::AudioPlayingDetector& m_detector;
|
||||||
Recorders::CPlaybackRecorder& m_recorder;
|
Recorders::PlaybackRecorder& m_recorder;
|
||||||
};
|
};
|
||||||
} // namespace Drivers
|
} // namespace Drivers
|
||||||
} // namespace Audio
|
} // namespace Audio
|
@ -1,28 +0,0 @@
|
|||||||
#include "CAudioDriver.h"
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers {
|
|
||||||
CAudioDriver::CAudioDriver (
|
|
||||||
Application::CApplicationContext& applicationContext, Detectors::CAudioPlayingDetector& detector,
|
|
||||||
Recorders::CPlaybackRecorder& recorder
|
|
||||||
) :
|
|
||||||
m_applicationContext (applicationContext),
|
|
||||||
m_detector (detector),
|
|
||||||
m_recorder (recorder) {}
|
|
||||||
|
|
||||||
void CAudioDriver::update () {
|
|
||||||
this->m_recorder.update ();
|
|
||||||
this->m_detector.update ();
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::CApplicationContext& CAudioDriver::getApplicationContext () {
|
|
||||||
return this->m_applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
Detectors::CAudioPlayingDetector& CAudioDriver::getAudioDetector () {
|
|
||||||
return this->m_detector;
|
|
||||||
}
|
|
||||||
|
|
||||||
Recorders::CPlaybackRecorder& CAudioDriver::getRecorder () {
|
|
||||||
return this->m_recorder;
|
|
||||||
}
|
|
||||||
} // namespace WallpaperEngine::Audio::Drivers
|
|
@ -0,0 +1,28 @@
|
|||||||
|
#include "AudioPlayingDetector.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
||||||
|
AudioPlayingDetector::AudioPlayingDetector (
|
||||||
|
Application::ApplicationContext& appContext,
|
||||||
|
const Render::Drivers::Detectors::FullScreenDetector& fullscreenDetector) :
|
||||||
|
m_applicationContext (appContext),
|
||||||
|
m_fullscreenDetector (fullscreenDetector) {}
|
||||||
|
|
||||||
|
bool AudioPlayingDetector::anythingPlaying () const {
|
||||||
|
return this->m_isPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
Application::ApplicationContext& AudioPlayingDetector::getApplicationContext () {
|
||||||
|
return this->m_applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Render::Drivers::Detectors::FullScreenDetector& AudioPlayingDetector::getFullscreenDetector () const {
|
||||||
|
return this->m_fullscreenDetector;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioPlayingDetector::setIsPlaying (bool newState) {
|
||||||
|
this->m_isPlaying = newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioPlayingDetector::update () {}
|
||||||
|
|
||||||
|
} // namespace WallpaperEngine::Audio::Drivers::Detectors
|
@ -1,28 +1,28 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
||||||
|
|
||||||
namespace WallpaperEngine {
|
namespace WallpaperEngine {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Render::Drivers::Detectors {
|
namespace Render::Drivers::Detectors {
|
||||||
class CFullScreenDetector;
|
class FullScreenDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Audio::Drivers::Detectors {
|
namespace Audio::Drivers::Detectors {
|
||||||
/**
|
/**
|
||||||
* Base class for any implementation of audio playing detection
|
* Base class for any implementation of audio playing detection
|
||||||
*/
|
*/
|
||||||
class CAudioPlayingDetector {
|
class AudioPlayingDetector {
|
||||||
public:
|
public:
|
||||||
CAudioPlayingDetector (
|
AudioPlayingDetector (
|
||||||
Application::CApplicationContext& appContext,
|
Application::ApplicationContext& appContext,
|
||||||
const Render::Drivers::Detectors::CFullScreenDetector& fullscreenDetector);
|
const Render::Drivers::Detectors::FullScreenDetector& fullscreenDetector);
|
||||||
|
|
||||||
virtual ~CAudioPlayingDetector () = default;
|
virtual ~AudioPlayingDetector () = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If any kind of sound is currently playing on the default audio device
|
* @return If any kind of sound is currently playing on the default audio device
|
||||||
@ -45,17 +45,17 @@ class CAudioPlayingDetector {
|
|||||||
/**
|
/**
|
||||||
* @return The application context using this detector
|
* @return The application context using this detector
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Application::CApplicationContext& getApplicationContext ();
|
[[nodiscard]] Application::ApplicationContext& getApplicationContext ();
|
||||||
/**
|
/**
|
||||||
* @return The fullscreen detector used
|
* @return The fullscreen detector used
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] const Render::Drivers::Detectors::CFullScreenDetector& getFullscreenDetector () const;
|
[[nodiscard]] const Render::Drivers::Detectors::FullScreenDetector& getFullscreenDetector () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isPlaying = false;
|
bool m_isPlaying = false;
|
||||||
|
|
||||||
Application::CApplicationContext& m_applicationContext;
|
Application::ApplicationContext& m_applicationContext;
|
||||||
const Render::Drivers::Detectors::CFullScreenDetector& m_fullscreenDetector;
|
const Render::Drivers::Detectors::FullScreenDetector& m_fullscreenDetector;
|
||||||
};
|
};
|
||||||
} // namespace Audio::Drivers::Detectors
|
} // namespace Audio::Drivers::Detectors
|
||||||
} // namespace WallpaperEngine
|
} // namespace WallpaperEngine
|
@ -1,28 +0,0 @@
|
|||||||
#include "CAudioPlayingDetector.h"
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
|
||||||
CAudioPlayingDetector::CAudioPlayingDetector (
|
|
||||||
Application::CApplicationContext& appContext,
|
|
||||||
const Render::Drivers::Detectors::CFullScreenDetector& fullscreenDetector) :
|
|
||||||
m_applicationContext (appContext),
|
|
||||||
m_fullscreenDetector (fullscreenDetector) {}
|
|
||||||
|
|
||||||
bool CAudioPlayingDetector::anythingPlaying () const {
|
|
||||||
return this->m_isPlaying;
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::CApplicationContext& CAudioPlayingDetector::getApplicationContext () {
|
|
||||||
return this->m_applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Render::Drivers::Detectors::CFullScreenDetector& CAudioPlayingDetector::getFullscreenDetector () const {
|
|
||||||
return this->m_fullscreenDetector;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAudioPlayingDetector::setIsPlaying (bool newState) {
|
|
||||||
this->m_isPlaying = newState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAudioPlayingDetector::update () {}
|
|
||||||
|
|
||||||
} // namespace WallpaperEngine::Audio::Drivers::Detectors
|
|
@ -1,11 +1,11 @@
|
|||||||
#include "CPulseAudioPlayingDetector.h"
|
#include "PulseAudioPlayingDetector.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
||||||
void sinkInputInfoCallback (pa_context* context, const pa_sink_input_info* info, int eol, void* userdata) {
|
void sinkInputInfoCallback (pa_context* context, const pa_sink_input_info* info, int eol, void* userdata) {
|
||||||
auto* detector = static_cast<CPulseAudioPlayingDetector*> (userdata);
|
auto* detector = static_cast<PulseAudioPlayingDetector*> (userdata);
|
||||||
|
|
||||||
if (info == nullptr)
|
if (info == nullptr)
|
||||||
return;
|
return;
|
||||||
@ -29,10 +29,10 @@ void defaultSinkInfoCallback (pa_context* context, const pa_server_info* info, v
|
|||||||
pa_operation_unref (op);
|
pa_operation_unref (op);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPulseAudioPlayingDetector::CPulseAudioPlayingDetector (
|
PulseAudioPlayingDetector::PulseAudioPlayingDetector (
|
||||||
Application::CApplicationContext& appContext,
|
Application::ApplicationContext& appContext,
|
||||||
const Render::Drivers::Detectors::CFullScreenDetector& fullscreenDetector) :
|
const Render::Drivers::Detectors::FullScreenDetector& fullscreenDetector) :
|
||||||
CAudioPlayingDetector (appContext, fullscreenDetector) {
|
AudioPlayingDetector (appContext, fullscreenDetector) {
|
||||||
this->m_mainloop = pa_mainloop_new ();
|
this->m_mainloop = pa_mainloop_new ();
|
||||||
this->m_mainloopApi = pa_mainloop_get_api (this->m_mainloop);
|
this->m_mainloopApi = pa_mainloop_get_api (this->m_mainloop);
|
||||||
this->m_context = pa_context_new (this->m_mainloopApi, "wallpaperengine");
|
this->m_context = pa_context_new (this->m_mainloopApi, "wallpaperengine");
|
||||||
@ -44,7 +44,7 @@ CPulseAudioPlayingDetector::CPulseAudioPlayingDetector (
|
|||||||
pa_mainloop_iterate (this->m_mainloop, 1, nullptr);
|
pa_mainloop_iterate (this->m_mainloop, 1, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPulseAudioPlayingDetector::~CPulseAudioPlayingDetector () {
|
PulseAudioPlayingDetector::~PulseAudioPlayingDetector () {
|
||||||
if (this->m_context) {
|
if (this->m_context) {
|
||||||
pa_context_disconnect (this->m_context);
|
pa_context_disconnect (this->m_context);
|
||||||
pa_context_unref (this->m_context);
|
pa_context_unref (this->m_context);
|
||||||
@ -54,7 +54,7 @@ CPulseAudioPlayingDetector::~CPulseAudioPlayingDetector () {
|
|||||||
pa_mainloop_free (this->m_mainloop);
|
pa_mainloop_free (this->m_mainloop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPulseAudioPlayingDetector::update () {
|
void PulseAudioPlayingDetector::update () {
|
||||||
if (!this->getApplicationContext ().settings.audio.automute)
|
if (!this->getApplicationContext ().settings.audio.automute)
|
||||||
return this->setIsPlaying (false);
|
return this->setIsPlaying (false);
|
||||||
if (this->getFullscreenDetector ().anythingFullscreen ())
|
if (this->getFullscreenDetector ().anythingFullscreen ())
|
@ -1,16 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CAudioPlayingDetector.h"
|
#include "AudioPlayingDetector.h"
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
namespace WallpaperEngine::Audio::Drivers::Detectors {
|
||||||
class CPulseAudioPlayingDetector final : public CAudioPlayingDetector {
|
class PulseAudioPlayingDetector final : public AudioPlayingDetector {
|
||||||
public:
|
public:
|
||||||
explicit CPulseAudioPlayingDetector (
|
explicit PulseAudioPlayingDetector (
|
||||||
Application::CApplicationContext& appContext, const Render::Drivers::Detectors::CFullScreenDetector&);
|
Application::ApplicationContext& appContext, const Render::Drivers::Detectors::FullScreenDetector&);
|
||||||
~CPulseAudioPlayingDetector () override;
|
~PulseAudioPlayingDetector () override;
|
||||||
|
|
||||||
void update () override;
|
void update () override;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
#include "CPlaybackRecorder.h"
|
#include "PlaybackRecorder.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
||||||
void CPlaybackRecorder::update () {}
|
void PlaybackRecorder::update () {}
|
||||||
|
|
||||||
} // namespace WallpaperEngine::Audio::Drivers::Recorders
|
} // namespace WallpaperEngine::Audio::Drivers::Recorders
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
||||||
class CPlaybackRecorder {
|
class PlaybackRecorder {
|
||||||
public:
|
public:
|
||||||
virtual ~CPlaybackRecorder () = default;
|
virtual ~PlaybackRecorder () = default;
|
||||||
|
|
||||||
virtual void update ();
|
virtual void update ();
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "CPulseAudioPlaybackRecorder.h"
|
#include "PulseAudioPlaybackRecorder.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
@ -21,7 +21,7 @@ void pa_stream_notify_cb (pa_stream* stream, void* /*userdata*/) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pa_stream_read_cb (pa_stream* stream, const size_t /*nbytes*/, void* userdata) {
|
void pa_stream_read_cb (pa_stream* stream, const size_t /*nbytes*/, void* userdata) {
|
||||||
auto* recorder = static_cast<CPulseAudioPlaybackRecorder::SPulseAudioData*> (userdata);
|
auto* recorder = static_cast<PulseAudioPlaybackRecorder::PulseAudioData*> (userdata);
|
||||||
|
|
||||||
// Careful when to pa_stream_peek() and pa_stream_drop()!
|
// Careful when to pa_stream_peek() and pa_stream_drop()!
|
||||||
// c.f. https://www.freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#ac2838c449cde56e169224d7fe3d00824
|
// c.f. https://www.freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#ac2838c449cde56e169224d7fe3d00824
|
||||||
@ -86,7 +86,7 @@ void pa_stream_read_cb (pa_stream* stream, const size_t /*nbytes*/, void* userda
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pa_server_info_cb (pa_context* ctx, const pa_server_info* info, void* userdata) {
|
void pa_server_info_cb (pa_context* ctx, const pa_server_info* info, void* userdata) {
|
||||||
auto* recorder = static_cast<CPulseAudioPlaybackRecorder::SPulseAudioData*> (userdata);
|
auto* recorder = static_cast<PulseAudioPlaybackRecorder::PulseAudioData*> (userdata);
|
||||||
|
|
||||||
pa_sample_spec spec;
|
pa_sample_spec spec;
|
||||||
spec.format = PA_SAMPLE_U8;
|
spec.format = PA_SAMPLE_U8;
|
||||||
@ -149,7 +149,7 @@ void pa_context_notify_cb (pa_context* ctx, void* userdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPulseAudioPlaybackRecorder::CPulseAudioPlaybackRecorder () :
|
PulseAudioPlaybackRecorder::PulseAudioPlaybackRecorder () :
|
||||||
m_captureData({
|
m_captureData({
|
||||||
.kisscfg = kiss_fftr_alloc (WAVE_BUFFER_SIZE, 0, nullptr, nullptr),
|
.kisscfg = kiss_fftr_alloc (WAVE_BUFFER_SIZE, 0, nullptr, nullptr),
|
||||||
.audioBuffer = new uint8_t [WAVE_BUFFER_SIZE],
|
.audioBuffer = new uint8_t [WAVE_BUFFER_SIZE],
|
||||||
@ -171,7 +171,7 @@ CPulseAudioPlaybackRecorder::CPulseAudioPlaybackRecorder () :
|
|||||||
pa_mainloop_iterate (this->m_mainloop, 1, nullptr);
|
pa_mainloop_iterate (this->m_mainloop, 1, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPulseAudioPlaybackRecorder::~CPulseAudioPlaybackRecorder () {
|
PulseAudioPlaybackRecorder::~PulseAudioPlaybackRecorder () {
|
||||||
if (m_captureData.captureStream) {
|
if (m_captureData.captureStream) {
|
||||||
pa_stream_unref (m_captureData.captureStream);
|
pa_stream_unref (m_captureData.captureStream);
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ CPulseAudioPlaybackRecorder::~CPulseAudioPlaybackRecorder () {
|
|||||||
pa_mainloop_free (this->m_mainloop);
|
pa_mainloop_free (this->m_mainloop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPulseAudioPlaybackRecorder::update () {
|
void PulseAudioPlaybackRecorder::update () {
|
||||||
pa_mainloop_iterate (this->m_mainloop, 0, nullptr);
|
pa_mainloop_iterate (this->m_mainloop, 0, nullptr);
|
||||||
|
|
||||||
// interpolate current values to the destination
|
// interpolate current values to the destination
|
@ -1,20 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "PlaybackRecorder.h"
|
||||||
#include "kiss_fftr.h"
|
#include "kiss_fftr.h"
|
||||||
#include "CPlaybackRecorder.h"
|
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
#define WAVE_BUFFER_SIZE 1024
|
#define WAVE_BUFFER_SIZE 1024
|
||||||
|
|
||||||
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
||||||
class CPlaybackRecorder;
|
class PlaybackRecorder;
|
||||||
|
|
||||||
class CPulseAudioPlaybackRecorder final : public CPlaybackRecorder {
|
class PulseAudioPlaybackRecorder final : public PlaybackRecorder {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Struct that contains all the required data for the PulseAudio callbacks
|
* Struct that contains all the required data for the PulseAudio callbacks
|
||||||
*/
|
*/
|
||||||
struct SPulseAudioData {
|
struct PulseAudioData {
|
||||||
kiss_fftr_cfg kisscfg;
|
kiss_fftr_cfg kisscfg;
|
||||||
uint8_t* audioBuffer;
|
uint8_t* audioBuffer;
|
||||||
uint8_t* audioBufferTmp;
|
uint8_t* audioBufferTmp;
|
||||||
@ -23,8 +23,8 @@ class CPulseAudioPlaybackRecorder final : public CPlaybackRecorder {
|
|||||||
pa_stream* captureStream;
|
pa_stream* captureStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
CPulseAudioPlaybackRecorder ();
|
PulseAudioPlaybackRecorder ();
|
||||||
~CPulseAudioPlaybackRecorder () override;
|
~PulseAudioPlaybackRecorder () override;
|
||||||
|
|
||||||
void update () override;
|
void update () override;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class CPulseAudioPlaybackRecorder final : public CPlaybackRecorder {
|
|||||||
pa_mainloop* m_mainloop;
|
pa_mainloop* m_mainloop;
|
||||||
pa_mainloop_api* m_mainloopApi;
|
pa_mainloop_api* m_mainloopApi;
|
||||||
pa_context* m_context;
|
pa_context* m_context;
|
||||||
SPulseAudioData m_captureData;
|
PulseAudioData m_captureData;
|
||||||
|
|
||||||
float m_audioFFTbuffer [WAVE_BUFFER_SIZE] = {0.0f};
|
float m_audioFFTbuffer [WAVE_BUFFER_SIZE] = {0.0f};
|
||||||
kiss_fft_cpx m_FFTinfo [WAVE_BUFFER_SIZE / 2 + 1] = {0};
|
kiss_fft_cpx m_FFTinfo [WAVE_BUFFER_SIZE / 2 + 1] = {0};
|
@ -1,5 +1,5 @@
|
|||||||
#include "CSDLAudioDriver.h"
|
#include "SDLAudioDriver.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#define SDL_AUDIO_BUFFER_SIZE 4096
|
#define SDL_AUDIO_BUFFER_SIZE 4096
|
||||||
#define MAX_AUDIO_FRAME_SIZE 192000
|
#define MAX_AUDIO_FRAME_SIZE 192000
|
||||||
@ -8,7 +8,7 @@ using namespace WallpaperEngine::Audio;
|
|||||||
using namespace WallpaperEngine::Audio::Drivers;
|
using namespace WallpaperEngine::Audio::Drivers;
|
||||||
|
|
||||||
void audio_callback (void* userdata, uint8_t* streamData, int length) {
|
void audio_callback (void* userdata, uint8_t* streamData, int length) {
|
||||||
auto* driver = static_cast<CSDLAudioDriver*> (userdata);
|
auto* driver = static_cast<SDLAudioDriver*> (userdata);
|
||||||
|
|
||||||
memset (streamData, 0, length);
|
memset (streamData, 0, length);
|
||||||
|
|
||||||
@ -64,11 +64,11 @@ void audio_callback (void* userdata, uint8_t* streamData, int length) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSDLAudioDriver::CSDLAudioDriver (
|
SDLAudioDriver::SDLAudioDriver (
|
||||||
Application::CApplicationContext& applicationContext, Detectors::CAudioPlayingDetector& detector,
|
Application::ApplicationContext& applicationContext, Detectors::AudioPlayingDetector& detector,
|
||||||
Recorders::CPlaybackRecorder& recorder
|
Recorders::PlaybackRecorder& recorder
|
||||||
) :
|
) :
|
||||||
CAudioDriver (applicationContext, detector, recorder),
|
AudioDriver (applicationContext, detector, recorder),
|
||||||
m_audioSpec () {
|
m_audioSpec () {
|
||||||
if (SDL_InitSubSystem (SDL_INIT_AUDIO) < 0) {
|
if (SDL_InitSubSystem (SDL_INIT_AUDIO) < 0) {
|
||||||
sLog.error ("Cannot initialize SDL audio system, SDL_GetError: ", SDL_GetError ());
|
sLog.error ("Cannot initialize SDL audio system, SDL_GetError: ", SDL_GetError ());
|
||||||
@ -99,7 +99,7 @@ CSDLAudioDriver::CSDLAudioDriver (
|
|||||||
this->m_initialized = true;
|
this->m_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSDLAudioDriver::~CSDLAudioDriver () {
|
SDLAudioDriver::~SDLAudioDriver () {
|
||||||
if (!this->m_initialized)
|
if (!this->m_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -107,15 +107,15 @@ CSDLAudioDriver::~CSDLAudioDriver () {
|
|||||||
SDL_QuitSubSystem (SDL_INIT_AUDIO);
|
SDL_QuitSubSystem (SDL_INIT_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSDLAudioDriver::addStream (CAudioStream* stream) {
|
void SDLAudioDriver::addStream (AudioStream* stream) {
|
||||||
this->m_streams.push_back (new CSDLAudioBuffer {stream});
|
this->m_streams.push_back (new SDLAudioBuffer {stream});
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<CSDLAudioBuffer*>& CSDLAudioDriver::getStreams () {
|
const std::vector<SDLAudioBuffer*>& SDLAudioDriver::getStreams () {
|
||||||
return this->m_streams;
|
return this->m_streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSampleFormat CSDLAudioDriver::getFormat () const {
|
AVSampleFormat SDLAudioDriver::getFormat () const {
|
||||||
switch (this->m_audioSpec.format) {
|
switch (this->m_audioSpec.format) {
|
||||||
case AUDIO_U8:
|
case AUDIO_U8:
|
||||||
case AUDIO_S8: return AV_SAMPLE_FMT_U8;
|
case AUDIO_S8: return AV_SAMPLE_FMT_U8;
|
||||||
@ -132,14 +132,14 @@ AVSampleFormat CSDLAudioDriver::getFormat () const {
|
|||||||
sLog.exception ("Cannot convert from SDL format to ffmpeg format, aborting...");
|
sLog.exception ("Cannot convert from SDL format to ffmpeg format, aborting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSDLAudioDriver::getSampleRate () const {
|
int SDLAudioDriver::getSampleRate () const {
|
||||||
return this->m_audioSpec.freq;
|
return this->m_audioSpec.freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSDLAudioDriver::getChannels () const {
|
int SDLAudioDriver::getChannels () const {
|
||||||
return this->m_audioSpec.channels;
|
return this->m_audioSpec.channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDL_AudioSpec& CSDLAudioDriver::getSpec () const {
|
const SDL_AudioSpec& SDLAudioDriver::getSpec () const {
|
||||||
return this->m_audioSpec;
|
return this->m_audioSpec;
|
||||||
}
|
}
|
@ -3,8 +3,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "WallpaperEngine/Audio/CAudioStream.h"
|
#include "WallpaperEngine/Audio/AudioStream.h"
|
||||||
#include "WallpaperEngine/Audio/Drivers/CAudioDriver.h"
|
#include "WallpaperEngine/Audio/Drivers/AudioDriver.h"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ namespace WallpaperEngine::Audio::Drivers {
|
|||||||
/**
|
/**
|
||||||
* Audio output buffers for streams being played under SDL
|
* Audio output buffers for streams being played under SDL
|
||||||
*/
|
*/
|
||||||
struct CSDLAudioBuffer {
|
struct SDLAudioBuffer {
|
||||||
CAudioStream* stream = nullptr;
|
AudioStream* stream = nullptr;
|
||||||
uint8_t audio_buf [(MAX_AUDIO_FRAME_SIZE * 3) / 2] = {0};
|
uint8_t audio_buf [(MAX_AUDIO_FRAME_SIZE * 3) / 2] = {0};
|
||||||
unsigned int audio_buf_size = 0;
|
unsigned int audio_buf_size = 0;
|
||||||
unsigned int audio_buf_index = 0;
|
unsigned int audio_buf_index = 0;
|
||||||
@ -24,19 +24,19 @@ struct CSDLAudioBuffer {
|
|||||||
/**
|
/**
|
||||||
* SDL's audio driver implementation
|
* SDL's audio driver implementation
|
||||||
*/
|
*/
|
||||||
class CSDLAudioDriver final : public CAudioDriver {
|
class SDLAudioDriver final : public AudioDriver {
|
||||||
public:
|
public:
|
||||||
CSDLAudioDriver (
|
SDLAudioDriver (
|
||||||
Application::CApplicationContext& applicationContext, Detectors::CAudioPlayingDetector& detector,
|
Application::ApplicationContext& applicationContext, Detectors::AudioPlayingDetector& detector,
|
||||||
Recorders::CPlaybackRecorder& recorder);
|
Recorders::PlaybackRecorder& recorder);
|
||||||
~CSDLAudioDriver () override;
|
~SDLAudioDriver () override;
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
void addStream (CAudioStream* stream) override;
|
void addStream (AudioStream* stream) override;
|
||||||
/**
|
/**
|
||||||
* @return All the registered audio streams
|
* @return All the registered audio streams
|
||||||
*/
|
*/
|
||||||
const std::vector<CSDLAudioBuffer*>& getStreams ();
|
const std::vector<SDLAudioBuffer*>& getStreams ();
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
[[nodiscard]] AVSampleFormat getFormat () const override;
|
[[nodiscard]] AVSampleFormat getFormat () const override;
|
||||||
@ -57,6 +57,6 @@ class CSDLAudioDriver final : public CAudioDriver {
|
|||||||
/** The sound output configuration */
|
/** The sound output configuration */
|
||||||
SDL_AudioSpec m_audioSpec {};
|
SDL_AudioSpec m_audioSpec {};
|
||||||
/** All the playable steams */
|
/** All the playable steams */
|
||||||
std::vector<CSDLAudioBuffer*> m_streams {};
|
std::vector<SDLAudioBuffer*> m_streams {};
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Audio::Drivers
|
} // namespace WallpaperEngine::Audio::Drivers
|
@ -5,8 +5,8 @@
|
|||||||
#include <glm/detail/qualifier.hpp>
|
#include <glm/detail/qualifier.hpp>
|
||||||
#include <glm/detail/type_vec1.hpp>
|
#include <glm/detail/type_vec1.hpp>
|
||||||
|
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
|
||||||
#include "WallpaperEngine/Data/Utils/SFINAE.h"
|
#include "WallpaperEngine/Data/Utils/SFINAE.h"
|
||||||
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Builders {
|
namespace WallpaperEngine::Data::Builders {
|
||||||
using namespace WallpaperEngine::Data::Utils::SFINAE;
|
using namespace WallpaperEngine::Data::Utils::SFINAE;
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Data/Builders/UserSettingBuilder.h"
|
#include "WallpaperEngine/Data/Builders/UserSettingBuilder.h"
|
||||||
#include "WallpaperEngine/Data/Builders/VectorBuilder.h"
|
#include "WallpaperEngine/Data/Builders/VectorBuilder.h"
|
||||||
#include "WallpaperEngine/Data/Utils/SFINAE.h"
|
|
||||||
#include "WallpaperEngine/Data/Model/Types.h"
|
#include "WallpaperEngine/Data/Model/Types.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Data/Utils/SFINAE.h"
|
||||||
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::JSON {
|
namespace WallpaperEngine::Data::JSON {
|
||||||
using namespace WallpaperEngine::Data::Builders;
|
using namespace WallpaperEngine::Data::Builders;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "ShaderConstantParser.h"
|
#include "ShaderConstantParser.h"
|
||||||
#include "WallpaperEngine/Data/Model/Object.h"
|
#include "WallpaperEngine/Data/Model/Object.h"
|
||||||
#include "WallpaperEngine/Data/Model/Project.h"
|
#include "WallpaperEngine/Data/Model/Project.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Data::Parsers;
|
using namespace WallpaperEngine::Data::Parsers;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "PackageParser.h"
|
#include "PackageParser.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Utils/BinaryReader.h"
|
#include "WallpaperEngine/Data/Utils/BinaryReader.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Assets/Package.h"
|
#include "WallpaperEngine/Data/Assets/Package.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "ProjectParser.h"
|
#include "ProjectParser.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#include "WallpaperParser.h"
|
#include "WallpaperParser.h"
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "TextureParser.h"
|
#include "TextureParser.h"
|
||||||
#include "WallpaperEngine/Data/Assets/Texture.h"
|
#include "WallpaperEngine/Data/Assets/Texture.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Data::Assets;
|
using namespace WallpaperEngine::Data::Assets;
|
||||||
using namespace WallpaperEngine::Data::Parsers;
|
using namespace WallpaperEngine::Data::Parsers;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "WallpaperEngine/Data/JSON.h"
|
#include "WallpaperEngine/Data/JSON.h"
|
||||||
#include "WallpaperEngine/Data/Model/Types.h"
|
#include "WallpaperEngine/Data/Model/Types.h"
|
||||||
#include "WallpaperEngine/Data/Model/UserSetting.h"
|
#include "WallpaperEngine/Data/Model/UserSetting.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Parsers {
|
namespace WallpaperEngine::Data::Parsers {
|
||||||
using json = WallpaperEngine::Data::JSON::JSON;
|
using json = WallpaperEngine::Data::JSON::JSON;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "WallpaperEngine/Data/Model/Project.h"
|
#include "WallpaperEngine/Data/Model/Project.h"
|
||||||
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
||||||
#include "WallpaperEngine/FileSystem/Container.h"
|
#include "WallpaperEngine/FileSystem/Container.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Data::Parsers;
|
using namespace WallpaperEngine::Data::Parsers;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "Directory.h"
|
#include "Directory.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Assets/CAssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
using namespace WallpaperEngine::FileSystem::Adapters;
|
using namespace WallpaperEngine::FileSystem::Adapters;
|
||||||
@ -57,7 +57,7 @@ std::filesystem::path DirectoryAdapter::physicalPath (const std::filesystem::pat
|
|||||||
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
||||||
|
|
||||||
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
||||||
throw Assets::CAssetLoadException ("Cannot find file", path);
|
throw Render::AssetLoadException ("Cannot find file", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalpath;
|
return finalpath;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "Package.h"
|
#include "Package.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Assets/CAssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
#include "WallpaperEngine/Data/Parsers/PackageParser.h"
|
#include "WallpaperEngine/Data/Parsers/PackageParser.h"
|
||||||
#include "WallpaperEngine/Data/Utils/BinaryReader.h"
|
#include "WallpaperEngine/Data/Utils/BinaryReader.h"
|
||||||
#include "WallpaperEngine/Data/Utils/MemoryStream.h"
|
#include "WallpaperEngine/Data/Utils/MemoryStream.h"
|
||||||
@ -45,7 +45,7 @@ bool PackageAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path PackageAdapter::physicalPath (const std::filesystem::path& path) const {
|
std::filesystem::path PackageAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Assets::CAssetLoadException ("Package adapter does not support realpath", path);
|
throw Render::AssetLoadException ("Package adapter does not support realpath", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PackageFactory::handlesMountpoint (const std::filesystem::path& path) const {
|
bool PackageFactory::handlesMountpoint (const std::filesystem::path& path) const {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Virtual.h"
|
#include "Virtual.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Assets/CAssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ bool VirtualAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path VirtualAdapter::physicalPath (const std::filesystem::path& path) const {
|
std::filesystem::path VirtualAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Assets::CAssetLoadException ("Virtual adapter does not support realpath", path);
|
throw Render::AssetLoadException ("Virtual adapter does not support realpath", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include "Adapters/Package.h"
|
#include "Adapters/Package.h"
|
||||||
#include "Adapters/Types.h"
|
#include "Adapters/Types.h"
|
||||||
#include "Adapters/Virtual.h"
|
#include "Adapters/Virtual.h"
|
||||||
#include "WallpaperEngine/Assets/CAssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
using namespace WallpaperEngine::FileSystem::Adapters;
|
using namespace WallpaperEngine::FileSystem::Adapters;
|
||||||
@ -56,7 +56,6 @@ Container::Container () {
|
|||||||
this->m_factories.push_back (std::make_unique<PackageFactory> ());
|
this->m_factories.push_back (std::make_unique<PackageFactory> ());
|
||||||
this->m_factories.push_back (std::make_unique<DirectoryFactory> ());
|
this->m_factories.push_back (std::make_unique<DirectoryFactory> ());
|
||||||
|
|
||||||
// TODO: FIND A BETTER WAY OF MOUNTING THE VIRTUAL FILESYSTEM
|
|
||||||
this->m_vfs = std::make_shared<VirtualAdapter> ();
|
this->m_vfs = std::make_shared<VirtualAdapter> ();
|
||||||
this->m_mountpoints.emplace_back ("/", this->m_vfs);
|
this->m_mountpoints.emplace_back ("/", this->m_vfs);
|
||||||
// mount the current directory as root
|
// mount the current directory as root
|
||||||
@ -64,9 +63,9 @@ Container::Container () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReadStreamSharedPtr Container::read (const std::filesystem::path& path) const {
|
ReadStreamSharedPtr Container::read (const std::filesystem::path& path) const {
|
||||||
std::filesystem::path normalized = normalize_path (path);
|
const auto normalized = normalize_path (path);
|
||||||
|
|
||||||
return this->resolveAdapterForFile (path).open (normalized);
|
return this->resolveAdapterForFile (path).open (normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Container::readString (const std::filesystem::path& path) const {
|
std::string Container::readString (const std::filesystem::path& path) const {
|
||||||
@ -77,9 +76,9 @@ std::string Container::readString (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path Container::physicalPath (const std::filesystem::path& path) const {
|
std::filesystem::path Container::physicalPath (const std::filesystem::path& path) const {
|
||||||
std::filesystem::path normalized = normalize_path (path);
|
const auto normalized = normalize_path (path);
|
||||||
|
|
||||||
return this->resolveAdapterForFile (path).physicalPath (normalized);
|
return this->resolveAdapterForFile (path).physicalPath (normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,16 +100,15 @@ VirtualAdapter& Container::getVFS () const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Adapter& Container::resolveAdapterForFile (const std::filesystem::path& path) const {
|
Adapter& Container::resolveAdapterForFile (const std::filesystem::path& path) const {
|
||||||
std::filesystem::path normalized = normalize_path (path);
|
const auto normalized = normalize_path (path);
|
||||||
|
|
||||||
for (const auto& [root, adapter] : this->m_mountpoints) {
|
for (const auto& [root, adapter] : this->m_mountpoints) {
|
||||||
if (normalized.string().starts_with (root.string()) == false) {
|
if (normalized.string().starts_with (root.string()) == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path relative = normalized.string().substr (root.string().length());
|
if (const auto relative = normalized.string ().substr (root.string ().length ());
|
||||||
|
adapter->exists (relative) == false) {
|
||||||
if (adapter->exists (relative) == false) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,5 +120,5 @@ Adapter& Container::resolveAdapterForFile (const std::filesystem::path& path) co
|
|||||||
return this->resolveAdapterForFile ("/" + normalized.string());
|
return this->resolveAdapterForFile ("/" + normalized.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Assets::CAssetLoadException ("Cannot find requested file ", path);
|
throw Render::AssetLoadException ("Cannot find requested file ", path);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#include "CInputContext.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Input;
|
|
||||||
using namespace WallpaperEngine::Render::Drivers;
|
|
||||||
|
|
||||||
CInputContext::CInputContext (CMouseInput& mouseInput) : m_mouse (mouseInput) {}
|
|
||||||
|
|
||||||
void CInputContext::update () {
|
|
||||||
this->m_mouse.update ();
|
|
||||||
}
|
|
||||||
|
|
||||||
const CMouseInput& CInputContext::getMouseInput () const {
|
|
||||||
return this->m_mouse;
|
|
||||||
}
|
|
@ -1,14 +1,14 @@
|
|||||||
#include "CGLFWMouseInput.h"
|
#include "GLFWMouseInput.h"
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Input::Drivers;
|
using namespace WallpaperEngine::Input::Drivers;
|
||||||
|
|
||||||
CGLFWMouseInput::CGLFWMouseInput (const Render::Drivers::CGLFWOpenGLDriver& driver) :
|
GLFWMouseInput::GLFWMouseInput (const Render::Drivers::GLFWOpenGLDriver& driver) :
|
||||||
m_driver (driver) {}
|
m_driver (driver) {}
|
||||||
|
|
||||||
void CGLFWMouseInput::update () {
|
void GLFWMouseInput::update () {
|
||||||
if (!this->m_driver.getApp ().getContext ().settings.mouse.enabled) {
|
if (!this->m_driver.getApp ().getContext ().settings.mouse.enabled) {
|
||||||
this->m_reportedPosition = {0, 0};
|
this->m_reportedPosition = {0, 0};
|
||||||
return;
|
return;
|
||||||
@ -26,14 +26,14 @@ void CGLFWMouseInput::update () {
|
|||||||
this->m_reportedPosition = glm::mix (this->m_reportedPosition, this->m_mousePosition, 1.0);
|
this->m_reportedPosition = glm::mix (this->m_reportedPosition, this->m_mousePosition, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::dvec2 CGLFWMouseInput::position () const {
|
glm::dvec2 GLFWMouseInput::position () const {
|
||||||
return this->m_reportedPosition;
|
return this->m_reportedPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperEngine::Input::MouseClickStatus CGLFWMouseInput::leftClick () const {
|
WallpaperEngine::Input::MouseClickStatus GLFWMouseInput::leftClick () const {
|
||||||
return m_leftClick;
|
return m_leftClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperEngine::Input::MouseClickStatus CGLFWMouseInput::rightClick () const {
|
WallpaperEngine::Input::MouseClickStatus GLFWMouseInput::rightClick () const {
|
||||||
return m_rightClick;
|
return m_rightClick;
|
||||||
}
|
}
|
@ -1,20 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Input/CMouseInput.h"
|
#include "WallpaperEngine/Input/MouseInput.h"
|
||||||
|
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CGLFWOpenGLDriver;
|
class GLFWOpenGLDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Input::Drivers {
|
namespace WallpaperEngine::Input::Drivers {
|
||||||
/**
|
/**
|
||||||
* Handles mouse input for the background
|
* Handles mouse input for the background
|
||||||
*/
|
*/
|
||||||
class CGLFWMouseInput final : public CMouseInput {
|
class GLFWMouseInput final : public MouseInput {
|
||||||
public:
|
public:
|
||||||
explicit CGLFWMouseInput (const Render::Drivers::CGLFWOpenGLDriver& driver);
|
explicit GLFWMouseInput (const Render::Drivers::GLFWOpenGLDriver& driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes current mouse position and updates it
|
* Takes current mouse position and updates it
|
||||||
@ -37,7 +37,7 @@ class CGLFWMouseInput final : public CMouseInput {
|
|||||||
[[nodiscard]] MouseClickStatus rightClick () const override;
|
[[nodiscard]] MouseClickStatus rightClick () const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Render::Drivers::CGLFWOpenGLDriver& m_driver;
|
const Render::Drivers::GLFWOpenGLDriver& m_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current mouse position
|
* The current mouse position
|
@ -1,15 +1,15 @@
|
|||||||
|
#include "WaylandMouseInput.h"
|
||||||
|
#include "WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.h"
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
#include "CWaylandMouseInput.h"
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Input::Drivers;
|
using namespace WallpaperEngine::Input::Drivers;
|
||||||
|
|
||||||
CWaylandMouseInput::CWaylandMouseInput (const WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver& driver) :
|
WaylandMouseInput::WaylandMouseInput (const WallpaperEngine::Render::Drivers::WaylandOpenGLDriver& driver) :
|
||||||
m_waylandDriver (driver) {}
|
m_waylandDriver (driver) {}
|
||||||
|
|
||||||
void CWaylandMouseInput::update () {}
|
void WaylandMouseInput::update () {}
|
||||||
|
|
||||||
glm::dvec2 CWaylandMouseInput::position () const {
|
glm::dvec2 WaylandMouseInput::position () const {
|
||||||
if (!this->m_waylandDriver.getApp ().getContext ().settings.mouse.enabled) {
|
if (!this->m_waylandDriver.getApp ().getContext ().settings.mouse.enabled) {
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
@ -20,14 +20,14 @@ glm::dvec2 CWaylandMouseInput::position () const {
|
|||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperEngine::Input::MouseClickStatus CWaylandMouseInput::leftClick () const {
|
WallpaperEngine::Input::MouseClickStatus WaylandMouseInput::leftClick () const {
|
||||||
if (m_waylandDriver.viewportInFocus && m_waylandDriver.viewportInFocus->rendering)
|
if (m_waylandDriver.viewportInFocus && m_waylandDriver.viewportInFocus->rendering)
|
||||||
return m_waylandDriver.viewportInFocus->leftClick;
|
return m_waylandDriver.viewportInFocus->leftClick;
|
||||||
|
|
||||||
return MouseClickStatus::Released;
|
return MouseClickStatus::Released;
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperEngine::Input::MouseClickStatus CWaylandMouseInput::rightClick () const {
|
WallpaperEngine::Input::MouseClickStatus WaylandMouseInput::rightClick () const {
|
||||||
if (m_waylandDriver.viewportInFocus && m_waylandDriver.viewportInFocus->rendering)
|
if (m_waylandDriver.viewportInFocus && m_waylandDriver.viewportInFocus->rendering)
|
||||||
return m_waylandDriver.viewportInFocus->rightClick;
|
return m_waylandDriver.viewportInFocus->rightClick;
|
||||||
|
|
@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
|
|
||||||
#include "WallpaperEngine/Input/CMouseInput.h"
|
#include "WallpaperEngine/Input/MouseInput.h"
|
||||||
|
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CWaylandOpenGLDriver;
|
class WaylandOpenGLDriver;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace WallpaperEngine::Input::Drivers {
|
namespace WallpaperEngine::Input::Drivers {
|
||||||
/**
|
/**
|
||||||
* Handles mouse input for the background
|
* Handles mouse input for the background
|
||||||
*/
|
*/
|
||||||
class CWaylandMouseInput final : public CMouseInput {
|
class WaylandMouseInput final : public MouseInput {
|
||||||
public:
|
public:
|
||||||
explicit CWaylandMouseInput (const WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver& driver);
|
explicit WaylandMouseInput (const WallpaperEngine::Render::Drivers::WaylandOpenGLDriver& driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes current mouse position and updates it
|
* Takes current mouse position and updates it
|
||||||
@ -42,7 +42,7 @@ class CWaylandMouseInput final : public CMouseInput {
|
|||||||
/**
|
/**
|
||||||
* Wayland: Driver
|
* Wayland: Driver
|
||||||
*/
|
*/
|
||||||
const WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver& m_waylandDriver;
|
const WallpaperEngine::Render::Drivers::WaylandOpenGLDriver& m_waylandDriver;
|
||||||
|
|
||||||
glm::dvec2 m_pos = {};
|
glm::dvec2 m_pos = {};
|
||||||
};
|
};
|
14
src/WallpaperEngine/Input/InputContext.cpp
Normal file
14
src/WallpaperEngine/Input/InputContext.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "InputContext.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Input;
|
||||||
|
using namespace WallpaperEngine::Render::Drivers;
|
||||||
|
|
||||||
|
InputContext::InputContext (MouseInput& mouseInput) : m_mouse (mouseInput) {}
|
||||||
|
|
||||||
|
void InputContext::update () {
|
||||||
|
this->m_mouse.update ();
|
||||||
|
}
|
||||||
|
|
||||||
|
const MouseInput& InputContext::getMouseInput () const {
|
||||||
|
return this->m_mouse;
|
||||||
|
}
|
@ -1,24 +1,24 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CMouseInput.h"
|
#include "MouseInput.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CVideoDriver;
|
class VideoDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Input {
|
namespace WallpaperEngine::Input {
|
||||||
class CInputContext {
|
class InputContext {
|
||||||
public:
|
public:
|
||||||
explicit CInputContext (CMouseInput& mouseInput);
|
explicit InputContext (MouseInput& mouseInput);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates input information
|
* Updates input information
|
||||||
*/
|
*/
|
||||||
void update ();
|
void update ();
|
||||||
|
|
||||||
[[nodiscard]] const CMouseInput& getMouseInput () const;
|
[[nodiscard]] const MouseInput& getMouseInput () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMouseInput& m_mouse;
|
MouseInput& m_mouse;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Input
|
} // namespace WallpaperEngine::Input
|
@ -11,9 +11,9 @@ enum MouseClickStatus : int {
|
|||||||
/**
|
/**
|
||||||
* Handles mouse input for the background
|
* Handles mouse input for the background
|
||||||
*/
|
*/
|
||||||
class CMouseInput {
|
class MouseInput {
|
||||||
public:
|
public:
|
||||||
virtual ~CMouseInput () = default;
|
virtual ~MouseInput () = default;
|
||||||
/**
|
/**
|
||||||
* Takes current mouse position and updates it
|
* Takes current mouse position and updates it
|
||||||
*/
|
*/
|
@ -1,28 +1,28 @@
|
|||||||
#include "CLog.h"
|
#include "Log.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace WallpaperEngine::Logging;
|
using namespace WallpaperEngine::Logging;
|
||||||
|
|
||||||
CLog::CLog () {
|
Log::Log () {
|
||||||
assert (this->sInstance == nullptr);
|
assert (this->sInstance == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLog& CLog::get () {
|
Log& Log::get () {
|
||||||
if (sInstance == nullptr) {
|
if (sInstance == nullptr) {
|
||||||
sInstance = std::make_unique<CLog> ();
|
sInstance = std::make_unique<Log> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *sInstance;
|
return *sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLog::addOutput (std::ostream* stream) {
|
void Log::addOutput (std::ostream* stream) {
|
||||||
this->mOutputs.push_back (stream);
|
this->mOutputs.push_back (stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLog::addError (std::ostream* stream) {
|
void Log::addError (std::ostream* stream) {
|
||||||
this->mErrors.push_back (stream);
|
this->mErrors.push_back (stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CLog> CLog::sInstance = nullptr;
|
std::unique_ptr<Log> Log::sInstance = nullptr;
|
@ -10,9 +10,9 @@ namespace WallpaperEngine::Logging {
|
|||||||
/**
|
/**
|
||||||
* Singleton class, simplifies logging for the whole app
|
* Singleton class, simplifies logging for the whole app
|
||||||
*/
|
*/
|
||||||
class CLog {
|
class Log {
|
||||||
public:
|
public:
|
||||||
CLog ();
|
Log ();
|
||||||
|
|
||||||
void addOutput (std::ostream* stream);
|
void addOutput (std::ostream* stream);
|
||||||
void addError (std::ostream* stream);
|
void addError (std::ostream* stream);
|
||||||
@ -67,7 +67,7 @@ class CLog {
|
|||||||
this->exception<std::runtime_error> (data...);
|
this->exception<std::runtime_error> (data...);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CLog& get ();
|
static Log& get ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename... Data> std::string buildBuffer (Data... data) {
|
template <typename... Data> std::string buildBuffer (Data... data) {
|
||||||
@ -82,8 +82,8 @@ class CLog {
|
|||||||
|
|
||||||
std::vector<std::ostream*> mOutputs = {};
|
std::vector<std::ostream*> mOutputs = {};
|
||||||
std::vector<std::ostream*> mErrors = {};
|
std::vector<std::ostream*> mErrors = {};
|
||||||
static std::unique_ptr<CLog> sInstance;
|
static std::unique_ptr<Log> sInstance;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Logging
|
} // namespace WallpaperEngine::Logging
|
||||||
|
|
||||||
#define sLog (WallpaperEngine::Logging::CLog::get ())
|
#define sLog (WallpaperEngine::Logging::Log::get ())
|
@ -1,5 +1,5 @@
|
|||||||
#include "CFBO.h"
|
#include "CFBO.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "ITexture.h"
|
#include "TextureProvider.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render {
|
namespace WallpaperEngine::Render {
|
||||||
class CFBO final : public ITexture {
|
class CFBO final : public TextureProvider {
|
||||||
public:
|
public:
|
||||||
CFBO (std::string name, TextureFormat format, uint32_t flags, float scale,
|
CFBO (std::string name, TextureFormat format, uint32_t flags, float scale,
|
||||||
uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight);
|
uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight);
|
||||||
|
@ -7,7 +7,7 @@ using namespace WallpaperEngine::Render;
|
|||||||
using namespace WallpaperEngine::Render::Wallpapers;
|
using namespace WallpaperEngine::Render::Wallpapers;
|
||||||
|
|
||||||
CObject::CObject (Wallpapers::CScene& scene, const Object& object) :
|
CObject::CObject (Wallpapers::CScene& scene, const Object& object) :
|
||||||
Helpers::CContextAware (scene),
|
Helpers::ContextAware (scene),
|
||||||
m_scene (scene),
|
m_scene (scene),
|
||||||
m_object (object) {}
|
m_object (object) {}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Helpers/CContextAware.h"
|
#include "WallpaperEngine/Render/Helpers/ContextAware.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Wallpapers/CScene.h"
|
#include "WallpaperEngine/Render/Wallpapers/CScene.h"
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ class CScene;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Render {
|
namespace WallpaperEngine::Render {
|
||||||
class CObject : public Helpers::CContextAware {
|
class CObject : public Helpers::ContextAware {
|
||||||
public:
|
public:
|
||||||
template <class T> [[nodiscard]] const T* as () const {
|
template <class T> [[nodiscard]] const T* as () const {
|
||||||
if (is <T> ()) {
|
if (is <T> ()) {
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <glm/vec4.hpp>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "CTextureCache.h"
|
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
|
||||||
#include "WallpaperEngine/Input/CInputContext.h"
|
|
||||||
#include "WallpaperEngine/Input/CMouseInput.h"
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/COutput.h"
|
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/COutputViewport.h"
|
|
||||||
|
|
||||||
namespace WallpaperEngine {
|
|
||||||
namespace Application {
|
|
||||||
class CWallpaperApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Render {
|
|
||||||
namespace Drivers {
|
|
||||||
class CVideoDriver;
|
|
||||||
|
|
||||||
namespace Output {
|
|
||||||
class COutput;
|
|
||||||
class COutputViewport;
|
|
||||||
} // namespace Output
|
|
||||||
} // namespace Drivers
|
|
||||||
|
|
||||||
class CWallpaper;
|
|
||||||
class CTextureCache;
|
|
||||||
|
|
||||||
class CRenderContext {
|
|
||||||
public:
|
|
||||||
CRenderContext (Drivers::CVideoDriver& driver, CWallpaperApplication& app);
|
|
||||||
|
|
||||||
void render (Drivers::Output::COutputViewport* viewport);
|
|
||||||
void setWallpaper (const std::string& display, std::shared_ptr <CWallpaper> wallpaper);
|
|
||||||
void setPause (bool newState);
|
|
||||||
[[nodiscard]] Input::CInputContext& getInputContext () const;
|
|
||||||
[[nodiscard]] const CWallpaperApplication& getApp () const;
|
|
||||||
[[nodiscard]] const Drivers::CVideoDriver& getDriver () const;
|
|
||||||
[[nodiscard]] const Drivers::Output::COutput& getOutput () const;
|
|
||||||
std::shared_ptr<const ITexture> resolveTexture (const std::string& name);
|
|
||||||
[[nodiscard]] const std::map<std::string, std::shared_ptr <CWallpaper>>& getWallpapers () const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
/** Video driver in use */
|
|
||||||
Drivers::CVideoDriver& m_driver;
|
|
||||||
/** Maps screen -> wallpaper list */
|
|
||||||
std::map<std::string, std::shared_ptr <CWallpaper>> m_wallpapers = {};
|
|
||||||
/** App that holds the render context */
|
|
||||||
CWallpaperApplication& m_app;
|
|
||||||
/** Texture cache for the render */
|
|
||||||
CTextureCache* m_textureCache = nullptr;
|
|
||||||
};
|
|
||||||
} // namespace Render
|
|
||||||
} // namespace WallpaperEngine
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "CTexture.h"
|
#include "CTexture.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <lz4.h>
|
#include <lz4.h>
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include <stb_image.h>
|
#include <stb_image.h>
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CTexture::CTexture (TextureUniquePtr header) : m_header (std::move(header)) {
|
CTexture::CTexture (TextureUniquePtr header) : m_header (std::move(header)) {
|
||||||
// ensure the header is parsed
|
// ensure the header is parsed
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ITexture.h"
|
#include "TextureProvider.h"
|
||||||
#include "WallpaperEngine/Data/Assets/Texture.h"
|
#include "WallpaperEngine/Data/Assets/Texture.h"
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
@ -8,13 +8,13 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace WallpaperEngine::Assets {
|
namespace WallpaperEngine::Render {
|
||||||
using namespace WallpaperEngine::Data::Assets;
|
using namespace WallpaperEngine::Data::Assets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A normal texture file in WallpaperEngine's format
|
* A normal texture file in WallpaperEngine's format
|
||||||
*/
|
*/
|
||||||
class CTexture final : public ITexture {
|
class CTexture final : public TextureProvider {
|
||||||
public:
|
public:
|
||||||
explicit CTexture (TextureUniquePtr header);
|
explicit CTexture (TextureUniquePtr header);
|
||||||
|
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "ITexture.h"
|
|
||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
|
||||||
#include "WallpaperEngine/Render/Helpers/CContextAware.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Render {
|
|
||||||
namespace Helpers {
|
|
||||||
class CContextAware;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CRenderContext;
|
|
||||||
|
|
||||||
class CTextureCache final : Helpers::CContextAware {
|
|
||||||
public:
|
|
||||||
explicit CTextureCache (CRenderContext& context);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given texture was already loaded and returns it
|
|
||||||
* If the texture was not loaded yet, it tries to load it from the container
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
std::shared_ptr<const ITexture> resolve (const std::string& filename);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a texture in the cache
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param texture
|
|
||||||
*/
|
|
||||||
void store (const std::string& name, std::shared_ptr<const ITexture> texture);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/** Cached textures */
|
|
||||||
std::map<std::string, std::shared_ptr<const ITexture>> m_textureCache = {};
|
|
||||||
};
|
|
||||||
} // namespace WallpaperEngine::Render
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "CWallpaper.h"
|
#include "CWallpaper.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Render/Wallpapers/CScene.h"
|
#include "WallpaperEngine/Render/Wallpapers/CScene.h"
|
||||||
#include "WallpaperEngine/Render/Wallpapers/CVideo.h"
|
#include "WallpaperEngine/Render/Wallpapers/CVideo.h"
|
||||||
#include "WallpaperEngine/Render/Wallpapers/CWeb.h"
|
#include "WallpaperEngine/Render/Wallpapers/CWeb.h"
|
||||||
@ -13,12 +13,12 @@
|
|||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CWallpaper::CWallpaper (
|
CWallpaper::CWallpaper (
|
||||||
const Wallpaper& wallpaperData, CRenderContext& context,CAudioContext& audioContext,
|
const Wallpaper& wallpaperData, RenderContext& context,AudioContext& audioContext,
|
||||||
const CWallpaperState::TextureUVsScaling& scalingMode,
|
const WallpaperState::TextureUVsScaling& scalingMode,
|
||||||
const uint32_t& clampMode
|
const uint32_t& clampMode
|
||||||
) :
|
) :
|
||||||
CContextAware (context),
|
ContextAware (context),
|
||||||
CFBOProvider (nullptr),
|
FBOProvider (nullptr),
|
||||||
m_wallpaperData (wallpaperData),
|
m_wallpaperData (wallpaperData),
|
||||||
m_audioContext (audioContext),
|
m_audioContext (audioContext),
|
||||||
m_state (scalingMode, clampMode) {
|
m_state (scalingMode, clampMode) {
|
||||||
@ -255,7 +255,7 @@ void CWallpaper::setupFramebuffers () {
|
|||||||
this->alias ("_rt_MipMappedFrameBuffer", "_rt_FullFrameBuffer");
|
this->alias ("_rt_MipMappedFrameBuffer", "_rt_FullFrameBuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioContext& CWallpaper::getAudioContext () {
|
AudioContext& CWallpaper::getAudioContext () {
|
||||||
return this->m_audioContext;
|
return this->m_audioContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,8 +273,8 @@ std::shared_ptr<const CFBO> CWallpaper::getFBO () const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CWallpaper> CWallpaper::fromWallpaper (
|
std::unique_ptr<CWallpaper> CWallpaper::fromWallpaper (
|
||||||
const Wallpaper& wallpaper, CRenderContext& context, CAudioContext& audioContext,
|
const Wallpaper& wallpaper, RenderContext& context, AudioContext& audioContext,
|
||||||
WebBrowser::CWebBrowserContext* browserContext, const CWallpaperState::TextureUVsScaling& scalingMode,
|
WebBrowser::WebBrowserContext* browserContext, const WallpaperState::TextureUVsScaling& scalingMode,
|
||||||
const uint32_t& clampMode
|
const uint32_t& clampMode
|
||||||
) {
|
) {
|
||||||
if (wallpaper.is<Scene> ()) {
|
if (wallpaper.is<Scene> ()) {
|
||||||
|
@ -3,32 +3,32 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include "WallpaperEngine/Audio/CAudioContext.h"
|
#include "WallpaperEngine/Audio/AudioContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/CFBO.h"
|
#include "WallpaperEngine/Render/CFBO.h"
|
||||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
#include "WallpaperEngine/Render/Helpers/ContextAware.h"
|
||||||
#include "WallpaperEngine/Render/Helpers/CContextAware.h"
|
#include "WallpaperEngine/Render/RenderContext.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
||||||
|
|
||||||
#include "CFBOProvider.h"
|
#include "FBOProvider.h"
|
||||||
#include "CWallpaperState.h"
|
#include "WallpaperState.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::WebBrowser {
|
namespace WallpaperEngine::WebBrowser {
|
||||||
class CWebBrowserContext;
|
class WebBrowserContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Render {
|
namespace WallpaperEngine::Render {
|
||||||
namespace Helpers {
|
namespace Helpers {
|
||||||
class CContextAware;
|
class ContextAware;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Render;
|
||||||
using namespace WallpaperEngine::Audio;
|
using namespace WallpaperEngine::Audio;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
|
|
||||||
class CWallpaper : public Helpers::CContextAware, public CFBOProvider {
|
class CWallpaper : public Helpers::ContextAware, public FBOProvider {
|
||||||
public:
|
public:
|
||||||
template <class T> [[nodiscard]] const T* as () const {
|
template <class T> [[nodiscard]] const T* as () const {
|
||||||
if (is <T> ()) {
|
if (is <T> ()) {
|
||||||
@ -70,7 +70,7 @@ class CWallpaper : public Helpers::CContextAware, public CFBOProvider {
|
|||||||
/**
|
/**
|
||||||
* @return The current audio context for this wallpaper
|
* @return The current audio context for this wallpaper
|
||||||
*/
|
*/
|
||||||
CAudioContext& getAudioContext ();
|
AudioContext& getAudioContext ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The scene's framebuffer
|
* @return The scene's framebuffer
|
||||||
@ -126,14 +126,14 @@ class CWallpaper : public Helpers::CContextAware, public CFBOProvider {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static std::unique_ptr<CWallpaper> fromWallpaper (
|
static std::unique_ptr<CWallpaper> fromWallpaper (
|
||||||
const Wallpaper& wallpaper, CRenderContext& context, CAudioContext& audioContext,
|
const Wallpaper& wallpaper, RenderContext& context, AudioContext& audioContext,
|
||||||
WebBrowser::CWebBrowserContext* browserContext, const CWallpaperState::TextureUVsScaling& scalingMode,
|
WebBrowser::WebBrowserContext* browserContext, const WallpaperState::TextureUVsScaling& scalingMode,
|
||||||
const uint32_t& clampMode);
|
const uint32_t& clampMode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CWallpaper (
|
CWallpaper (
|
||||||
const Wallpaper& wallpaperData, CRenderContext& context,
|
const Wallpaper& wallpaperData, RenderContext& context,
|
||||||
CAudioContext& audioContext, const CWallpaperState::TextureUVsScaling& scalingMode,
|
AudioContext& audioContext, const WallpaperState::TextureUVsScaling& scalingMode,
|
||||||
const uint32_t& clampMode);
|
const uint32_t& clampMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,8 +170,8 @@ class CWallpaper : public Helpers::CContextAware, public CFBOProvider {
|
|||||||
/** List of FBOs registered for this wallpaper */
|
/** List of FBOs registered for this wallpaper */
|
||||||
std::map<std::string, std::shared_ptr<const CFBO>> m_fbos = {};
|
std::map<std::string, std::shared_ptr<const CFBO>> m_fbos = {};
|
||||||
/** Audio context that is using this wallpaper */
|
/** Audio context that is using this wallpaper */
|
||||||
CAudioContext& m_audioContext;
|
AudioContext& m_audioContext;
|
||||||
/** Current Wallpaper state */
|
/** Current Wallpaper state */
|
||||||
CWallpaperState m_state;
|
WallpaperState m_state;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Render
|
} // namespace WallpaperEngine::Render
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
#include "CCamera.h"
|
#include "Camera.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine;
|
using namespace WallpaperEngine;
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CCamera::CCamera (Wallpapers::CScene& scene, const SceneData::Camera& camera) :
|
Camera::Camera (Wallpapers::CScene& scene, const SceneData::Camera& camera) :
|
||||||
m_width (0),
|
m_width (0),
|
||||||
m_height (0),
|
m_height (0),
|
||||||
m_camera (camera),
|
m_camera (camera),
|
||||||
@ -16,45 +16,45 @@ CCamera::CCamera (Wallpapers::CScene& scene, const SceneData::Camera& camera) :
|
|||||||
this->m_lookat = glm::lookAt (this->getEye (), this->getCenter (), this->getUp ());
|
this->m_lookat = glm::lookAt (this->getEye (), this->getCenter (), this->getUp ());
|
||||||
}
|
}
|
||||||
|
|
||||||
CCamera::~CCamera () = default;
|
Camera::~Camera () = default;
|
||||||
|
|
||||||
const glm::vec3& CCamera::getCenter () const {
|
const glm::vec3& Camera::getCenter () const {
|
||||||
return this->m_camera.configuration.center;
|
return this->m_camera.configuration.center;
|
||||||
}
|
}
|
||||||
|
|
||||||
const glm::vec3& CCamera::getEye () const {
|
const glm::vec3& Camera::getEye () const {
|
||||||
return this->m_camera.configuration.eye;
|
return this->m_camera.configuration.eye;
|
||||||
}
|
}
|
||||||
|
|
||||||
const glm::vec3& CCamera::getUp () const {
|
const glm::vec3& Camera::getUp () const {
|
||||||
return this->m_camera.configuration.up;
|
return this->m_camera.configuration.up;
|
||||||
}
|
}
|
||||||
|
|
||||||
const glm::mat4& CCamera::getProjection () const {
|
const glm::mat4& Camera::getProjection () const {
|
||||||
return this->m_projection;
|
return this->m_projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const glm::mat4& CCamera::getLookAt () const {
|
const glm::mat4& Camera::getLookAt () const {
|
||||||
return this->m_lookat;
|
return this->m_lookat;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCamera::isOrthogonal () const {
|
bool Camera::isOrthogonal () const {
|
||||||
return this->m_isOrthogonal;
|
return this->m_isOrthogonal;
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallpapers::CScene& CCamera::getScene () const {
|
Wallpapers::CScene& Camera::getScene () const {
|
||||||
return this->m_scene;
|
return this->m_scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCamera::getWidth () const {
|
float Camera::getWidth () const {
|
||||||
return this->m_width;
|
return this->m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCamera::getHeight () const {
|
float Camera::getHeight () const {
|
||||||
return this->m_height;
|
return this->m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCamera::setOrthogonalProjection (float width, float height) {
|
void Camera::setOrthogonalProjection (float width, float height) {
|
||||||
this->m_width = width;
|
this->m_width = width;
|
||||||
this->m_height = height;
|
this->m_height = height;
|
||||||
|
|
@ -14,10 +14,10 @@ class CScene;
|
|||||||
namespace WallpaperEngine::Render {
|
namespace WallpaperEngine::Render {
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
class CCamera {
|
class Camera {
|
||||||
public:
|
public:
|
||||||
CCamera (Wallpapers::CScene& scene, const SceneData::Camera& camera);
|
Camera (Wallpapers::CScene& scene, const SceneData::Camera& camera);
|
||||||
~CCamera ();
|
~Camera ();
|
||||||
|
|
||||||
void setOrthogonalProjection (float width, float height);
|
void setOrthogonalProjection (float width, float height);
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
#include "CVideoDriver.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Input;
|
|
||||||
using namespace WallpaperEngine::Render::Drivers;
|
|
||||||
|
|
||||||
CVideoDriver::CVideoDriver (CWallpaperApplication& app, CMouseInput& mouseInput) :
|
|
||||||
m_app (app),
|
|
||||||
m_inputContext (mouseInput) {}
|
|
||||||
|
|
||||||
CWallpaperApplication& CVideoDriver::getApp () const {
|
|
||||||
return this->m_app;
|
|
||||||
}
|
|
||||||
|
|
||||||
CInputContext& CVideoDriver::getInputContext () {
|
|
||||||
return this->m_inputContext;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#include "CFullScreenDetector.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine;
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Detectors;
|
|
||||||
|
|
||||||
CFullScreenDetector::CFullScreenDetector (Application::CApplicationContext& appContext) :
|
|
||||||
m_applicationContext (appContext) {}
|
|
||||||
|
|
||||||
Application::CApplicationContext& CFullScreenDetector::getApplicationContext () const {
|
|
||||||
return this->m_applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CFullScreenDetector::anythingFullscreen () const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFullScreenDetector::reset () {}
|
|
@ -0,0 +1,17 @@
|
|||||||
|
#include "FullScreenDetector.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine;
|
||||||
|
using namespace WallpaperEngine::Render::Drivers::Detectors;
|
||||||
|
|
||||||
|
FullScreenDetector::FullScreenDetector (Application::ApplicationContext& appContext) :
|
||||||
|
m_applicationContext (appContext) {}
|
||||||
|
|
||||||
|
Application::ApplicationContext& FullScreenDetector::getApplicationContext () const {
|
||||||
|
return this->m_applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FullScreenDetector::anythingFullscreen () const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FullScreenDetector::reset () {}
|
@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Detectors {
|
namespace WallpaperEngine::Render::Drivers::Detectors {
|
||||||
class CFullScreenDetector {
|
class FullScreenDetector {
|
||||||
public:
|
public:
|
||||||
explicit CFullScreenDetector (Application::CApplicationContext& appContext);
|
explicit FullScreenDetector (Application::ApplicationContext& appContext);
|
||||||
virtual ~CFullScreenDetector () = default;
|
virtual ~FullScreenDetector () = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If anything is fullscreen
|
* @return If anything is fullscreen
|
||||||
@ -19,9 +19,9 @@ class CFullScreenDetector {
|
|||||||
/**
|
/**
|
||||||
* @return The application context using this detector
|
* @return The application context using this detector
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Application::CApplicationContext& getApplicationContext () const;
|
[[nodiscard]] Application::ApplicationContext& getApplicationContext () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Application::CApplicationContext& m_applicationContext;
|
Application::ApplicationContext& m_applicationContext;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Render::Drivers::Detectors
|
} // namespace WallpaperEngine::Render::Drivers::Detectors
|
@ -1,7 +1,7 @@
|
|||||||
#include "CWaylandFullScreenDetector.h"
|
#include "WaylandFullScreenDetector.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoFactories.h"
|
#include "WallpaperEngine/Render/Drivers/VideoFactories.h"
|
||||||
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
|
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ zwlr_foreign_toplevel_manager_v1_listener toplevelManagerListener = {
|
|||||||
}; // anonymous namespace
|
}; // anonymous namespace
|
||||||
|
|
||||||
void handleGlobal (void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
|
void handleGlobal (void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
|
||||||
const auto detector = static_cast<CWaylandFullScreenDetector*> (data);
|
const auto detector = static_cast<WaylandFullScreenDetector*> (data);
|
||||||
if (strcmp (interface, zwlr_foreign_toplevel_manager_v1_interface.name) == 0) {
|
if (strcmp (interface, zwlr_foreign_toplevel_manager_v1_interface.name) == 0) {
|
||||||
detector->m_toplevelManager = static_cast<zwlr_foreign_toplevel_manager_v1*> (
|
detector->m_toplevelManager = static_cast<zwlr_foreign_toplevel_manager_v1*> (
|
||||||
wl_registry_bind (registry, name, &zwlr_foreign_toplevel_manager_v1_interface, 3));
|
wl_registry_bind (registry, name, &zwlr_foreign_toplevel_manager_v1_interface, 3));
|
||||||
@ -117,8 +117,8 @@ constexpr struct wl_registry_listener registryListener = {
|
|||||||
.global_remove = handleGlobalRemoved,
|
.global_remove = handleGlobalRemoved,
|
||||||
};
|
};
|
||||||
|
|
||||||
CWaylandFullScreenDetector::CWaylandFullScreenDetector (Application::CApplicationContext& appContext) :
|
WaylandFullScreenDetector::WaylandFullScreenDetector (Application::ApplicationContext& appContext) :
|
||||||
CFullScreenDetector (appContext) {
|
FullScreenDetector (appContext) {
|
||||||
m_display = wl_display_connect (nullptr);
|
m_display = wl_display_connect (nullptr);
|
||||||
if (!m_display)
|
if (!m_display)
|
||||||
sLog.exception ("Failed to query wayland display");
|
sLog.exception ("Failed to query wayland display");
|
||||||
@ -133,12 +133,12 @@ CWaylandFullScreenDetector::CWaylandFullScreenDetector (Application::CApplicatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandFullScreenDetector::~CWaylandFullScreenDetector () {
|
WaylandFullScreenDetector::~WaylandFullScreenDetector () {
|
||||||
if (m_display)
|
if (m_display)
|
||||||
wl_display_disconnect (m_display);
|
wl_display_disconnect (m_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWaylandFullScreenDetector::anythingFullscreen () const {
|
bool WaylandFullScreenDetector::anythingFullscreen () const {
|
||||||
if (!m_toplevelManager) {
|
if (!m_toplevelManager) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -146,14 +146,14 @@ bool CWaylandFullScreenDetector::anythingFullscreen () const {
|
|||||||
return m_fullscreenCount > 0;
|
return m_fullscreenCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandFullScreenDetector::reset () {}
|
void WaylandFullScreenDetector::reset () {}
|
||||||
|
|
||||||
|
|
||||||
__attribute__((constructor)) void registerWaylandFullscreenDetector () {
|
__attribute__((constructor)) void registerWaylandFullscreenDetector () {
|
||||||
sVideoFactories.registerFullscreenDetector(
|
sVideoFactories.registerFullscreenDetector(
|
||||||
"wayland",
|
"wayland",
|
||||||
[](CApplicationContext& context, CVideoDriver& driver) -> std::unique_ptr<CFullScreenDetector> {
|
[](ApplicationContext& context, VideoDriver& driver) -> std::unique_ptr<FullScreenDetector> {
|
||||||
return std::make_unique <CWaylandFullScreenDetector> (context);
|
return std::make_unique <WaylandFullScreenDetector> (context);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
#include <glm/vec4.hpp>
|
#include <glm/vec4.hpp>
|
||||||
|
|
||||||
#include "CFullScreenDetector.h"
|
#include "FullScreenDetector.h"
|
||||||
|
|
||||||
struct wl_display;
|
struct wl_display;
|
||||||
struct wl_registry;
|
struct wl_registry;
|
||||||
struct zwlr_foreign_toplevel_manager_v1;
|
struct zwlr_foreign_toplevel_manager_v1;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Detectors {
|
namespace WallpaperEngine::Render::Drivers::Detectors {
|
||||||
class CWaylandFullScreenDetector final : public CFullScreenDetector {
|
class WaylandFullScreenDetector final : public FullScreenDetector {
|
||||||
public:
|
public:
|
||||||
explicit CWaylandFullScreenDetector (Application::CApplicationContext& appContext);
|
explicit WaylandFullScreenDetector (Application::ApplicationContext& appContext);
|
||||||
~CWaylandFullScreenDetector () override;
|
~WaylandFullScreenDetector () override;
|
||||||
|
|
||||||
[[nodiscard]] bool anythingFullscreen () const override;
|
[[nodiscard]] bool anythingFullscreen () const override;
|
||||||
void reset () override;
|
void reset () override;
|
@ -1,15 +1,15 @@
|
|||||||
#include "CX11FullScreenDetector.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "X11FullScreenDetector.h"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h"
|
#include "WallpaperEngine/Render/Drivers/VideoFactories.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoFactories.h"
|
#include "WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Detectors {
|
namespace WallpaperEngine::Render::Drivers::Detectors {
|
||||||
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
||||||
const auto context = static_cast<CX11FullScreenDetector*> (userdata);
|
const auto context = static_cast<X11FullScreenDetector*> (userdata);
|
||||||
|
|
||||||
sLog.debugerror ("Critical XServer error detected. Attempting to recover...");
|
sLog.debugerror ("Critical XServer error detected. Attempting to recover...");
|
||||||
|
|
||||||
@ -29,17 +29,17 @@ int CustomXIOErrorHandler (Display* dsp) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11FullScreenDetector::CX11FullScreenDetector (
|
X11FullScreenDetector::X11FullScreenDetector (
|
||||||
Application::CApplicationContext& appContext, CVideoDriver& driver
|
Application::ApplicationContext& appContext, VideoDriver& driver
|
||||||
) :
|
) :
|
||||||
CFullScreenDetector (appContext),
|
FullScreenDetector (appContext),
|
||||||
m_display (nullptr),
|
m_display (nullptr),
|
||||||
m_root (0),
|
m_root (0),
|
||||||
m_driver (driver) {
|
m_driver (driver) {
|
||||||
try {
|
try {
|
||||||
// attempt casting to CGLFWOpenGLDriver, this will throw if it's not possible
|
// attempt casting to CGLFWOpenGLDriver, this will throw if it's not possible
|
||||||
// so we can gracely handle the error
|
// so we can gracely handle the error
|
||||||
dynamic_cast <CGLFWOpenGLDriver&> (this->m_driver);
|
dynamic_cast <GLFWOpenGLDriver&> (this->m_driver);
|
||||||
} catch (std::exception&) {
|
} catch (std::exception&) {
|
||||||
sLog.exception ("X11 FullScreen Detector initialized with the wrong video driver... This is a bug...");
|
sLog.exception ("X11 FullScreen Detector initialized with the wrong video driver... This is a bug...");
|
||||||
}
|
}
|
||||||
@ -54,11 +54,11 @@ CX11FullScreenDetector::CX11FullScreenDetector (
|
|||||||
this->initialize ();
|
this->initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11FullScreenDetector::~CX11FullScreenDetector () {
|
X11FullScreenDetector::~X11FullScreenDetector () {
|
||||||
this->stop ();
|
this->stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CX11FullScreenDetector::anythingFullscreen () const {
|
bool X11FullScreenDetector::anythingFullscreen () const {
|
||||||
// stop rendering if anything is fullscreen
|
// stop rendering if anything is fullscreen
|
||||||
bool isFullscreen = false;
|
bool isFullscreen = false;
|
||||||
XWindowAttributes attribs;
|
XWindowAttributes attribs;
|
||||||
@ -69,7 +69,7 @@ bool CX11FullScreenDetector::anythingFullscreen () const {
|
|||||||
if (!XQueryTree (this->m_display, this->m_root, &_, &_, &children, &nchildren))
|
if (!XQueryTree (this->m_display, this->m_root, &_, &_, &children, &nchildren))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto ourWindow = reinterpret_cast<Window> (dynamic_cast <CGLFWOpenGLDriver&> (this->m_driver).getWindow ());
|
const auto ourWindow = reinterpret_cast<Window> (dynamic_cast <GLFWOpenGLDriver&> (this->m_driver).getWindow ());
|
||||||
Window parentWindow;
|
Window parentWindow;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -109,12 +109,12 @@ bool CX11FullScreenDetector::anythingFullscreen () const {
|
|||||||
return isFullscreen;
|
return isFullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11FullScreenDetector::reset () {
|
void X11FullScreenDetector::reset () {
|
||||||
this->stop ();
|
this->stop ();
|
||||||
this->initialize ();
|
this->initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11FullScreenDetector::initialize () {
|
void X11FullScreenDetector::initialize () {
|
||||||
this->m_display = XOpenDisplay (nullptr);
|
this->m_display = XOpenDisplay (nullptr);
|
||||||
|
|
||||||
// set the error handling to try and recover from X disconnections
|
// set the error handling to try and recover from X disconnections
|
||||||
@ -159,7 +159,7 @@ void CX11FullScreenDetector::initialize () {
|
|||||||
XRRFreeScreenResources (screenResources);
|
XRRFreeScreenResources (screenResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11FullScreenDetector::stop () {
|
void X11FullScreenDetector::stop () {
|
||||||
if (this->m_display == nullptr)
|
if (this->m_display == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -170,8 +170,8 @@ void CX11FullScreenDetector::stop () {
|
|||||||
__attribute__((constructor)) void registerX11FullscreenDetector () {
|
__attribute__((constructor)) void registerX11FullscreenDetector () {
|
||||||
sVideoFactories.registerFullscreenDetector(
|
sVideoFactories.registerFullscreenDetector(
|
||||||
"x11",
|
"x11",
|
||||||
[](CApplicationContext& context, CVideoDriver& driver) -> std::unique_ptr<CFullScreenDetector> {
|
[](ApplicationContext& context, VideoDriver& driver) -> std::unique_ptr<FullScreenDetector> {
|
||||||
return std::make_unique <CX11FullScreenDetector> (context, driver);
|
return std::make_unique <X11FullScreenDetector> (context, driver);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -4,18 +4,18 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "CFullScreenDetector.h"
|
#include "FullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CGLFWOpenGLDriver;
|
class GLFWOpenGLDriver;
|
||||||
|
|
||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CX11FullScreenDetector final : public CFullScreenDetector {
|
class X11FullScreenDetector final : public FullScreenDetector {
|
||||||
public:
|
public:
|
||||||
CX11FullScreenDetector (Application::CApplicationContext& appContext, CVideoDriver& driver);
|
X11FullScreenDetector (Application::ApplicationContext& appContext, VideoDriver& driver);
|
||||||
~CX11FullScreenDetector () override;
|
~X11FullScreenDetector () override;
|
||||||
|
|
||||||
[[nodiscard]] bool anythingFullscreen () const override;
|
[[nodiscard]] bool anythingFullscreen () const override;
|
||||||
void reset () override;
|
void reset () override;
|
||||||
@ -27,7 +27,7 @@ class CX11FullScreenDetector final : public CFullScreenDetector {
|
|||||||
Display* m_display = nullptr;
|
Display* m_display = nullptr;
|
||||||
Window m_root;
|
Window m_root;
|
||||||
std::map<std::string, glm::ivec4> m_screens = {};
|
std::map<std::string, glm::ivec4> m_screens = {};
|
||||||
CVideoDriver& m_driver;
|
VideoDriver& m_driver;
|
||||||
};
|
};
|
||||||
} // namespace Detectors
|
} // namespace Detectors
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
@ -1,9 +1,9 @@
|
|||||||
#include "CGLFWOpenGLDriver.h"
|
#include "GLFWOpenGLDriver.h"
|
||||||
#include "CVideoFactories.h"
|
#include "VideoFactories.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h"
|
||||||
#ifdef ENABLE_X11
|
#ifdef ENABLE_X11
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
#include "WallpaperEngine/Render/Drivers/Output/X11Output.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GLFW_EXPOSE_NATIVE_X11
|
#define GLFW_EXPOSE_NATIVE_X11
|
||||||
@ -17,10 +17,10 @@ void CustomGLFWErrorHandler (int errorCode, const char* reason) {
|
|||||||
sLog.error ("GLFW error ", errorCode, ": ", reason);
|
sLog.error ("GLFW error ", errorCode, ": ", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLFWOpenGLDriver::CGLFWOpenGLDriver (
|
GLFWOpenGLDriver::GLFWOpenGLDriver (
|
||||||
const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app
|
const char* windowTitle, ApplicationContext& context, WallpaperApplication& app
|
||||||
) :
|
) :
|
||||||
CVideoDriver (app, m_mouseInput),
|
VideoDriver (app, m_mouseInput),
|
||||||
m_context (context),
|
m_context (context),
|
||||||
m_mouseInput (*this) {
|
m_mouseInput (*this) {
|
||||||
glfwSetErrorCallback (CustomGLFWErrorHandler);
|
glfwSetErrorCallback (CustomGLFWErrorHandler);
|
||||||
@ -40,7 +40,7 @@ CGLFWOpenGLDriver::CGLFWOpenGLDriver (
|
|||||||
glfwWindowHintString (GLFW_X11_INSTANCE_NAME, "linux-wallpaperengine");
|
glfwWindowHintString (GLFW_X11_INSTANCE_NAME, "linux-wallpaperengine");
|
||||||
|
|
||||||
// for forced window mode, we can set some hints that'll help position the window
|
// for forced window mode, we can set some hints that'll help position the window
|
||||||
if (context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW) {
|
if (context.settings.render.mode == Application::ApplicationContext::EXPLICIT_WINDOW) {
|
||||||
glfwWindowHint (GLFW_RESIZABLE, GLFW_FALSE);
|
glfwWindowHint (GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
glfwWindowHint (GLFW_DECORATED, GLFW_FALSE);
|
glfwWindowHint (GLFW_DECORATED, GLFW_FALSE);
|
||||||
glfwWindowHint (GLFW_FLOATING, GLFW_TRUE);
|
glfwWindowHint (GLFW_FLOATING, GLFW_TRUE);
|
||||||
@ -66,13 +66,13 @@ CGLFWOpenGLDriver::CGLFWOpenGLDriver (
|
|||||||
sLog.error ("Failed to initialize GLEW: ", glewGetErrorString (result));
|
sLog.error ("Failed to initialize GLEW: ", glewGetErrorString (result));
|
||||||
|
|
||||||
// setup output
|
// setup output
|
||||||
if (context.settings.render.mode == CApplicationContext::EXPLICIT_WINDOW ||
|
if (context.settings.render.mode == ApplicationContext::EXPLICIT_WINDOW ||
|
||||||
context.settings.render.mode == CApplicationContext::NORMAL_WINDOW) {
|
context.settings.render.mode == ApplicationContext::NORMAL_WINDOW) {
|
||||||
m_output = new WallpaperEngine::Render::Drivers::Output::CGLFWWindowOutput (context, *this);
|
m_output = new WallpaperEngine::Render::Drivers::Output::GLFWWindowOutput (context, *this);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_X11
|
#ifdef ENABLE_X11
|
||||||
else {
|
else {
|
||||||
m_output = new WallpaperEngine::Render::Drivers::Output::CX11Output (context, *this);
|
m_output = new WallpaperEngine::Render::Drivers::Output::X11Output (context, *this);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
else {
|
else {
|
||||||
@ -81,40 +81,40 @@ CGLFWOpenGLDriver::CGLFWOpenGLDriver (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLFWOpenGLDriver::~CGLFWOpenGLDriver () {
|
GLFWOpenGLDriver::~GLFWOpenGLDriver () {
|
||||||
glfwTerminate ();
|
glfwTerminate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Output::COutput& CGLFWOpenGLDriver::getOutput () {
|
Output::Output& GLFWOpenGLDriver::getOutput () {
|
||||||
return *this->m_output;
|
return *this->m_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CGLFWOpenGLDriver::getRenderTime () const {
|
float GLFWOpenGLDriver::getRenderTime () const {
|
||||||
return static_cast<float> (glfwGetTime ());
|
return static_cast<float> (glfwGetTime ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGLFWOpenGLDriver::closeRequested () {
|
bool GLFWOpenGLDriver::closeRequested () {
|
||||||
return glfwWindowShouldClose (this->m_window);
|
return glfwWindowShouldClose (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWOpenGLDriver::resizeWindow (glm::ivec2 size) {
|
void GLFWOpenGLDriver::resizeWindow (glm::ivec2 size) {
|
||||||
glfwSetWindowSize (this->m_window, size.x, size.y);
|
glfwSetWindowSize (this->m_window, size.x, size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWOpenGLDriver::resizeWindow (glm::ivec4 sizeandpos) {
|
void GLFWOpenGLDriver::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 CGLFWOpenGLDriver::showWindow () {
|
void GLFWOpenGLDriver::showWindow () {
|
||||||
glfwShowWindow (this->m_window);
|
glfwShowWindow (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWOpenGLDriver::hideWindow () {
|
void GLFWOpenGLDriver::hideWindow () {
|
||||||
glfwHideWindow (this->m_window);
|
glfwHideWindow (this->m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::ivec2 CGLFWOpenGLDriver::getFramebufferSize () const {
|
glm::ivec2 GLFWOpenGLDriver::getFramebufferSize () const {
|
||||||
glm::ivec2 size;
|
glm::ivec2 size;
|
||||||
|
|
||||||
glfwGetFramebufferSize (this->m_window, &size.x, &size.y);
|
glfwGetFramebufferSize (this->m_window, &size.x, &size.y);
|
||||||
@ -122,11 +122,11 @@ glm::ivec2 CGLFWOpenGLDriver::getFramebufferSize () const {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CGLFWOpenGLDriver::getFrameCounter () const {
|
uint32_t GLFWOpenGLDriver::getFrameCounter () const {
|
||||||
return this->m_frameCounter;
|
return this->m_frameCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWOpenGLDriver::dispatchEventQueue () {
|
void GLFWOpenGLDriver::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 ();
|
||||||
@ -172,35 +172,35 @@ void CGLFWOpenGLDriver::dispatchEventQueue () {
|
|||||||
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CGLFWOpenGLDriver::getProcAddress (const char* name) const {
|
void* GLFWOpenGLDriver::getProcAddress (const char* name) const {
|
||||||
return reinterpret_cast<void*> (glfwGetProcAddress (name));
|
return reinterpret_cast<void*> (glfwGetProcAddress (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWwindow* CGLFWOpenGLDriver::getWindow () const {
|
GLFWwindow* GLFWOpenGLDriver::getWindow () const {
|
||||||
return this->m_window;
|
return this->m_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__attribute__((constructor)) void registerGLFWOpenGLDriver () {
|
__attribute__((constructor)) void registerGLFWOpenGLDriver () {
|
||||||
sVideoFactories.registerDriver (
|
sVideoFactories.registerDriver (
|
||||||
CApplicationContext::DESKTOP_BACKGROUND,
|
ApplicationContext::DESKTOP_BACKGROUND,
|
||||||
"x11",
|
"x11",
|
||||||
[](CApplicationContext& context, CWallpaperApplication& application) -> std::unique_ptr<CVideoDriver> {
|
[](ApplicationContext& context, WallpaperApplication& application) -> std::unique_ptr<VideoDriver> {
|
||||||
return std::make_unique <CGLFWOpenGLDriver> ("wallpaperengine", context, application);
|
return std::make_unique <GLFWOpenGLDriver> ("wallpaperengine", context, application);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
sVideoFactories.registerDriver (
|
sVideoFactories.registerDriver (
|
||||||
CApplicationContext::EXPLICIT_WINDOW,
|
ApplicationContext::EXPLICIT_WINDOW,
|
||||||
DEFAULT_WINDOW_NAME,
|
DEFAULT_WINDOW_NAME,
|
||||||
[](CApplicationContext& context, CWallpaperApplication& application) -> std::unique_ptr<CVideoDriver> {
|
[](ApplicationContext& context, WallpaperApplication& application) -> std::unique_ptr<VideoDriver> {
|
||||||
return std::make_unique <CGLFWOpenGLDriver> ("wallpaperengine", context, application);
|
return std::make_unique <GLFWOpenGLDriver> ("wallpaperengine", context, application);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
sVideoFactories.registerDriver (
|
sVideoFactories.registerDriver (
|
||||||
CApplicationContext::NORMAL_WINDOW,
|
ApplicationContext::NORMAL_WINDOW,
|
||||||
DEFAULT_WINDOW_NAME,
|
DEFAULT_WINDOW_NAME,
|
||||||
[](CApplicationContext& context, CWallpaperApplication& application) -> std::unique_ptr<CVideoDriver> {
|
[](ApplicationContext& context, WallpaperApplication& application) -> std::unique_ptr<VideoDriver> {
|
||||||
return std::make_unique <CGLFWOpenGLDriver> ("wallpaperengine", context, application);
|
return std::make_unique <GLFWOpenGLDriver> ("wallpaperengine", context, application);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -1,27 +1,27 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
#include "WallpaperEngine/Application/WallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Input/Drivers/CGLFWMouseInput.h"
|
#include "WallpaperEngine/Input/Drivers/GLFWMouseInput.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
class CWallpaperApplication;
|
class WallpaperApplication;
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
|
|
||||||
class CGLFWOpenGLDriver final : public CVideoDriver {
|
class GLFWOpenGLDriver final : public VideoDriver {
|
||||||
public:
|
public:
|
||||||
explicit CGLFWOpenGLDriver (const char* windowTitle, CApplicationContext& context, CWallpaperApplication& app);
|
explicit GLFWOpenGLDriver (const char* windowTitle, ApplicationContext& context, WallpaperApplication& app);
|
||||||
~CGLFWOpenGLDriver () override;
|
~GLFWOpenGLDriver () override;
|
||||||
|
|
||||||
[[nodiscard]] Output::COutput& getOutput () override;
|
[[nodiscard]] Output::Output& getOutput () override;
|
||||||
[[nodiscard]] float getRenderTime () const override;
|
[[nodiscard]] float getRenderTime () const override;
|
||||||
bool closeRequested () override;
|
bool closeRequested () override;
|
||||||
void resizeWindow (glm::ivec2 size) override;
|
void resizeWindow (glm::ivec2 size) override;
|
||||||
@ -36,9 +36,9 @@ class CGLFWOpenGLDriver final : public CVideoDriver {
|
|||||||
GLFWwindow* getWindow () const;
|
GLFWwindow* getWindow () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CApplicationContext& m_context;
|
ApplicationContext& m_context;
|
||||||
Input::Drivers::CGLFWMouseInput m_mouseInput;
|
Input::Drivers::GLFWMouseInput m_mouseInput;
|
||||||
Output::COutput* m_output = nullptr;
|
Output::Output* m_output = nullptr;
|
||||||
GLFWwindow* m_window = nullptr;
|
GLFWwindow* m_window = nullptr;
|
||||||
uint32_t m_frameCounter = 0;
|
uint32_t m_frameCounter = 0;
|
||||||
};
|
};
|
@ -1,12 +0,0 @@
|
|||||||
#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 () {}
|
|
@ -1,19 +0,0 @@
|
|||||||
#include "COutput.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
|
||||||
|
|
||||||
COutput::COutput (CApplicationContext& context, CVideoDriver& driver) :
|
|
||||||
m_context (context),
|
|
||||||
m_driver (driver) {}
|
|
||||||
|
|
||||||
const std::map<std::string, COutputViewport*>& COutput::getViewports () const {
|
|
||||||
return this->m_viewports;
|
|
||||||
}
|
|
||||||
|
|
||||||
int COutput::getFullWidth () const {
|
|
||||||
return this->m_fullWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
int COutput::getFullHeight () const {
|
|
||||||
return this->m_fullHeight;
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
#include "CWaylandOutput.h"
|
|
||||||
#include "../CWaylandOpenGLDriver.h"
|
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
|
||||||
|
|
||||||
CWaylandOutput::CWaylandOutput (CApplicationContext& context, CWaylandOpenGLDriver& driver) :
|
|
||||||
COutput (context, driver) {
|
|
||||||
updateViewports ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWaylandOutput::updateViewports () {
|
|
||||||
m_viewports.clear ();
|
|
||||||
const auto PDRIVER = dynamic_cast<CWaylandOpenGLDriver*> (&m_driver);
|
|
||||||
glm::ivec2 fullw = {0, 0};
|
|
||||||
for (const auto& o : PDRIVER->m_screens) {
|
|
||||||
if (!o->layerSurface)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
m_viewports [o->name] = o;
|
|
||||||
|
|
||||||
fullw = fullw + glm::ivec2 {o->size.x * o->scale, 0};
|
|
||||||
if (o->size.y > fullw.y)
|
|
||||||
fullw.y = o->size.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_fullWidth = fullw.x;
|
|
||||||
m_fullHeight = fullw.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWaylandOutput::reset () {
|
|
||||||
updateViewports ();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWaylandOutput::renderVFlip () const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWaylandOutput::renderMultiple () const {
|
|
||||||
return false; // todo
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWaylandOutput::haveImageBuffer () const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* CWaylandOutput::getImageBuffer () const {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CWaylandOutput::getImageBufferSize () const {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWaylandOutput::updateRender () const {}
|
|
@ -0,0 +1,12 @@
|
|||||||
|
#include "GLFWOutputViewport.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
|
GLFWOutputViewport::GLFWOutputViewport (glm::ivec4 viewport, std::string name) :
|
||||||
|
OutputViewport (viewport, std::move (name)) {}
|
||||||
|
|
||||||
|
void GLFWOutputViewport::makeCurrent () {}
|
||||||
|
|
||||||
|
void GLFWOutputViewport::swapOutput () {}
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "COutputViewport.h"
|
#include "OutputViewport.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Output {
|
namespace WallpaperEngine::Render::Drivers::Output {
|
||||||
class CGLFWOutputViewport final : public COutputViewport {
|
class GLFWOutputViewport final : public OutputViewport {
|
||||||
public:
|
public:
|
||||||
CGLFWOutputViewport (glm::ivec4 viewport, std::string name);
|
GLFWOutputViewport (glm::ivec4 viewport, std::string name);
|
||||||
|
|
||||||
void makeCurrent () override;
|
void makeCurrent () override;
|
||||||
void swapOutput () override;
|
void swapOutput () override;
|
@ -1,6 +1,6 @@
|
|||||||
#include "CGLFWWindowOutput.h"
|
#include "GLFWOutputViewport.h"
|
||||||
#include "CGLFWOutputViewport.h"
|
#include "GLFWWindowOutput.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
@ -8,15 +8,15 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver& driver) : COutput (context, driver) {
|
GLFWWindowOutput::GLFWWindowOutput (ApplicationContext& context, VideoDriver& driver) : Output (context, driver) {
|
||||||
if (this->m_context.settings.render.mode != Application::CApplicationContext::NORMAL_WINDOW &&
|
if (this->m_context.settings.render.mode != Application::ApplicationContext::NORMAL_WINDOW &&
|
||||||
this->m_context.settings.render.mode != Application::CApplicationContext::EXPLICIT_WINDOW)
|
this->m_context.settings.render.mode != Application::ApplicationContext::EXPLICIT_WINDOW)
|
||||||
sLog.exception ("Initializing window output when not in output mode, how did you get here?!");
|
sLog.exception ("Initializing window output when not in output mode, how did you get here?!");
|
||||||
|
|
||||||
// window should be visible
|
// window should be visible
|
||||||
driver.showWindow ();
|
driver.showWindow ();
|
||||||
|
|
||||||
if (this->m_context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW) {
|
if (this->m_context.settings.render.mode == Application::ApplicationContext::EXPLICIT_WINDOW) {
|
||||||
this->m_fullWidth = this->m_context.settings.render.window.geometry.z;
|
this->m_fullWidth = this->m_context.settings.render.window.geometry.z;
|
||||||
this->m_fullHeight = this->m_context.settings.render.window.geometry.w;
|
this->m_fullHeight = this->m_context.settings.render.window.geometry.w;
|
||||||
this->repositionWindow ();
|
this->repositionWindow ();
|
||||||
@ -27,41 +27,41 @@ CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register the default viewport
|
// register the default viewport
|
||||||
this->m_viewports ["default"] = new CGLFWOutputViewport {{0, 0, this->m_fullWidth, this->m_fullHeight}, "default"};
|
this->m_viewports ["default"] = new GLFWOutputViewport {{0, 0, this->m_fullWidth, this->m_fullHeight}, "default"};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWWindowOutput::repositionWindow () {
|
void GLFWWindowOutput::repositionWindow () {
|
||||||
// reposition the window
|
// reposition the window
|
||||||
this->m_driver.resizeWindow (this->m_context.settings.render.window.geometry);
|
this->m_driver.resizeWindow (this->m_context.settings.render.window.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWWindowOutput::reset () {
|
void GLFWWindowOutput::reset () {
|
||||||
if (this->m_context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW)
|
if (this->m_context.settings.render.mode == Application::ApplicationContext::EXPLICIT_WINDOW)
|
||||||
this->repositionWindow ();
|
this->repositionWindow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGLFWWindowOutput::renderVFlip () const {
|
bool GLFWWindowOutput::renderVFlip () const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGLFWWindowOutput::renderMultiple () const {
|
bool GLFWWindowOutput::renderMultiple () const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGLFWWindowOutput::haveImageBuffer () const {
|
bool GLFWWindowOutput::haveImageBuffer () const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CGLFWWindowOutput::getImageBuffer () const {
|
void* GLFWWindowOutput::getImageBuffer () const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CGLFWWindowOutput::getImageBufferSize () const {
|
uint32_t GLFWWindowOutput::getImageBufferSize () const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGLFWWindowOutput::updateRender () const {
|
void GLFWWindowOutput::updateRender () const {
|
||||||
if (this->m_context.settings.render.mode != Application::CApplicationContext::NORMAL_WINDOW)
|
if (this->m_context.settings.render.mode != Application::ApplicationContext::NORMAL_WINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// take the size from the driver (default window size)
|
// take the size from the driver (default window size)
|
@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "COutput.h"
|
#include "Output.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Output {
|
namespace WallpaperEngine::Render::Drivers::Output {
|
||||||
class CGLFWWindowOutput final : public COutput {
|
class GLFWWindowOutput final : public Output {
|
||||||
public:
|
public:
|
||||||
CGLFWWindowOutput (CApplicationContext& context, CVideoDriver& driver);
|
GLFWWindowOutput (ApplicationContext& context, VideoDriver& driver);
|
||||||
|
|
||||||
void reset () override;
|
void reset () override;
|
||||||
bool renderVFlip () const override;
|
bool renderVFlip () const override;
|
19
src/WallpaperEngine/Render/Drivers/Output/Output.cpp
Normal file
19
src/WallpaperEngine/Render/Drivers/Output/Output.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "Output.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
|
Output::Output (ApplicationContext& context, VideoDriver& driver) :
|
||||||
|
m_context (context),
|
||||||
|
m_driver (driver) {}
|
||||||
|
|
||||||
|
const std::map<std::string, OutputViewport*>& Output::getViewports () const {
|
||||||
|
return this->m_viewports;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Output::getFullWidth () const {
|
||||||
|
return this->m_fullWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Output::getFullHeight () const {
|
||||||
|
return this->m_fullHeight;
|
||||||
|
}
|
@ -4,29 +4,29 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CVideoDriver;
|
class VideoDriver;
|
||||||
|
|
||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CFullScreenDetector;
|
class FullScreenDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Output {
|
namespace Output {
|
||||||
class COutputViewport;
|
class OutputViewport;
|
||||||
|
|
||||||
class COutput {
|
class Output {
|
||||||
public:
|
public:
|
||||||
COutput (CApplicationContext& context, CVideoDriver& driver);
|
Output (ApplicationContext& context, VideoDriver& driver);
|
||||||
virtual ~COutput () = default;
|
virtual ~Output () = default;
|
||||||
|
|
||||||
virtual void reset () = 0;
|
virtual void reset () = 0;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class COutput {
|
|||||||
virtual bool renderVFlip () const = 0;
|
virtual bool renderVFlip () const = 0;
|
||||||
virtual bool renderMultiple () const = 0;
|
virtual bool renderMultiple () const = 0;
|
||||||
virtual bool haveImageBuffer () const = 0;
|
virtual bool haveImageBuffer () const = 0;
|
||||||
const std::map<std::string, COutputViewport*>& getViewports () const;
|
const std::map<std::string, OutputViewport*>& getViewports () const;
|
||||||
virtual void* getImageBuffer () const = 0;
|
virtual void* getImageBuffer () const = 0;
|
||||||
virtual uint32_t getImageBufferSize () const = 0;
|
virtual uint32_t getImageBufferSize () const = 0;
|
||||||
virtual void updateRender () const = 0;
|
virtual void updateRender () const = 0;
|
||||||
@ -44,9 +44,9 @@ class COutput {
|
|||||||
protected:
|
protected:
|
||||||
mutable int m_fullWidth = 0;
|
mutable int m_fullWidth = 0;
|
||||||
mutable int m_fullHeight = 0;
|
mutable int m_fullHeight = 0;
|
||||||
mutable std::map<std::string, COutputViewport*> m_viewports = {};
|
mutable std::map<std::string, OutputViewport*> m_viewports = {};
|
||||||
CApplicationContext& m_context;
|
ApplicationContext& m_context;
|
||||||
CVideoDriver& m_driver;
|
VideoDriver& m_driver;
|
||||||
};
|
};
|
||||||
} // namespace Output
|
} // namespace Output
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
@ -1,10 +1,10 @@
|
|||||||
#include "COutputViewport.h"
|
#include "OutputViewport.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
COutputViewport::COutputViewport (glm::ivec4 viewport, std::string name, bool single) :
|
OutputViewport::OutputViewport (glm::ivec4 viewport, std::string name, bool single) :
|
||||||
viewport (viewport),
|
viewport (viewport),
|
||||||
name (std::move (name)),
|
name (std::move (name)),
|
||||||
single (single) {}
|
single (single) {}
|
@ -4,10 +4,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Output {
|
namespace WallpaperEngine::Render::Drivers::Output {
|
||||||
class COutputViewport {
|
class OutputViewport {
|
||||||
public:
|
public:
|
||||||
COutputViewport (glm::ivec4 viewport, std::string name, bool single = false);
|
OutputViewport (glm::ivec4 viewport, std::string name, bool single = false);
|
||||||
virtual ~COutputViewport () = default;
|
virtual ~OutputViewport () = default;
|
||||||
|
|
||||||
glm::ivec4 viewport;
|
glm::ivec4 viewport;
|
||||||
std::string name;
|
std::string name;
|
55
src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.cpp
Normal file
55
src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "WaylandOutput.h"
|
||||||
|
#include "../WaylandOpenGLDriver.h"
|
||||||
|
#include "WallpaperEngine/Application/WallpaperApplication.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
|
WaylandOutput::WaylandOutput (ApplicationContext& context, WaylandOpenGLDriver& driver) :
|
||||||
|
Output (context, driver) {
|
||||||
|
updateViewports ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaylandOutput::updateViewports () {
|
||||||
|
m_viewports.clear ();
|
||||||
|
const auto PDRIVER = dynamic_cast<WaylandOpenGLDriver*> (&m_driver);
|
||||||
|
glm::ivec2 fullw = {0, 0};
|
||||||
|
for (const auto& o : PDRIVER->m_screens) {
|
||||||
|
if (!o->layerSurface)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
m_viewports [o->name] = o;
|
||||||
|
|
||||||
|
fullw = fullw + glm::ivec2 {o->size.x * o->scale, 0};
|
||||||
|
if (o->size.y > fullw.y)
|
||||||
|
fullw.y = o->size.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_fullWidth = fullw.x;
|
||||||
|
m_fullHeight = fullw.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaylandOutput::reset () {
|
||||||
|
updateViewports ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WaylandOutput::renderVFlip () const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WaylandOutput::renderMultiple () const {
|
||||||
|
return false; // todo
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WaylandOutput::haveImageBuffer () const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* WaylandOutput::getImageBuffer () const {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t WaylandOutput::getImageBufferSize () const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaylandOutput::updateRender () const {}
|
@ -6,17 +6,17 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "COutput.h"
|
#include "Output.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CWaylandOpenGLDriver;
|
class WaylandOpenGLDriver;
|
||||||
|
|
||||||
namespace Output {
|
namespace Output {
|
||||||
class CWaylandOutput final : public COutput {
|
class WaylandOutput final : public Output {
|
||||||
public:
|
public:
|
||||||
CWaylandOutput (CApplicationContext& context, CWaylandOpenGLDriver& driver);
|
WaylandOutput (ApplicationContext& context, WaylandOpenGLDriver& driver);
|
||||||
~CWaylandOutput () override = default;
|
~WaylandOutput () override = default;
|
||||||
|
|
||||||
void reset () override;
|
void reset () override;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "CWaylandOutputViewport.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WaylandOutputViewport.h"
|
||||||
|
|
||||||
#define class _class
|
#define class _class
|
||||||
#define namespace _namespace
|
#define namespace _namespace
|
||||||
@ -17,7 +17,7 @@ using namespace WallpaperEngine::Render::Drivers;
|
|||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
static void handleLSConfigure (void* data, zwlr_layer_surface_v1* surface, uint32_t serial, uint32_t w, uint32_t h) {
|
static void handleLSConfigure (void* data, zwlr_layer_surface_v1* surface, uint32_t serial, uint32_t w, uint32_t h) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
viewport->size = {w, h};
|
viewport->size = {w, h};
|
||||||
viewport->viewport = {0, 0, viewport->size.x * viewport->scale, viewport->size.y * viewport->scale};
|
viewport->viewport = {0, 0, viewport->size.x * viewport->scale, viewport->size.y * viewport->scale};
|
||||||
viewport->resize ();
|
viewport->resize ();
|
||||||
@ -26,7 +26,7 @@ static void handleLSConfigure (void* data, zwlr_layer_surface_v1* surface, uint3
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handleLSClosed (void* data, zwlr_layer_surface_v1* surface) {
|
static void handleLSClosed (void* data, zwlr_layer_surface_v1* surface) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
|
|
||||||
viewport->getDriver ()->onLayerClose (viewport);
|
viewport->getDriver ()->onLayerClose (viewport);
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ static void geometry (void* data, wl_output* output, int32_t x, int32_t y, int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void mode (void* data, wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
static void mode (void* data, wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
|
|
||||||
// update viewport size too
|
// update viewport size too
|
||||||
viewport->size = {width, height};
|
viewport->size = {width, height};
|
||||||
@ -51,11 +51,11 @@ static void mode (void* data, wl_output* output, uint32_t flags, int32_t width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void done (void* data, wl_output* wl_output) {
|
static void done (void* data, wl_output* wl_output) {
|
||||||
static_cast<CWaylandOutputViewport*> (data)->initialized = true;
|
static_cast<WaylandOutputViewport*> (data)->initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scale (void* data, wl_output* wl_output, int32_t scale) {
|
static void scale (void* data, wl_output* wl_output, int32_t scale) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
|
|
||||||
viewport->scale = scale;
|
viewport->scale = scale;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ static void scale (void* data, wl_output* wl_output, int32_t scale) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void name (void* data, wl_output* wl_output, const char* name) {
|
static void name (void* data, wl_output* wl_output, const char* name) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
viewport->name = name;
|
viewport->name = name;
|
||||||
@ -81,7 +81,7 @@ static void description (void* data, wl_output* wl_output, const char* descripti
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void surfaceFrameCallback (void* data, struct wl_callback* cb, uint32_t time) {
|
static void surfaceFrameCallback (void* data, struct wl_callback* cb, uint32_t time) {
|
||||||
const auto viewport = static_cast<CWaylandOutputViewport*> (data);
|
const auto viewport = static_cast<WaylandOutputViewport*> (data);
|
||||||
|
|
||||||
wl_callback_destroy (cb);
|
wl_callback_destroy (cb);
|
||||||
|
|
||||||
@ -101,9 +101,9 @@ constexpr struct zwlr_layer_surface_v1_listener layerSurfaceListener = {
|
|||||||
.closed = handleLSClosed,
|
.closed = handleLSClosed,
|
||||||
};
|
};
|
||||||
|
|
||||||
CWaylandOutputViewport::CWaylandOutputViewport (CWaylandOpenGLDriver* driver, uint32_t waylandName,
|
WaylandOutputViewport::WaylandOutputViewport (WaylandOpenGLDriver* driver, uint32_t waylandName,
|
||||||
struct wl_registry* registry) :
|
struct wl_registry* registry) :
|
||||||
COutputViewport ({0, 0, 0, 0}, "", true),
|
OutputViewport ({0, 0, 0, 0}, "", true),
|
||||||
size ({0, 0}),
|
size ({0, 0}),
|
||||||
waylandName (waylandName),
|
waylandName (waylandName),
|
||||||
m_driver (driver) {
|
m_driver (driver) {
|
||||||
@ -112,7 +112,7 @@ CWaylandOutputViewport::CWaylandOutputViewport (CWaylandOpenGLDriver* driver, ui
|
|||||||
wl_output_add_listener (output, &outputListener, this);
|
wl_output_add_listener (output, &outputListener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOutputViewport::setupLS () {
|
void WaylandOutputViewport::setupLS () {
|
||||||
surface = wl_compositor_create_surface (m_driver->getWaylandContext ()->compositor);
|
surface = wl_compositor_create_surface (m_driver->getWaylandContext ()->compositor);
|
||||||
layerSurface =
|
layerSurface =
|
||||||
zwlr_layer_shell_v1_get_layer_surface (m_driver->getWaylandContext ()->layerShell, surface, output,
|
zwlr_layer_shell_v1_get_layer_surface (m_driver->getWaylandContext ()->layerShell, surface, output,
|
||||||
@ -162,11 +162,11 @@ void CWaylandOutputViewport::setupLS () {
|
|||||||
this->m_driver->getOutput ().reset ();
|
this->m_driver->getOutput ().reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandOpenGLDriver* CWaylandOutputViewport::getDriver () {
|
WaylandOpenGLDriver* WaylandOutputViewport::getDriver () {
|
||||||
return this->m_driver;
|
return this->m_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOutputViewport::makeCurrent () {
|
void WaylandOutputViewport::makeCurrent () {
|
||||||
const EGLBoolean result = eglMakeCurrent (m_driver->getEGLContext ()->display, eglSurface, eglSurface,
|
const EGLBoolean result = eglMakeCurrent (m_driver->getEGLContext ()->display, eglSurface, eglSurface,
|
||||||
m_driver->getEGLContext ()->context);
|
m_driver->getEGLContext ()->context);
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ void CWaylandOutputViewport::makeCurrent () {
|
|||||||
sLog.error ("Couldn't make egl current");
|
sLog.error ("Couldn't make egl current");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOutputViewport::swapOutput () {
|
void WaylandOutputViewport::swapOutput () {
|
||||||
this->callbackInitialized = true;
|
this->callbackInitialized = true;
|
||||||
|
|
||||||
this->makeCurrent ();
|
this->makeCurrent ();
|
||||||
@ -186,7 +186,7 @@ void CWaylandOutputViewport::swapOutput () {
|
|||||||
wl_surface_commit (surface);
|
wl_surface_commit (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOutputViewport::resize () {
|
void WaylandOutputViewport::resize () {
|
||||||
if (!this->eglWindow)
|
if (!this->eglWindow)
|
||||||
return;
|
return;
|
||||||
|
|
@ -9,28 +9,28 @@
|
|||||||
#include <wayland-cursor.h>
|
#include <wayland-cursor.h>
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
|
|
||||||
#include "../CWaylandOpenGLDriver.h"
|
#include "../WaylandOpenGLDriver.h"
|
||||||
#include <WallpaperEngine/Input/CMouseInput.h>
|
#include "OutputViewport.h"
|
||||||
#include "COutputViewport.h"
|
#include <WallpaperEngine/Input/MouseInput.h>
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
|
||||||
struct zwlr_layer_shell_v1;
|
struct zwlr_layer_shell_v1;
|
||||||
struct zwlr_layer_surface_v1;
|
struct zwlr_layer_surface_v1;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CWaylandOpenGLDriver;
|
class WaylandOpenGLDriver;
|
||||||
|
|
||||||
namespace Output {
|
namespace Output {
|
||||||
class COutputViewport;
|
class OutputViewport;
|
||||||
|
|
||||||
class CWaylandOutputViewport final : public COutputViewport {
|
class WaylandOutputViewport final : public OutputViewport {
|
||||||
public:
|
public:
|
||||||
CWaylandOutputViewport (CWaylandOpenGLDriver* driver, uint32_t waylandName, struct wl_registry* registry);
|
WaylandOutputViewport (WaylandOpenGLDriver* driver, uint32_t waylandName, struct wl_registry* registry);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The wayland driver
|
* @return The wayland driver
|
||||||
*/
|
*/
|
||||||
CWaylandOpenGLDriver* getDriver ();
|
WaylandOpenGLDriver* getDriver ();
|
||||||
|
|
||||||
wl_output* output = nullptr;
|
wl_output* output = nullptr;
|
||||||
glm::ivec2 size = {};
|
glm::ivec2 size = {};
|
||||||
@ -69,7 +69,7 @@ class CWaylandOutputViewport final : public COutputViewport {
|
|||||||
void resize ();
|
void resize ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CWaylandOpenGLDriver* m_driver = nullptr;
|
WaylandOpenGLDriver* m_driver = nullptr;
|
||||||
};
|
};
|
||||||
} // namespace Output
|
} // namespace Output
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
@ -1,6 +1,6 @@
|
|||||||
#include "CX11Output.h"
|
#include "GLFWOutputViewport.h"
|
||||||
#include "CGLFWOutputViewport.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "X11Output.h"
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||||
|
|
||||||
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
void CustomXIOErrorExitHandler (Display* dsp, void* userdata) {
|
||||||
const auto context = static_cast<CX11Output*> (userdata);
|
const auto context = static_cast<X11Output*> (userdata);
|
||||||
|
|
||||||
sLog.debugerror ("Critical XServer error detected. Attempting to recover...");
|
sLog.debugerror ("Critical XServer error detected. Attempting to recover...");
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ int CustomXIOErrorHandler (Display* dsp) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11Output::CX11Output (CApplicationContext& context, CVideoDriver& driver) : COutput (context, driver),
|
X11Output::X11Output (ApplicationContext& context, VideoDriver& driver) : Output (context, driver),
|
||||||
m_display (nullptr),
|
m_display (nullptr),
|
||||||
m_pixmap (None),
|
m_pixmap (None),
|
||||||
m_root (None),
|
m_root (None),
|
||||||
@ -44,11 +44,11 @@ CX11Output::CX11Output (CApplicationContext& context, CVideoDriver& driver) : CO
|
|||||||
this->loadScreenInfo ();
|
this->loadScreenInfo ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11Output::~CX11Output () {
|
X11Output::~X11Output () {
|
||||||
this->free ();
|
this->free ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11Output::reset () {
|
void X11Output::reset () {
|
||||||
// first free whatever we have right now
|
// first free whatever we have right now
|
||||||
this->free ();
|
this->free ();
|
||||||
// re-load screen info
|
// re-load screen info
|
||||||
@ -58,7 +58,7 @@ void CX11Output::reset () {
|
|||||||
// this->m_driver.getFullscreenDetector ().reset ();
|
// this->m_driver.getFullscreenDetector ().reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11Output::free () {
|
void X11Output::free () {
|
||||||
// go through all the viewports and free them
|
// go through all the viewports and free them
|
||||||
for (const auto& [screen, viewport] : this->m_viewports)
|
for (const auto& [screen, viewport] : this->m_viewports)
|
||||||
delete viewport;
|
delete viewport;
|
||||||
@ -73,27 +73,27 @@ void CX11Output::free () {
|
|||||||
XCloseDisplay (this->m_display);
|
XCloseDisplay (this->m_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CX11Output::getImageBuffer () const {
|
void* X11Output::getImageBuffer () const {
|
||||||
return this->m_imageData;
|
return this->m_imageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CX11Output::renderVFlip () const {
|
bool X11Output::renderVFlip () const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CX11Output::renderMultiple () const {
|
bool X11Output::renderMultiple () const {
|
||||||
return this->m_viewports.size () > 1;
|
return this->m_viewports.size () > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CX11Output::haveImageBuffer () const {
|
bool X11Output::haveImageBuffer () const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CX11Output::getImageBufferSize () const {
|
uint32_t X11Output::getImageBufferSize () const {
|
||||||
return this->m_imageSize;
|
return this->m_imageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11Output::loadScreenInfo () {
|
void X11Output::loadScreenInfo () {
|
||||||
this->m_display = XOpenDisplay (nullptr);
|
this->m_display = XOpenDisplay (nullptr);
|
||||||
// set the error handling to try and recover from X disconnections
|
// set the error handling to try and recover from X disconnections
|
||||||
#ifdef HAVE_XSETIOERROREXITHANDLER
|
#ifdef HAVE_XSETIOERROREXITHANDLER
|
||||||
@ -131,7 +131,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 CGLFWOutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name});
|
this->m_screens.push_back (new GLFWOutputViewport {{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) !=
|
||||||
@ -140,7 +140,7 @@ void CX11Output::loadScreenInfo () {
|
|||||||
crtc->height);
|
crtc->height);
|
||||||
|
|
||||||
this->m_viewports [info->name] =
|
this->m_viewports [info->name] =
|
||||||
new CGLFWOutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name};
|
new GLFWOutputViewport {{crtc->x, crtc->y, crtc->width, crtc->height}, info->name};
|
||||||
}
|
}
|
||||||
|
|
||||||
XRRFreeCrtcInfo (crtc);
|
XRRFreeCrtcInfo (crtc);
|
||||||
@ -179,7 +179,7 @@ void CX11Output::loadScreenInfo () {
|
|||||||
this->m_driver.resizeWindow ({this->m_fullWidth, this->m_fullHeight});
|
this->m_driver.resizeWindow ({this->m_fullWidth, this->m_fullHeight});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX11Output::updateRender () const {
|
void X11Output::updateRender () const {
|
||||||
// put the image back into the screen
|
// put the image back into the screen
|
||||||
XPutImage (this->m_display, this->m_pixmap, this->m_gc, this->m_image, 0, 0, 0, 0, this->m_fullWidth,
|
XPutImage (this->m_display, this->m_pixmap, this->m_gc, this->m_image, 0, 0, 0, 0, this->m_fullWidth,
|
||||||
this->m_fullHeight);
|
this->m_fullHeight);
|
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include "COutput.h"
|
#include "Output.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Output {
|
namespace WallpaperEngine::Render::Drivers::Output {
|
||||||
class CX11Output final : public COutput {
|
class X11Output final : public Output {
|
||||||
public:
|
public:
|
||||||
CX11Output (CApplicationContext& context, CVideoDriver& driver);
|
X11Output (ApplicationContext& context, VideoDriver& driver);
|
||||||
~CX11Output () override;
|
~X11Output () override;
|
||||||
|
|
||||||
void reset () override;
|
void reset () override;
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ class CX11Output final : public COutput {
|
|||||||
char* m_imageData = nullptr;
|
char* m_imageData = nullptr;
|
||||||
uint32_t m_imageSize = 0;
|
uint32_t m_imageSize = 0;
|
||||||
XImage* m_image = nullptr;
|
XImage* m_image = nullptr;
|
||||||
std::vector<COutputViewport*> m_screens = {};
|
std::vector<OutputViewport*> m_screens = {};
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Render::Drivers::Output
|
} // namespace WallpaperEngine::Render::Drivers::Output
|
16
src/WallpaperEngine/Render/Drivers/VideoDriver.cpp
Normal file
16
src/WallpaperEngine/Render/Drivers/VideoDriver.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "VideoDriver.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Input;
|
||||||
|
using namespace WallpaperEngine::Render::Drivers;
|
||||||
|
|
||||||
|
VideoDriver::VideoDriver (WallpaperApplication& app, MouseInput& mouseInput) :
|
||||||
|
m_app (app),
|
||||||
|
m_inputContext (mouseInput) {}
|
||||||
|
|
||||||
|
WallpaperApplication& VideoDriver::getApp () const {
|
||||||
|
return this->m_app;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputContext& VideoDriver::getInputContext () {
|
||||||
|
return this->m_inputContext;
|
||||||
|
}
|
@ -1,35 +1,35 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/COutput.h"
|
#include "WallpaperEngine/Input/InputContext.h"
|
||||||
#include "WallpaperEngine/Input/CMouseInput.h"
|
#include "WallpaperEngine/Input/MouseInput.h"
|
||||||
#include "WallpaperEngine/Input/CInputContext.h"
|
#include "WallpaperEngine/Render/Drivers/Output/Output.h"
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
#include <glm/vec4.hpp>
|
#include <glm/vec4.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
class CWallpaperApplication;
|
class WallpaperApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Input {
|
namespace WallpaperEngine::Input {
|
||||||
class CInputContext;
|
class InputContext;
|
||||||
class CWaylandMouseInput;
|
class CWaylandMouseInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
namespace Detectors {
|
namespace Detectors {
|
||||||
class CFullScreenDetector;
|
class FullScreenDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CVideoDriver {
|
class VideoDriver {
|
||||||
public:
|
public:
|
||||||
explicit CVideoDriver (CWallpaperApplication& app, Input::CMouseInput& mouseInput);
|
explicit VideoDriver (WallpaperApplication& app, Input::MouseInput& mouseInput);
|
||||||
virtual ~CVideoDriver () = default;
|
virtual ~VideoDriver () = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The current output in use
|
* @return The current output in use
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual Output::COutput& getOutput () = 0;
|
[[nodiscard]] virtual Output::Output& getOutput () = 0;
|
||||||
/**
|
/**
|
||||||
* @return The time that has passed since the driver started
|
* @return The time that has passed since the driver started
|
||||||
*/
|
*/
|
||||||
@ -74,16 +74,16 @@ class CVideoDriver {
|
|||||||
/**
|
/**
|
||||||
* @return The app that owns this driver
|
* @return The app that owns this driver
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] CWallpaperApplication& getApp () const;
|
[[nodiscard]] WallpaperApplication& getApp () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The input context in use by this driver
|
* @return The input context in use by this driver
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] Input::CInputContext& getInputContext ();
|
[[nodiscard]] Input::InputContext& getInputContext ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** App that owns this driver */
|
/** App that owns this driver */
|
||||||
CWallpaperApplication& m_app;
|
WallpaperApplication& m_app;
|
||||||
Input::CInputContext m_inputContext;
|
Input::InputContext m_inputContext;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
@ -1,26 +1,26 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "CVideoFactories.h"
|
#include "VideoFactories.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render::Drivers;
|
using namespace WallpaperEngine::Render::Drivers;
|
||||||
|
|
||||||
CVideoFactories::CVideoFactories () {
|
VideoFactories::VideoFactories () {
|
||||||
assert (this->sInstance == nullptr);
|
assert (this->sInstance == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVideoFactories& CVideoFactories::get () {
|
VideoFactories& VideoFactories::get () {
|
||||||
if (sInstance == nullptr) {
|
if (sInstance == nullptr) {
|
||||||
sInstance = std::make_unique <CVideoFactories> ();
|
sInstance = std::make_unique <VideoFactories> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *sInstance;
|
return *sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideoFactories::registerDriver (
|
void VideoFactories::registerDriver (
|
||||||
CApplicationContext::WINDOW_MODE forMode, std::string xdgSessionType,
|
ApplicationContext::WINDOW_MODE forMode, std::string xdgSessionType,
|
||||||
WallpaperEngine::Render::Drivers::CVideoFactories::DriverConstructionFunc factory) {
|
WallpaperEngine::Render::Drivers::VideoFactories::DriverConstructionFunc factory) {
|
||||||
const auto cur = this->m_driverFactories.find (forMode);
|
const auto cur = this->m_driverFactories.find (forMode);
|
||||||
|
|
||||||
if (cur == this->m_driverFactories.end ()) {
|
if (cur == this->m_driverFactories.end ()) {
|
||||||
@ -33,11 +33,11 @@ void CVideoFactories::registerDriver (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideoFactories::registerFullscreenDetector (std::string xdgSessionType, FullscreenDetectorConstructionFunc factory) {
|
void VideoFactories::registerFullscreenDetector (std::string xdgSessionType, FullscreenDetectorConstructionFunc factory) {
|
||||||
this->m_fullscreenFactories.emplace (xdgSessionType, factory);
|
this->m_fullscreenFactories.emplace (xdgSessionType, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> CVideoFactories::getRegisteredDrivers () const {
|
std::vector<std::string> VideoFactories::getRegisteredDrivers () const {
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
|
||||||
for (const auto& [windowMode, sessionTypeToFactory] : this->m_driverFactories) {
|
for (const auto& [windowMode, sessionTypeToFactory] : this->m_driverFactories) {
|
||||||
@ -53,9 +53,9 @@ std::vector<std::string> CVideoFactories::getRegisteredDrivers () const {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr <CVideoDriver> CVideoFactories::createVideoDriver (
|
std::unique_ptr <VideoDriver> VideoFactories::createVideoDriver (
|
||||||
CApplicationContext::WINDOW_MODE mode, const std::string& xdgSessionType,
|
ApplicationContext::WINDOW_MODE mode, const std::string& xdgSessionType,
|
||||||
CApplicationContext& context, CWallpaperApplication& application
|
ApplicationContext& context, WallpaperApplication& application
|
||||||
) {
|
) {
|
||||||
const auto sessionTypeToFactory = this->m_driverFactories.find (mode);
|
const auto sessionTypeToFactory = this->m_driverFactories.find (mode);
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ std::unique_ptr <CVideoDriver> CVideoFactories::createVideoDriver (
|
|||||||
// and it's not like the current map properly allows for storing this
|
// and it's not like the current map properly allows for storing this
|
||||||
// so hijacking the detection is probably best for now
|
// so hijacking the detection is probably best for now
|
||||||
const auto factory =
|
const auto factory =
|
||||||
mode != Application::CApplicationContext::DESKTOP_BACKGROUND
|
mode != Application::ApplicationContext::DESKTOP_BACKGROUND
|
||||||
? sessionTypeToFactory->second.find (DEFAULT_WINDOW_NAME)
|
? sessionTypeToFactory->second.find (DEFAULT_WINDOW_NAME)
|
||||||
: sessionTypeToFactory->second.find (xdgSessionType);
|
: sessionTypeToFactory->second.find (xdgSessionType);
|
||||||
|
|
||||||
@ -78,16 +78,16 @@ std::unique_ptr <CVideoDriver> CVideoFactories::createVideoDriver (
|
|||||||
return factory->second (context, application);
|
return factory->second (context, application);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr <Detectors::CFullScreenDetector> CVideoFactories::createFullscreenDetector (
|
std::unique_ptr <Detectors::FullScreenDetector> VideoFactories::createFullscreenDetector (
|
||||||
std::string xdgSessionType, CApplicationContext& context, CVideoDriver& driver
|
std::string xdgSessionType, ApplicationContext& context, VideoDriver& driver
|
||||||
) {
|
) {
|
||||||
const auto it = this->m_fullscreenFactories.find (xdgSessionType);
|
const auto it = this->m_fullscreenFactories.find (xdgSessionType);
|
||||||
|
|
||||||
if (it == this->m_fullscreenFactories.end () || !context.settings.render.pauseOnFullscreen) {
|
if (it == this->m_fullscreenFactories.end () || !context.settings.render.pauseOnFullscreen) {
|
||||||
return std::make_unique <Detectors::CFullScreenDetector> (context);
|
return std::make_unique <Detectors::FullScreenDetector> (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return it->second (context, driver);
|
return it->second (context, driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CVideoFactories> CVideoFactories::sInstance = nullptr;
|
std::unique_ptr<VideoFactories> VideoFactories::sInstance = nullptr;
|
@ -4,27 +4,28 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "CVideoDriver.h"
|
#include "VideoDriver.h"
|
||||||
|
|
||||||
#define DEFAULT_WINDOW_NAME "default"
|
#define DEFAULT_WINDOW_NAME "default"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
class CVideoFactories {
|
class VideoFactories {
|
||||||
public:
|
public:
|
||||||
using DriverConstructionFunc = std::function<std::unique_ptr<CVideoDriver>(CApplicationContext&, CWallpaperApplication&)>;
|
using DriverConstructionFunc = std::function<std::unique_ptr<VideoDriver>(ApplicationContext&, WallpaperApplication&)>;
|
||||||
using FullscreenDetectorConstructionFunc = std::function<std::unique_ptr<Detectors::CFullScreenDetector>(CApplicationContext&, CVideoDriver&)>;
|
using FullscreenDetectorConstructionFunc = std::function<std::unique_ptr<Detectors::FullScreenDetector>(ApplicationContext&, VideoDriver&)>;
|
||||||
CVideoFactories ();
|
VideoFactories ();
|
||||||
|
|
||||||
static CVideoFactories& get ();
|
static VideoFactories& get ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new handler for the given window mode and XDG_SESSION_TYPE
|
* Adds a new handler for the given window mode and XDG_SESSION_TYPE
|
||||||
*
|
*
|
||||||
* @param forMode
|
* @param forMode
|
||||||
|
* @param xdgSessionType
|
||||||
* @param factory
|
* @param factory
|
||||||
*/
|
*/
|
||||||
void registerDriver (
|
void registerDriver (
|
||||||
CApplicationContext::WINDOW_MODE forMode, std::string xdgSessionType, DriverConstructionFunc factory);
|
ApplicationContext::WINDOW_MODE forMode, std::string xdgSessionType, DriverConstructionFunc factory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new handler for the given XDG_SESSION_TYPE
|
* Adds a new handler for the given XDG_SESSION_TYPE
|
||||||
@ -44,29 +45,31 @@ class CVideoFactories {
|
|||||||
*
|
*
|
||||||
* @param mode
|
* @param mode
|
||||||
* @param xdgSessionType
|
* @param xdgSessionType
|
||||||
|
* @param context
|
||||||
|
* @param application
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] std::unique_ptr <CVideoDriver> createVideoDriver (
|
[[nodiscard]] std::unique_ptr <VideoDriver> createVideoDriver (
|
||||||
CApplicationContext::WINDOW_MODE mode, const std::string& xdgSessionType,
|
ApplicationContext::WINDOW_MODE mode, const std::string& xdgSessionType,
|
||||||
CApplicationContext& context, CWallpaperApplication& application);
|
ApplicationContext& context, WallpaperApplication& application);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the factory and builds the requested fullscreen detector or provides a stub if not possible
|
* Calls the factory and builds the requested fullscreen detector or provides a stub if not possible
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] std::unique_ptr <Detectors::CFullScreenDetector> createFullscreenDetector (
|
[[nodiscard]] std::unique_ptr <Detectors::FullScreenDetector> createFullscreenDetector (
|
||||||
std::string xdgSessionType, CApplicationContext& context, CVideoDriver& driver);
|
std::string xdgSessionType, ApplicationContext& context, VideoDriver& driver);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using SessionTypeToFullscreenDetectorType = std::map <std::string, FullscreenDetectorConstructionFunc>;
|
using SessionTypeToFullscreenDetectorType = std::map <std::string, FullscreenDetectorConstructionFunc>;
|
||||||
using SessionTypeToFactoryType = std::map <std::string, DriverConstructionFunc>;
|
using SessionTypeToFactoryType = std::map <std::string, DriverConstructionFunc>;
|
||||||
using WindowModeToSessionType = std::map <CApplicationContext::WINDOW_MODE, SessionTypeToFactoryType>;
|
using WindowModeToSessionType = std::map <ApplicationContext::WINDOW_MODE, SessionTypeToFactoryType>;
|
||||||
|
|
||||||
SessionTypeToFullscreenDetectorType m_fullscreenFactories = {};
|
SessionTypeToFullscreenDetectorType m_fullscreenFactories = {};
|
||||||
WindowModeToSessionType m_driverFactories = {};
|
WindowModeToSessionType m_driverFactories = {};
|
||||||
static std::unique_ptr<CVideoFactories> sInstance;
|
static std::unique_ptr<VideoFactories> sInstance;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Render::Drivers
|
} // namespace WallpaperEngine::Render::Drivers
|
||||||
|
|
||||||
#define sVideoFactories (WallpaperEngine::Render::Drivers::CVideoFactories::get ())
|
#define sVideoFactories (WallpaperEngine::Render::Drivers::VideoFactories::get ())
|
@ -1,7 +1,7 @@
|
|||||||
#include "CWaylandOpenGLDriver.h"
|
#include "WaylandOpenGLDriver.h"
|
||||||
#include "CVideoFactories.h"
|
#include "VideoFactories.h"
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
#include "WallpaperEngine/Application/WallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Logging/CLog.h"
|
#include "WallpaperEngine/Logging/Log.h"
|
||||||
|
|
||||||
#define class _class
|
#define class _class
|
||||||
#define namespace _namespace
|
#define namespace _namespace
|
||||||
@ -22,7 +22,7 @@ using namespace WallpaperEngine::Render::Drivers;
|
|||||||
|
|
||||||
static void handlePointerEnter (void* data, struct wl_pointer* wl_pointer, uint32_t serial, struct wl_surface* surface,
|
static void handlePointerEnter (void* data, struct wl_pointer* wl_pointer, uint32_t serial, struct wl_surface* surface,
|
||||||
wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||||
const auto driver = static_cast<CWaylandOpenGLDriver*> (data);
|
const auto driver = static_cast<WaylandOpenGLDriver*> (data);
|
||||||
const auto viewport = driver->surfaceToViewport (surface);
|
const auto viewport = driver->surfaceToViewport (surface);
|
||||||
driver->viewportInFocus = viewport;
|
driver->viewportInFocus = viewport;
|
||||||
wl_surface_set_buffer_scale (viewport->cursorSurface, viewport->scale);
|
wl_surface_set_buffer_scale (viewport->cursorSurface, viewport->scale);
|
||||||
@ -39,7 +39,7 @@ static void handlePointerAxis (void* data, wl_pointer* wl_pointer, uint32_t time
|
|||||||
|
|
||||||
static void handlePointerMotion (void* data, struct wl_pointer* wl_pointer, uint32_t time, wl_fixed_t surface_x,
|
static void handlePointerMotion (void* data, struct wl_pointer* wl_pointer, uint32_t time, wl_fixed_t surface_x,
|
||||||
wl_fixed_t surface_y) {
|
wl_fixed_t surface_y) {
|
||||||
const auto driver = static_cast<CWaylandOpenGLDriver*> (data);
|
const auto driver = static_cast<WaylandOpenGLDriver*> (data);
|
||||||
|
|
||||||
const auto x = wl_fixed_to_double (surface_x);
|
const auto x = wl_fixed_to_double (surface_x);
|
||||||
const auto y = wl_fixed_to_double (surface_y);
|
const auto y = wl_fixed_to_double (surface_y);
|
||||||
@ -52,7 +52,7 @@ static void handlePointerMotion (void* data, struct wl_pointer* wl_pointer, uint
|
|||||||
|
|
||||||
static void handlePointerButton (void* data, struct wl_pointer* wl_pointer, uint32_t serial, uint32_t time,
|
static void handlePointerButton (void* data, struct wl_pointer* wl_pointer, uint32_t serial, uint32_t time,
|
||||||
uint32_t button, uint32_t button_state) {
|
uint32_t button, uint32_t button_state) {
|
||||||
const auto driver = static_cast<CWaylandOpenGLDriver*> (data);
|
const auto driver = static_cast<WaylandOpenGLDriver*> (data);
|
||||||
|
|
||||||
if (!driver->viewportInFocus)
|
if (!driver->viewportInFocus)
|
||||||
return;
|
return;
|
||||||
@ -87,7 +87,7 @@ constexpr struct wl_seat_listener seatListener = {.capabilities = handleCapabili
|
|||||||
|
|
||||||
static void handleGlobal (void* data, struct wl_registry* registry, uint32_t name, const char* interface,
|
static void handleGlobal (void* data, struct wl_registry* registry, uint32_t name, const char* interface,
|
||||||
uint32_t version) {
|
uint32_t version) {
|
||||||
const auto driver = static_cast<CWaylandOpenGLDriver*> (data);
|
const auto driver = static_cast<WaylandOpenGLDriver*> (data);
|
||||||
|
|
||||||
if (strcmp (interface, wl_compositor_interface.name) == 0) {
|
if (strcmp (interface, wl_compositor_interface.name) == 0) {
|
||||||
driver->getWaylandContext ()->compositor =
|
driver->getWaylandContext ()->compositor =
|
||||||
@ -97,7 +97,7 @@ static void handleGlobal (void* data, struct wl_registry* registry, uint32_t nam
|
|||||||
static_cast<wl_shm*> (wl_registry_bind (registry, name, &wl_shm_interface, 1));
|
static_cast<wl_shm*> (wl_registry_bind (registry, name, &wl_shm_interface, 1));
|
||||||
} else if (strcmp (interface, wl_output_interface.name) == 0) {
|
} else if (strcmp (interface, wl_output_interface.name) == 0) {
|
||||||
driver->m_screens.emplace_back (
|
driver->m_screens.emplace_back (
|
||||||
new WallpaperEngine::Render::Drivers::Output::CWaylandOutputViewport (driver, name, registry));
|
new WallpaperEngine::Render::Drivers::Output::WaylandOutputViewport (driver, name, registry));
|
||||||
} else if (strcmp (interface, zwlr_layer_shell_v1_interface.name) == 0) {
|
} else if (strcmp (interface, zwlr_layer_shell_v1_interface.name) == 0) {
|
||||||
driver->getWaylandContext ()->layerShell =
|
driver->getWaylandContext ()->layerShell =
|
||||||
static_cast<zwlr_layer_shell_v1*> (wl_registry_bind (registry, name, &zwlr_layer_shell_v1_interface, 1));
|
static_cast<zwlr_layer_shell_v1*> (wl_registry_bind (registry, name, &zwlr_layer_shell_v1_interface, 1));
|
||||||
@ -117,7 +117,7 @@ constexpr struct wl_registry_listener registryListener = {
|
|||||||
.global_remove = handleGlobalRemoved,
|
.global_remove = handleGlobalRemoved,
|
||||||
};
|
};
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::initEGL () {
|
void WaylandOpenGLDriver::initEGL () {
|
||||||
const char* CLIENT_EXTENSIONS = eglQueryString (EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
const char* CLIENT_EXTENSIONS = eglQueryString (EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||||
if (!CLIENT_EXTENSIONS)
|
if (!CLIENT_EXTENSIONS)
|
||||||
sLog.exception ("Failed to query EGL Extensions");
|
sLog.exception ("Failed to query EGL Extensions");
|
||||||
@ -198,14 +198,14 @@ void CWaylandOpenGLDriver::initEGL () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::finishEGL () const {
|
void WaylandOpenGLDriver::finishEGL () const {
|
||||||
eglMakeCurrent (EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent (EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
if (m_eglContext.display)
|
if (m_eglContext.display)
|
||||||
eglTerminate (m_eglContext.display);
|
eglTerminate (m_eglContext.display);
|
||||||
eglReleaseThread ();
|
eglReleaseThread ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::onLayerClose (Output::CWaylandOutputViewport* viewport) {
|
void WaylandOpenGLDriver::onLayerClose (Output::WaylandOutputViewport* viewport) {
|
||||||
sLog.error ("Compositor closed our LS, freeing data...");
|
sLog.error ("Compositor closed our LS, freeing data...");
|
||||||
|
|
||||||
if (viewport->eglSurface)
|
if (viewport->eglSurface)
|
||||||
@ -231,8 +231,8 @@ void CWaylandOpenGLDriver::onLayerClose (Output::CWaylandOutputViewport* viewpor
|
|||||||
delete viewport;
|
delete viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandOpenGLDriver::CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app) :
|
WaylandOpenGLDriver::WaylandOpenGLDriver (ApplicationContext& context, WallpaperApplication& app) :
|
||||||
CVideoDriver (app, m_mouseInput),
|
VideoDriver (app, m_mouseInput),
|
||||||
m_output (context, *this),
|
m_output (context, *this),
|
||||||
m_requestedExit (false),
|
m_requestedExit (false),
|
||||||
m_frameCounter (0),
|
m_frameCounter (0),
|
||||||
@ -276,7 +276,7 @@ CWaylandOpenGLDriver::CWaylandOpenGLDriver (CApplicationContext& context, CWallp
|
|||||||
sLog.error ("Failed to initialize GLEW: ", glewGetErrorString (result));
|
sLog.error ("Failed to initialize GLEW: ", glewGetErrorString (result));
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandOpenGLDriver::~CWaylandOpenGLDriver () {
|
WaylandOpenGLDriver::~WaylandOpenGLDriver () {
|
||||||
// stop EGL
|
// stop EGL
|
||||||
eglMakeCurrent (EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent (EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ CWaylandOpenGLDriver::~CWaylandOpenGLDriver () {
|
|||||||
wl_display_disconnect (this->m_waylandContext.display);
|
wl_display_disconnect (this->m_waylandContext.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::dispatchEventQueue () {
|
void WaylandOpenGLDriver::dispatchEventQueue () {
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@ -322,50 +322,50 @@ void CWaylandOpenGLDriver::dispatchEventQueue () {
|
|||||||
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
Output::COutput& CWaylandOpenGLDriver::getOutput () {
|
Output::Output& WaylandOpenGLDriver::getOutput () {
|
||||||
return this->m_output;
|
return this->m_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CWaylandOpenGLDriver::getRenderTime () const {
|
float WaylandOpenGLDriver::getRenderTime () const {
|
||||||
return static_cast<float> (std::chrono::duration_cast<std::chrono::microseconds> (
|
return static_cast<float> (std::chrono::duration_cast<std::chrono::microseconds> (
|
||||||
std::chrono::high_resolution_clock::now () - renderStart)
|
std::chrono::high_resolution_clock::now () - renderStart)
|
||||||
.count ()) /
|
.count ()) /
|
||||||
1000000.0;
|
1000000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWaylandOpenGLDriver::closeRequested () {
|
bool WaylandOpenGLDriver::closeRequested () {
|
||||||
return this->m_requestedExit;
|
return this->m_requestedExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::resizeWindow (glm::ivec2 size) {}
|
void WaylandOpenGLDriver::resizeWindow (glm::ivec2 size) {}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::resizeWindow (glm::ivec4 sizeandpos) {}
|
void WaylandOpenGLDriver::resizeWindow (glm::ivec4 sizeandpos) {}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::showWindow () {}
|
void WaylandOpenGLDriver::showWindow () {}
|
||||||
|
|
||||||
void CWaylandOpenGLDriver::hideWindow () {}
|
void WaylandOpenGLDriver::hideWindow () {}
|
||||||
|
|
||||||
glm::ivec2 CWaylandOpenGLDriver::getFramebufferSize () const {
|
glm::ivec2 WaylandOpenGLDriver::getFramebufferSize () const {
|
||||||
return glm::ivec2 {0, 0};
|
return glm::ivec2 {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CWaylandOpenGLDriver::getFrameCounter () const {
|
uint32_t WaylandOpenGLDriver::getFrameCounter () const {
|
||||||
return m_frameCounter;
|
return m_frameCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandOpenGLDriver::SEGLContext* CWaylandOpenGLDriver::getEGLContext () {
|
WaylandOpenGLDriver::SEGLContext* WaylandOpenGLDriver::getEGLContext () {
|
||||||
return &this->m_eglContext;
|
return &this->m_eglContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CWaylandOpenGLDriver::getProcAddress (const char* name) const {
|
void* WaylandOpenGLDriver::getProcAddress (const char* name) const {
|
||||||
return reinterpret_cast<void*> (eglGetProcAddress (name));
|
return reinterpret_cast<void*> (eglGetProcAddress (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaylandOpenGLDriver::SWaylandContext* CWaylandOpenGLDriver::getWaylandContext () {
|
WaylandOpenGLDriver::WaylandContext* WaylandOpenGLDriver::getWaylandContext () {
|
||||||
return &this->m_waylandContext;
|
return &this->m_waylandContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
Output::CWaylandOutputViewport* CWaylandOpenGLDriver::surfaceToViewport (const wl_surface* surface) {
|
Output::WaylandOutputViewport* WaylandOpenGLDriver::surfaceToViewport (const wl_surface* surface) {
|
||||||
for (const auto& o : m_screens) {
|
for (const auto& o : m_screens) {
|
||||||
if (o->surface == surface)
|
if (o->surface == surface)
|
||||||
return o;
|
return o;
|
||||||
@ -376,10 +376,10 @@ Output::CWaylandOutputViewport* CWaylandOpenGLDriver::surfaceToViewport (const w
|
|||||||
|
|
||||||
__attribute__((constructor)) void registerWaylandOpenGL () {
|
__attribute__((constructor)) void registerWaylandOpenGL () {
|
||||||
sVideoFactories.registerDriver (
|
sVideoFactories.registerDriver (
|
||||||
CApplicationContext::DESKTOP_BACKGROUND,
|
ApplicationContext::DESKTOP_BACKGROUND,
|
||||||
"wayland",
|
"wayland",
|
||||||
[](CApplicationContext& context, CWallpaperApplication& application) -> std::unique_ptr<CVideoDriver> {
|
[](ApplicationContext& context, WallpaperApplication& application) -> std::unique_ptr<VideoDriver> {
|
||||||
return std::make_unique <CWaylandOpenGLDriver> (context, application);
|
return std::make_unique <WaylandOpenGLDriver> (context, application);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -9,17 +9,17 @@
|
|||||||
#include <wayland-cursor.h>
|
#include <wayland-cursor.h>
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
#include "WallpaperEngine/Application/WallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Input/Drivers/CWaylandMouseInput.h"
|
#include "WallpaperEngine/Input/Drivers/WaylandMouseInput.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Output/WaylandOutput.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutputViewport.h"
|
#include "WallpaperEngine/Render/Drivers/VideoDriver.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
class CApplicationContext;
|
class ApplicationContext;
|
||||||
class CWallpaperApplication;
|
class WallpaperApplication;
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
||||||
|
|
||||||
struct zwlr_layer_shell_v1;
|
struct zwlr_layer_shell_v1;
|
||||||
@ -28,15 +28,15 @@ struct zwlr_layer_surface_v1;
|
|||||||
namespace WallpaperEngine::Render::Drivers {
|
namespace WallpaperEngine::Render::Drivers {
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
using namespace WallpaperEngine::Input::Drivers;
|
using namespace WallpaperEngine::Input::Drivers;
|
||||||
class CWaylandOpenGLDriver;
|
class WaylandOpenGLDriver;
|
||||||
|
|
||||||
namespace Output {
|
namespace Output {
|
||||||
class CWaylandOutputViewport;
|
class WaylandOutputViewport;
|
||||||
class CWaylandOutput;
|
class WaylandOutput;
|
||||||
} // namespace Output
|
} // namespace Output
|
||||||
|
|
||||||
class CWaylandOpenGLDriver final : public CVideoDriver {
|
class WaylandOpenGLDriver final : public VideoDriver {
|
||||||
friend class Output::CWaylandOutput;
|
friend class Output::WaylandOutput;
|
||||||
friend class CWaylandMouseInput;
|
friend class CWaylandMouseInput;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -47,7 +47,7 @@ class CWaylandOpenGLDriver final : public CVideoDriver {
|
|||||||
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT = nullptr;
|
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SWaylandContext {
|
struct WaylandContext {
|
||||||
wl_display* display = nullptr;
|
wl_display* display = nullptr;
|
||||||
wl_registry* registry = nullptr;
|
wl_registry* registry = nullptr;
|
||||||
wl_compositor* compositor = nullptr;
|
wl_compositor* compositor = nullptr;
|
||||||
@ -56,10 +56,10 @@ class CWaylandOpenGLDriver final : public CVideoDriver {
|
|||||||
wl_seat* seat = nullptr;
|
wl_seat* seat = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit CWaylandOpenGLDriver (CApplicationContext& context, CWallpaperApplication& app);
|
explicit WaylandOpenGLDriver (ApplicationContext& context, WallpaperApplication& app);
|
||||||
~CWaylandOpenGLDriver ();
|
~WaylandOpenGLDriver ();
|
||||||
|
|
||||||
[[nodiscard]] Output::COutput& getOutput () override;
|
[[nodiscard]] Output::Output& getOutput () override;
|
||||||
float getRenderTime () const override;
|
float getRenderTime () const override;
|
||||||
bool closeRequested () override;
|
bool closeRequested () override;
|
||||||
void resizeWindow (glm::ivec2 size) override;
|
void resizeWindow (glm::ivec2 size) override;
|
||||||
@ -71,32 +71,32 @@ class CWaylandOpenGLDriver final : public CVideoDriver {
|
|||||||
void dispatchEventQueue () override;
|
void dispatchEventQueue () override;
|
||||||
[[nodiscard]] void* getProcAddress (const char* name) const override;
|
[[nodiscard]] void* getProcAddress (const char* name) const override;
|
||||||
|
|
||||||
void onLayerClose (Output::CWaylandOutputViewport*);
|
void onLayerClose (Output::WaylandOutputViewport*);
|
||||||
Output::CWaylandOutputViewport* surfaceToViewport (const wl_surface*);
|
Output::WaylandOutputViewport* surfaceToViewport (const wl_surface*);
|
||||||
|
|
||||||
Output::CWaylandOutputViewport* viewportInFocus = nullptr;
|
Output::WaylandOutputViewport* viewportInFocus = nullptr;
|
||||||
|
|
||||||
[[nodiscard]] SEGLContext* getEGLContext ();
|
[[nodiscard]] SEGLContext* getEGLContext ();
|
||||||
[[nodiscard]] SWaylandContext* getWaylandContext ();
|
[[nodiscard]] WaylandContext* getWaylandContext ();
|
||||||
|
|
||||||
/** List of available screens */
|
/** List of available screens */
|
||||||
std::vector<Output::CWaylandOutputViewport*> m_screens = {};
|
std::vector<Output::WaylandOutputViewport*> m_screens = {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The output used by the driver */
|
/** The output used by the driver */
|
||||||
Output::CWaylandOutput m_output;
|
Output::WaylandOutput m_output;
|
||||||
/** The EGL context in use */
|
/** The EGL context in use */
|
||||||
SEGLContext m_eglContext = {};
|
SEGLContext m_eglContext = {};
|
||||||
/** The Wayland context in use */
|
/** The Wayland context in use */
|
||||||
SWaylandContext m_waylandContext = {};
|
WaylandContext m_waylandContext = {};
|
||||||
mutable bool m_requestedExit;
|
mutable bool m_requestedExit;
|
||||||
|
|
||||||
void initEGL ();
|
void initEGL ();
|
||||||
void finishEGL () const;
|
void finishEGL () const;
|
||||||
|
|
||||||
uint32_t m_frameCounter = 0;
|
uint32_t m_frameCounter = 0;
|
||||||
CApplicationContext& m_context;
|
ApplicationContext& m_context;
|
||||||
CWaylandMouseInput m_mouseInput;
|
WaylandMouseInput m_mouseInput;
|
||||||
|
|
||||||
std::chrono::high_resolution_clock::time_point renderStart = std::chrono::high_resolution_clock::now ();
|
std::chrono::high_resolution_clock::time_point renderStart = std::chrono::high_resolution_clock::now ();
|
||||||
};
|
};
|
@ -1,15 +1,15 @@
|
|||||||
#include "CFBOProvider.h"
|
#include "FBOProvider.h"
|
||||||
#include <gmpxx.h>
|
#include <gmpxx.h>
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
|
|
||||||
CFBOProvider::CFBOProvider (const CFBOProvider* parent) :
|
FBOProvider::FBOProvider (const FBOProvider* parent) :
|
||||||
m_parent (parent) {}
|
m_parent (parent) {}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<CFBO> CFBOProvider::create(const FBO& base, uint32_t flags, glm::vec2 size) {
|
std::shared_ptr<CFBO> FBOProvider::create(const FBO& base, uint32_t flags, glm::vec2 size) {
|
||||||
return this->m_fbos[base.name] = std::make_shared <CFBO> (
|
return this->m_fbos[base.name] = std::make_shared <CFBO> (
|
||||||
base.name,
|
base.name,
|
||||||
// TODO: PROPERLY DETERMINE FBO FORMAT BASED ON THE STRING
|
// TODO: PROPERLY DETERMINE FBO FORMAT BASED ON THE STRING
|
||||||
@ -23,7 +23,7 @@ std::shared_ptr<CFBO> CFBOProvider::create(const FBO& base, uint32_t flags, glm:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CFBO> CFBOProvider::create (
|
std::shared_ptr<CFBO> FBOProvider::create (
|
||||||
const std::string& name, TextureFormat format, uint32_t flags, float scale,
|
const std::string& name, TextureFormat format, uint32_t flags, float scale,
|
||||||
glm::vec2 realSize, glm::vec2 textureSize
|
glm::vec2 realSize, glm::vec2 textureSize
|
||||||
) {
|
) {
|
||||||
@ -39,11 +39,11 @@ std::shared_ptr<CFBO> CFBOProvider::create (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CFBO> CFBOProvider::alias (const std::string& newName, const std::string& original) {
|
std::shared_ptr<CFBO> FBOProvider::alias (const std::string& newName, const std::string& original) {
|
||||||
return this->m_fbos[newName] = this->m_fbos[original];
|
return this->m_fbos[newName] = this->m_fbos[original];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CFBO> CFBOProvider::find (const std::string& name) const {
|
std::shared_ptr<CFBO> FBOProvider::find (const std::string& name) const {
|
||||||
const auto it = this->m_fbos.find (name);
|
const auto it = this->m_fbos.find (name);
|
||||||
|
|
||||||
if (it != this->m_fbos.end ())
|
if (it != this->m_fbos.end ())
|
@ -8,9 +8,9 @@
|
|||||||
namespace WallpaperEngine::Render {
|
namespace WallpaperEngine::Render {
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
class CFBOProvider {
|
class FBOProvider {
|
||||||
public:
|
public:
|
||||||
CFBOProvider (const CFBOProvider* parent);
|
explicit FBOProvider (const FBOProvider* parent);
|
||||||
|
|
||||||
std::shared_ptr<CFBO> create (const FBO& base, uint32_t flags, glm::vec2 size);
|
std::shared_ptr<CFBO> create (const FBO& base, uint32_t flags, glm::vec2 size);
|
||||||
std::shared_ptr<CFBO> create (
|
std::shared_ptr<CFBO> create (
|
||||||
@ -20,7 +20,7 @@ class CFBOProvider {
|
|||||||
[[nodiscard]] std::shared_ptr<CFBO> find (const std::string& name) const;
|
[[nodiscard]] std::shared_ptr<CFBO> find (const std::string& name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CFBOProvider* m_parent;
|
const FBOProvider* m_parent;
|
||||||
std::map <std::string, std::shared_ptr<CFBO>> m_fbos = {};
|
std::map <std::string, std::shared_ptr<CFBO>> m_fbos = {};
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -1,13 +0,0 @@
|
|||||||
#include "CContextAware.h"
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Helpers {
|
|
||||||
CContextAware::CContextAware (const CContextAware& from) : CContextAware (from.getContext ()) {}
|
|
||||||
|
|
||||||
CContextAware::CContextAware (const CContextAware* from) : CContextAware (from->getContext ()) {}
|
|
||||||
|
|
||||||
CContextAware::CContextAware (CRenderContext& context) : m_context (context) {}
|
|
||||||
|
|
||||||
CRenderContext& CContextAware::getContext () const {
|
|
||||||
return this->m_context;
|
|
||||||
}
|
|
||||||
} // namespace WallpaperEngine::Render::Helpers
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user