Mercurial > dwindows
comparison os2/dw.c @ 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 | a640714f9087 |
children | 9304241b7b33 |
comparison
equal
deleted
inserted
replaced
1791:ed8851658015 | 1792:b0bdec1b820c |
---|---|
5202 { | 5202 { |
5203 thiswidth = bmp.cx; | 5203 thiswidth = bmp.cx; |
5204 thisheight = bmp.cy; | 5204 thisheight = bmp.cy; |
5205 } | 5205 } |
5206 } | 5206 } |
5207 else if(dw_window_get_data(handle, "_dw_status")) | 5207 else |
5208 { | 5208 { |
5209 extrawidth = 4; | 5209 if(thiswidth == 1 && thisheight == 1) |
5210 extraheight = 4; | 5210 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); |
5211 if(dw_window_get_data(handle, "_dw_status")) | |
5212 { | |
5213 extrawidth = 4; | |
5214 extraheight = 4; | |
5215 } | |
5211 } | 5216 } |
5212 } | 5217 } |
5213 /* Ranged: Slider/Percent */ | 5218 /* Ranged: Slider/Percent */ |
5214 else if(strncmp(tmpbuf, "#38", 4)== 0) | 5219 else if(strncmp(tmpbuf, "#38", 4)== 0) |
5215 { | 5220 { |
7521 Item *item = _box_item(handle); | 7526 Item *item = _box_item(handle); |
7522 | 7527 |
7523 /* Check to see if any of the sizes need to be recalculated */ | 7528 /* Check to see if any of the sizes need to be recalculated */ |
7524 if(item && (item->origwidth == -1 || item->origheight == -1)) | 7529 if(item && (item->origwidth == -1 || item->origheight == -1)) |
7525 { | 7530 { |
7526 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); | 7531 int newwidth, newheight; |
7527 /* Queue a redraw on the top-level window */ | 7532 |
7528 _dw_redraw(_toplevel_window(handle), TRUE); | 7533 _control_size(handle, &newwidth, &newheight); |
7534 | |
7535 /* Only update the item and redraw the window if it changed */ | |
7536 if((item->origwidth == -1 && item->width != newwidth) || | |
7537 (item->origheight == -1 && item->height != newheight)) | |
7538 { | |
7539 if(item->origwidth == -1) | |
7540 item->width = newwidth; | |
7541 if(item->origheight == -1) | |
7542 item->height = newheight; | |
7543 /* Queue a redraw on the top-level window */ | |
7544 _dw_redraw(_toplevel_window(handle), TRUE); | |
7545 } | |
7529 } | 7546 } |
7530 } | 7547 } |
7531 } | 7548 } |
7532 | 7549 |
7533 /* | 7550 /* |