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

List:       kde-commits
Subject:    kdebase/kicker/applets/minipager
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2004-12-03 10:13:41
Message-ID: 20041203101341.9E54C1B909 () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

take into consideration the 1px spacing


  M +15 -16    pagerapplet.cpp   1.107


--- kdebase/kicker/applets/minipager/pagerapplet.cpp  #1.106:1.107
@@ -385,13 +385,13 @@ int KMiniPager::widthForHeight(int h) co
 {
     int deskNum = kwin_module->numberOfDesktops();
-    int rowNum = deskNum; // default is the number of desktops...
-    if( m_rows == 0 ) {
-        if( h<=32 || deskNum<=1 )
+    int rowNum = m_rows;
+    if( m_rows == 0 )
+    {
+        if (h <= 32 || deskNum <= 1)
             rowNum = 1;
         else
             rowNum = 2;
-    } else {
-        rowNum = m_rows;
     }
+
     int deskCols = deskNum/rowNum;
     if(deskNum == 0 || deskNum % rowNum != 0)
@@ -400,10 +400,10 @@ int KMiniPager::widthForHeight(int h) co
     int nWd;
     if( mode() != LabelName ) {
-        int bw = (h/rowNum);
+        int bw = (h/rowNum) + 1;
         if ( desktopPreview() )
             bw = (int) ( bw * (double) QApplication::desktop()->width() / \
QApplication::desktop()->height() );  nWd = ( deskCols * bw);
     } else {
-        int bw = (h/rowNum);
+        int bw = (h/rowNum) + 1;
         for (int i = 1; i <= deskNum; i++ ) {
             int sw = fontMetrics().width( kwin_module->desktopName( i ) ) + 16;
@@ -420,5 +420,5 @@ int KMiniPager::heightForWidth(int w) co
 {
     int deskNum = kwin_module->numberOfDesktops();
-    int rowNum = deskNum; // actually these are columns now... oh well.
+    int rowNum = m_rows; // actually these are columns now... oh well.
     if( m_rows == 0 ) {
         if( w<=48 || deskNum<=1 )
@@ -426,7 +426,6 @@ int KMiniPager::heightForWidth(int w) co
         else
             rowNum = 2;
-    } else {
-        rowNum = m_rows;
     }
+
     int deskCols = deskNum/rowNum;
     if(deskNum == 0 || deskNum % rowNum != 0)
@@ -433,5 +432,5 @@ int KMiniPager::heightForWidth(int w) co
         deskCols += 1;
 
-    int bh = (w/rowNum);
+    int bh = (w/rowNum) + 1;
     if ( desktopPreview() )
         bh = (int) ( bh *  (double) QApplication::desktop()->height() / \
QApplication::desktop()->width() ); @@ -481,13 +480,13 @@ void \
KMiniPager::resizeEvent(QResizeEven  
     int deskNum = btnList.count();
-    int rowNum = deskNum;
-    if( m_rows == 0 ) {
-        if( ((horiz && height()<=32)||(!horiz && width()<=48)) || deskNum <= 1 )
+    int rowNum = m_rows;
+    if( m_rows == 0 )
+    {
+        if (((horiz && height()<=32)||(!horiz && width()<=48)) || deskNum <= 1)
             rowNum = 1;
         else
             rowNum = 2;
-    } else {
-        rowNum = m_rows;
     }
+
     int deskCols = deskNum/rowNum;
     if(deskNum == 0 || deskNum % rowNum != 0)


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

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