mouse 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +4 -0
- data/README.markdown +2 -1
- data/ext/mouse/mouse.c +1 -1
- data/ext/mouse/mouser.c +3 -55
- data/ext/mouse/mouser.h +0 -18
- data/lib/mouse.rb +5 -2
- data/lib/mouse/version.rb +1 -1
- metadata +5 -5
data/History.markdown
CHANGED
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# mouse
|
2
2
|
|
3
3
|
A port of mouse.rb from [AXElements](http://github.com/Marketcircle/AXElements),
|
4
4
|
but cleaned up and rewritten in C to be more portable across languages and
|
@@ -57,6 +57,7 @@ change in the future if there are enough complaints.
|
|
57
57
|
* Support for mouse gestures
|
58
58
|
* Make animation duration accurate (current naiveté has a bit of error)
|
59
59
|
|
60
|
+
|
60
61
|
## Copyright
|
61
62
|
|
62
63
|
Copyright (c) 2012, Mark Rada
|
data/ext/mouse/mouse.c
CHANGED
@@ -474,7 +474,7 @@ Init_mouse()
|
|
474
474
|
*/
|
475
475
|
rb_mMouse = rb_define_module("Mouse");
|
476
476
|
|
477
|
-
|
477
|
+
rb_extend_object(rb_mMouse, rb_mMouse);
|
478
478
|
|
479
479
|
rb_define_method(rb_mMouse, "current_position", rb_mouse_current_position, 0);
|
480
480
|
rb_define_method(rb_mMouse, "move_to", rb_mouse_move_to, -1);
|
data/ext/mouse/mouser.c
CHANGED
@@ -9,10 +9,9 @@
|
|
9
9
|
#include <ApplicationServices/ApplicationServices.h>
|
10
10
|
#include "mouser.h"
|
11
11
|
|
12
|
-
static const uint_t FPS
|
13
|
-
static const uint_t QUANTUM
|
14
|
-
static const double DEFAULT_DURATION
|
15
|
-
static const double DEFAULT_MAGNIFICATION = 2.0; // factor
|
12
|
+
static const uint_t FPS = 240;
|
13
|
+
static const uint_t QUANTUM = 1000000 / 240; // should be FPS, but GCC sucks
|
14
|
+
static const double DEFAULT_DURATION = 0.2; // seconds
|
16
15
|
|
17
16
|
#define NEW_EVENT(type,point,button) CGEventCreateMouseEvent(nil,type,point,button)
|
18
17
|
#define POST(event) CGEventPost(kCGHIDEventTap, event)
|
@@ -347,54 +346,3 @@ mouse_triple_click()
|
|
347
346
|
{
|
348
347
|
mouse_triple_click2(mouse_current_position());
|
349
348
|
}
|
350
|
-
|
351
|
-
void
|
352
|
-
mouse_smart_magnify2(CGPoint point)
|
353
|
-
{
|
354
|
-
}
|
355
|
-
|
356
|
-
void
|
357
|
-
mouse_smart_magnify()
|
358
|
-
{
|
359
|
-
mouse_smart_magnify2(mouse_current_position());
|
360
|
-
}
|
361
|
-
|
362
|
-
void
|
363
|
-
mouse_swipe2(int direction, double duration)
|
364
|
-
{
|
365
|
-
}
|
366
|
-
|
367
|
-
void
|
368
|
-
mouse_swipe(int direction)
|
369
|
-
{
|
370
|
-
mouse_swipe2(direction, DEFAULT_DURATION);
|
371
|
-
}
|
372
|
-
|
373
|
-
void
|
374
|
-
mouse_pinch3(int direction, double magnification, double duration)
|
375
|
-
{
|
376
|
-
}
|
377
|
-
|
378
|
-
void
|
379
|
-
mouse_pinch2(int direction, double magnification)
|
380
|
-
{
|
381
|
-
mouse_pinch3(direction, magnification, DEFAULT_DURATION);
|
382
|
-
}
|
383
|
-
|
384
|
-
void
|
385
|
-
mouse_pinch(int direction)
|
386
|
-
{
|
387
|
-
mouse_pinch2(direction, DEFAULT_MAGNIFICATION);
|
388
|
-
}
|
389
|
-
|
390
|
-
void
|
391
|
-
mouse_rotate2(int direction, double angle, double duration)
|
392
|
-
{
|
393
|
-
}
|
394
|
-
|
395
|
-
void
|
396
|
-
mouse_rotate(int direction, double angle)
|
397
|
-
{
|
398
|
-
mouse_rotate2(direction, angle, DEFAULT_DURATION);
|
399
|
-
}
|
400
|
-
|
data/ext/mouse/mouser.h
CHANGED
@@ -22,10 +22,6 @@ void mouse_scroll(size_t amount);
|
|
22
22
|
void mouse_scroll2(size_t amount, CGScrollEventUnit units);
|
23
23
|
void mouse_scroll3(size_t amount, CGScrollEventUnit units, double duration);
|
24
24
|
|
25
|
-
void mouse_horizontal_scroll(size_t amount);
|
26
|
-
void mouse_horizontal_scroll2(size_t amount, CGScrollEventUnit units);
|
27
|
-
void mouse_horizontal_scroll3(size_t amount, CGScrollEventUnit units, double duration);
|
28
|
-
|
29
25
|
void mouse_click_down();
|
30
26
|
void mouse_click_down2(CGPoint point);
|
31
27
|
void mouse_click_down3(CGPoint point, uint_t sleep_quanta);
|
@@ -55,17 +51,3 @@ void mouse_double_click2(CGPoint point);
|
|
55
51
|
|
56
52
|
void mouse_triple_click();
|
57
53
|
void mouse_triple_click2(CGPoint point);
|
58
|
-
|
59
|
-
void mouse_smart_magnify();
|
60
|
-
void mouse_smart_magnify2(CGPoint point);
|
61
|
-
|
62
|
-
void mouse_swipe(int direction);
|
63
|
-
void mouse_swipe2(int direction, double duration);
|
64
|
-
|
65
|
-
void mouse_pinch(int direction);
|
66
|
-
void mouse_pinch2(int direction, double magnification);
|
67
|
-
void mouse_pinch3(int direction, double magnification, double duration);
|
68
|
-
|
69
|
-
void mouse_rotate(int direction, double angle);
|
70
|
-
void mouse_rotate2(int direction, double angle, double duration);
|
71
|
-
|
data/lib/mouse.rb
CHANGED
@@ -5,7 +5,10 @@ if RUBY_ENGINE == 'macruby'
|
|
5
5
|
framework 'AppKit'
|
6
6
|
|
7
7
|
# A workaround that guarantees that `CGPoint` is defined
|
8
|
-
|
8
|
+
unless defined? MOUNTAIN_LION_APPKIT_VERSION
|
9
|
+
MOUNTAIN_LION_APPKIT_VERSION = 1187
|
10
|
+
end
|
11
|
+
|
9
12
|
if NSAppKitVersionNumber >= MOUNTAIN_LION_APPKIT_VERSION
|
10
13
|
framework '/System/Library/Frameworks/CoreGraphics.framework'
|
11
14
|
end
|
@@ -14,7 +17,7 @@ else
|
|
14
17
|
|
15
18
|
##
|
16
19
|
# A structure that contains a point in a two-dimensional coordinate system
|
17
|
-
|
20
|
+
CGPoint = Struct.new(:x, :y) do
|
18
21
|
|
19
22
|
# @param x [Number]
|
20
23
|
# @param y [Number]
|
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: 1.0.
|
4
|
+
version: 1.0.4
|
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: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yard
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- History.markdown
|
86
86
|
- .yardopts
|
87
87
|
- test/helper.rb
|
88
|
-
homepage: http://github.com/
|
88
|
+
homepage: http://github.com/AXElements/mouse
|
89
89
|
licenses:
|
90
90
|
- BSD 3-clause
|
91
91
|
post_install_message:
|
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
segments:
|
102
102
|
- 0
|
103
|
-
hash:
|
103
|
+
hash: -3725369419576116380
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash:
|
112
|
+
hash: -3725369419576116380
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
115
|
rubygems_version: 1.8.24
|