reflexion 0.1.57 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/exception.cpp +1 -1
- data/.doc/ext/reflex/key_event.cpp +22 -7
- data/.doc/ext/reflex/reflex.cpp +203 -0
- data/.doc/ext/reflex/style.cpp +2 -2
- data/.doc/ext/reflex/view.cpp +1 -1
- data/.github/workflows/release-gem.yml +1 -1
- data/.github/workflows/tag.yml +1 -1
- data/.github/workflows/test.yml +7 -1
- data/ChangeLog.md +19 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/ext/reflex/exception.cpp +1 -1
- data/ext/reflex/key_event.cpp +22 -7
- data/ext/reflex/reflex.cpp +203 -0
- data/ext/reflex/style.cpp +2 -2
- data/ext/reflex/view.cpp +1 -1
- data/include/reflex/defs.h +199 -188
- data/include/reflex/ruby.h +4 -1
- data/include/reflex.h +2 -0
- data/lib/reflex/key_event.rb +23 -1
- data/reflex.gemspec +4 -4
- data/samples/key.rb +1 -1
- data/src/event.cpp +1 -0
- data/src/ios/event.h +1 -11
- data/src/ios/event.mm +10 -57
- data/src/ios/view_controller.mm +21 -44
- data/src/ios/window.mm +19 -19
- data/src/osx/event.h +1 -1
- data/src/osx/event.mm +51 -189
- data/src/osx/native_window.mm +33 -84
- data/src/osx/window.mm +12 -12
- data/src/pointer.cpp +53 -11
- data/src/pointer.h +8 -0
- data/src/view.cpp +4 -79
- data/src/window.cpp +105 -0
- data/src/window.h +13 -3
- data/test/helper.rb +0 -6
- data/test/test_key_event.rb +17 -8
- data/test/test_pointer.rb +7 -2
- data/test/test_screen.rb +0 -4
- metadata +10 -10
data/ext/reflex/style.cpp
CHANGED
@@ -52,7 +52,7 @@ RUCY_DEFN(set_flow)
|
|
52
52
|
argc >= 2 ? (Reflex::Style::Flow) to<int>(argv[1]) : Reflex::Style::FLOW_NONE);
|
53
53
|
}
|
54
54
|
|
55
|
-
return
|
55
|
+
return array(argv, argc);
|
56
56
|
}
|
57
57
|
RUCY_END
|
58
58
|
|
@@ -120,7 +120,7 @@ RUCY_DEFN(set_size)
|
|
120
120
|
set_width( self, argv[0]);
|
121
121
|
set_height(self, argc >= 2 ? argv[1] : argv[0]);
|
122
122
|
|
123
|
-
return
|
123
|
+
return array(argv, argc);
|
124
124
|
}
|
125
125
|
RUCY_END
|
126
126
|
|
data/ext/reflex/view.cpp
CHANGED
data/include/reflex/defs.h
CHANGED
@@ -66,188 +66,199 @@ namespace Reflex
|
|
66
66
|
enum KeyCode
|
67
67
|
{
|
68
68
|
|
69
|
-
KEY_NONE =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
//
|
214
|
-
//
|
215
|
-
//
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
//
|
226
|
-
//
|
227
|
-
//
|
228
|
-
//
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
//
|
235
|
-
//
|
236
|
-
//
|
237
|
-
//
|
238
|
-
//
|
239
|
-
//
|
240
|
-
//
|
241
|
-
|
242
|
-
|
243
|
-
//
|
244
|
-
//
|
245
|
-
//
|
246
|
-
|
247
|
-
//
|
248
|
-
//
|
249
|
-
//
|
250
|
-
|
69
|
+
KEY_NONE = -1,
|
70
|
+
|
71
|
+
#if defined(OSX) || defined(IOS)
|
72
|
+
#define NATIVE_VK(osx) osx
|
73
|
+
#endif
|
74
|
+
|
75
|
+
KEY_A = NATIVE_VK(0x00),
|
76
|
+
KEY_B = NATIVE_VK(0x0B),
|
77
|
+
KEY_C = NATIVE_VK(0x08),
|
78
|
+
KEY_D = NATIVE_VK(0x02),
|
79
|
+
KEY_E = NATIVE_VK(0x0E),
|
80
|
+
KEY_F = NATIVE_VK(0x03),
|
81
|
+
KEY_G = NATIVE_VK(0x05),
|
82
|
+
KEY_H = NATIVE_VK(0x04),
|
83
|
+
KEY_I = NATIVE_VK(0x22),
|
84
|
+
KEY_J = NATIVE_VK(0x26),
|
85
|
+
KEY_K = NATIVE_VK(0x28),
|
86
|
+
KEY_L = NATIVE_VK(0x25),
|
87
|
+
KEY_M = NATIVE_VK(0x2E),
|
88
|
+
KEY_N = NATIVE_VK(0x2D),
|
89
|
+
KEY_O = NATIVE_VK(0x1F),
|
90
|
+
KEY_P = NATIVE_VK(0x23),
|
91
|
+
KEY_Q = NATIVE_VK(0x0C),
|
92
|
+
KEY_R = NATIVE_VK(0x0F),
|
93
|
+
KEY_S = NATIVE_VK(0x01),
|
94
|
+
KEY_T = NATIVE_VK(0x11),
|
95
|
+
KEY_U = NATIVE_VK(0x20),
|
96
|
+
KEY_V = NATIVE_VK(0x09),
|
97
|
+
KEY_W = NATIVE_VK(0x0D),
|
98
|
+
KEY_X = NATIVE_VK(0x07),
|
99
|
+
KEY_Y = NATIVE_VK(0x10),
|
100
|
+
KEY_Z = NATIVE_VK(0x06),
|
101
|
+
|
102
|
+
KEY_0 = NATIVE_VK(0x1D),
|
103
|
+
KEY_1 = NATIVE_VK(0x12),
|
104
|
+
KEY_2 = NATIVE_VK(0x13),
|
105
|
+
KEY_3 = NATIVE_VK(0x14),
|
106
|
+
KEY_4 = NATIVE_VK(0x15),
|
107
|
+
KEY_5 = NATIVE_VK(0x17),
|
108
|
+
KEY_6 = NATIVE_VK(0x16),
|
109
|
+
KEY_7 = NATIVE_VK(0x1A),
|
110
|
+
KEY_8 = NATIVE_VK(0x1C),
|
111
|
+
KEY_9 = NATIVE_VK(0x19),
|
112
|
+
|
113
|
+
KEY_MINUS = NATIVE_VK(0x1B),
|
114
|
+
KEY_EQUAL = NATIVE_VK(0x18),
|
115
|
+
KEY_COMMA = NATIVE_VK(0x2B),
|
116
|
+
KEY_PERIOD = NATIVE_VK(0x2F),
|
117
|
+
KEY_SEMICOLON = NATIVE_VK(0x29),
|
118
|
+
KEY_QUOTE = NATIVE_VK(0x27),
|
119
|
+
KEY_SLASH = NATIVE_VK(0x2C),
|
120
|
+
KEY_BACKSLASH = NATIVE_VK(0x2A),
|
121
|
+
KEY_UNDERSCORE = NATIVE_VK(0x5E),
|
122
|
+
KEY_GRAVE = NATIVE_VK(0x32),
|
123
|
+
KEY_YEN = NATIVE_VK(0x5D),
|
124
|
+
KEY_LBRACKET = NATIVE_VK(0x21),
|
125
|
+
KEY_RBRACKET = NATIVE_VK(0x1E),
|
126
|
+
|
127
|
+
KEY_ENTER = NATIVE_VK(0x24),
|
128
|
+
KEY_RETURN = NATIVE_VK(0x24),
|
129
|
+
KEY_SPACE = NATIVE_VK(0x31),
|
130
|
+
KEY_TAB = NATIVE_VK(0x30),
|
131
|
+
KEY_DELETE = NATIVE_VK(0x75),
|
132
|
+
KEY_BACKSPACE = NATIVE_VK(0x33),
|
133
|
+
//KEY_INSERT = NATIVE_VK(),
|
134
|
+
KEY_ESCAPE = NATIVE_VK(0x35),
|
135
|
+
|
136
|
+
KEY_LEFT = NATIVE_VK(0x7B),
|
137
|
+
KEY_RIGHT = NATIVE_VK(0x7C),
|
138
|
+
KEY_UP = NATIVE_VK(0x7E),
|
139
|
+
KEY_DOWN = NATIVE_VK(0x7D),
|
140
|
+
KEY_HOME = NATIVE_VK(0x73),
|
141
|
+
KEY_END = NATIVE_VK(0x77),
|
142
|
+
KEY_PAGEUP = NATIVE_VK(0x74),
|
143
|
+
KEY_PAGEDOWN = NATIVE_VK(0x79),
|
144
|
+
|
145
|
+
KEY_SHIFT = NATIVE_VK(0x38),
|
146
|
+
KEY_LSHIFT = NATIVE_VK(0x38),
|
147
|
+
KEY_RSHIFT = NATIVE_VK(0x3C),
|
148
|
+
KEY_CONTROL = NATIVE_VK(0x3B),
|
149
|
+
KEY_LCONTROL = NATIVE_VK(0x3B),
|
150
|
+
KEY_RCONTROL = NATIVE_VK(0x3E),
|
151
|
+
//KEY_LALT = NATIVE_VK(),
|
152
|
+
//KEY_RALT = NATIVE_VK(),
|
153
|
+
//KEY_LWIN = NATIVE_VK(),
|
154
|
+
//KEY_RWIN = NATIVE_VK(),
|
155
|
+
KEY_COMMAND = NATIVE_VK(0x37),
|
156
|
+
KEY_LCOMMAND = NATIVE_VK(0x37),
|
157
|
+
KEY_RCOMMAND = NATIVE_VK(0x36),
|
158
|
+
KEY_OPTION = NATIVE_VK(0x3A),
|
159
|
+
KEY_LOPTION = NATIVE_VK(0x3A),
|
160
|
+
KEY_ROPTION = NATIVE_VK(0x3D),
|
161
|
+
KEY_FUNCTION = NATIVE_VK(0x3F),
|
162
|
+
|
163
|
+
KEY_F1 = NATIVE_VK(0x7A),
|
164
|
+
KEY_F2 = NATIVE_VK(0x78),
|
165
|
+
KEY_F3 = NATIVE_VK(0x63),
|
166
|
+
KEY_F4 = NATIVE_VK(0x76),
|
167
|
+
KEY_F5 = NATIVE_VK(0x60),
|
168
|
+
KEY_F6 = NATIVE_VK(0x61),
|
169
|
+
KEY_F7 = NATIVE_VK(0x62),
|
170
|
+
KEY_F8 = NATIVE_VK(0x64),
|
171
|
+
KEY_F9 = NATIVE_VK(0x65),
|
172
|
+
KEY_F10 = NATIVE_VK(0x6D),
|
173
|
+
KEY_F11 = NATIVE_VK(0x67),
|
174
|
+
KEY_F12 = NATIVE_VK(0x6F),
|
175
|
+
KEY_F13 = NATIVE_VK(0x69),
|
176
|
+
KEY_F14 = NATIVE_VK(0x6B),
|
177
|
+
KEY_F15 = NATIVE_VK(0x71),
|
178
|
+
KEY_F16 = NATIVE_VK(0x6A),
|
179
|
+
KEY_F17 = NATIVE_VK(0x40),
|
180
|
+
KEY_F18 = NATIVE_VK(0x4F),
|
181
|
+
KEY_F19 = NATIVE_VK(0x50),
|
182
|
+
KEY_F20 = NATIVE_VK(0x5A),
|
183
|
+
//KEY_F21 = NATIVE_VK(),
|
184
|
+
//KEY_F22 = NATIVE_VK(),
|
185
|
+
//KEY_F23 = NATIVE_VK(),
|
186
|
+
//KEY_F24 = NATIVE_VK(),
|
187
|
+
|
188
|
+
KEY_NUM_0 = NATIVE_VK(0x52),
|
189
|
+
KEY_NUM_1 = NATIVE_VK(0x53),
|
190
|
+
KEY_NUM_2 = NATIVE_VK(0x54),
|
191
|
+
KEY_NUM_3 = NATIVE_VK(0x55),
|
192
|
+
KEY_NUM_4 = NATIVE_VK(0x56),
|
193
|
+
KEY_NUM_5 = NATIVE_VK(0x57),
|
194
|
+
KEY_NUM_6 = NATIVE_VK(0x58),
|
195
|
+
KEY_NUM_7 = NATIVE_VK(0x59),
|
196
|
+
KEY_NUM_8 = NATIVE_VK(0x5B),
|
197
|
+
KEY_NUM_9 = NATIVE_VK(0x5C),
|
198
|
+
|
199
|
+
KEY_NUM_PLUS = NATIVE_VK(0x45),
|
200
|
+
KEY_NUM_MINUS = NATIVE_VK(0x4E),
|
201
|
+
KEY_NUM_MULTIPLY = NATIVE_VK(0x43),
|
202
|
+
KEY_NUM_DIVIDE = NATIVE_VK(0x4B),
|
203
|
+
KEY_NUM_EQUAL = NATIVE_VK(0x51),
|
204
|
+
KEY_NUM_COMMA = NATIVE_VK(0x5F),
|
205
|
+
KEY_NUM_DECIMAL = NATIVE_VK(0x41),
|
206
|
+
KEY_NUM_CLEAR = NATIVE_VK(0x47),
|
207
|
+
KEY_NUM_ENTER = NATIVE_VK(0x4C),
|
208
|
+
|
209
|
+
KEY_CAPSLOCK = NATIVE_VK(0x39),
|
210
|
+
//KEY_NUMLOCK = NATIVE_VK(),
|
211
|
+
//KEY_SCROLLLOCK = NATIVE_VK(),
|
212
|
+
|
213
|
+
//KEY_PRINTSCREEN = NATIVE_VK(),
|
214
|
+
//KEY_PAUSE = NATIVE_VK(),
|
215
|
+
//KEY_BREAK = NATIVE_VK(),
|
216
|
+
KEY_SECTION = NATIVE_VK(0x0A),
|
217
|
+
KEY_HELP = NATIVE_VK(0x72),
|
218
|
+
|
219
|
+
KEY_IME_EISU = NATIVE_VK(0x66),
|
220
|
+
KEY_IME_KANA = NATIVE_VK(0x68),
|
221
|
+
//KEY_IME_KANJI = NATIVE_VK(),
|
222
|
+
//KEY_IME_JUNJA = NATIVE_VK(),
|
223
|
+
//KEY_IME_PROCESS = NATIVE_VK(),
|
224
|
+
//KEY_IME_ACCEPT = NATIVE_VK(),
|
225
|
+
//KEY_IME_FINAL = NATIVE_VK(),
|
226
|
+
//KEY_IME_CONVERT = NATIVE_VK(),
|
227
|
+
//KEY_IME_NONCONVERT = NATIVE_VK(),
|
228
|
+
//KEY_IME_MODECHANGE = NATIVE_VK(),
|
229
|
+
|
230
|
+
KEY_VOLUME_UP = NATIVE_VK(0x48),
|
231
|
+
KEY_VOLUME_DOWN = NATIVE_VK(0x49),
|
232
|
+
KEY_MUTE = NATIVE_VK(0x4A),
|
233
|
+
|
234
|
+
//KEY_SLEEP = NATIVE_VK(),
|
235
|
+
//KEY_EXEC = NATIVE_VK(),
|
236
|
+
//KEY_PRINT = NATIVE_VK(),
|
237
|
+
//KEY_APPS = NATIVE_VK(),
|
238
|
+
//KEY_SELECT = NATIVE_VK(),
|
239
|
+
//KEY_CLEAR = NATIVE_VK(),
|
240
|
+
//KEY_PLAY = NATIVE_VK(),
|
241
|
+
//KEY_ZOOM = NATIVE_VK(),
|
242
|
+
|
243
|
+
//KEY_BROWSER_BACK = NATIVE_VK(),
|
244
|
+
//KEY_BROWSER_FORWARD = NATIVE_VK(),
|
245
|
+
//KEY_BROWSER_REFRESH = NATIVE_VK(),
|
246
|
+
//KEY_BROWSER_STOP = NATIVE_VK(),
|
247
|
+
//KEY_BROWSER_SEARCH = NATIVE_VK(),
|
248
|
+
//KEY_BROWSER_FAVORITES = NATIVE_VK(),
|
249
|
+
//KEY_BROWSER_HOME = NATIVE_VK(),
|
250
|
+
|
251
|
+
//KEY_MEDIA_NEXT_TRACK = NATIVE_VK(),
|
252
|
+
//KEY_MEDIA_PREV_TRACK = NATIVE_VK(),
|
253
|
+
//KEY_MEDIA_STOP = NATIVE_VK(),
|
254
|
+
//KEY_MEDIA_PLAY_PAUSE = NATIVE_VK(),
|
255
|
+
|
256
|
+
//KEY_LAUNCH_MAIL = NATIVE_VK(),
|
257
|
+
//KEY_LAUNCH_MEDIA_SELECT = NATIVE_VK(),
|
258
|
+
//KEY_LAUNCH_APP1 = NATIVE_VK(),
|
259
|
+
//KEY_LAUNCH_APP2 = NATIVE_VK(),
|
260
|
+
|
261
|
+
#undef NATIVE_VK
|
251
262
|
|
252
263
|
};// KeyCode
|
253
264
|
|
@@ -267,17 +278,17 @@ namespace Reflex
|
|
267
278
|
MOD_WIN = 0x1 << 3,
|
268
279
|
#endif
|
269
280
|
|
270
|
-
MOD_OPTION =
|
281
|
+
MOD_OPTION = 0x1 << 4,
|
271
282
|
|
272
|
-
MOD_COMMAND =
|
283
|
+
MOD_COMMAND = 0x1 << 5,
|
273
284
|
|
274
|
-
MOD_HELP = 0x1 <<
|
285
|
+
MOD_HELP = 0x1 << 6,
|
275
286
|
|
276
|
-
MOD_FUNCTION = 0x1 <<
|
287
|
+
MOD_FUNCTION = 0x1 << 7,
|
277
288
|
|
278
|
-
MOD_NUMPAD = 0x1 <<
|
289
|
+
MOD_NUMPAD = 0x1 << 8,
|
279
290
|
|
280
|
-
MOD_CAPS = 0x1 <<
|
291
|
+
MOD_CAPS = 0x1 << 9,
|
281
292
|
|
282
293
|
};// Modifier
|
283
294
|
|
data/include/reflex/ruby.h
CHANGED
@@ -4,19 +4,22 @@
|
|
4
4
|
#define __REFLEX_RUBY_H__
|
5
5
|
|
6
6
|
|
7
|
-
#include <reflex/ruby/reflex.h>
|
8
7
|
#include <reflex/ruby/defs.h>
|
8
|
+
#include <reflex/ruby/reflex.h>
|
9
9
|
#include <reflex/ruby/exception.h>
|
10
10
|
|
11
11
|
#include <reflex/ruby/selector.h>
|
12
|
+
#include <reflex/ruby/pointer.h>
|
12
13
|
#include <reflex/ruby/event.h>
|
13
14
|
#include <reflex/ruby/timer.h>
|
14
15
|
#include <reflex/ruby/style.h>
|
15
16
|
#include <reflex/ruby/shape.h>
|
17
|
+
#include <reflex/ruby/filter.h>
|
16
18
|
|
17
19
|
#include <reflex/ruby/application.h>
|
18
20
|
#include <reflex/ruby/window.h>
|
19
21
|
#include <reflex/ruby/view.h>
|
22
|
+
#include <reflex/ruby/screen.h>
|
20
23
|
|
21
24
|
#include <reflex/ruby/image_view.h>
|
22
25
|
|
data/include/reflex.h
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <reflex/debug.h>
|
11
11
|
|
12
12
|
#include <reflex/selector.h>
|
13
|
+
#include <reflex/pointer.h>
|
13
14
|
#include <reflex/event.h>
|
14
15
|
#include <reflex/style.h>
|
15
16
|
#include <reflex/timer.h>
|
@@ -19,6 +20,7 @@
|
|
19
20
|
#include <reflex/application.h>
|
20
21
|
#include <reflex/window.h>
|
21
22
|
#include <reflex/view.h>
|
23
|
+
#include <reflex/screen.h>
|
22
24
|
|
23
25
|
#include <reflex/device.h>
|
24
26
|
|
data/lib/reflex/key_event.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'xot/bit_flag_accessor'
|
1
2
|
require 'xot/const_symbol_accessor'
|
2
3
|
require 'reflex/ext'
|
3
4
|
|
@@ -15,6 +16,19 @@ module Reflex
|
|
15
16
|
up: UP
|
16
17
|
}
|
17
18
|
|
19
|
+
bit_flag_reader :modifiers, **{
|
20
|
+
shift: MOD_SHIFT,
|
21
|
+
control: MOD_CONTROL,
|
22
|
+
alt: MOD_ALT,
|
23
|
+
win: MOD_WIN,
|
24
|
+
option: MOD_OPTION,
|
25
|
+
command: MOD_COMMAND,
|
26
|
+
help: MOD_HELP,
|
27
|
+
function: MOD_FUNCTION,
|
28
|
+
numpad: MOD_NUMPAD,
|
29
|
+
caps: MOD_CAPS,
|
30
|
+
}
|
31
|
+
|
18
32
|
def down?()
|
19
33
|
get_action == DOWN
|
20
34
|
end
|
@@ -28,7 +42,15 @@ module Reflex
|
|
28
42
|
end
|
29
43
|
|
30
44
|
def inspect()
|
31
|
-
"#<Reflex::KeyEvent action
|
45
|
+
"#<Reflex::KeyEvent action:%s chars:%s key:%s code:0x%X mod:%s repeat:%d captured?:%s>" % [
|
46
|
+
action,
|
47
|
+
chars ? "'#{chars}'" : :nil,
|
48
|
+
key ? key : :nil,
|
49
|
+
code,
|
50
|
+
modifiers.join(','),
|
51
|
+
repeat,
|
52
|
+
captured?
|
53
|
+
]
|
32
54
|
end
|
33
55
|
|
34
56
|
end# KeyEvent
|
data/reflex.gemspec
CHANGED
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
27
27
|
|
28
|
-
s.add_runtime_dependency 'xot', '~> 0.1
|
29
|
-
s.add_runtime_dependency 'rucy', '~> 0.1
|
30
|
-
s.add_runtime_dependency 'beeps', '~> 0.1
|
31
|
-
s.add_runtime_dependency 'rays', '~> 0.1
|
28
|
+
s.add_runtime_dependency 'xot', '~> 0.2.1'
|
29
|
+
s.add_runtime_dependency 'rucy', '~> 0.2.1'
|
30
|
+
s.add_runtime_dependency 'beeps', '~> 0.2.1'
|
31
|
+
s.add_runtime_dependency 'rays', '~> 0.2.1'
|
32
32
|
|
33
33
|
s.files = `git ls-files`.split $/
|
34
34
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/samples/key.rb
CHANGED
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
w.on :pointer_move do |points|
|
32
32
|
$pos = "#{points.x}, #{points.y}"
|
33
|
-
p [points.
|
33
|
+
p [points.action, points.x, points.y, points.size, points.modifiers, points.count, points.drag?]
|
34
34
|
w.redraw
|
35
35
|
end
|
36
36
|
|
data/src/event.cpp
CHANGED
data/src/ios/event.h
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
#define __REFLEX_SRC_IOS_EVENT_H__
|
5
5
|
|
6
6
|
|
7
|
-
#include <list>
|
8
7
|
#import <UIKit/UIEvent.h>
|
9
8
|
#include "../event.h"
|
10
9
|
|
@@ -13,21 +12,12 @@ namespace Reflex
|
|
13
12
|
{
|
14
13
|
|
15
14
|
|
16
|
-
typedef std::list<Pointer> PrevPointerList;
|
17
|
-
|
18
|
-
|
19
15
|
class NativePointerEvent : public PointerEvent
|
20
16
|
{
|
21
17
|
|
22
18
|
public:
|
23
19
|
|
24
|
-
NativePointerEvent (
|
25
|
-
NSSet* touches, UIEvent* event, UIView* view,
|
26
|
-
Pointer::ID* pointer_id);
|
27
|
-
|
28
|
-
NativePointerEvent (
|
29
|
-
NSSet* touches, UIEvent* event, UIView* view,
|
30
|
-
PrevPointerList* prev_pointers);
|
20
|
+
NativePointerEvent (NSSet* touches, UIEvent* event, UIView* view);
|
31
21
|
|
32
22
|
};// NativePointerEvent
|
33
23
|
|
data/src/ios/event.mm
CHANGED
@@ -69,45 +69,13 @@ namespace Reflex
|
|
69
69
|
(flags & UIKeyModifierNumericPad) ? MOD_NUMPAD : 0;
|
70
70
|
}
|
71
71
|
|
72
|
-
static void
|
73
|
-
set_pasts (Pointer* pointer, const Pointer* prev)
|
74
|
-
{
|
75
|
-
Pointer_set_prev(pointer, prev);
|
76
|
-
if (prev && prev->down())
|
77
|
-
Pointer_set_down(pointer, prev->down());
|
78
|
-
}
|
79
|
-
|
80
|
-
static void
|
81
|
-
attach_prev_pointer (
|
82
|
-
Pointer* pointer, PrevPointerList* prev_pointers, const Point& prev_position)
|
83
|
-
{
|
84
|
-
auto it = std::find_if(
|
85
|
-
prev_pointers->begin(), prev_pointers->end(),
|
86
|
-
[&](const Pointer& p) {return p.position() == prev_position;});
|
87
|
-
|
88
|
-
if (it != prev_pointers->end())
|
89
|
-
{
|
90
|
-
set_pasts(pointer, &*it);
|
91
|
-
prev_pointers->erase(it);
|
92
|
-
}
|
93
|
-
else if (prev_pointers->size() == 1)
|
94
|
-
{
|
95
|
-
set_pasts(pointer, &prev_pointers->front());
|
96
|
-
prev_pointers->clear();
|
97
|
-
}
|
98
|
-
|
99
|
-
if (pointer->prev())
|
100
|
-
Pointer_set_id(pointer, pointer->prev()->id());
|
101
|
-
}
|
102
|
-
|
103
72
|
static Pointer
|
104
|
-
create_pointer (
|
105
|
-
UITouch* touch, UIEvent* event, UIView* view, double time,
|
106
|
-
Pointer::ID pointer_id, PrevPointerList* prev_pointers)
|
73
|
+
create_pointer (UITouch* touch, UIEvent* event, UIView* view)
|
107
74
|
{
|
108
75
|
Pointer::Action action = get_action(touch);
|
76
|
+
|
109
77
|
Pointer pointer(
|
110
|
-
|
78
|
+
0,
|
111
79
|
get_type(touch),
|
112
80
|
action,
|
113
81
|
to_point([touch locationInView: view]),
|
@@ -115,39 +83,24 @@ namespace Reflex
|
|
115
83
|
action == Pointer::MOVE,
|
116
84
|
(uint) touch.tapCount,
|
117
85
|
0,
|
118
|
-
|
86
|
+
touch.timestamp);
|
119
87
|
|
120
|
-
if (
|
88
|
+
if (touch.phase != UITouchPhaseBegan)
|
121
89
|
{
|
122
|
-
|
123
|
-
&pointer,
|
124
|
-
to_point([touch previousLocationInView: view]));
|
90
|
+
Pointer_set_prev_position(
|
91
|
+
&pointer, to_point([touch previousLocationInView: view]));
|
125
92
|
}
|
126
|
-
else
|
127
|
-
Pointer_set_down(&pointer, &pointer);
|
128
93
|
|
129
94
|
return pointer;
|
130
95
|
}
|
131
96
|
|
132
97
|
NativePointerEvent::NativePointerEvent (
|
133
|
-
NSSet* touches, UIEvent* event, UIView* view
|
134
|
-
Pointer::ID* pointer_id)
|
135
|
-
{
|
136
|
-
for (UITouch* touch in touches)
|
137
|
-
{
|
138
|
-
PointerEvent_add_pointer(
|
139
|
-
this, create_pointer(touch, event, view, time(), ++*pointer_id, NULL));
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
NativePointerEvent::NativePointerEvent (
|
144
|
-
NSSet* touches, UIEvent* event, UIView* view,
|
145
|
-
PrevPointerList* prev_pointers)
|
98
|
+
NSSet* touches, UIEvent* event, UIView* view)
|
146
99
|
{
|
147
100
|
for (UITouch* touch in touches)
|
148
101
|
{
|
149
|
-
|
150
|
-
|
102
|
+
Pointer pointer = create_pointer(touch, event, view);
|
103
|
+
if (pointer) PointerEvent_add_pointer(this, pointer);
|
151
104
|
}
|
152
105
|
}
|
153
106
|
|