Author: jimtabor
Date: Mon Oct 24 14:13:19 2011
New Revision: 54247
URL:
http://svn.reactos.org/svn/reactos?rev=54247&view=rev
Log:
[User32]
- Fix SetWindowTextA/W so that it passes through defwnd to be processed for themes.
- Fix desktop checks.
- Add create window flags.
Modified:
trunk/reactos/dll/win32/user32/windows/window.c
trunk/reactos/dll/win32/user32/windows/winpos.c
Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Mon Oct 24 14:13:19 2011
@@ -168,13 +168,14 @@
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam,
- BOOL Unicode)
+ DWORD dwFlags)
{
LARGE_STRING WindowName;
LARGE_STRING lstrClassName, *plstrClassName;
UNICODE_STRING ClassName;
WNDCLASSEXA wceA;
WNDCLASSEXW wceW;
+ BOOL Unicode;
HWND Handle = NULL;
#if 0
@@ -186,6 +187,8 @@
ERR("User32CreateWindowEx RegisterSystemControls\n");
RegisterSystemControls();
}
+
+ Unicode = !(dwFlags & NUCWE_ANSI);
if (IS_ATOM(lpClassName))
{
@@ -278,7 +281,7 @@
hMenu,
hInstance,
lpParam,
- 0,
+ dwFlags,
NULL);
#if 0
@@ -417,7 +420,7 @@
hMenu,
hInstance,
lpParam,
- FALSE);
+ NUCWE_ANSI);
return hwnd;
}
@@ -540,7 +543,7 @@
hMenu,
hInstance,
lpParam,
- TRUE);
+ 0);
return hwnd;
}
@@ -955,15 +958,26 @@
{
PWND Wnd = ValidateHwnd(hWnd);
- if (Wnd != NULL)
- {
- lpRect->left = lpRect->top = 0;
+ if (!Wnd) return FALSE;
+ if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
+ {
+/* lpRect->left = lpRect->top = 0;
lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left;
lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top;
- return TRUE;
- }
-
- return FALSE;
+*/
+ *lpRect = Wnd->rcClient;
+ OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top);
+ }
+ else
+ {
+ lpRect->left = lpRect->top = 0;
+ lpRect->right = Wnd->rcClient.right;
+ lpRect->bottom = Wnd->rcClient.bottom;
+/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
+ lpRect->right = GetSystemMetrics(SM_CXSCREEN);
+ lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
+*/ }
+ return TRUE;
}
@@ -1242,13 +1256,21 @@
{
PWND Wnd = ValidateHwnd(hWnd);
- if (Wnd != NULL)
+ if (!Wnd) return FALSE;
+ if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
{
*lpRect = Wnd->rcWindow;
- return TRUE;
- }
-
- return FALSE;
+ }
+ else
+ {
+ lpRect->left = lpRect->top = 0;
+ lpRect->right = Wnd->rcWindow.right;
+ lpRect->bottom = Wnd->rcWindow.bottom;
+/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
+ lpRect->right = GetSystemMetrics(SM_CXSCREEN);
+ lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
+*/ }
+ return TRUE;
}
@@ -1693,26 +1715,19 @@
SetWindowTextA(HWND hWnd,
LPCSTR lpString)
{
- DWORD ProcessId;
- if(!GetWindowThreadProcessId(hWnd, &ProcessId))
- {
- return FALSE;
- }
-
- if(ProcessId != GetCurrentProcessId())
- {
+ PWND pwnd;
+
+ pwnd = ValidateHwnd(hWnd);
+ if (pwnd)
+ {
+ if (!TestWindowProcess(pwnd))
+ {
/* do not send WM_GETTEXT messages to other processes */
-
- DefSetText(hWnd, (PCWSTR)lpString, TRUE);
-
- if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
- {
- DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
- }
- return TRUE;
- }
-
- return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
+ return (DefWindowProcA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
+ }
+ return (SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
+ }
+ return FALSE;
}
@@ -1723,26 +1738,19 @@
SetWindowTextW(HWND hWnd,
LPCWSTR lpString)
{
- DWORD ProcessId;
- if(!GetWindowThreadProcessId(hWnd, &ProcessId))
- {
- return FALSE;
- }
-
- if(ProcessId != GetCurrentProcessId())
- {
+ PWND pwnd;
+
+ pwnd = ValidateHwnd(hWnd);
+ if (pwnd)
+ {
+ if (!TestWindowProcess(pwnd))
+ {
/* do not send WM_GETTEXT messages to other processes */
-
- DefSetText(hWnd, lpString, FALSE);
-
- if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
- {
- DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
- }
- return TRUE;
- }
-
- return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
+ return (DefWindowProcW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
+ }
+ return (SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
+ }
+ return FALSE;
}
Modified: trunk/reactos/dll/win32/user32/windows/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/winpos.c [iso-8859-1] Mon Oct 24 14:13:19 2011
@@ -151,7 +151,7 @@
Delta.x = Delta.y = 0;
mirror_from = mirror_to = FALSE;
- if (FromWnd && FromWnd->fnid != FNID_DESKTOP)
+ if (FromWnd && hWndFrom != GetDesktopWindow()) // FromWnd->fnid !=
FNID_DESKTOP)
{
if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
{
@@ -163,7 +163,7 @@
Delta.y = FromWnd->rcClient.top;
}
- if (ToWnd && ToWnd->fnid != FNID_DESKTOP)
+ if (ToWnd && hWndTo != GetDesktopWindow()) // ToWnd->fnid !=
FNID_DESKTOP)
{
if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
{
@@ -207,7 +207,7 @@
if (!Wnd)
return FALSE;
- if (Wnd->fnid != FNID_DESKTOP)
+ if (hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
{
if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
lpPoint->x = Wnd->rcClient.right - lpPoint->x;
@@ -231,7 +231,7 @@
if (!Wnd)
return FALSE;
- if (Wnd->fnid != FNID_DESKTOP)
+ if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
{
if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
lpPoint->x = Wnd->rcClient.right - lpPoint->x;