movewin 1.10 → 1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -7
- data/ext/movewin/movewin_ext.c +16 -5
- data/ext/movewin/winutils.c +24 -2
- data/ext/movewin/winutils.h +5 -2
- data/lib/movewin.rb +2 -2
- metadata +23 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3843c385c582fdeeb83f418b7681e91506fcd9a8e0b645b321e12a3c6e02d120
|
4
|
+
data.tar.gz: 60fe63177a8b4081f64bccdbf36bd824f562a13390b082734337c95c6eba2ae1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: acb032ac21110ad0b3d142966a3e43e1c7f2be28780eb90e2f655d2b10a3f2850169757bc9ce01aef87c43cc4ae435f82cc6129883c8471a2c8f23000f4efe86
|
7
|
+
data.tar.gz: 3701ad4547eec20f8a4604250a82a23c778cfc596e0fdc561af70e1485103505ae1565e17de707307c0b4c513c76ec923e0a3dc42806b1e8d4e93c157ee2acbd
|
data/ext/movewin/movewin_ext.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* movewin_ext.c - Ruby extension to list and move OS X windows
|
3
3
|
* Andrew Ho (andrew@zeuscat.com)
|
4
4
|
*
|
5
|
-
* Copyright (c) 2014-
|
5
|
+
* Copyright (c) 2014-2020, Andrew Ho.
|
6
6
|
* All rights reserved.
|
7
7
|
*
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
@@ -44,7 +44,10 @@ static VALUE MW_WindowClass;
|
|
44
44
|
void Init_movewin_ext();
|
45
45
|
|
46
46
|
/* Ruby method implementations */
|
47
|
-
VALUE
|
47
|
+
VALUE MW_is_recording_authorized(VALUE module);
|
48
|
+
/* MoveWin.recording_authorized? */
|
49
|
+
VALUE MW_is_accessibility_authorized(VALUE module);
|
50
|
+
/* MoveWin.accessibility_authorized? */
|
48
51
|
VALUE MW_display_size(VALUE module); /* MoveWin.display_size */
|
49
52
|
VALUE MW_windows(VALUE module); /* MoveWin.windows */
|
50
53
|
VALUE MW_Window_id(VALUE self); /* MoveWin::Window.id */
|
@@ -86,7 +89,10 @@ void Init_movewin_ext() {
|
|
86
89
|
|
87
90
|
/* Define module MoveWin and its methods */
|
88
91
|
MW_Module = rb_define_module("MoveWin");
|
89
|
-
rb_define_singleton_method(MW_Module, "
|
92
|
+
rb_define_singleton_method(MW_Module, "recording_authorized?",
|
93
|
+
MW_is_recording_authorized, 0);
|
94
|
+
rb_define_singleton_method(MW_Module, "accessibility_authorized?",
|
95
|
+
MW_is_accessibility_authorized, 0);
|
90
96
|
rb_define_singleton_method(MW_Module, "display_size", MW_display_size, 0);
|
91
97
|
rb_define_singleton_method(MW_Module, "windows", MW_windows, 0);
|
92
98
|
|
@@ -104,9 +110,14 @@ void Init_movewin_ext() {
|
|
104
110
|
rb_define_method(MW_WindowClass, "to_s", MW_Window_to_string, 0);
|
105
111
|
}
|
106
112
|
|
113
|
+
/* Return true if we are authorized to do screen recording */
|
114
|
+
VALUE MW_is_recording_authorized(VALUE module) {
|
115
|
+
return isAuthorizedForScreenRecording() ? Qtrue : Qfalse;
|
116
|
+
}
|
117
|
+
|
107
118
|
/* Return true if we are authorized to use OS X accessibility APIs */
|
108
|
-
VALUE
|
109
|
-
return
|
119
|
+
VALUE MW_is_accessibility_authorized(VALUE module) {
|
120
|
+
return isAuthorizedForAccessibility() ? Qtrue : Qfalse;
|
110
121
|
}
|
111
122
|
|
112
123
|
/* Return dimensions of current main display as an array of two integers */
|
data/ext/movewin/winutils.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* winutils.c - utility functions for listing and moving windows
|
3
3
|
* Andrew Ho (andrew@zeuscat.com)
|
4
4
|
*
|
5
|
-
* Copyright (c) 2014-
|
5
|
+
* Copyright (c) 2014-2020, Andrew Ho.
|
6
6
|
* All rights reserved.
|
7
7
|
*
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
@@ -186,8 +186,30 @@ CGSize CGWindowGetSize(CFDictionaryRef window) {
|
|
186
186
|
return CGSizeMake(width, height);
|
187
187
|
}
|
188
188
|
|
189
|
+
/* Return true if and only if we are authorized to do screen recording */
|
190
|
+
bool isAuthorizedForScreenRecording() {
|
191
|
+
if (MAC_OS_X_VERSION_MIN_REQUIRED < 101500) {
|
192
|
+
/* OS X prior to Catalina does not require separate permissions */
|
193
|
+
return 1;
|
194
|
+
} else {
|
195
|
+
CGDisplayStreamFrameAvailableHandler handler =
|
196
|
+
^(CGDisplayStreamFrameStatus status,
|
197
|
+
uint64_t display_time,
|
198
|
+
IOSurfaceRef frame_surface,
|
199
|
+
CGDisplayStreamUpdateRef updateRef) { return; };
|
200
|
+
CGDisplayStreamRef stream =
|
201
|
+
CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, 'BGRA', NULL, handler);
|
202
|
+
if (stream == NULL) {
|
203
|
+
return 0;
|
204
|
+
} else {
|
205
|
+
CFRelease(stream);
|
206
|
+
return 1;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
189
211
|
/* Return true if and only if we are authorized to call accessibility APIs */
|
190
|
-
bool
|
212
|
+
bool isAuthorizedForAccessibility() {
|
191
213
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
|
192
214
|
return AXAPIEnabled() || AXIsProcessTrusted();
|
193
215
|
#else
|
data/ext/movewin/winutils.h
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* winutils.h - utility functions for listing and moving windows
|
3
3
|
* Andrew Ho (andrew@zeuscat.com)
|
4
4
|
*
|
5
|
-
* Copyright (c) 2014, Andrew Ho.
|
5
|
+
* Copyright (c) 2014-2020, Andrew Ho.
|
6
6
|
* All rights reserved.
|
7
7
|
*
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
@@ -63,8 +63,11 @@ char *windowTitle(char *appName, char *windowName);
|
|
63
63
|
CGPoint CGWindowGetPosition(CFDictionaryRef window);
|
64
64
|
CGSize CGWindowGetSize(CFDictionaryRef window);
|
65
65
|
|
66
|
+
/* Return true if and only if we are authorized to do screen recording */
|
67
|
+
bool isAuthorizedForScreenRecording();
|
68
|
+
|
66
69
|
/* Return true if and only if we are authorized to call accessibility APIs */
|
67
|
-
bool
|
70
|
+
bool isAuthorizedForAccessibility();
|
68
71
|
|
69
72
|
/* Given window dictionary from CGWindowList, return accessibility object */
|
70
73
|
AXUIElementRef AXWindowFromCGWindow(CFDictionaryRef window);
|
data/lib/movewin.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# movewin.rb - Ruby native code that augments movewin_ext Ruby extension
|
3
3
|
# Andrew Ho (andrew@zeuscat.com)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2014-
|
5
|
+
# Copyright (c) 2014-2020, Andrew Ho.
|
6
6
|
# All rights reserved.
|
7
7
|
#
|
8
8
|
# Redistribution and use in source and binary forms, with or without
|
@@ -36,7 +36,7 @@
|
|
36
36
|
require 'movewin/movewin_ext'
|
37
37
|
|
38
38
|
module MoveWin
|
39
|
-
VERSION = '1.
|
39
|
+
VERSION = '1.11'
|
40
40
|
|
41
41
|
# Individual accessors for display size components
|
42
42
|
def self.display_width; MoveWin.display_size[0]; end
|
metadata
CHANGED
@@ -1,57 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: movewin
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.11'
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Andrew Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2015-04-28 00:00:00 Z
|
11
|
+
date: 2020-07-03 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
|
15
13
|
description: List and move OS X windows from Ruby via the OS X accessibility APIs.
|
16
14
|
email: andrew@zeuscat.com
|
17
15
|
executables: []
|
18
|
-
|
19
|
-
extensions:
|
16
|
+
extensions:
|
20
17
|
- ext/movewin/extconf.rb
|
21
18
|
extra_rdoc_files: []
|
22
|
-
|
23
|
-
|
24
|
-
-
|
19
|
+
files:
|
20
|
+
- ext/movewin/dispatch/empty.rb
|
21
|
+
- ext/movewin/extconf.rb
|
25
22
|
- ext/movewin/movewin_ext.c
|
26
23
|
- ext/movewin/winutils.c
|
27
24
|
- ext/movewin/winutils.h
|
28
|
-
-
|
29
|
-
- ext/movewin/extconf.rb
|
25
|
+
- lib/movewin.rb
|
30
26
|
homepage: https://github.com/andrewgho/movewin-ruby
|
31
|
-
licenses:
|
27
|
+
licenses:
|
32
28
|
- BSD-3-Clause
|
33
29
|
metadata: {}
|
34
|
-
|
35
30
|
post_install_message:
|
36
31
|
rdoc_options: []
|
37
|
-
|
38
|
-
require_paths:
|
32
|
+
require_paths:
|
39
33
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
-
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
49
44
|
requirements: []
|
50
|
-
|
51
|
-
rubyforge_project:
|
52
|
-
rubygems_version: 2.0.15
|
45
|
+
rubygems_version: 3.0.3
|
53
46
|
signing_key:
|
54
47
|
specification_version: 4
|
55
48
|
summary: List and move OS X windows from Ruby
|
56
49
|
test_files: []
|
57
|
-
|