diff mac/dw.m @ 1792:b0bdec1b820c

Similar fixes to the Mac one on OS/2 and Windows.... Plus a performance optimization on all three platforms. Don't redraw the window if the calculated control size did not change.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 05 Aug 2012 13:47:57 +0000
parents ed8851658015
children 9304241b7b33
line wrap: on
line diff
--- a/mac/dw.m	Sun Aug 05 13:02:39 2012 +0000
+++ b/mac/dw.m	Sun Aug 05 13:47:57 2012 +0000
@@ -8918,9 +8918,21 @@
     /* Check to see if any of the sizes need to be recalculated */
     if(item && (item->origwidth == -1 || item->origheight == -1))
     {
-        _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL);        
-        /* Queue a redraw on the top-level window */
-        _dw_redraw([object window], TRUE);
+      int newwidth, newheight;
+      
+      _control_size(handle, &newwidth, &newheight); 
+      
+      /* Only update the item and redraw the window if it changed */
+      if((item->origwidth == -1 && item->width != newwidth) ||
+         (item->origheight == -1 && item->height != newheight))
+      {
+         if(item->origwidth == -1)
+            item->width = newwidth;
+         if(item->origheight == -1)
+            item->height = newheight;
+         /* Queue a redraw on the top-level window */
+         _dw_redraw([object window], TRUE);
+      }
     }
 }