minor event refinements
This commit is contained in:
parent
a9c233b5c3
commit
81b7084fca
|
|
@ -68,6 +68,20 @@ queue_event(CPT_Event event) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EventQueue::clear
|
||||
// Access: Public
|
||||
// Description: Empties all events on the queue, throwing them on the
|
||||
// floor.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EventQueue::
|
||||
clear() {
|
||||
while (!_queue.empty()) {
|
||||
_queue.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EventQueue::is_queue_empty
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ PUBLISHED:
|
|||
~EventQueue();
|
||||
|
||||
void queue_event(CPT_Event event);
|
||||
|
||||
void clear();
|
||||
|
||||
bool is_queue_empty() const;
|
||||
bool is_queue_full() const;
|
||||
|
|
|
|||
|
|
@ -966,10 +966,19 @@ event_window_event(CPT_Event event, void *data) {
|
|||
const GraphicsWindow *win;
|
||||
DCAST_INTO_V(win, param.get_ptr());
|
||||
|
||||
if (!win->get_properties().get_open()) {
|
||||
// If the last window was closed, exit the application.
|
||||
if (self->all_windows_closed()) {
|
||||
self->_exit_flag = true;
|
||||
// Is this a window we've heard about?
|
||||
int window_index = self->find_window(win);
|
||||
if (window_index == -1) {
|
||||
framework_cat.warning()
|
||||
<< "Ignoring message from unknown window.\n";
|
||||
} else {
|
||||
if (!win->get_properties().get_open()) {
|
||||
// If the last window was closed, exit the application.
|
||||
if (self->all_windows_closed() && !self->_exit_flag) {
|
||||
framework_cat.info()
|
||||
<< "Last window was closed by user.\n";
|
||||
self->_exit_flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue