Make the manager listen for changes on new window

When mapping a new window, listen for property notify events.
This commit is contained in:
Thibault Jouan 2015-04-22 03:23:22 +00:00
parent 03a6c323ac
commit 933bcdfcd8
2 changed files with 10 additions and 0 deletions

View File

@ -59,6 +59,7 @@ module Uh
return if window.override_redirect? || client_for(window) return if window.override_redirect? || client_for(window)
@clients << client = Client.new(window) @clients << client = Client.new(window)
@events.emit :manage, args: client @events.emit :manage, args: client
@display.listen_events window, Events::PROPERTY_CHANGE_MASK
end end
def unmap window def unmap window

View File

@ -133,6 +133,8 @@ module Uh
end end
describe '#map' do describe '#map' do
let(:display) { instance_spy Display }
it 'registers a new client wrapping the given window' do it 'registers a new client wrapping the given window' do
manager.map window manager.map window
expect(manager.clients[0]) expect(manager.clients[0])
@ -159,6 +161,13 @@ module Uh
end end
manager.map window manager.map window
end end
it 'listens for property notify events on given window' do
expect(display)
.to receive(:listen_events)
.with window, Events::PROPERTY_CHANGE_MASK
manager.map window
end
end end
describe '#unmap' do describe '#unmap' do