* Fix issue 340 for good.
* On X systems this still depends on a working X detectable repeat,
  which is not the case in stable releases of some popular linux
  distributons at this time. This is expected to be fixed soon.
  I haven't chosen yet whether I wait for the fix on X side or if
  I work around the bug.
This commit is contained in:
jean.chalard
2010-02-27 10:57:32 +00:00
parent 80fdb0a38f
commit 2ef8fa338c

View File

@@ -10,6 +10,7 @@
#include <iostream>
#include <map>
#include <set>
#include <limits>
#include "../include/JGE.h"
@@ -128,16 +129,20 @@ void JGE::HoldKey_NoRepeat(const JButton sym)
}
void JGE::ReleaseKey(const LocalKeySym sym)
{
set<JButton> s;
const pair<keycodes_it, keycodes_it> rng = keyBinds.equal_range(sym);
for (keycodes_it it = rng.first; it != rng.second; ++it)
holds.erase(it->second);
{
s.insert(it->second);
holds.erase(it->second);
}
queue< pair<pair<LocalKeySym, JButton>, bool> > r;
while (!keyBuffer.empty())
{
pair<pair<LocalKeySym, JButton>, bool> q = keyBuffer.front();
keyBuffer.pop();
if ((!q.second)) r.push(q);
if ((!q.second) || (s.end() == s.find(q.first.second))) r.push(q);
}
keyBuffer = r;
}