glimmer-dsl-swt 4.18.4.2 → 4.18.4.3

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: 3c4acc7755917941e9c8fd7d94f7712d29701ca4eefd1b31b20a9a46d41ec557
4
- data.tar.gz: 3f59ee7617453a88165fa57594bcff2dea9831c70a821c11326ace68d66b8936
3
+ metadata.gz: 961d9ddec901003644771059d3e3914ec041fe72e6d551ea1aa89c0f755725ee
4
+ data.tar.gz: 5dc835b1580c1f5125531f80efb9620cf39b8ccb905dc991bf771c38bcac1816
5
5
  SHA512:
6
- metadata.gz: 22e115579a74734199b02ce5e43cb15fd789424f063e0d805ff3e1058ec63067e01ea63df4b794e530a0268803bdd898211db3f31a99fe27c63f9ed21c1cb857
7
- data.tar.gz: 85a7683f0e431252bf4e5490895fa029bfc961a17be3a6fa8e1d15ab4a6927acd8ddf834a46ada2dbaa1ce0aaaf68979c477edebae48e77de9c601a5dfd0d658
6
+ metadata.gz: b21c2e5bc842dd1ef9d937b37fa72567d76b8c3ee4ae823952d982a2e80d078b50f383738b70f40655c241d1c697a5ce10ae74c9b43dce7685ca6d9d4683ebe9
7
+ data.tar.gz: 1862c2516f8237a426cbddb6a331d74bc5112950491abb9d78a5086df8e9343408146d17c05e0c10613f68828d1a9081ec54ba118f8d4b8ab80d25b567d4c1b5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.4.3
4
+
5
+ - Fix flashing issue when using ShellProxy#pack_same_size on Windows
6
+ - Double buffer Hello, Canvas Animation! Sample to remove flickering
7
+ - Tetris - Added `:double_buffered` SWT style for Tetris Playfield and Block to avoid rendering flicker on Windows
8
+ - Tetris - Substituted command key with control on Windows/Linux to make Tetris menu shortcuts work (e.g. CTRL+P pauses)
9
+ - Tetris - Workaround for Windows issue with tetromino down invisibility upon holding down arrow key (now holding down does only one down)
10
+
3
11
  ### 4.18.4.2
4
12
 
5
13
  - Remove Tetris Clear button from High Score dialog (since it is available via menu and is rarely used)
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 SWT 4.18.4.2
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 SWT 4.18.4.3
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -456,9 +456,10 @@ https://www.eclipse.org/swt/faq.php
456
456
 
457
457
  ## Pre-requisites
458
458
 
459
- - JDK 8u241 (1.8.0_241) (find at https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html)
459
+ - JDK 8u241 (1.8.0_241) (find at https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html / On Windows, ensure PATH includes Java bin directory like C:\Program Files\Java\jdk1.8.0_241\bin for javapackager to work during packaging Glimmer applications)
460
460
  - JRuby 9.2.14.0 (supporting Ruby 2.5.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux or find at [https://www.jruby.org/download](https://www.jruby.org/download) for Windows)
461
461
  - SWT 4.18 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem)
462
+ - Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
462
463
 
463
464
  To obtain JRuby through [RVM](http://rvm.io), you may run:
464
465
 
@@ -478,7 +479,7 @@ If you intend to build a Glimmer app from scratch with [scaffolding](#scaffoldin
478
479
 
479
480
  Otherwise, Option 2 ([Bundler](#option-2-bundler)) can be followed in rare cases where you want to build an app without [scaffolding](#scaffolding).
480
481
 
481
- Note: if you encounter any [issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues), please [report](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) and then install a previous version instead from the list of [Glimmer Releases](https://rubygems.org/gems/glimmer-dsl-swt/versions).
482
+ **Note:** if you encounter any [issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues), please [report](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) and then install a previous version instead from the list of [Glimmer Releases](https://rubygems.org/gems/glimmer-dsl-swt/versions) (keep looking back till you find one that works). Do not be disheartened as nearly everything is only a few days of work away. That said, keep in mind that this project is free and open source, meaning provided as is, so do not expect anything, but if you help with reporting and contributing, you could speed things up or even become part of the project.
482
483
 
483
484
  ### Option 1: Direct Install
484
485
  (Use for [Scaffolding](#scaffolding))
@@ -490,7 +491,7 @@ jgem install glimmer-dsl-swt
490
491
 
491
492
  Or this command if you want a specific version:
492
493
  ```
493
- jgem install glimmer-dsl-swt -v 4.18.4.2
494
+ jgem install glimmer-dsl-swt -v 4.18.4.3
494
495
  ```
495
496
 
496
497
  `jgem` is JRuby's version of `gem` command.
@@ -508,7 +509,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
508
509
 
509
510
  Add the following to `Gemfile`:
510
511
  ```
511
- gem 'glimmer-dsl-swt', '~> 4.18.4.2'
512
+ gem 'glimmer-dsl-swt', '~> 4.18.4.3'
512
513
  ```
513
514
 
514
515
  And, then run:
@@ -566,7 +567,7 @@ bin/glimmer samples
566
567
  Below are the full usage instructions that come up when running `glimmer` without args.
567
568
 
568
569
  ```
569
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.4.2
570
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.4.3
570
571
 
571
572
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
572
573
 
@@ -588,8 +589,8 @@ Tasks are run via rake. Some tasks take arguments in square brackets.
588
589
 
589
590
  Available tasks are below (if you do not see any, please add `require 'glimmer/rake_task'` to Rakefile and rerun or run rake -T):
590
591
 
591
- Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
592
- ‣ glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
592
+ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
593
+ ‣ glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
593
594
  glimmer list:gems:customwidget[query] # List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]
594
595
  glimmer list:gems:dsl[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
595
596
  glimmer package[type] # Package app for distribution (generating config, jar, and native files) (type is optional)
@@ -1045,7 +1046,7 @@ Output:
1045
1046
 
1046
1047
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1047
1048
  Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
1048
- Swt glimmer-dsl-swt 4.18.4.2 AndyMaleh Glimmer DSL for SWT
1049
+ Swt glimmer-dsl-swt 4.18.4.3 AndyMaleh Glimmer DSL for SWT
1049
1050
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1050
1051
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
1051
1052
  ```
@@ -2402,22 +2403,24 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
2402
2403
 
2403
2404
  ### Canvas Shape DSL
2404
2405
 
2406
+ **(ALPHA FEATURE)**
2407
+
2405
2408
  Glimmer supports drawing graphics directly on a `canvas` widget via SWT (or any widget for that matter though `canvas` is recommended for drawing).
2406
2409
 
2407
2410
  This is accomplished via the Shape DSL a sub-DSL of the Glimmer GUI DSL, which makes it possible to draw graphics declaratively with very understandable and maintainable syntax.
2408
2411
 
2409
2412
  Shape keywords and their args (including defaults) are listed below (they basically match method names and arguments on [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) minus the `draw` or `fill` prefix in downcase):
2410
- - `arc(x, y, width, height, startAngle, arcAngle, fill: false)` arc is part of a circle within an oval area, denoted by start angle (degrees) and end angle (degrees)
2411
- - `focus(x, y, width, height)` this is just like rectangle but its foreground color is always that of the OS widget focus color (useful when capturing user interaction via a shape)
2413
+ - `arc​(x, y, width, height, startAngle, arcAngle, fill: false)` arc is part of a circle within an oval area, denoted by start angle (degrees) and end angle (degrees)
2414
+ - `focus​(x, y, width, height)` this is just like rectangle but its foreground color is always that of the OS widget focus color (useful when capturing user interaction via a shape)
2412
2415
  - `image(image, x, y)` [image](#image)
2413
2416
  - `line(x1, y1, x2, y2)` line
2414
2417
  - `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
2415
- - `point(x, y)` point
2418
+ - `point​(x, y)` point
2416
2419
  - `polygon(pointArray, fill: false)` polygon consisting of points, which close automatically to form a shape that can be optionally filled (when points only form a line, it does not show up as filled)
2417
2420
  - `polyline(pointArray)` polyline is just like a polygon, but it does not close up to form a shape, remaining open (unless the points close themselves by having the last point or an intermediate point match the first)
2418
2421
  - `rectangle(x, y, width, height, fill: false)` standard rectangle, which can be optionally filled
2419
2422
  - `rectangle(x, y, width, height, arcWidth = 60, arcHeight = 60, fill: false, round: true)` round rectangle, which can be optionally filled, and takes optional extra round angle arguments
2420
- - `rectangle(x, y, width, height, vertical = true, fill: true, gradient: true)` gradient rectangle, which is always filled, and takes an optional extra argument to specify true for vertical gradient (default) and false for horizontal gradient
2423
+ - `rectangle​(x, y, width, height, vertical = true, fill: true, gradient: true)` gradient rectangle, which is always filled, and takes an optional extra argument to specify true for vertical gradient (default) and false for horizontal gradient
2421
2424
  - `text(string, x, y, flags = nil)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be :draw_delimiter (i.e. new lines), :draw_tab, :draw_mnemonic, and :draw_transparent as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
2422
2425
 
2423
2426
  Shape keywords that can be filled with color can take an keyword argument `fill: true`. Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
@@ -2431,7 +2434,7 @@ Here is a list of supported attributes nestable within a block under shapes:
2431
2434
  - `antialias` enables antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
2432
2435
  - `background` sets fill color for fillable shapes (standard color symbol (e.g. `:red`), `rgb(red_integer, green_integer, blue_integer)` color, or Color/ColorProxy object directly)
2433
2436
  - `background_pattern` sets fill gradient/image pattern for fillable shape background (takes the same arguments as the SWT [Pattern](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Pattern.html) class [e.g. `background_pattern 2.3, 4.2, 5.4, 7.2, :red, :blue`] / note: this feature isn't extensively tested yet)
2434
- - `clipping` clips area of painting (numeric values for `(x, y, width, height)`)
2437
+ - `clipping` clips area of painting (​numeric values for `(x, y, width, height)`)
2435
2438
  - `fill_rule` sets filling rule (SWT style value of `:fill_even_odd` or `:fill_winding`)
2436
2439
  - `font` sets font (Hash of `:name`, `:height`, and `:style` just like standard widget font property, or Font/FontProxy object directly)
2437
2440
  - `foreground` sets draw color for drawable shapes (standard color symbol (e.g. `:red`), `rgb(red_integer, green_integer, blue_integer)` color, or Color/ColorProxy object directly)
@@ -2633,6 +2636,8 @@ shell {
2633
2636
 
2634
2637
  ### Canvas Transform DSL
2635
2638
 
2639
+ **(ALPHA FEATURE)**
2640
+
2636
2641
  The transform DSL builds [org.eclipse.swt.graphics.Transform](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Transform.html) objects with a nice declarative syntax.
2637
2642
 
2638
2643
  `transform` keyword builds a `Transform` object. It optionally takes the transformation matrix elements: (m11, m12, m21, m22, dx, dy)
@@ -2715,6 +2720,8 @@ Learn more at the [Hello, Canvas Transform! Sample](#hello-canvas-transform).
2715
2720
 
2716
2721
  ### Canvas Animation DSL
2717
2722
 
2723
+ **(EARLY ALPHA FEATURE)**
2724
+
2718
2725
  (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2719
2726
 
2720
2727
  Glimmer additionally provides built-in support for animations via a declarative Animation DSL, another sub-DSL of the Glimmer GUI DSL.
@@ -3283,7 +3290,7 @@ https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.platform.doc.isv
3283
3290
 
3284
3291
  It has `addSelectionListener`. Additionally, under its `Control` super class, it has `addControlListener`, `addDragDetectListener`, `addFocusListener`, `addGestureListener`, `addHelpListener`, `addKeyListener`, `addMenuDetectListener`, `addMouseListener`, `addMouseMoveListener`, `addMouseTrackListener`, `addMouseWheelListener`, `addPaintListener`, `addTouchListener`, and `addTraverseListener`
3285
3292
 
3286
- Suppose, we select `addSelectionListener`, which is responsible for what happens when a user selects a button (clicks it). Then, open its argument `SelectionListener` SWT API, and you find the event (instance) methods: `widgetDefaultSelected` and `widgetSelected​`. Let's select the second one, which is what gets invoked when a button is clicked.
3293
+ Suppose, we select `addSelectionListener`, which is responsible for what happens when a user selects a button (clicks it). Then, open its argument `SelectionListener` SWT API, and you find the event (instance) methods: `widgetDefaultSelected` and `widgetSelected​`. Let's select the second one, which is what gets invoked when a button is clicked.
3287
3294
 
3288
3295
  Now, Glimmer simplifies the process of hooking into that listener (observer) by neither requiring you to call the `addSelectionListener` method nor requiring you to implement/extend the `SelectionListener` API.
3289
3296
 
@@ -3704,6 +3711,7 @@ To use, simply use `code_text` in place of the `text` or `styled_text` widget. I
3704
3711
 
3705
3712
  **lines**
3706
3713
  (default: false)
3714
+ **(ALPHA OPTION)**
3707
3715
 
3708
3716
  Shows line numbers when set to true.
3709
3717
 
@@ -5199,6 +5207,8 @@ Contact Manager - Edit Done
5199
5207
 
5200
5208
  This sample demonstrates how to build an interactive animated game with MVC architecture, custom-shell/custom-widgets, multi-threading, asynchronous programming, data-binding, canvas shape graphic decorations, canvas shape icon image generation, and keyboard events/shortcuts.
5201
5209
 
5210
+ Note that it works optimally on the Mac. It is very new, so it has not been optimized for Windows and Linux yet given their minor differences from the Mac.
5211
+
5202
5212
  Code:
5203
5213
 
5204
5214
  [samples/elaborate/tetris.rb](samples/elaborate/tetris.rb)
@@ -5272,7 +5282,7 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
5272
5282
 
5273
5283
  ## Packaging & Distribution
5274
5284
 
5275
- Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
5285
+ Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem). On Windows, ensure system PATH includes Java bin directory like "C:\Program Files\Java\jdk1.8.0_241\bin" for javapackager command to work during packaging Glimmer applications.
5276
5286
 
5277
5287
  Note 2: Glimmer packaging has a strong dependency on JDK8 at the moment. JDK9 & JDK10 might work, but JDK11 and onward definitely won't since they dropped javapackager, which later came back as jpackage in JDK14, but it's not ready for prime time yet. Just stick to JDK8 for now, strongly supported by Oracle for the next 6 years at least.
5278
5288
 
@@ -5282,7 +5292,7 @@ Glimmer simplifies the process of native-executable packaging and distribution o
5282
5292
  glimmer package
5283
5293
  ```
5284
5294
 
5285
- It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating all available packaging types on the current platform (e.g. `DMG`, `PKG`, `APP` on the Mac) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows)
5295
+ It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating all available packaging types on the current platform (e.g. `DMG`, `PKG`, `APP` on the Mac) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows). If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.
5286
5296
 
5287
5297
  You may choose to generate a specific type of packaging instead by addionally passing in the `[type]` option. For example, this generates an MSI setup file on Windows:
5288
5298
 
@@ -5430,7 +5440,7 @@ Glimmer::RakeTask::Package.javapackager_extra_args = '-Bmac.signing-key-develope
5430
5440
 
5431
5441
  Now, when you run `glimmer package`, it builds a self-signed DMG file. When you make available online, and users download, upon launching application, they are presented with your certificate, which they have to sign if they trust you in order to use the application.
5432
5442
 
5433
- ### Gotchas
5443
+ ### Packaging Gotchas
5434
5444
 
5435
5445
  1. Specifying License File
5436
5446
 
@@ -5463,6 +5473,16 @@ You can get around that in zsh by running glimmer package commands with `bash -c
5463
5473
  bash -c 'glimmer package'
5464
5474
  ```
5465
5475
 
5476
+ 4. Java on Windows System PATH
5477
+
5478
+ If you get any errors running Java on Windows, keep in mind that you need to have the Java binaries on the Windows System PATH environment variable:
5479
+ c:\program files\java\jre1.8.0_241
5480
+
5481
+ The problem is Oracle seems to be adding an indirect Java path junction in later versions of their installer:
5482
+ C:\Program Files (x86)\Common Files\Oracle\Java\javapath
5483
+
5484
+ Simply replace with the simple one above (setting the correct version number) and then reinstall JRuby to have it use Java from the right path.
5485
+
5466
5486
  ## App Updates
5467
5487
 
5468
5488
  Glimmer already supports automatic (and manual) app updates via the Mac App Store for Mac apps. Simply run the `glimmer package` command with the Mac App Store keys configured as per [Mac Application Distribution](mac-application-distribution) instructions and you get automatic (and manual) app update support courtesy of the Mac App Store.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.4.2
1
+ 4.18.4.3
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.18.4.2 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.4.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.4.2"
9
+ s.version = "4.18.4.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-02-04"
14
+ s.date = "2021-02-07"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -164,7 +164,7 @@ module Glimmer
164
164
  minimum_size = @swt_widget.getMinimumSize
165
165
  @swt_widget.setMinimumSize(bounds.width, bounds.height)
166
166
  listener = on_control_resized { @swt_widget.setBounds(bounds) }
167
- @swt_widget.pack
167
+ @swt_widget.layout(true, true)
168
168
  @swt_widget.removeControlListener(listener.swt_listener)
169
169
  @swt_widget.setMinimumSize(minimum_size)
170
170
  elsif OS.linux?
@@ -51,11 +51,12 @@ class Tetris
51
51
  end
52
52
 
53
53
  Display.app_name = 'Glimmer Tetris'
54
+
54
55
  display {
55
- @keyboard_listener = on_swt_keydown { |key_event|
56
+ @keyboard_down_listener = on_swt_keydown { |key_event|
56
57
  case key_event.keyCode
57
58
  when swt(:arrow_down), 's'.bytes.first
58
- game.down!
59
+ game.down! if OS.mac?
59
60
  when swt(:arrow_up)
60
61
  case game.up_arrow_action
61
62
  when :instant_down
@@ -69,7 +70,7 @@ class Tetris
69
70
  game.left!
70
71
  when swt(:arrow_right), 'd'.bytes.first
71
72
  game.right!
72
- when swt(:shift), swt(:alt), swt(:ctrl)
73
+ when swt(:shift), swt(:alt)
73
74
  if key_event.keyLocation == swt(:right) # right shift key
74
75
  game.rotate!(:right)
75
76
  elsif key_event.keyLocation == swt(:left) # left shift key
@@ -77,6 +78,16 @@ class Tetris
77
78
  end
78
79
  end
79
80
  }
81
+
82
+ # invoke game.down! on keyup with Windows/Linux since they seem to group-render similar events, preventing intermediate renders (causing invisiblity while holding keys)
83
+ if !OS.mac?
84
+ @keyboard_up_listener = on_swt_keyup { |key_event|
85
+ case key_event.keyCode
86
+ when swt(:arrow_down), 's'.bytes.first
87
+ game.down!
88
+ end
89
+ }
90
+ end
80
91
 
81
92
  # if running in app mode, set the Mac app about dialog (ignored in platforms)
82
93
  @about_observer = on_about {
@@ -167,7 +178,7 @@ class Tetris
167
178
  }
168
179
  }
169
180
  end
170
-
181
+
171
182
  def start_moving_tetrominos_down
172
183
  Thread.new do
173
184
  @mutex.synchronize do
@@ -199,7 +210,8 @@ class Tetris
199
210
  def deregister_observers
200
211
  @show_high_scores_observer&.deregister
201
212
  @game_over_observer&.deregister
202
- @keyboard_listener&.deregister
213
+ @keyboard_down_listener&.deregister
214
+ @keyboard_up_listener&.deregister
203
215
  @about_observer&.deregister
204
216
  @quit_observer&.deregister
205
217
  end
@@ -27,7 +27,7 @@ class Tetris
27
27
  options :game_playfield, :block_size, :row, :column
28
28
 
29
29
  body {
30
- canvas {
30
+ canvas(:double_buffered) {
31
31
  background bind(game_playfield[row][column], :color)
32
32
  polygon(0, 0, block_size, 0, block_size - 4, 4, 4, 4) {
33
33
  background bind(game_playfield[row][column], :color) { |color_value|
@@ -29,7 +29,7 @@ class Tetris
29
29
  options :game_playfield, :playfield_width, :playfield_height, :block_size
30
30
 
31
31
  body {
32
- composite {
32
+ composite(:double_buffered) {
33
33
  grid_layout {
34
34
  num_columns playfield_width
35
35
  make_columns_equal_width true
@@ -23,6 +23,8 @@ class Tetris
23
23
  module View
24
24
  class TetrisMenuBar
25
25
  include Glimmer::UI::CustomWidget
26
+
27
+ COMMAND_KEY = OS.mac? ? :command : :ctrl
26
28
 
27
29
  options :game
28
30
 
@@ -34,7 +36,7 @@ class Tetris
34
36
  menu_item {
35
37
  text '&Start'
36
38
  enabled bind(game, :game_over)
37
- accelerator :command, :s
39
+ accelerator COMMAND_KEY, :s
38
40
 
39
41
  on_widget_selected {
40
42
  game.start!
@@ -42,14 +44,14 @@ class Tetris
42
44
  }
43
45
  menu_item(:check) {
44
46
  text '&Pause'
45
- accelerator :command, :p
47
+ accelerator COMMAND_KEY, :p
46
48
  enabled bind(game, :game_over, on_read: :!) {|value| value && !game.show_high_scores}
47
49
  enabled bind(game, :show_high_scores, on_read: :!) {|value| value && !game.game_over}
48
50
  selection bind(game, :paused)
49
51
  }
50
52
  menu_item {
51
53
  text '&Restart'
52
- accelerator :command, :r
54
+ accelerator COMMAND_KEY, :r
53
55
 
54
56
  on_widget_selected {
55
57
  game.restart!
@@ -58,7 +60,7 @@ class Tetris
58
60
  menu_item(:separator)
59
61
  menu_item {
60
62
  text '&Exit'
61
- accelerator :command, :x
63
+ accelerator COMMAND_KEY, :x
62
64
 
63
65
  on_widget_selected {
64
66
  parent_proxy.close
@@ -73,12 +75,12 @@ class Tetris
73
75
  text '&High Scores'
74
76
  menu_item(:check) {
75
77
  text '&Show'
76
- accelerator :command, :shift, :h
78
+ accelerator COMMAND_KEY, :shift, :h
77
79
  selection bind(game, :show_high_scores)
78
80
  }
79
81
  menu_item {
80
82
  text '&Clear'
81
- accelerator :command, :shift, :c
83
+ accelerator COMMAND_KEY, :shift, :c
82
84
 
83
85
  on_widget_selected {
84
86
  game.clear_high_scores!
@@ -91,24 +93,24 @@ class Tetris
91
93
  text '&Options'
92
94
  menu_item(:check) {
93
95
  text '&Beeping'
94
- accelerator :command, :b
96
+ accelerator COMMAND_KEY, :b
95
97
  selection bind(game, :beeping)
96
98
  }
97
99
  menu {
98
100
  text 'Up Arrow'
99
101
  menu_item(:radio) {
100
102
  text '&Instant Down'
101
- accelerator :command, :shift, :i
103
+ accelerator COMMAND_KEY, :shift, :i
102
104
  selection bind(game, :instant_down_on_up, computed_by: :up_arrow_action)
103
105
  }
104
106
  menu_item(:radio) {
105
107
  text 'Rotate &Right'
106
- accelerator :command, :shift, :r
108
+ accelerator COMMAND_KEY, :shift, :r
107
109
  selection bind(game, :rotate_right_on_up, computed_by: :up_arrow_action)
108
110
  }
109
111
  menu_item(:radio) {
110
112
  text 'Rotate &Left'
111
- accelerator :command, :shift, :l
113
+ accelerator COMMAND_KEY, :shift, :l
112
114
  selection bind(game, :rotate_left_on_up, computed_by: :up_arrow_action)
113
115
  }
114
116
  }
@@ -119,7 +121,7 @@ class Tetris
119
121
 
120
122
  menu_item {
121
123
  text '&About'
122
- accelerator :command, :shift, :a
124
+ accelerator COMMAND_KEY, :shift, :a
123
125
 
124
126
  on_widget_selected {
125
127
  parent_custom_shell&.show_about_dialog
@@ -25,7 +25,7 @@ shell {
25
25
  text 'Hello, Canvas Animation!'
26
26
  minimum_size 800, 420
27
27
 
28
- canvas {
28
+ canvas(:double_buffered) {
29
29
  animation {
30
30
  every 0.01 # in seconds (one hundredth)
31
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.4.2
4
+ version: 4.18.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement