summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-04-06 20:01:59 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-04-06 20:01:59 (GMT)
commit00b1b03df4ce671eea9cc375ea1d6d7d892d73ea (patch)
tree39bae83927e12e2e33b5a459c20a4811b2617538
parentf4c9b668c5a0329779df76cc8a18d4fc2fc6a6e8 (diff)
downloadtk-00b1b03df4ce671eea9cc375ea1d6d7d892d73ea.zip
tk-00b1b03df4ce671eea9cc375ea1d6d7d892d73ea.tar.gz
tk-00b1b03df4ce671eea9cc375ea1d6d7d892d73ea.tar.bz2
Slightly better fix anonymously proposed in [6020ee2d03]. Use floor() instead of casting to an int.
-rw-r--r--generic/ttk/ttkNotebook.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 389d520..b649e4b 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <ctype.h>
+#include <math.h>
#include <stdio.h>
#include <tk.h>
@@ -454,15 +455,17 @@ static void SqueezeTabs(
if (nTabs > 0) {
int difference = available - needed;
- double delta = (double)difference / needed;
+ double fraction = (double)difference / needed;
double slack = 0;
+ double ad;
int i;
for (i = 0; i < nTabs; ++i) {
Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i);
- double ad = slack + tab->width * delta;
+
+ ad = slack + tab->width * fraction;
tab->width += (int)ad;
- slack = ad - (int)ad;
+ slack = ad - floor(ad);
}
}
}