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 "System.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
@ -75,9 +79,22 @@ struct SScrollDelta
|
||||||
bool isAccelerated = false; /* System performs acceleration computation */
|
bool isAccelerated = false; /* System performs acceleration computation */
|
||||||
|
|
||||||
SScrollDelta operator+(const SScrollDelta& other)
|
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)
|
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;}
|
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);
|
uint32_t charCode = translateKeysym(e.wParam, (e.lParam >> 16) & 0xff, specialKey, modifierKey);
|
||||||
EModifierKey modifierMask = translateModifiers(e.uMsg);
|
EModifierKey modifierMask = translateModifiers(e.uMsg);
|
||||||
if (charCode)
|
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)
|
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)
|
else if (modifierKey != EModifierKey::None)
|
||||||
m_callback->modKeyDown(modifierKey, (e.lParam & 0xffff) != 0);
|
m_callback->modKeyDown(modifierKey, (HIWORD(e.lParam) & KF_REPEAT) != 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1182,10 +1182,8 @@ public:
|
||||||
{ GET_X_LPARAM(e.lParam), h-GET_Y_LPARAM(e.lParam) },
|
{ 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) }
|
{ float(GET_X_LPARAM(e.lParam)) / float(w), float(h-GET_Y_LPARAM(e.lParam)) / float(h) }
|
||||||
};
|
};
|
||||||
SScrollDelta scroll =
|
SScrollDelta scroll = {};
|
||||||
{
|
scroll.delta[1] = GET_WHEEL_DELTA_WPARAM(e.wParam) / double(WHEEL_DELTA);
|
||||||
{ 0, GET_WHEEL_DELTA_WPARAM(e.wParam) / double(WHEEL_DELTA) }, false
|
|
||||||
};
|
|
||||||
m_callback->scroll(coord, scroll);
|
m_callback->scroll(coord, scroll);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue