xinput_wrapper 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/lib/xinput_wrapper.rb +44 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd5d3382f535c9b0cc5fd6def2b5b7bad34237f9eb2e602fef6c9ed21d59e107
|
4
|
+
data.tar.gz: fe866a13173f38b75027676b7583470c6d350527f1d1fd0eccd978d135fb8e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfc590d0eab22723afe694344a339cf24b7d08989f73c270a6106320806db47442c23607b3f8afd2b1fa63d8a7f79f48fde3c86c4fc6e32cbee60beb06dc4ff
|
7
|
+
data.tar.gz: 767186f2fde2a191249cea820d6eb6887d32691917b4fe48954be4f3034c56923b5a26a52fe64bb3cc79eeaf30bbeeeaa725d3b88e2bad65fbe57d290633ab22
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
��
|
2
|
-
��Zw�FA���p<w�n�ln�@Ŏ��:�tԉ��]�4��ge'?�J�N�Zŕ~����w;N�E�f{d��@���n�k�d����"���A�gZ �[�w0_�ŋ�?2ߟ��MeC�;x�s�|E&͚�����=�l������A�P�o�y�^@��>?�~z���_��iLG���F�Hk!҃�
|
3
|
-
1�S��_f�����#Ź�.sr��)e����̀V��ۛe�ϑ�sV{K����'Ǘ���G
|
1
|
+
ZR�ҘeT�jZE�(��k�y�&�&0K�j3�տ"��9��.ü�%��3u��m�ޘ0����{ҿ,#�ZC>R#�z!�I�5.� isL=ad�k����L��.N�6^�A��,���Ő�L��Y��� ����t����BW��jYۨ\~Mr�a/���?�����T�� n
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/xinput_wrapper.rb
CHANGED
@@ -98,7 +98,11 @@ class XInputWrapper
|
|
98
98
|
# type = 13 means a key has been pressed
|
99
99
|
if type == 13 then
|
100
100
|
|
101
|
-
raw_keys
|
101
|
+
if @modifiers.include? raw_keys.last or @modifiers.include? keycode then
|
102
|
+
raw_keys << keycode
|
103
|
+
end
|
104
|
+
|
105
|
+
next if @modifiers.include? keycode
|
102
106
|
|
103
107
|
puts 'raw_keys: ' + raw_keys.inspect if @debug
|
104
108
|
|
@@ -113,26 +117,55 @@ class XInputWrapper
|
|
113
117
|
puts ('key: ' + key.inspect).debug if @debug
|
114
118
|
|
115
119
|
if key then
|
120
|
+
|
116
121
|
puts key.to_s + ' key presssed' if @verbose
|
117
122
|
name = "on_#{key}_key".to_sym
|
118
123
|
method(name).call if self.protected_methods.include? name
|
119
124
|
|
120
|
-
keystring = ((key.length > 1 or key == ' ') ? "{%s}" % key : key)
|
121
|
-
|
125
|
+
keystring = ((key.length > 1 or key == ' ') ? "{%s}" % key : key)
|
126
|
+
block_given? ? yield(keystring) : on_key_press(keystring, keycode)
|
127
|
+
|
122
128
|
end
|
123
129
|
|
124
130
|
else
|
125
131
|
|
126
132
|
keys = raw_keys.map {|kc| @lookup[kc] }
|
127
133
|
puts ('keys: ' + keys.inspect) if @debug
|
128
|
-
|
134
|
+
|
135
|
+
if block_given? then
|
136
|
+
yield(format_key(keys.last, keys[0..-2]))
|
137
|
+
else
|
138
|
+
on_key_press(keys.last, keycode, keys[0..-2])
|
139
|
+
end
|
140
|
+
|
141
|
+
raw_keys = []
|
129
142
|
|
130
143
|
end
|
131
144
|
|
132
145
|
|
133
146
|
|
147
|
+
# a key has been released
|
134
148
|
elsif type == 14
|
135
149
|
|
150
|
+
# here we are only looking to detect a
|
151
|
+
# single modifier key press and release
|
152
|
+
|
153
|
+
key = @lookup[keycode]
|
154
|
+
|
155
|
+
unless raw_keys.empty? then
|
156
|
+
puts key.to_s + ' key presssed'
|
157
|
+
|
158
|
+
if block_given? then
|
159
|
+
|
160
|
+
yield(format_key(key.to_s))
|
161
|
+
|
162
|
+
else
|
163
|
+
name = "on_#{key}_key".to_sym
|
164
|
+
method(name).call if self.protected_methods.include? name
|
165
|
+
on_key_press(key, keycode)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
136
169
|
index = raw_keys.rindex(keycode)
|
137
170
|
raw_keys.delete_at index if index
|
138
171
|
|
@@ -173,6 +206,13 @@ class XInputWrapper
|
|
173
206
|
|
174
207
|
private
|
175
208
|
|
209
|
+
def format_key(key, modifier=[])
|
210
|
+
|
211
|
+
modifier.any? ? "{%s}" % (modifier + [key.to_s]).join('+') \
|
212
|
+
: key.to_s
|
213
|
+
|
214
|
+
end
|
215
|
+
|
176
216
|
def on_leftcontrol_key() on_control_key() end
|
177
217
|
def on_rightcontrol_key() on_control_key() end
|
178
218
|
def on_left_alt_key() on_alt_key() end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xinput_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
rryowfoo6nLmegcIZjm+zz/gkT/0udwMMVm2gwo0bIRQuQOLmd7IUNzYQKZQOGMA
|
36
36
|
g4ETbI8IEC3VCaoECdunsS3t
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2019-04-
|
38
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: c32
|
metadata.gz.sig
CHANGED
Binary file
|