mac-robot 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -12,6 +12,7 @@ A Library to Automate User Interactions
12
12
 
13
13
  robot.mouse_press
14
14
  robot.mouse_move(250, 250)
15
+ robot.mouse_drag(100, 200)
15
16
  robot.mouse_release
16
17
  robot.scroll_wheel(:x => 10, :y => -20, :z => 5)
17
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -16,6 +16,8 @@ VALUE createInstance() {
16
16
  return Data_Wrap_Struct(rb_cEventDispatcher, 0, cEventDispatcher_free, obj);
17
17
  }
18
18
 
19
+ // https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/doc/uid/TP40003550-CH3g-C016985
20
+ // XXX: support right button and center button
19
21
  CGEventType getEventTypeFromValue(VALUE value)
20
22
  {
21
23
  const char *typeStr;
@@ -29,6 +31,8 @@ CGEventType getEventTypeFromValue(VALUE value)
29
31
  type = kCGEventLeftMouseUp;
30
32
  } else if(strcmp(typeStr, "mouse_move") == 0) {
31
33
  type = kCGEventMouseMoved;
34
+ } else if(strcmp(typeStr, "mouse_drag") == 0) {
35
+ type = kCGEventLeftMouseDragged;
32
36
  } else {
33
37
  type = kCGEventNull;
34
38
  }
data/lib/mac-robot.rb CHANGED
@@ -38,6 +38,13 @@ module Mac
38
38
  mouse_event(:left, :mouse_move)
39
39
  end
40
40
 
41
+ def mouse_drag(x, y)
42
+ @x = x
43
+ @y = y
44
+
45
+ mouse_event(:left, :mouse_drag)
46
+ end
47
+
41
48
  def key_press(keycode)
42
49
  keyboard_event(keycode, 1)
43
50
  end
data/mac-robot.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "mac-robot"
8
- s.version = "0.3.0"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["youpy"]
12
- s.date = "2012-09-18"
12
+ s.date = "2013-03-06"
13
13
  s.description = "A Library to Automate User Interactions"
14
14
  s.email = "youpy@buycheapviagraonlinenow.com"
15
15
  s.extensions = ["ext/event_dispatcher/extconf.rb", "ext/util/extconf.rb"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mac-robot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.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: 2012-09-18 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: 625334772670347707
106
+ hash: 76449113198307385
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements: