mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Add support for disabling mouse interactions with the background (#176)
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
89612ea6c2
commit
21c38d9fd1
@ -27,6 +27,7 @@ struct option long_options[] = {
|
|||||||
{ "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' },
|
{ "no-fullscreen-pause", no_argument, nullptr, 'n' },
|
||||||
|
{ "disable-mouse", no_argument, nullptr, 'e' },
|
||||||
{ nullptr, 0, nullptr, 0 }
|
{ nullptr, 0, nullptr, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,6 +73,10 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
|||||||
.volume = 15,
|
.volume = 15,
|
||||||
.automute = true
|
.automute = true
|
||||||
},
|
},
|
||||||
|
.mouse =
|
||||||
|
{
|
||||||
|
.enabled = true,
|
||||||
|
},
|
||||||
.screenshot =
|
.screenshot =
|
||||||
{
|
{
|
||||||
.take = false,
|
.take = false,
|
||||||
@ -185,6 +190,10 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
|
|||||||
this->settings.audio.automute = false;
|
this->settings.audio.automute = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'e':
|
||||||
|
this->settings.mouse.enabled = false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sLog.out ("Default on path parsing: ", optarg);
|
sLog.out ("Default on path parsing: ", optarg);
|
||||||
break;
|
break;
|
||||||
@ -280,4 +289,5 @@ void CApplicationContext::printHelp (const char* route)
|
|||||||
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");
|
sLog.out ("\t--no-fullscreen-pause\tPrevents the background pausing when an app is fullscreen");
|
||||||
|
sLog.out ("\t--disable-mouse\tDisables mouse interactions");
|
||||||
}
|
}
|
@ -84,6 +84,15 @@ namespace WallpaperEngine::Application
|
|||||||
bool automute;
|
bool automute;
|
||||||
} audio;
|
} audio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouse input settings
|
||||||
|
*/
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/** If the mouse movement is enabled */
|
||||||
|
bool enabled;
|
||||||
|
} mouse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screenshot settings
|
* Screenshot settings
|
||||||
*/
|
*/
|
||||||
|
@ -20,5 +20,10 @@ namespace WallpaperEngine::Application
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
int volume;
|
int volume;
|
||||||
} audio{};
|
} audio{};
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
} mouse{};
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ namespace WallpaperEngine::Input
|
|||||||
/**
|
/**
|
||||||
* The virtual pointer's position
|
* The virtual pointer's position
|
||||||
*/
|
*/
|
||||||
virtual glm::dvec2 position () const = 0;
|
[[nodiscard]] virtual glm::dvec2 position () const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,12 @@ CGLFWMouseInput::CGLFWMouseInput (Render::Drivers::CX11OpenGLDriver* driver) :
|
|||||||
|
|
||||||
void CGLFWMouseInput::update ()
|
void CGLFWMouseInput::update ()
|
||||||
{
|
{
|
||||||
|
if (!this->m_driver->getApp ().getContext ().settings.mouse.enabled)
|
||||||
|
{
|
||||||
|
this->m_reportedPosition = {0, 0};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// update current mouse position
|
// update current mouse position
|
||||||
glfwGetCursorPos (this->m_driver->getWindow (), &this->m_mousePosition.x, &this->m_mousePosition.y);
|
glfwGetCursorPos (this->m_driver->getWindow (), &this->m_mousePosition.x, &this->m_mousePosition.y);
|
||||||
// interpolate to the new position
|
// interpolate to the new position
|
||||||
|
@ -27,7 +27,7 @@ namespace WallpaperEngine::Input::Drivers
|
|||||||
/**
|
/**
|
||||||
* The virtual pointer's position
|
* The virtual pointer's position
|
||||||
*/
|
*/
|
||||||
glm::dvec2 position () const override;
|
[[nodiscard]] glm::dvec2 position () const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Render::Drivers::CX11OpenGLDriver* m_driver;
|
Render::Drivers::CX11OpenGLDriver* m_driver;
|
||||||
|
@ -14,6 +14,11 @@ void CWaylandMouseInput::update ()
|
|||||||
|
|
||||||
glm::dvec2 CWaylandMouseInput::position() const
|
glm::dvec2 CWaylandMouseInput::position() const
|
||||||
{
|
{
|
||||||
|
if (!this->waylandDriver->getApp().getContext ().settings.mouse.enabled)
|
||||||
|
{
|
||||||
|
return {0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
if (waylandDriver->viewportInFocus && waylandDriver->viewportInFocus->rendering)
|
if (waylandDriver->viewportInFocus && waylandDriver->viewportInFocus->rendering)
|
||||||
return waylandDriver->viewportInFocus->mousePos;
|
return waylandDriver->viewportInFocus->mousePos;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace WallpaperEngine::Input::Drivers
|
|||||||
/**
|
/**
|
||||||
* The virtual pointer's position
|
* The virtual pointer's position
|
||||||
*/
|
*/
|
||||||
glm::dvec2 position () const override;
|
[[nodiscard]] glm::dvec2 position () const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
#include "WallpaperEngine/Render/Drivers/CVideoDriver.h"
|
||||||
#include "WallpaperEngine/Application/CApplicationContext.h"
|
#include "WallpaperEngine/Application/CApplicationContext.h"
|
||||||
|
#include "WallpaperEngine/Application/CWallpaperApplication.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutputViewport.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutputViewport.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
#include "WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user