From 933bcdfcd829787228ae3a4661de41d8e1d3c4be Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 22 Apr 2015 03:23:22 +0000 Subject: [PATCH] Make the manager listen for changes on new window When mapping a new window, listen for property notify events. --- lib/uh/wm/manager.rb | 1 + spec/uh/wm/manager_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/uh/wm/manager.rb b/lib/uh/wm/manager.rb index ab830cd..f710f2a 100644 --- a/lib/uh/wm/manager.rb +++ b/lib/uh/wm/manager.rb @@ -59,6 +59,7 @@ module Uh return if window.override_redirect? || client_for(window) @clients << client = Client.new(window) @events.emit :manage, args: client + @display.listen_events window, Events::PROPERTY_CHANGE_MASK end def unmap window diff --git a/spec/uh/wm/manager_spec.rb b/spec/uh/wm/manager_spec.rb index 2b4db09..0098f3b 100644 --- a/spec/uh/wm/manager_spec.rb +++ b/spec/uh/wm/manager_spec.rb @@ -133,6 +133,8 @@ module Uh end describe '#map' do + let(:display) { instance_spy Display } + it 'registers a new client wrapping the given window' do manager.map window expect(manager.clients[0]) @@ -159,6 +161,13 @@ module Uh end manager.map window 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 describe '#unmap' do