mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-16 22:32:25 +08:00
Added parameter to configure fullscreen detection
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
9a5913921c
commit
13e43bada7
@ -26,6 +26,7 @@ struct option long_options[] = {
|
|||||||
{ "list-properties", no_argument, nullptr, 'l' },
|
{ "list-properties", no_argument, nullptr, 'l' },
|
||||||
{ "set-property", required_argument, nullptr, 'o' },
|
{ "set-property", required_argument, nullptr, 'o' },
|
||||||
{ "noautomute", no_argument, nullptr, 'm' },
|
{ "noautomute", no_argument, nullptr, 'm' },
|
||||||
|
{ "no-fullscreen-pause", no_argument,nullptr, 'n' },
|
||||||
{ nullptr, 0, nullptr, 0 }
|
{ nullptr, 0, nullptr, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
.mode = NORMAL_WINDOW,
|
.mode = NORMAL_WINDOW,
|
||||||
.maximumFPS = 30,
|
.maximumFPS = 30,
|
||||||
|
.pauseOnFullscreen = true,
|
||||||
.window = { .geometry = {}},
|
.window = { .geometry = {}},
|
||||||
},
|
},
|
||||||
.audio =
|
.audio =
|
||||||
@ -82,10 +84,14 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
|||||||
|
|
||||||
std::string lastScreen;
|
std::string lastScreen;
|
||||||
|
|
||||||
while ((c = getopt_long (argc, argv, "b:r:p:d:shf:a:w:m", long_options, nullptr)) != -1)
|
while ((c = getopt_long (argc, argv, "b:r:p:d:shf:a:w:mn", long_options, nullptr)) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
case 'n':
|
||||||
|
this->settings.render.pauseOnFullscreen = false;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
if (lastScreen.empty ())
|
if (lastScreen.empty ())
|
||||||
sLog.exception ("--bg has to go after a --screen-root argument");
|
sLog.exception ("--bg has to go after a --screen-root argument");
|
||||||
@ -178,6 +184,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
|||||||
case 'm':
|
case 'm':
|
||||||
this->settings.audio.automute = false;
|
this->settings.audio.automute = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sLog.out ("Default on path parsing: ", optarg);
|
sLog.out ("Default on path parsing: ", optarg);
|
||||||
break;
|
break;
|
||||||
@ -272,4 +279,5 @@ void CApplicationContext::printHelp (const char* route)
|
|||||||
sLog.out ("\t--screenshot\t\t\t\tTakes a screenshot of the background");
|
sLog.out ("\t--screenshot\t\t\t\tTakes a screenshot of the background");
|
||||||
sLog.out ("\t--list-properties\t\t\tList all the available properties and their possible values");
|
sLog.out ("\t--list-properties\t\t\tList all the available properties and their possible values");
|
||||||
sLog.out ("\t--set-property <name=value>\tOverrides the default value of the given property");
|
sLog.out ("\t--set-property <name=value>\tOverrides the default value of the given property");
|
||||||
|
sLog.out ("\t--no-fullscreen-pause\tPrevents the background pausing when an app is fullscreen");
|
||||||
}
|
}
|
@ -61,6 +61,8 @@ namespace WallpaperEngine::Application
|
|||||||
WINDOW_MODE mode;
|
WINDOW_MODE mode;
|
||||||
/** Maximum FPS */
|
/** Maximum FPS */
|
||||||
int maximumFPS;
|
int maximumFPS;
|
||||||
|
/** Indicates if pausing should happen when something goes fullscreen */
|
||||||
|
bool pauseOnFullscreen;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ namespace WallpaperEngine::Application
|
|||||||
// output requested
|
// output requested
|
||||||
WallpaperEngine::Render::Drivers::Output::COutput* output;
|
WallpaperEngine::Render::Drivers::Output::COutput* output;
|
||||||
// fullscreen detector is common for the different render modes
|
// fullscreen detector is common for the different render modes
|
||||||
WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector fullscreenDetector (videoDriver);
|
WallpaperEngine::Render::Drivers::Detectors::CX11FullScreenDetector fullscreenDetector (this->m_context, videoDriver);
|
||||||
// stereo mix recorder for audio processing
|
// stereo mix recorder for audio processing
|
||||||
WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder audioRecorder;
|
WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder audioRecorder;
|
||||||
// audio playing detector
|
// audio playing detector
|
||||||
|
@ -1 +1,14 @@
|
|||||||
#include "CFullScreenDetector.h"
|
#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;
|
||||||
|
}
|
@ -1,10 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WallpaperEngine/Application/CApplicationContext.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Drivers::Detectors
|
namespace WallpaperEngine::Render::Drivers::Detectors
|
||||||
{
|
{
|
||||||
class CFullScreenDetector
|
class CFullScreenDetector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CFullScreenDetector (Application::CApplicationContext& appContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If anything is fullscreen
|
* @return If anything is fullscreen
|
||||||
*/
|
*/
|
||||||
@ -14,5 +18,12 @@ namespace WallpaperEngine::Render::Drivers::Detectors
|
|||||||
* Restarts the fullscreen detector, specially useful if there's any resources tied to the output driver
|
* Restarts the fullscreen detector, specially useful if there's any resources tied to the output driver
|
||||||
*/
|
*/
|
||||||
virtual void reset () = 0;
|
virtual void reset () = 0;
|
||||||
|
/**
|
||||||
|
* @return The application context using this detector
|
||||||
|
*/
|
||||||
|
[[nodiscard]] Application::CApplicationContext& getApplicationContext () const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Application::CApplicationContext& m_applicationContext;
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -31,7 +31,8 @@ namespace WallpaperEngine::Render::Drivers::Detectors
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CX11FullScreenDetector::CX11FullScreenDetector (CVideoDriver& driver) :
|
CX11FullScreenDetector::CX11FullScreenDetector (Application::CApplicationContext& appContext, CVideoDriver& driver) :
|
||||||
|
CFullScreenDetector (appContext),
|
||||||
m_driver (driver)
|
m_driver (driver)
|
||||||
{
|
{
|
||||||
// do not use previous handler, it might stop the app under weird circumstances
|
// do not use previous handler, it might stop the app under weird circumstances
|
||||||
@ -51,6 +52,9 @@ namespace WallpaperEngine::Render::Drivers::Detectors
|
|||||||
|
|
||||||
bool CX11FullScreenDetector::anythingFullscreen () const
|
bool CX11FullScreenDetector::anythingFullscreen () const
|
||||||
{
|
{
|
||||||
|
if (!this->getApplicationContext ().settings.render.pauseOnFullscreen)
|
||||||
|
return false;
|
||||||
|
|
||||||
// stop rendering if anything is fullscreen
|
// stop rendering if anything is fullscreen
|
||||||
bool isFullscreen = false;
|
bool isFullscreen = false;
|
||||||
XWindowAttributes attribs;
|
XWindowAttributes attribs;
|
||||||
|
@ -14,7 +14,7 @@ namespace WallpaperEngine::Render::Drivers::Detectors
|
|||||||
class CX11FullScreenDetector : public CFullScreenDetector
|
class CX11FullScreenDetector : public CFullScreenDetector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CX11FullScreenDetector (CVideoDriver& driver);
|
CX11FullScreenDetector (Application::CApplicationContext& appContext, CVideoDriver& driver);
|
||||||
~CX11FullScreenDetector ();
|
~CX11FullScreenDetector ();
|
||||||
|
|
||||||
[[nodiscard]] bool anythingFullscreen () const override;
|
[[nodiscard]] bool anythingFullscreen () const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user