mac-event-monitor 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,29 +26,29 @@
26
26
 
27
27
  eventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:mask
28
28
  handler:^(NSEvent *incomingEvent) {
29
- VALUE event;
30
-
31
- event = rb_str_new2([[incomingEvent description] UTF8String]);
32
- rb_funcall(rb_monitor, rb_intern("receive_event"), 1, event);
29
+ rb_funcall(rb_monitor, rb_intern("receive_event"), 1, rb_str_new2([[incomingEvent description] UTF8String]));
33
30
  }];
34
31
  }
35
32
 
36
33
  - (void)onTimeout:(NSTimer *)timer {
37
34
  NSEvent *event;
38
35
 
36
+ [timer release];
37
+
39
38
  [[NSApplication sharedApplication] stop:nil];
40
39
  //[NSEvent removeMonitor:eventMonitor];
41
40
 
42
41
  // http://www.cocoabuilder.com/archive/cocoa/219842-nsapp-stop.html
43
42
  event = [NSEvent otherEventWithType: NSApplicationDefined
44
- location: NSMakePoint(0,0)
45
- modifierFlags: 0
46
- timestamp: 0.0
47
- windowNumber: 0
48
- context: nil
49
- subtype: 0
50
- data1: 0
51
- data2: 0];
43
+ location: NSMakePoint(0,0)
44
+ modifierFlags: 0
45
+ timestamp: 0.0
46
+ windowNumber: 0
47
+ context: nil
48
+ subtype: 0
49
+ data1: 0
50
+ data2: 0];
51
+
52
52
  [NSApp postEvent: event atStart: true];
53
53
  }
54
54
 
@@ -63,13 +63,13 @@ static VALUE cMonitor_run_app(int argc, VALUE *argv, VALUE self)
63
63
 
64
64
  rb_scan_args(argc, argv, "1", &stopAfter);
65
65
 
66
- delegate = [EventMonitorAppDelegate new];
67
- delegate.rb_monitor = self;
68
-
69
- [NSApplication sharedApplication];
70
- [NSApp setDelegate: delegate];
66
+ if(!(delegate = [[NSApplication sharedApplication] delegate])) {
67
+ delegate = [[EventMonitorAppDelegate alloc] init];
68
+ delegate.rb_monitor = self;
69
+ [NSApp setDelegate: delegate];
70
+ }
71
71
 
72
- if(stopAfter) {
72
+ if(stopAfter != Qnil) {
73
73
  [NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)NUM2INT(stopAfter)
74
74
  target:delegate
75
75
  selector:@selector(onTimeout:)
@@ -10,9 +10,7 @@ extension_name = 'event_monitor'
10
10
  # Set your target name
11
11
  dir_config(extension_name)
12
12
 
13
- $LDFLAGS += ' -framework ApplicationServices -framework AppKit'
14
-
15
- have_header(extension_name)
13
+ $LDFLAGS += ' -framework AppKit'
16
14
 
17
15
  # Do the work
18
16
  create_makefile(extension_name)
@@ -1,5 +1,5 @@
1
1
  module Mac
2
2
  module EventMonitor
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mac-event-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-14 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70149660258920 !ruby/object:Gem::Requirement
16
+ requirement: &70325557283420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70149660258920
24
+ version_requirements: *70325557283420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mac-robot
27
- requirement: &70149660258500 !ruby/object:Gem::Requirement
27
+ requirement: &70325557283000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70149660258500
35
+ version_requirements: *70325557283000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: eventmachine
38
- requirement: &70149660258040 !ruby/object:Gem::Requirement
38
+ requirement: &70325557282540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70149660258040
46
+ version_requirements: *70325557282540
47
47
  description: A Library to Monitor User Interactions
48
48
  email:
49
49
  - youpy@buycheapviagraonlinenow.com
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: -357376635066606538
88
+ hash: 3251763459567005321
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: -357376635066606538
97
+ hash: 3251763459567005321
98
98
  requirements: []
99
99
  rubyforge_project:
100
100
  rubygems_version: 1.8.10