reflexion 0.1.57 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  #include <assert.h>
6
- #include <rays/opengl.h>
6
+ #include <rays/rays.h>
7
7
  #include "reflex/exception.h"
8
8
  #include "../view.h"
9
9
  #include "../pointer.h"
@@ -136,8 +136,6 @@ ReflexViewController_get_show_fun ()
136
136
  Reflex::Window *pwindow, *ptr_for_rebind;
137
137
  int update_count;
138
138
  int touching_count;
139
- Reflex::Pointer::ID pointer_id;
140
- Reflex::PrevPointerList prev_pointers;
141
139
  }
142
140
 
143
141
  - (id) init
@@ -149,7 +147,6 @@ ReflexViewController_get_show_fun ()
149
147
  ptr_for_rebind = NULL;
150
148
  update_count = 0;
151
149
  touching_count = 0;
152
- pointer_id = 0;
153
150
 
154
151
  return self;
155
152
  }
@@ -272,9 +269,8 @@ ReflexViewController_get_show_fun ()
272
269
  ReflexView* view = self.reflexView;
273
270
  if (!view) return;
274
271
 
275
- EAGLContext* context = view.context;
276
- if (context && context == [EAGLContext currentContext])
277
- [EAGLContext setCurrentContext: (EAGLContext*) Rays::get_offscreen_context()];
272
+ if (view.context && view.context == [EAGLContext currentContext])
273
+ Rays::activate_offscreen_context();
278
274
 
279
275
  view.reflexViewController = nil;
280
276
  [view removeFromSuperview];
@@ -421,23 +417,22 @@ ReflexViewController_get_show_fun ()
421
417
  win->self->prev_position = b.position();
422
418
  win->self->prev_size = b.size();
423
419
 
424
- if (dpos != 0 || dsize != 0)
420
+ if (dpos == 0 && dsize == 0) return;
421
+
422
+ Reflex::FrameEvent e(b, dpos.x, dpos.y, 0, dsize.x, dsize.y, 0);
423
+ if (dpos != 0) win->on_move(&e);
424
+ if (dsize != 0)
425
425
  {
426
- Reflex::FrameEvent e(b, dpos.x, dpos.y, 0, dsize.x, dsize.y, 0);
427
- if (dpos != 0) win->on_move(&e);
428
- if (dsize != 0)
429
- {
430
- Rays::Bounds b = win->frame();
431
- b.move_to(0, 0);
426
+ Rays::Bounds b = win->frame();
427
+ b.move_to(0, 0);
432
428
 
433
- if (win->painter())
434
- win->painter()->canvas(b, win->painter()->pixel_density());
429
+ if (win->painter())
430
+ win->painter()->canvas(b, win->painter()->pixel_density());
435
431
 
436
- if (win->root())
437
- View_set_frame(win->root(), b);
432
+ if (win->root())
433
+ View_set_frame(win->root(), b);
438
434
 
439
- win->on_resize(&e);
440
- }
435
+ win->on_resize(&e);
441
436
  }
442
437
  }
443
438
 
@@ -481,12 +476,10 @@ ReflexViewController_get_show_fun ()
481
476
  Reflex::Window* win = self.window;
482
477
  if (!win) return;
483
478
 
484
- Reflex::NativePointerEvent e(touches, event, self.reflexView, &pointer_id);
485
- [self addToPrevPointers: e];
479
+ Reflex::NativePointerEvent e(touches, event, self.reflexView);
480
+ Window_call_pointer_event(win, &e);
486
481
 
487
482
  touching_count += e.size();
488
-
489
- Window_call_pointer_event(win, &e);
490
483
  }
491
484
 
492
485
  - (void) touchesEnded: (NSSet*) touches withEvent: (UIEvent*) event
@@ -494,15 +487,14 @@ ReflexViewController_get_show_fun ()
494
487
  Reflex::Window* win = self.window;
495
488
  if (!win) return;
496
489
 
497
- Reflex::NativePointerEvent e(touches, event, self.reflexView, &prev_pointers);
490
+ Reflex::NativePointerEvent e(touches, event, self.reflexView);
491
+ Window_call_pointer_event(win, &e);
498
492
 
499
493
  touching_count -= e.size();
500
494
  if (touching_count == 0)
501
- prev_pointers.clear();
495
+ win->self->prev_pointers.clear();
502
496
  else if (touching_count < 0)
503
497
  Reflex::invalid_state_error(__FILE__, __LINE__);
504
-
505
- Window_call_pointer_event(win, &e);
506
498
  }
507
499
 
508
500
  - (void) touchesCancelled: (NSSet*) touches withEvent: (UIEvent*) event
@@ -515,23 +507,8 @@ ReflexViewController_get_show_fun ()
515
507
  Reflex::Window* win = self.window;
516
508
  if (!win) return;
517
509
 
518
- Reflex::NativePointerEvent e(touches, event, self.reflexView, &prev_pointers);
519
- [self addToPrevPointers: e];
520
-
510
+ Reflex::NativePointerEvent e(touches, event, self.reflexView);
521
511
  Window_call_pointer_event(win, &e);
522
512
  }
523
513
 
524
- - (void) addToPrevPointers: (const Reflex::PointerEvent&) event
525
- {
526
- size_t size = event.size();
527
- for (size_t i = 0; i < size; ++i)
528
- {
529
- prev_pointers.emplace_back(event[i]);
530
- if (prev_pointers.size() > 10)
531
- Reflex::invalid_state_error(__FILE__, __LINE__);
532
-
533
- Reflex::Pointer_set_prev(&prev_pointers.back(), NULL);
534
- }
535
- }
536
-
537
514
  @end// ReflexViewController
data/src/ios/window.mm CHANGED
@@ -142,6 +142,25 @@ namespace Reflex
142
142
  return Bounds(b.origin.x, b.origin.y, b.size.width, b.size.height);
143
143
  }
144
144
 
145
+ static UIScreen*
146
+ get_screen (const Window& window)
147
+ {
148
+ UIWindow* w = get_vc(&window).view.window;
149
+ if (@available(iOS 13.0, *))
150
+ return w.windowScene.screen;
151
+ else
152
+ return w.screen;
153
+ }
154
+
155
+ Screen
156
+ Window_get_screen (const Window& window)
157
+ {
158
+ Screen s;
159
+ UIScreen* screen = get_screen(window);
160
+ Screen_initialize(&s, screen ? screen : UIScreen.mainScreen);
161
+ return s;
162
+ }
163
+
145
164
  static UIInterfaceOrientationMask g_orientation_mask =
146
165
  UIInterfaceOrientationMaskAll;
147
166
 
@@ -246,25 +265,6 @@ namespace Reflex
246
265
  flags_to_orientation_mask(flags & (Window::FLAG_PORTRAIT | Window::FLAG_LANDSCAPE)));
247
266
  }
248
267
 
249
- static UIScreen*
250
- get_screen (const Window& window)
251
- {
252
- UIWindow* w = get_vc(&window).view.window;
253
- if (@available(iOS 13.0, *))
254
- return w.windowScene.screen;
255
- else
256
- return w.screen;
257
- }
258
-
259
- Screen
260
- Window_get_screen (const Window& window)
261
- {
262
- Screen s;
263
- UIScreen* screen = get_screen(window);
264
- Screen_initialize(&s, screen ? screen : UIScreen.mainScreen);
265
- return s;
266
- }
267
-
268
268
  float
269
269
  Window_get_pixel_density (const Window& window)
270
270
  {
data/src/osx/event.h CHANGED
@@ -38,7 +38,7 @@ namespace Reflex
38
38
  public:
39
39
 
40
40
  NativePointerEvent (
41
- NSEvent* event, NSView* view, Pointer::ID id, Pointer::Action action);
41
+ NSEvent* event, NSView* view, Pointer::Action action);
42
42
 
43
43
  };// NativePointerEvent
44
44
 
data/src/osx/event.mm CHANGED
@@ -11,145 +11,47 @@ namespace Reflex
11
11
  {
12
12
 
13
13
 
14
- static const char*
15
- get_chars (NSEvent* e)
14
+ static uint
15
+ get_modifiers (const NSEvent* e)
16
16
  {
17
- NSString* chars = [e characters];//charactersIgnoringModifiers];
18
- return [chars UTF8String];
17
+ NSUInteger flags = e.modifierFlags;
18
+ return
19
+ (flags & NSAlphaShiftKeyMask) ? MOD_CAPS : 0 |
20
+ (flags & NSShiftKeyMask) ? MOD_SHIFT : 0 |
21
+ (flags & NSControlKeyMask) ? MOD_CONTROL : 0 |
22
+ (flags & NSAlternateKeyMask) ? MOD_OPTION : 0 |
23
+ (flags & NSCommandKeyMask) ? MOD_COMMAND : 0 |
24
+ (flags & NSNumericPadKeyMask) ? MOD_NUMPAD : 0 |
25
+ (flags & NSHelpKeyMask) ? MOD_HELP : 0 |
26
+ (flags & NSFunctionKeyMask) ? MOD_FUNCTION : 0;
19
27
  }
20
28
 
21
- static KeyCode
22
- get_code (UInt16 code)
29
+ static Point
30
+ get_pointer_position (NSEvent* e, NSView* view)
23
31
  {
24
- switch (code)
25
- {
26
- case kVK_ANSI_A: return KEY_A;
27
- case kVK_ANSI_S: return KEY_S;
28
- case kVK_ANSI_D: return KEY_D;
29
- case kVK_ANSI_F: return KEY_F;
30
- case kVK_ANSI_H: return KEY_H;
31
- case kVK_ANSI_G: return KEY_G;
32
- case kVK_ANSI_Z: return KEY_Z;
33
- case kVK_ANSI_X: return KEY_X;
34
- case kVK_ANSI_C: return KEY_C;
35
- case kVK_ANSI_V: return KEY_V;
36
- case kVK_ANSI_B: return KEY_B;
37
- case kVK_ANSI_Q: return KEY_Q;
38
- case kVK_ANSI_W: return KEY_W;
39
- case kVK_ANSI_E: return KEY_E;
40
- case kVK_ANSI_R: return KEY_R;
41
- case kVK_ANSI_Y: return KEY_Y;
42
- case kVK_ANSI_T: return KEY_T;
43
- case kVK_ANSI_1: return KEY_1;
44
- case kVK_ANSI_2: return KEY_2;
45
- case kVK_ANSI_3: return KEY_3;
46
- case kVK_ANSI_4: return KEY_4;
47
- case kVK_ANSI_6: return KEY_6;
48
- case kVK_ANSI_5: return KEY_5;
49
- case kVK_ANSI_Equal: return KEY_EQUAL;
50
- case kVK_ANSI_9: return KEY_9;
51
- case kVK_ANSI_7: return KEY_7;
52
- case kVK_ANSI_Minus: return KEY_MINUS;
53
- case kVK_ANSI_8: return KEY_8;
54
- case kVK_ANSI_0: return KEY_0;
55
- case kVK_ANSI_RightBracket: return KEY_RBRACKET;
56
- case kVK_ANSI_O: return KEY_O;
57
- case kVK_ANSI_U: return KEY_U;
58
- case kVK_ANSI_LeftBracket: return KEY_LBRACKET;
59
- case kVK_ANSI_I: return KEY_I;
60
- case kVK_ANSI_P: return KEY_P;
61
- case kVK_ANSI_L: return KEY_L;
62
- case kVK_ANSI_J: return KEY_J;
63
- case kVK_ANSI_Quote: return KEY_QUOTE;
64
- case kVK_ANSI_K: return KEY_K;
65
- case kVK_ANSI_Semicolon: return KEY_SEMICOLON;
66
- case kVK_ANSI_Backslash: return KEY_BACKSLASH;
67
- case kVK_ANSI_Comma: return KEY_COMMA;
68
- case kVK_ANSI_Slash: return KEY_SLASH;
69
- case kVK_ANSI_N: return KEY_N;
70
- case kVK_ANSI_M: return KEY_M;
71
- case kVK_ANSI_Period: return KEY_PERIOD;
72
- case kVK_ANSI_Grave: return KEY_GRAVE;
73
- case kVK_ANSI_KeypadDecimal: return KEY_NUM_DECIMAL;
74
- case kVK_ANSI_KeypadMultiply: return KEY_NUM_MULTIPLY;
75
- case kVK_ANSI_KeypadPlus: return KEY_NUM_PLUS;
76
- case kVK_ANSI_KeypadClear: return KEY_NUM_CLEAR;
77
- case kVK_ANSI_KeypadDivide: return KEY_NUM_DIVIDE;
78
- case kVK_ANSI_KeypadEnter: return KEY_ENTER;
79
- case kVK_ANSI_KeypadMinus: return KEY_NUM_MINUS;
80
- case kVK_ANSI_KeypadEquals: return KEY_NUM_EQUAL;
81
- case kVK_ANSI_Keypad0: return KEY_NUM_0;
82
- case kVK_ANSI_Keypad1: return KEY_NUM_1;
83
- case kVK_ANSI_Keypad2: return KEY_NUM_2;
84
- case kVK_ANSI_Keypad3: return KEY_NUM_3;
85
- case kVK_ANSI_Keypad4: return KEY_NUM_4;
86
- case kVK_ANSI_Keypad5: return KEY_NUM_5;
87
- case kVK_ANSI_Keypad6: return KEY_NUM_6;
88
- case kVK_ANSI_Keypad7: return KEY_NUM_7;
89
- case kVK_ANSI_Keypad8: return KEY_NUM_8;
90
- case kVK_ANSI_Keypad9: return KEY_NUM_9;
32
+ assert(view);
91
33
 
92
- case kVK_Return: return KEY_RETURN;
93
- case kVK_Tab: return KEY_TAB;
94
- case kVK_Space: return KEY_SPACE;
95
- case kVK_Delete: return KEY_BACKSPACE;
96
- case kVK_Escape: return KEY_ESCAPE;
97
- case kVK_Command: return KEY_LCOMMAND;
98
- case kVK_Shift: return KEY_LSHIFT;
99
- case kVK_CapsLock: return KEY_CAPSLOCK;
100
- case kVK_Option: return KEY_LOPTION;
101
- case kVK_Control: return KEY_LCONTROL;
102
- case kVK_RightCommand: return KEY_RCOMMAND;
103
- case kVK_RightShift: return KEY_RSHIFT;
104
- case kVK_RightOption: return KEY_ROPTION;
105
- case kVK_RightControl: return KEY_RCONTROL;
106
- case kVK_Function: return KEY_FUNCTION;
107
- case kVK_F17: return KEY_F17;
108
- case kVK_VolumeUp: return KEY_VOLUME_UP;
109
- case kVK_VolumeDown: return KEY_VOLUME_DOWN;
110
- case kVK_Mute: return KEY_MUTE;
111
- case kVK_F18: return KEY_F18;
112
- case kVK_F19: return KEY_F19;
113
- case kVK_F20: return KEY_F20;
114
- case kVK_F5: return KEY_F5;
115
- case kVK_F6: return KEY_F6;
116
- case kVK_F7: return KEY_F7;
117
- case kVK_F3: return KEY_F3;
118
- case kVK_F8: return KEY_F8;
119
- case kVK_F9: return KEY_F9;
120
- case kVK_F11: return KEY_F11;
121
- case kVK_F13: return KEY_F13;
122
- case kVK_F16: return KEY_F16;
123
- case kVK_F14: return KEY_F14;
124
- case kVK_F10: return KEY_F10;
125
- case kVK_F12: return KEY_F12;
126
- case kVK_F15: return KEY_F15;
127
- case kVK_Help: return KEY_HELP;
128
- case kVK_Home: return KEY_HOME;
129
- case kVK_PageUp: return KEY_PAGEUP;
130
- case kVK_ForwardDelete: return KEY_DELETE;
131
- case kVK_F4: return KEY_F4;
132
- case kVK_End: return KEY_END;
133
- case kVK_F2: return KEY_F2;
134
- case kVK_PageDown: return KEY_PAGEDOWN;
135
- case kVK_F1: return KEY_F1;
136
- case kVK_LeftArrow: return KEY_LEFT;
137
- case kVK_RightArrow: return KEY_RIGHT;
138
- case kVK_DownArrow: return KEY_DOWN;
139
- case kVK_UpArrow: return KEY_UP;
34
+ NSPoint p = [view convertPoint: e.locationInWindow fromView: nil];
35
+ p.y = view.bounds.size.height - p.y;
36
+ return Point(p.x, p.y);
37
+ }
140
38
 
141
- case kVK_ISO_Section: return KEY_SECTION;
142
39
 
143
- case kVK_JIS_Yen: return KEY_YEN;
144
- case kVK_JIS_Underscore: return KEY_UNDERSCORE;
145
- case kVK_JIS_KeypadComma: return KEY_NUM_COMMA;
146
- case kVK_JIS_Eisu: return KEY_IME_EISU;
147
- case kVK_JIS_Kana: return KEY_IME_KANA;
148
- }
40
+ static const char*
41
+ get_chars (NSEvent* e)
42
+ {
43
+ NSString* chars = [e characters];//charactersIgnoringModifiers];
44
+ return [chars UTF8String];
45
+ }
149
46
 
150
- return KEY_NONE;
47
+ NativeKeyEvent::NativeKeyEvent (NSEvent* e, Action action)
48
+ : KeyEvent(
49
+ action, get_chars(e), [e keyCode],
50
+ get_modifiers(e), [e isARepeat] ? 1 : 0)
51
+ {
151
52
  }
152
53
 
54
+
153
55
  static uint
154
56
  get_modifier_flag_mask (const NSEvent* e)
155
57
  {
@@ -180,6 +82,23 @@ namespace Reflex
180
82
  : Reflex::KeyEvent::UP;
181
83
  }
182
84
 
85
+ NativeFlagKeyEvent::NativeFlagKeyEvent (NSEvent* e)
86
+ : KeyEvent(
87
+ get_flag_key_event_action(e), "", [e keyCode],
88
+ get_modifiers(e), 0)
89
+ {
90
+ }
91
+
92
+
93
+ static bool
94
+ is_pointer_dragging (NSEvent* e)
95
+ {
96
+ return
97
+ [e type] == NSLeftMouseDragged ||
98
+ [e type] == NSRightMouseDragged ||
99
+ [e type] == NSOtherMouseDragged;
100
+ }
101
+
183
102
  static uint
184
103
  get_current_pointer_type ()
185
104
  {
@@ -219,75 +138,18 @@ namespace Reflex
219
138
  }
220
139
  }
221
140
 
222
- static uint
223
- get_modifiers (const NSEvent* e)
224
- {
225
- NSUInteger flags = [e modifierFlags];
226
- return
227
- (flags & NSAlphaShiftKeyMask) ? MOD_CAPS : 0 |
228
- (flags & NSShiftKeyMask) ? MOD_SHIFT : 0 |
229
- (flags & NSControlKeyMask) ? MOD_CONTROL : 0 |
230
- (flags & NSAlternateKeyMask) ? MOD_ALT : 0 |
231
- (flags & NSCommandKeyMask) ? MOD_COMMAND : 0 |
232
- (flags & NSNumericPadKeyMask) ? MOD_NUMPAD : 0 |
233
- (flags & NSHelpKeyMask) ? MOD_HELP : 0 |
234
- (flags & NSFunctionKeyMask) ? MOD_FUNCTION : 0;
235
- }
236
-
237
- static NSPoint
238
- correct_point (NSView* view, const NSPoint& point)
239
- {
240
- assert(view);
241
- NSPoint p = [view convertPoint: point fromView: nil];
242
- p.y = [view bounds].size.height - p.y;
243
- return p;
244
- }
245
-
246
- static Point
247
- get_pointer_position (NSEvent* e, NSView* view)
248
- {
249
- NSPoint p = correct_point(view, [e locationInWindow]);
250
- return Point(p.x, p.y);
251
- }
252
-
253
-
254
- NativeKeyEvent::NativeKeyEvent (NSEvent* e, Action action)
255
- : KeyEvent(
256
- action, get_chars(e), get_code([e keyCode]),
257
- get_modifiers(e), [e isARepeat] ? 1 : 0)
258
- {
259
- }
260
-
261
-
262
- NativeFlagKeyEvent::NativeFlagKeyEvent (NSEvent* e)
263
- : KeyEvent(
264
- get_flag_key_event_action(e), "", get_code([e keyCode]),
265
- get_modifiers(e), 0)
266
- {
267
- }
268
-
269
-
270
- static bool
271
- is_pointer_dragging (NSEvent* e)
272
- {
273
- return
274
- [e type] == NSLeftMouseDragged ||
275
- [e type] == NSRightMouseDragged ||
276
- [e type] == NSOtherMouseDragged;
277
- }
278
-
279
141
  NativePointerEvent::NativePointerEvent (
280
- NSEvent* event, NSView* view, Pointer::ID id, Pointer::Action action)
142
+ NSEvent* event, NSView* view, Pointer::Action action)
281
143
  {
282
144
  bool dragging = is_pointer_dragging(event);
283
145
  PointerEvent_add_pointer(this, Pointer(
284
- id,
146
+ 0,
285
147
  get_pointer_type(event),
286
148
  action,
287
149
  get_pointer_position(event, view),
288
150
  get_modifiers(event),
289
151
  dragging,
290
- action == Pointer::MOVE && !dragging ? 0 : (uint) [event clickCount],
152
+ action == Pointer::MOVE && !dragging ? 0 : (uint) event.clickCount,
291
153
  0,
292
154
  time()));
293
155
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include <assert.h>
6
6
  #import <Cocoa/Cocoa.h>
7
+ #include <rays/rays.h>
7
8
  #include "reflex/exception.h"
8
9
  #include "../view.h"
9
10
  #include "../pointer.h"
@@ -12,12 +13,6 @@
12
13
  #import "opengl_view.h"
13
14
 
14
15
 
15
- static const uint MOUSE_BUTTONS =
16
- Reflex::Pointer::MOUSE_LEFT |
17
- Reflex::Pointer::MOUSE_RIGHT |
18
- Reflex::Pointer::MOUSE_MIDDLE;
19
-
20
-
21
16
  static NSWindowStyleMask
22
17
  default_style_mask ()
23
18
  {
@@ -61,8 +56,6 @@ move_to_main_screen_origin (NativeWindow* window)
61
56
  OpenGLView* view;
62
57
  NSTimer* timer;
63
58
  int update_count;
64
- Reflex::Pointer::ID pointer_id;
65
- Reflex::Pointer prev_pointer;
66
59
  }
67
60
 
68
61
  - (id) init
@@ -74,12 +67,11 @@ move_to_main_screen_origin (NativeWindow* window)
74
67
  defer: NO];
75
68
  if (!self) return nil;
76
69
 
77
- pwindow =
78
- ptr_for_rebind = NULL;
79
- view = nil;
80
- timer = nil;
81
- update_count = 0;
82
- pointer_id = 0;
70
+ pwindow =
71
+ ptr_for_rebind = NULL;
72
+ view = nil;
73
+ timer = nil;
74
+ update_count = 0;
83
75
 
84
76
  [self setDelegate: self];
85
77
  [self setupContentView];
@@ -92,8 +84,7 @@ move_to_main_screen_origin (NativeWindow* window)
92
84
  {
93
85
  assert(!pwindow);
94
86
 
95
- if (view) [view release];
96
-
87
+ [self cleanupContentView];
97
88
  [super dealloc];
98
89
  }
99
90
 
@@ -156,6 +147,16 @@ move_to_main_screen_origin (NativeWindow* window)
156
147
  [self setContentView: view];
157
148
  }
158
149
 
150
+ - (void) cleanupContentView
151
+ {
152
+ if (!view) return;
153
+
154
+ if (view.openGLContext == NSOpenGLContext.currentContext)
155
+ Rays::activate_offscreen_context();
156
+
157
+ [view release];
158
+ }
159
+
159
160
  - (void) startTimer
160
161
  {
161
162
  [self startTimer: 60];
@@ -297,23 +298,22 @@ move_to_main_screen_origin (NativeWindow* window)
297
298
  win->self->prev_position = b.position();
298
299
  win->self->prev_size = b.size();
299
300
 
300
- if (dpos != 0 || dsize != 0)
301
+ if (dpos == 0 && dsize == 0) return;
302
+
303
+ Reflex::FrameEvent e(b, dpos.x, dpos.y, 0, dsize.x, dsize.y, 0);
304
+ if (dpos != 0) win->on_move(&e);
305
+ if (dsize != 0)
301
306
  {
302
- Reflex::FrameEvent e(b, dpos.x, dpos.y, 0, dsize.x, dsize.y, 0);
303
- if (dpos != 0) win->on_move(&e);
304
- if (dsize != 0)
305
- {
306
- Rays::Bounds b = win->frame();
307
- b.move_to(0, 0);
307
+ Rays::Bounds b = win->frame();
308
+ b.move_to(0, 0);
308
309
 
309
- if (win->painter())
310
- win->painter()->canvas(b, win->painter()->pixel_density());
310
+ if (win->painter())
311
+ win->painter()->canvas(b, win->painter()->pixel_density());
311
312
 
312
- if (win->root())
313
- View_set_frame(win->root(), b);
313
+ if (win->root())
314
+ View_set_frame(win->root(), b);
314
315
 
315
- win->on_resize(&e);
316
- }
316
+ win->on_resize(&e);
317
317
  }
318
318
  }
319
319
 
@@ -394,10 +394,7 @@ move_to_main_screen_origin (NativeWindow* window)
394
394
  Reflex::Window* win = self.window;
395
395
  if (!win) return;
396
396
 
397
- if (Reflex::Pointer_mask_flag(prev_pointer, MOUSE_BUTTONS) == 0)
398
- ++pointer_id;
399
-
400
- Reflex::NativePointerEvent e(event, view, pointer_id, Reflex::Pointer::DOWN);
397
+ Reflex::NativePointerEvent e(event, view, Reflex::Pointer::DOWN);
401
398
 
402
399
  if (e[0].position().y < 0)
403
400
  {
@@ -406,8 +403,6 @@ move_to_main_screen_origin (NativeWindow* window)
406
403
  return;
407
404
  }
408
405
 
409
- [self attachAndUpdatePastPointers: &e];
410
-
411
406
  Window_call_pointer_event(win, &e);
412
407
  }
413
408
 
@@ -416,15 +411,7 @@ move_to_main_screen_origin (NativeWindow* window)
416
411
  Reflex::Window* win = self.window;
417
412
  if (!win) return;
418
413
 
419
- Reflex::NativePointerEvent e(event, view, pointer_id, Reflex::Pointer::UP);
420
- [self attachAndUpdatePastPointers: &e];
421
-
422
- if (prev_pointer && Reflex::Pointer_mask_flag(prev_pointer, MOUSE_BUTTONS) == 0)
423
- {
424
- ++pointer_id;
425
- Pointer_set_down(&prev_pointer, NULL);
426
- }
427
-
414
+ Reflex::NativePointerEvent e(event, view, Reflex::Pointer::UP);
428
415
  Window_call_pointer_event(win, &e);
429
416
  }
430
417
 
@@ -433,9 +420,7 @@ move_to_main_screen_origin (NativeWindow* window)
433
420
  Reflex::Window* win = self.window;
434
421
  if (!win) return;
435
422
 
436
- Reflex::NativePointerEvent e(event, view, pointer_id, Reflex::Pointer::MOVE);
437
- [self attachAndUpdatePastPointers: &e];
438
-
423
+ Reflex::NativePointerEvent e(event, view, Reflex::Pointer::MOVE);
439
424
  Window_call_pointer_event(win, &e);
440
425
  }
441
426
 
@@ -444,46 +429,10 @@ move_to_main_screen_origin (NativeWindow* window)
444
429
  Reflex::Window* win = self.window;
445
430
  if (!win) return;
446
431
 
447
- Reflex::NativePointerEvent e(event, view, pointer_id, Reflex::Pointer::MOVE);
448
- [self attachAndUpdatePastPointers: &e];
449
-
432
+ Reflex::NativePointerEvent e(event, view, Reflex::Pointer::MOVE);
450
433
  Window_call_pointer_event(win, &e);
451
434
  }
452
435
 
453
- - (void) attachAndUpdatePastPointers: (Reflex::PointerEvent*) e
454
- {
455
- using namespace Reflex;
456
-
457
- assert(e->size() == 1);
458
-
459
- Pointer& pointer = PointerEvent_pointer_at(e, 0);
460
-
461
- if (prev_pointer)
462
- {
463
- Pointer_add_flag(&pointer, Pointer_mask_flag(prev_pointer, MOUSE_BUTTONS));
464
- Reflex::Pointer_set_prev(&pointer, &prev_pointer);
465
- }
466
-
467
- switch (pointer.action())
468
- {
469
- case Pointer::DOWN:
470
- Pointer_add_flag(&pointer, pointer.types());
471
- break;
472
-
473
- case Pointer::UP:
474
- Pointer_remove_flag(&pointer, pointer.types());
475
- break;
476
- }
477
-
478
- if (prev_pointer && prev_pointer.down())
479
- Reflex::Pointer_set_down(&pointer, prev_pointer.down());
480
- else if (pointer.action() == Reflex::Pointer::DOWN)
481
- Reflex::Pointer_set_down(&pointer, &pointer);
482
-
483
- prev_pointer = pointer;
484
- Reflex::Pointer_set_prev(&prev_pointer, NULL);
485
- }
486
-
487
436
  - (void) scrollWheel: (NSEvent*) event
488
437
  {
489
438
  Reflex::Window* win = self.window;