Author: matt
Date: 2010-10-30 12:28:17 -0700 (Sat, 30 Oct 2010)
New Revision: 7777
Log:
STR 2370: fixed static allocation in Fl_Tabs.

Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/src/Fl_Tabs.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2010-10-30 19:18:05 UTC (rev 7776)
+++ branches/branch-1.3/CHANGES 2010-10-30 19:28:17 UTC (rev 7777)
@@ -1,5 +1,9 @@
 CHANGES IN FLTK 1.3.0
 
+       - Fixed static allocation in Fl_Tabs (STR #2370)
+       - Fixed Fl_Widget::measure_label() to const (STR #2406)
+       - Added step by step README's for MSWindows, OS X, and four
+         Linux distros
        - Fixed unbalanced Windows OleInitialize/OleUnitialize calls
          when loading/unloading the FLTK dll (STR #2417)
        - Fixed X11/XDBE double buffering (STR #2152, #2197)

Modified: branches/branch-1.3/src/Fl_Tabs.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Tabs.cxx 2010-10-30 19:18:05 UTC (rev 7776)
+++ branches/branch-1.3/src/Fl_Tabs.cxx 2010-10-30 19:28:17 UTC (rev 7777)
@@ -117,12 +117,20 @@
     if (event_y > y()+H || event_y < y()) return 0;
   }
   if (event_x < x()) return 0;
-  int p[128], wp[128];
+  Fl_Widget *ret = 0L;
+  int nc = children();
+  int *p  = (int*)malloc((nc+1)*sizeof(int));
+  int *wp = (int*)malloc((nc+1)*sizeof(int));
   tab_positions(p, wp);
   for (int i=0; i<children(); i++) {
-    if (event_x < x()+p[i+1]) return child(i);
+    if (event_x < x()+p[i+1]) {
+      ret = child(i);
+      break;
+    }
   }
-  return 0;
+  free(p);
+  free(wp);
+  return ret;
 }
 
 void Fl_Tabs::redraw_tabs()
@@ -318,7 +326,9 @@
     if (v) update_child(*v);
   }
   if (damage() & (FL_DAMAGE_SCROLL|FL_DAMAGE_ALL)) {
-    int p[128]; int wp[128];
+    int nc = children();
+    int *p  = (int*)malloc((nc+1)*sizeof(int));
+    int *wp = (int*)malloc((nc+1)*sizeof(int));
     int selected = tab_positions(p,wp);
     int i;
     Fl_Widget*const* a = array();
@@ -330,6 +340,8 @@
       i = selected;
       draw_tab(x()+p[i], x()+p[i+1], wp[i], H, a[i], SELECTED);
     }
+    free(p);
+    free(wp);
   }
 }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to