mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
Added application state to keep track of enable/disable audio and volume changes when things go fullscreen
Removed .clang-format as it's not useful Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
f499454957
commit
84f6018e1a
@ -1,66 +0,0 @@
|
||||
# Generated from CLion C/C++ Code Style settings
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignOperands: Align
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Always
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterUnion: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
ColumnLimit: 0
|
||||
CompactNamespaces: false
|
||||
ContinuationIndentWidth: 8
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: All
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PointerAlignment: Left
|
||||
ReflowComments: false
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: Always
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 0
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
TabWidth: 4
|
||||
UseTab: ForContinuationAndIndentation
|
2
main.cpp
2
main.cpp
@ -29,7 +29,7 @@ int main (int argc, char* argv[])
|
||||
WallpaperEngine::Application::CWallpaperApplication app (appContext);
|
||||
|
||||
// halt if the list-properties option was specified
|
||||
if (appContext.general.onlyListProperties)
|
||||
if (appContext.settings.general.onlyListProperties)
|
||||
return 0;
|
||||
|
||||
appPointer = &app;
|
||||
|
@ -47,30 +47,33 @@ std::string stringPathFixes (const std::string& s)
|
||||
CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
{
|
||||
// setup structs with sane default values for now
|
||||
this->general =
|
||||
this->settings =
|
||||
{
|
||||
.onlyListProperties = false,
|
||||
.assets = "",
|
||||
.defaultBackground = "",
|
||||
.screenBackgrounds = {},
|
||||
.properties = {},
|
||||
};
|
||||
this->render =
|
||||
{
|
||||
.mode = NORMAL_WINDOW,
|
||||
.maximumFPS = 30,
|
||||
.window = { .geometry = {}},
|
||||
};
|
||||
this->audio =
|
||||
{
|
||||
.enabled = true,
|
||||
.volume = 127,
|
||||
};
|
||||
this->screenshot =
|
||||
{
|
||||
.take = false,
|
||||
.path = "",
|
||||
.format = FIF_UNKNOWN,
|
||||
.general =
|
||||
{
|
||||
.onlyListProperties = false,
|
||||
.assets = "",
|
||||
.defaultBackground = "",
|
||||
.screenBackgrounds = {},
|
||||
.properties = {},
|
||||
},
|
||||
.render =
|
||||
{
|
||||
.mode = NORMAL_WINDOW,
|
||||
.maximumFPS = 30,
|
||||
.window = { .geometry = {}},
|
||||
},
|
||||
.audio =
|
||||
{
|
||||
.enabled = true,
|
||||
.volume = 127,
|
||||
},
|
||||
.screenshot =
|
||||
{
|
||||
.take = false,
|
||||
.path = "",
|
||||
.format = FIF_UNKNOWN,
|
||||
},
|
||||
};
|
||||
|
||||
int c;
|
||||
@ -87,7 +90,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
|
||||
// no need to check for previous screen being in the list, as it's the only way for this variable
|
||||
// to have any value
|
||||
this->general.screenBackgrounds[lastScreen] = translateBackground (optarg);
|
||||
this->settings.general.screenBackgrounds[lastScreen] = translateBackground (optarg);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
@ -97,56 +100,56 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
|
||||
// properties without value are treated as booleans for now
|
||||
if (equals == std::string::npos)
|
||||
this->general.properties[value] = "1";
|
||||
this->settings.general.properties[value] = "1";
|
||||
else
|
||||
this->general.properties[value.substr (0, equals)] = value.substr (equals + 1);
|
||||
this->settings.general.properties[value.substr (0, equals)] = value.substr (equals + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
this->general.onlyListProperties = true;
|
||||
this->settings.general.onlyListProperties = true;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
if (this->general.screenBackgrounds.find (optarg) != this->general.screenBackgrounds.end ())
|
||||
if (this->settings.general.screenBackgrounds.find (optarg) != this->settings.general.screenBackgrounds.end ())
|
||||
sLog.exception ("Cannot specify the same screen more than once: ", optarg);
|
||||
if (this->render.mode == EXPLICIT_WINDOW)
|
||||
if (this->settings.render.mode == EXPLICIT_WINDOW)
|
||||
sLog.exception ("Cannot run in both background and window mode");
|
||||
|
||||
this->render.mode = X11_BACKGROUND;
|
||||
this->settings.render.mode = X11_BACKGROUND;
|
||||
lastScreen = optarg;
|
||||
this->general.screenBackgrounds[lastScreen] = "";
|
||||
this->settings.general.screenBackgrounds[lastScreen] = "";
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
if (this->render.mode == X11_BACKGROUND)
|
||||
if (this->settings.render.mode == X11_BACKGROUND)
|
||||
sLog.exception ("Cannot run in both background and window mode");
|
||||
|
||||
if (optarg != nullptr)
|
||||
{
|
||||
this->render.mode = EXPLICIT_WINDOW;
|
||||
this->settings.render.mode = EXPLICIT_WINDOW;
|
||||
// read window geometry
|
||||
char* pos = optarg;
|
||||
|
||||
if (pos != nullptr)
|
||||
this->render.window.geometry.x = atoi (pos);
|
||||
this->settings.render.window.geometry.x = atoi (pos);
|
||||
if ((pos = strchr (pos, '.')) != nullptr)
|
||||
this->render.window.geometry.y = atoi (pos + 1);
|
||||
this->settings.render.window.geometry.y = atoi (pos + 1);
|
||||
if ((pos = strchr (pos + 1, '.')) != nullptr)
|
||||
this->render.window.geometry.z = atoi (pos + 1);
|
||||
this->settings.render.window.geometry.z = atoi (pos + 1);
|
||||
if ((pos = strchr (pos + 1, '.')) != nullptr)
|
||||
this->render.window.geometry.w = atoi (pos + 1);
|
||||
this->settings.render.window.geometry.w = atoi (pos + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 'd':
|
||||
sLog.error ("--dir/--pkg is deprecated and not used anymore");
|
||||
this->general.defaultBackground = translateBackground (stringPathFixes (optarg));
|
||||
this->settings.general.defaultBackground = translateBackground (stringPathFixes (optarg));
|
||||
break;
|
||||
|
||||
case 's':
|
||||
this->audio.enabled = false;
|
||||
this->settings.audio.enabled = false;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
@ -154,20 +157,20 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
this->render.maximumFPS = atoi (optarg);
|
||||
this->settings.render.maximumFPS = atoi (optarg);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
this->general.assets = stringPathFixes (optarg);
|
||||
this->settings.general.assets = stringPathFixes (optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
this->audio.volume = std::max (atoi (optarg), 128);
|
||||
this->settings.audio.volume = std::max (atoi (optarg), 128);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
this->screenshot.take = true;
|
||||
this->screenshot.path = stringPathFixes (optarg);
|
||||
this->settings.screenshot.take = true;
|
||||
this->settings.screenshot.path = stringPathFixes (optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -176,11 +179,11 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (this->general.defaultBackground.empty ())
|
||||
if (this->settings.general.defaultBackground.empty ())
|
||||
{
|
||||
if (optind < argc && strlen (argv[optind]) > 0)
|
||||
{
|
||||
this->general.defaultBackground = translateBackground (argv[optind]);
|
||||
this->settings.general.defaultBackground = translateBackground (argv[optind]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -191,6 +194,11 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
||||
// perform some extra validation on the inputs
|
||||
this->validateAssets ();
|
||||
this->validateScreenshot ();
|
||||
|
||||
// setup application state
|
||||
this->state.general.keepRunning = true;
|
||||
this->state.audio.enabled = this->settings.audio.enabled;
|
||||
this->state.audio.volume = this->settings.audio.volume;
|
||||
}
|
||||
|
||||
std::filesystem::path CApplicationContext::translateBackground (const std::string& bgIdOrPath)
|
||||
@ -203,15 +211,15 @@ std::filesystem::path CApplicationContext::translateBackground (const std::strin
|
||||
|
||||
void CApplicationContext::validateAssets ()
|
||||
{
|
||||
if (!this->general.assets.empty ())
|
||||
if (!this->settings.general.assets.empty ())
|
||||
{
|
||||
sLog.out ("Using wallpaper engine's assets at ", this->general.assets, " based on --assets-dir parameter");
|
||||
sLog.out ("Using wallpaper engine's assets at ", this->settings.general.assets, " based on --assets-dir parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this->general.assets = Steam::FileSystem::appDirectory (APP_DIRECTORY, "assets");
|
||||
this->settings.general.assets = Steam::FileSystem::appDirectory (APP_DIRECTORY, "assets");
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
@ -222,20 +230,20 @@ void CApplicationContext::validateAssets ()
|
||||
|
||||
void CApplicationContext::validateScreenshot ()
|
||||
{
|
||||
if (!this->screenshot.take)
|
||||
if (!this->settings.screenshot.take)
|
||||
return;
|
||||
|
||||
if (!this->screenshot.path.has_extension ())
|
||||
if (!this->settings.screenshot.path.has_extension ())
|
||||
sLog.exception ("Cannot determine screenshot format");
|
||||
|
||||
std::string extension = this->screenshot.path.extension ();
|
||||
std::string extension = this->settings.screenshot.path.extension ();
|
||||
|
||||
if (extension == ".bmp")
|
||||
this->screenshot.format = FIF_BMP;
|
||||
this->settings.screenshot.format = FIF_BMP;
|
||||
else if (extension == ".png")
|
||||
this->screenshot.format = FIF_PNG;
|
||||
this->settings.screenshot.format = FIF_PNG;
|
||||
else if (extension == ".jpg" || extension == ".jpeg")
|
||||
this->screenshot.format = FIF_JPEG;
|
||||
this->settings.screenshot.format = FIF_JPEG;
|
||||
else
|
||||
sLog.exception ("Cannot determine screenshot format, unknown extension ", extension);
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
#include <FreeImage.h>
|
||||
|
||||
#include "CApplicationState.h"
|
||||
|
||||
namespace WallpaperEngine::Application
|
||||
{
|
||||
/**
|
||||
@ -21,105 +23,79 @@ namespace WallpaperEngine::Application
|
||||
|
||||
enum WINDOW_MODE
|
||||
{
|
||||
/**
|
||||
* Default window mode
|
||||
*/
|
||||
/** Default window mode */
|
||||
NORMAL_WINDOW = 0,
|
||||
/**
|
||||
* Draw to X11 background
|
||||
*/
|
||||
/** Draw to X11 background */
|
||||
X11_BACKGROUND = 1,
|
||||
/**
|
||||
* Explicit window mode with specified geometry
|
||||
*/
|
||||
/** Explicit window mode with specified geometry */
|
||||
EXPLICIT_WINDOW = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* General settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* If the user requested a list of properties for the given background
|
||||
*/
|
||||
bool onlyListProperties;
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* General settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/** If the user requested a list of properties for the given background */
|
||||
bool onlyListProperties;
|
||||
|
||||
/**
|
||||
* The path to the assets folder
|
||||
*/
|
||||
std::filesystem::path assets;
|
||||
/**
|
||||
* Background to load (provided as the final argument) as fallback for multi-screen setups
|
||||
*/
|
||||
std::filesystem::path defaultBackground;
|
||||
/** The path to the assets folder */
|
||||
std::filesystem::path assets;
|
||||
/** Background to load (provided as the final argument) as fallback for multi-screen setups */
|
||||
std::filesystem::path defaultBackground;
|
||||
|
||||
/**
|
||||
* The backgrounds specified for different screens
|
||||
*/
|
||||
std::map <std::string, std::filesystem::path> screenBackgrounds;
|
||||
/**
|
||||
* Properties to change values for
|
||||
*/
|
||||
std::map <std::string, std::string> properties;
|
||||
} general;
|
||||
/** The backgrounds specified for different screens */
|
||||
std::map <std::string, std::filesystem::path> screenBackgrounds;
|
||||
/** Properties to change values for */
|
||||
std::map <std::string, std::string> properties;
|
||||
} general;
|
||||
|
||||
/**
|
||||
* Render settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* The mode to run the background in
|
||||
*/
|
||||
WINDOW_MODE mode;
|
||||
/**
|
||||
* Maximum FPS
|
||||
*/
|
||||
int maximumFPS;
|
||||
/**
|
||||
* Render settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/** The mode to run the background in */
|
||||
WINDOW_MODE mode;
|
||||
/** Maximum FPS */
|
||||
int maximumFPS;
|
||||
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* The window size used in explicit window
|
||||
*/
|
||||
glm::ivec4 geometry;
|
||||
} window;
|
||||
} render;
|
||||
struct
|
||||
{
|
||||
/** The window size used in explicit window */
|
||||
glm::ivec4 geometry;
|
||||
} window;
|
||||
} render;
|
||||
|
||||
/**
|
||||
* Audio settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* If the audio system is enabled
|
||||
*/
|
||||
bool enabled;
|
||||
/**
|
||||
* Sound volume (0-128)
|
||||
*/
|
||||
int volume;
|
||||
} audio;
|
||||
/**
|
||||
* Audio settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/** If the audio system is enabled */
|
||||
bool enabled;
|
||||
/** Sound volume (0-128) */
|
||||
int volume;
|
||||
} audio;
|
||||
|
||||
/**
|
||||
* Screenshot settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/** If an screenshot should be taken */
|
||||
bool take;
|
||||
/** The path to where the screenshot must be saved */
|
||||
std::filesystem::path path;
|
||||
/** The image format */
|
||||
FREE_IMAGE_FORMAT format;
|
||||
} screenshot;
|
||||
} settings;
|
||||
|
||||
CApplicationState state;
|
||||
|
||||
/**
|
||||
* Screenshot settings
|
||||
*/
|
||||
struct
|
||||
{
|
||||
/**
|
||||
* If an screenshot should be taken
|
||||
*/
|
||||
bool take;
|
||||
/**
|
||||
* The path to where the screenshot must be saved
|
||||
*/
|
||||
std::filesystem::path path;
|
||||
/**
|
||||
* The image format
|
||||
*/
|
||||
FREE_IMAGE_FORMAT format;
|
||||
} screenshot;
|
||||
private:
|
||||
/**
|
||||
* Validates the assets folder and ensures a valid one is present
|
||||
|
1
src/WallpaperEngine/Application/CApplicationState.cpp
Normal file
1
src/WallpaperEngine/Application/CApplicationState.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "CApplicationState.h"
|
24
src/WallpaperEngine/Application/CApplicationState.h
Normal file
24
src/WallpaperEngine/Application/CApplicationState.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "CApplicationContext.h"
|
||||
|
||||
namespace WallpaperEngine::Application
|
||||
{
|
||||
/**
|
||||
* Represents current application state
|
||||
*/
|
||||
class CApplicationState
|
||||
{
|
||||
public:
|
||||
struct
|
||||
{
|
||||
bool keepRunning;
|
||||
} general{};
|
||||
|
||||
struct
|
||||
{
|
||||
bool enabled;
|
||||
int volume;
|
||||
} audio{};
|
||||
};
|
||||
}
|
@ -9,14 +9,12 @@
|
||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
||||
#include "WallpaperEngine/Render/Drivers/Output/CGLFWWindowOutput.h"
|
||||
#include "WallpaperEngine/Render/Drivers/Output/CX11Output.h"
|
||||
#include "WallpaperEngine/Application/CApplicationState.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
float g_Time;
|
||||
float g_TimeLast;
|
||||
bool g_KeepRunning = true;
|
||||
bool g_AudioEnabled = true;
|
||||
int g_AudioVolume = 128;
|
||||
|
||||
namespace WallpaperEngine::Application
|
||||
{
|
||||
@ -24,9 +22,6 @@ namespace WallpaperEngine::Application
|
||||
m_context (context),
|
||||
m_defaultBackground (nullptr)
|
||||
{
|
||||
// copy state to global variables for now
|
||||
g_AudioVolume = context.audio.volume;
|
||||
g_AudioEnabled = context.audio.enabled;
|
||||
this->loadBackgrounds ();
|
||||
this->setupProperties ();
|
||||
}
|
||||
@ -38,7 +33,7 @@ namespace WallpaperEngine::Application
|
||||
container.add (new CDirectory (basepath));
|
||||
container.addPkg (basepath / "scene.pkg");
|
||||
container.addPkg (basepath / "gifscene.pkg");
|
||||
container.add (new CDirectory (this->m_context.general.assets));
|
||||
container.add (new CDirectory (this->m_context.settings.general.assets));
|
||||
|
||||
// add two possible patches directories to the container
|
||||
// hopefully one sticks
|
||||
@ -171,7 +166,7 @@ namespace WallpaperEngine::Application
|
||||
|
||||
void CWallpaperApplication::loadBackgrounds ()
|
||||
{
|
||||
for (const auto& it : this->m_context.general.screenBackgrounds)
|
||||
for (const auto& it : this->m_context.settings.general.screenBackgrounds)
|
||||
{
|
||||
// ignore the screen settings if there was no background specified
|
||||
// the default will be used
|
||||
@ -182,8 +177,8 @@ namespace WallpaperEngine::Application
|
||||
}
|
||||
|
||||
// load the default project if required
|
||||
if (!this->m_context.general.defaultBackground.empty ())
|
||||
this->m_defaultBackground = this->loadBackground (this->m_context.general.defaultBackground);
|
||||
if (!this->m_context.settings.general.defaultBackground.empty ())
|
||||
this->m_defaultBackground = this->loadBackground (this->m_context.settings.general.defaultBackground);
|
||||
}
|
||||
|
||||
Core::CProject* CWallpaperApplication::loadBackground (const std::string& bg)
|
||||
@ -201,16 +196,16 @@ namespace WallpaperEngine::Application
|
||||
for (auto cur : project->getProperties ())
|
||||
{
|
||||
// update the value of the property
|
||||
auto override = this->m_context.general.properties.find (cur->getName ());
|
||||
auto override = this->m_context.settings.general.properties.find (cur->getName ());
|
||||
|
||||
if (override != this->m_context.general.properties.end ())
|
||||
if (override != this->m_context.settings.general.properties.end ())
|
||||
{
|
||||
sLog.out ("Applying override value for ", cur->getName ());
|
||||
|
||||
cur->update (override->second);
|
||||
}
|
||||
|
||||
if (this->m_context.general.onlyListProperties)
|
||||
if (this->m_context.settings.general.onlyListProperties)
|
||||
sLog.out (cur->dump ());
|
||||
}
|
||||
}
|
||||
@ -265,15 +260,12 @@ namespace WallpaperEngine::Application
|
||||
delete[] buffer;
|
||||
|
||||
FreeImage_Unload (bitmap);
|
||||
|
||||
// unbind the textures
|
||||
glBindTexture (GL_TEXTURE_2D, GL_NONE);
|
||||
}
|
||||
|
||||
void CWallpaperApplication::show ()
|
||||
{
|
||||
// initialize sdl audio driver
|
||||
WallpaperEngine::Audio::Drivers::CSDLAudioDriver audioDriver;
|
||||
WallpaperEngine::Audio::Drivers::CSDLAudioDriver audioDriver (this->m_context);
|
||||
// initialize audio context
|
||||
WallpaperEngine::Audio::CAudioContext audioContext (audioDriver);
|
||||
// initialize OpenGL driver
|
||||
@ -284,16 +276,16 @@ namespace WallpaperEngine::Application
|
||||
WallpaperEngine::Render::Drivers::Output::COutput* output;
|
||||
|
||||
// initialize the requested output
|
||||
switch (this->m_context.render.mode)
|
||||
switch (this->m_context.settings.render.mode)
|
||||
{
|
||||
case CApplicationContext::EXPLICIT_WINDOW:
|
||||
case CApplicationContext::NORMAL_WINDOW:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CGLFWWindowOutput (this->m_context, videoDriver);
|
||||
break;
|
||||
case CApplicationContext::EXPLICIT_WINDOW:
|
||||
case CApplicationContext::NORMAL_WINDOW:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CGLFWWindowOutput (this->m_context, videoDriver);
|
||||
break;
|
||||
|
||||
case CApplicationContext::X11_BACKGROUND:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CX11Output (this->m_context, videoDriver);
|
||||
break;
|
||||
case CApplicationContext::X11_BACKGROUND:
|
||||
output = new WallpaperEngine::Render::Drivers::Output::CX11Output (this->m_context, videoDriver);
|
||||
break;
|
||||
}
|
||||
|
||||
// initialize render context
|
||||
@ -312,9 +304,9 @@ namespace WallpaperEngine::Application
|
||||
this->m_defaultBackground->getWallpaper (), context, audioContext
|
||||
));
|
||||
|
||||
float startTime, endTime, minimumTime = 1.0f / this->m_context.render.maximumFPS;
|
||||
float startTime, endTime, minimumTime = 1.0f / this->m_context.settings.render.maximumFPS;
|
||||
|
||||
while (!videoDriver.closeRequested () && g_KeepRunning)
|
||||
while (!videoDriver.closeRequested () && this->m_context.state.general.keepRunning)
|
||||
{
|
||||
// update input information
|
||||
inputContext.update ();
|
||||
@ -333,16 +325,16 @@ namespace WallpaperEngine::Application
|
||||
if ((endTime - startTime) < minimumTime)
|
||||
usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
|
||||
|
||||
if (!this->m_context.screenshot.take || videoDriver.getFrameCounter () != 5)
|
||||
if (!this->m_context.settings.screenshot.take || videoDriver.getFrameCounter () != 5)
|
||||
continue;
|
||||
|
||||
this->takeScreenshot (context, this->m_context.screenshot.path, this->m_context.screenshot.format);
|
||||
this->takeScreenshot (context, this->m_context.settings.screenshot.path, this->m_context.settings.screenshot.format);
|
||||
// disable screenshot just in case the counter overflows
|
||||
this->m_context.screenshot.take = false;
|
||||
this->m_context.settings.screenshot.take = false;
|
||||
}
|
||||
|
||||
// ensure this is updated as sometimes it might not come from a signal
|
||||
g_KeepRunning = false;
|
||||
this->m_context.state.general.keepRunning = false;
|
||||
|
||||
sLog.out ("Stop requested");
|
||||
|
||||
@ -351,7 +343,7 @@ namespace WallpaperEngine::Application
|
||||
|
||||
void CWallpaperApplication::signal (int signal)
|
||||
{
|
||||
g_KeepRunning = false;
|
||||
this->m_context.state.general.keepRunning = false;
|
||||
}
|
||||
|
||||
const std::map<std::string, Core::CProject*>& CWallpaperApplication::getBackgrounds () const
|
||||
@ -363,4 +355,9 @@ namespace WallpaperEngine::Application
|
||||
{
|
||||
return this->m_defaultBackground;
|
||||
}
|
||||
|
||||
CApplicationContext& CWallpaperApplication::getContext () const
|
||||
{
|
||||
return this->m_context;
|
||||
}
|
||||
}
|
@ -40,6 +40,10 @@ namespace WallpaperEngine::Application
|
||||
* @return The default background to use if no specific project is loaded
|
||||
*/
|
||||
[[nodiscard]] Core::CProject* getDefaultBackground () const;
|
||||
/**
|
||||
* @return The current application context
|
||||
*/
|
||||
[[nodiscard]] CApplicationContext& getContext () const;
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -79,17 +83,11 @@ namespace WallpaperEngine::Application
|
||||
*/
|
||||
static void takeScreenshot (const Render::CRenderContext& context, const std::filesystem::path& filename, 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;
|
||||
/**
|
||||
* The application context that contains the current app settings
|
||||
*/
|
||||
/** The application context that contains the current app settings */
|
||||
CApplicationContext& m_context;
|
||||
/**
|
||||
* Maps screens to backgrounds
|
||||
*/
|
||||
/** Maps screens to backgrounds */
|
||||
std::map <std::string, Core::CProject*> m_backgrounds;
|
||||
};
|
||||
}
|
||||
|
@ -1,30 +1,35 @@
|
||||
#include "CAudioContext.h"
|
||||
#include "WallpaperEngine/Audio/Drivers/CAudioDriver.h"
|
||||
|
||||
using namespace WallpaperEngine::Audio;
|
||||
using namespace WallpaperEngine::Audio::Drivers;
|
||||
|
||||
CAudioContext::CAudioContext (CAudioDriver& driver) :
|
||||
m_driver (driver)
|
||||
namespace WallpaperEngine::Audio
|
||||
{
|
||||
}
|
||||
CAudioContext::CAudioContext (Drivers::CAudioDriver& driver) :
|
||||
m_driver (driver)
|
||||
{
|
||||
}
|
||||
|
||||
void CAudioContext::addStream (CAudioStream* stream)
|
||||
{
|
||||
this->m_driver.addStream (stream);
|
||||
}
|
||||
void CAudioContext::addStream (CAudioStream* stream)
|
||||
{
|
||||
this->m_driver.addStream (stream);
|
||||
}
|
||||
|
||||
AVSampleFormat CAudioContext::getFormat () const
|
||||
{
|
||||
return this->m_driver.getFormat ();
|
||||
}
|
||||
AVSampleFormat CAudioContext::getFormat () const
|
||||
{
|
||||
return this->m_driver.getFormat ();
|
||||
}
|
||||
|
||||
int CAudioContext::getSampleRate () const
|
||||
{
|
||||
return this->m_driver.getSampleRate ();
|
||||
}
|
||||
int CAudioContext::getSampleRate () const
|
||||
{
|
||||
return this->m_driver.getSampleRate ();
|
||||
}
|
||||
|
||||
int CAudioContext::getChannels () const
|
||||
{
|
||||
return this->m_driver.getChannels ();
|
||||
int CAudioContext::getChannels () const
|
||||
{
|
||||
return this->m_driver.getChannels ();
|
||||
}
|
||||
|
||||
Application::CApplicationContext& CAudioContext::getApplicationContext ()
|
||||
{
|
||||
return this->m_driver.getApplicationContext ();
|
||||
}
|
||||
}
|
@ -3,44 +3,58 @@
|
||||
#include <libavutil/samplefmt.h>
|
||||
#include <vector>
|
||||
|
||||
namespace WallpaperEngine::Audio::Drivers
|
||||
{
|
||||
class CAudioDriver;
|
||||
}
|
||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
||||
|
||||
namespace WallpaperEngine::Audio
|
||||
namespace WallpaperEngine
|
||||
{
|
||||
class CAudioStream;
|
||||
|
||||
class CAudioContext
|
||||
namespace Application
|
||||
{
|
||||
public:
|
||||
explicit CAudioContext (Drivers::CAudioDriver& driver);
|
||||
class CApplicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given stream in the driver for playing
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void addStream (CAudioStream* stream);
|
||||
namespace Audio
|
||||
{
|
||||
namespace Drivers
|
||||
{
|
||||
class CAudioDriver;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
||||
*
|
||||
* @return The audio format the driver supports
|
||||
*/
|
||||
[[nodiscard]] AVSampleFormat getFormat () const;
|
||||
/**
|
||||
* @return The sample rate the driver supports
|
||||
*/
|
||||
[[nodiscard]] int getSampleRate () const;
|
||||
/**
|
||||
* @return The channels the driver supports
|
||||
*/
|
||||
[[nodiscard]] int getChannels () const;
|
||||
class CAudioStream;
|
||||
|
||||
private:
|
||||
/** The audio driver in use */
|
||||
Drivers::CAudioDriver& m_driver;
|
||||
};
|
||||
class CAudioContext
|
||||
{
|
||||
public:
|
||||
explicit CAudioContext (Drivers::CAudioDriver& driver);
|
||||
|
||||
/**
|
||||
* Registers the given stream in the driver for playing
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void addStream (CAudioStream* stream);
|
||||
|
||||
/**
|
||||
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
||||
*
|
||||
* @return The audio format the driver supports
|
||||
*/
|
||||
[[nodiscard]] AVSampleFormat getFormat () const;
|
||||
/**
|
||||
* @return The sample rate the driver supports
|
||||
*/
|
||||
[[nodiscard]] int getSampleRate () const;
|
||||
/**
|
||||
* @return The channels the driver supports
|
||||
*/
|
||||
[[nodiscard]] int getChannels () const;
|
||||
/**
|
||||
* @return The application context under which the audio driver is initialized
|
||||
*/
|
||||
Application::CApplicationContext& getApplicationContext ();
|
||||
|
||||
private:
|
||||
/** The audio driver in use */
|
||||
Drivers::CAudioDriver& m_driver;
|
||||
};
|
||||
}
|
||||
}
|
@ -8,22 +8,19 @@
|
||||
#define MAX_QUEUE_SIZE (5 * 1024 * 1024)
|
||||
#define MIN_FRAMES 25
|
||||
|
||||
extern int g_AudioVolume;
|
||||
extern bool g_KeepRunning;
|
||||
|
||||
using namespace WallpaperEngine::Audio;
|
||||
|
||||
int audio_read_thread (void* arg)
|
||||
{
|
||||
SDL_mutex* waitMutex = SDL_CreateMutex ();
|
||||
CAudioStream* stream = static_cast <CAudioStream*> (arg);
|
||||
auto* stream = static_cast <CAudioStream*> (arg);
|
||||
AVPacket* packet = av_packet_alloc ();
|
||||
int ret = 0;
|
||||
|
||||
if (waitMutex == nullptr)
|
||||
sLog.exception ("Cannot create mutex for audio playback waiting");
|
||||
|
||||
while (ret >= 0 && g_KeepRunning)
|
||||
while (ret >= 0 && stream->getAudioContext ().getApplicationContext ().state.general.keepRunning)
|
||||
{
|
||||
// give the cpu some time to play the queued frames if there's enough info there
|
||||
if (
|
||||
@ -322,7 +319,7 @@ void CAudioStream::dequeuePacket (AVPacket* output)
|
||||
|
||||
SDL_LockMutex (this->m_queue->mutex);
|
||||
|
||||
while (g_KeepRunning)
|
||||
while (this->m_audioContext.getApplicationContext ().state.general.keepRunning)
|
||||
{
|
||||
|
||||
#if FF_API_FIFO_OLD_API
|
||||
@ -620,7 +617,7 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize)
|
||||
}
|
||||
|
||||
// block until there's any data in the buffers
|
||||
while (g_KeepRunning) {
|
||||
while (this->m_audioContext.getApplicationContext ().state.general.keepRunning) {
|
||||
while (audio_pkt_size > 0) {
|
||||
int got_frame = 0;
|
||||
int ret = avcodec_receive_frame(this->getContext (), avFrame);
|
||||
@ -669,4 +666,9 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CAudioContext& CAudioStream::getAudioContext () const
|
||||
{
|
||||
return this->m_audioContext;
|
||||
}
|
@ -43,6 +43,11 @@ namespace WallpaperEngine::Audio
|
||||
*/
|
||||
void dequeuePacket (AVPacket* output);
|
||||
|
||||
/**
|
||||
* @return The audio context in use for this audio stream
|
||||
*/
|
||||
CAudioContext& getAudioContext () const;
|
||||
|
||||
/**
|
||||
* @return to the codec context, which provides information on the audio stream's format
|
||||
*/
|
||||
|
@ -1,4 +1,14 @@
|
||||
#include "CAudioDriver.h"
|
||||
|
||||
using namespace WallpaperEngine::Audio;
|
||||
using namespace WallpaperEngine::Audio::Drivers;
|
||||
namespace WallpaperEngine::Audio::Drivers
|
||||
{
|
||||
CAudioDriver::CAudioDriver (Application::CApplicationContext& applicationContext) :
|
||||
m_applicationContext (applicationContext)
|
||||
{
|
||||
}
|
||||
|
||||
Application::CApplicationContext& CAudioDriver::getApplicationContext ()
|
||||
{
|
||||
return this->m_applicationContext;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
||||
#include "WallpaperEngine/Audio/CAudioStream.h"
|
||||
|
||||
namespace WallpaperEngine::Audio
|
||||
@ -9,34 +10,61 @@ namespace WallpaperEngine::Audio
|
||||
class CAudioStream;
|
||||
}
|
||||
|
||||
namespace WallpaperEngine::Audio::Drivers
|
||||
namespace WallpaperEngine::Application
|
||||
{
|
||||
/**
|
||||
* Base class for audio driver implementations
|
||||
*/
|
||||
class CAudioDriver
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Registers the given stream in the driver for playing
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
virtual void addStream (CAudioStream* stream) = 0;
|
||||
class CApplicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
||||
*
|
||||
* @return The audio format the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual AVSampleFormat getFormat () const = 0;
|
||||
/**
|
||||
* @return The sample rate the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual int getSampleRate () const = 0;
|
||||
/**
|
||||
* @return The channels the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual int getChannels () const = 0;
|
||||
};
|
||||
namespace WallpaperEngine
|
||||
{
|
||||
namespace Application
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
namespace Audio
|
||||
{
|
||||
class CAudioStream;
|
||||
|
||||
namespace Drivers
|
||||
{
|
||||
/**
|
||||
* Base class for audio driver implementations
|
||||
*/
|
||||
class CAudioDriver
|
||||
{
|
||||
public:
|
||||
explicit CAudioDriver (Application::CApplicationContext& applicationContext);
|
||||
|
||||
/**
|
||||
* Registers the given stream in the driver for playing
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
virtual void addStream (CAudioStream* stream) = 0;
|
||||
|
||||
/**
|
||||
* TODO: MAYBE THIS SHOULD BE OUR OWN DEFINITIONS INSTEAD OF LIBRARY SPECIFIC ONES?
|
||||
*
|
||||
* @return The audio format the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual AVSampleFormat getFormat () const = 0;
|
||||
/**
|
||||
* @return The sample rate the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual int getSampleRate () const = 0;
|
||||
/**
|
||||
* @return The channels the driver supports
|
||||
*/
|
||||
[[nodiscard]] virtual int getChannels () const = 0;
|
||||
/**
|
||||
* @return The application context under which the audio driver is initialized
|
||||
*/
|
||||
Application::CApplicationContext& getApplicationContext ();
|
||||
|
||||
private:
|
||||
Application::CApplicationContext& m_applicationContext;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -4,9 +4,6 @@
|
||||
#define SDL_AUDIO_BUFFER_SIZE 4096
|
||||
#define MAX_AUDIO_FRAME_SIZE 192000
|
||||
|
||||
extern int g_AudioVolume;
|
||||
extern bool g_KeepRunning;
|
||||
|
||||
using namespace WallpaperEngine::Audio;
|
||||
using namespace WallpaperEngine::Audio::Drivers;
|
||||
|
||||
@ -34,7 +31,7 @@ void audio_callback (void* userdata, uint8_t* streamData, int length)
|
||||
continue;
|
||||
}
|
||||
|
||||
while (streamLength > 0 && g_KeepRunning)
|
||||
while (streamLength > 0 && driver->getApplicationContext ().state.general.keepRunning)
|
||||
{
|
||||
if (buffer->audio_buf_index >= buffer->audio_buf_size)
|
||||
{
|
||||
@ -63,7 +60,7 @@ void audio_callback (void* userdata, uint8_t* streamData, int length)
|
||||
// mix the audio
|
||||
SDL_MixAudioFormat (
|
||||
streamDataPointer, &buffer->audio_buf [buffer->audio_buf_index],
|
||||
driver->getSpec ().format, len1, g_AudioVolume
|
||||
driver->getSpec ().format, len1, driver->getApplicationContext ().state.audio.volume
|
||||
);
|
||||
|
||||
streamLength -= len1;
|
||||
@ -73,7 +70,8 @@ void audio_callback (void* userdata, uint8_t* streamData, int length)
|
||||
}
|
||||
}
|
||||
|
||||
CSDLAudioDriver::CSDLAudioDriver () :
|
||||
CSDLAudioDriver::CSDLAudioDriver (Application::CApplicationContext& applicationContext) :
|
||||
CAudioDriver (applicationContext),
|
||||
m_initialized (false),
|
||||
m_audioSpec ()
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ namespace WallpaperEngine::Audio::Drivers
|
||||
class CSDLAudioDriver : public CAudioDriver
|
||||
{
|
||||
public:
|
||||
CSDLAudioDriver ();
|
||||
CSDLAudioDriver (Application::CApplicationContext& applicationContext);
|
||||
~CSDLAudioDriver ();
|
||||
|
||||
/** @inheritdoc */
|
||||
|
@ -1,12 +1,8 @@
|
||||
#include "common.h"
|
||||
#include "CVideo.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
extern bool g_AudioEnabled;
|
||||
extern int g_AudioVolume;
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
@ -21,7 +17,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& aud
|
||||
m_height (16),
|
||||
m_mpvGl (nullptr)
|
||||
{
|
||||
double volume = g_AudioVolume * 100.0 / 128.0;
|
||||
double volume = this->getContext ().getApp ().getContext ().settings.audio.volume * 100.0 / 128.0;
|
||||
|
||||
// create mpv contexts
|
||||
this->m_mpv = mpv_create ();
|
||||
@ -64,7 +60,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& aud
|
||||
if (mpv_command (this->m_mpv, command) < 0)
|
||||
sLog.exception ("Cannot load video to play");
|
||||
|
||||
if (!g_AudioEnabled)
|
||||
if (!this->getContext ().getApp ().getContext ().settings.audio.enabled)
|
||||
{
|
||||
const char* mutecommand [] = {
|
||||
"set", "mute", "yes", nullptr
|
||||
|
@ -9,17 +9,17 @@ CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver
|
||||
m_driver (driver)
|
||||
{
|
||||
if (
|
||||
this->m_context.render.mode != Application::CApplicationContext::NORMAL_WINDOW &&
|
||||
this->m_context.render.mode != Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
this->m_context.settings.render.mode != Application::CApplicationContext::NORMAL_WINDOW &&
|
||||
this->m_context.settings.render.mode != Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
sLog.exception ("Initializing window output when not in output mode, how did you get here?!");
|
||||
|
||||
// window should be visible
|
||||
driver.showWindow ();
|
||||
|
||||
if (this->m_context.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
if (this->m_context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
{
|
||||
this->m_fullWidth = this->m_context.render.window.geometry.z;
|
||||
this->m_fullHeight = this->m_context.render.window.geometry.w;
|
||||
this->m_fullWidth = this->m_context.settings.render.window.geometry.z;
|
||||
this->m_fullHeight = this->m_context.settings.render.window.geometry.w;
|
||||
this->repositionWindow ();
|
||||
}
|
||||
else
|
||||
@ -36,12 +36,12 @@ CGLFWWindowOutput::CGLFWWindowOutput (CApplicationContext& context, CVideoDriver
|
||||
void CGLFWWindowOutput::repositionWindow ()
|
||||
{
|
||||
// reposition the window
|
||||
this->m_driver.resizeWindow (this->m_context.render.window.geometry);
|
||||
this->m_driver.resizeWindow (this->m_context.settings.render.window.geometry);
|
||||
}
|
||||
|
||||
void CGLFWWindowOutput::reset ()
|
||||
{
|
||||
if (this->m_context.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
if (this->m_context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW)
|
||||
this->repositionWindow ();
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ void* CGLFWWindowOutput::getImageBuffer () const
|
||||
}
|
||||
void CGLFWWindowOutput::updateRender () const
|
||||
{
|
||||
if (this->m_context.render.mode != Application::CApplicationContext::NORMAL_WINDOW)
|
||||
if (this->m_context.settings.render.mode != Application::CApplicationContext::NORMAL_WINDOW)
|
||||
return;
|
||||
|
||||
// take the size from the driver (default window size)
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
#define FULLSCREEN_CHECK_WAIT_TIME 250
|
||||
|
||||
extern bool g_KeepRunning;
|
||||
|
||||
using namespace WallpaperEngine::Render::Drivers::Output;
|
||||
|
||||
void CustomXIOErrorExitHandler (Display* dsp, void* userdata)
|
||||
@ -142,7 +140,7 @@ void CX11Output::loadScreenInfo ()
|
||||
);
|
||||
|
||||
// only keep info of registered screens
|
||||
if (this->m_context.general.screenBackgrounds.find (info->name) != this->m_context.general.screenBackgrounds.end ())
|
||||
if (this->m_context.settings.general.screenBackgrounds.find (info->name) != this->m_context.settings.general.screenBackgrounds.end ())
|
||||
{
|
||||
sLog.out ("Found requested screen: ", info->name, " -> ", crtc->x, "x", crtc->y, ":", crtc->width, "x", crtc->height);
|
||||
|
||||
@ -230,5 +228,5 @@ void CX11Output::updateRender () const
|
||||
// give the cpu some time to check again later
|
||||
usleep (FULLSCREEN_CHECK_WAIT_TIME);
|
||||
}
|
||||
while (isFullscreen && g_KeepRunning);
|
||||
while (isFullscreen && this->m_context.state.general.keepRunning);
|
||||
}
|
||||
|
@ -2,15 +2,13 @@
|
||||
|
||||
#include "CSound.h"
|
||||
|
||||
extern bool g_AudioEnabled;
|
||||
|
||||
using namespace WallpaperEngine::Render::Objects;
|
||||
|
||||
CSound::CSound (CScene* scene, Core::Objects::CSound* sound) :
|
||||
CObject (scene, Type, sound),
|
||||
m_sound (sound)
|
||||
{
|
||||
if (g_AudioEnabled)
|
||||
if (this->getScene ()->getContext ().getApp ().getContext ().settings.audio.enabled)
|
||||
this->load ();
|
||||
}
|
||||
|
||||
@ -35,7 +33,6 @@ void CSound::load ()
|
||||
|
||||
void CSound::render ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const std::string CSound::Type = "sound";
|
Loading…
Reference in New Issue
Block a user