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

List:       kde-devel
Subject:    KPanel: when using more than 8 desk buttons...
From:       Cristian Tibirna <ctibirna () gch ! ulaval ! ca>
Date:       1999-01-30 4:00:22
[Download RAW message or body]


... on two rows, the kpanel layouts correctly only the first 8 buttons.
The remaining are drawn one over the others *and* over the first 8
buttons.

The following patch fixes this.

Sorry, this patch also damages some KDE statistics based on the number of
the lines of code :-). 

Also, sorry for sending the patch to the list. The bug is ugly
(aesthetically speaking) and needs fixed for 1.1, and the procedure asks
me to send the fixes to the list.

---
Cristian Tibirna :: ctibirna@gch.ulaval.ca
KDE Worshiper    ::  tibirna@kde.org



Index: kpanel.C
===================================================================
RCS file: /home/kde/kdebase/kpanel/kpanel.C,v
retrieving revision 1.89
diff -u -r1.89 kpanel.C
--- kpanel.C	1999/01/17 23:00:31	1.89
+++ kpanel.C	1999/01/30 03:38:45
@@ -521,56 +521,21 @@
 				 box_height - exit_button->height(),
 				 exit_button->width(),
 				 exit_button->height());
-	
+
+	//CT 29Jan1999 - fix for more than 8 buttons and cleaner code
+	int par, col, tmp_y, tmp_w, tmp_h;
 	for (i=0; (tmp_button = desktopbar->find(i)); i++){
-	  switch (i){
-	  case 0:
-	    tmp_button->setGeometry(1, 0,
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 2:
-	    tmp_button->setGeometry(exit_button->width() * dbhs + 2, 0,
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 4:
-	    tmp_button->setGeometry(2 * exit_button->width() * dbhs + 3, 0,
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 6:
-	    tmp_button->setGeometry(3 * exit_button->width() * dbhs + 4, 0,
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 1:
-	    tmp_button->setGeometry(1,
-				    lock_button->y(),
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 3:
-	    tmp_button->setGeometry(exit_button->width() * dbhs + 2,
-				    lock_button->y(),
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 5:
-	    tmp_button->setGeometry(2 * exit_button->width() * dbhs + 3,
-				    lock_button->y(),
-				    exit_button->width() * dbhs,
-				    exit_button->height());
-	    break;
-	  case 7:
-	    tmp_button->setGeometry(3 * exit_button->width() * dbhs + 4,
-				    lock_button->y(),
-				    exit_button->width() * dbhs,
-				  exit_button->height());
-	    break;
-	  }
+	  par = !(i % 2);
+	  col = i / 2;
+	  tmp_h = exit_button->height();
+	  tmp_w = exit_button->width() * dbhs;
+	  if ( par ) tmp_y = 0;
+	  else       tmp_y = lock_button->y();
+	  tmp_button->setGeometry(col*(tmp_w+1)+1, tmp_y,
+				    tmp_w,
+				    tmp_h);
 	}
-	
+	//CT	
 	
 	desktopbar->setGeometry(exit_button->width(),
 				0,

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

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