mouse 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +10 -0
- data/README.markdown +31 -0
- data/ext/mouse/CGEventAdditions.h +227 -0
- data/ext/mouse/IOHIDEventTypes.h +617 -0
- data/ext/mouse/mouse.c +326 -30
- data/ext/mouse/mouser.c +251 -18
- data/ext/mouse/mouser.h +21 -0
- data/lib/mouse.rb +3 -71
- data/lib/mouse/core_extensions.rb +29 -0
- data/lib/mouse/core_extensions/macruby.rb +10 -0
- data/lib/mouse/core_extensions/mri.rb +31 -0
- data/lib/mouse/version.rb +1 -1
- metadata +7 -2
data/ext/mouse/mouser.h
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
//
|
8
8
|
|
9
9
|
#include <ApplicationServices/ApplicationServices.h>
|
10
|
+
#include "CGEventAdditions.h"
|
10
11
|
|
11
12
|
typedef unsigned int uint_t;
|
12
13
|
|
@@ -22,6 +23,10 @@ void mouse_scroll(int amount);
|
|
22
23
|
void mouse_scroll2(int amount, CGScrollEventUnit units);
|
23
24
|
void mouse_scroll3(int amount, CGScrollEventUnit units, double duration);
|
24
25
|
|
26
|
+
void mouse_horizontal_scroll(int amount);
|
27
|
+
void mouse_horizontal_scroll2(int amount, CGScrollEventUnit units);
|
28
|
+
void mouse_horizontal_scroll3(int amount, CGScrollEventUnit units, double duration);
|
29
|
+
|
25
30
|
void mouse_click_down();
|
26
31
|
void mouse_click_down2(CGPoint point);
|
27
32
|
void mouse_click_down3(CGPoint point, uint_t sleep_quanta);
|
@@ -65,3 +70,19 @@ void mouse_double_click2(CGPoint point);
|
|
65
70
|
|
66
71
|
void mouse_triple_click();
|
67
72
|
void mouse_triple_click2(CGPoint point);
|
73
|
+
|
74
|
+
void mouse_smart_magnify();
|
75
|
+
void mouse_smart_magnify2(CGPoint point);
|
76
|
+
|
77
|
+
void mouse_swipe(CGSwipeDirection direction);
|
78
|
+
void mouse_swipe2(CGSwipeDirection direction, CGPoint point);
|
79
|
+
void mouse_swipe3(CGSwipeDirection direction, CGPoint point, double duration);
|
80
|
+
|
81
|
+
void mouse_pinch(CGPinchDirection direction);
|
82
|
+
void mouse_pinch2(CGPinchDirection direction, double magnification);
|
83
|
+
void mouse_pinch3(CGPinchDirection direction, double magnification, CGPoint point);
|
84
|
+
void mouse_pinch4(CGPinchDirection direction, double magnification, CGPoint point, double duration);
|
85
|
+
|
86
|
+
void mouse_rotate(CGRotateDirection direction, double angle);
|
87
|
+
void mouse_rotate2(CGRotateDirection direction, double angle, CGPoint point);
|
88
|
+
void mouse_rotate3(CGRotateDirection direction, double angle, CGPoint point, double duration);
|
data/lib/mouse.rb
CHANGED
@@ -1,74 +1,6 @@
|
|
1
1
|
require 'mouse/version'
|
2
|
+
require 'mouse/core_extensions'
|
3
|
+
require 'mouse/mouse'
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
framework 'AppKit'
|
6
|
-
|
7
|
-
# A workaround that guarantees that `CGPoint` is defined
|
8
|
-
unless defined? MOUNTAIN_LION_APPKIT_VERSION
|
9
|
-
MOUNTAIN_LION_APPKIT_VERSION = 1187
|
10
|
-
end
|
11
|
-
|
12
|
-
if NSAppKitVersionNumber >= MOUNTAIN_LION_APPKIT_VERSION
|
13
|
-
framework '/System/Library/Frameworks/CoreGraphics.framework'
|
14
|
-
end
|
15
|
-
|
16
|
-
else
|
17
|
-
|
18
|
-
|
19
|
-
##
|
20
|
-
# A structure that contains a point in a two-dimensional coordinate system
|
21
|
-
CGPoint = Struct.new(:x, :y) unless defined? CGPoint
|
22
|
-
class CGPoint
|
23
|
-
|
24
|
-
# @param x [Number]
|
25
|
-
# @param y [Number]
|
26
|
-
def initialize x = 0.0, y = 0.0
|
27
|
-
super x.to_f, y.to_f
|
28
|
-
end
|
29
|
-
|
30
|
-
# @!attribute [rw] x
|
31
|
-
# The `x` co-ordinate of the screen point
|
32
|
-
# @return [Number]
|
33
|
-
|
34
|
-
# @!attribute [rw] y
|
35
|
-
# The `y` co-ordinate of the screen point
|
36
|
-
# @return [Number]
|
37
|
-
|
38
|
-
##
|
39
|
-
# Return a nice string representation of the point
|
40
|
-
#
|
41
|
-
# Overrides `Object#inspect` to more closely mimic MacRuby `Boxed#inspect`.
|
42
|
-
#
|
43
|
-
# @return [String]
|
44
|
-
def inspect
|
45
|
-
"#<CGPoint x=#{self.x.to_f} y=#{self.y.to_f}>"
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
class CGPoint
|
53
|
-
##
|
54
|
-
# Returns the receiver, since the receiver is already a {CGPoint}
|
55
|
-
#
|
56
|
-
# @return [CGPoint]
|
57
|
-
def to_point
|
58
|
-
self
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
##
|
63
|
-
# Mouse extensions to `Array`
|
64
|
-
class Array
|
65
|
-
##
|
66
|
-
# Coerce the first two elements of the receiver into a {CGPoint}
|
67
|
-
#
|
68
|
-
# @return [CGPoint]
|
69
|
-
def to_point
|
70
|
-
CGPoint.new self[0], self[1]
|
71
|
-
end
|
5
|
+
module Mouse
|
72
6
|
end
|
73
|
-
|
74
|
-
require 'mouse/mouse'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
if RUBY_ENGINE == 'macruby'
|
2
|
+
require 'mouse/core_extensions/macruby'
|
3
|
+
else
|
4
|
+
require 'mouse/core_extensions/mri'
|
5
|
+
end
|
6
|
+
|
7
|
+
##
|
8
|
+
# Mouse extensions to `CGPoint`
|
9
|
+
class CGPoint
|
10
|
+
##
|
11
|
+
# Returns the receiver, since the receiver is already a {CGPoint}
|
12
|
+
#
|
13
|
+
# @return [CGPoint]
|
14
|
+
def to_point
|
15
|
+
self
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Mouse extensions to `Array`
|
21
|
+
class Array
|
22
|
+
##
|
23
|
+
# Coerce the first two elements of the receiver into a {CGPoint}
|
24
|
+
#
|
25
|
+
# @return [CGPoint]
|
26
|
+
def to_point
|
27
|
+
CGPoint.new self[0], self[1]
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
framework 'AppKit'
|
2
|
+
|
3
|
+
# A workaround that guarantees that `CGPoint` is defined
|
4
|
+
unless defined? MOUNTAIN_LION_APPKIT_VERSION
|
5
|
+
MOUNTAIN_LION_APPKIT_VERSION = 1187
|
6
|
+
end
|
7
|
+
|
8
|
+
if NSAppKitVersionNumber >= MOUNTAIN_LION_APPKIT_VERSION
|
9
|
+
framework '/System/Library/Frameworks/CoreGraphics.framework'
|
10
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
##
|
2
|
+
# A structure that contains a point in a two-dimensional coordinate system
|
3
|
+
CGPoint = Struct.new(:x, :y) unless defined? CGPoint
|
4
|
+
|
5
|
+
class CGPoint
|
6
|
+
|
7
|
+
# @param x [Number]
|
8
|
+
# @param y [Number]
|
9
|
+
def initialize x = 0.0, y = 0.0
|
10
|
+
super x.to_f, y.to_f
|
11
|
+
end
|
12
|
+
|
13
|
+
# @!attribute [rw] x
|
14
|
+
# The `x` co-ordinate of the screen point
|
15
|
+
# @return [Number]
|
16
|
+
|
17
|
+
# @!attribute [rw] y
|
18
|
+
# The `y` co-ordinate of the screen point
|
19
|
+
# @return [Number]
|
20
|
+
|
21
|
+
##
|
22
|
+
# Return a nice string representation of the point
|
23
|
+
#
|
24
|
+
# Overrides `Object#inspect` to more closely mimic MacRuby `Boxed#inspect`.
|
25
|
+
#
|
26
|
+
# @return [String]
|
27
|
+
def inspect
|
28
|
+
"#<CGPoint x=#{self.x.to_f} y=#{self.y.to_f}>"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/lib/mouse/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mouse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yard
|
@@ -74,10 +74,15 @@ extensions:
|
|
74
74
|
- ext/mouse/extconf.rb
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- lib/mouse/core_extensions/macruby.rb
|
78
|
+
- lib/mouse/core_extensions/mri.rb
|
79
|
+
- lib/mouse/core_extensions.rb
|
77
80
|
- lib/mouse/version.rb
|
78
81
|
- lib/mouse.rb
|
79
82
|
- ext/mouse/mouse.c
|
80
83
|
- ext/mouse/mouser.c
|
84
|
+
- ext/mouse/CGEventAdditions.h
|
85
|
+
- ext/mouse/IOHIDEventTypes.h
|
81
86
|
- ext/mouse/mouser.h
|
82
87
|
- ext/mouse/extconf.rb
|
83
88
|
- Rakefile
|