zui 0.0.5 → 0.0.6

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: '0999bab5076e4e21bf90ec3640b66299b922f06b5b1365f77a3e2c8535c4b483'
4
- data.tar.gz: fdd3778327cc3fac59b2b3017e2b181bff8e6965cd88a34248b4204e2954b6d1
3
+ metadata.gz: d7ea7b4582e9bcf5569570df18dd76f3d1393ec669e1b724074a42100e4fda3a
4
+ data.tar.gz: 53cdb96fec42899c801e28699bc6a288c209de6e194096644e1087e51238f1de
5
5
  SHA512:
6
- metadata.gz: 6742f765a1b83dd292971a800e84b4e83ddd0d7c69c9ec8b42dc921850a8f73a095c436118fa403d1dc90400535b7191bd61e844c8950e74e1c2ef98bf695cd3
7
- data.tar.gz: 4d39a113ac0d61a0a2373101b79e5807c19642b657965675f77871f54cfcbf744dbb14f7b2501a9af3940d6c6d28bbd1f39cf7daa0bf07653780789e98dcc642
6
+ metadata.gz: 908ffce6d2e11436a24ea978971dcdc19aabf55a7dd1706ff2e6fb86b0ce255c77a98d61bbb02b82b2bc6a5b9b16e4674f017adda6629ae95f76af284e0ae64e
7
+ data.tar.gz: 71f8b68dc16b2260efb2a3424e4a9170ac86db42f05958778a63fe2f74c302763141842c94766d7d8db577f3514dfb6b0146d658002c45532f70f74a408a873f
@@ -152,7 +152,10 @@ Item {
152
152
  function payload(mouse) { return { x: mouse.x, y: mouse.y, button: mouse.button } }
153
153
  onClicked: function(mouse) { if (renderer.subscribed("click")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", payload(mouse)) }
154
154
  onDoubleClicked: function(mouse) { if (renderer.subscribed("double_click")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "double_click", payload(mouse)) }
155
- onPressed: function(mouse) { if (renderer.subscribed("press")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", payload(mouse)) }
155
+ onPressed: function(mouse) {
156
+ canvasRoot.forceActiveFocus()
157
+ if (renderer.subscribed("press")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", payload(mouse))
158
+ }
156
159
  onReleased: function(mouse) { if (renderer.subscribed("release")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", payload(mouse)) }
157
160
  onPositionChanged: function(mouse) { if (renderer.subscribed("hover")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", payload(mouse)) }
158
161
  }
@@ -11,6 +11,8 @@ FocusScope {
11
11
  signal activateRequested()
12
12
  signal textKey(string text)
13
13
  focus: true
14
+ Component.onCompleted: Qt.callLater(function() { root.forceActiveFocus() })
15
+ onVisibleChanged: if (visible) Qt.callLater(function() { root.forceActiveFocus() })
14
16
  Keys.onEscapePressed: if (!blocked) closeRequested()
15
17
  Keys.onDeletePressed: if (!blocked) deleteRequested()
16
18
  Keys.onReturnPressed: if (!blocked) returnRequested()
data/README.md CHANGED
@@ -61,7 +61,7 @@ Build and install the gem directly from a checkout:
61
61
 
62
62
  ```bash
63
63
  gem build zui.gemspec
64
- gem install ./zui-0.0.5.gem
64
+ gem install ./zui-0.0.6.gem
65
65
  ```
66
66
 
67
67
  `zui doctor --fix` is the one-time setup for each Zui version and platform. It downloads the
data/Service.qml CHANGED
@@ -158,11 +158,20 @@ Item {
158
158
 
159
159
  surfaces = message.surfaces
160
160
  surfaceOptions = message.surface_options || ({})
161
- nodeIndex = nextIndex
161
+ commitNodeIndex(nextIndex)
162
162
  revision += 1
163
163
  lastError = ""
164
164
  }
165
165
 
166
+ // nodeIndex intentionally keeps a stable object identity. ControlNode observes
167
+ // revision, so publishing a new index object before its revision would expose
168
+ // intermediate patch state and invalidate every renderer in a batch.
169
+ function commitNodeIndex(nextIndex) {
170
+ for (var oldId in nodeIndex)
171
+ if (nextIndex[oldId] === undefined) delete nodeIndex[oldId]
172
+ for (var nextId in nextIndex) nodeIndex[nextId] = nextIndex[nextId]
173
+ }
174
+
166
175
  function validateSurfaceOptions(options) {
167
176
  if (!plainObject(options)) return false
168
177
  var allowed = {
@@ -192,6 +201,8 @@ Item {
192
201
  if (!validSetPatch(message.patches[batchIndex])) return reject("patch batch rejected")
193
202
  for (var applyIndex = 0; applyIndex < message.patches.length; applyIndex++)
194
203
  applySetPatch(message.patches[applyIndex], false)
204
+ // All replacements above are invisible to bindings until this single
205
+ // revision publishes the complete, internally consistent batch.
195
206
  revision += 1
196
207
  return true
197
208
  }
@@ -220,7 +231,7 @@ Item {
220
231
  var containerReplacement = ({ type: node.type, id: node.id, props: node.props || {}, children: message.children })
221
232
  if (node.events !== undefined) containerReplacement.events = node.events
222
233
  childrenIndex[node.id] = containerReplacement
223
- nodeIndex = childrenIndex
234
+ commitNodeIndex(childrenIndex)
224
235
  revision += 1
225
236
  return true
226
237
  }
@@ -250,10 +261,7 @@ Item {
250
261
  if (node.children !== undefined) animatedReplacement.children = node.children
251
262
  if (node.events !== undefined) animatedReplacement.events = node.events
252
263
  animatedReplacement.transitions = validatedTracks
253
- var animatedIndex = ({})
254
- for (var animatedId in nodeIndex) animatedIndex[animatedId] = nodeIndex[animatedId]
255
- animatedIndex[node.id] = animatedReplacement
256
- nodeIndex = animatedIndex
264
+ nodeIndex[node.id] = animatedReplacement
257
265
  revision += 1
258
266
  return true
259
267
  }
@@ -299,10 +307,7 @@ Item {
299
307
  }
300
308
  }
301
309
 
302
- var nextIndex = ({})
303
- for (var id in nodeIndex) nextIndex[id] = nodeIndex[id]
304
- nextIndex[node.id] = replacement
305
- nodeIndex = nextIndex
310
+ nodeIndex[node.id] = replacement
306
311
  if (incrementRevision) revision += 1
307
312
  return true
308
313
  }
data/lib/zui.rb CHANGED
@@ -21,7 +21,7 @@ require_relative "zui/generator"
21
21
  require_relative "zui/distribution"
22
22
 
23
23
  module Zui
24
- VERSION = "0.0.5"
24
+ VERSION = "0.0.6"
25
25
  FRAMEWORK_ROOT = File.expand_path("..", __dir__)
26
26
 
27
27
  def self.app(&definition)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Moussa Ali