libui 0.0.12 → 0.0.15.pre
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/README.md +18 -6
- data/lib/libui/ffi.rb +1 -3
- data/lib/libui/libui_base.rb +25 -18
- data/lib/libui/version.rb +1 -3
- data/lib/libui.rb +16 -2
- data/vendor/libui.dylib +0 -0
- metadata +6 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e282cdaee29c0b7cd5b7bd11dc0bcb8c546ef927127c7564b79d890ec35e35f
|
4
|
+
data.tar.gz: 321d554f02a4f618590d2fc3652463e928136d1008b8836f15814a1f45c95072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05af08c9952f4107fd21a3db10aca8c6c37e1396076b8eebefe11efbe1b7d3b94e985eae313867b1a92b668cd916811711b60da4e83aaeea646f8809bcf0457b
|
7
|
+
data.tar.gz: 0e3e330daefd9483f0e885dbd1aeea1dbf9a4fa9843f83e30b529cdcb7fad99887916a3a9bb44d95e39a75537eb5297f7e55e75e0d2df1cc7542373eeeeabef6
|
data/README.md
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
[](https://badge.fury.io/rb/libui)
|
5
|
+
<a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
|
5
6
|
|
6
|
-
:radio_button: [libui](https://github.com/
|
7
|
+
:radio_button: [libui](https://github.com/libui-ng/libui-ng) - a portable GUI library - for Ruby
|
7
8
|
|
8
9
|
## Installation
|
9
10
|
|
@@ -20,7 +21,10 @@ gem install libui
|
|
20
21
|
|---------|-----|-------|
|
21
22
|
|<img src="https://user-images.githubusercontent.com/5798442/103118046-900ea780-46b0-11eb-81fc-32626762e4df.png">|<img src="https://user-images.githubusercontent.com/5798442/103118059-99980f80-46b0-11eb-9d12-324ec4d297c9.png">|<img src="https://user-images.githubusercontent.com/5798442/103118068-a0bf1d80-46b0-11eb-8c5c-3bdcc3dcfb26.png">|
|
22
23
|
|
23
|
-
Note:
|
24
|
+
Note:
|
25
|
+
* If you are using the 32-bit (x86) version of Ruby, you need to download the 32-bit (x86) native dll. See [Development](#development).
|
26
|
+
* ARM64/AARCH64 Support is limited. See ([#47](https://github.com/kojix2/LibUI/issues/47))
|
27
|
+
* On Windows, libui may not work due to missing DLLs. In that case, you need to install [Visual C++ Redistributable](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). See ([#48](https://github.com/kojix2/LibUI/issues/48))
|
24
28
|
|
25
29
|
## Usage
|
26
30
|
|
@@ -69,12 +73,13 @@ You can use [the documentation for libui's Go bindings](https://pkg.go.dev/githu
|
|
69
73
|
|
70
74
|
### Not object oriented?
|
71
75
|
|
72
|
-
|
73
|
-
|
76
|
+
LibUI is not object-oriented, but provides high portability with minimal implementation.
|
77
|
+
If you want to write in an object-oriented way, please use the following DSLs built on top of LibUI.
|
74
78
|
|
75
79
|
### DSLs for LibUI
|
76
|
-
|
77
|
-
|
80
|
+
|
81
|
+
* [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
|
82
|
+
* [libui_paradise](https://rubygems.org/gems/libui_paradise)
|
78
83
|
|
79
84
|
### How to use fiddle pointers?
|
80
85
|
|
@@ -100,6 +105,7 @@ font_button = UI.new_font_button
|
|
100
105
|
# Allocate memory
|
101
106
|
font_descriptor = UI::FFI::FontDescriptor.malloc
|
102
107
|
font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
|
108
|
+
# font_descriptor = UI::FFI::FontDescriptor.malloc(Fiddle::RUBY_FREE) # fiddle 1.0.1 or higher
|
103
109
|
|
104
110
|
UI.font_button_on_changed(font_button) do
|
105
111
|
UI.font_button_font(font_button, font_descriptor)
|
@@ -185,6 +191,12 @@ Would you like to add your commits to libui?
|
|
185
191
|
* Small corrections, such as typofixes, are appreciated.
|
186
192
|
* Did you find any bugs? Write it in the [issues](https://github.com/kojix2/LibUI/issue) section!
|
187
193
|
|
194
|
+
```
|
195
|
+
Do you need commit rights to my repository?
|
196
|
+
Do you want to get admin rights and take over the project?
|
197
|
+
If so, please feel free to contact me @kojix2.
|
198
|
+
```
|
199
|
+
|
188
200
|
## Acknowledgement
|
189
201
|
|
190
202
|
This project is inspired by libui-ruby.
|
data/lib/libui/ffi.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require 'fiddle/import'
|
4
2
|
require_relative 'fiddle_patch'
|
5
3
|
|
@@ -36,7 +34,7 @@ module LibUI
|
|
36
34
|
|
37
35
|
# https://github.com/andlabs/libui/blob/master/ui.h
|
38
36
|
# keep same order
|
39
|
-
|
37
|
+
|
40
38
|
try_extern 'const char *uiInit(uiInitOptions *options)'
|
41
39
|
try_extern 'void uiUninit(void)'
|
42
40
|
try_extern 'void uiFreeInitError(const char *err)'
|
data/lib/libui/libui_base.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module LibUI
|
4
2
|
module LibUIBase
|
5
3
|
FFI.func_map.each_key do |original_method_name|
|
@@ -12,24 +10,33 @@ module LibUI
|
|
12
10
|
|
13
11
|
# The proc object is converted to a Closure::BlockCaller object.
|
14
12
|
args.map!.with_index do |arg, idx|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
13
|
+
next arg unless arg.is_a?(Proc)
|
14
|
+
|
15
|
+
# now arg must be Proc
|
16
|
+
|
17
|
+
# The types of the function arguments are stored in advance.
|
18
|
+
# See the monkey patch in ffi.rb.
|
19
|
+
_f, ret_type, arg_types = func.callback_argument_types[idx]
|
20
|
+
# TODO: raise some nice error if _f is nil.
|
21
|
+
|
22
|
+
callback = Fiddle::Closure::BlockCaller.new(
|
23
|
+
ret_type, arg_types, &arg
|
24
|
+
)
|
25
|
+
# Protect from GC
|
26
|
+
# by giving the owner object a reference to the callback.
|
27
|
+
# See https://github.com/kojix2/LibUI/issues/8
|
28
|
+
owner = if idx == 0 or # UI.queue_main{}
|
29
|
+
owner.frozen? # UI.timer(100) {}
|
30
|
+
LibUIBase # or UI is better?
|
31
|
+
else
|
32
|
+
args[0] # receiver
|
33
|
+
end
|
34
|
+
if owner.instance_variable_defined?(:@callbacks)
|
35
|
+
owner.instance_variable_get(:@callbacks) << callback
|
30
36
|
else
|
31
|
-
|
37
|
+
owner.instance_variable_set(:@callbacks, [callback])
|
32
38
|
end
|
39
|
+
callback
|
33
40
|
end
|
34
41
|
|
35
42
|
# Make it possible to omit the last nil. This may be an over-optimization.
|
data/lib/libui/version.rb
CHANGED
data/lib/libui.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require_relative 'libui/version'
|
4
2
|
require_relative 'libui/utils'
|
3
|
+
require 'rbconfig'
|
5
4
|
|
6
5
|
module LibUI
|
7
6
|
class Error < StandardError; end
|
@@ -35,6 +34,21 @@ module LibUI
|
|
35
34
|
warn 'error'
|
36
35
|
warn UI.free_init_error(init)
|
37
36
|
end
|
37
|
+
|
38
|
+
def open_type_features_add(otf, a, b, c, d, value)
|
39
|
+
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
|
40
|
+
super(otf, a, b, c, d, value)
|
41
|
+
end
|
42
|
+
|
43
|
+
def open_type_features_remove(otf, a, b, c, d)
|
44
|
+
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
|
45
|
+
super(otf, a, b, c, d)
|
46
|
+
end
|
47
|
+
|
48
|
+
def open_type_features_get(otf, a, b, c, d, value)
|
49
|
+
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
|
50
|
+
super(otf, a, b, c, d, value)
|
51
|
+
end
|
38
52
|
end
|
39
53
|
|
40
54
|
# UI_ENUM
|
data/vendor/libui.dylib
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,85 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: minitest
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubyzip
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
83
13
|
description:
|
84
14
|
email:
|
85
15
|
- 2xijok@gmail.com
|
@@ -115,11 +45,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
45
|
version: '2.5'
|
116
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
47
|
requirements:
|
118
|
-
- - "
|
48
|
+
- - ">"
|
119
49
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
50
|
+
version: 1.3.1
|
121
51
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.3.7
|
123
53
|
signing_key:
|
124
54
|
specification_version: 4
|
125
55
|
summary: Ruby bindings to libui
|