reflexion 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/key_event.cpp +22 -7
- data/.doc/ext/reflex/reflex.cpp +203 -0
- data/.doc/ext/reflex/style.cpp +2 -2
- data/.doc/ext/reflex/view.cpp +1 -1
- data/.github/workflows/release-gem.yml +1 -1
- data/.github/workflows/tag.yml +1 -1
- data/.github/workflows/test.yml +7 -1
- data/ChangeLog.md +13 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/ext/reflex/key_event.cpp +22 -7
- data/ext/reflex/reflex.cpp +203 -0
- data/ext/reflex/style.cpp +2 -2
- data/ext/reflex/view.cpp +1 -1
- data/include/reflex/defs.h +199 -188
- data/include/reflex/ruby.h +4 -1
- data/include/reflex.h +2 -0
- data/lib/reflex/key_event.rb +23 -1
- data/reflex.gemspec +4 -4
- data/samples/key.rb +1 -1
- data/src/event.cpp +1 -0
- data/src/ios/event.h +1 -11
- data/src/ios/event.mm +10 -57
- data/src/ios/view_controller.mm +21 -44
- data/src/ios/window.mm +19 -19
- data/src/osx/event.h +1 -1
- data/src/osx/event.mm +51 -189
- data/src/osx/native_window.mm +33 -84
- data/src/osx/window.mm +12 -12
- data/src/pointer.cpp +53 -11
- data/src/pointer.h +8 -0
- data/src/view.cpp +4 -79
- data/src/window.cpp +105 -0
- data/src/window.h +13 -3
- data/test/helper.rb +0 -6
- data/test/test_key_event.rb +17 -8
- data/test/test_pointer.rb +7 -2
- data/test/test_screen.rb +0 -4
- metadata +10 -10
data/src/window.h
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
#include <vector>
|
8
|
+
#include <list>
|
8
9
|
#include <map>
|
9
10
|
#include <xot/time.h>
|
10
11
|
#include <rays/point.h>
|
@@ -18,6 +19,9 @@ namespace Reflex
|
|
18
19
|
{
|
19
20
|
|
20
21
|
|
22
|
+
typedef std::list<Pointer> PointerList;
|
23
|
+
|
24
|
+
|
21
25
|
enum {CAPTURE_ALL = INT_MAX};
|
22
26
|
|
23
27
|
|
@@ -39,7 +43,7 @@ namespace Reflex
|
|
39
43
|
|
40
44
|
int hide_count = 1;
|
41
45
|
|
42
|
-
bool redraw
|
46
|
+
bool redraw = true;
|
43
47
|
|
44
48
|
Painter painter;
|
45
49
|
|
@@ -51,6 +55,12 @@ namespace Reflex
|
|
51
55
|
|
52
56
|
CaptureMap captures;
|
53
57
|
|
58
|
+
int next_pointer_id = 1;
|
59
|
+
|
60
|
+
Pointer prev_mouse_pointer;
|
61
|
+
|
62
|
+
PointerList prev_pointers;
|
63
|
+
|
54
64
|
uint flags;
|
55
65
|
|
56
66
|
Data ();
|
@@ -97,6 +107,8 @@ namespace Reflex
|
|
97
107
|
|
98
108
|
void Window_set_flags (Window* window, uint flags);
|
99
109
|
|
110
|
+
float Window_get_pixel_density (const Window& window);
|
111
|
+
|
100
112
|
void Window_set_focus (Window* window, View* view);
|
101
113
|
|
102
114
|
void Window_register_capture (
|
@@ -117,8 +129,6 @@ namespace Reflex
|
|
117
129
|
|
118
130
|
void Window_call_wheel_event (Window* window, WheelEvent* event);
|
119
131
|
|
120
|
-
float Window_get_pixel_density (const Window& window);
|
121
|
-
|
122
132
|
|
123
133
|
typedef View* (*Window_CreateRootViewFun) ();
|
124
134
|
|
data/test/helper.rb
CHANGED
data/test/test_key_event.rb
CHANGED
@@ -3,22 +3,24 @@ require_relative 'helper'
|
|
3
3
|
|
4
4
|
class TestKeyEvent < Test::Unit::TestCase
|
5
5
|
|
6
|
+
DOWN = Reflex::KeyEvent::DOWN
|
7
|
+
|
6
8
|
def event(*args)
|
7
9
|
Reflex::KeyEvent.new(*args)
|
8
10
|
end
|
9
11
|
|
10
12
|
def test_initialize()
|
11
|
-
e = event
|
12
|
-
assert_equal :down,
|
13
|
-
assert_equal 'a',
|
14
|
-
assert_equal 1,
|
15
|
-
assert_equal
|
16
|
-
assert_equal 3,
|
17
|
-
assert_false
|
13
|
+
e = event DOWN, 'a', 1, 2, 3
|
14
|
+
assert_equal :down, e.action
|
15
|
+
assert_equal 'a', e.chars
|
16
|
+
assert_equal 1, e.code
|
17
|
+
assert_equal [:control], e.modifiers
|
18
|
+
assert_equal 3, e.repeat
|
19
|
+
assert_false e.captured?
|
18
20
|
end
|
19
21
|
|
20
22
|
def test_dup()
|
21
|
-
e1 = event
|
23
|
+
e1 = event DOWN, 'a', 1, 2, 3
|
22
24
|
e2 = e1.dup
|
23
25
|
e1.block
|
24
26
|
e3 = e1.dup
|
@@ -27,4 +29,11 @@ class TestKeyEvent < Test::Unit::TestCase
|
|
27
29
|
assert_true e3.blocked?
|
28
30
|
end
|
29
31
|
|
32
|
+
def test_chars()
|
33
|
+
assert_equal 'foo', event(DOWN, 'foo', 1, 2, 3).chars
|
34
|
+
|
35
|
+
assert_nil event(DOWN, '', 1, 2, 3).chars
|
36
|
+
assert_nil event(DOWN, nil, 1, 2, 3).chars
|
37
|
+
end
|
38
|
+
|
30
39
|
end# TestKeyEvent
|
data/test/test_pointer.rb
CHANGED
@@ -34,13 +34,13 @@ class TestPointer < Test::Unit::TestCase
|
|
34
34
|
assert_nothing_raised {pointer}
|
35
35
|
|
36
36
|
p = pointer(
|
37
|
-
id: 1, types: TOUCH, action:
|
37
|
+
id: 1, types: TOUCH, action: UP,
|
38
38
|
position: [2, 3], modifiers: 4, drag: true, click_count: 5, view_index: 6,
|
39
39
|
time: 7)
|
40
40
|
|
41
41
|
assert_equal 1, p.id
|
42
42
|
assert_equal [:touch], p.types
|
43
|
-
assert_equal :
|
43
|
+
assert_equal :up, p.action
|
44
44
|
assert_equal [2, 3], p.position.to_a
|
45
45
|
assert_equal 2, p.x
|
46
46
|
assert_equal 3, p.y
|
@@ -134,6 +134,11 @@ class TestPointer < Test::Unit::TestCase
|
|
134
134
|
assert_equal 2, pointer(position: [1, 2]).y
|
135
135
|
end
|
136
136
|
|
137
|
+
def test_down()
|
138
|
+
assert_equal 1, pointer(id: 1, action: DOWN).down.id # DOWN pointer's down() returns itself
|
139
|
+
assert_nil pointer(id: 2, action: UP) .down
|
140
|
+
end
|
141
|
+
|
137
142
|
def test_compare()
|
138
143
|
assert_equal pointer, pointer
|
139
144
|
|
data/test/test_screen.rb
CHANGED
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:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 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:
|
19
|
+
version: 0.2.1
|
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:
|
26
|
+
version: 0.2.1
|
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:
|
33
|
+
version: 0.2.1
|
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:
|
40
|
+
version: 0.2.1
|
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:
|
47
|
+
version: 0.2.1
|
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:
|
54
|
+
version: 0.2.1
|
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:
|
61
|
+
version: 0.2.1
|
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:
|
68
|
+
version: 0.2.1
|
69
69
|
description: This library helps you to develop interactive graphical user interface.
|
70
70
|
email: xordog@gmail.com
|
71
71
|
executables: []
|