fix for wxJoystick when not calling SetCapture() (patch 1000685)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -92,7 +92,8 @@ void* wxJoystickThread::Entry()
|
|||||||
struct timeval time_out = {0, 0};
|
struct timeval time_out = {0, 0};
|
||||||
|
|
||||||
FD_ZERO(&read_fds);
|
FD_ZERO(&read_fds);
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
if (TestDestroy())
|
if (TestDestroy())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -113,15 +114,14 @@ void* wxJoystickThread::Entry()
|
|||||||
//printf("time: %d\t value: %d\t type: %d\t number: %d\n",
|
//printf("time: %d\t value: %d\t type: %d\t number: %d\n",
|
||||||
// j_evt.time, j_evt.value, j_evt.type, j_evt.number);
|
// j_evt.time, j_evt.value, j_evt.type, j_evt.number);
|
||||||
|
|
||||||
if (m_catchwin)
|
|
||||||
{
|
|
||||||
wxJoystickEvent jwx_event;
|
wxJoystickEvent jwx_event;
|
||||||
|
|
||||||
if ((j_evt.type & JS_EVENT_AXIS) == JS_EVENT_AXIS) {
|
if (j_evt.type & JS_EVENT_AXIS)
|
||||||
|
{
|
||||||
m_axe[j_evt.number] = j_evt.value;
|
m_axe[j_evt.number] = j_evt.value;
|
||||||
|
|
||||||
switch (j_evt.number) {
|
switch (j_evt.number)
|
||||||
|
{
|
||||||
case wxJS_AXIS_X:
|
case wxJS_AXIS_X:
|
||||||
m_lastposition.x = j_evt.value;
|
m_lastposition.x = j_evt.value;
|
||||||
jwx_event.SetEventType(wxEVT_JOY_MOVE);
|
jwx_event.SetEventType(wxEVT_JOY_MOVE);
|
||||||
@@ -141,7 +141,8 @@ void* wxJoystickThread::Entry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((j_evt.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) {
|
if (j_evt.type & JS_EVENT_BUTTON)
|
||||||
|
{
|
||||||
if (j_evt.value)
|
if (j_evt.value)
|
||||||
{
|
{
|
||||||
m_buttons |= (1 << j_evt.number);
|
m_buttons |= (1 << j_evt.number);
|
||||||
@@ -154,7 +155,6 @@ void* wxJoystickThread::Entry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
jwx_event.SetButtonChange(j_evt.number);
|
jwx_event.SetButtonChange(j_evt.number);
|
||||||
}
|
|
||||||
|
|
||||||
jwx_event.SetTimestamp(j_evt.time);
|
jwx_event.SetTimestamp(j_evt.time);
|
||||||
jwx_event.SetJoystick(m_joystick);
|
jwx_event.SetJoystick(m_joystick);
|
||||||
@@ -163,12 +163,9 @@ void* wxJoystickThread::Entry()
|
|||||||
jwx_event.SetZPosition(m_axe[3]);
|
jwx_event.SetZPosition(m_axe[3]);
|
||||||
jwx_event.SetEventObject(m_catchwin);
|
jwx_event.SetEventObject(m_catchwin);
|
||||||
|
|
||||||
|
if (m_catchwin)
|
||||||
m_catchwin->AddPendingEvent(jwx_event);
|
m_catchwin->AddPendingEvent(jwx_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (m_polling)
|
|
||||||
// wxThread::Sleep(m_polling);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user