diff --git a/features/layout/protocol.feature b/features/layout/protocol.feature index 14d1296..aa4dfe1 100644 --- a/features/layout/protocol.feature +++ b/features/layout/protocol.feature @@ -6,6 +6,9 @@ Feature: layout protocol class Layout def register display puts display + display.create_subwindow(Uh::Geo.new(0, 0, 640, 16)).tap do |o| + o.show + end end def << client @@ -20,6 +23,10 @@ Feature: layout protocol def update client puts "testing_#update_#{client.name}" end + + def expose window + puts "testing_#expose_#{window.id}" + end end """ @@ -43,3 +50,7 @@ Feature: layout protocol And a window is mapped When the window name changes to "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+/ diff --git a/features/manager/expose.feature b/features/manager/expose.feature new file mode 100644 index 0000000..09ec916 --- /dev/null +++ b/features/manager/expose.feature @@ -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 diff --git a/lib/uh/wm/manager.rb b/lib/uh/wm/manager.rb index a3fc312..6b58034 100644 --- a/lib/uh/wm/manager.rb +++ b/lib/uh/wm/manager.rb @@ -120,6 +120,10 @@ module Uh destroy event.window end + def handle_expose event + @events.emit :expose, args: event.window + end + def handle_map_request event map event.window end diff --git a/lib/uh/wm/runner.rb b/lib/uh/wm/runner.rb index beb6ffc..ba93001 100644 --- a/lib/uh/wm/runner.rb +++ b/lib/uh/wm/runner.rb @@ -123,6 +123,10 @@ module Uh log "Updating client #{client}" layout.update client end + @events.on :expose do |window| + log "Exposing window: #{window}" + layout.expose window + end end def register_keybinds_hooks diff --git a/uh-wm.gemspec b/uh-wm.gemspec index 8fcfb9b..1a23946 100644 --- a/uh-wm.gemspec +++ b/uh-wm.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.executables = s.files.grep(/\Abin\//) { |f| File.basename(f) } 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 'cucumber', '~> 2.0'