module SplitF where import AllFudgets import HandleF(vHandleF,hHandleF) import LinearSplitP(linearSplitP) hSplitF :: F a a -> F c b -> F (Either a c) (Either a b) hSplitF = Double -> F a a -> F c b -> F (Either a c) (Either a b) forall a a c b. Double -> F a a -> F c b -> F (Either a c) (Either a b) hSplitF' Double aCenter vSplitF :: F a a -> F c b -> F (Either a c) (Either a b) vSplitF = Double -> F a a -> F c b -> F (Either a c) (Either a b) forall a a c b. Double -> F a a -> F c b -> F (Either a c) (Either a b) vSplitF' Double aCenter hSplitF' :: Double -> F a a -> F c b -> F (Either a c) (Either a b) hSplitF' = LayoutDir -> Double -> F a a -> F c b -> F (Either a c) (Either a b) forall a a c b. LayoutDir -> Double -> F a a -> F c b -> F (Either a c) (Either a b) splitF' LayoutDir Horizontal vSplitF' :: Double -> F a a -> F c b -> F (Either a c) (Either a b) vSplitF' = LayoutDir -> Double -> F a a -> F c b -> F (Either a c) (Either a b) forall a a c b. LayoutDir -> Double -> F a a -> F c b -> F (Either a c) (Either a b) splitF' LayoutDir Vertical splitF' :: LayoutDir -> Double -> F a a -> F c b -> F (Either a c) (Either a b) splitF' LayoutDir dir Double alignment F a a fud1 F c b fud2 = F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b)) -> F (Either a c) (Either a b) forall a b c d. F (Either (Either a b) c) (Either (Either c d) a) -> F b d loopCompThroughRightF (F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b)) -> F (Either a c) (Either a b)) -> F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b)) -> F (Either a c) (Either a b) forall a b. (a -> b) -> a -> b $ [FRequest] -> K (Either (Either (Either a Any) b) (Either a c)) (Either (Either (Either a Point) c) (Either a b)) -> F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b)) forall a b c d. [FRequest] -> K a b -> F c d -> F (Either a c) (Either b d) groupF [FRequest] startcmds K (Either (Either (Either a Any) b) (Either a c)) (Either (Either (Either a Point) c) (Either a b)) forall a p b a b. K (Either (Either (Either a p) b) (Either a b)) (Either (Either (Either a Point) b) (Either a b)) sizeK (F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b))) -> F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either (Either (Either a Any) b) (Either a c)) (Either (Either a Point) c)) (Either (Either (Either (Either a Point) c) (Either a b)) (Either (Either a Any) b)) forall a b. (a -> b) -> a -> b $ Placer -> F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either a Point) c) (Either (Either a Any) b) forall a b. Placer -> F a b -> F a b placerF (LayoutDir -> Int -> Placer linearSplitP LayoutDir dir Int forall a. Num a => a defaultSep) (F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either a Point) c) (Either (Either a Any) b)) -> F (Either (Either a Point) c) (Either (Either a Any) b) -> F (Either (Either a Point) c) (Either (Either a Any) b) forall a b. (a -> b) -> a -> b $ F a a fud1F a a -> F Point Any -> F (Either a Point) (Either a Any) forall a b c d. F a b -> F c d -> F (Either a c) (Either b d) >+<F Point Any forall d. F Point d hFF (Either a Point) (Either a Any) -> F c b -> F (Either (Either a Point) c) (Either (Either a Any) b) forall a b c d. F a b -> F c d -> F (Either a c) (Either b d) >+<F c b fud2 where startcmds :: [FRequest] startcmds = [XCommand -> FRequest XCmd (XCommand -> FRequest) -> XCommand -> FRequest forall a b. (a -> b) -> a -> b $ [WindowAttributes] -> XCommand ChangeWindowAttributes [PixmapId -> WindowAttributes CWBackPixmap PixmapId parentRelative]] hF :: F Point d hF = LayoutDir -> (Double -> F Point d) -> (Double -> F Point d) -> Double -> F Point d forall p. LayoutDir -> p -> p -> p colinear LayoutDir dir Double -> F Point d forall d. Double -> F Point d hHandleF Double -> F Point d forall d. Double -> F Point d vHandleF Double alignment toLoop :: a -> Maybe (Message a (Either a b)) toLoop = Message a (Either a b) -> Maybe (Message a (Either a b)) forall a. a -> Maybe a Just (Message a (Either a b) -> Maybe (Message a (Either a b))) -> (a -> Message a (Either a b)) -> a -> Maybe (Message a (Either a b)) forall b c a. (b -> c) -> (a -> b) -> a -> c . Either a b -> Message a (Either a b) forall a b. b -> Message a b High (Either a b -> Message a (Either a b)) -> (a -> Either a b) -> a -> Message a (Either a b) forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> Either a b forall a b. a -> Either a b Left out :: b -> Maybe (Message a (Either a b)) out = Message a (Either a b) -> Maybe (Message a (Either a b)) forall a. a -> Maybe a Just (Message a (Either a b) -> Maybe (Message a (Either a b))) -> (b -> Message a (Either a b)) -> b -> Maybe (Message a (Either a b)) forall b c a. (b -> c) -> (a -> b) -> a -> c . Either a b -> Message a (Either a b) forall a b. b -> Message a b High (Either a b -> Message a (Either a b)) -> (b -> Either a b) -> b -> Message a (Either a b) forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> Either a b forall a b. b -> Either a b Right toHandle :: b -> Maybe (Message a (Either (Either (Either a b) b) b)) toHandle = Either (Either a b) b -> Maybe (Message a (Either (Either (Either a b) b) b)) forall a a b. a -> Maybe (Message a (Either a b)) toLoop (Either (Either a b) b -> Maybe (Message a (Either (Either (Either a b) b) b))) -> (b -> Either (Either a b) b) -> b -> Maybe (Message a (Either (Either (Either a b) b) b)) forall b c a. (b -> c) -> (a -> b) -> a -> c . Either a b -> Either (Either a b) b forall a b. a -> Either a b Left (Either a b -> Either (Either a b) b) -> (b -> Either a b) -> b -> Either (Either a b) b forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> Either a b forall a b. b -> Either a b Right toFud1 :: a -> Maybe (Message a (Either (Either (Either a b) b) b)) toFud1 = Either (Either a b) b -> Maybe (Message a (Either (Either (Either a b) b) b)) forall a a b. a -> Maybe (Message a (Either a b)) toLoop (Either (Either a b) b -> Maybe (Message a (Either (Either (Either a b) b) b))) -> (a -> Either (Either a b) b) -> a -> Maybe (Message a (Either (Either (Either a b) b) b)) forall b c a. (b -> c) -> (a -> b) -> a -> c . Either a b -> Either (Either a b) b forall a b. a -> Either a b Left (Either a b -> Either (Either a b) b) -> (a -> Either a b) -> a -> Either (Either a b) b forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> Either a b forall a b. a -> Either a b Left toFud2 :: b -> Maybe (Message a (Either (Either a b) b)) toFud2 = Either a b -> Maybe (Message a (Either (Either a b) b)) forall a a b. a -> Maybe (Message a (Either a b)) toLoop (Either a b -> Maybe (Message a (Either (Either a b) b))) -> (b -> Either a b) -> b -> Maybe (Message a (Either (Either a b) b)) forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> Either a b forall a b. b -> Either a b Right sizeK :: K (Either (Either (Either a p) b) (Either a b)) (Either (Either (Either a Point) b) (Either a b)) sizeK = KSP (Either (Either (Either a p) b) (Either a b)) (Either (Either (Either a Point) b) (Either a b)) -> K (Either (Either (Either a p) b) (Either a b)) (Either (Either (Either a Point) b) (Either a b)) forall hi ho. KSP hi ho -> K hi ho K ((Message FResponse (Either (Either (Either a p) b) (Either a b)) -> Maybe (Message FRequest (Either (Either (Either a Point) b) (Either a b)))) -> KSP (Either (Either (Either a p) b) (Either a b)) (Either (Either (Either a Point) b) (Either a b)) forall t b. (t -> Maybe b) -> SP t b mapFilterSP Message FResponse (Either (Either (Either a p) b) (Either a b)) -> Maybe (Message FRequest (Either (Either (Either a Point) b) (Either a b))) forall a p b a b a. Message FResponse (Either (Either (Either a p) b) (Either a b)) -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b))) route) route :: Message FResponse (Either (Either (Either a p) b) (Either a b)) -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b))) route = (FResponse -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b)))) -> (Either (Either (Either a p) b) (Either a b) -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b)))) -> Message FResponse (Either (Either (Either a p) b) (Either a b)) -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b))) forall t1 p t2. (t1 -> p) -> (t2 -> p) -> Message t1 t2 -> p message FResponse -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b))) forall a a b b. FResponse -> Maybe (Message a (Either (Either (Either a Point) b) b)) low Either (Either (Either a p) b) (Either a b) -> Maybe (Message a (Either (Either (Either a Point) b) (Either a b))) forall a p b a b a b. Either (Either (Either a p) b) (Either a b) -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) high low :: FResponse -> Maybe (Message a (Either (Either (Either a Point) b) b)) low (LEvt (LayoutSize Point size)) = Point -> Maybe (Message a (Either (Either (Either a Point) b) b)) forall b a a b b. b -> Maybe (Message a (Either (Either (Either a b) b) b)) toHandle Point size low FResponse event = FResponse -> Maybe (Message a (Either (Either (Either a Point) b) b)) forall p a. p -> Maybe a ignore FResponse event high :: Either (Either (Either a p) b) (Either a b) -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) high = (Either (Either a p) b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b)))) -> (Either a b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b)))) -> Either (Either (Either a p) b) (Either a b) -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either Either (Either a p) b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) forall a p b a a. Either (Either a p) b -> Maybe (Message a (Either a (Either a b))) fromLoop ((a -> Maybe (Message a (Either (Either (Either a b) b) (Either a b)))) -> (b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b)))) -> Either a b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either a -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) forall a a b b b. a -> Maybe (Message a (Either (Either (Either a b) b) b)) toFud1 b -> Maybe (Message a (Either (Either (Either a b) b) (Either a b))) forall b a a b. b -> Maybe (Message a (Either (Either a b) b)) toFud2) fromLoop :: Either (Either a p) b -> Maybe (Message a (Either a (Either a b))) fromLoop = (Either a p -> Maybe (Message a (Either a (Either a b)))) -> (b -> Maybe (Message a (Either a (Either a b)))) -> Either (Either a p) b -> Maybe (Message a (Either a (Either a b))) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either ((a -> Maybe (Message a (Either a (Either a b)))) -> (p -> Maybe (Message a (Either a (Either a b)))) -> Either a p -> Maybe (Message a (Either a (Either a b))) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either a -> Maybe (Message a (Either a (Either a b))) forall a a a b. a -> Maybe (Message a (Either a (Either a b))) fromFud1 p -> Maybe (Message a (Either a (Either a b))) forall p a. p -> Maybe a ignore) b -> Maybe (Message a (Either a (Either a b))) forall b a a a. b -> Maybe (Message a (Either a (Either a b))) fromFud2 fromFud1 :: a -> Maybe (Message a (Either a (Either a b))) fromFud1 = Either a b -> Maybe (Message a (Either a (Either a b))) forall b a a. b -> Maybe (Message a (Either a b)) out (Either a b -> Maybe (Message a (Either a (Either a b)))) -> (a -> Either a b) -> a -> Maybe (Message a (Either a (Either a b))) forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> Either a b forall a b. a -> Either a b Left fromFud2 :: b -> Maybe (Message a (Either a (Either a b))) fromFud2 = Either a b -> Maybe (Message a (Either a (Either a b))) forall b a a. b -> Maybe (Message a (Either a b)) out (Either a b -> Maybe (Message a (Either a (Either a b)))) -> (b -> Either a b) -> b -> Maybe (Message a (Either a (Either a b))) forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> Either a b forall a b. b -> Either a b Right ignore :: p -> Maybe a ignore p _ = Maybe a forall a. Maybe a Nothing