libui 0.2.0.pre-aarch64-linux → 0.2.1-aarch64-linux
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/LICENSE.txt +1 -1
- data/README.md +53 -47
- data/lib/libui/ffi.rb +1 -1
- data/lib/libui/fiddle_patch.rb +1 -1
- data/lib/libui/libui_base.rb +6 -4
- data/lib/libui/version.rb +1 -1
- data/lib/libui.rb +110 -4
- data/vendor/libui.aarch64.so +0 -0
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46dd8a324e8f00193d0a24d23bcece4de9fc6526392e3506b3ec81543ff96bd5
|
|
4
|
+
data.tar.gz: ac3ab3100f882d00d4e67f052ac1047495ae4e448eb4c63fdfd1069bf0ebda93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89ca6535da0b6cc404ceb8cc840bdb938ea6e688f4e68f2d63c33279af5ce9cf42e8f6d53dbfaed5463731dbc59e52d76a3e5e9faa8043de8c2874d2e2731004
|
|
7
|
+
data.tar.gz: c8df2b43a9563013247315255faaf11a0c2b5ff6b4cbaf3fcc1b7fca416783cae781371eb7a8ef2751113ee2c51e38d8fe707749c2a1e768386150296de75007
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -16,20 +16,12 @@ LibUI is a Ruby wrapper for libui family.
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
It is recommended to use libui-ng, via the --pre commandline flag:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
gem install libui --pre # libui-ng; this will fetch libui-0.1.3.pre-x86_64-linux.gem
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
If for some reason you would like to install the slightly older libui-0.1.2.gem release, issue:
|
|
26
|
-
|
|
27
19
|
```sh
|
|
28
|
-
gem install libui
|
|
20
|
+
gem install libui # --pre
|
|
29
21
|
```
|
|
30
22
|
|
|
31
23
|
- The gem package includes the libui-ng shared library for Windows, Mac, and Linux.
|
|
32
|
-
- Namely `libui.dll`, `libui.dylib`, or `libui.so`.
|
|
24
|
+
- Namely `libui.x64.dll`/`libui.x86.dll`, `libui.x86_64.dylib`/`libui.arm64.dylib`, or `libui.x86_64.so`/`libui.aarch64.so`.
|
|
33
25
|
- No dependencies required.
|
|
34
26
|
- The libui gem uses the standard Ruby library [Fiddle](https://github.com/ruby/fiddle) to call C functions.
|
|
35
27
|
|
|
@@ -62,9 +54,8 @@ end
|
|
|
62
54
|
|
|
63
55
|
UI.window_on_closing(main_window) do
|
|
64
56
|
puts 'Bye Bye'
|
|
65
|
-
UI.control_destroy(main_window)
|
|
66
57
|
UI.quit
|
|
67
|
-
|
|
58
|
+
1
|
|
68
59
|
end
|
|
69
60
|
|
|
70
61
|
UI.window_set_child(main_window, button)
|
|
@@ -86,7 +77,7 @@ Compared to the original libui library written in C:
|
|
|
86
77
|
- The block will be converted to a Proc object and added as the last argument.
|
|
87
78
|
- The last argument can still be omitted when nil.
|
|
88
79
|
|
|
89
|
-
You can use [the
|
|
80
|
+
You can use [the libui-ng API documentation](https://libui-ng.github.io/libui-ng/) as a reference.
|
|
90
81
|
|
|
91
82
|
### DSLs for LibUI
|
|
92
83
|
|
|
@@ -105,12 +96,26 @@ UI = LibUI
|
|
|
105
96
|
UI.init
|
|
106
97
|
```
|
|
107
98
|
|
|
108
|
-
|
|
99
|
+
Text getter methods such as `label_text`, `entry_text`, and `window_title`
|
|
100
|
+
return `Fiddle::Pointer` objects for strings allocated by libui. Convert the
|
|
101
|
+
pointer to a Ruby string, then release it with `free_text`.
|
|
109
102
|
|
|
110
103
|
```ruby
|
|
111
104
|
label = UI.new_label("Ruby")
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
pointer = UI.label_text(label) # #<Fiddle::Pointer>
|
|
106
|
+
text = pointer.to_s
|
|
107
|
+
UI.free_text(pointer)
|
|
108
|
+
p text # Ruby
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use `ensure` if the code between conversion and cleanup can raise:
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
def ui_text(text_pointer)
|
|
115
|
+
text_pointer.to_s
|
|
116
|
+
ensure
|
|
117
|
+
UI.free_text(text_pointer) if text_pointer && !text_pointer.null?
|
|
118
|
+
end
|
|
114
119
|
```
|
|
115
120
|
|
|
116
121
|
If you need to use C structs, you can do the following:
|
|
@@ -125,11 +130,15 @@ font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
|
|
|
125
130
|
|
|
126
131
|
UI.font_button_on_changed(font_button) do
|
|
127
132
|
UI.font_button_font(font_button, font_descriptor)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
begin
|
|
134
|
+
p family: font_descriptor.Family.to_s,
|
|
135
|
+
size: font_descriptor.Size,
|
|
136
|
+
weight: font_descriptor.Weight,
|
|
137
|
+
italic: font_descriptor.Italic,
|
|
138
|
+
stretch: font_descriptor.Stretch
|
|
139
|
+
ensure
|
|
140
|
+
UI.free_font_button_font(font_descriptor)
|
|
141
|
+
end
|
|
133
142
|
end
|
|
134
143
|
```
|
|
135
144
|
|
|
@@ -178,40 +187,27 @@ Add additional options below if necessary:
|
|
|
178
187
|
git clone https://github.com/kojix2/libui
|
|
179
188
|
cd libui
|
|
180
189
|
bundle install
|
|
181
|
-
bundle exec rake vendor:auto
|
|
190
|
+
bundle exec rake vendor:auto
|
|
182
191
|
bundle exec rake test
|
|
183
192
|
```
|
|
184
193
|
|
|
185
194
|
### Pre-built shared libraries for libui-ng
|
|
186
195
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`rake -T`
|
|
196
|
+
Download pre-built libui-ng shared libraries (per your current platform):
|
|
190
197
|
|
|
198
|
+
```sh
|
|
199
|
+
bundle exec rake vendor:auto
|
|
191
200
|
```
|
|
192
|
-
rake vendor:build[hash] # Build libui-ng latest master [commit hash]
|
|
193
|
-
rake vendor:libui-ng:macos # Download latest official pre-build for Mac to vendor directory
|
|
194
|
-
rake vendor:libui-ng:ubuntu_x64 # Download latest official pre-build for Ubuntu to vendor directory
|
|
195
|
-
rake vendor:macos_arm64 # Download pre-build for Mac to vendor directory
|
|
196
|
-
rake vendor:macos_x64 # Download pre-build for Mac to vendor directory
|
|
197
|
-
rake vendor:raspbian_aarch64 # Download pre-build for Raspbian to vendor directory
|
|
198
|
-
rake vendor:ubuntu_x64 # Download pre-build for Ubuntu to vendor directory
|
|
199
|
-
rake vendor:windows_x64 # Download pre-build for Windows to vendor directory
|
|
200
|
-
rake vendor:windows_x86 # Download pre-build for Windows to vendor directory
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
For example, if you are using a 32-bit (x86) version of Ruby on Windows, type `vendor:windows_x86`.
|
|
204
|
-
These shared libraries are [artifacts](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml) of the [pre-build branch](https://github.com/kojix2/libui-ng/tree/pre-build) of [kojix2/libui-ng](https://github.com/kojix2/libui-ng). In that case, please let us know.
|
|
205
201
|
|
|
206
|
-
|
|
202
|
+
Clean downloaded vendor files (keeps `vendor/{LICENSE,README}.md`):
|
|
207
203
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
204
|
+
```sh
|
|
205
|
+
bundle exec rake vendor:clean
|
|
206
|
+
```
|
|
211
207
|
|
|
212
|
-
|
|
208
|
+
### Using your own libui build
|
|
213
209
|
|
|
214
|
-
|
|
210
|
+
If you build libui-ng yourself, set `LIBUIDIR` to the directory containing the compiled `.so/.dylib/.dll` so LibUI can load it. You may also replace files under `vendor/` with your build if preferred. See [#46](https://github.com/kojix2/LibUI/issues/46#issuecomment-1041575792).
|
|
215
211
|
|
|
216
212
|
### Publishing gems
|
|
217
213
|
|
|
@@ -220,8 +216,8 @@ Another simple approach is to replace the shared libraries in the gem vendor dir
|
|
|
220
216
|
Push a version tag to automatically publish platform-specific gems:
|
|
221
217
|
|
|
222
218
|
```sh
|
|
223
|
-
git tag v0.
|
|
224
|
-
git push origin v0.
|
|
219
|
+
git tag v0.2.0
|
|
220
|
+
git push origin v0.2.0
|
|
225
221
|
```
|
|
226
222
|
|
|
227
223
|
Requires `RUBYGEMS_API_KEY` repository secret with scoped API key.
|
|
@@ -239,9 +235,19 @@ find pkg -name *.gem -exec sh -c "echo; echo \# {}; tar -O -f {} -x data.tar.gz
|
|
|
239
235
|
rake release_platform # publish gems
|
|
240
236
|
```
|
|
241
237
|
|
|
238
|
+
Windows Ruby (x64-mingw32 or x64-mingw-ucrt)
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
gem install rake rubyzip
|
|
242
|
+
GEM_PLATFORM=x64-mingw32 rake vendor:clean
|
|
243
|
+
GEM_PLATFORM=x64-mingw32 rake vendor:auto
|
|
244
|
+
GEM_PLATFORM=x64-mingw32 gem build libui.gemspec
|
|
245
|
+
gem push libui-0.2.0-x64-mingw32.gem
|
|
246
|
+
```
|
|
247
|
+
|
|
242
248
|
### libui or libui-ng
|
|
243
249
|
|
|
244
|
-
- From version 0.1.X,
|
|
250
|
+
- From version 0.1.X, LibUI supports only libui-ng.
|
|
245
251
|
- Version 0.0.X only supports andlabs/libui.
|
|
246
252
|
|
|
247
253
|
## Contributing
|
data/lib/libui/ffi.rb
CHANGED
|
@@ -3,7 +3,6 @@ require_relative 'fiddle_patch'
|
|
|
3
3
|
require_relative 'error'
|
|
4
4
|
|
|
5
5
|
module LibUI
|
|
6
|
-
class Error < StandardError; end
|
|
7
6
|
|
|
8
7
|
module FFI
|
|
9
8
|
extend Fiddle::Importer
|
|
@@ -38,6 +37,7 @@ module LibUI
|
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
typealias('uint32_t', 'unsigned int')
|
|
40
|
+
typealias('uint64_t', 'unsigned long long')
|
|
41
41
|
|
|
42
42
|
InitOptions = struct [
|
|
43
43
|
'size_t Size'
|
data/lib/libui/fiddle_patch.rb
CHANGED
|
@@ -16,7 +16,7 @@ module LibUI
|
|
|
16
16
|
when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
|
|
17
17
|
[parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
|
|
18
18
|
else
|
|
19
|
-
raise("can't
|
|
19
|
+
raise("can't parse the function prototype: #{signature}")
|
|
20
20
|
end
|
|
21
21
|
symname = func
|
|
22
22
|
callback_argument_types = {} # Added
|
data/lib/libui/libui_base.rb
CHANGED
|
@@ -25,11 +25,13 @@ module LibUI
|
|
|
25
25
|
# Protect from GC
|
|
26
26
|
# by giving the owner object a reference to the callback.
|
|
27
27
|
# See https://github.com/kojix2/LibUI/issues/8
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
receiver = args.first
|
|
29
|
+
owner = if idx == 0 || # UI.queue_main{}
|
|
30
|
+
receiver.nil? ||
|
|
31
|
+
(receiver.respond_to?(:frozen?) && receiver.frozen?) # UI.timer(100) {}
|
|
32
|
+
LibUIBase # keep a reference on an internal module to avoid GC
|
|
31
33
|
else
|
|
32
|
-
|
|
34
|
+
receiver # receiver object holds the callback
|
|
33
35
|
end
|
|
34
36
|
if owner.instance_variable_defined?(:@callbacks)
|
|
35
37
|
owner.instance_variable_get(:@callbacks) << callback
|
data/lib/libui/version.rb
CHANGED
data/lib/libui.rb
CHANGED
|
@@ -42,15 +42,121 @@ module LibUI
|
|
|
42
42
|
|
|
43
43
|
class << self
|
|
44
44
|
def init(opt = nil)
|
|
45
|
+
# Allocate uiInitOptions if not provided
|
|
45
46
|
unless opt
|
|
46
47
|
opt = FFI::InitOptions.malloc
|
|
47
48
|
opt.to_ptr.free = Fiddle::RUBY_FREE
|
|
49
|
+
opt.Size = FFI::InitOptions.size
|
|
48
50
|
end
|
|
49
|
-
i = super(opt)
|
|
50
|
-
return if i.size.zero?
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
err_ptr = super(opt) # uiInit returns const char* error or NULL on success
|
|
53
|
+
return nil if err_ptr.null?
|
|
54
|
+
|
|
55
|
+
# Convert C string to Ruby string and free the error string per API contract
|
|
56
|
+
err_msg = err_ptr.to_s
|
|
57
|
+
free_init_error(err_ptr)
|
|
58
|
+
warn err_msg
|
|
59
|
+
nil
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def new_button(text = '')
|
|
63
|
+
super(text)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def new_checkbox(text = '')
|
|
67
|
+
super(text)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def window_set_title(window, title = '')
|
|
71
|
+
super(window, title)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def button_set_text(button, text = '')
|
|
75
|
+
super(button, text)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def checkbox_set_text(checkbox, text = '')
|
|
79
|
+
super(checkbox, text)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def entry_set_text(entry, text = '')
|
|
83
|
+
super(entry, text)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def label_set_text(label, text = '')
|
|
87
|
+
super(label, text)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def new_label(text = '')
|
|
91
|
+
super(text)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def group_set_title(group, title = '')
|
|
95
|
+
super(group, title)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def new_group(title = '')
|
|
99
|
+
super(title)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def combobox_append(combobox, text = '')
|
|
103
|
+
super(combobox, text)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def combobox_insert_at(combobox, index, text = '')
|
|
107
|
+
super(combobox, index, text)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def editable_combobox_append(combobox, text = '')
|
|
111
|
+
super(combobox, text)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def editable_combobox_set_text(combobox, text = '')
|
|
115
|
+
super(combobox, text)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def radio_buttons_append(radio_buttons, text = '')
|
|
119
|
+
super(radio_buttons, text)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def multiline_entry_set_text(entry, text = '')
|
|
123
|
+
super(entry, text)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def multiline_entry_append(entry, text = '')
|
|
127
|
+
super(entry, text)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def menu_append_item(menu, name = '')
|
|
131
|
+
super(menu, name)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def menu_append_check_item(menu, name = '')
|
|
135
|
+
super(menu, name)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def new_menu(name = '')
|
|
139
|
+
super(name)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def msg_box(parent, title, description = '')
|
|
143
|
+
super(parent, title, description)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def msg_box_error(parent, title, description = '')
|
|
147
|
+
super(parent, title, description)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def new_attributed_string(initial_string = '')
|
|
151
|
+
super(initial_string)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def attributed_string_append_unattributed(attributed_string, str = '')
|
|
155
|
+
super(attributed_string, str)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def new_table_value_string(str = '')
|
|
159
|
+
super(str)
|
|
54
160
|
end
|
|
55
161
|
|
|
56
162
|
# Gets the window position.
|
data/vendor/libui.aarch64.so
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- kojix2
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: fiddle
|
|
@@ -24,7 +23,6 @@ dependencies:
|
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
|
-
description:
|
|
28
26
|
email:
|
|
29
27
|
- 2xijok@gmail.com
|
|
30
28
|
executables: []
|
|
@@ -47,7 +45,6 @@ homepage: https://github.com/kojix2/libui
|
|
|
47
45
|
licenses:
|
|
48
46
|
- MIT
|
|
49
47
|
metadata: {}
|
|
50
|
-
post_install_message:
|
|
51
48
|
rdoc_options: []
|
|
52
49
|
require_paths:
|
|
53
50
|
- lib
|
|
@@ -62,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
59
|
- !ruby/object:Gem::Version
|
|
63
60
|
version: '0'
|
|
64
61
|
requirements: []
|
|
65
|
-
rubygems_version: 3.
|
|
66
|
-
signing_key:
|
|
62
|
+
rubygems_version: 3.6.9
|
|
67
63
|
specification_version: 4
|
|
68
64
|
summary: Ruby bindings to libui
|
|
69
65
|
test_files: []
|