reflexion 0.1.38 → 0.1.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/capture_event.cpp +1 -1
  3. data/.doc/ext/reflex/event.cpp +7 -2
  4. data/.doc/ext/reflex/frame_event.cpp +25 -8
  5. data/.doc/ext/reflex/motion_event.cpp +4 -4
  6. data/.doc/ext/reflex/pointer.cpp +15 -6
  7. data/.doc/ext/reflex/pointer_event.cpp +0 -1
  8. data/.doc/ext/reflex/polygon_shape.cpp +1 -1
  9. data/.doc/ext/reflex/scroll_event.cpp +1 -1
  10. data/.doc/ext/reflex/style.cpp +2 -2
  11. data/.doc/ext/reflex/wheel_event.cpp +1 -1
  12. data/ChangeLog.md +14 -6
  13. data/VERSION +1 -1
  14. data/ext/reflex/capture_event.cpp +1 -1
  15. data/ext/reflex/defs.h +2 -2
  16. data/ext/reflex/event.cpp +7 -2
  17. data/ext/reflex/frame_event.cpp +26 -7
  18. data/ext/reflex/motion_event.cpp +4 -4
  19. data/ext/reflex/pointer.cpp +16 -6
  20. data/ext/reflex/pointer_event.cpp +0 -1
  21. data/ext/reflex/polygon_shape.cpp +1 -1
  22. data/ext/reflex/scroll_event.cpp +1 -1
  23. data/ext/reflex/selector.h +1 -1
  24. data/ext/reflex/style.cpp +2 -2
  25. data/ext/reflex/wheel_event.cpp +1 -1
  26. data/include/reflex/event.h +29 -13
  27. data/include/reflex/pointer.h +5 -3
  28. data/include/reflex/shape.h +1 -1
  29. data/lib/reflex/frame_event.rb +12 -2
  30. data/lib/reflex/pointer.rb +1 -1
  31. data/lib/reflex/pointer_event.rb +2 -2
  32. data/reflex.gemspec +4 -4
  33. data/src/body.h +1 -1
  34. data/src/event.cpp +83 -14
  35. data/src/event.h +11 -5
  36. data/src/fixture.h +1 -1
  37. data/src/ios/application.h +1 -1
  38. data/src/ios/event.mm +2 -1
  39. data/src/osx/application.h +1 -1
  40. data/src/osx/event.h +12 -6
  41. data/src/osx/event.mm +2 -1
  42. data/src/osx/native_window.mm +1 -1
  43. data/src/pointer.cpp +34 -18
  44. data/src/pointer.h +4 -2
  45. data/src/selector.h +1 -1
  46. data/src/shape.h +1 -1
  47. data/src/style.h +1 -1
  48. data/src/timer.h +1 -1
  49. data/src/view.cpp +149 -67
  50. data/src/view.h +1 -1
  51. data/src/win32/defs.h +1 -1
  52. data/src/window.cpp +25 -22
  53. data/src/window.h +15 -6
  54. data/src/world.h +1 -1
  55. data/test/test_event.rb +18 -15
  56. data/test/test_frame_event.rb +20 -16
  57. data/test/test_pointer.rb +20 -16
  58. data/test/test_pointer_event.rb +21 -21
  59. metadata +10 -10
data/src/pointer.cpp CHANGED
@@ -1,6 +1,7 @@
1
1
  #include "pointer.h"
2
2
 
3
3
 
4
+ #include <limits.h>
4
5
  #include <xot/time.h>
5
6
  #include "reflex/exception.h"
6
7
 
@@ -43,7 +44,9 @@ namespace Reflex
43
44
 
44
45
  Point position;
45
46
 
46
- uint modifiers, click_count, flags;
47
+ uint modifiers, flags;
48
+
49
+ ushort click_count, view_index;
47
50
 
48
51
  double time;
49
52
 
@@ -51,14 +54,16 @@ namespace Reflex
51
54
 
52
55
  Data (
53
56
  ID id = -1, uint type = TYPE_NONE, Action action = ACTION_NONE,
54
- const Point& position = 0, uint modifiers = 0, uint click_count = 0,
57
+ const Point& position = 0, uint modifiers = 0,
55
58
  bool drag = false, bool enter = false, bool exit = false,
56
- double time = 0)
59
+ uint click_count = 0, uint view_index = 0, double time = 0)
57
60
  : id(id), type(type), action(action),
58
- position(position), modifiers(modifiers), click_count(click_count),
61
+ position(position), modifiers(modifiers),
59
62
  flags(make_flags(drag, enter, exit)),
60
- time(time)
63
+ click_count(click_count), view_index(view_index), time(time)
61
64
  {
65
+ if (view_index >= USHRT_MAX)
66
+ argument_error(__FILE__, __LINE__);
62
67
  }
63
68
 
64
69
  uint make_flags (bool drag, bool enter, bool exit)
@@ -75,8 +80,6 @@ namespace Reflex
75
80
  void
76
81
  Pointer_update_positions (Pointer* pthis, std::function<void(Point*)> fun)
77
82
  {
78
- assert(pthis);
79
-
80
83
  auto& self = pthis->self;
81
84
  fun(&self->position);
82
85
  if (self->prev)
@@ -89,6 +92,15 @@ namespace Reflex
89
92
  pthis->self->id = id;
90
93
  }
91
94
 
95
+ void
96
+ Pointer_set_view_index (Pointer* pthis, uint view_index)
97
+ {
98
+ if (view_index >= USHRT_MAX)
99
+ argument_error(__FILE__, __LINE__);
100
+
101
+ pthis->self->view_index = view_index;
102
+ }
103
+
92
104
  void
93
105
  Pointer_set_prev (Pointer* pthis, const Pointer* prev)
94
106
  {
@@ -105,26 +117,24 @@ namespace Reflex
105
117
 
106
118
  Pointer::Pointer (
107
119
  ID id, uint type, Action action,
108
- const Point& position, uint modifiers, uint click_count, bool drag,
109
- double time)
120
+ const Point& position, uint modifiers, bool drag,
121
+ uint click_count, uint view_index, double time)
110
122
  : self(new Data(
111
123
  id, type, action,
112
- position, modifiers, click_count, drag, false, false,
113
- time))
124
+ position, modifiers, drag, false, false,
125
+ click_count, view_index, time))
114
126
  {
115
127
  }
116
128
 
117
129
  Pointer::Pointer (const This& obj)
118
- : self(new Data(*obj.self))
130
+ : self(obj.self)
119
131
  {
120
132
  }
121
133
 
122
134
  Pointer&
123
135
  Pointer::operator = (const This& obj)
124
136
  {
125
- if (&obj == this) return *this;
126
-
127
- *self = *obj.self;
137
+ self.operator=(obj.self);
128
138
  return *this;
129
139
  }
130
140
 
@@ -162,16 +172,22 @@ namespace Reflex
162
172
  return self->modifiers;
163
173
  }
164
174
 
175
+ bool
176
+ Pointer::is_drag () const
177
+ {
178
+ return self->flags & Data::DRAG;
179
+ }
180
+
165
181
  uint
166
182
  Pointer::click_count () const
167
183
  {
168
184
  return self->click_count;
169
185
  }
170
186
 
171
- bool
172
- Pointer::is_drag () const
187
+ uint
188
+ Pointer::view_index () const
173
189
  {
174
- return self->flags & Data::DRAG;
190
+ return self->view_index;
175
191
  }
176
192
 
177
193
  double
data/src/pointer.h CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
  #include <functional>
8
- #include <reflex/pointer.h>
8
+ #include "reflex/pointer.h"
9
9
 
10
10
 
11
11
  namespace Reflex
@@ -15,7 +15,9 @@ namespace Reflex
15
15
  void Pointer_update_positions (
16
16
  Pointer* pthis, std::function<void(Point*)> fun);
17
17
 
18
- void Pointer_set_id (Pointer* pthis, Pointer::ID id);
18
+ void Pointer_set_id (Pointer* pthis, Pointer::ID id);
19
+
20
+ void Pointer_set_view_index (Pointer* pthis, uint view_index);
19
21
 
20
22
  void Pointer_set_prev (Pointer* pthis, const Pointer* prev);
21
23
 
data/src/selector.h CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
  #include <memory>
8
- #include <reflex/selector.h>
8
+ #include "reflex/selector.h"
9
9
 
10
10
 
11
11
  namespace Reflex
data/src/shape.h CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
  #include <xot/util.h>
8
- #include <reflex/shape.h>
8
+ #include "reflex/shape.h"
9
9
 
10
10
 
11
11
  class b2Shape;
data/src/style.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #define __REFLEX_SRC_STYLE_H__
5
5
 
6
6
 
7
- #include <reflex/style.h>
7
+ #include "reflex/style.h"
8
8
 
9
9
 
10
10
  namespace Reflex
data/src/timer.h CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include <vector>
8
8
  #include <list>
9
- #include <reflex/timer.h>
9
+ #include "reflex/timer.h"
10
10
 
11
11
 
12
12
  namespace Reflex
data/src/view.cpp CHANGED
@@ -1,6 +1,7 @@
1
1
  #include "view.h"
2
2
 
3
3
 
4
+ #include <limits.h>
4
5
  #include <assert.h>
5
6
  #include <memory>
6
7
  #include <algorithm>
@@ -47,29 +48,34 @@ namespace Reflex
47
48
 
48
49
  UPDATE_LAYOUT = Xot::bit(5, FLAG_LAST),
49
50
 
50
- FIT_TO_CONTENT = Xot::bit(6, FLAG_LAST),
51
+ SORT_CHILDREN = Xot::bit(6, FLAG_LAST),
51
52
 
52
- HAS_VARIABLE_LENGTHS = Xot::bit(7, FLAG_LAST),
53
+ FIT_TO_CONTENT = Xot::bit(7, FLAG_LAST),
53
54
 
54
- NO_SHAPE = Xot::bit(8, FLAG_LAST),
55
+ HAS_VARIABLE_LENGTHS = Xot::bit(8, FLAG_LAST),
56
+
57
+ NO_SHAPE = Xot::bit(9, FLAG_LAST),
55
58
 
56
59
  };// Flag
57
60
 
58
- Window* window = NULL;
61
+ Window* window = NULL;
59
62
 
60
- View* parent = NULL;
63
+ View* parent = NULL;
61
64
 
62
65
  Bounds frame;
63
66
 
64
- float zoom = 1;
67
+ float zoom = 1;
68
+
69
+ float angle = 0;
65
70
 
66
- float angle = 0;
71
+ ushort capture = CAPTURE_NONE;
67
72
 
68
- ushort capture = CAPTURE_NONE;
73
+ short hide_count = 0;
69
74
 
70
- short hide_count = 0;
75
+ ushort child_index = 0;
71
76
 
72
- uint flags = FLAG_CLIP | FLAG_RESIZE_TO_FIT | REDRAW | UPDATE_LAYOUT | UPDATE_STYLE;
77
+ uint flags =
78
+ FLAG_CLIP | FLAG_RESIZE_TO_FIT | REDRAW | UPDATE_LAYOUT | UPDATE_STYLE;
73
79
 
74
80
  std::unique_ptr<Point> ppivot;
75
81
 
@@ -99,6 +105,8 @@ namespace Reflex
99
105
 
100
106
  std::unique_ptr<ChildList> pchildren;
101
107
 
108
+ std::unique_ptr<ChildList> pchildren_sorted;
109
+
102
110
  Point& pivot ()
103
111
  {
104
112
  if (!ppivot) ppivot.reset(new Point);
@@ -243,9 +251,10 @@ namespace Reflex
243
251
  {
244
252
  assert(m && *m == 1 && ppivot && *ppivot != 0 && pbody);
245
253
 
254
+ Point pos = pbody->position();
246
255
  Point pivot = *ppivot * frame.size();
247
256
  float angle = pbody->angle();
248
- m->translate(pbody->position())
257
+ m->translate(pos.x, pos.y, frame.z)
249
258
  .rotate(angle)
250
259
  .translate( pivot)
251
260
  .rotate(-angle)
@@ -304,10 +313,24 @@ namespace Reflex
304
313
  view->remove_child(wall.get());
305
314
  }
306
315
 
307
- ChildList& children ()
316
+ ChildList* children (bool create = false, bool sort = false)
317
+ {
318
+ if (!pchildren)
319
+ {
320
+ if (!create) return NULL;
321
+ pchildren.reset(new ChildList);
322
+ }
323
+
324
+ if (sort && check_and_remove_flag(SORT_CHILDREN))
325
+ do_sort_children();
326
+
327
+ return sort && pchildren_sorted ? pchildren_sorted.get() : pchildren.get();
328
+ }
329
+
330
+ void sort_children (bool order_only = false)
308
331
  {
309
- if (!pchildren) pchildren.reset(new ChildList);
310
- return *pchildren;
332
+ add_flag(SORT_CHILDREN);
333
+ if (!order_only && pchildren_sorted) pchildren_sorted.reset();
311
334
  }
312
335
 
313
336
  void add_flag (uint flag)
@@ -330,6 +353,50 @@ namespace Reflex
330
353
  return Xot::check_and_remove_flag(&flags, flag);
331
354
  }
332
355
 
356
+ private:
357
+
358
+ void do_sort_children ()
359
+ {
360
+ assert(pchildren);
361
+
362
+ auto& children = *pchildren;
363
+
364
+ size_t size = children.size();
365
+ if (size >= USHRT_MAX)
366
+ invalid_state_error(__FILE__, __LINE__, "too many children");
367
+
368
+ ushort index = 0;
369
+ bool have_z = false;
370
+ for (auto& child : children)
371
+ {
372
+ child->self->child_index = index++;
373
+ have_z |= child->frame().z != 0;
374
+ }
375
+
376
+ if (!have_z)
377
+ {
378
+ pchildren_sorted.reset();
379
+ return;
380
+ }
381
+
382
+ if (!pchildren_sorted)
383
+ {
384
+ pchildren_sorted.reset(
385
+ new ChildList(children.begin(), children.end()));
386
+ }
387
+
388
+ std::sort(
389
+ pchildren_sorted->begin(), pchildren_sorted->end(),
390
+ [](const auto& a, const auto& b)
391
+ {
392
+ auto *aa = a->self.get(), *bb = b->self.get();
393
+ if (aa->frame.z != bb->frame.z)
394
+ return aa->frame.z < bb->frame.z;
395
+ else
396
+ return aa->child_index < bb->child_index;
397
+ });
398
+ }
399
+
333
400
  };// View::Data
334
401
 
335
402
 
@@ -351,8 +418,8 @@ namespace Reflex
351
418
 
352
419
  void place_children ()
353
420
  {
354
- View::ChildList* pchildren = parent->self->pchildren.get();
355
- if (!pchildren || pchildren->empty())
421
+ View::ChildList* children = parent->self->children();
422
+ if (!children || children->empty())
356
423
  return;
357
424
 
358
425
  bool leftward = flow_main_h < 0 || flow_sub_h < 0;
@@ -362,7 +429,7 @@ namespace Reflex
362
429
  upward ? parent_frame.height : 0);
363
430
  Point position = start_position;
364
431
 
365
- for (iterator begin = pchildren->begin(), end = pchildren->end(); true;)
432
+ for (iterator begin = children->begin(), end = children->end(); true;)
366
433
  {
367
434
  iterator line_end;
368
435
  coord main_fill_size = 0;
@@ -653,11 +720,11 @@ namespace Reflex
653
720
  view->self->window = window;
654
721
  view->self->update_body_and_shapes();
655
722
 
656
- View::ChildList* pchildren = view->self->pchildren.get();
657
- if (pchildren)
723
+ View::ChildList* children = view->self->children();
724
+ if (children)
658
725
  {
659
- for (auto& pchild : *pchildren)
660
- View_set_window(pchild.get(), window);
726
+ for (auto& child : *children)
727
+ View_set_window(child.get(), window);
661
728
  }
662
729
 
663
730
  if (view->self->window)
@@ -673,15 +740,15 @@ namespace Reflex
673
740
  {
674
741
  assert(parent);
675
742
 
676
- View::ChildList* pchildren = parent->self->pchildren.get();
677
- if (!pchildren) return;
743
+ View::ChildList* children = parent->self->children();
744
+ if (!children) return;
678
745
 
679
- for (auto& pchild : *pchildren)
746
+ for (auto& child : *children)
680
747
  {
681
- assert(pchild);
748
+ assert(child);
682
749
 
683
- if (pchild->self->has_flag(View::Data::HAS_VARIABLE_LENGTHS))
684
- pchild->self->add_flag(View::Data::APPLY_STYLE);
750
+ if (child->self->has_flag(View::Data::HAS_VARIABLE_LENGTHS))
751
+ child->self->add_flag(View::Data::APPLY_STYLE);
685
752
  }
686
753
  }
687
754
 
@@ -733,6 +800,9 @@ namespace Reflex
733
800
  if (update_body && (moved || rotated) && self->pbody)
734
801
  self->update_body_frame();
735
802
 
803
+ if (moved && event.dz() != 0 && self->parent)
804
+ self->parent->self->sort_children(true);
805
+
736
806
  if ((moved || resized) && self->parent)
737
807
  self->parent->self->add_flag(View::Data::FIT_TO_CONTENT);
738
808
 
@@ -779,19 +849,19 @@ namespace Reflex
779
849
  {
780
850
  assert(result && view);
781
851
 
782
- View::ChildList* pchildren = view->self->pchildren.get();
783
- if (!pchildren) return;
852
+ View::ChildList* children = view->self->children();
853
+ if (!children) return;
784
854
 
785
- for (auto& pchild : *pchildren)
855
+ for (auto& child : *children)
786
856
  {
787
- if (!pchild)
857
+ if (!child)
788
858
  invalid_state_error(__FILE__, __LINE__);
789
859
 
790
- if (pchild->selector().contains(selector))
791
- result->push_back(pchild);
860
+ if (child->selector().contains(selector))
861
+ result->push_back(child);
792
862
 
793
863
  if (recursive)
794
- find_all_children(result, pchild.get(), selector, true);
864
+ find_all_children(result, child.get(), selector, true);
795
865
  }
796
866
  }
797
867
 
@@ -814,11 +884,11 @@ namespace Reflex
814
884
 
815
885
  if (!recursive) return;
816
886
 
817
- View::ChildList* pchildren = view->self->pchildren.get();
818
- if (pchildren)
887
+ View::ChildList* children = view->self->children();
888
+ if (children)
819
889
  {
820
- for (auto& pchild : *pchildren)
821
- find_all_styles(result, pchild.get(), selector, true);
890
+ for (auto& child : *children)
891
+ find_all_styles(result, child.get(), selector, true);
822
892
  }
823
893
  }
824
894
 
@@ -866,7 +936,10 @@ namespace Reflex
866
936
  frame.set_position(m * Point(0));
867
937
  }
868
938
  else
869
- frame.set_position(body->position());
939
+ {
940
+ Point pos = body->position();
941
+ frame.set_position(pos.x, pos.y, frame.z);
942
+ }
870
943
 
871
944
  update_view_frame(view, frame, view->zoom(), body->angle(), false);
872
945
  }
@@ -882,11 +955,11 @@ namespace Reflex
882
955
 
883
956
  child_world->on_update(dt);
884
957
 
885
- View::ChildList* pchildren = self->pchildren.get();
886
- if (pchildren)
958
+ View::ChildList* children = self->children();
959
+ if (children)
887
960
  {
888
- for (auto& pchild : *pchildren)
889
- update_view_body(pchild.get());
961
+ for (auto& child : *children)
962
+ update_view_body(child.get());
890
963
  }
891
964
  }
892
965
 
@@ -910,8 +983,8 @@ namespace Reflex
910
983
 
911
984
  children.clear();
912
985
  find_all_children(&children, view, sel, true);
913
- for (auto& pchild : children)
914
- pchild->self->add_flag(View::Data::UPDATE_STYLE);
986
+ for (auto& child : children)
987
+ child->self->add_flag(View::Data::UPDATE_STYLE);
915
988
  }
916
989
 
917
990
  sels->clear();
@@ -1010,11 +1083,11 @@ namespace Reflex
1010
1083
 
1011
1084
  fire_timers(view, event.now());
1012
1085
 
1013
- View::ChildList* pchildren = self->pchildren.get();
1014
- if (pchildren)
1086
+ View::ChildList* children = self->children();
1087
+ if (children)
1015
1088
  {
1016
- for (auto& pchild : *pchildren)
1017
- View_update_tree(pchild.get(), event);
1089
+ for (auto& child : *children)
1090
+ View_update_tree(child.get(), event);
1018
1091
  }
1019
1092
 
1020
1093
  update_view_shapes(view);
@@ -1148,13 +1221,13 @@ namespace Reflex
1148
1221
 
1149
1222
  if (event->is_blocked()) return;
1150
1223
 
1151
- View::ChildList* pchildren = self->pchildren.get();
1152
- if (pchildren)
1224
+ View::ChildList* children = self->children(false, true);
1225
+ if (children)
1153
1226
  {
1154
- for (auto& pchild : *pchildren)
1227
+ for (auto& child : *children)
1155
1228
  {
1156
- if (event->bounds() & pchild->self->frame)
1157
- View_draw_tree(pchild.get(), event, offset, clip);
1229
+ if (event->bounds() & child->self->frame)
1230
+ View_draw_tree(child.get(), event, offset, clip);
1158
1231
  }
1159
1232
  }
1160
1233
 
@@ -1321,15 +1394,14 @@ namespace Reflex
1321
1394
  }
1322
1395
 
1323
1396
  static void
1324
- call_children (View* parent, std::function<bool(View*)> fun)
1397
+ call_children (View* parent, std::function<bool(View*)> fun, bool sort = true)
1325
1398
  {
1326
1399
  assert(parent);
1327
1400
 
1328
- auto* pchildren = parent->self->pchildren.get();
1329
- if (!pchildren) return;
1401
+ auto* children = parent->self->children(false, sort);
1402
+ if (!children) return;
1330
1403
 
1331
- auto end = pchildren->rend();
1332
- for (auto it = pchildren->rbegin(); it != end; ++it)
1404
+ for (auto it = children->rbegin(), end = children->rend(); it != end; ++it)
1333
1405
  {
1334
1406
  if (!fun(it->get()))
1335
1407
  break;
@@ -1367,6 +1439,9 @@ namespace Reflex
1367
1439
  case Pointer::CANCEL: view->on_pointer_cancel(event); break;
1368
1440
  default: break;
1369
1441
  }
1442
+
1443
+ if (!event->is_captured())
1444
+ PointerEvent_increment_view_indices(event);
1370
1445
  }
1371
1446
 
1372
1447
  static void
@@ -1381,7 +1456,7 @@ namespace Reflex
1381
1456
  PointerEvent_each_pointer(&event, [&](const auto& pointer)
1382
1457
  {
1383
1458
  if (pointer.action() == Pointer::DOWN)
1384
- Window_register_capture(win, view, pointer.id());
1459
+ Window_register_capture(win, view, pointer.id(), pointer.view_index());
1385
1460
  });
1386
1461
  }
1387
1462
 
@@ -1710,7 +1785,7 @@ namespace Reflex
1710
1785
  {
1711
1786
  assert(parent && child);
1712
1787
 
1713
- View::ChildList* children = parent->self->pchildren.get();
1788
+ View::ChildList* children = parent->self->children();
1714
1789
  if (!children) return;
1715
1790
 
1716
1791
  auto end = children->end();
@@ -1719,7 +1794,10 @@ namespace Reflex
1719
1794
 
1720
1795
  children->erase(it);
1721
1796
  if (children->empty())
1797
+ {
1722
1798
  parent->self->pchildren.reset();
1799
+ parent->self->pchildren_sorted.reset();
1800
+ }
1723
1801
  }
1724
1802
 
1725
1803
  void
@@ -1735,7 +1813,7 @@ namespace Reflex
1735
1813
  else if (found != belong)
1736
1814
  invalid_state_error(__FILE__, __LINE__);
1737
1815
 
1738
- self->children().push_back(child);
1816
+ self->children(true)->push_back(child);
1739
1817
 
1740
1818
  View* prev_parent = child->parent();
1741
1819
  set_parent(child, this);
@@ -1743,6 +1821,8 @@ namespace Reflex
1743
1821
  if (prev_parent)
1744
1822
  erase_child_from_children(prev_parent, child);
1745
1823
 
1824
+ self->sort_children();
1825
+
1746
1826
  update_view_layout(this);
1747
1827
  }
1748
1828
 
@@ -1763,16 +1843,18 @@ namespace Reflex
1763
1843
 
1764
1844
  erase_child_from_children(this, child);
1765
1845
 
1846
+ self->sort_children();
1847
+
1766
1848
  update_view_layout(this);
1767
1849
  }
1768
1850
 
1769
1851
  void
1770
1852
  View::clear_children ()
1771
1853
  {
1772
- if (!self->pchildren || self->pchildren->empty()) return;
1854
+ auto* children = self->children();
1855
+ if (!children || children->empty()) return;
1773
1856
 
1774
- auto children = *self->pchildren;
1775
- for (auto& child : children)
1857
+ for (auto& child : *children)
1776
1858
  remove_child(child);
1777
1859
  }
1778
1860
 
@@ -2264,9 +2346,9 @@ namespace Reflex
2264
2346
  bool capture = types != CAPTURE_NONE;
2265
2347
 
2266
2348
  if (capture && !registered)
2267
- Window_register_capture(w, this);
2349
+ Window_register_capture(w, this, CAPTURE_ALL);
2268
2350
  else if (!capture && registered)
2269
- Window_unregister_capture(w, this);
2351
+ Window_unregister_capture(w, this, CAPTURE_ALL);
2270
2352
 
2271
2353
  CaptureEvent e(~old & types, old & ~types);
2272
2354
  on_capture(&e);
data/src/view.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #define __REFLEX_SRC_VIEW_H__
5
5
 
6
6
 
7
- #include <reflex/view.h>
7
+ #include "reflex/view.h"
8
8
 
9
9
 
10
10
  namespace Reflex
data/src/win32/defs.h CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
  #include <windows.h>
8
- #include <reflex/defs.h>
8
+ #include "reflex/defs.h"
9
9
 
10
10
 
11
11
  namespace Reflex