aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/MultiToggle
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2009-12-20 01:47:33 +0100
committerTomas Janousek <tomi@nomi.cz>2009-12-20 01:47:33 +0100
commit6cad66e67a68f2f57c0faf159a6e0412b67f55e0 (patch)
tree6d88c84bf5d4cf5d0ba70386c5bdc0c467f20536 /XMonad/Layout/MultiToggle
parent46993804cde7b3766fdc214144600310937a834c (diff)
downloadXMonadContrib-6cad66e67a68f2f57c0faf159a6e0412b67f55e0.tar.gz
XMonadContrib-6cad66e67a68f2f57c0faf159a6e0412b67f55e0.tar.xz
XMonadContrib-6cad66e67a68f2f57c0faf159a6e0412b67f55e0.zip
Fix MultiToggle crashes with decorated layouts
Ignore-this: 9208f5da9f0de95464ea62cb45e8f291 The problem was that certain layouts keep their "world" state in their value, which was thrown away and forgotten after ReleaseResources during toggle. In particular, decorated layouts store some X11 handles in them and allocate/deallocate it as appropriate. If any modification to their state is ignored, they may try to deallocate already deallocated memory, which results in a crash somewhere inside Xlib. This patch makes Transformers reversible so that nothing is ever ignored. As a side effect, layout transformers now do receive messages and messages for the base layout do not need the undo/reapply cycle -- we just pass messages to the current transformed layout and unapply the transformer when needed. (This, however, doesn't mean that the base layout is not asked to release resources on a transformer change -- we still need the transformer to release its resources and there's no way to do this without asking the base layout as well.) darcs-hash:20091220004733-c9ff5-34670f3db8ab715d8f334973d6ea2a3e7f3aed7a.gz
Diffstat (limited to 'XMonad/Layout/MultiToggle')
-rw-r--r--XMonad/Layout/MultiToggle/Instances.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/XMonad/Layout/MultiToggle/Instances.hs b/XMonad/Layout/MultiToggle/Instances.hs
index a409aa8..b8112f1 100644
--- a/XMonad/Layout/MultiToggle/Instances.hs
+++ b/XMonad/Layout/MultiToggle/Instances.hs
@@ -22,6 +22,7 @@ import XMonad.Layout.MultiToggle
import XMonad
import XMonad.Layout.NoBorders
+import XMonad.Layout.LayoutModifier
data StdTransformers = FULL -- ^ switch to Full layout
| NBFULL -- ^ switch to Full with no borders
@@ -31,8 +32,8 @@ data StdTransformers = FULL -- ^ switch to Full layout
deriving (Read, Show, Eq, Typeable)
instance Transformer StdTransformers Window where
- transform FULL _ k = k Full
- transform NBFULL _ k = k (noBorders Full)
- transform MIRROR x k = k (Mirror x)
- transform NOBORDERS x k = k (noBorders x)
- transform SMARTBORDERS x k = k (smartBorders x)
+ transform FULL x k = k Full (const x)
+ transform NBFULL x k = k (noBorders Full) (const x)
+ transform MIRROR x k = k (Mirror x) (\(Mirror x') -> x')
+ transform NOBORDERS x k = k (noBorders x) (\(ModifiedLayout _ x') -> x')
+ transform SMARTBORDERS x k = k (smartBorders x) (\(ModifiedLayout _ x') -> x')