Skip to content

Commit

Permalink
ActionTools
Browse files Browse the repository at this point in the history
- done Linux version of the SystemInput mouse device
  • Loading branch information
Jmgr committed Jan 14, 2012
1 parent 54cd47c commit abbb7cd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
2 changes: 0 additions & 2 deletions actiontools/systeminput.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace ActionTools
LeftButton,
MiddleButton,
RightButton,
WheelUpButton,
WheelDownButton,
XButton0,
XButton1,
XButton2,
Expand Down
34 changes: 31 additions & 3 deletions actiontools/systeminputtask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,47 @@ namespace ActionTools
//TODO
break;
case ButtonPress:
Task::instance()->emitMouseButtonPressed(static_cast<Button>(recordData->u.u.detail - 1));
switch(recordData->u.u.detail)
{
case Button1:
Task::instance()->emitMouseButtonPressed(LeftButton);
break;
case Button2:
Task::instance()->emitMouseButtonPressed(MiddleButton);
break;
case Button3:
Task::instance()->emitMouseButtonPressed(RightButton);
break;
case Button4:
case Button5:
// Ignore wheel up & wheel down buttons
break;
default:
Task::instance()->emitMouseButtonPressed(static_cast<Button>(XButton0 + recordData->u.u.detail - Button5 - 1));
break;
}
break;
case ButtonRelease:
Task::instance()->emitMouseButtonReleased(static_cast<Button>(recordData->u.u.detail - 1));

switch(recordData->u.u.detail)
{
case Button1:
Task::instance()->emitMouseButtonReleased(LeftButton);
break;
case Button2:
Task::instance()->emitMouseButtonReleased(MiddleButton);
break;
case Button3:
Task::instance()->emitMouseButtonReleased(RightButton);
break;
case Button4:
Task::instance()->emitMouseWheel(1);
break;
case Button5:
Task::instance()->emitMouseWheel(-1);
break;
default:
Task::instance()->emitMouseButtonReleased(static_cast<Button>(XButton0 + recordData->u.u.detail - Button5 - 1));
break;
}
break;
case MotionNotify:
Expand Down

0 comments on commit abbb7cd

Please sign in to comment.