Haiku: handle the quit request message
This commit is contained in:
parent
0038e27fc3
commit
93ac4ace0a
3 changed files with 18 additions and 19 deletions
|
@ -2,7 +2,7 @@
|
||||||
#include "haiku_direct_window.h"
|
#include "haiku_direct_window.h"
|
||||||
|
|
||||||
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame)
|
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame)
|
||||||
: BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, 0)
|
: BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
|
||||||
{
|
{
|
||||||
last_mouse_pos_valid = false;
|
last_mouse_pos_valid = false;
|
||||||
last_buttons_state = 0;
|
last_buttons_state = 0;
|
||||||
|
@ -33,10 +33,13 @@ void HaikuDirectWindow::SetInput(InputDefault* p_input) {
|
||||||
input = p_input;
|
input = p_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HaikuDirectWindow::SetMainLoop(MainLoop* p_main_loop) {
|
||||||
|
main_loop = p_main_loop;
|
||||||
|
}
|
||||||
|
|
||||||
bool HaikuDirectWindow::QuitRequested() {
|
bool HaikuDirectWindow::QuitRequested() {
|
||||||
view->EnableDirectMode(false);
|
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HaikuDirectWindow::DirectConnected(direct_buffer_info* info) {
|
void HaikuDirectWindow::DirectConnected(direct_buffer_info* info) {
|
||||||
|
@ -44,24 +47,15 @@ void HaikuDirectWindow::DirectConnected(direct_buffer_info* info) {
|
||||||
view->EnableDirectMode(true);
|
view->EnableDirectMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HaikuDirectWindow::MessageReceived(BMessage* message)
|
void HaikuDirectWindow::MessageReceived(BMessage* message) {
|
||||||
{
|
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case REDRAW_MSG:
|
case REDRAW_MSG:
|
||||||
//ERR_PRINT("iteration 1");
|
Sync();
|
||||||
Main::iteration();
|
|
||||||
|
|
||||||
//if (NeedsUpdate()) {
|
if (Main::iteration() == true) {
|
||||||
// ERR_PRINT("NEEDS UPDATE");
|
view->EnableDirectMode(false);
|
||||||
// Main::force_redraw();
|
Quit();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//ERR_PRINT("iteration 2");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case B_INVALIDATE:
|
|
||||||
ERR_PRINT("WINDOW B_INVALIDATE");
|
|
||||||
//Main::force_redraw();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -18,6 +18,7 @@ private:
|
||||||
uint32 last_buttons_state;
|
uint32 last_buttons_state;
|
||||||
int last_button_mask;
|
int last_button_mask;
|
||||||
|
|
||||||
|
MainLoop* main_loop;
|
||||||
InputDefault* input;
|
InputDefault* input;
|
||||||
HaikuGLView* view;
|
HaikuGLView* view;
|
||||||
BMessageRunner* update_runner;
|
BMessageRunner* update_runner;
|
||||||
|
@ -35,6 +36,7 @@ public:
|
||||||
void StartMessageRunner();
|
void StartMessageRunner();
|
||||||
void StopMessageRunner();
|
void StopMessageRunner();
|
||||||
void SetInput(InputDefault* p_input);
|
void SetInput(InputDefault* p_input);
|
||||||
|
void SetMainLoop(MainLoop* p_main_loop);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void DirectConnected(direct_buffer_info* info);
|
virtual void DirectConnected(direct_buffer_info* info);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
|
@ -30,6 +30,7 @@ void OS_Haiku::run() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
app->Run();
|
app->Run();
|
||||||
window->StopMessageRunner();
|
window->StopMessageRunner();
|
||||||
delete app;
|
delete app;
|
||||||
|
@ -142,6 +143,7 @@ void OS_Haiku::finalize() {
|
||||||
void OS_Haiku::set_main_loop(MainLoop* p_main_loop) {
|
void OS_Haiku::set_main_loop(MainLoop* p_main_loop) {
|
||||||
main_loop = p_main_loop;
|
main_loop = p_main_loop;
|
||||||
input->set_main_loop(p_main_loop);
|
input->set_main_loop(p_main_loop);
|
||||||
|
window->SetMainLoop(p_main_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainLoop* OS_Haiku::get_main_loop() const {
|
MainLoop* OS_Haiku::get_main_loop() const {
|
||||||
|
@ -154,6 +156,7 @@ void OS_Haiku::delete_main_loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
|
window->SetMainLoop(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_Haiku::release_rendering_thread() {
|
void OS_Haiku::release_rendering_thread() {
|
||||||
|
|
Loading…
Reference in a new issue