Merge branch 'window-expose-handling'

Handle X expose events, generate an :expose internal event, and
support #expose layout protocol message.
This commit is contained in:
Thibault Jouan 2015-04-22 16:34:52 +00:00
commit 4e4b15871e
5 changed files with 25 additions and 1 deletions

View File

@ -6,6 +6,9 @@ Feature: layout protocol
class Layout class Layout
def register display def register display
puts display puts display
display.create_subwindow(Uh::Geo.new(0, 0, 640, 16)).tap do |o|
o.show
end
end end
def << client def << client
@ -20,6 +23,10 @@ Feature: layout protocol
def update client def update client
puts "testing_#update_#{client.name}" puts "testing_#update_#{client.name}"
end end
def expose window
puts "testing_#expose_#{window.id}"
end
end end
""" """
@ -43,3 +50,7 @@ Feature: layout protocol
And a window is mapped And a window is mapped
When the window name changes to "testing_new_name" When the window name changes to "testing_new_name"
Then the output must contain "testing_#update_testing_new_name" Then the output must contain "testing_#update_testing_new_name"
Scenario: tells the layout about an exposed window with #expose message
Given I run uhwm with options -r./layout -l Layout
Then the output must match /testing_#expose_\d+/

View File

@ -0,0 +1,5 @@
Feature: expose events handling
Scenario: logs when an expose event is handled
Given uhwm is running
Then the output must match /expos.+window.+\d+/i

View File

@ -120,6 +120,10 @@ module Uh
destroy event.window destroy event.window
end end
def handle_expose event
@events.emit :expose, args: event.window
end
def handle_map_request event def handle_map_request event
map event.window map event.window
end end

View File

@ -123,6 +123,10 @@ module Uh
log "Updating client #{client}" log "Updating client #{client}"
layout.update client layout.update client
end end
@events.on :expose do |window|
log "Exposing window: #{window}"
layout.expose window
end
end end
def register_keybinds_hooks def register_keybinds_hooks

View File

@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.executables = s.files.grep(/\Abin\//) { |f| File.basename(f) } s.executables = s.files.grep(/\Abin\//) { |f| File.basename(f) }
s.add_dependency 'uh', '2.0.0.pre2' s.add_dependency 'uh', '2.0.0.pre2'
s.add_dependency 'uh-layout', '~> 0.2.2' s.add_dependency 'uh-layout', '~> 0.2.3'
s.add_development_dependency 'aruba', '~> 0.6' s.add_development_dependency 'aruba', '~> 0.6'
s.add_development_dependency 'cucumber', '~> 2.0' s.add_development_dependency 'cucumber', '~> 2.0'