forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close all docs correctly even in case of exception (fix aseprite#3162)
- Loading branch information
Showing
10 changed files
with
165 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Aseprite UI Library | ||
// Copyright (C) 2022 Igara Studio S.A. | ||
// | ||
// This file is released under the terms of the MIT license. | ||
// Read LICENSE.txt for more information. | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "ui/app_state.h" | ||
|
||
#include "ui/manager.h" | ||
|
||
namespace ui { | ||
|
||
AppState g_state = AppState::kNormal; | ||
|
||
void set_app_state(AppState state) | ||
{ | ||
g_state = state; | ||
|
||
if (state == AppState::kClosingWithException) { | ||
if (auto man = ui::Manager::getDefault()) | ||
man->_closingAppWithException(); | ||
} | ||
} | ||
|
||
AppState get_app_state() | ||
{ | ||
return g_state; | ||
} | ||
|
||
bool is_app_state_closing() | ||
{ | ||
return (g_state == AppState::kClosing || | ||
g_state == AppState::kClosingWithException); | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Aseprite UI Library | ||
// Copyright (C) 2022 Igara Studio S.A. | ||
// | ||
// This file is released under the terms of the MIT license. | ||
// Read LICENSE.txt for more information. | ||
|
||
#ifndef UI_APP_STATE_H_INCLUDED | ||
#define UI_APP_STATE_H_INCLUDED | ||
#pragma once | ||
|
||
namespace ui { | ||
|
||
enum AppState { | ||
kNormal, | ||
kClosing, | ||
kClosingWithException, | ||
}; | ||
|
||
void set_app_state(AppState state); | ||
AppState get_app_state(); | ||
bool is_app_state_closing(); | ||
|
||
} // namespace ui | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters