1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add exit function for cleanup

This commit is contained in:
Elias Steurer 2023-10-12 16:01:27 +02:00
parent 5f331043e2
commit 757b43e8c2
4 changed files with 26 additions and 17 deletions

View File

@ -307,7 +307,7 @@ bool ScreenPlayManager::removeAllWallpapers()
bool ScreenPlayManager::removeAllWidgets()
{
if (m_screenPlayWidgets.empty()) {
qWarning() << "Trying to remove all Widgets while m_screenPlayWidgets is not empty. Count: " << m_screenPlayWidgets.size();
qWarning() << "Trying to remove all Widgets while m_screenPlayWidgets is empty. Count: " << m_screenPlayWidgets.size();
return false;
}

View File

@ -21,7 +21,9 @@ void ScreenPlayGodotWallpaper::_bind_methods()
ClassDB::bind_method(godot::D_METHOD("send_welcome"), &ScreenPlayGodotWallpaper::send_welcome);
ClassDB::bind_method(godot::D_METHOD("get_screenPlayConnected"), &ScreenPlayGodotWallpaper::get_screenPlayConnected);
ClassDB::bind_method(godot::D_METHOD("get_pipeConnected"), &ScreenPlayGodotWallpaper::get_pipeConnected);
ClassDB::bind_method(godot::D_METHOD("read_from_pipe"), &ScreenPlayGodotWallpaper::read_from_pipe);
ClassDB::bind_method(godot::D_METHOD("ping_alive_screenplay"), &ScreenPlayGodotWallpaper::ping_alive_screenplay);
ClassDB::bind_method(godot::D_METHOD("exit"), &ScreenPlayGodotWallpaper::exit);
ClassDB::bind_method(godot::D_METHOD("get_activeScreensList"), &ScreenPlayGodotWallpaper::get_activeScreensList);
ClassDB::bind_method(godot::D_METHOD("set_activeScreensList", "screens"), &ScreenPlayGodotWallpaper::set_activeScreensList);
@ -63,22 +65,6 @@ ScreenPlayGodotWallpaper::~ScreenPlayGodotWallpaper()
UtilityFunctions::print(
"ScreenPlayWallpaper ", itos(mID),
" destroyed, current instance count: ", itos(sInstanceCount));
// Somehow this gets called at editor startup
// so just return if not initialized
if (m_hook) {
ShowWindow(m_hook->windowHandle, SW_HIDE);
// Force refresh so that we display the regular
// desktop wallpaper again
ShowWindow(m_hook->windowHandleWorker, SW_HIDE);
ShowWindow(m_hook->windowHandleWorker, SW_SHOW);
}
// Destructor
if (m_hPipe != INVALID_HANDLE_VALUE) {
CloseHandle(m_hPipe);
}
}
bool ScreenPlayGodotWallpaper::configureWindowGeometry()
@ -285,6 +271,26 @@ bool ScreenPlayGodotWallpaper::get_pipeConnected() const
{
return m_pipeConnected;
}
bool ScreenPlayGodotWallpaper::exit()
{
// Somehow this gets called at editor startup
// so just return if not initialized
if (m_hook) {
ShowWindow(m_hook->windowHandle, SW_HIDE);
// Force refresh so that we display the regular
// desktop wallpaper again
ShowWindow(m_hook->windowHandleWorker, SW_HIDE);
ShowWindow(m_hook->windowHandleWorker, SW_SHOW);
}
// Destructor
if (m_hPipe != INVALID_HANDLE_VALUE) {
CloseHandle(m_hPipe);
}
return true;
}
bool ScreenPlayGodotWallpaper::get_checkWallpaperVisible() const
{
return m_checkWallpaperVisible;

View File

@ -41,6 +41,7 @@ public:
bool get_screenPlayConnected() const;
bool get_pipeConnected() const;
bool ping_alive_screenplay();
bool exit();
protected:
static void _bind_methods();

View File

@ -10,6 +10,8 @@ func ping_alive_screenplay():
if not msg.isEmpty():
print("message", msg)
if "quit" in msg:
var exit = screen_play_wallpaper.exit()
print("exit ", exit)
get_tree().quit()
return