clean up destroyed windows from urgents list

This commit is contained in:
Devin Mullins 2007-11-03 15:03:58 +00:00
parent f2eec4b48b
commit 3fb0cf1391

View File

@ -35,7 +35,7 @@ import Control.Monad (when)
import Control.Monad.State (gets) import Control.Monad.State (gets)
import Data.Bits (testBit, clearBit) import Data.Bits (testBit, clearBit)
import Data.IORef import Data.IORef
import Data.List ((\\)) import Data.List ((\\), delete)
import Data.Maybe (listToMaybe) import Data.Maybe (listToMaybe)
import qualified Data.Set as S import qualified Data.Set as S
import Graphics.X11.Xlib import Graphics.X11.Xlib
@ -97,7 +97,7 @@ data WithUrgencyHook a = WithUrgencyHook deriving (Read, Show)
instance LayoutModifier WithUrgencyHook Window where instance LayoutModifier WithUrgencyHook Window where
handleMess _ mess handleMess _ mess
| Just (PropertyEvent { ev_event_type = t, ev_atom = a, ev_window = w }) <- fromMessage mess = do | Just PropertyEvent { ev_event_type = t, ev_atom = a, ev_window = w } <- fromMessage mess = do
when (t == propertyNotify && a == wM_HINTS) $ withDisplay $ \dpy -> do when (t == propertyNotify && a == wM_HINTS) $ withDisplay $ \dpy -> do
wmh@WMHints { wmh_flags = flags } <- io $ getWMHints dpy w wmh@WMHints { wmh_flags = flags } <- io $ getWMHints dpy w
when (testBit flags urgencyHintBit) $ do when (testBit flags urgencyHintBit) $ do
@ -115,6 +115,9 @@ instance LayoutModifier WithUrgencyHook Window where
-- effect of ignoring *all* urgency-clearing messages, some of which might -- effect of ignoring *all* urgency-clearing messages, some of which might
-- be legitimate. Let's wait for bug reports on that, though. -- be legitimate. Let's wait for bug reports on that, though.
return Nothing return Nothing
| Just DestroyWindowEvent {ev_window = w} <- fromMessage mess = do
adjustUrgents (delete w)
return Nothing
| otherwise = | otherwise =
return Nothing return Nothing