Skip to content

Commit

Permalink
[Fix] Event server code for remote mouse with event client protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ulion authored and davilla committed Oct 26, 2013
1 parent 90aa523 commit 0c233ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 11 additions & 0 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,7 +3254,18 @@ bool CApplication::ProcessEventServer(float frameTime)
{
CPoint pos;
if (es->GetMousePos(pos.x, pos.y) && g_Mouse.IsEnabled())
{
XBMC_Event newEvent;
newEvent.type = XBMC_MOUSEMOTION;
newEvent.motion.xrel = 0;
newEvent.motion.yrel = 0;
newEvent.motion.state = 0;
newEvent.motion.which = 0x10; // just a different value to distinguish between mouse and event client device.
newEvent.motion.x = pos.x;
newEvent.motion.y = pos.y;
OnEvent(newEvent); // had to call this to update g_Mouse position
return OnAction(CAction(ACTION_MOUSE_MOVE, pos.x, pos.y));
}
}
#endif
return false;
Expand Down
8 changes: 2 additions & 6 deletions xbmc/network/EventClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,8 @@ bool CEventClient::GetMousePos(float& x, float& y)
CSingleLock lock(m_critSection);
if (m_bMouseMoved)
{
x = (float)((m_iMouseX / 65535.0f) *
(g_graphicsContext.GetViewWindow().x2
-g_graphicsContext.GetViewWindow().x1));
y = (float)((m_iMouseY / 65535.0f) *
(g_graphicsContext.GetViewWindow().y2
-g_graphicsContext.GetViewWindow().y1));
x = (float)((m_iMouseX / 65535.0f) * g_graphicsContext.GetWidth());
y = (float)((m_iMouseY / 65535.0f) * g_graphicsContext.GetHeight());
m_bMouseMoved = false;
return true;
}
Expand Down

0 comments on commit 0c233ac

Please sign in to comment.