libui 0.2.0.pre-x86_64-darwin → 0.2.0-x86_64-darwin

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f93f77a77f68890634f59988823870d3f80baac5820856ac551dac128c47228
4
- data.tar.gz: 0aa9e66cbf90e9a5c3cfb1d86f11e82200f82eac2c9e88d21b2aeb1ad60d3275
3
+ metadata.gz: 9d2954e0190af33bfe1bb68cc123b57b5d5bc10a90ef21167b6db870ff40524d
4
+ data.tar.gz: e5748e4586617b1809dfc384bb897f92e298d91ec50e15eb6a7bef763f17dab7
5
5
  SHA512:
6
- metadata.gz: abcecf91a66544d8d5365eb98c72b89b5fb8a638dbf7940f4a1fa5232c04b0d37c445ce49994bbec583926e63d6b008d9c519e4ca6f6ca5d390b8a24960bb972
7
- data.tar.gz: 1b22d167e1a2b692f5634390856274a9171b129ea1b8509cf381ea5f75ce06ecc3ade77808135bd78fb13637f7a327a3d2a8d386e1b85171313f0c09569f568e
6
+ metadata.gz: dacbc63fe500b48d6216d64090b8d94a1ac0e466eadc9cd9ad266c65e61bf45c3da768778cf03388d094abe67e1fd20723d728758c419d85e04c310f6fc5f65d
7
+ data.tar.gz: c55a34901a8dc3a997d055d0034a84e574fbe6fb1aad6eab6e4419a1bd4b42e10b94750d590d77e524500a64fac28f1e61c3cb257ac5682f4a80ca6ae7476b5f
data/README.md CHANGED
@@ -62,9 +62,8 @@ end
62
62
 
63
63
  UI.window_on_closing(main_window) do
64
64
  puts 'Bye Bye'
65
- UI.control_destroy(main_window)
66
65
  UI.quit
67
- 0
66
+ 1
68
67
  end
69
68
 
70
69
  UI.window_set_child(main_window, button)
@@ -178,40 +177,27 @@ Add additional options below if necessary:
178
177
  git clone https://github.com/kojix2/libui
179
178
  cd libui
180
179
  bundle install
181
- bundle exec rake vendor:auto # vendor:build
180
+ bundle exec rake vendor:auto
182
181
  bundle exec rake test
183
182
  ```
184
183
 
185
184
  ### Pre-built shared libraries for libui-ng
186
185
 
187
- Use the following rake tasks to download the shared library required for your platform:
186
+ Download pre-built libui-ng shared libraries (per your current platform):
188
187
 
189
- `rake -T`
190
-
191
- ```
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
188
+ ```sh
189
+ bundle exec rake vendor:auto
201
190
  ```
202
191
 
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
-
206
- ### Using C libui compiled from source code
192
+ Clean downloaded vendor files (keeps `vendor/{LICENSE,README}.md`):
207
193
 
208
- The following Rake task will compile libui-ng. meson or ninja is required.
209
-
210
- `bundle exec rake vendor:build`
194
+ ```sh
195
+ bundle exec rake vendor:clean
196
+ ```
211
197
 
212
- Alternatively, you can tell Ruby LibUI the location of shared libraries. Set the environment variable `LIBUIDIR` to specify the path to the shared library. (See [#46](https://github.com/kojix2/LibUI/issues/46#issuecomment-1041575792)). This is especially useful on platforms where the LibUI gem does not provide shared library, such as the ARM architecture (used in devices like Raspberry Pi).
198
+ ### Using your own libui build
213
199
 
214
- Another simple approach is to replace the shared libraries in the gem vendor directory with the ones you have compiled.
200
+ 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
201
 
216
202
  ### Publishing gems
217
203
 
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'
@@ -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 parserake the function prototype: #{signature}")
19
+ raise("can't parse the function prototype: #{signature}")
20
20
  end
21
21
  symname = func
22
22
  callback_argument_types = {} # Added
@@ -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
- owner = if idx == 0 or # UI.queue_main{}
29
- owner.frozen? # UI.timer(100) {}
30
- LibUIBase # or UI is better?
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
- args[0] # receiver
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
@@ -1,3 +1,3 @@
1
1
  module LibUI
2
- VERSION = '0.2.0.pre'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/libui.rb CHANGED
@@ -42,15 +42,21 @@ 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
- warn 'error'
53
- warn UI.free_init_error(init)
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
54
60
  end
55
61
 
56
62
  # Gets the window position.
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.0.pre
4
+ version: 0.2.0
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - kojix2
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-08-16 00:00:00.000000000 Z
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.5.22
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: []