reflexion 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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 = true;
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
@@ -8,9 +8,3 @@ require 'reflex'
8
8
  require 'test/unit'
9
9
 
10
10
  include Xot::Test
11
-
12
-
13
- unless defined?($REFLEX_NOAUTOINIT) && $REFLEX_NOAUTOINIT
14
- def Rays.fin!() end
15
- def Reflex.fin!() end
16
- end
@@ -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 Reflex::KeyEvent::DOWN, 'a', 1, 2, 3
12
- assert_equal :down, e.action
13
- assert_equal 'a', e.chars
14
- assert_equal 1, e.code
15
- assert_equal 2, e.modifiers
16
- assert_equal 3, e.repeat
17
- assert_false e.captured?
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 Reflex::KeyEvent::DOWN, 'a', 1, 2, 3
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: DOWN,
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 :down, p.action
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
@@ -11,8 +11,4 @@ class TestScreen < Test::Unit::TestCase
11
11
  assert_raise(Reflex::ReflexError) {Reflex::Screen.new}
12
12
  end
13
13
 
14
- def test_frame()
15
- assert_raise(Rucy::InvalidObjectError) {screen.frame}
16
- end
17
-
18
14
  end# TestScreen
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.2'
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-03-13 00:00:00.000000000 Z
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: '0.2'
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: '0.2'
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: '0.2'
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: '0.2'
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: '0.2'
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: '0.2'
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: '0.2'
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: '0.2'
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: []