From f93ee863768757ee4f37c4529c31cffde1ca71b9 Mon Sep 17 00:00:00 2001
From: Yoann Laissus <yoann.laissus@gmail.com>
Date: Sun, 5 Aug 2012 18:26:36 +0200
Subject: Center the tab preview popup if the tab width is bigger or smaller

---
 src/tabbar.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index e3b44d53..ee210770 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -201,9 +201,13 @@ void TabBar::showTabPreview()
 
     m_previewPopup = new TabPreviewPopup(indexedTab , this);
 
-    int w = (mv->sizeHint().width() / baseWidthDivisor);
+    int w = tabSizeHint(m_currentTabPreviewIndex).width();
     int tabBarWidth = mv->size().width();
     int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w) / 2;
+    int popupWidth = m_previewPopup.data()->thumbnailSize().width();
+
+    // Center the popup if the tab width is bigger or smaller
+    leftIndex += (w - popupWidth) / 2;
 
     if (leftIndex < 0)
     {
-- 
cgit v1.2.1