From bb316caf3b404ba1c8a486bbf09a70293a519264 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 17 Jul 2011 22:09:19 +0200 Subject: Correctly align non-square icons --- lib/Phi/Widgets/Taskbar.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/Phi/Widgets/Taskbar.hs b/lib/Phi/Widgets/Taskbar.hs index 23572bd..ab67846 100644 --- a/lib/Phi/Widgets/Taskbar.hs +++ b/lib/Phi/Widgets/Taskbar.hs @@ -237,6 +237,10 @@ instance WidgetClass Taskbar where let scalef = (fromIntegral h')/(fromIntegral $ max imageW imageH) + case True of + _ | imageH < imageW -> translate 0 (fromIntegral (imageW-imageH)*scalef/2) + | otherwise -> translate (fromIntegral (imageH-imageW)*scalef/2) 0 + renderWithSimilarSurface ContentColorAlpha h' h' $ \surface -> do renderWith surface $ do downscaled scalef icon -- cgit v1.2.3