xinput_wrapperplus 0.3.1 → 0.4.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: 9746ab6974a5f1e62f33e2ca78c60460f09832473b3ba9280563144c2f685908
4
- data.tar.gz: 4aa6cb89a0875ade8ed522cdc30f7da38fabd0b805b05816cd010d32e985e786
3
+ metadata.gz: b2b5ef82422b06bf45406ed32784ec03f9d4edad0d464ec668aeadbecb3b0408
4
+ data.tar.gz: 3e1f069f5e827fe2bb12ae52bfeaba53c19e831d1396979ab0dfb8bd52a3030f
5
5
  SHA512:
6
- metadata.gz: acfcc429d10181d7c32d634d9d98535365d0b2428a08954f3ee253c3b699fa3e42d1da6867e85b24d6ab9a376a737ab38e941c8f1f272595c757c9d3d65bfd24
7
- data.tar.gz: 6ca188a4d73692579cc3a2280e2f31d52cc158bd49a992312add45409e19dee6a3318d8dd6f4c9bdaaaa1f125dbdff6b16e3c088234925b7236ae76184e482df
6
+ metadata.gz: d817422ca9e21d2d6504402da8326f770ce7cfd30132fdab2a2c228bcf8f2ca3412a60b1282ab917ed6e5619f2deef9a43e3e5365fc0b09067d7fbe1aa2633ee
7
+ data.tar.gz: 7a525ac9e7ebcebcf77df04e5cc84ab6b6351886fc72ee5d1d2751d579a071b46c1acec30108934743c5cc916731257ab0a9909235ebcb3f4dfdf14f1554c3c4
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,7 +10,7 @@ require 'xinput_wrapper'
10
10
  class XInputWrapperPlus < XInputWrapper
11
11
 
12
12
  def initialize(device: '3', host: 'sps', port: '59000',
13
- topic: 'input/keyboard', verbose: true, lookup: {},
13
+ topic: 'input', verbose: true, lookup: {},
14
14
  debug: false, capture_all: false)
15
15
 
16
16
  super(device: device, verbose: verbose, lookup: lookup,
@@ -21,6 +21,9 @@ class XInputWrapperPlus < XInputWrapper
21
21
  external: self, verbose: verbose, debug: debug
22
22
  @sk.detect timeout: 0.7
23
23
 
24
+ @a = [] # Used to store mouse gestures
25
+ @timer = nil
26
+
24
27
  end
25
28
 
26
29
 
@@ -28,13 +31,15 @@ class XInputWrapperPlus < XInputWrapper
28
31
  puts 'knock' if @verbose
29
32
  end
30
33
 
31
- def message(msg)
34
+ def message(msg, subtopic=:keyboard)
32
35
 
33
36
  puts ':: ' + msg.inspect if @verbose
34
37
 
35
38
  return if msg.strip.empty?
36
39
 
37
- @sps.notice "%s: %s" % [@topic, msg]
40
+ topic = [@topic, subtopic].join('/')
41
+
42
+ @sps.notice "%s: %s" % [topic, msg]
38
43
 
39
44
  end
40
45
 
@@ -45,6 +50,14 @@ class XInputWrapperPlus < XInputWrapper
45
50
  @sk.knock
46
51
  end
47
52
 
53
+ def on_gesture(a)
54
+
55
+ puts 'inside on_gesture' if @debug
56
+ points = @a.map {|coords| coords.map {|x| x}.join(',') }.join(' ')
57
+ message points, 'motion'
58
+
59
+ end
60
+
48
61
  def on_key_press(key, keycode, modifier=[])
49
62
 
50
63
  puts 'inside on_key_press' if @debug
@@ -55,6 +68,30 @@ class XInputWrapperPlus < XInputWrapper
55
68
 
56
69
  end
57
70
 
71
+ def on_mousemove(x,y)
72
+
73
+ if @debug then
74
+ puts "on_mousemove() x: %s y: %s" % [x, y]
75
+ end
76
+
77
+ @timer.exit if @timer
78
+
79
+ @a << [x,y]
80
+
81
+
82
+ @timer = Thread.new do
83
+
84
+ sleep 0.25
85
+ puts 'inside timer' if @debug
86
+
87
+ on_gesture(@a) if @a.length > 6 and @a.length < 36
88
+ @a = []
89
+
90
+ end
91
+
92
+
93
+ end
94
+
58
95
  def on_super_key()
59
96
  message 'super key pressed'
60
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xinput_wrapperplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  SK2jOkRNlfF9rY8O76O35JOdWJTBmi/UxMmyH0ISaWkk7/5E8Q1ZElsb7WR/Nlpk
31
31
  DHs=
32
32
  -----END CERTIFICATE-----
33
- date: 2019-04-08 00:00:00.000000000 Z
33
+ date: 2019-05-08 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sps-pub
@@ -78,20 +78,20 @@ dependencies:
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 0.5.0
81
+ version: 0.6.0
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '0.5'
84
+ version: '0.6'
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.5.0
91
+ version: 0.6.0
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '0.5'
94
+ version: '0.6'
95
95
  description:
96
96
  email: james@jamesrobertson.eu
97
97
  executables: []
metadata.gz.sig CHANGED
Binary file