[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kicker/applets/minipager
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-04-15 10:24:10
Message-ID: 20040415102410.8F79A9A45 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

* Take aspect ratio into account when deciding whether to show the virtual 
desktops in one or two rows. In vertical mode the panel will now switch
sooner to one row mode. (BR57775)
* Fixed bug where one part tested for < 32 and another for <= 32 which could
result in the pager being only half as wide as it should be ("sqeeuzed")
Based on a patch by Luciano Montanaro
CCMAIL: 57775-done@bugs.kde.org


  M +10 -4     pagerapplet.cpp   1.101


--- kdebase/kicker/applets/minipager/pagerapplet.cpp  #1.100:1.101
@@ -60,4 +60,8 @@ const int knDesktopPreviewSize = 12;
 const int knBtnSpacing = 1;
 
+// The previews tend to have a 4/3 aspect ratio
+static const int smallHeight = 32;
+static const int smallWidth = 42;
+
 extern "C"
 {
@@ -358,5 +362,7 @@ int KMiniPager::widthForHeight(int h) co
     int deskHalf = (deskNum+1)/2;
 
-    int bw = h < 32 ? h : (h/2);
+    bool small = h <= smallHeight;
+
+    int bw = small ? h : (h/2);
     if ( desktopPreview() )
         bw = (int) ( bw * (double) QApplication::desktop()->width() / \
QApplication::desktop()->height() ); @@ -369,5 +375,5 @@ int \
KMiniPager::widthForHeight(int h) co  }
 
-    int nWd = ( h <= 32 ? deskNum * bw : deskHalf * bw);
+    int nWd = ( small ? deskNum * bw : deskHalf * bw);
 
     return nWd;
@@ -379,5 +385,5 @@ int KMiniPager::heightForWidth(int w) co
     int deskHalf = (deskNum+1)/2;
 
-    bool small = w <= 32;
+    bool small = w <= smallWidth;
 
     int bh = small ? w : (w/2);
@@ -423,5 +429,5 @@ void KMiniPager::resizeEvent(QResizeEven
     int deskHalf = (deskNum+1)/2;
     bool horiz = orientation() == Horizontal;
-    bool small = (horiz && height() <=32) || (!horiz && width() <=32);
+    bool small = horiz ? (height() <= smallHeight) : (width() <= smallWidth);
 
     if ( !horiz && mode() == LabelName )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic