Skip to content

Commit d202e64

Browse files
authored
Merge pull request #348 from crertel/v0.12.0-rc.0
V0.12.0 rc.0
2 parents e7e7e03 + 79051af commit d202e64

File tree

12 files changed

+131
-83
lines changed

12 files changed

+131
-83
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
include:
21-
- elixir: '1.11.4'
22-
otp: '24.2'
2321
- elixir: '1.16.0'
2422
otp: '26.2'
2523

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## 0.12.0-rc.0
4+
5+
**Note: as of v0.12.0 we'll be requiring at least Elixir 1.16**
6+
7+
This is a major update that adds fixes and support for new operations:
8+
9+
* CI improvements - @axelson
10+
* Formatting updates - @axelson
11+
* Support for Elixir 1.16 - @axelson
12+
* Update getting started guide for Scenic in supervision tree - @amclain
13+
* Fix `already_started` error propogation failure - @seb3s
14+
* Add development Nix flake - @crertel
15+
* Reduce makefile compilation spam - @jjcartsens
16+
* Simplify `default_pin` and `centroid` code - @seb3s
17+
* Add new input events (`:btn_pressed`, `:btn_released`, `:dropdown_opened`, `:dropdown_closed`, `:dropdown_item_hover`, `:focus`, `:blur`) - @GPrimola
18+
* Add warning for missing `handle_input/3` on `request_input/2` - @BinaryNoggin
19+
* Add alpha channel to sprites - @seb3s
20+
* Add script arc functions - @GPrimola
21+
* Add extended rounded rectangle drawing - @GPrimola
22+
* Assorted updates for deprecations and warnings
23+
24+
325
## 0.11.2
426

527
* Variety of minor updates, bug fixes, and doc updates
@@ -113,7 +135,7 @@ continue to work, but will log a warning when used.
113135

114136
| Asset Class | Module |
115137
| ------------- | -----|
116-
| Fonts | `Scenic.Cache.Static.Font` |
138+
| Fonts | `Scenic.Cache.Static.Font` |
117139
| Font Metrics | `Scenic.Cache.Static.FontMetrics` |
118140
| Textures (images in a fill) | `Scenic.Cache.Static.Texture` |
119141
| Raw Pixel Maps | `Scenic.Cache.Dynamic.Texture` |

config/.credo.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
# If you don't want TODO comments to cause `mix credo` to fail, just
8585
# set this value to 0 (zero).
8686
#
87-
{Credo.Check.Design.TagTODO, exit_status: 2},
87+
{Credo.Check.Design.TagTODO, exit_status: 0},
8888
{Credo.Check.Design.TagFIXME},
8989

9090
#

flake.nix

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,44 @@
77
};
88
outputs = { self, nixpkgs, flake-utils }:
99
flake-utils.lib.eachDefaultSystem (system:
10-
let
11-
inherit (pkgs.lib) optional optionals;
12-
pkgs = import nixpkgs { inherit system; };
10+
let
11+
inherit (pkgs.lib) optional optionals;
12+
pkgs = import nixpkgs { inherit system; };
1313

14-
elixir = pkgs.beam.packages.erlang.elixir;
15-
in
16-
with pkgs;
17-
{
18-
devShell = pkgs.mkShell {
19-
buildInputs = [
20-
elixir_1_16
21-
elixir_ls
22-
] ++ optional stdenv.isLinux inotify-tools
14+
elixir = pkgs.beam.packages.erlang.elixir;
15+
in
16+
with pkgs;
17+
{
18+
devShell = pkgs.mkShell {
19+
buildInputs = [
20+
util-linux
21+
libselinux
22+
libthai
23+
libdatrie
24+
libsepol
25+
libxkbcommon
26+
libepoxy
27+
pcre
28+
pcre2
29+
xorg.libXtst
30+
cairo
31+
gtk3
32+
freeglut
33+
elixir_1_16
34+
elixir_ls
35+
glibcLocales
36+
glew
37+
glfw
38+
pkg-config
39+
xorg.libX11
40+
xorg.libXau
41+
xorg.libXdmcp
42+
] ++ optional stdenv.isLinux inotify-tools
2343
++ optional stdenv.isDarwin terminal-notifier
2444
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
2545
CoreFoundation
2646
CoreServices
2747
]);
28-
};
29-
});
48+
};
49+
});
3050
}

lib/scenic/color.ex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ defmodule Scenic.Color do
180180
181181
Most of the time, you will use one of the pre-defined named colors from the
182182
Named Colors table. However, there are times when you want to work with
183-
other color formats ranging from simple grayscale to rgb to hsl.
183+
other color formats ranging from simple grayscale to rgb to hsl.
184184
185185
The following formats are all supported by the `Scenic.Color` module.
186186
The values of r, g, b, and a are integers between 0 and 255.
@@ -543,11 +543,12 @@ defmodule Scenic.Color do
543543
h = rgb_to_hue(r, g, b)
544544
l = (max + min) / 2
545545

546-
s =
547-
cond do
548-
delta < @epsilon -> 0.0
549-
true -> delta / (1 - abs(2 * l - 1))
550-
end
546+
s = if delta < @epsilon do
547+
0.0
548+
else
549+
delta / (1 - abs(2 * l - 1))
550+
end
551+
551552

552553
{h, s * 100, l * 100}
553554
end

lib/scenic/driver/key_map.ex

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ defmodule Scenic.Driver.KeyMap do
6464
"""
6565
@spec caps_lock?(keys :: keys) :: boolean
6666
def caps_lock?(keys) do
67-
is_pressed?(keys[:virt_caps_lock])
67+
pressed?(keys[:virt_caps_lock])
6868
end
6969

7070
@doc """
@@ -74,7 +74,7 @@ defmodule Scenic.Driver.KeyMap do
7474
"""
7575
@spec num_lock?(keys :: keys) :: boolean
7676
def num_lock?(keys) do
77-
is_pressed?(keys[:virt_num_lock])
77+
pressed?(keys[:virt_num_lock])
7878
end
7979

8080
@doc """
@@ -84,7 +84,7 @@ defmodule Scenic.Driver.KeyMap do
8484
"""
8585
@spec scroll_lock?(keys :: keys) :: boolean
8686
def scroll_lock?(keys) do
87-
is_pressed?(keys[:virt_scroll_lock])
87+
pressed?(keys[:virt_scroll_lock])
8888
end
8989

9090
@doc """
@@ -94,39 +94,39 @@ defmodule Scenic.Driver.KeyMap do
9494
"""
9595
@spec shift?(keys :: keys) :: boolean
9696
def shift?(keys) do
97-
is_pressed?(keys[:key_shift]) ||
98-
is_pressed?(keys[:key_leftshift]) ||
99-
is_pressed?(keys[:key_rightshift])
97+
pressed?(keys[:key_shift]) ||
98+
pressed?(keys[:key_leftshift]) ||
99+
pressed?(keys[:key_rightshift])
100100
end
101101

102102
@doc """
103103
Is any alt key pressed?
104104
"""
105105
@spec alt?(keys :: keys) :: boolean
106106
def alt?(keys) do
107-
is_pressed?(keys[:key_alt]) ||
108-
is_pressed?(keys[:key_leftalt]) ||
109-
is_pressed?(keys[:key_rightalt])
107+
pressed?(keys[:key_alt]) ||
108+
pressed?(keys[:key_leftalt]) ||
109+
pressed?(keys[:key_rightalt])
110110
end
111111

112112
@doc """
113113
Is any ctrl key pressed?
114114
"""
115115
@spec ctrl?(keys :: keys) :: boolean
116116
def ctrl?(keys) do
117-
is_pressed?(keys[:key_ctrl]) ||
118-
is_pressed?(keys[:key_leftctrl]) ||
119-
is_pressed?(keys[:key_rightctrl])
117+
pressed?(keys[:key_ctrl]) ||
118+
pressed?(keys[:key_leftctrl]) ||
119+
pressed?(keys[:key_rightctrl])
120120
end
121121

122122
@doc """
123123
Is any meta key pressed? This is usually the command button.
124124
"""
125125
@spec meta?(keys :: keys) :: boolean
126126
def meta?(keys) do
127-
is_pressed?(keys[:key_meta]) ||
128-
is_pressed?(keys[:key_leftmeta]) ||
129-
is_pressed?(keys[:key_rightmeta])
127+
pressed?(keys[:key_meta]) ||
128+
pressed?(keys[:key_leftmeta]) ||
129+
pressed?(keys[:key_rightmeta])
130130
end
131131

132132
@doc """
@@ -144,9 +144,9 @@ defmodule Scenic.Driver.KeyMap do
144144
|> add_if_set(:scroll_lock, scroll_lock?(keys))
145145
end
146146

147-
defp is_pressed?(nil), do: false
148-
defp is_pressed?(0), do: false
149-
defp is_pressed?(_), do: true
147+
defp pressed?(nil), do: false
148+
defp pressed?(0), do: false
149+
defp pressed?(_), do: true
150150

151151
defp add_if_set(list, value, true), do: [value | list]
152152
defp add_if_set(list, _value, false), do: list

lib/scenic/graph/compiler.ex

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,21 @@ defmodule Scenic.Graph.Compiler do
156156
defp compile_styles(desired, %Compiler{} = state) when is_list(desired) do
157157
Enum.reduce(desired, {[], state}, fn k, {ops, state} ->
158158
# if not requested, there is no style to compile...
159-
with {:ok, req} <- fetch_req(state, k) do
160-
case fetch_set(state, k) do
161-
{:ok, ^req} ->
162-
# Nothing to do. The correct style is already set
163-
{ops, state}
164-
165-
_ ->
166-
# Whatever is set (or not) is different than what is requested
167-
{compile_style(ops, {k, req}), put_set(state, k, req)}
168-
end
169-
else
159+
case fetch_req(state, k) do
160+
{:ok, req} ->
161+
case fetch_set(state, k) do
162+
{:ok, ^req} ->
163+
# Nothing to do. The correct style is already set
164+
{ops, state}
165+
166+
_ ->
167+
# Whatever is set (or not) is different than what is requested
168+
{compile_style(ops, {k, req}), put_set(state, k, req)}
169+
end
170+
170171
# not requested at all case
171-
_ -> {ops, state}
172+
_ ->
173+
{ops, state}
172174
end
173175
end)
174176
end

lib/scenic/scene.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,14 @@ defmodule Scenic.Scene do
722722
def request_input(scene, input_class)
723723
def request_input(scene, input) when is_atom(input), do: request_input(scene, [input])
724724

725-
def request_input(%Scene{viewport: vp, pid: pid, module: module}, inputs) when is_list(inputs) do
725+
def request_input(%Scene{viewport: vp, pid: pid, module: module}, inputs)
726+
when is_list(inputs) do
726727
unless Kernel.function_exported?(module, :handle_input, 3) do
727-
Logger.warning("Requesting input for #{inspect inputs} - #{module}.handle_input/3 not implemented")
728+
Logger.warning(
729+
"Requesting input for #{inspect(inputs)} - #{module}.handle_input/3 not implemented"
730+
)
728731
end
732+
729733
ViewPort.Input.request(vp, inputs, pid: pid)
730734
end
731735

lib/scenic/script.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ defmodule Scenic.Script do
570570

571571
[
572572
{:draw_rrectv,
573-
{width, height, upper_left_radius, upper_right_radius, lower_right_radius, lower_left_radius, flag}}
573+
{width, height, upper_left_radius, upper_right_radius, lower_right_radius,
574+
lower_left_radius, flag}}
574575
| ops
575576
]
576577
end

mix.exs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ defmodule Scenic.Mixfile do
33

44
@app_name :scenic
55

6-
@version "0.11.2"
6+
@version "0.12.0-rc.0"
77

8-
@elixir_version "~> 1.11"
8+
@elixir_version "~> 1.16"
99
@github "https://github.com/ScenicFramework/scenic"
1010

1111
def project do
@@ -47,18 +47,18 @@ defmodule Scenic.Mixfile do
4747
defp deps do
4848
[
4949
{:font_metrics, "~> 0.5.0"},
50-
{:nimble_options, "~> 0.3.4 or ~> 0.4.0 or ~> 0.5.0 or ~> 1.0"},
50+
{:nimble_options, "~> 0.3.4 or ~> 0.4.0 or ~> 0.5.0 or ~> 1.1"},
5151
{:ex_image_info, "~> 0.2.4"},
5252
{:truetype_metrics, "~> 0.6"},
5353

5454
# Tools
55-
{:elixir_make, "~> 0.8.3", runtime: false},
56-
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
57-
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false},
58-
{:excoveralls, ">= 0.0.0", only: :test, runtime: false},
55+
{:elixir_make, "~> 0.8.4", runtime: false},
56+
{:ex_doc, "~> 0.34.1", only: :dev, runtime: false},
57+
{:credo, "~> 1.7.7", only: [:dev, :test], runtime: false},
58+
{:excoveralls, "~> 0.18.1", only: :test, runtime: false},
5959
{:inch_ex, "~> 2.0", only: [:dev, :docs], runtime: false},
60-
{:dialyxir, "~> 1.1", only: :dev, runtime: false},
61-
{:machete, "~> 0.2.8", only: :test}
60+
{:dialyxir, "~> 1.4.3", only: :dev, runtime: false},
61+
{:machete, "~> 0.3.3", only: :test}
6262
]
6363
end
6464

0 commit comments

Comments
 (0)