fusuma 3.3.1 → 3.5.0

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: 629441e7756cdd5df55e497ff6c4758fcbcd1f351132f55caea11a80a06492e8
4
- data.tar.gz: 6510ed44d991c1ec08938ad33b316ce6693fee571f00743df9dc66a1948c3562
3
+ metadata.gz: 352237ad297e7171f4e0ab18f96b1560e90ce1835b2591e01213496876388b42
4
+ data.tar.gz: 11b61f92f937ac7857800d10e6967367674e691cc883a12e81a343f084a8073b
5
5
  SHA512:
6
- metadata.gz: 88fe3cc4229f5a6bcd772affcd2292c440ede0a581448f81605b24de1ad90c15a6ad6b3d097da00ea35b6b9131ccd108cfab4c063c07c1aa140e3c83a125fcf2
7
- data.tar.gz: 0e4fb3ac2fe62fd064a0ad17d46ba21952e78b75cf13c118961854316998cc70f00c8d83a0c386517efb0136f90349024c5ffd5870cc53cfdbc3688a5e0082f7
6
+ metadata.gz: 49d73eaa0635211cb018992b4c7d8cfd238a7f7d9811db33248578873ad21b04b0cbdaaecbc7469c34d18c9205e1de574be85f47e91cc7c986460f29adb18aa4
7
+ data.tar.gz: a0beefc19aefe6cf1ffeb879b3dc070af75e65b620a5b68a0765bb9cbb09f4df3f0d689e4b67b3963f90e7ece9398a0543014874f6555abb320c19698997d3d5
@@ -14,7 +14,7 @@ module Fusuma
14
14
  key = Key.new(key) if !key.is_a? Key
15
15
  @keys << key
16
16
  key.symbol
17
- end.join(",")
17
+ end.join(",").to_sym
18
18
  else
19
19
  key = Key.new(keys)
20
20
  @cache_key = key.symbol
@@ -22,10 +22,16 @@ module Fusuma
22
22
  end
23
23
  end
24
24
 
25
- def inspect
25
+ def to_s
26
26
  @keys.map(&:inspect)
27
27
  end
28
28
 
29
+ def ==(other)
30
+ return false unless other.is_a? Index
31
+
32
+ cache_key == other.cache_key
33
+ end
34
+
29
35
  attr_reader :keys, :cache_key
30
36
 
31
37
  # Keys in Index
@@ -40,7 +46,7 @@ module Fusuma
40
46
  @skippable = skippable
41
47
  end
42
48
 
43
- def inspect
49
+ def to_s
44
50
  if @skippable
45
51
  "#{@symbol}(skippable)"
46
52
  else
@@ -81,18 +81,20 @@ module Fusuma
81
81
  # Search with context from load_streamed Config
82
82
  # @param context [Hash]
83
83
  # @return [Object]
84
- def with_context(context, &block)
85
- @context = context || {}
84
+ def with_context(context = {}, &block)
85
+ before = @context
86
+ @context = context
86
87
  result = block.call
87
- @context = {}
88
+ ensure # NOTE: ensure is called even if return in block
89
+ @context = before
88
90
  result
89
91
  end
90
92
 
91
- CONEXT_SEARCH_ORDER = [:no_context, :complete_match_context, :partial_match_context]
93
+ CONTEXT_SEARCH_ORDER = [:no_context, :complete_match_context, :partial_match_context]
92
94
  # Return a matching context from config
93
95
  # @params request_context [Hash]
94
96
  # @return [Hash]
95
- def find_context(request_context, fallbacks = CONEXT_SEARCH_ORDER, &block)
97
+ def find_context(request_context, fallbacks = CONTEXT_SEARCH_ORDER, &block)
96
98
  # Search in blocks in the following order.
97
99
  # 1. primary context(no context)
98
100
  # 2. complete match config[:context] == request_context
@@ -31,6 +31,11 @@ module Fusuma
31
31
  def clear_expired(current_time: Time.now)
32
32
  end
33
33
 
34
+ # @return [TrueClass, FalseClass]
35
+ def empty?
36
+ @events.empty?
37
+ end
38
+
34
39
  # clear buffer
35
40
  def clear
36
41
  @events.clear
@@ -127,10 +127,6 @@ module Fusuma
127
127
  @events.last.record.gesture
128
128
  end
129
129
 
130
- def empty?
131
- @events.empty?
132
- end
133
-
134
130
  def select_by_events(&block)
135
131
  return enum_for(:select_by_events) unless block
136
132
 
@@ -34,10 +34,6 @@ module Fusuma
34
34
  @events.delete(e)
35
35
  end
36
36
  end
37
-
38
- def empty?
39
- @events.empty?
40
- end
41
37
  end
42
38
  end
43
39
  end
@@ -29,6 +29,10 @@ module Fusuma
29
29
  @finger = finger.to_i
30
30
  @delta = delta
31
31
  end
32
+
33
+ def to_s
34
+ "#{@gesture}, #{@finger}, #{@status}, #{@delta}"
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -22,6 +22,10 @@ module Fusuma
22
22
  @args = args
23
23
  end
24
24
 
25
+ def to_s
26
+ "#{@index}, #{@position}, #{@trigger}, #{@args}"
27
+ end
28
+
25
29
  def type
26
30
  :index
27
31
  end
@@ -25,19 +25,22 @@ module Fusuma
25
25
 
26
26
  input = inputs.find { |i| i.io == io }
27
27
 
28
- begin
29
- # NOTE: io.readline is blocking method
30
- # each input plugin must write line to pipe (include `\n`)
31
- line = io.readline(chomp: true)
32
- rescue EOFError => e
33
- MultiLogger.error "#{input.class.name}: #{e}"
34
- MultiLogger.error "Shutdown fusuma process..."
35
- Process.kill("TERM", Process.pid)
36
- rescue => e
37
- MultiLogger.error "#{input.class.name}: #{e}"
38
- exit 1
39
- end
40
- input.create_event(record: line)
28
+ input.create_event(record: input.read_from_io)
29
+ end
30
+
31
+ # @return [String, Record]
32
+ # IO#readline is blocking method
33
+ # so input plugin must write line to pipe (include `\n`)
34
+ # or, override read_from_io and implement your own read method
35
+ def read_from_io
36
+ io.readline(chomp: true)
37
+ rescue EOFError => e
38
+ MultiLogger.error "#{self.class.name}: #{e}"
39
+ MultiLogger.error "Shutdown fusuma process..."
40
+ Process.kill("TERM", Process.pid)
41
+ rescue => e
42
+ MultiLogger.error "#{self.class.name}: #{e}"
43
+ exit 1
41
44
  end
42
45
 
43
46
  # @return [Integer]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = "3.3.1"
4
+ VERSION = "3.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-04 00:00:00.000000000 Z
11
+ date: 2024-01-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
14
14
  on Linux able to recognize swipes or pinchs and assign command to them. Read installation
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubygems_version: 3.4.10
90
+ rubygems_version: 3.4.19
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Multitouch gestures with libinput driver, Linux