libui 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c60340ec43dace0a242ef186a57ef756931f286350555b97c39baff6d072d6cb
4
- data.tar.gz: fbf6e4dbd6ae9018fc6227c17f9250326b6b0850e764bb04d13780a764b8d777
3
+ metadata.gz: f74d579c937d71a61c613abe93ca07ae1bafa8c78933d7cd4f979fc92b327883
4
+ data.tar.gz: f091c583e9fd5c53673232b4babc90f87c626a8185c4fcfb576ce9d89d36affa
5
5
  SHA512:
6
- metadata.gz: 6d5618424d35ed377ae722b925dc5b2c808317e8b1d6657b0108db0d4e2cd9a8d65acc338e708eaad53bfa5733a6d6488e58a58ff428e94ffbae0d8c4db7a6f0
7
- data.tar.gz: '095d839f03a9e511d2912c8c7310c02143f2a2968af301237b1f31184b0f85592ce0fb8a379768b0a79837ed7a3789f01c5280a20829690400807bd1d5c2b82d'
6
+ metadata.gz: 8897e6b92a054070600be68a2f646e7b79468ace0ed6b6c0de4713a2b3cf8e7a72ef35e6934d72f1d31112778a6f948c49ca74130d805e189a72c448144fd35f
7
+ data.tar.gz: ad4f816e611238801cfefdbff60891f86703c92554fbca79691e4bcff1fd9a4dff45ebeabd78acd57aedaf56ff3f120b9cd16ca95788a469bb0cb58060194dcc
data/README.md CHANGED
@@ -64,12 +64,17 @@ Compared to original libui written in C,
64
64
  * You can pass a block as a callback.
65
65
  * The block will be converted to a Proc object and added to the last argument.
66
66
  * Even in that case, it is possible to omit the last argument nil.
67
-
67
+
68
+ You can use [the documentation for libui's Go bindings](https://pkg.go.dev/github.com/andlabs/ui) as a reference.
69
+
68
70
  ### Not object oriented?
69
71
 
70
72
  * At the moment, it is not object-oriented.
71
73
  * Instead of providing a half-baked object-oriented approach, leave it as is.
72
- * [A list of DSLs for LibUI.](https://github.com/kojix2/LibUI/wiki/DSL-for-LibUI)
74
+
75
+ ### DSLs for LibUI
76
+ * [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
77
+ * [libui_paradise](https://rubygems.org/gems/libui_paradise)
73
78
 
74
79
  ### How to use fiddle pointers?
75
80
 
@@ -94,6 +99,7 @@ font_button = UI.new_font_button
94
99
 
95
100
  # Allocate memory
96
101
  font_descriptor = UI::FFI::FontDescriptor.malloc
102
+ font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
97
103
 
98
104
  UI.font_button_on_changed(font_button) do
99
105
  UI.font_button_font(font_button, font_descriptor)
data/lib/libui/ffi.rb CHANGED
@@ -217,17 +217,33 @@ module LibUI
217
217
  # uiDateTimePicker
218
218
 
219
219
  # time.h
220
- TM = struct [
221
- 'int tm_sec',
222
- 'int tm_min',
223
- 'int tm_hour',
224
- 'int tm_mday',
225
- 'int tm_mon',
226
- 'int tm_year',
227
- 'int tm_wday',
228
- 'int tm_yday',
229
- 'int tm_isdst'
230
- ]
220
+ TM = if Fiddle::WINDOWS
221
+ struct [
222
+ 'int tm_sec',
223
+ 'int tm_min',
224
+ 'int tm_hour',
225
+ 'int tm_mday',
226
+ 'int tm_mon',
227
+ 'int tm_year',
228
+ 'int tm_wday',
229
+ 'int tm_yday',
230
+ 'int tm_isdst'
231
+ ]
232
+ else # The GNU C Library (glibc)
233
+ struct [
234
+ 'int tm_sec',
235
+ 'int tm_min',
236
+ 'int tm_hour',
237
+ 'int tm_mday',
238
+ 'int tm_mon',
239
+ 'int tm_year',
240
+ 'int tm_wday',
241
+ 'int tm_yday',
242
+ 'int tm_isdst',
243
+ 'long tm_gmtoff',
244
+ 'const char *tm_zone'
245
+ ]
246
+ end
231
247
 
232
248
  try_extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
233
249
  try_extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
data/lib/libui/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibUI
4
- VERSION = '0.0.11'
4
+ VERSION = '0.0.12'
5
5
  end
data/lib/libui.rb CHANGED
@@ -24,7 +24,11 @@ module LibUI
24
24
  extend LibUIBase
25
25
 
26
26
  class << self
27
- def init(opt = FFI::InitOptions.malloc)
27
+ def init(opt = nil)
28
+ unless opt
29
+ opt = FFI::InitOptions.malloc
30
+ opt.to_ptr.free = Fiddle::RUBY_FREE
31
+ end
28
32
  i = super(opt)
29
33
  return if i.size.zero?
30
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-03 00:00:00.000000000 Z
11
+ date: 2021-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler