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:
parent
5f331043e2
commit
757b43e8c2
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
bool get_screenPlayConnected() const;
|
||||
bool get_pipeConnected() const;
|
||||
bool ping_alive_screenplay();
|
||||
bool exit();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user