summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-11 16:34:32 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-11 16:42:31 -0300
commitb7d69c2444354e526e4112d9c65423e9fd311f27 (patch)
tree42249b9c4928059efd074ab886b5ef36dc947563 /scene
parent7bf4b592f806caeb9112d026bc650889e509e930 (diff)
Added a BACK notification besides QUIT, so they go in separate channels.
Diffstat (limited to 'scene')
-rw-r--r--scene/main/scene_main_loop.cpp15
-rw-r--r--scene/main/scene_main_loop.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 487b740c34..d233bf1a72 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -498,6 +498,7 @@ void SceneTree::init() {
//_quit=false;
accept_quit=true;
+ quit_on_go_back=true;
initialized=true;
input_handled=false;
@@ -646,6 +647,15 @@ void SceneTree::_notification(int p_notification) {
break;
}
} break;
+ case NOTIFICATION_WM_GO_BACK_REQUEST: {
+
+ get_root()->propagate_notification(p_notification);
+
+ if (quit_on_go_back) {
+ _quit=true;
+ break;
+ }
+ } break;
case NOTIFICATION_OS_MEMORY_WARNING:
case NOTIFICATION_WM_FOCUS_IN:
case NOTIFICATION_WM_FOCUS_OUT: {
@@ -672,6 +682,11 @@ void SceneTree::set_auto_accept_quit(bool p_enable) {
accept_quit=p_enable;
}
+void SceneTree::set_quit_on_go_back(bool p_enable) {
+
+ quit_on_go_back=p_enable;
+}
+
void SceneTree::set_editor_hint(bool p_enabled) {
editor_hint=p_enabled;
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index 164ffe2ef7..9de4abe81e 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -107,6 +107,7 @@ private:
float fixed_process_time;
float idle_process_time;
bool accept_quit;
+ bool quit_on_go_back;
uint32_t last_id;
bool editor_hint;
@@ -353,6 +354,7 @@ public:
virtual void finish();
void set_auto_accept_quit(bool p_enable);
+ void set_quit_on_go_back(bool p_enable);
void quit();