Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Dahlmanns committed Jun 4, 2017
1 parent d3f0187 commit 3d90ad4
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion uinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,33 @@ A virtual mouse input device is just as easy to create and use:
Example (trigger a right click):
err = vm.RightClick()
3. Close the device
Example: err = vm.Close()
If you'd like to use absolute input events (move the cursor to specific positions on screen), use the touch pad.
Note that you'll need to specify the size of the screen area you want to use when you initialize the
device. Here are a few examples of how to use the virtual touch pad:
1. Initialize the device:
Example: vt, err := CreateTouchPad("/dev/uinput", "DontTouchThis", 0, 1024, 0, 768)
2. Move the cursor around and issue click events
Example (move cursor to the top left corner of the screen):
err = vt.MoveTo(0, 0)
Example (move cursor to the position x: 100, y: 250):
err = vt.MoveTo(100, 250)
Example (trigger a left click):
err = vt.LeftClick()
Example (trigger a right click):
err = vt.RightClick()
3. Close the device
Example: err = vt.Close()
*/
package uinput

Expand Down Expand Up @@ -166,7 +193,8 @@ func (vTouch vTouchPad) LeftClick() error {
if err != nil {
return fmt.Errorf("sync to device file failed: %v", err)
}
return nil}
return nil
}

func (vTouch vTouchPad) RightClick() error {
err := sendBtnEvent(vTouch.deviceFile, evBtnRight, btnStatePressed)
Expand Down

0 comments on commit 3d90ad4

Please sign in to comment.