Author: cwittich
Date: Sat Oct 17 21:35:42 2009
New Revision: 43539
URL: 
http://svn.reactos.org/svn/reactos?rev=43539&view=rev
Log:
sync edit to wine 1.1.31
Modified:
    trunk/reactos/dll/win32/user32/controls/edit.c
Modified: trunk/reactos/dll/win32/user32/controls/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Sat Oct 17 21:35:42 2009
@@ -164,6 +164,7 @@
                     (LPARAM)(es->hwndSelf)); \
        } while(0)
+
 /*********************************************************************
  *
  *     EM_CANUNDO
@@ -1225,7 +1226,7 @@
        {
            WARN("edit hwnd %p already destroyed\n", es->hwndSelf);
            return;
-       }
+       }
        if (!es->lock_count) {
                ERR("lock_count == 0 ... please report\n");
@@ -3676,8 +3677,8 @@
            }
            break;
         case VK_ESCAPE:
-           if (!(es->style & ES_MULTILINE) && EDIT_IsInsideDialog(es))
-               PostMessageW(es->hwndParent, WM_CLOSE, 0, 0);
+            if ((es->style & ES_MULTILINE) && EDIT_IsInsideDialog(es))
+                PostMessageW(es->hwndParent, WM_CLOSE, 0, 0);
             break;
         case VK_TAB:
             if ((es->style & ES_MULTILINE) && EDIT_IsInsideDialog(es))
@@ -4601,8 +4602,8 @@
         *            WM_XXX messages before WM_NCCREATE is completed.
         */
-       es->is_unicode = unicode;
-       es->style = lpcs->style;
+       es->is_unicode = unicode;
+       es->style = lpcs->style;
         es->bEnableState = !(es->style & WS_DISABLED);
@@ -4670,7 +4671,7 @@
          * If WS_BORDER without WS_EX_CLIENTEDGE is specified we shouldn't have
          * a nonclient area and we should handle painting the border ourselves.
          *
-         * When making modifications please ensure that the code still works
+         * When making modifications please ensure that the code still works
          * for edit controls created directly with style 0x50800000, exStyle 0
          * (which should have a single pixel border)
         */
@@ -4691,7 +4692,7 @@
 static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name)
 {
         RECT clientRect;
-
+
        TRACE("%s\n", debugstr_w(name));
        /*
         *      To initialize some final structure members, we call some helper
@@ -4701,7 +4702,7 @@
         */
         EDIT_WM_SetFont(es, 0, FALSE);
         EDIT_EM_EmptyUndoBuffer(es);
-
+
         /* We need to calculate the format rect
            (applications may send EM_SETMARGINS before the control gets visible) */
         GetClientRect(es->hwndSelf, &clientRect);
@@ -4803,7 +4804,7 @@
        LRESULT result = 0;
         TRACE("hwnd=%p msg=%x (%s) wparam=%lx lparam=%lx\n", hwnd, msg,
SPY_GetMsgName(msg, hwnd), wParam, lParam);
-
+
        if (!es && msg != WM_NCCREATE)
                return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
@@ -5121,6 +5122,9 @@
        case EM_SETREADONLY16:
 #endif
        case EM_SETREADONLY:
+       {
+               DWORD old_style = es->style;
+
                if (wParam) {
                     SetWindowLongPtrW( hwnd, GWL_STYLE,
                                        GetWindowLongPtrW( hwnd, GWL_STYLE ) | ES_READONLY
);
@@ -5130,8 +5134,13 @@
                                        GetWindowLongPtrW( hwnd, GWL_STYLE ) &
~ES_READONLY );
                     es->style &= ~ES_READONLY;
                }
-                result = 1;
-               break;
+
+               if (old_style ^ es->style)
+                   InvalidateRect(es->hwndSelf, NULL, TRUE);
+
+               result = 1;
+               break;
+       }
 #ifndef __REACTOS__
        case EM_SETWORDBREAKPROC16:
@@ -5208,7 +5217,7 @@
        case WM_GETDLGCODE:
                result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
-
+
                if (es->style & ES_MULTILINE)
                   result |= DLGC_WANTALLKEYS;
@@ -5483,12 +5492,12 @@
        case WM_IME_CONTROL:
                break;
-
+
        default:
                result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
                break;
        }
-
+
        if (es) EDIT_UnlockBuffer(es, FALSE);
         TRACE("hwnd=%p msg=%x (%s) -- 0x%08lx\n", hwnd, msg,
SPY_GetMsgName(msg, hwnd), result);