mirror of https://github.com/AxioDL/boo.git
Fix Win32 repeat key test
This commit is contained in:
parent
4d7e9656f1
commit
bcfff2bf7f
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include "System.hpp"
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
@ -75,9 +79,22 @@ struct SScrollDelta
|
|||
bool isAccelerated = false; /* System performs acceleration computation */
|
||||
|
||||
SScrollDelta operator+(const SScrollDelta& other)
|
||||
{return {{delta[0] + other.delta[0], delta[1] + other.delta[1]}, isFine || other.isFine};}
|
||||
{
|
||||
SScrollDelta ret;
|
||||
ret.delta[0] = delta[0] + other.delta[0];
|
||||
ret.delta[1] = delta[1] + other.delta[1];
|
||||
ret.isFine = isFine || other.isFine;
|
||||
ret.isAccelerated = isAccelerated || other.isAccelerated;
|
||||
return ret;
|
||||
}
|
||||
SScrollDelta& operator+=(const SScrollDelta& other)
|
||||
{delta[0] += other.delta[0]; delta[1] += other.delta[1]; isFine |= other.isFine; return *this;}
|
||||
{
|
||||
delta[0] += other.delta[0];
|
||||
delta[1] += other.delta[1];
|
||||
isFine |= other.isFine;
|
||||
isAccelerated |= other.isAccelerated;
|
||||
return *this;
|
||||
}
|
||||
void zeroOut() {delta[0] = 0.0; delta[1] = 0.0;}
|
||||
};
|
||||
|
||||
|
|
|
@ -1039,11 +1039,11 @@ public:
|
|||
uint32_t charCode = translateKeysym(e.wParam, (e.lParam >> 16) & 0xff, specialKey, modifierKey);
|
||||
EModifierKey modifierMask = translateModifiers(e.uMsg);
|
||||
if (charCode)
|
||||
m_callback->charKeyDown(charCode, modifierMask, (e.lParam & 0xffff) != 0);
|
||||
m_callback->charKeyDown(charCode, modifierMask, (HIWORD(e.lParam) & KF_REPEAT) != 0);
|
||||
else if (specialKey != ESpecialKey::None)
|
||||
m_callback->specialKeyDown(specialKey, modifierMask, (e.lParam & 0xffff) != 0);
|
||||
m_callback->specialKeyDown(specialKey, modifierMask, (HIWORD(e.lParam) & KF_REPEAT) != 0);
|
||||
else if (modifierKey != EModifierKey::None)
|
||||
m_callback->modKeyDown(modifierKey, (e.lParam & 0xffff) != 0);
|
||||
m_callback->modKeyDown(modifierKey, (HIWORD(e.lParam) & KF_REPEAT) != 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1182,10 +1182,8 @@ public:
|
|||
{ GET_X_LPARAM(e.lParam), h-GET_Y_LPARAM(e.lParam) },
|
||||
{ float(GET_X_LPARAM(e.lParam)) / float(w), float(h-GET_Y_LPARAM(e.lParam)) / float(h) }
|
||||
};
|
||||
SScrollDelta scroll =
|
||||
{
|
||||
{ 0, GET_WHEEL_DELTA_WPARAM(e.wParam) / double(WHEEL_DELTA) }, false
|
||||
};
|
||||
SScrollDelta scroll = {};
|
||||
scroll.delta[1] = GET_WHEEL_DELTA_WPARAM(e.wParam) / double(WHEEL_DELTA);
|
||||
m_callback->scroll(coord, scroll);
|
||||
}
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue