glimmer-dsl-libui 0.7.5 → 0.7.6

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: ec43caceca7a5693e9a98278af76787a03cdfa7e259b4eafc221456f2388f1cf
4
- data.tar.gz: 72e7b5b20c6d07ab1160d1e83c7564dea41181b538b71d73d54acb41e839f503
3
+ metadata.gz: a51c465651c0e505932930498ce9a827401b91a4d3cd4371a0b8dc58b8da8348
4
+ data.tar.gz: e422609e3e0400f8dc5ad55fd90f40040cc7a30cba33b66813b7adc14ff9b2ce
5
5
  SHA512:
6
- metadata.gz: b829f991b9fa34fb2ba186a022a950e45e65d13e81019ad53829b2c57b13aa7a16c10304207c6cc734015a4a5a3b44885070da15832f92f655603e925623396e
7
- data.tar.gz: c00a6b5c543039dc64c68f5e2e3cccfad74f7b511ba6fb40aa3482e9468ea49de995dc0edb8cc924082c2cce456923a47e5d9bc406b2866be8999f6309b31925
6
+ metadata.gz: d6bd5b18f925857c9505eef4b36d893ddcfe5b5bcc1203b4581d5cc91f5bd319527d1123584cb7a9730d28693d668fe877d00872afea1f828e08a2cc2fc91ebe
7
+ data.tar.gz: 34e80b9accde5252b992f8d1517f34fc74ca023f5ce7fcfa179bf311426c817cc0c89a863ff58157ea86e0f5c3f92653cbc8d7d7cef2ebaeb8cc3269a4186b27
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.7.6
4
+
5
+ - Fix issue with hearing "fonk" sound on every key press when handling `on_key_event`/`on_key_down`/`on_key_up` listeners (by returning expected `1` value if the listeners are handled properly or otherwise allowing the "fonk" sound to ring when the listeners are not handled)
6
+ - Update examples/tetris.rb with COMMAND+Q shortcut for quitting on the Mac and ALT+F4 shortcut for quitting on Windows/Linux
7
+
3
8
  ## 0.7.5
4
9
 
5
10
  - Fix [issue 46](https://github.com/AndyObtiva/glimmer-dsl-libui/issues/46) (GTK Error rendering table with zero initial elements), which happens when explicitly data-binding table cell_rows to an empty array
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.7.5
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.7.6
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  ### The Quickest Way From Zero To GUI
4
4
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
@@ -544,7 +544,7 @@ gem install glimmer-dsl-libui
544
544
  Or install via Bundler `Gemfile`:
545
545
 
546
546
  ```ruby
547
- gem 'glimmer-dsl-libui', '~> 0.7.5'
547
+ gem 'glimmer-dsl-libui', '~> 0.7.6'
548
548
  ```
549
549
 
550
550
  Test that installation worked by running the [Meta-Example](#examples):
@@ -763,7 +763,7 @@ Keyword(Args) | Properties | Listeners
763
763
  - `valign` [dsl-only] (`:fill`, `:start`, `:center`, or `:end`) [default=`:fill`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
764
764
 
765
765
  ### Common Control Operations
766
- - `destroy`
766
+ - `destroy` (note that for closing a `window`, in addition to calling `somewindow.destroy`, you also have to call `::LibUI.quit`)
767
767
  - `disable`
768
768
  - `enable`
769
769
  - `hide`
@@ -1947,7 +1947,7 @@ The [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) (a
1947
1947
 
1948
1948
  ![MVC - Model View Controller](https://developer.mozilla.org/en-US/docs/Glossary/MVC/model-view-controller-light-blue.png)
1949
1949
 
1950
- [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) supports the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) via the `observe(model, attribute_or_key=nil)` keyword, which can observe `Object` models with attributes, `Hash`es with keys, and `Array`s. It automatically enhances objects as needed to support automatically notifying observers of changes via `observable#notify_observers(attribute_or_key = nil)` method:
1950
+ [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) supports the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) via control listeners in the View layer (e.g. `on_clicked` or `on_closing`) and via the `observe(model, attribute_or_key=nil)` keyword in the Model layer, which can observe `Object` models with attributes, `Hash`es with keys, and `Array`s. It automatically enhances objects as needed to support automatically notifying observers of changes via `observable#notify_observers(attribute_or_key = nil)` method:
1951
1951
  - `Object` becomes `Glimmer::DataBinding::ObservableModel`, which supports observing specified `Object` model attributes.
1952
1952
  - `Hash` becomes `Glimmer::DataBinding::ObservableHash`, which supports observing all `Hash` keys or a specific `Hash` key
1953
1953
  - `Array` becomes `Glimmer::DataBinding::ObservableArray`, which supports observing `Array` changes like those done with `push`, `<<`, `delete`, and `map!` methods (all mutation methods).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.5
1
+ 0.7.6
data/examples/tetris.rb CHANGED
@@ -292,6 +292,10 @@ class Tetris
292
292
  @game.rotate!(:right)
293
293
  in modifier: :control
294
294
  @game.rotate!(:left)
295
+ in modifiers: [:command], key: 'q'
296
+ exit(0) if OS.mac?
297
+ in modifiers: [:alt], ext_key: :f4
298
+ exit(0) unless OS.mac?
295
299
  else
296
300
  # Do Nothing
297
301
  end
Binary file
@@ -179,7 +179,7 @@ module Glimmer
179
179
  @area_handler.DragBroken = fiddle_closure_block_caller(0, [1, 1]) do |_, _|
180
180
  notify_custom_listeners('on_drag_broken')
181
181
  end
182
- @area_handler.KeyEvent = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_key_event|
182
+ @area_handler.KeyEvent = fiddle_closure_block_caller(1, [1, 1, 1]) do |_, _, area_key_event|
183
183
  area_key_event = ::LibUI::FFI::AreaKeyEvent.new(area_key_event)
184
184
  area_key_event = area_key_event_hash(area_key_event)
185
185
  notify_custom_listeners('on_key_event', area_key_event)
@@ -188,6 +188,11 @@ module Glimmer
188
188
  else
189
189
  notify_custom_listeners('on_key_down', area_key_event)
190
190
  end
191
+ if handle_custom_listener('on_key_event').any? || handle_custom_listener('on_key_up').any? || handle_custom_listener('on_key_down').any?
192
+ 1
193
+ else
194
+ 0
195
+ end
191
196
  end
192
197
  @listeners_installed = true
193
198
  end
@@ -221,13 +226,14 @@ module Glimmer
221
226
 
222
227
  def area_key_event_hash(area_key_event)
223
228
  modifiers = modifiers_to_symbols(area_key_event.Modifiers)
229
+ modifier = modifiers_to_symbols(area_key_event.Modifier).first
224
230
  {
225
231
  key: key_to_char(area_key_event.Key, modifiers),
226
232
  key_value: area_key_event.Key,
227
233
  key_code: area_key_event.Key,
228
234
  ext_key: ext_key_to_symbol(area_key_event.ExtKey),
229
235
  ext_key_value: area_key_event.ExtKey,
230
- modifier: modifiers_to_symbols(area_key_event.Modifier).first,
236
+ modifier: modifier,
231
237
  modifiers: modifiers,
232
238
  up: Glimmer::LibUI.integer_to_boolean(area_key_event.Up),
233
239
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-30 00:00:00.000000000 Z
11
+ date: 2023-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -567,7 +567,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
567
567
  - !ruby/object:Gem::Version
568
568
  version: '0'
569
569
  requirements: []
570
- rubygems_version: 3.3.16
570
+ rubygems_version: 3.3.1
571
571
  signing_key:
572
572
  specification_version: 4
573
573
  summary: Glimmer DSL for LibUI