libui 0.1.0.pre.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ module LibUI
2
+ module FiddlePatch
3
+ def parse_signature(signature, tymap = nil)
4
+ tymap ||= {}
5
+ ctype, func, args = case compact(signature)
6
+ when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
7
+ [TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
8
+ when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
9
+ [parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
10
+ else
11
+ raise("can't parserake the function prototype: #{signature}")
12
+ end
13
+ symname = func
14
+ callback_argument_types = {} # Added
15
+ argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
16
+ # Check if it is a function pointer or not
17
+ if arg =~ /\(\*.*\)\(.*\)/ # Added
18
+ # From the arguments, create a notation that looks like a function declaration
19
+ # int(*f)(int *, void *) -> int f(int *, void *)
20
+ func_arg = arg.sub('(*', ' ').sub(')', '') # Added
21
+ # Use Fiddle's parse_signature method again.
22
+ callback_argument_types[idx] = parse_signature(func_arg) # Added
23
+ end
24
+ parse_ctype(arg, tymap)
25
+ end
26
+ # Added callback_argument_types. Original method return only 3 values.
27
+ [symname, ctype, argtype, callback_argument_types]
28
+ end
29
+
30
+ def extern(signature, *opts)
31
+ symname, ctype, argtype, callback_argument_types = parse_signature(signature, type_alias)
32
+ opt = parse_bind_options(opts)
33
+ func = import_function(symname, ctype, argtype, opt[:call_type])
34
+
35
+ # callback_argument_types
36
+ func.instance_variable_set(:@callback_argument_types,
37
+ callback_argument_types) # Added
38
+ # attr_reader
39
+ def func.callback_argument_types
40
+ @callback_argument_types
41
+ end
42
+
43
+ # argument_types
44
+ # Ruby 2.7 Fiddle::Function dose not have @argument_types
45
+ # Ruby 3.0 Fiddle::Function has @argument_types
46
+ if func.instance_variable_defined?(:@argument_types)
47
+ # check if @argument_types are the same
48
+ if func.instance_variable_get(:@argument_types) != argtype
49
+ warn "#{symname} func.argument_types:#{func.argument_types} != argtype #{argtype}"
50
+ end
51
+ else
52
+ func.instance_variable_set(:@argument_types, argtype)
53
+ end
54
+ # attr_reader
55
+ def func.argument_types
56
+ @argument_types
57
+ end
58
+
59
+ name = symname.gsub(/@.+/, '')
60
+ @func_map[name] = func
61
+ # define_method(name){|*args,&block| f.call(*args,&block)}
62
+ begin
63
+ /^(.+?):(\d+)/ =~ caller.first
64
+ file = Regexp.last_match(1)
65
+ line = Regexp.last_match(2).to_i
66
+ rescue StandardError
67
+ file, line = __FILE__, __LINE__ + 3
68
+ end
69
+ module_eval(<<-EOS, file, line)
70
+ def #{name}(*args, &block)
71
+ @func_map['#{name}'].call(*args,&block)
72
+ end
73
+ EOS
74
+ module_function(name)
75
+ func
76
+ end
77
+ end
78
+ private_constant :FiddlePatch
79
+ 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.0.pre.0'
3
+ end
data/lib/libui.rb ADDED
@@ -0,0 +1,226 @@
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 = "libui.#{RbConfig::CONFIG['SOEXT']}"
13
+
14
+ self.ffi_lib = if ENV['LIBUIDIR'] && !ENV['LIBUIDIR'].empty?
15
+ File.expand_path(lib_name, ENV['LIBUIDIR'])
16
+ else
17
+ File.expand_path("../vendor/#{lib_name}", __dir__)
18
+ end
19
+
20
+ require_relative 'libui/ffi'
21
+ require_relative 'libui/libui_base'
22
+
23
+ extend LibUIBase
24
+
25
+ class << self
26
+ def init(opt = nil)
27
+ unless opt
28
+ opt = FFI::InitOptions.malloc
29
+ opt.to_ptr.free = Fiddle::RUBY_FREE
30
+ end
31
+ i = super(opt)
32
+ return if i.size.zero?
33
+
34
+ warn 'error'
35
+ warn UI.free_init_error(init)
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
52
+ end
53
+
54
+ # UI_ENUM
55
+ # https://github.com/andlabs/libui/blob/master/ui.h
56
+
57
+ # ForEach
58
+ ForEachContinue = 0
59
+ ForEachStop = 1
60
+
61
+ # WindowResizeEdge
62
+ WindowResizeEdgeLeft = 0
63
+ WindowResizeEdgeTop = 1
64
+ WindowResizeEdgeRight = 2
65
+ WindowResizeEdgeBottom = 3
66
+ WindowResizeEdgeTopLeft = 4
67
+ WindowResizeEdgeTopRight = 5
68
+ WindowResizeEdgeBottomLeft = 6
69
+ WindowResizeEdgeBottomRight = 7
70
+
71
+ # DrawBrushType
72
+ DrawBrushTypeSolid = 0
73
+ DrawBrushTypeLinearGradient = 1
74
+ DrawBrushTypeRadialGradient = 2
75
+ DrawBrushTypeImage = 3
76
+
77
+ # DrawLineCap
78
+ DrawLineCapFlat = 0
79
+ DrawLineCapRound = 1
80
+ DrawLineCapSquare = 2
81
+
82
+ # DrawLineJoin
83
+ DrawLineJoinMiter = 0
84
+ DrawLineJoinRound = 1
85
+ DrawLineJoinBevel = 2
86
+
87
+ DrawDefaultMiterLimit = 10.0
88
+
89
+ # DrawFillMode
90
+ DrawFillModeWinding = 0
91
+ DrawFillModeAlternate = 1
92
+
93
+ # AttributeType
94
+ AttributeTypeFamily = 0
95
+ AttributeTypeSize = 1
96
+ AttributeTypeWeight = 2
97
+ AttributeTypeItalic = 3
98
+ AttributeTypeStretch = 4
99
+ AttributeTypeColor = 5
100
+ AttributeTypeBackground = 6
101
+ AttributeTypeUnderline = 7
102
+ AttributeTypeUnderlineColor = 8
103
+ AttributeTypeFeatures = 9
104
+
105
+ # TextWeight
106
+ TextWeightMinimum = 0
107
+ TextWeightThin = 100
108
+ TextWeightUltraLight = 200
109
+ TextWeightLight = 300
110
+ TextWeightBook = 350
111
+ TextWeightNormal = 400
112
+ TextWeightMedium = 500
113
+ TextWeightSemiBold = 600
114
+ TextWeightBold = 700
115
+ TextWeightUltraBold = 800
116
+ TextWeightHeavy = 900
117
+ TextWeightUltraHeavy = 950
118
+ TextWeightMaximum = 1000
119
+
120
+ # TextItalic
121
+ TextItalicNormal = 0
122
+ TextItalicOblique = 1
123
+ TextItalicItalic = 2
124
+
125
+ # TextStretch
126
+ TextStretchUltraCondensed = 0
127
+ TextStretchExtraCondensed = 1
128
+ TextStretchCondensed = 2
129
+ TextStretchSemiCondensed = 3
130
+ TextStretchNormal = 4
131
+ TextStretchSemiExpanded = 5
132
+ TextStretchExpanded = 6
133
+ TextStretchExtraExpanded = 7
134
+ TextStretchUltraExpanded = 8
135
+
136
+ # Underline
137
+ UnderlineNone = 0
138
+ UnderlineSingle = 1
139
+ UnderlineDouble = 2
140
+ UnderlineSuggestion = 3
141
+
142
+ # UnderlineColor
143
+ UnderlineColorCustom = 0
144
+ UnderlineColorSpelling = 1
145
+ UnderlineColorGrammar = 2
146
+ UnderlineColorAuxiliary = 3
147
+
148
+ # DrawTextAlign
149
+ DrawTextAlignLeft = 0
150
+ DrawTextAlignCenter = 1
151
+ DrawTextAlignRight = 2
152
+
153
+ # Modifiers
154
+ ModifierCtrl = (1 << 0)
155
+ ModifierAlt = (1 << 1)
156
+ ModifierShift = (1 << 2)
157
+ ModifierSuper = (1 << 3)
158
+
159
+ # ExtKey
160
+ ExtKeyEscape = 1
161
+ ExtKeyInsert = 2
162
+ ExtKeyDelete = 3
163
+ ExtKeyHome = 4
164
+ ExtKeyEnd = 5
165
+ ExtKeyPageUp = 6
166
+ ExtKeyPageDown = 7
167
+ ExtKeyUp = 8
168
+ ExtKeyDown = 9
169
+ ExtKeyLeft = 10
170
+ ExtKeyRight = 11
171
+ ExtKeyF1 = 12
172
+ ExtKeyF2 = 13
173
+ ExtKeyF3 = 14
174
+ ExtKeyF4 = 15
175
+ ExtKeyF5 = 16
176
+ ExtKeyF6 = 17
177
+ ExtKeyF7 = 18
178
+ ExtKeyF8 = 19
179
+ ExtKeyF9 = 20
180
+ ExtKeyF10 = 21
181
+ ExtKeyF11 = 22
182
+ ExtKeyF12 = 23
183
+ ExtKeyN0 = 24
184
+ ExtKeyN1 = 25
185
+ ExtKeyN2 = 26
186
+ ExtKeyN3 = 27
187
+ ExtKeyN4 = 28
188
+ ExtKeyN5 = 29
189
+ ExtKeyN6 = 30
190
+ ExtKeyN7 = 31
191
+ ExtKeyN8 = 32
192
+ ExtKeyN9 = 33
193
+ ExtKeyNDot = 34
194
+ ExtKeyNEnter = 35
195
+ ExtKeyNAdd = 36
196
+ ExtKeyNSubtract = 37
197
+ ExtKeyNMultiply = 38
198
+ ExtKeyNDivide = 39
199
+
200
+ # Align
201
+ AlignFill = 0
202
+ AlignStart = 1
203
+ AlignCenter = 2
204
+ AlignEnd = 3
205
+
206
+ # At
207
+ AtLeading = 0
208
+ AtTop = 1
209
+ AtTrailing = 2
210
+ AtBottom = 3
211
+
212
+ # TableValueType
213
+ TableValueTypeString = 0
214
+ TableValueTypeImage = 1
215
+ TableValueTypeInt = 2
216
+ TableValueTypeColor = 3
217
+
218
+ # SortIndicator
219
+ SortIndicatorNone = 0
220
+ SortIndicatorAscending = 1
221
+ SortIndicatorDescending = 2
222
+
223
+ # editable
224
+ TableModelColumnNeverEditable = -1
225
+ TableModelColumnAlwaysEditable = -2
226
+ 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,143 @@
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
+ ## Installation
72
+
73
+ Meson also supports installing from source; if you use Ninja, just do
74
+
75
+ ```
76
+ $ ninja -C build install
77
+ ```
78
+
79
+ 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.
80
+
81
+ #### Arch Linux
82
+
83
+ Can be built from AUR: https://aur.archlinux.org/packages/libui-ng-git/
84
+
85
+ ## Documentation
86
+
87
+ Needs to be written. Consult `ui.h` and the examples for details for now.
88
+
89
+ ## Language Bindings
90
+
91
+ 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.
92
+
93
+ Other people have made bindings to other languages:
94
+
95
+ Language | Bindings
96
+ --- | ---
97
+ C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
98
+ C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
99
+ C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [SimplexiDev.UI](https://github.com/simplexidev/sdfx)
100
+ CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
101
+ Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
102
+ Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron), [iu](https://github.com/grkek/iu)
103
+ D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
104
+ Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
105
+ Harbour | [hbui](https://github.com/rjopek/hbui)
106
+ Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
107
+ Janet | [JanetUI](https://github.com/janet-lang/janetui)
108
+ 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)
109
+ Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
110
+ Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
111
+ 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)
112
+ Nim | [ui](https://github.com/nim-lang/ui)
113
+ Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
114
+ PHP | [ui](https://github.com/krakjoe/ui)
115
+ Python | [pylibui](https://github.com/joaoventura/pylibui)
116
+ Ring | [RingLibui](https://github.com/ring-lang/ring/tree/master/extensions/ringlibui)
117
+ 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)
118
+ 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)
119
+ Scala | [scalaui](https://github.com/lolgab/scalaui)
120
+ Swift | [libui-swift](https://github.com/sclukey/libui-swift)
121
+
122
+ ## Frequently Asked Questions
123
+
124
+ ### Why does my program start in the background on OS X if I run from the command line?
125
+ 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".
126
+
127
+ 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.
128
+
129
+ 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).
130
+
131
+ ## Contributing
132
+
133
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
134
+
135
+ ## Screenshots
136
+
137
+ From examples/controlgallery:
138
+
139
+ ![Windows](examples/controlgallery/windows.png)
140
+
141
+ ![Unix](examples/controlgallery/unix.png)
142
+
143
+ ![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.0.pre.0
5
+ platform: x86_64-darwin
6
+ authors:
7
+ - kojix2
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-13 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.dylib
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.5'
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.3.7
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Ruby bindings to libui
54
+ test_files: []