Skip to content

Commit

Permalink
Merge pull request #30 from gridpoint-com/input_blacklist
Browse files Browse the repository at this point in the history
Add input_blacklist opts to remove unwanted InputEvent streams
  • Loading branch information
crertel authored Jul 12, 2023
2 parents 14fb2df + 344ddc6 commit fec7808
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/driver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ defmodule Scenic.Driver.Local do
type:
{:or, [:mfa, {:in, [:restart, :stop_driver, :stop_viewport, :stop_system, :halt_system]}]},
default: :restart
]
],
input_blacklist: [type: {:list, :string}, default: []]
]

# @mix_target Mix.Tasks.Compile.ScenicDriverLocal.target()
Expand Down Expand Up @@ -262,7 +263,8 @@ defmodule Scenic.Driver.Local do
cursor_update: false,
rel_x: 0,
rel_y: 0,
dirty_streams: []
dirty_streams: [],
input_blacklist: opts[:input_blacklist]
)

# send message to set up the cursor later
Expand Down
3 changes: 3 additions & 0 deletions lib/input.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ defmodule Scenic.Driver.Local.Input do

input_state =
inputs
|> Enum.reject(fn {_, info} ->
Enum.find(driver.assigns.input_blacklist, &(&1 == info.name))
end)
|> Enum.reduce(%{}, fn {path, info}, acc ->
{:ok, pid} = InputEvent.start_link(path)

Expand Down

0 comments on commit fec7808

Please sign in to comment.