libui 0.1.3.pre-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,87 @@
1
+ module LibUI
2
+ # This module overrides Fiddle's mtehods
3
+ # - Fiddle::Importer#extern
4
+ # - Fiddle::CParser#parse_signature
5
+ # Original methods are in
6
+ # - https://github.com/ruby/fiddle/blob/master/lib/fiddle/import.rb
7
+ # - https://github.com/ruby/fiddle/blob/master/lib/fiddle/cparser.rb
8
+ # These changes add the ability to parse the signatures of functions given as arguments.
9
+
10
+ module FiddlePatch
11
+ def parse_signature(signature, tymap = nil)
12
+ tymap ||= {}
13
+ ctype, func, args = case compact(signature)
14
+ when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
15
+ [TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
16
+ when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
17
+ [parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
18
+ else
19
+ raise("can't parserake the function prototype: #{signature}")
20
+ end
21
+ symname = func
22
+ callback_argument_types = {} # Added
23
+ argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
24
+ # Check if it is a function pointer or not
25
+ if arg =~ /\(\*.*\)\(.*\)/ # Added
26
+ # From the arguments, create a notation that looks like a function declaration
27
+ # int(*f)(int *, void *) -> int f(int *, void *)
28
+ func_arg = arg.sub('(*', ' ').sub(')', '') # Added
29
+ # Use Fiddle's parse_signature method again.
30
+ callback_argument_types[idx] = parse_signature(func_arg) # Added
31
+ end
32
+ parse_ctype(arg, tymap)
33
+ end
34
+ # Added callback_argument_types. Original method return only 3 values.
35
+ [symname, ctype, argtype, callback_argument_types]
36
+ end
37
+
38
+ def extern(signature, *opts)
39
+ symname, ctype, argtype, callback_argument_types = parse_signature(signature, type_alias)
40
+ opt = parse_bind_options(opts)
41
+ func = import_function(symname, ctype, argtype, opt[:call_type])
42
+
43
+ # callback_argument_types
44
+ func.instance_variable_set(:@callback_argument_types,
45
+ callback_argument_types) # Added
46
+ # attr_reader
47
+ def func.callback_argument_types
48
+ @callback_argument_types
49
+ end
50
+
51
+ # argument_types
52
+ # Ruby 2.7 Fiddle::Function dose not have @argument_types
53
+ # Ruby 3.0 Fiddle::Function has @argument_types
54
+ if func.instance_variable_defined?(:@argument_types)
55
+ # check if @argument_types are the same
56
+ if func.instance_variable_get(:@argument_types) != argtype
57
+ warn "#{symname} func.argument_types:#{func.argument_types} != argtype #{argtype}"
58
+ end
59
+ else
60
+ func.instance_variable_set(:@argument_types, argtype)
61
+ end
62
+ # attr_reader
63
+ def func.argument_types
64
+ @argument_types
65
+ end
66
+
67
+ name = symname.gsub(/@.+/, '')
68
+ @func_map[name] = func
69
+ # define_method(name){|*args,&block| f.call(*args,&block)}
70
+ begin
71
+ /^(.+?):(\d+)/ =~ caller.first
72
+ file = Regexp.last_match(1)
73
+ line = Regexp.last_match(2).to_i
74
+ rescue StandardError
75
+ file, line = __FILE__, __LINE__ + 3
76
+ end
77
+ module_eval(<<-EOS, file, line)
78
+ def #{name}(*args, &block)
79
+ @func_map['#{name}'].call(*args,&block)
80
+ end
81
+ EOS
82
+ module_function(name)
83
+ func
84
+ end
85
+ end
86
+ private_constant :FiddlePatch
87
+ end
@@ -0,0 +1,52 @@
1
+ module LibUI
2
+ module LibUIBase
3
+ FFI.func_map.each_key do |original_method_name|
4
+ name = Utils.convert_to_ruby_method(original_method_name)
5
+ func = FFI.func_map[original_method_name]
6
+
7
+ define_method(name) do |*args, &blk|
8
+ # Assume that block is the last argument.
9
+ args << blk if blk
10
+
11
+ # The proc object is converted to a Closure::BlockCaller object.
12
+ args.map!.with_index do |arg, idx|
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
36
+ else
37
+ owner.instance_variable_set(:@callbacks, [callback])
38
+ end
39
+ callback
40
+ end
41
+
42
+ # Make it possible to omit the last nil. This may be an over-optimization.
43
+ siz = func.argument_types.size - 1
44
+ args[siz] = nil if args.size == siz
45
+
46
+ FFI.public_send(original_method_name, *args)
47
+ end
48
+ end
49
+ end
50
+
51
+ private_constant :LibUIBase
52
+ end
@@ -0,0 +1,19 @@
1
+ module LibUI
2
+ module Utils
3
+ class << self
4
+ def convert_to_ruby_method(original_method_name)
5
+ underscore(original_method_name.delete_prefix('ui'))
6
+ end
7
+
8
+ # Converting camel case to underscore case in ruby
9
+ # https://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby#1509939
10
+ def underscore(str)
11
+ str.gsub(/::/, '/') # Maybe we don't need it.
12
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
13
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
14
+ .tr('-', '_')
15
+ .downcase
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module LibUI
2
+ VERSION = '0.1.3.pre'
3
+ end
data/lib/libui.rb ADDED
@@ -0,0 +1,258 @@
1
+ require_relative 'libui/version'
2
+ require_relative 'libui/utils'
3
+ require 'rbconfig'
4
+
5
+ module LibUI
6
+ class Error < StandardError; end
7
+
8
+ class << self
9
+ attr_accessor :ffi_lib
10
+ end
11
+
12
+ lib_name = [
13
+ "libui.#{RbConfig::CONFIG['host_cpu']}.#{RbConfig::CONFIG['SOEXT']}",
14
+ "libui.#{RbConfig::CONFIG['SOEXT']}"
15
+ ]
16
+
17
+ self.ffi_lib = \
18
+ if ENV['LIBUIDIR'] && !ENV['LIBUIDIR'].empty?
19
+ lib_name.lazy
20
+ .map { |name| File.expand_path(name, ENV['LIBUIDIR']) }
21
+ .find { |path| File.exist?(path) }
22
+ else
23
+ lib_name.lazy
24
+ .map { |name| File.expand_path("../vendor/#{name}", __dir__) }
25
+ .find { |path| File.exist?(path) }
26
+ end
27
+
28
+ require_relative 'libui/ffi'
29
+ require_relative 'libui/libui_base'
30
+
31
+ extend LibUIBase
32
+
33
+ class << self
34
+ def init(opt = nil)
35
+ unless opt
36
+ opt = FFI::InitOptions.malloc
37
+ opt.to_ptr.free = Fiddle::RUBY_FREE
38
+ end
39
+ i = super(opt)
40
+ return if i.size.zero?
41
+
42
+ warn 'error'
43
+ warn UI.free_init_error(init)
44
+ end
45
+
46
+ # Gets the window position.
47
+ # Coordinates are measured from the top left corner of the screen.
48
+ # @param w [Fiddle::Pointer] Pointer of uiWindow instance.
49
+ # @return [Array] position of the window. [x, y]
50
+ # @note This method may return inaccurate or dummy values on Unix platforms.
51
+
52
+ def window_position(w)
53
+ x_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE)
54
+ y_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE)
55
+ super(w, x_ptr, y_ptr)
56
+ x = x_ptr[0, Fiddle::SIZEOF_INT].unpack1('i*')
57
+ y = y_ptr[0, Fiddle::SIZEOF_INT].unpack1('i*')
58
+ [x, y]
59
+ end
60
+
61
+ # FIXME: This is a workaround for a old version of Fiddle.
62
+ # Fiddle 1.1.2 and above should be able to handle one character string.
63
+ # See https://github.com/ruby/fiddle/issues/96
64
+
65
+ def open_type_features_add(otf, a, b, c, d, value)
66
+ a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
67
+ super(otf, a, b, c, d, value)
68
+ end
69
+
70
+ def open_type_features_remove(otf, a, b, c, d)
71
+ a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
72
+ super(otf, a, b, c, d)
73
+ end
74
+
75
+ def open_type_features_get(otf, a, b, c, d, value)
76
+ a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
77
+ super(otf, a, b, c, d, value)
78
+ end
79
+ end
80
+
81
+ ## UI_ENUM https://github.com/libui-ng/libui-ng/blob/master/ui.h
82
+
83
+ # ForEach
84
+ ForEachContinue = 0
85
+ ForEachStop = 1
86
+
87
+ # WindowResizeEdge
88
+ WindowResizeEdgeLeft = 0
89
+ WindowResizeEdgeTop = 1
90
+ WindowResizeEdgeRight = 2
91
+ WindowResizeEdgeBottom = 3
92
+ WindowResizeEdgeTopLeft = 4
93
+ WindowResizeEdgeTopRight = 5
94
+ WindowResizeEdgeBottomLeft = 6
95
+ WindowResizeEdgeBottomRight = 7
96
+
97
+ # DrawBrushType
98
+ DrawBrushTypeSolid = 0
99
+ DrawBrushTypeLinearGradient = 1
100
+ DrawBrushTypeRadialGradient = 2
101
+ DrawBrushTypeImage = 3
102
+
103
+ # DrawLineCap
104
+ DrawLineCapFlat = 0
105
+ DrawLineCapRound = 1
106
+ DrawLineCapSquare = 2
107
+
108
+ # DrawLineJoin
109
+ DrawLineJoinMiter = 0
110
+ DrawLineJoinRound = 1
111
+ DrawLineJoinBevel = 2
112
+
113
+ DrawDefaultMiterLimit = 10.0
114
+
115
+ # DrawFillMode
116
+ DrawFillModeWinding = 0
117
+ DrawFillModeAlternate = 1
118
+
119
+ # AttributeType
120
+ AttributeTypeFamily = 0
121
+ AttributeTypeSize = 1
122
+ AttributeTypeWeight = 2
123
+ AttributeTypeItalic = 3
124
+ AttributeTypeStretch = 4
125
+ AttributeTypeColor = 5
126
+ AttributeTypeBackground = 6
127
+ AttributeTypeUnderline = 7
128
+ AttributeTypeUnderlineColor = 8
129
+ AttributeTypeFeatures = 9
130
+
131
+ # TextWeight
132
+ TextWeightMinimum = 0
133
+ TextWeightThin = 100
134
+ TextWeightUltraLight = 200
135
+ TextWeightLight = 300
136
+ TextWeightBook = 350
137
+ TextWeightNormal = 400
138
+ TextWeightMedium = 500
139
+ TextWeightSemiBold = 600
140
+ TextWeightBold = 700
141
+ TextWeightUltraBold = 800
142
+ TextWeightHeavy = 900
143
+ TextWeightUltraHeavy = 950
144
+ TextWeightMaximum = 1000
145
+
146
+ # TextItalic
147
+ TextItalicNormal = 0
148
+ TextItalicOblique = 1
149
+ TextItalicItalic = 2
150
+
151
+ # TextStretch
152
+ TextStretchUltraCondensed = 0
153
+ TextStretchExtraCondensed = 1
154
+ TextStretchCondensed = 2
155
+ TextStretchSemiCondensed = 3
156
+ TextStretchNormal = 4
157
+ TextStretchSemiExpanded = 5
158
+ TextStretchExpanded = 6
159
+ TextStretchExtraExpanded = 7
160
+ TextStretchUltraExpanded = 8
161
+
162
+ # Underline
163
+ UnderlineNone = 0
164
+ UnderlineSingle = 1
165
+ UnderlineDouble = 2
166
+ UnderlineSuggestion = 3
167
+
168
+ # UnderlineColor
169
+ UnderlineColorCustom = 0
170
+ UnderlineColorSpelling = 1
171
+ UnderlineColorGrammar = 2
172
+ UnderlineColorAuxiliary = 3
173
+
174
+ # DrawTextAlign
175
+ DrawTextAlignLeft = 0
176
+ DrawTextAlignCenter = 1
177
+ DrawTextAlignRight = 2
178
+
179
+ # Modifiers
180
+ ModifierCtrl = (1 << 0)
181
+ ModifierAlt = (1 << 1)
182
+ ModifierShift = (1 << 2)
183
+ ModifierSuper = (1 << 3)
184
+
185
+ # ExtKey
186
+ ExtKeyEscape = 1
187
+ ExtKeyInsert = 2
188
+ ExtKeyDelete = 3
189
+ ExtKeyHome = 4
190
+ ExtKeyEnd = 5
191
+ ExtKeyPageUp = 6
192
+ ExtKeyPageDown = 7
193
+ ExtKeyUp = 8
194
+ ExtKeyDown = 9
195
+ ExtKeyLeft = 10
196
+ ExtKeyRight = 11
197
+ ExtKeyF1 = 12
198
+ ExtKeyF2 = 13
199
+ ExtKeyF3 = 14
200
+ ExtKeyF4 = 15
201
+ ExtKeyF5 = 16
202
+ ExtKeyF6 = 17
203
+ ExtKeyF7 = 18
204
+ ExtKeyF8 = 19
205
+ ExtKeyF9 = 20
206
+ ExtKeyF10 = 21
207
+ ExtKeyF11 = 22
208
+ ExtKeyF12 = 23
209
+ ExtKeyN0 = 24
210
+ ExtKeyN1 = 25
211
+ ExtKeyN2 = 26
212
+ ExtKeyN3 = 27
213
+ ExtKeyN4 = 28
214
+ ExtKeyN5 = 29
215
+ ExtKeyN6 = 30
216
+ ExtKeyN7 = 31
217
+ ExtKeyN8 = 32
218
+ ExtKeyN9 = 33
219
+ ExtKeyNDot = 34
220
+ ExtKeyNEnter = 35
221
+ ExtKeyNAdd = 36
222
+ ExtKeyNSubtract = 37
223
+ ExtKeyNMultiply = 38
224
+ ExtKeyNDivide = 39
225
+
226
+ # Align
227
+ AlignFill = 0
228
+ AlignStart = 1
229
+ AlignCenter = 2
230
+ AlignEnd = 3
231
+
232
+ # At
233
+ AtLeading = 0
234
+ AtTop = 1
235
+ AtTrailing = 2
236
+ AtBottom = 3
237
+
238
+ # TableValueType
239
+ TableValueTypeString = 0
240
+ TableValueTypeImage = 1
241
+ TableValueTypeInt = 2
242
+ TableValueTypeColor = 3
243
+
244
+ # SortIndicator
245
+ SortIndicatorNone = 0
246
+ SortIndicatorAscending = 1
247
+ SortIndicatorDescending = 2
248
+
249
+ # editable
250
+ TableModelColumnNeverEditable = -1
251
+ TableModelColumnAlwaysEditable = -2
252
+
253
+ # TableSelectionMode
254
+ TableSelectionModeNone = 0
255
+ TableSelectionModeZeroOrOne = 1
256
+ TableSelectionModeOne = 2
257
+ TableSelectionModeZeroOrMany = 3
258
+ end
data/vendor/LICENSE.md ADDED
@@ -0,0 +1,10 @@
1
+ Copyright (c) 2022 libui-ng authors
2
+
3
+ Copyright (c) 2014 Pietro Gagliardi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
data/vendor/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # libui-ng: a portable GUI library for C
2
+
3
+ Fork of [andlabs/libui](https://github.com/andlabs/libui). This README is being written.<br>
4
+ [![Build Status, GitHub Actions](https://github.com/libui-ng/libui-ng/actions/workflows/build.yml/badge.svg)](https://github.com/libui-ng/libui-ng/actions/workflows/build.yml)
5
+ [![GitLab](https://img.shields.io/badge/gitlab-%23181717.svg?style=for-the-badge&logo=gitlab&logoColor=white)](https://gitlab.com/libui-ng/libui-ng)
6
+ [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/libui-ng/libui-ng)
7
+
8
+ ## About
9
+
10
+ Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
11
+
12
+ ## Status
13
+
14
+ libui-ng is currently **mid-alpha** software.
15
+
16
+ See [CHANGELOG.md](CHANGELOG.md)
17
+
18
+ *Old announcements can be found in the [news.md](old/news.md) file.*
19
+
20
+ ## Runtime Requirements
21
+
22
+ * Windows: Windows Vista SP2 with Platform Update or newer
23
+ * Unix: GTK+ 3.10 or newer
24
+ * Mac OS X: OS X 10.8 or newer
25
+
26
+ ## Build Requirements
27
+
28
+ * All platforms:
29
+ * [Meson](https://mesonbuild.com/) 0.58.0 or newer
30
+ * Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
31
+ * Windows: either
32
+ * Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
33
+ * MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
34
+ * [Isolation awareness](https://msdn.microsoft.com/en-us/library/aa375197%28v=vs.85%29.aspx), which is how you get themed controls from a DLL without needing a manifest
35
+ * Unix: nothing else specific
36
+ * Mac OS X: nothing else specific, so long as you can build Cocoa programs
37
+
38
+ ## Building
39
+
40
+ libui-ng mainly uses [the standard Meson build options](https://mesonbuild.com/Builtin-options.html).
41
+
42
+ ```
43
+ $ # in the top-level libui-ng directory run:
44
+ $ meson setup build [options]
45
+ $ ninja -C build
46
+ ```
47
+
48
+ Once this completes, everything will be under `build/meson-out/`.
49
+
50
+ libui-ng specific options:
51
+
52
+ - `-Dtests=(true|false)` controls whether tests are built; defaults to `true`
53
+ - `-Dexamples=(true|false)` controls whether examples are built; defaults to `true`
54
+
55
+ Most important Meson options:
56
+
57
+ * `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
58
+ * `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
59
+ * `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
60
+ * `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
61
+ * `--wrap-mode=(forcefallback|nofallback|nodownload|...)` controls which cmocka library version to use in test enabled builds. The default is `forcefallback` to pull and build a local copy. Package maintainers may wish to choose `nofallback` to use the system's library and declare `cmocka` a build time dependency or `nodownload`, see [the Meson documentation](https://mesonbuild.com/Subprojects.html#commandline-options) for more details.
62
+
63
+ Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
64
+
65
+ The Meson website and documentation has more in-depth usage instructions.
66
+
67
+ For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
68
+
69
+ Backends other than `ninja` should work, but are untested by me.
70
+
71
+ ## Testing
72
+
73
+ ### Automated Unit Tests
74
+
75
+ Run the included unit tests via `meson test -C build`. Alternatively you can also run the `unit` executable manually.
76
+
77
+ ### Manual Testing Suite
78
+
79
+ Run the manual quality assurance test suite via `qa` and follow the instructions laid out within.
80
+
81
+ ## Installation
82
+
83
+ Meson also supports installing from source; if you use Ninja, just do
84
+
85
+ ```
86
+ $ ninja -C build install
87
+ ```
88
+
89
+ When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
90
+
91
+ #### Arch Linux
92
+
93
+ Can be built from AUR: https://aur.archlinux.org/packages/libui-ng-git/
94
+
95
+ ## Documentation [WIP]
96
+
97
+ [API](https://libui-ng.github.io/libui-ng/), check the [modules](https://libui-ng.github.io/libui-ng/modules.html) section for an overview of (nearly all) uiControls.
98
+
99
+ Consult the `ui.h` comments for the uiControls missing in the docs.
100
+
101
+ Check the `examples` directory for fully fledged examples. Check out the `tests` directory and subdirectories for more real world usage.
102
+
103
+ ## Language Bindings
104
+
105
+ libui was originally written as part of my [package ui for Go](https://github.com/andlabs/ui). Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.
106
+
107
+ Other people have made bindings to other languages:
108
+
109
+ Language | Bindings
110
+ --- | ---
111
+ C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
112
+ C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
113
+ C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/)
114
+ CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
115
+ Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
116
+ Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron), [iu](https://github.com/grkek/iu)
117
+ D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
118
+ Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
119
+ Harbour | [hbui](https://github.com/rjopek/hbui)
120
+ Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
121
+ Janet | [JanetUI](https://github.com/janet-lang/janetui)
122
+ JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido)
123
+ Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
124
+ Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
125
+ Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui)
126
+ Nim | [ui](https://github.com/nim-lang/ui), [uing](https://github.com/neroist/uing)
127
+ Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
128
+ PHP | [ui](https://github.com/krakjoe/ui), [Ardillo](https://github.com/ardillo-php/ext)
129
+ Python | [pylibui](https://github.com/joaoventura/pylibui)
130
+ Ring | [RingLibui](https://github.com/ring-lang/ring/tree/master/extensions/ringlibui)
131
+ Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby), [LibUI](https://github.com/kojix2/libui), [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
132
+ Rust | [libui-ng-sys](https://github.com/norepimorphism/libui-ng-sys), [boing](https://github.com/norepimorphism/boing), [libui-rs](https://github.com/rust-native-ui/libui-rs), [libui](https://github.com/libui-rs/libui)
133
+ Scala | [scalaui](https://github.com/lolgab/scalaui)
134
+ Swift | [libui-swift](https://github.com/sclukey/libui-swift)
135
+
136
+ ## Frequently Asked Questions
137
+
138
+ ### Why does my program start in the background on OS X if I run from the command line?
139
+ OS X normally does not start program executables directly; instead, it uses [Launch Services](https://developer.apple.com/reference/coreservices/1658613-launch_services?language=objc) to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".
140
+
141
+ When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out [there is an API](https://developer.apple.com/reference/appkit/nsapplication/1428468-activateignoringotherapps) that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.
142
+
143
+ See also [this](https://github.com/andlabs/libui/pull/20#issuecomment-211381971) and [this](http://stackoverflow.com/questions/25318524/what-exactly-should-i-pass-to-nsapp-activateignoringotherapps-to-get-my-appl).
144
+
145
+ ## Contributing
146
+
147
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
148
+
149
+ ## Screenshots
150
+
151
+ From examples/controlgallery:
152
+
153
+ ![Windows](examples/controlgallery/windows.png)
154
+
155
+ ![Unix](examples/controlgallery/unix.png)
156
+
157
+ ![OS X](examples/controlgallery/darwin.png)
Binary file
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: libui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3.pre
5
+ platform: x64-mingw-ucrt
6
+ authors:
7
+ - kojix2
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-11-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - 2xijok@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE.txt
21
+ - README.md
22
+ - lib/libui.rb
23
+ - lib/libui/ffi.rb
24
+ - lib/libui/fiddle_patch.rb
25
+ - lib/libui/libui_base.rb
26
+ - lib/libui/utils.rb
27
+ - lib/libui/version.rb
28
+ - vendor/LICENSE.md
29
+ - vendor/README.md
30
+ - vendor/libui.x64.dll
31
+ homepage: https://github.com/kojix2/libui
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">"
47
+ - !ruby/object:Gem::Version
48
+ version: 1.3.1
49
+ requirements: []
50
+ rubygems_version: 3.4.22
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Ruby bindings to libui
54
+ test_files: []