reflexion 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +6 -0
- data/VERSION +1 -1
- data/reflex.gemspec +1 -1
- data/src/ios/event.h +1 -1
- data/src/ios/event.mm +2 -2
- data/src/ios/view_controller.mm +71 -4
- data/src/osx/event.h +1 -1
- data/src/osx/event.mm +2 -4
- data/src/osx/native_window.mm +19 -6
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee249febb85efea8890f5d4623feec5d9f191ad969e20d83af968cb243b2b116
|
|
4
|
+
data.tar.gz: 70b1950e21b7e6ddc89b967b72a1e4acdd42afda4952f59832aa84379b24e5fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 816a5bfe8901e16a894ecb7f47cc5d542d50d33c856b0bed1b6b70189169e76f0abb917b2bf539ca71f4b25b3a3e47a05e5e3ff19f738b5125cdf338c1de894e
|
|
7
|
+
data.tar.gz: b53a2064c5b99b16195d69a51d02af0ff7437fafe3dab282528bb449c98c5fcd5de9b0b3dbf080a279a9ff2507e357f5b797fdb778d0a3787f2748955b63f1a8
|
data/ChangeLog.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.1
|
data/reflex.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
|
27
27
|
|
|
28
28
|
s.add_dependency 'xot', '~> 0.3.13'
|
|
29
29
|
s.add_dependency 'rucy', '~> 0.3.13'
|
|
30
|
-
s.add_dependency 'rays', '~> 0.3.
|
|
30
|
+
s.add_dependency 'rays', '~> 0.3.14'
|
|
31
31
|
|
|
32
32
|
s.files = `git ls-files`.split $/
|
|
33
33
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/ios/event.h
CHANGED
data/src/ios/event.mm
CHANGED
|
@@ -115,10 +115,10 @@ namespace Reflex
|
|
|
115
115
|
return s.UTF8String;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
NativeKeyEvent::NativeKeyEvent (UIPress* press, Action action)
|
|
118
|
+
NativeKeyEvent::NativeKeyEvent (UIPress* press, Action action, int repeat)
|
|
119
119
|
: KeyEvent(
|
|
120
120
|
action, get_chars(press.key), (int) press.key.keyCode,
|
|
121
|
-
to_modifiers(press.key.modifierFlags),
|
|
121
|
+
to_modifiers(press.key.modifierFlags), repeat)
|
|
122
122
|
{
|
|
123
123
|
}
|
|
124
124
|
|
data/src/ios/view_controller.mm
CHANGED
|
@@ -65,6 +65,14 @@ show_reflex_view_controller (
|
|
|
65
65
|
[top presentViewController: reflex_vc animated: YES completion: nil];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
static BOOL
|
|
69
|
+
is_modifier_key (long keyCode) API_AVAILABLE(ios(13.4))
|
|
70
|
+
{
|
|
71
|
+
return
|
|
72
|
+
keyCode >= UIKeyboardHIDUsageKeyboardLeftControl &&
|
|
73
|
+
keyCode <= UIKeyboardHIDUsageKeyboardRightGUI;
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
|
|
69
77
|
namespace global
|
|
70
78
|
{
|
|
@@ -129,6 +137,10 @@ ReflexViewController_get_show_fun ()
|
|
|
129
137
|
|
|
130
138
|
@property(nonatomic, strong) UIHoverGestureRecognizer* hoverRecognizer;
|
|
131
139
|
|
|
140
|
+
@property(nonatomic, strong) UIPress* repeatingKeyPress;
|
|
141
|
+
|
|
142
|
+
@property(nonatomic, strong) NSTimer* repeatingKeyTimer;
|
|
143
|
+
|
|
132
144
|
@end
|
|
133
145
|
|
|
134
146
|
|
|
@@ -138,6 +150,7 @@ ReflexViewController_get_show_fun ()
|
|
|
138
150
|
Reflex::Window *pwindow, *ptr_for_rebind;
|
|
139
151
|
int update_count;
|
|
140
152
|
int touching_count;
|
|
153
|
+
int repeating_key_count;
|
|
141
154
|
}
|
|
142
155
|
|
|
143
156
|
- (id) init
|
|
@@ -145,10 +158,11 @@ ReflexViewController_get_show_fun ()
|
|
|
145
158
|
self = [super init];
|
|
146
159
|
if (!self) return nil;
|
|
147
160
|
|
|
148
|
-
pwindow
|
|
149
|
-
ptr_for_rebind
|
|
150
|
-
update_count
|
|
151
|
-
touching_count
|
|
161
|
+
pwindow =
|
|
162
|
+
ptr_for_rebind = NULL;
|
|
163
|
+
update_count = 0;
|
|
164
|
+
touching_count = 0;
|
|
165
|
+
repeating_key_count = 0;
|
|
152
166
|
|
|
153
167
|
return self;
|
|
154
168
|
}
|
|
@@ -301,6 +315,8 @@ ReflexViewController_get_show_fun ()
|
|
|
301
315
|
ReflexView* view = self.reflexView;
|
|
302
316
|
if (!view) return;
|
|
303
317
|
|
|
318
|
+
[self stopKeyRepeat];
|
|
319
|
+
|
|
304
320
|
if (view.context && view.context == [EAGLContext currentContext])
|
|
305
321
|
Rays::activate_offscreen_context();
|
|
306
322
|
|
|
@@ -333,6 +349,7 @@ ReflexViewController_get_show_fun ()
|
|
|
333
349
|
|
|
334
350
|
- (void) viewDidDisappear: (BOOL) animated
|
|
335
351
|
{
|
|
352
|
+
[self stopKeyRepeat];
|
|
336
353
|
[self resignFirstResponder];
|
|
337
354
|
|
|
338
355
|
[NSNotificationCenter.defaultCenter
|
|
@@ -357,6 +374,7 @@ ReflexViewController_get_show_fun ()
|
|
|
357
374
|
|
|
358
375
|
- (void) willResignActive
|
|
359
376
|
{
|
|
377
|
+
[self stopKeyRepeat];
|
|
360
378
|
Window_call_deactivate_event(self.window);
|
|
361
379
|
}
|
|
362
380
|
|
|
@@ -638,7 +656,56 @@ ReflexViewController_get_show_fun ()
|
|
|
638
656
|
if (!press.key) continue;
|
|
639
657
|
Reflex::NativeKeyEvent e(press, action);
|
|
640
658
|
Window_call_key_event(win, &e);
|
|
659
|
+
|
|
660
|
+
if (action == Reflex::KeyEvent::DOWN)
|
|
661
|
+
{
|
|
662
|
+
if (!is_modifier_key(press.key.keyCode))
|
|
663
|
+
[self startKeyRepeat: press];
|
|
664
|
+
}
|
|
665
|
+
else if (
|
|
666
|
+
self.repeatingKeyPress &&
|
|
667
|
+
press.key.keyCode == self.repeatingKeyPress.key.keyCode)
|
|
668
|
+
{
|
|
669
|
+
[self stopKeyRepeat];
|
|
670
|
+
}
|
|
641
671
|
}
|
|
642
672
|
}
|
|
643
673
|
|
|
674
|
+
- (void) startKeyRepeat: (UIPress*) press
|
|
675
|
+
API_AVAILABLE(ios(13.4))
|
|
676
|
+
{
|
|
677
|
+
[self stopKeyRepeat];
|
|
678
|
+
|
|
679
|
+
repeating_key_count = 0;
|
|
680
|
+
self.repeatingKeyPress = press;
|
|
681
|
+
self.repeatingKeyTimer = [NSTimer scheduledTimerWithTimeInterval: 0.4
|
|
682
|
+
target: self selector: @selector(keyRepeatFired:) userInfo: nil repeats: NO];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
- (void) keyRepeatFired: (NSTimer*) timer
|
|
686
|
+
API_AVAILABLE(ios(13.4))
|
|
687
|
+
{
|
|
688
|
+
Reflex::Window* win = self.window;
|
|
689
|
+
UIPress* press = self.repeatingKeyPress;
|
|
690
|
+
if (!win || !press || !press.key)
|
|
691
|
+
{
|
|
692
|
+
[self stopKeyRepeat];
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
Reflex::NativeKeyEvent e(press, Reflex::KeyEvent::DOWN, ++repeating_key_count);
|
|
697
|
+
Window_call_key_event(win, &e);
|
|
698
|
+
|
|
699
|
+
self.repeatingKeyTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1
|
|
700
|
+
target: self selector: @selector(keyRepeatFired:) userInfo: nil repeats: NO];
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
- (void) stopKeyRepeat
|
|
704
|
+
{
|
|
705
|
+
[self.repeatingKeyTimer invalidate];
|
|
706
|
+
self.repeatingKeyTimer = nil;
|
|
707
|
+
self.repeatingKeyPress = nil;
|
|
708
|
+
repeating_key_count = 0;
|
|
709
|
+
}
|
|
710
|
+
|
|
644
711
|
@end// ReflexViewController
|
data/src/osx/event.h
CHANGED
data/src/osx/event.mm
CHANGED
|
@@ -52,10 +52,8 @@ namespace Reflex
|
|
|
52
52
|
return [chars UTF8String];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
NativeKeyEvent::NativeKeyEvent (NSEvent* e, Action action)
|
|
56
|
-
: KeyEvent(
|
|
57
|
-
action, get_chars(e), [e keyCode],
|
|
58
|
-
get_modifiers(e), [e isARepeat] ? 1 : 0)
|
|
55
|
+
NativeKeyEvent::NativeKeyEvent (NSEvent* e, Action action, int repeat)
|
|
56
|
+
: KeyEvent(action, get_chars(e), [e keyCode], get_modifiers(e), repeat)
|
|
59
57
|
{
|
|
60
58
|
}
|
|
61
59
|
|
data/src/osx/native_window.mm
CHANGED
|
@@ -56,6 +56,8 @@ move_to_main_screen_origin (NativeWindow* window)
|
|
|
56
56
|
OpenGLView* view;
|
|
57
57
|
NSTimer* timer;
|
|
58
58
|
int update_count;
|
|
59
|
+
int repeating_key_code;
|
|
60
|
+
int repeating_key_count;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
- (id) init
|
|
@@ -67,11 +69,13 @@ move_to_main_screen_origin (NativeWindow* window)
|
|
|
67
69
|
defer: NO];
|
|
68
70
|
if (!self) return nil;
|
|
69
71
|
|
|
70
|
-
pwindow
|
|
71
|
-
ptr_for_rebind
|
|
72
|
-
view
|
|
73
|
-
timer
|
|
74
|
-
update_count
|
|
72
|
+
pwindow =
|
|
73
|
+
ptr_for_rebind = NULL;
|
|
74
|
+
view = nil;
|
|
75
|
+
timer = nil;
|
|
76
|
+
update_count = 0;
|
|
77
|
+
repeating_key_code = -1;
|
|
78
|
+
repeating_key_count = 0;
|
|
75
79
|
|
|
76
80
|
[self setDelegate: self];
|
|
77
81
|
[self setupContentView];
|
|
@@ -365,7 +369,16 @@ move_to_main_screen_origin (NativeWindow* window)
|
|
|
365
369
|
Reflex::Window* win = self.window;
|
|
366
370
|
if (!win) return;
|
|
367
371
|
|
|
368
|
-
|
|
372
|
+
int code = (int) event.keyCode;
|
|
373
|
+
if (event.isARepeat && code == repeating_key_code)
|
|
374
|
+
++repeating_key_count;
|
|
375
|
+
else
|
|
376
|
+
{
|
|
377
|
+
repeating_key_code = code;
|
|
378
|
+
repeating_key_count = 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
Reflex::NativeKeyEvent e(event, Reflex::KeyEvent::DOWN, repeating_key_count);
|
|
369
382
|
Window_call_key_event(win, &e);
|
|
370
383
|
}
|
|
371
384
|
|
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.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xordog
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xot
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.3.
|
|
47
|
+
version: 0.3.14
|
|
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.3.
|
|
54
|
+
version: 0.3.14
|
|
55
55
|
description: This library helps you to develop interactive graphical user interface.
|
|
56
56
|
email: xordog@gmail.com
|
|
57
57
|
executables: []
|