comparison win/dw.c @ 127:c5c3ccb84ac7

Safety checks in the splitbar calculations on OS/2 and Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 20 Oct 2002 06:10:31 +0000
parents 72cb88af4490
children e47c52b37cdd
comparison
equal deleted inserted replaced
126:72cb88af4490 127:c5c3ccb84ac7
2291 if(type == BOXHORZ) 2291 if(type == BOXHORZ)
2292 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); 2292 SetCursor(LoadCursor(NULL, IDC_SIZEWE));
2293 else 2293 else
2294 SetCursor(LoadCursor(NULL, IDC_SIZENS)); 2294 SetCursor(LoadCursor(NULL, IDC_SIZENS));
2295 2295
2296 if(GetCapture() == hwnd) 2296 if(GetCapture() == hwnd && percent)
2297 { 2297 {
2298 POINT point; 2298 POINT point;
2299 RECT rect; 2299 RECT rect;
2300 2300
2301 GetCursorPos(&point); 2301 GetCursorPos(&point);
2307 int height = (rect.bottom - rect.top); 2307 int height = (rect.bottom - rect.top);
2308 2308
2309 if(type == BOXHORZ) 2309 if(type == BOXHORZ)
2310 { 2310 {
2311 start = point.x - rect.left; 2311 start = point.x - rect.left;
2312 *percent = ((float)start / (float)(rect.right - rect.left - SPLITBAR_WIDTH)) * 100.0; 2312 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
2313 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
2313 } 2314 }
2314 else 2315 else
2315 { 2316 {
2316 start = point.y - rect.top; 2317 start = point.y - rect.top;
2317 *percent = ((float)start / (float)(rect.bottom - rect.top - SPLITBAR_WIDTH)) * 100.0; 2318 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
2319 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0;
2318 } 2320 }
2319 _handle_splitbar_resize(hwnd, *percent, type, width, height); 2321 _handle_splitbar_resize(hwnd, *percent, type, width, height);
2320 } 2322 }
2321 } 2323 }
2322 break; 2324 break;