reflexion 0.1.57 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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 value(argc, argv);
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 value(argc, argv);
123
+ return array(argv, argc);
124
124
  }
125
125
  RUCY_END
126
126
 
data/ext/reflex/view.cpp CHANGED
@@ -31,7 +31,7 @@ array (T begin, T end)
31
31
  {
32
32
  std::vector<Value> v;
33
33
  for (T it = begin; it != end; ++it) v.push_back(value(*it));
34
- return value(v.size(), &v[0]);
34
+ return array(&v[0], v.size());
35
35
  }
36
36
 
37
37
 
@@ -66,188 +66,199 @@ namespace Reflex
66
66
  enum KeyCode
67
67
  {
68
68
 
69
- KEY_NONE = 0,
70
-
71
- KEY_A,
72
- KEY_B,
73
- KEY_C,
74
- KEY_D,
75
- KEY_E,
76
- KEY_F,
77
- KEY_G,
78
- KEY_H,
79
- KEY_I,
80
- KEY_J,
81
- KEY_K,
82
- KEY_L,
83
- KEY_M,
84
- KEY_N,
85
- KEY_O,
86
- KEY_P,
87
- KEY_Q,
88
- KEY_R,
89
- KEY_S,
90
- KEY_T,
91
- KEY_U,
92
- KEY_V,
93
- KEY_W,
94
- KEY_X,
95
- KEY_Y,
96
- KEY_Z,
97
-
98
- KEY_0,
99
- KEY_1,
100
- KEY_2,
101
- KEY_3,
102
- KEY_4,
103
- KEY_5,
104
- KEY_6,
105
- KEY_7,
106
- KEY_8,
107
- KEY_9,
108
-
109
- KEY_MINUS,
110
- KEY_EQUAL,
111
- KEY_COMMA,
112
- KEY_PERIOD,
113
- KEY_SEMICOLON,
114
- KEY_QUOTE,
115
- KEY_SLASH,
116
- KEY_BACKSLASH,
117
- KEY_UNDERSCORE,
118
- KEY_GRAVE,
119
- KEY_YEN,
120
- KEY_LBRACKET,
121
- KEY_RBRACKET,
122
-
123
- KEY_ENTER,
124
- KEY_RETURN,
125
- KEY_SPACE,
126
- KEY_TAB,
127
- KEY_DELETE,
128
- KEY_BACKSPACE,
129
- //KEY_INSERT,
130
- KEY_ESCAPE,
131
-
132
- KEY_LEFT,
133
- KEY_RIGHT,
134
- KEY_UP,
135
- KEY_DOWN,
136
- KEY_HOME,
137
- KEY_END,
138
- KEY_PAGEUP,
139
- KEY_PAGEDOWN,
140
-
141
- KEY_LSHIFT,
142
- KEY_RSHIFT,
143
- KEY_LCONTROL,
144
- KEY_RCONTROL,
145
- //KEY_LALT,
146
- //KEY_RALT,
147
- //KEY_LWIN,
148
- //KEY_RWIN,
149
- KEY_LCOMMAND,
150
- KEY_RCOMMAND,
151
- KEY_LOPTION,
152
- KEY_ROPTION,
153
- KEY_FUNCTION,
154
-
155
- KEY_F1,
156
- KEY_F2,
157
- KEY_F3,
158
- KEY_F4,
159
- KEY_F5,
160
- KEY_F6,
161
- KEY_F7,
162
- KEY_F8,
163
- KEY_F9,
164
- KEY_F10,
165
- KEY_F11,
166
- KEY_F12,
167
- KEY_F13,
168
- KEY_F14,
169
- KEY_F15,
170
- KEY_F16,
171
- KEY_F17,
172
- KEY_F18,
173
- KEY_F19,
174
- KEY_F20,
175
- //KEY_F21,
176
- //KEY_F22,
177
- //KEY_F23,
178
- //KEY_F24,
179
-
180
- KEY_NUM_0,
181
- KEY_NUM_1,
182
- KEY_NUM_2,
183
- KEY_NUM_3,
184
- KEY_NUM_4,
185
- KEY_NUM_5,
186
- KEY_NUM_6,
187
- KEY_NUM_7,
188
- KEY_NUM_8,
189
- KEY_NUM_9,
190
-
191
- KEY_NUM_PLUS,
192
- KEY_NUM_MINUS,
193
- KEY_NUM_MULTIPLY,
194
- KEY_NUM_DIVIDE,
195
- KEY_NUM_EQUAL,
196
- KEY_NUM_COMMA,
197
- KEY_NUM_DECIMAL,
198
- KEY_NUM_CLEAR,
199
-
200
- KEY_CAPSLOCK,
201
- //KEY_NUMLOCK,
202
- //KEY_SCROLLLOCK,
203
-
204
- //KEY_PRINTSCREEN,
205
- //KEY_PAUSE,
206
- //KEY_BREAK,
207
- KEY_SECTION,
208
- KEY_HELP,
209
-
210
- KEY_IME_EISU,
211
- KEY_IME_KANA,
212
- //KEY_IME_KANJI,
213
- //KEY_IME_JUNJA,
214
- //KEY_IME_PROCESS,
215
- //KEY_IME_ACCEPT,
216
- //KEY_IME_FINAL,
217
- //KEY_IME_CONVERT,
218
- //KEY_IME_NONCONVERT,
219
- //KEY_IME_MODECHANGE,
220
-
221
- KEY_VOLUME_UP,
222
- KEY_VOLUME_DOWN,
223
- KEY_MUTE,
224
-
225
- //KEY_SLEEP,
226
- //KEY_EXEC,
227
- //KEY_PRINT,
228
- //KEY_APPS,
229
- //KEY_SELECT,
230
- //KEY_CLEAR,
231
- //KEY_PLAY,
232
- //KEY_ZOOM,
233
-
234
- //KEY_BROWSER_BACK,
235
- //KEY_BROWSER_FORWARD,
236
- //KEY_BROWSER_REFRESH,
237
- //KEY_BROWSER_STOP,
238
- //KEY_BROWSER_SEARCH,
239
- //KEY_BROWSER_FAVORITES,
240
- //KEY_BROWSER_HOME,
241
-
242
- //KEY_MEDIA_NEXT_TRACK,
243
- //KEY_MEDIA_PREV_TRACK,
244
- //KEY_MEDIA_STOP,
245
- //KEY_MEDIA_PLAY_PAUSE,
246
-
247
- //KEY_LAUNCH_MAIL,
248
- //KEY_LAUNCH_MEDIA_SELECT,
249
- //KEY_LAUNCH_APP1,
250
- //KEY_LAUNCH_APP2,
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 = MOD_ALT,
281
+ MOD_OPTION = 0x1 << 4,
271
282
 
272
- MOD_COMMAND = MOD_WIN,
283
+ MOD_COMMAND = 0x1 << 5,
273
284
 
274
- MOD_HELP = 0x1 << 4,
285
+ MOD_HELP = 0x1 << 6,
275
286
 
276
- MOD_FUNCTION = 0x1 << 5,
287
+ MOD_FUNCTION = 0x1 << 7,
277
288
 
278
- MOD_NUMPAD = 0x1 << 6,
289
+ MOD_NUMPAD = 0x1 << 8,
279
290
 
280
- MOD_CAPS = 0x1 << 7,
291
+ MOD_CAPS = 0x1 << 9,
281
292
 
282
293
  };// Modifier
283
294
 
@@ -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
 
@@ -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:#{action} chars:'#{chars}' code:#{code} mod:#{modifiers} repeat:#{repeat} captured?:#{captured?}>"
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.42'
29
- s.add_runtime_dependency 'rucy', '~> 0.1.44'
30
- s.add_runtime_dependency 'beeps', '~> 0.1.46'
31
- s.add_runtime_dependency 'rays', '~> 0.1.49'
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.type, points.x, points.y, points.size, points.modifiers, points.count, points.drag]
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
@@ -545,6 +545,7 @@ namespace Reflex
545
545
  const char*
546
546
  KeyEvent::chars () const
547
547
  {
548
+ if (self->chars.empty()) return NULL;
548
549
  return self->chars;
549
550
  }
550
551
 
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
- pointer_id,
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
- time);
86
+ touch.timestamp);
119
87
 
120
- if (prev_pointers)
88
+ if (touch.phase != UITouchPhaseBegan)
121
89
  {
122
- attach_prev_pointer(
123
- &pointer, prev_pointers,
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
- PointerEvent_add_pointer(
150
- this, create_pointer(touch, event, view, time(), 0, prev_pointers));
102
+ Pointer pointer = create_pointer(touch, event, view);
103
+ if (pointer) PointerEvent_add_pointer(this, pointer);
151
104
  }
152
105
  }
153
106