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.
- data/ext/event_monitor/event_monitor.m +18 -18
- data/ext/event_monitor/extconf.rb +1 -3
- data/lib/mac-event-monitor/version.rb +1 -1
- metadata +10 -10
@@ -26,29 +26,29 @@
|
|
26
26
|
|
27
27
|
eventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:mask
|
28
28
|
handler:^(NSEvent *incomingEvent) {
|
29
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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 = [
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
14
|
-
|
15
|
-
have_header(extension_name)
|
13
|
+
$LDFLAGS += ' -framework AppKit'
|
16
14
|
|
17
15
|
# Do the work
|
18
16
|
create_makefile(extension_name)
|
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.
|
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-
|
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: &
|
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: *
|
24
|
+
version_requirements: *70325557283420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mac-robot
|
27
|
-
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: *
|
35
|
+
version_requirements: *70325557283000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: eventmachine
|
38
|
-
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: *
|
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:
|
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:
|
97
|
+
hash: 3251763459567005321
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
100
|
rubygems_version: 1.8.10
|