mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
chore: renamed members not properly named
This commit is contained in:
parent
d652691088
commit
4dbb3cc422
@ -28,17 +28,17 @@ CWallpaperApplication::CWallpaperApplication (CApplicationContext& context,
|
|||||||
WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext) :
|
WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext) :
|
||||||
m_context (context),
|
m_context (context),
|
||||||
m_defaultBackground (nullptr),
|
m_defaultBackground (nullptr),
|
||||||
browserContext (browserContext) {
|
m_browserContext (browserContext) {
|
||||||
this->loadBackgrounds ();
|
this->loadBackgrounds ();
|
||||||
this->setupProperties ();
|
this->setupProperties ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWallpaperApplication::~CWallpaperApplication () {
|
CWallpaperApplication::~CWallpaperApplication () {
|
||||||
delete context;
|
delete m_renderContext;
|
||||||
delete videoDriver;
|
delete m_videoDriver;
|
||||||
delete audioContext;
|
delete m_audioContext;
|
||||||
delete audioDriver;
|
delete m_audioDriver;
|
||||||
delete inputContext;
|
delete m_inputContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::setupContainer (CCombinedContainer& container, const std::string& bg) const {
|
void CWallpaperApplication::setupContainer (CCombinedContainer& container, const std::string& bg) const {
|
||||||
@ -211,18 +211,17 @@ void CWallpaperApplication::setupProperties () {
|
|||||||
this->setupPropertiesForProject (this->m_defaultBackground);
|
this->setupPropertiesForProject (this->m_defaultBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::takeScreenshot (const Render::CRenderContext& context,
|
void CWallpaperApplication::takeScreenshot (const std::filesystem::path& filename, FREE_IMAGE_FORMAT format) {
|
||||||
const std::filesystem::path& filename, FREE_IMAGE_FORMAT format) {
|
|
||||||
// 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 = context.getOutput ().getFullWidth ();
|
const int width = this->m_renderContext->getOutput ().getFullWidth ();
|
||||||
const int height = context.getOutput ().getFullHeight ();
|
const int height = this->m_renderContext->getOutput ().getFullHeight ();
|
||||||
|
|
||||||
// build the output file with FreeImage
|
// build the output file with FreeImage
|
||||||
static FIBITMAP* bitmap = FreeImage_Allocate (width, height, 24);
|
static FIBITMAP* bitmap = FreeImage_Allocate (width, height, 24);
|
||||||
RGBQUAD color;
|
RGBQUAD color;
|
||||||
int xoffset = 0;
|
int xoffset = 0;
|
||||||
|
|
||||||
for (const auto& [screen, viewport] : context.getOutput ().getViewports ()) {
|
for (const auto& [screen, viewport] : this->m_renderContext->getOutput ().getViewports ()) {
|
||||||
// activate opengl context so we can read from the framebuffer
|
// activate opengl context so we can read from the framebuffer
|
||||||
viewport->makeCurrent ();
|
viewport->makeCurrent ();
|
||||||
// make room for storing the pixel of this viewport
|
// make room for storing the pixel of this viewport
|
||||||
@ -242,7 +241,7 @@ void CWallpaperApplication::takeScreenshot (const Render::CRenderContext& contex
|
|||||||
|
|
||||||
// set the pixel in the destination
|
// set the pixel in the destination
|
||||||
FreeImage_SetPixelColor (bitmap, x + xoffset,
|
FreeImage_SetPixelColor (bitmap, x + xoffset,
|
||||||
context.getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y, &color);
|
this->m_renderContext->getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y, &color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,11 +276,11 @@ void CWallpaperApplication::show () {
|
|||||||
if (this->m_context.settings.render.mode == CApplicationContext::DESKTOP_BACKGROUND) {
|
if (this->m_context.settings.render.mode == CApplicationContext::DESKTOP_BACKGROUND) {
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
if (isWayland) {
|
if (isWayland) {
|
||||||
videoDriver = new WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver (this->m_context, *this);
|
m_videoDriver = new WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver (this->m_context, *this);
|
||||||
inputContext =
|
m_inputContext =
|
||||||
new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CWaylandMouseInput (
|
new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CWaylandMouseInput (
|
||||||
reinterpret_cast<WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver*> (videoDriver)));
|
reinterpret_cast<WallpaperEngine::Render::Drivers::CWaylandOpenGLDriver*> (m_videoDriver)));
|
||||||
this->fullScreenDetector =
|
this->m_fullScreenDetector =
|
||||||
new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector (this->m_context);
|
new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector (this->m_context);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WAYLAND
|
#endif // ENABLE_WAYLAND
|
||||||
@ -290,13 +289,13 @@ void CWallpaperApplication::show () {
|
|||||||
else
|
else
|
||||||
#endif // ENABLE_WAYLAND
|
#endif // ENABLE_WAYLAND
|
||||||
if (isX11) {
|
if (isX11) {
|
||||||
videoDriver =
|
m_videoDriver =
|
||||||
new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
||||||
inputContext =
|
m_inputContext =
|
||||||
new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CGLFWMouseInput (
|
new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CGLFWMouseInput (
|
||||||
reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (videoDriver)));
|
reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (m_videoDriver)));
|
||||||
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (
|
this->m_fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (
|
||||||
this->m_context, *reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (videoDriver));
|
this->m_context, *reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (m_videoDriver));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_X11
|
#endif // ENABLE_X11
|
||||||
else {
|
else {
|
||||||
@ -304,12 +303,12 @@ void CWallpaperApplication::show () {
|
|||||||
"Cannot run in background mode, window server could not be detected. XDG_SESSION_TYPE must be wayland or x11");
|
"Cannot run in background mode, window server could not be detected. XDG_SESSION_TYPE must be wayland or x11");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
videoDriver =
|
m_videoDriver =
|
||||||
new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
new WallpaperEngine::Render::Drivers::CGLFWOpenGLDriver ("wallpaperengine", this->m_context, *this);
|
||||||
|
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
if (isWayland) {
|
if (isWayland) {
|
||||||
this->fullScreenDetector =
|
this->m_fullScreenDetector =
|
||||||
new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector (this->m_context);
|
new WallpaperEngine::Render::Drivers::Detectors::CWaylandFullScreenDetector (this->m_context);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WAYLAND
|
#endif // ENABLE_WAYLAND
|
||||||
@ -318,54 +317,54 @@ void CWallpaperApplication::show () {
|
|||||||
else
|
else
|
||||||
#endif // ENABLE_WAYLAND
|
#endif // ENABLE_WAYLAND
|
||||||
if (isX11) {
|
if (isX11) {
|
||||||
this->fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (
|
this->m_fullScreenDetector = new WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector (
|
||||||
this->m_context, *reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (videoDriver));
|
this->m_context, *reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (m_videoDriver));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_X11
|
#endif // ENABLE_X11
|
||||||
else {
|
else {
|
||||||
this->fullScreenDetector =
|
this->m_fullScreenDetector =
|
||||||
new WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector (this->m_context);
|
new WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector (this->m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inputContext = new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CGLFWMouseInput (
|
m_inputContext = new WallpaperEngine::Input::CInputContext (new WallpaperEngine::Input::Drivers::CGLFWMouseInput (
|
||||||
reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (videoDriver)));
|
reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (m_videoDriver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->m_context.settings.audio.audioprocessing) {
|
if (this->m_context.settings.audio.audioprocessing) {
|
||||||
this->audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder ();
|
this->m_audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder ();
|
||||||
} else {
|
} else {
|
||||||
this->audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder ();
|
this->m_audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// audio playing detector
|
// audio playing detector
|
||||||
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (this->m_context,
|
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (this->m_context,
|
||||||
*this->fullScreenDetector);
|
*this->m_fullScreenDetector);
|
||||||
// initialize sdl audio driver
|
// initialize sdl audio driver
|
||||||
audioDriver =
|
m_audioDriver =
|
||||||
new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, *this->audioRecorder);
|
new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, *this->m_audioRecorder);
|
||||||
// initialize audio context
|
// initialize audio context
|
||||||
audioContext = new WallpaperEngine::Audio::CAudioContext (*audioDriver);
|
m_audioContext = new WallpaperEngine::Audio::CAudioContext (*m_audioDriver);
|
||||||
// initialize render context
|
// initialize render context
|
||||||
context = new WallpaperEngine::Render::CRenderContext (*videoDriver, *inputContext, *this);
|
m_renderContext = new WallpaperEngine::Render::CRenderContext (*m_videoDriver, *m_inputContext, *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
|
||||||
for (const auto& [background, info] : this->m_backgrounds) {
|
for (const auto& [background, info] : this->m_backgrounds) {
|
||||||
context->setWallpaper (background, WallpaperEngine::Render::CWallpaper::fromWallpaper (
|
m_renderContext->setWallpaper (background, WallpaperEngine::Render::CWallpaper::fromWallpaper (
|
||||||
info->getWallpaper (), *context, *audioContext, browserContext,
|
info->getWallpaper (), *m_renderContext, *m_audioContext, m_browserContext,
|
||||||
this->m_context.settings.general.screenScalings [background]));
|
this->m_context.settings.general.screenScalings [background]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// wallpapers are setup, free browsesr context if possible
|
// wallpapers are setup, free browsesr context if possible
|
||||||
if (!this->browserContext.isUsed ()) {
|
if (!this->m_browserContext.isUsed ()) {
|
||||||
this->browserContext.stop ();
|
this->m_browserContext.stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t seconds;
|
static time_t seconds;
|
||||||
static struct tm* timeinfo;
|
static struct tm* timeinfo;
|
||||||
|
|
||||||
while (this->m_context.state.general.keepRunning && !videoDriver->closeRequested ()) {
|
while (this->m_context.state.general.keepRunning && !m_videoDriver->closeRequested ()) {
|
||||||
// update g_Daytime
|
// update g_Daytime
|
||||||
time (&seconds);
|
time (&seconds);
|
||||||
timeinfo = localtime (&seconds);
|
timeinfo = localtime (&seconds);
|
||||||
@ -374,18 +373,18 @@ void CWallpaperApplication::show () {
|
|||||||
// keep track of the previous frame's time
|
// keep track of the previous frame's time
|
||||||
g_TimeLast = g_Time;
|
g_TimeLast = g_Time;
|
||||||
// calculate the current time value
|
// calculate the current time value
|
||||||
g_Time = videoDriver->getRenderTime ();
|
g_Time = m_videoDriver->getRenderTime ();
|
||||||
// update audio recorder
|
// update audio recorder
|
||||||
audioDriver->update ();
|
m_audioDriver->update ();
|
||||||
// update input information
|
// update input information
|
||||||
inputContext->update ();
|
m_inputContext->update ();
|
||||||
// process driver events
|
// process driver events
|
||||||
videoDriver->dispatchEventQueue ();
|
m_videoDriver->dispatchEventQueue ();
|
||||||
|
|
||||||
if (!this->m_context.settings.screenshot.take || videoDriver->getFrameCounter () < 5)
|
if (!this->m_context.settings.screenshot.take || m_videoDriver->getFrameCounter () < 5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this->takeScreenshot (*context, this->m_context.settings.screenshot.path,
|
this->takeScreenshot (this->m_context.settings.screenshot.path,
|
||||||
this->m_context.settings.screenshot.format);
|
this->m_context.settings.screenshot.format);
|
||||||
this->m_context.settings.screenshot.take = false;
|
this->m_context.settings.screenshot.take = false;
|
||||||
}
|
}
|
||||||
@ -400,11 +399,11 @@ void CWallpaperApplication::show () {
|
|||||||
|
|
||||||
void CWallpaperApplication::update (Render::Drivers::Output::COutputViewport* viewport) {
|
void CWallpaperApplication::update (Render::Drivers::Output::COutputViewport* viewport) {
|
||||||
// check for fullscreen windows and wait until there's none fullscreen
|
// check for fullscreen windows and wait until there's none fullscreen
|
||||||
while (this->fullScreenDetector->anythingFullscreen () && this->m_context.state.general.keepRunning)
|
while (this->m_fullScreenDetector->anythingFullscreen () && this->m_context.state.general.keepRunning)
|
||||||
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
||||||
|
|
||||||
// render the scene
|
// render the scene
|
||||||
context->render (viewport);
|
m_renderContext->render (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallpaperApplication::signal (int signal) {
|
void CWallpaperApplication::signal (int signal) {
|
||||||
@ -424,6 +423,6 @@ CApplicationContext& CWallpaperApplication::getContext () const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const WallpaperEngine::Render::Drivers::Output::COutput& CWallpaperApplication::getOutput () const {
|
const WallpaperEngine::Render::Drivers::Output::COutput& CWallpaperApplication::getOutput () const {
|
||||||
return this->context->getOutput ();
|
return this->m_renderContext->getOutput ();
|
||||||
}
|
}
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
@ -112,8 +112,7 @@ class CWallpaperApplication {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param format
|
* @param format
|
||||||
*/
|
*/
|
||||||
static void takeScreenshot (const Render::CRenderContext& context, const std::filesystem::path& filename,
|
void takeScreenshot (const std::filesystem::path& filename, FREE_IMAGE_FORMAT format);
|
||||||
FREE_IMAGE_FORMAT format);
|
|
||||||
|
|
||||||
/** The default background to display if no specific background was loaded */
|
/** The default background to display if no specific background was loaded */
|
||||||
Core::CProject* m_defaultBackground;
|
Core::CProject* m_defaultBackground;
|
||||||
@ -122,13 +121,13 @@ class CWallpaperApplication {
|
|||||||
/** Maps screens to backgrounds */
|
/** Maps screens to backgrounds */
|
||||||
std::map<std::string, Core::CProject*> m_backgrounds;
|
std::map<std::string, Core::CProject*> m_backgrounds;
|
||||||
|
|
||||||
WallpaperEngine::Audio::CAudioContext* audioContext;
|
WallpaperEngine::Audio::CAudioContext* m_audioContext;
|
||||||
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* audioDriver;
|
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* m_audioDriver;
|
||||||
WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder* audioRecorder;
|
WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder* m_audioRecorder;
|
||||||
WallpaperEngine::Input::CInputContext* inputContext;
|
WallpaperEngine::Input::CInputContext* m_inputContext;
|
||||||
WallpaperEngine::Render::CRenderContext* context;
|
WallpaperEngine::Render::CRenderContext* m_renderContext;
|
||||||
WallpaperEngine::Render::Drivers::CVideoDriver* videoDriver;
|
WallpaperEngine::Render::Drivers::CVideoDriver* m_videoDriver;
|
||||||
WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector* fullScreenDetector;
|
WallpaperEngine::Render::Drivers::Detectors::CFullScreenDetector* m_fullScreenDetector;
|
||||||
WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext;
|
WallpaperEngine::WebBrowser::CWebBrowserContext& m_browserContext;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Application
|
} // namespace WallpaperEngine::Application
|
||||||
|
Loading…
Reference in New Issue
Block a user