uh 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uh/version.rb +1 -1
- data/lib/uh/wm/action_handler.rb +19 -8
- data/lib/uh/wm/workers/multiplexing_worker.rb +9 -5
- data/lib/uh/wm.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0efbb3383d315de3572ecf957001d7dfa7324c03
|
4
|
+
data.tar.gz: ceaee1387cb5664f702c675a8009986a88e54eb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f92d07c0f1356951d45e44544ca4b113f3f0e4efa5f8db2728b86d4db9f197e868786cd25a6b0eb027fbb1dbc9458dd2fbe372bf8d4a2820ffcaea3bf1d30b
|
7
|
+
data.tar.gz: 9d09c9409e9c83a65ad950c151fd0ee832effd5537a0c47506381de23f5ff9c1f4727d4a3e742c22812a7d4062ef125a67060baa7b06949a34452763d8249d7e
|
data/lib/uh/version.rb
CHANGED
data/lib/uh/wm/action_handler.rb
CHANGED
@@ -1,44 +1,55 @@
|
|
1
1
|
module Uh
|
2
2
|
class WM
|
3
3
|
class ActionHandler
|
4
|
+
extend Forwardable
|
5
|
+
def_delegators :@wm, :log, :log_error
|
6
|
+
|
7
|
+
attr_reader :layout
|
8
|
+
|
4
9
|
def initialize(wm, manager, layout)
|
5
10
|
@wm, @manager, @layout = wm, manager, layout
|
6
11
|
end
|
7
12
|
|
8
13
|
def call(action)
|
9
14
|
instance_exec &action
|
15
|
+
rescue LocalJumpError => e
|
16
|
+
log_error "Action: #{e}"
|
10
17
|
end
|
11
18
|
|
12
19
|
def quit
|
13
|
-
|
20
|
+
log 'Exiting...'
|
14
21
|
@wm.request_quit!
|
15
22
|
end
|
16
23
|
|
17
24
|
def execute(command)
|
18
|
-
|
25
|
+
log "Spawn `#{command}`"
|
19
26
|
pid = spawn command, pgroup: true
|
20
27
|
Process.detach pid
|
21
28
|
rescue Errno::ENOENT => e
|
22
|
-
|
29
|
+
log_error "Spawn: #{e}"
|
23
30
|
end
|
24
31
|
|
25
32
|
def log_layout
|
26
|
-
|
33
|
+
log "Layout:\n#{@layout.to_s.lines.map { |e| " #{e}" }.join.chomp}"
|
27
34
|
end
|
28
35
|
|
29
36
|
def log_clients
|
30
|
-
|
37
|
+
log "Clients:\n#{@manager.to_s.lines.map { |e| " #{e}" }.join.chomp}"
|
31
38
|
end
|
32
39
|
|
33
40
|
def log_separator
|
34
|
-
|
41
|
+
log '- ' * 24
|
35
42
|
end
|
36
43
|
|
37
44
|
def method_missing(m, *args, &block)
|
38
45
|
if respond_to? m
|
39
46
|
meth = layout_method m
|
40
|
-
|
41
|
-
|
47
|
+
log "#{@layout.class.name}##{meth} #{args.inspect}"
|
48
|
+
begin
|
49
|
+
@layout.send(meth, *args)
|
50
|
+
rescue NoMethodError
|
51
|
+
log_error "Layout does not implement `#{meth}'"
|
52
|
+
end
|
42
53
|
else
|
43
54
|
super
|
44
55
|
end
|
@@ -4,23 +4,27 @@ module Uh
|
|
4
4
|
class MultiplexingWorker < BaseWorker
|
5
5
|
DEFAULT_TIMEOUT = 4
|
6
6
|
|
7
|
-
def configure(timeout: DEFAULT_TIMEOUT)
|
8
|
-
@timeout
|
7
|
+
def configure(timeout: DEFAULT_TIMEOUT, on_timeout: nil)
|
8
|
+
@timeout = timeout
|
9
|
+
@on_timeout = on_timeout
|
9
10
|
end
|
10
11
|
|
11
12
|
def setup
|
12
13
|
@display_io = IO.new(@display.fileno)
|
13
|
-
@display.flush
|
14
14
|
self
|
15
15
|
end
|
16
16
|
|
17
17
|
def each_event
|
18
18
|
loop do
|
19
|
+
@display.flush
|
19
20
|
@logger.debug "select [#{@display_io.fileno}], _, _, #{@timeout}"
|
20
21
|
rs, _ = IO.select [@display_io], [], [], @timeout
|
21
22
|
@logger.debug " => #{rs.inspect}"
|
22
|
-
|
23
|
-
|
23
|
+
if rs.nil? || rs.empty?
|
24
|
+
@on_timeout.call if @on_timeout
|
25
|
+
else
|
26
|
+
yield @display.next_event while @display.pending?
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/uh/wm.rb
CHANGED
@@ -149,7 +149,7 @@ module Uh
|
|
149
149
|
|
150
150
|
def log_event(event)
|
151
151
|
complement = case event.type
|
152
|
-
when :destroy_notify, :expose, :
|
152
|
+
when :destroy_notify, :expose, :map_request, :property_notify
|
153
153
|
"window: #{event.window}"
|
154
154
|
when :configure_request
|
155
155
|
'%s, above: #%d, detail: #%d, value_mask: #%d' % [
|
@@ -158,6 +158,8 @@ module Uh
|
|
158
158
|
event.detail,
|
159
159
|
event.value_mask
|
160
160
|
]
|
161
|
+
when :key_press
|
162
|
+
"window: #{event.window}, key: #{event.key}, mask: #{event.modifier_mask}"
|
161
163
|
when :unmap_notify
|
162
164
|
"window: #{event.window}, event_window: #{event.event_window}"
|
163
165
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|