reflexion 0.1.25 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdc0c2ff303a64e7cd33a4c47e9b3ce00a5cc81aa37e7ea139be74858b5d5e63
4
- data.tar.gz: be377f16084291df970d88411b868312c75946ecf6949a3cc2bf4dba86d0452d
3
+ metadata.gz: 9c0f36ce2f27bdfc704cf1ad8546e18a9acf656ea8c18c16d58a6f50c2a0e037
4
+ data.tar.gz: f88574b6d37c6a3d6656b185c5ee61708d1c9b5b7492d44732d8774f0027d657
5
5
  SHA512:
6
- metadata.gz: c805ad801e76dc3d0d9418741a16ab2d350494a8a013ee77a5f26b352549a6128640dddbdc5e43539e801de0084175930e2f4d58c6d3146bb4e8cded8ef2b761
7
- data.tar.gz: 1603789dd274019aa55f58a48e6c9fd52f58f5deb6e093f255884cb64ac24ad1b3ffed5320d53ce5fc5497d53daac8da110b2b04a0d9096f7cea1fb31425d9a0
6
+ metadata.gz: 3bc258254bdb5348518da4a25017286cc9b4821008ff219a4e8c87286323e6a3a55c6888b979d1be76d617f9f468700f2d5f0cd65c6bb141734958f02656fac5
7
+ data.tar.gz: a3bdb07be95f500c100ee3d9dc98defee1d7274ec4ae7f807cfa98c3d15deab74f75dfefb0324c621a9b5f2c141b8a2bad2c886f68b9f68671101638e07c54c6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.25
1
+ 0.1.26
@@ -35,7 +35,7 @@ namespace Reflex
35
35
 
36
36
  virtual void hide ();
37
37
 
38
- virtual void close ();
38
+ virtual void close (bool force = false);
39
39
 
40
40
  virtual void redraw ();
41
41
 
@@ -25,7 +25,7 @@ module Reflex
25
25
  end
26
26
 
27
27
  def inspect()
28
- "#<Reflex::PointerEvent id:#{id} #{type} #{action} (#{x.round 2}, #{y.round 2}) mod:#{modifiers} click:#{click_count} drag:#{drag?} time:#{time.round 2}>"
28
+ "#<Reflex::PointerEvent id:#{id} #{types} #{action} (#{x.round 2}, #{y.round 2}) mod:#{modifiers} click:#{click_count} drag:#{drag?} time:#{time.round 2}>"
29
29
  end
30
30
 
31
31
  private
data/reflex.gemspec CHANGED
@@ -28,10 +28,10 @@ Gem::Specification.new do |s|
28
28
  s.platform = Gem::Platform::RUBY
29
29
  s.required_ruby_version = '>= 2.6.0'
30
30
 
31
- s.add_runtime_dependency 'xot', '~> 0.1.25'
32
- s.add_runtime_dependency 'rucy', '~> 0.1.25'
33
- s.add_runtime_dependency 'beeps', '~> 0.1.25'
34
- s.add_runtime_dependency 'rays', '~> 0.1.25'
31
+ s.add_runtime_dependency 'xot', '~> 0.1.26'
32
+ s.add_runtime_dependency 'rucy', '~> 0.1.26'
33
+ s.add_runtime_dependency 'beeps', '~> 0.1.26'
34
+ s.add_runtime_dependency 'rays', '~> 0.1.26'
35
35
 
36
36
  s.files = `git ls-files`.split $/
37
37
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
@@ -1,12 +1,6 @@
1
1
  // -*- objc -*-
2
2
  #import <UIKit/UIApplication.h>
3
- #include "application.h"
4
3
 
5
4
 
6
5
  @interface ReflexAppDelegate : UIResponder <UIApplicationDelegate>
7
-
8
- - (void) bind: (Reflex::Application*) application;
9
-
10
- - (BOOL) callOnStart;
11
-
12
6
  @end// ReflexAppDelegate
@@ -6,6 +6,7 @@
6
6
  #import <CoreMotion/CoreMotion.h>
7
7
  #include "reflex/event.h"
8
8
  #include "reflex/exception.h"
9
+ #include "application.h"
9
10
 
10
11
 
11
12
  @implementation ReflexAppDelegate
@@ -13,6 +13,12 @@ extern "C" {
13
13
  }
14
14
 
15
15
 
16
+ @interface ReflexAppDelegate (Bind)
17
+ - (void) bind: (Reflex::Application*) application;
18
+ - (BOOL) callOnStart;
19
+ @end
20
+
21
+
16
22
  namespace Reflex
17
23
  {
18
24
 
@@ -16,7 +16,7 @@
16
16
  static ReflexViewController*
17
17
  create_reflex_view_controller ()
18
18
  {
19
- return [[ReflexViewController alloc] init];
19
+ return [[[ReflexViewController alloc] init] autorelease];
20
20
  }
21
21
 
22
22
  static UIViewController*
@@ -102,7 +102,7 @@ ReflexViewController_get_show_fun ()
102
102
 
103
103
  @interface ReflexView ()
104
104
 
105
- @property(nonatomic, strong) ReflexViewController* reflexViewController;
105
+ @property(nonatomic, unsafe_unretained) ReflexViewController* reflexViewController;
106
106
 
107
107
  @end
108
108
 
@@ -112,7 +112,9 @@ ReflexViewController_get_show_fun ()
112
112
  - (void) layoutSubviews
113
113
  {
114
114
  [super layoutSubviews];
115
- [self.reflexViewController viewDidResize];
115
+
116
+ if (self.reflexViewController)
117
+ [self.reflexViewController viewDidResize];
116
118
  }
117
119
 
118
120
  @end
@@ -153,6 +155,9 @@ ReflexViewController_get_show_fun ()
153
155
 
154
156
  - (void) dealloc
155
157
  {
158
+ Reflex::Window* win = self.window;
159
+ if (win) win->close(true);
160
+
156
161
  [self cleanup];
157
162
  [super dealloc];
158
163
  }
@@ -227,6 +232,11 @@ ReflexViewController_get_show_fun ()
227
232
  [self setupReflexView];
228
233
  }
229
234
 
235
+ - (ReflexView*) createReflexView
236
+ {
237
+ return [[[ReflexView alloc] initWithFrame: self.view.bounds] autorelease];
238
+ }
239
+
230
240
  - (void) setupReflexView
231
241
  {
232
242
  ReflexView* view = [self createReflexView];
@@ -256,11 +266,6 @@ ReflexViewController_get_show_fun ()
256
266
  self.reflexView = view;
257
267
  }
258
268
 
259
- - (ReflexView*) createReflexView
260
- {
261
- return [[[ReflexView alloc] initWithFrame: self.view.bounds] autorelease];
262
- }
263
-
264
269
  - (void) cleanupReflexView
265
270
  {
266
271
  ReflexView* view = self.reflexView;
@@ -270,6 +275,7 @@ ReflexViewController_get_show_fun ()
270
275
  if (context && context == [EAGLContext currentContext])
271
276
  [EAGLContext setCurrentContext: (EAGLContext*) Rays::get_offscreen_context()];
272
277
 
278
+ view.reflexViewController = nil;
273
279
  [view removeFromSuperview];
274
280
 
275
281
  self.reflexView = nil;
data/src/ios/window.mm CHANGED
@@ -51,8 +51,7 @@ namespace Reflex
51
51
  void
52
52
  Window_initialize (Window* window)
53
53
  {
54
- ReflexViewController* vc =
55
- [ReflexViewController_get_create_fun()() autorelease];
54
+ ReflexViewController* vc = ReflexViewController_get_create_fun()();
56
55
  if (!vc)
57
56
  reflex_error(__FILE__, __LINE__);
58
57
 
@@ -95,7 +94,6 @@ namespace Reflex
95
94
  void
96
95
  Window_close (Window* window)
97
96
  {
98
- not_implemented_error(__FILE__, __LINE__);
99
97
  }
100
98
 
101
99
  void
@@ -104,7 +102,7 @@ namespace Reflex
104
102
  if (!title)
105
103
  argument_error(__FILE__, __LINE__);
106
104
 
107
- get_vc(window).title = [[NSString alloc] initWithUTF8String: title];
105
+ get_vc(window).title = [NSString stringWithUTF8String: title];
108
106
  }
109
107
 
110
108
  const char*
@@ -34,6 +34,20 @@ count_mouse_buttons (const Reflex::PointerEvent& e)
34
34
  return nbuttons;
35
35
  }
36
36
 
37
+ static void
38
+ update_pixel_density (Reflex::Window* window)
39
+ {
40
+ assert(window);
41
+
42
+ Rays::Painter* painter = window->painter();
43
+ if (!painter) return;
44
+
45
+ float pd = Window_get_pixel_density(*window);
46
+ if (painter->pixel_density() != pd)
47
+ painter->canvas(window->frame().dup().move_to(0, 0), pd);
48
+ }
49
+
50
+
37
51
  @implementation NativeWindow
38
52
 
39
53
  {
@@ -43,7 +57,7 @@ count_mouse_buttons (const Reflex::PointerEvent& e)
43
57
  int update_count;
44
58
  int clicking_count;
45
59
  Reflex::Pointer::ID pointer_id;
46
- Reflex::Pointer prevPointer;
60
+ Reflex::Pointer prev_pointer;
47
61
  }
48
62
 
49
63
  - (id) init
@@ -196,6 +210,8 @@ count_mouse_buttons (const Reflex::PointerEvent& e)
196
210
  Reflex::Window* win = self.window;
197
211
  if (!win) return;
198
212
 
213
+ update_pixel_density(win);
214
+
199
215
  if (update_count == 0)
200
216
  [self update];
201
217
 
@@ -381,9 +397,11 @@ count_mouse_buttons (const Reflex::PointerEvent& e)
381
397
  assert(e->size() == 1);
382
398
 
383
399
  Reflex::Pointer& pointer = Reflex::PointerEvent_pointer_at(e, 0);
384
- if (prevPointer)
385
- Reflex::Pointer_set_prev(&pointer, &prevPointer);
386
- prevPointer = pointer;
400
+ if (prev_pointer)
401
+ Reflex::Pointer_set_prev(&pointer, &prev_pointer);
402
+
403
+ prev_pointer = pointer;
404
+ Reflex::Pointer_set_prev(&prev_pointer, NULL);
387
405
  }
388
406
 
389
407
  - (void) scrollWheel: (NSEvent*) event
data/src/window.cpp CHANGED
@@ -165,6 +165,15 @@ namespace Reflex
165
165
  if (!event)
166
166
  argument_error(__FILE__, __LINE__);
167
167
 
168
+ window->on_key(event);
169
+
170
+ switch (event->action())
171
+ {
172
+ case KeyEvent::DOWN: window->on_key_down(event); break;
173
+ case KeyEvent::UP: window->on_key_up(event); break;
174
+ default: break;
175
+ }
176
+
168
177
  for (auto& [view, targets] : window->self->captures)
169
178
  {
170
179
  if (!is_capturing(view.get(), targets, View::CAPTURE_KEY))
@@ -179,17 +188,6 @@ namespace Reflex
179
188
  View_call_key_event(window->self->focus.get(), event);
180
189
 
181
190
  cleanup_captures(window);
182
-
183
- if (event->is_blocked()) return;
184
-
185
- window->on_key(event);
186
-
187
- switch (event->action())
188
- {
189
- case KeyEvent::DOWN: window->on_key_down(event); break;
190
- case KeyEvent::UP: window->on_key_up(event); break;
191
- default: break;
192
- }
193
191
  }
194
192
 
195
193
  static void
@@ -362,19 +360,6 @@ namespace Reflex
362
360
  if (!event)
363
361
  argument_error(__FILE__, __LINE__);
364
362
 
365
- call_captured_pointer_events(window, event);
366
-
367
- if (!event->empty())
368
- {
369
- PointerEvent_update_for_child_view(event, window->root());
370
- View_call_pointer_event(window->root(), event);
371
- }
372
-
373
- cleanup_captures(window);
374
-
375
- if (event->empty() || event->is_blocked())
376
- return;
377
-
378
363
  window->on_pointer(event);
379
364
 
380
365
  switch ((*event)[0].action())
@@ -385,6 +370,16 @@ namespace Reflex
385
370
  case Pointer::CANCEL: window->on_pointer_cancel(event); break;
386
371
  default: break;
387
372
  }
373
+
374
+ call_captured_pointer_events(window, event);
375
+
376
+ if (!event->empty())
377
+ {
378
+ PointerEvent_update_for_child_view(event, window->root());
379
+ View_call_pointer_event(window->root(), event);
380
+ }
381
+
382
+ cleanup_captures(window);
388
383
  }
389
384
 
390
385
  void
@@ -415,9 +410,7 @@ namespace Reflex
415
410
 
416
411
  Window::~Window ()
417
412
  {
418
- //close();
419
-
420
- View_set_window(self->root.get(), NULL);
413
+ //close(true);
421
414
  }
422
415
 
423
416
  void
@@ -453,11 +446,14 @@ namespace Reflex
453
446
  }
454
447
 
455
448
  void
456
- Window::close ()
449
+ Window::close (bool force)
457
450
  {
458
451
  Event e;
459
452
  on_close(&e);
460
- if (e.is_blocked()) return;
453
+ if (!force && e.is_blocked()) return;
454
+
455
+ View_set_window(self->root.get(), NULL);
456
+ self->root.reset();
461
457
 
462
458
  Window_close(this);
463
459
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflexion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-04 00:00:00.000000000 Z
11
+ date: 2022-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.25
19
+ version: 0.1.26
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.25
26
+ version: 0.1.26
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rucy
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.25
33
+ version: 0.1.26
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.25
40
+ version: 0.1.26
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: beeps
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.25
47
+ version: 0.1.26
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.25
54
+ version: 0.1.26
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rays
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.25
61
+ version: 0.1.26
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.25
68
+ version: 0.1.26
69
69
  description: This library helps you to develop interactive graphical user interface.
70
70
  email: xordog@gmail.com
71
71
  executables: []
@@ -395,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
395
  - !ruby/object:Gem::Version
396
396
  version: '0'
397
397
  requirements: []
398
- rubygems_version: 3.2.32
398
+ rubygems_version: 3.2.33
399
399
  signing_key:
400
400
  specification_version: 4
401
401
  summary: A Graphical User Interface Tool Kit.