aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-08-03 17:27:48 +0200
committerTomaka17 <pierre.krieger1708@gmail.com>2014-08-03 17:27:48 +0200
commit3c9565ad25d1bd86e307964811ceaef5de9c1324 (patch)
tree0c17dfa9fbbc87f67feca3538c501750a661e376 /src
parentc0912c9ec4b3080fbff6dc1debd216dbe9fe93e8 (diff)
downloadglutin-3c9565ad25d1bd86e307964811ceaef5de9c1324.tar.gz
glutin-3c9565ad25d1bd86e307964811ceaef5de9c1324.zip
Fix closed flag not being immediatly set on win32
Diffstat (limited to 'src')
-rw-r--r--src/win32/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index 891c783..dbcbd8a 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -133,6 +133,7 @@ impl Window {
}
}
+ // if one of the received events is `Closed`, setting `is_closed` to true
if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() {
use std::sync::atomics::Relaxed;
self.is_closed.store(true, Relaxed);
@@ -146,10 +147,21 @@ impl Window {
pub fn wait_events(&self) -> Vec<Event> {
match self.events_receiver.recv_opt() {
Ok(ev) => {
+ // if the received event is `Closed`, setting `is_closed` to true
+ match ev {
+ ::Closed => {
+ use std::sync::atomics::Relaxed;
+ self.is_closed.store(true, Relaxed);
+ },
+ _ => ()
+ };
+
+ // looing for other possible events in the queue
let mut result = self.poll_events();
result.insert(0, ev);
result
},
+
Err(_) => {
use std::sync::atomics::Relaxed;
self.is_closed.store(true, Relaxed);