Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs16:/tmp/cvs-serv6795/src

Modified Files:
	mswindow.c 
Log Message:
Improved windows sizing box procedure by only having size box show when
user right click's border.  Size box goes away when user right clicks anywhere
in window.  Same for both local/map, and message richtext windows.

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- mswindow.c	13 Apr 2007 07:12:24 -0000	1.70
+++ mswindow.c	14 Apr 2007 03:48:47 -0000	1.71
@@ -1141,12 +1141,6 @@
             WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
         parentwin = &myroot;
     }
-    else if (strncmp (name, "local", 5) == 0 || strncmp (name, "map", 3) == 0)
-    {
-        s = name;
-        if (mainResizeable)
-            SpecialStyle = WS_THICKFRAME;
-    }
     else
         s = name;
 
@@ -2157,7 +2151,30 @@
         EventQueue[EventTail].type = W_EV_BUTTON;
         return (0);
 
+    case WM_NCRBUTTONDOWN:
+        BringWindowToTop (hwnd);
+        GET_STRUCT_PTR;
 
+        if (mainResizeable && (((Window *) mapw != NULL && win->hwnd == ((Window *) mapw)->hwnd)
+             || ((Window *) w != NULL && win->hwnd == ((Window *) w)->hwnd)) )
+        {
+            if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_SIZEBOX)
+            {
+                // remove sizing border and redraw
+                SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
+                SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+                // Flag local window as needing redraw
+                if (win->hwnd == ((Window *) w)->hwnd)
+                    W_FastClear = 1;
+            }
+            else
+            {
+                // set sizing border and redraw
+                SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_SIZEBOX);
+                SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+            }
+        }
+        break;
     case WM_MBUTTONDOWN:
         BringWindowToTop (hwnd);
         GET_STRUCT_PTR;
@@ -2197,6 +2214,20 @@
         STORE_EVENT_MOUSE;
         LastPressHwnd = hwnd;
 
+        if (mainResizeable && (((Window *) mapw != NULL && win->hwnd == ((Window *) mapw)->hwnd)
+             || ((Window *) w != NULL && win->hwnd == ((Window *) w)->hwnd)) )
+        {
+            if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_SIZEBOX)
+            {
+                // remove sizing border and redraw
+                SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
+                SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+                // Flag local window as needing redraw
+                if (win->hwnd == ((Window *) w)->hwnd)
+                    W_FastClear = 1;
+            }
+        }
+
 #ifdef SHIFTED_MOUSE
         if (shiftedMouse)
         {
@@ -6149,16 +6180,27 @@
         // fake a caption hit to move window
         SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
         break;
-    case WM_NCLBUTTONDOWN:
-        // set sizing border
-        SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_SIZEBOX);
-        break;
-    case WM_LBUTTONUP:
-    case WM_NCLBUTTONUP:
-        SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
-        // remove sizing border and redraw
-        SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+    case WM_NCRBUTTONDOWN:
+        if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_SIZEBOX)
+        {
+            // remove sizing border and redraw
+            SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
+            SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+        }
+        else
+        {
+            // set sizing border and redraw
+            SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_SIZEBOX);
+            SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+        }
         break;
+    case WM_RBUTTONDOWN:
+        if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_SIZEBOX)
+        {
+            // remove sizing border and redraw
+            SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
+            SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+        }
     }
     return CallWindowProc (lpfnDefRichEditWndProc, hwnd, msg, wParam, lParam);
 }