changeset 539:8f80ed604a89

Some splitbar optimizations, removed unneeded code and optimized crucial codepaths (window procedures) on OS/2 and Windows. I also figured out what the splitbar problem is on OS/2, but the fix is not yet finished. I have a somewhat working fix but it causes some other problems. So I have not committed it yet.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 01 Apr 2004 07:25:38 +0000
parents 5c1ee7f6e7ff
children 2b9b88c273bc
files os2/dw.c win/dw.c
diffstat 2 files changed, 29 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Thu Mar 25 19:52:57 2004 +0000
+++ b/os2/dw.c	Thu Apr 01 07:25:38 2004 +0000
@@ -2784,18 +2784,17 @@
 
 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y)
 {
+	float ratio = (float)percent/(float)100.0;
+	HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
+	HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
+	Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
+
+	WinShowWindow(handle1, FALSE);
+	WinShowWindow(handle2, FALSE);
+
 	if(type == DW_HORZ)
 	{
-		int newx = x;
-		float ratio = (float)percent/(float)100.0;
-		HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
-		HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
-		Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
-
-		WinShowWindow(handle1, FALSE);
-		WinShowWindow(handle2, FALSE);
-
-		newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2);
+		int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
 
 		WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE);
 		_do_resize(tmp, newx - 1, y - 1);
@@ -2808,22 +2807,10 @@
 
 		WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE);
 		_do_resize(tmp, newx - 1, y - 1);
-
-		WinShowWindow(handle1, TRUE);
-		WinShowWindow(handle2, TRUE);
 	}
 	else
 	{
-		int newy = y;
-		float ratio = (float)percent/(float)100.0;
-		HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
-		HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
-		Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
-
-		WinShowWindow(handle1, FALSE);
-		WinShowWindow(handle2, FALSE);
-
-		newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2);
+		int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
 
 		WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE);
 		_do_resize(tmp, x - 1, newy - 1);
@@ -2835,21 +2822,17 @@
 		WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE);
 		_do_resize(tmp, x - 1, newy - 1);
 
-		WinShowWindow(handle1, TRUE);
-		WinShowWindow(handle2, TRUE);
-
 		dw_window_set_data(hwnd, "_dw_start", (void *)newy);
 	}
+
+	WinShowWindow(handle1, TRUE);
+	WinShowWindow(handle2, TRUE);
 }
 
 
 /* This handles any activity on the splitbars (sizers) */
 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
-	float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
-	int type = (int)dw_window_get_data(hwnd, "_dw_type");
-	int start = (int)dw_window_get_data(hwnd, "_dw_start");
-
 	switch (msg)
 	{
 	case WM_ACTIVATE:
@@ -2861,6 +2844,8 @@
 			HPS hps;
 			POINTL ptl[2];
 			RECTL rcl;
+			int type = (int)dw_window_get_data(hwnd, "_dw_type");
+			int start = (int)dw_window_get_data(hwnd, "_dw_start");
 
 			hps = WinBeginPaint(hwnd, 0, 0);
 
@@ -2891,6 +2876,8 @@
 
 	case WM_MOUSEMOVE:
 		{
+			int type = (int)dw_window_get_data(hwnd, "_dw_type");
+
 			if(type == DW_HORZ)
 				WinSetPointer(HWND_DESKTOP,
 							  WinQuerySysPointer(HWND_DESKTOP,
@@ -2908,6 +2895,9 @@
 			APIRET rc;
 			RECTL  rclFrame;
 			RECTL  rclBounds;
+			float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
+			int type = (int)dw_window_get_data(hwnd, "_dw_type");
+			int start = (int)dw_window_get_data(hwnd, "_dw_start");
 
 			WinQueryWindowRect(hwnd, &rclFrame);
 			WinQueryWindowRect(hwnd, &rclBounds);
--- a/win/dw.c	Thu Mar 25 19:52:57 2004 +0000
+++ b/win/dw.c	Thu Apr 01 07:25:38 2004 +0000
@@ -2714,9 +2714,6 @@
 		MoveWindow(handle2, x - newx, 0, newx, y, FALSE);
 		_do_resize(tmp, newx - 1, y - 1);
 
-		ShowWindow(handle1, SW_SHOW);
-		ShowWindow(handle2, SW_SHOW);
-
 		dw_window_set_data(hwnd, "_dw_start", (void *)newx);
 	}
 	else
@@ -2742,20 +2739,16 @@
 		MoveWindow(handle2, 0, 0, x, newy, FALSE);
 		_do_resize(tmp, x - 1, newy - 1);
 
-		ShowWindow(handle1, SW_SHOW);
-		ShowWindow(handle2, SW_SHOW);
-
 		dw_window_set_data(hwnd, "_dw_start", (void *)newy);
 	}
+
+	ShowWindow(handle1, SW_SHOW);
+	ShowWindow(handle2, SW_SHOW);
 }
 
 /* This handles any activity on the splitbars (sizers) */
 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
 {
-	float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
-	int type = (int)dw_window_get_data(hwnd, "_dw_type");
-	int start = (int)dw_window_get_data(hwnd, "_dw_start");
-
 	switch (msg)
 	{
 	case WM_ACTIVATE:
@@ -2766,6 +2759,8 @@
 		{
 			PAINTSTRUCT ps;
 			HDC hdcPaint;
+			int type = (int)dw_window_get_data(hwnd, "_dw_type");
+			int start = (int)dw_window_get_data(hwnd, "_dw_start");
 
 			BeginPaint(hwnd, &ps);
 
@@ -2802,6 +2797,10 @@
 		break;
 	case WM_MOUSEMOVE:
 		{
+			float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
+			int type = (int)dw_window_get_data(hwnd, "_dw_type");
+			int start;
+
 			if(type == DW_HORZ)
 				SetCursor(LoadCursor(NULL, IDC_SIZEWE));
 			else