[ros-diffs] [tkreuzer] 50955: [USER32] Sync edit.c with wine head.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Mar 2 13:13:10 UTC 2011


Author: tkreuzer
Date: Wed Mar  2 13:13:10 2011
New Revision: 50955

URL: http://svn.reactos.org/svn/reactos?rev=50955&view=rev
Log:
[USER32]
Sync edit.c with wine head.

Modified:
    trunk/reactos/dll/win32/user32/controls/edit.c
    trunk/reactos/dll/win32/user32/include/user32p.h

Modified: trunk/reactos/dll/win32/user32/controls/edit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/edit.c?rev=50955&r1=50954&r2=50955&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Wed Mar  2 13:13:10 2011
@@ -426,8 +426,8 @@
 				/* The buffer has been expanded, create a new line and
 				   insert it into the link list */
 				LINEDEF *new_line = HeapAlloc(GetProcessHeap(), 0, sizeof(LINEDEF));
-                if (new_line == NULL)
-                    break;
+                if (new_line == NULL) // reactos r33509
+                    break; // reactos r33509
 				new_line->next = previous_line->next;
 				previous_line->next = new_line;
 				current_line = new_line;
@@ -1109,8 +1109,7 @@
 	    if(textA)
 	    {
 		HLOCAL hloc32W_new;
-		UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, countA, NULL, 0);
-		TRACE("%d bytes translated to %d WCHARs\n", countA, countW_new);
+		UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0);
 		if(countW_new > es->buffer_size + 1)
 		{
 		    UINT alloc_size = ROUND_TO_GROW(countW_new * sizeof(WCHAR));
@@ -1125,14 +1124,11 @@
 		    else
 			WARN("FAILED! Will synchronize partially\n");
 		}
+                es->text = LocalLock(es->hloc32W);
+		MultiByteToWideChar(CP_ACP, 0, textA, -1, es->text, es->buffer_size + 1);
+                LocalUnlock(es->hloc32A);
 	    }
-	    /*TRACE("Locking 32-bit UNICODE buffer\n");*/
-	    es->text = LocalLock(es->hloc32W);
-	    if(textA)
-	    {
-		MultiByteToWideChar(CP_ACP, 0, textA, countA, es->text, es->buffer_size + 1);
-		LocalUnlock(es->hloc32A);
-	    }
+	    else es->text = LocalLock(es->hloc32W);
 	}
         if(es->flags & EF_APP_HAS_HANDLE) text_buffer_changed(es);
 	es->lock_count++;
@@ -1165,7 +1161,6 @@
 
 	if (force || (es->lock_count == 1)) {
 	    if (es->hloc32W) {
-		CHAR *textA = NULL; // ReactOS hacked!
 		UINT countA = 0;
 		UINT countW = get_text_length(es) + 1;
 
@@ -1190,13 +1185,9 @@
 			else
 			    WARN("FAILED! Will synchronize partially\n");
 		    }
-		    textA = LocalLock(es->hloc32A);
-		}
-
-		if(textA)
-		{
-		    WideCharToMultiByte(CP_ACP, 0, es->text, countW, textA, countA, NULL, NULL);
-		    LocalUnlock(es->hloc32A);
+		    WideCharToMultiByte(CP_ACP, 0, es->text, countW,
+                                        LocalLock(es->hloc32A), countA, NULL, NULL);
+                    LocalUnlock(es->hloc32A);
 		}
 
 		LocalUnlock(es->hloc32W);
@@ -2799,11 +2790,11 @@
 		es->tabs = NULL;
 	else {
 		es->tabs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT));
-        if (es->tabs == NULL)
+        if (es->tabs == NULL) // reactos r33503
         {
             es->tabs_count = 0;
             return FALSE;
-        }
+        } // reactos r33503
 		memcpy(es->tabs, tabs, count * sizeof(INT));
 	}
 	return TRUE;
@@ -2847,8 +2838,8 @@
 	ulength = strlenW(es->undo_text);
 
 	utext = HeapAlloc(GetProcessHeap(), 0, (ulength + 1) * sizeof(WCHAR));
-    if (utext == NULL)
-        return FALSE;
+    if (utext == NULL) // reactos r33503
+        return FALSE; // reactos r33503
 
 	strcpyW(utext, es->undo_text);
 
@@ -2877,7 +2868,7 @@
  * controls without ES_WANTRETURN would attempt to detect whether it is inside
  * a dialog box or not.
  */
-static BOOL EDIT_IsInsideDialog(EDITSTATE *es)
+static inline BOOL EDIT_IsInsideDialog(EDITSTATE *es)
 {
     return (es->flags & EF_DIALOGMODE);
 }
@@ -3109,11 +3100,7 @@
  */
 static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
 {
-#ifdef __REACTOS__
-	HMENU menu = LoadMenuA(User32Instance, "EDITMENU");
-#else
 	HMENU menu = LoadMenuA(user32_module, "EDITMENU");
-#endif
 	HMENU popup = GetSubMenu(menu, 0);
 	UINT start = es->selection_start;
 	UINT end = es->selection_end;
@@ -3144,6 +3131,10 @@
             y = rc.top + (rc.bottom - rc.top) / 2;
         }
 
+	if (!(es->flags & EF_FOCUSED))
+            SetFocus(es->hwndSelf);
+
+#ifdef __REACTOS__
 	selectedItem = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, es->hwndSelf, NULL);
         // Added see Revision 43925 comments.
 	switch (selectedItem) {
@@ -3170,7 +3161,7 @@
 			ERR("unknown menu item, please report\n");
 			break;
 	}
-
+#endif
 	DestroyMenu(menu);
 }
 
@@ -3682,7 +3673,7 @@
 		EDIT_UpdateText(es, NULL, TRUE);
 	if (es->flags & EF_FOCUSED) {
 		DestroyCaret();
-		CreateCaret(es->hwndSelf, 0, 2, es->line_height);
+		CreateCaret(es->hwndSelf, 0, 1, es->line_height);
 		EDIT_SetCaretPos(es, es->selection_end,
 				 es->flags & EF_AFTER_WRAP);
 		ShowCaret(es->hwndSelf);
@@ -4428,10 +4419,10 @@
 
 /*********************************************************************
  *
- *	WM_DESTROY
- *
- */
-static LRESULT EDIT_WM_Destroy(EDITSTATE *es)
+ *	WM_NCDESTROY
+ *
+ */
+static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es)
 {
 	LINEDEF *pc, *pp;
 
@@ -4472,8 +4463,7 @@
  *	The messages are in the order of the actual integer values
  *	(which can be found in include/windows.h)
  */
-LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
-                                   WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
 {
 	EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 );
 	LRESULT result = 0;
@@ -4495,7 +4485,7 @@
 	if (!es && msg != WM_NCCREATE)
 		return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
 
-	if (es && (msg != WM_DESTROY)) EDIT_LockBuffer(es);
+	if (es && (msg != WM_NCDESTROY)) EDIT_LockBuffer(es);
 
 	switch (msg) {
 	case EM_GETSEL:
@@ -4570,13 +4560,9 @@
 		break;
 
 	/* these messages missing from specs */
-	case WM_USER+15:
 	case 0x00bf:
-	case WM_USER+16:
 	case 0x00c0:
-	case WM_USER+19:
 	case 0x00c3:
-	case WM_USER+26:
 	case 0x00ca:
 		FIXME("undocumented message 0x%x, please report\n", msg);
 		result = DefWindowProcW(hwnd, msg, wParam, lParam);
@@ -4733,8 +4719,8 @@
 		result = EDIT_WM_NCCreate(hwnd, (LPCREATESTRUCTW)lParam, unicode);
 		break;
 
-	case WM_DESTROY:
-		result = EDIT_WM_Destroy(es);
+	case WM_NCDESTROY:
+		result = EDIT_WM_NCDestroy(es);
 		es = NULL;
 #ifdef __REACTOS__
                 NtUserSetWindowFNID(hwnd, FNID_DESTROY);
@@ -5058,10 +5044,10 @@
     CS_DBLCLKS | CS_PARENTDC,   /* style */
     EditWndProcA,         /* procA */
     EditWndProcW,         /* procW */
-#ifdef _WIN64
+#ifndef _WIN64
+    sizeof(EDITSTATE *) + sizeof(WORD), /* extra */
+#else
     sizeof(EDITSTATE *),  /* extra */
-#else
-    sizeof(EDITSTATE *) + sizeof(WORD), /* extra */
 #endif
     IDC_IBEAM,            /* cursor */
     0                     /* brush */

Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/user32p.h?rev=50955&r1=50954&r2=50955&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Wed Mar  2 13:13:10 2011
@@ -106,6 +106,7 @@
 
 /* Internal Thread Data */
 extern HINSTANCE User32Instance;
+#define user32_module User32Instance
 extern HINSTANCE hImmInstance;
 
 /* Critical Section*/




More information about the Ros-diffs mailing list