From a00440a6bf516b55929795dc69a10352bb0dbb6a Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Sun, 21 Jun 2009 21:46:52 +0200 Subject: Provide means to find original window by its decoration. Ignore-this: fad8cb7fb4c2785b14b97d48f19604cc In order to enable user to write custom `decorationMouseFocusHook' and `decorationMouseDragHook' hooks we need to provide him with means to lookup original window by its decoration. Module Decoration has internal function `lookFor' for exactly the same purpose. I exported it under a slightly different name and without exposing internals of DecorationState. darcs-hash:20090621194652-5701e-3fe157f99b1ea31377b0d77db4fd3a0314b553fd.gz --- XMonad/Layout/Decoration.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'XMonad/Layout/Decoration.hs') diff --git a/XMonad/Layout/Decoration.hs b/XMonad/Layout/Decoration.hs index 776108f..5c94f12 100644 --- a/XMonad/Layout/Decoration.hs +++ b/XMonad/Layout/Decoration.hs @@ -26,6 +26,7 @@ module XMonad.Layout.Decoration , Shrinker (..), DefaultShrinker , shrinkText, CustomShrink ( CustomShrink ), shrinkWhile , isInStack, isVisible, isInvisible, isWithin, fi + , findWindowByDecoration , module XMonad.Layout.LayoutModifier ) where @@ -307,6 +308,9 @@ lookFor w ((wr,(Just dw,dr)):dwrs) | w == dw = Just (wr,(dw,dr)) lookFor w ((_, (Nothing, _)):dwrs) = lookFor w dwrs lookFor _ [] = Nothing +findWindowByDecoration :: Window -> DecorationState -> Maybe (OrigWin,(Window,Maybe Rectangle)) +findWindowByDecoration w ds = lookFor w (decos ds) + -- | Initialize the 'DecorationState' by initializing the font -- structure and by creating the needed decorations. initState :: DecorationStyle ds Window => Theme -> ds Window -> Rectangle -- cgit v1.2.3