mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
More user fixes.
svn path=/trunk/; revision=3517
This commit is contained in:
parent
8874b95126
commit
93381cbd04
17 changed files with 479 additions and 145 deletions
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.5 2002/09/08 10:23:09 chorns Exp $
|
# $Id: Makefile,v 1.6 2002/09/17 23:46:22 dwelch Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ TARGET_BASE = 0x77e70000
|
||||||
|
|
||||||
TARGET_SDKLIBS = ntdll.a kernel32.a gdi32.a
|
TARGET_SDKLIBS = ntdll.a kernel32.a gdi32.a
|
||||||
|
|
||||||
TARGET_CFLAGS = -I./include -DUNICODE -DDBG
|
TARGET_CFLAGS = -I./include -DUNICODE -DDBG -Wall -Werror
|
||||||
|
|
||||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,5 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
|
|
||||||
extern HANDLE ProcessHeap;
|
|
||||||
VOID
|
|
||||||
User32FreeHeap(PVOID Block);
|
|
||||||
PVOID
|
|
||||||
User32AllocHeap(ULONG Size);
|
|
||||||
VOID
|
|
||||||
User32ConvertUnicodeString(PWSTR SrcString, PSTR DestString, ULONG DestSize);
|
|
||||||
PWSTR
|
|
||||||
User32ConvertString(PCSTR String);
|
|
||||||
VOID
|
|
||||||
User32FreeString(PWSTR String);
|
|
||||||
|
|
|
@ -8,3 +8,6 @@
|
||||||
|
|
||||||
#define IS_ATOM(x) \
|
#define IS_ATOM(x) \
|
||||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||||
|
|
||||||
|
VOID
|
||||||
|
UserSetupInternalPos(VOID);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: desktop.c,v 1.6 2002/09/08 10:23:10 chorns Exp $
|
/* $Id: desktop.c,v 1.7 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -81,7 +81,7 @@ CreateDesktopA(LPCSTR lpszDesktop,
|
||||||
|
|
||||||
hDesktop = CreateDesktopW(DesktopNameU.Buffer,
|
hDesktop = CreateDesktopW(DesktopNameU.Buffer,
|
||||||
NULL,
|
NULL,
|
||||||
pDevmode,
|
(LPDEVMODEW)pDevmode,
|
||||||
dwFlags,
|
dwFlags,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
lpsa);
|
lpsa);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <user32/callback.h>
|
#include <user32/callback.h>
|
||||||
|
#include <window.h>
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
|
@ -12,55 +13,13 @@ DWORD DebugTraceLevel = MIN_TRACE;
|
||||||
/* To make the linker happy */
|
/* To make the linker happy */
|
||||||
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
|
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
|
||||||
|
|
||||||
HANDLE ProcessHeap;
|
|
||||||
HWINSTA ProcessWindowStation;
|
HWINSTA ProcessWindowStation;
|
||||||
|
|
||||||
PVOID
|
|
||||||
User32AllocHeap(ULONG Size)
|
|
||||||
{
|
|
||||||
return(RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, Size));
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
User32FreeHeap(PVOID Block)
|
|
||||||
{
|
|
||||||
RtlFreeHeap(ProcessHeap, 0, Block);
|
|
||||||
}
|
|
||||||
|
|
||||||
PWSTR
|
|
||||||
User32ConvertString(PCSTR String)
|
|
||||||
{
|
|
||||||
ANSI_STRING InString;
|
|
||||||
UNICODE_STRING OutString;
|
|
||||||
RtlInitAnsiString(&InString, String);
|
|
||||||
RtlAnsiStringToUnicodeString(&OutString, &InString, TRUE);
|
|
||||||
return(OutString.Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
User32ConvertUnicodeString(PWSTR SrcString, PSTR DestString, ULONG DestSize)
|
|
||||||
{
|
|
||||||
UNICODE_STRING InString;
|
|
||||||
ANSI_STRING OutString;
|
|
||||||
RtlInitUnicodeString(&InString, SrcString);
|
|
||||||
OutString.Buffer = DestString;
|
|
||||||
OutString.MaximumLength = DestSize;
|
|
||||||
RtlUnicodeStringToAnsiString(&OutString, &InString, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
User32FreeString(PWSTR String)
|
|
||||||
{
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, String);
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
Init(VOID)
|
Init(VOID)
|
||||||
{
|
{
|
||||||
DWORD Status;
|
DWORD Status;
|
||||||
|
|
||||||
ProcessHeap = RtlGetProcessHeap();
|
|
||||||
|
|
||||||
/* Set up the kernel callbacks. */
|
/* Set up the kernel callbacks. */
|
||||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
|
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
|
||||||
(PVOID)User32CallWindowProcFromKernel;
|
(PVOID)User32CallWindowProcFromKernel;
|
||||||
|
@ -75,6 +34,8 @@ Init(VOID)
|
||||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
|
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
|
||||||
(PVOID)User32SendNCCALCSIZEMessageForKernel;
|
(PVOID)User32SendNCCALCSIZEMessageForKernel;
|
||||||
|
|
||||||
|
UserSetupInternalPos();
|
||||||
|
|
||||||
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: stubs.c,v 1.14 2002/09/08 10:23:10 chorns Exp $
|
/* $Id: stubs.c,v 1.15 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -11,11 +11,6 @@
|
||||||
*/
|
*/
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
WINBOOL STDCALL
|
|
||||||
ScreenToClient(HWND hWnd, LPPOINT lpPoint)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WINBOOL
|
WINBOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
AnyPopup(VOID)
|
AnyPopup(VOID)
|
||||||
|
@ -289,19 +284,6 @@ LockWorkStation(VOID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
STDCALL
|
|
||||||
MapWindowPoints(
|
|
||||||
HWND hWndFrom,
|
|
||||||
HWND hWndTo,
|
|
||||||
LPPOINT lpPoints,
|
|
||||||
UINT cPoints)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WINBOOL
|
WINBOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
MessageBeep(
|
MessageBeep(
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: winhelp.c,v 1.1 2002/08/27 06:40:15 robd Exp $
|
/* $Id: winhelp.c,v 1.2 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/misc/winhelp.c
|
* FILE: lib/user32/misc/winhelp.c
|
||||||
|
@ -123,7 +123,7 @@ WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
|
||||||
lpwh->ofsData = 0;
|
lpwh->ofsData = 0;
|
||||||
}
|
}
|
||||||
GlobalUnlock(hwh);
|
GlobalUnlock(hwh);
|
||||||
return SendMessage(hDest, WM_WINHELP, hWnd, (LPARAM)hwh);
|
return SendMessage(hDest, WM_WINHELP, (WPARAM)hWnd, (LPARAM)hwh);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL
|
WINBOOL
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: accel.c,v 1.3 2002/09/08 10:23:11 chorns Exp $
|
/* $Id: accel.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -67,7 +67,7 @@ CreateAcceleratorTableW(LPACCEL lpaccl,
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
DestroyAcceleratorTable(HACCEL hAccel)
|
DestroyAcceleratorTable(HACCEL hAccel)
|
||||||
{
|
{
|
||||||
User32FreeHeap(hAccel);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, hAccel);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,11 @@ LoadAcceleratorsA(HINSTANCE hInstance,
|
||||||
{
|
{
|
||||||
LPWSTR lpTableNameW;
|
LPWSTR lpTableNameW;
|
||||||
HACCEL Res;
|
HACCEL Res;
|
||||||
lpTableNameW = User32ConvertString(lpTableName);
|
UNICODE_STRING lpTableNameString;
|
||||||
|
RtlCreateUnicodeStringFromAsciiz(&lpTableNameString, (LPSTR)lpTableName);
|
||||||
|
lpTableNameW = lpTableNameString.Buffer;
|
||||||
Res = LoadAcceleratorsW(hInstance, lpTableNameW);
|
Res = LoadAcceleratorsW(hInstance, lpTableNameW);
|
||||||
User32FreeString(lpTableName);
|
RtlFreeUnicodeString(&lpTableNameString);
|
||||||
return(Res);
|
return(Res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +105,7 @@ LoadAcceleratorsW(HINSTANCE hInstance,
|
||||||
Mem = LoadResource(hInstance, Rsrc);
|
Mem = LoadResource(hInstance, Rsrc);
|
||||||
Size = SizeofResource(hInstance, Rsrc);
|
Size = SizeofResource(hInstance, Rsrc);
|
||||||
AccelTableRsrc = LockResource(Mem);
|
AccelTableRsrc = LockResource(Mem);
|
||||||
AccelTable = User32AllocHeap(Size);
|
AccelTable = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
|
||||||
memcpy(AccelTable, AccelTableRsrc, Size);
|
memcpy(AccelTable, AccelTableRsrc, Size);
|
||||||
return((HACCEL)AccelTable);
|
return((HACCEL)AccelTable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: bitmap.c,v 1.4 2002/09/08 10:23:11 chorns Exp $
|
/* $Id: bitmap.c,v 1.5 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -44,13 +44,15 @@ LoadImageA(HINSTANCE hinst,
|
||||||
{
|
{
|
||||||
LPWSTR lpszWName;
|
LPWSTR lpszWName;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
UNICODE_STRING NameString;
|
||||||
|
|
||||||
if (HIWORD(lpszName))
|
if (HIWORD(lpszName))
|
||||||
{
|
{
|
||||||
lpszWName = User32ConvertString(lpszName);
|
RtlCreateUnicodeStringFromAsciiz(&NameString, (LPSTR)lpszName);
|
||||||
|
lpszWName = NameString.Buffer;
|
||||||
Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
|
Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
|
||||||
cyDesired, fuLoad);
|
cyDesired, fuLoad);
|
||||||
User32FreeString(lpszWName);
|
RtlFreeUnicodeString(&NameString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: cursor.c,v 1.3 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: cursor.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/cursor.c
|
* FILE: lib/user32/windows/cursor.c
|
||||||
|
@ -121,8 +121,13 @@ LoadCursorA(HINSTANCE hInstance,
|
||||||
HCURSOR STDCALL
|
HCURSOR STDCALL
|
||||||
LoadCursorFromFileA(LPCSTR lpFileName)
|
LoadCursorFromFileA(LPCSTR lpFileName)
|
||||||
{
|
{
|
||||||
return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0,
|
UNICODE_STRING FileName;
|
||||||
LR_LOADFROMFILE | LR_DEFAULTSIZE));
|
HCURSOR Result;
|
||||||
|
RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
|
||||||
|
Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0,
|
||||||
|
LR_LOADFROMFILE | LR_DEFAULTSIZE);
|
||||||
|
RtlFreeUnicodeString(&FileName);
|
||||||
|
return(Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
HCURSOR STDCALL
|
HCURSOR STDCALL
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: defwnd.c,v 1.9 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: defwnd.c,v 1.10 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <user32/wininternal.h>
|
#include <user32/wininternal.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
@ -60,8 +61,17 @@ static COLORREF SysColours[] =
|
||||||
RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
|
RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ATOM AtomInternalPos;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
UserSetupInternalPos(VOID)
|
||||||
|
{
|
||||||
|
LPSTR Str = "SysIP";
|
||||||
|
AtomInternalPos = GlobalAddAtomA(Str);
|
||||||
|
}
|
||||||
|
|
||||||
/* ReactOS extension */
|
/* ReactOS extension */
|
||||||
HPEN STDCALL
|
HPEN STDCALL
|
||||||
GetSysColorPen(int nIndex)
|
GetSysColorPen(int nIndex)
|
||||||
|
@ -100,6 +110,24 @@ DefFrameProcW(HWND hWnd,
|
||||||
BOOL
|
BOOL
|
||||||
DefWndRedrawIconTitle(HWND hWnd)
|
DefWndRedrawIconTitle(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd,
|
||||||
|
(LPSTR)(DWORD)AtomInternalPos);
|
||||||
|
if (lpPos != NULL)
|
||||||
|
{
|
||||||
|
if (lpPos->IconTitle != NULL)
|
||||||
|
{
|
||||||
|
SendMessageA(lpPos->IconTitle, WM_SHOWWINDOW, TRUE, 0);
|
||||||
|
InvalidateRect(lpPos->IconTitle, NULL, TRUE);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
UserHasMenu(HWND hWnd, ULONG Style)
|
||||||
|
{
|
||||||
|
return(!(Style & WS_CHILD) && GetWindowLong(hWnd, GWL_ID) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -292,8 +320,9 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
|
||||||
if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
|
if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
|
||||||
else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
|
else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
|
||||||
SetBkMode( hdc, TRANSPARENT );
|
SetBkMode( hdc, TRANSPARENT );
|
||||||
DrawTextA( hdc, buffer, -1, &r,
|
/*DrawTextA( hdc, buffer, -1, &r,
|
||||||
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
|
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );*/
|
||||||
|
TextOutA(hdc, r.left, r.top, buffer, strlen(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,21 +479,342 @@ DefWndPaintNC(HWND hWnd, HRGN clip)
|
||||||
LRESULT
|
LRESULT
|
||||||
DefWndHitTestNC(HWND hWnd, POINT Point)
|
DefWndHitTestNC(HWND hWnd, POINT Point)
|
||||||
{
|
{
|
||||||
|
RECT WindowRect;
|
||||||
|
ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
|
||||||
|
ULONG ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
||||||
|
|
||||||
|
GetWindowRect(hWnd, &WindowRect);
|
||||||
|
|
||||||
|
if (!PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
return(HTNOWHERE);
|
||||||
|
}
|
||||||
|
if (Style & WS_MINIMIZE)
|
||||||
|
{
|
||||||
|
return(HTCAPTION);
|
||||||
|
}
|
||||||
|
if (UserHasThickFrameStyle(Style, ExStyle))
|
||||||
|
{
|
||||||
|
InflateRect(&WindowRect, -GetSystemMetrics(SM_CXFRAME),
|
||||||
|
-GetSystemMetrics(SM_CYFRAME));
|
||||||
|
if (!PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
if (Point.y < WindowRect.top)
|
||||||
|
{
|
||||||
|
if (Point.x < (WindowRect.left + GetSystemMetrics(SM_CXSIZE)))
|
||||||
|
{
|
||||||
|
return(HTTOPLEFT);
|
||||||
|
}
|
||||||
|
if (Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXSIZE)))
|
||||||
|
{
|
||||||
|
return(HTTOPRIGHT);
|
||||||
|
}
|
||||||
|
return(HTTOP);
|
||||||
|
}
|
||||||
|
if (Point.y >= WindowRect.bottom)
|
||||||
|
{
|
||||||
|
if (Point.x < (WindowRect.left + GetSystemMetrics(SM_CXSIZE)))
|
||||||
|
{
|
||||||
|
return(HTBOTTOMLEFT);
|
||||||
|
}
|
||||||
|
if (Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXSIZE)))
|
||||||
|
{
|
||||||
|
return(HTBOTTOMRIGHT);
|
||||||
|
}
|
||||||
|
return(HTBOTTOM);
|
||||||
|
}
|
||||||
|
if (Point.x < WindowRect.left)
|
||||||
|
{
|
||||||
|
if (Point.y < (WindowRect.top + GetSystemMetrics(SM_CYSIZE)))
|
||||||
|
{
|
||||||
|
return(HTTOPLEFT);
|
||||||
|
}
|
||||||
|
if (Point.y >= (WindowRect.bottom - GetSystemMetrics(SM_CYSIZE)))
|
||||||
|
{
|
||||||
|
return(HTBOTTOMLEFT);
|
||||||
|
}
|
||||||
|
return(HTLEFT);
|
||||||
|
}
|
||||||
|
if (Point.x >= WindowRect.right)
|
||||||
|
{
|
||||||
|
if (Point.y < (WindowRect.top + GetSystemMetrics(SM_CYSIZE)))
|
||||||
|
{
|
||||||
|
return(HTTOPRIGHT);
|
||||||
|
}
|
||||||
|
if (Point.y >= (WindowRect.bottom - GetSystemMetrics(SM_CYSIZE)))
|
||||||
|
{
|
||||||
|
return(HTBOTTOMRIGHT);
|
||||||
|
}
|
||||||
|
return(HTRIGHT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UserHasDlgFrameStyle(Style, ExStyle))
|
||||||
|
{
|
||||||
|
InflateRect(&WindowRect, -GetSystemMetrics(SM_CXDLGFRAME),
|
||||||
|
-GetSystemMetrics(SM_CYDLGFRAME));
|
||||||
|
}
|
||||||
|
else if (UserHasThinFrameStyle(Style, ExStyle))
|
||||||
|
{
|
||||||
|
InflateRect(&WindowRect, -GetSystemMetrics(SM_CXBORDER),
|
||||||
|
-GetSystemMetrics(SM_CYBORDER));
|
||||||
|
}
|
||||||
|
if (!PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
return(HTBORDER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Style & WS_CAPTION) == WS_CAPTION)
|
||||||
|
{
|
||||||
|
WindowRect.top += GetSystemMetrics(SM_CYCAPTION) -
|
||||||
|
GetSystemMetrics(SM_CYBORDER);
|
||||||
|
if (!PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW))
|
||||||
|
{
|
||||||
|
WindowRect.left += GetSystemMetrics(SM_CXSIZE);
|
||||||
|
}
|
||||||
|
if (Point.x <= WindowRect.left)
|
||||||
|
{
|
||||||
|
return(HTSYSMENU);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Style & WS_MAXIMIZEBOX)
|
||||||
|
{
|
||||||
|
WindowRect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
||||||
|
}
|
||||||
|
if (Point.x >= WindowRect.right)
|
||||||
|
{
|
||||||
|
return(HTMAXBUTTON);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Style & WS_MINIMIZEBOX)
|
||||||
|
{
|
||||||
|
WindowRect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
||||||
|
}
|
||||||
|
if (Point.x >= WindowRect.right)
|
||||||
|
{
|
||||||
|
return(HTMINBUTTON);
|
||||||
|
}
|
||||||
|
return(HTCAPTION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenToClient(hWnd, &Point);
|
||||||
|
GetClientRect(hWnd, &WindowRect);
|
||||||
|
|
||||||
|
if (PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
return(HTCLIENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Style & WS_VSCROLL)
|
||||||
|
{
|
||||||
|
WindowRect.right += GetSystemMetrics(SM_CXVSCROLL);
|
||||||
|
if (PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
return(HTVSCROLL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Style & WS_HSCROLL)
|
||||||
|
{
|
||||||
|
WindowRect.bottom += GetSystemMetrics(SM_CYHSCROLL);
|
||||||
|
if (PtInRect(&WindowRect, Point))
|
||||||
|
{
|
||||||
|
if ((Style & WS_VSCROLL) &&
|
||||||
|
(Point.x >= (WindowRect.right - GetSystemMetrics(SM_CXVSCROLL))))
|
||||||
|
{
|
||||||
|
return(HTSIZE);
|
||||||
|
}
|
||||||
|
return(HTHSCROLL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UserHasMenu(hWnd, Style))
|
||||||
|
{
|
||||||
|
if (Point.y < 0 && Point.x >= 0 && Point.x <= WindowRect.right)
|
||||||
|
{
|
||||||
|
return(HTMENU);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(HTNOWHERE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DefWndTrackMinMaxBox(HWND hWnd, WPARAM wParam)
|
||||||
|
{
|
||||||
|
HDC hDC = GetWindowDC(hWnd);
|
||||||
|
BOOL Pressed = TRUE;
|
||||||
|
MSG Msg;
|
||||||
|
|
||||||
|
SetCapture(hWnd);
|
||||||
|
|
||||||
|
if (wParam == HTMINBUTTON)
|
||||||
|
{
|
||||||
|
UserDrawMinButton(hWnd, hDC, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserDrawMaxButton(hWnd, hDC, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
BOOL OldState = Pressed;
|
||||||
|
|
||||||
|
GetMessageA(hWnd, &Msg, 0, 0);
|
||||||
|
if (Msg.message == WM_LBUTTONUP)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Msg.message != WM_MOUSEMOVE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pressed = DefWndHitTestNC(hWnd, Msg.pt) == wParam;
|
||||||
|
if (Pressed != OldState)
|
||||||
|
{
|
||||||
|
if (wParam == HTMINBUTTON)
|
||||||
|
{
|
||||||
|
UserDrawMinButton(hWnd, hDC, Pressed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserDrawMaxButton(hWnd, hDC, Pressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pressed)
|
||||||
|
{
|
||||||
|
if (wParam == HTMINBUTTON)
|
||||||
|
{
|
||||||
|
UserDrawMinButton(hWnd, hDC, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserDrawMaxButton(hWnd, hDC, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseCapture();
|
||||||
|
ReleaseDC(hWnd, hDC);
|
||||||
|
|
||||||
|
if (!Pressed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wParam == HTMINBUTTON)
|
||||||
|
{
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE,
|
||||||
|
MAKELONG(Msg.pt.x, Msg.pt.y));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND,
|
||||||
|
IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE,
|
||||||
|
MAKELONG(Msg.pt.x, Msg.pt.y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down)
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
HDC hDcMem;
|
||||||
|
HBITMAP hSavedBitmap;
|
||||||
|
|
||||||
|
UserGetInsideRectNC(hWnd, &Rect);
|
||||||
|
hDcMem = CreateCompatibleDC(hDC);
|
||||||
|
hSavedBitmap = SelectObject(hDcMem, hbitmapClose);
|
||||||
|
BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE),
|
||||||
|
GetSystemMetrics(SM_CYSIZE), hDcMem,
|
||||||
|
(GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ?
|
||||||
|
GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY);
|
||||||
|
SelectObject(hDcMem, hSavedBitmap);
|
||||||
|
DeleteDC(hDcMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT
|
LRESULT
|
||||||
DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case HTCAPTION:
|
||||||
|
{
|
||||||
|
HWND hTopWnd = GetAncestor(hWnd, GA_ROOT);
|
||||||
|
if (SetActiveWindow(hTopWnd) || GetActiveWindow() == hTopWnd)
|
||||||
|
{
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HTSYSMENU:
|
||||||
|
{
|
||||||
|
if (GetWindowLong(hWnd, GWL_STYLE) & WS_SYSMENU)
|
||||||
|
{
|
||||||
|
if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZE))
|
||||||
|
{
|
||||||
|
HDC hDC = GetWindowDC(hWnd);
|
||||||
|
DefWndDrawSysButton(hWnd, hDC, TRUE);
|
||||||
|
ReleaseDC(hWnd, hDC);
|
||||||
|
}
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
|
||||||
|
lParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case HTMENU:
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTHSCROLL:
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTVSCROLL:
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTMINBUTTON:
|
||||||
|
case HTMAXBUTTON:
|
||||||
|
DefWndTrackMinMaxBox(hWnd, wParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTLEFT:
|
||||||
|
case HTRIGHT:
|
||||||
|
case HTTOP:
|
||||||
|
case HTBOTTOM:
|
||||||
|
case HTTOPLEFT:
|
||||||
|
case HTTOPRIGHT:
|
||||||
|
case HTBOTTOMLEFT:
|
||||||
|
case HTBOTTOMRIGHT:
|
||||||
|
SendMessageA(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT
|
LRESULT
|
||||||
DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
/* FIXME: Implement this. */
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT
|
LRESULT
|
||||||
DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
|
DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
|
/* FIXME: Implement this. */
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -624,6 +974,7 @@ LRESULT
|
||||||
DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
|
DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
|
||||||
{
|
{
|
||||||
/* FIXME: Implement this. */
|
/* FIXME: Implement this. */
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
|
@ -1022,7 +1373,7 @@ DefWindowProcA(HWND hWnd,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
static ATOM WindowTextAtom = 0;
|
static LPSTR WindowTextAtom = 0;
|
||||||
PSTR WindowText;
|
PSTR WindowText;
|
||||||
|
|
||||||
switch (Msg)
|
switch (Msg)
|
||||||
|
@ -1032,8 +1383,10 @@ DefWindowProcA(HWND hWnd,
|
||||||
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
|
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
|
||||||
if (HIWORD(Cs->lpszName))
|
if (HIWORD(Cs->lpszName))
|
||||||
{
|
{
|
||||||
WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomA");
|
WindowTextAtom =
|
||||||
WindowText = User32AllocHeap(strlen(Cs->lpszName) * sizeof(CHAR));
|
(LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA");
|
||||||
|
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||||
|
strlen(Cs->lpszName) * sizeof(CHAR));
|
||||||
strcpy(WindowText, Cs->lpszName);
|
strcpy(WindowText, Cs->lpszName);
|
||||||
SetPropA(hWnd, WindowTextAtom, WindowText);
|
SetPropA(hWnd, WindowTextAtom, WindowText);
|
||||||
}
|
}
|
||||||
|
@ -1057,7 +1410,7 @@ DefWindowProcA(HWND hWnd,
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
return(wcslen(WindowText));
|
return(strlen(WindowText));
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_GETTEXT:
|
case WM_GETTEXT:
|
||||||
|
@ -1071,22 +1424,24 @@ DefWindowProcA(HWND hWnd,
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
strncpy(lParam, WindowText, wParam);
|
strncpy((LPSTR)lParam, WindowText, wParam);
|
||||||
return(min(wParam, wcslen(WindowText)));
|
return(min(wParam, strlen(WindowText)));
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SETTEXT:
|
case WM_SETTEXT:
|
||||||
{
|
{
|
||||||
if (WindowTextAtom != 0)
|
if (WindowTextAtom != 0)
|
||||||
{
|
{
|
||||||
WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomW");
|
WindowTextAtom =
|
||||||
|
(LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");
|
||||||
}
|
}
|
||||||
if (WindowTextAtom != 0 &&
|
if (WindowTextAtom != 0 &&
|
||||||
(WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
|
(WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
|
||||||
{
|
{
|
||||||
User32FreeHeap(WindowText);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
|
||||||
}
|
}
|
||||||
WindowText = User32AllocHeap(strlen((PSTR)lParam) * sizeof(CHAR));
|
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||||
|
strlen((PSTR)lParam) * sizeof(CHAR));
|
||||||
strcpy(WindowText, (PSTR)lParam);
|
strcpy(WindowText, (PSTR)lParam);
|
||||||
SetPropA(hWnd, WindowTextAtom, WindowText);
|
SetPropA(hWnd, WindowTextAtom, WindowText);
|
||||||
}
|
}
|
||||||
|
@ -1096,11 +1451,11 @@ DefWindowProcA(HWND hWnd,
|
||||||
if (WindowTextAtom != 0 &&
|
if (WindowTextAtom != 0 &&
|
||||||
(WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
|
(WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
|
||||||
{
|
{
|
||||||
User32FreeHeap(WindowText);
|
RtlFreeHeap(GetProcessHeap(), 0, WindowText);
|
||||||
}
|
}
|
||||||
if (WindowTextAtom != 0)
|
if (WindowTextAtom != 0)
|
||||||
{
|
{
|
||||||
GlobalDeleteAtom(WindowTextAtom);
|
GlobalDeleteAtom((ATOM)(ULONG)WindowTextAtom);
|
||||||
}
|
}
|
||||||
/* FIXME: Destroy scroll bars here as well. */
|
/* FIXME: Destroy scroll bars here as well. */
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -1121,7 +1476,7 @@ DefWindowProcW(HWND hWnd,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
static ATOM WindowTextAtom = 0;
|
static LPWSTR WindowTextAtom = 0;
|
||||||
PWSTR WindowText;
|
PWSTR WindowText;
|
||||||
|
|
||||||
switch (Msg)
|
switch (Msg)
|
||||||
|
@ -1131,8 +1486,10 @@ DefWindowProcW(HWND hWnd,
|
||||||
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
|
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
|
||||||
if (HIWORD(Cs->lpszName))
|
if (HIWORD(Cs->lpszName))
|
||||||
{
|
{
|
||||||
WindowTextAtom = GlobalAddAtomW(L"USER32!WindowTextAtomW");
|
WindowTextAtom =
|
||||||
WindowText = User32AllocHeap(wcslen(Cs->lpszName) * sizeof(WCHAR));
|
(LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW");
|
||||||
|
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||||
|
wcslen(Cs->lpszName) * sizeof(WCHAR));
|
||||||
wcscpy(WindowText, Cs->lpszName);
|
wcscpy(WindowText, Cs->lpszName);
|
||||||
SetPropW(hWnd, WindowTextAtom, WindowText);
|
SetPropW(hWnd, WindowTextAtom, WindowText);
|
||||||
}
|
}
|
||||||
|
@ -1178,14 +1535,16 @@ DefWindowProcW(HWND hWnd,
|
||||||
{
|
{
|
||||||
if (WindowTextAtom != 0)
|
if (WindowTextAtom != 0)
|
||||||
{
|
{
|
||||||
WindowTextAtom = GlobalAddAtom(L"USER32!WindowTextAtomW");
|
WindowTextAtom =
|
||||||
|
(LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");
|
||||||
}
|
}
|
||||||
if (WindowTextAtom != 0 &&
|
if (WindowTextAtom != 0 &&
|
||||||
(WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
|
(WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
|
||||||
{
|
{
|
||||||
User32FreeHeap(WindowText);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
|
||||||
}
|
}
|
||||||
WindowText = User32AllocHeap(wcslen((PWSTR)lParam) * sizeof(WCHAR));
|
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||||
|
wcslen((PWSTR)lParam) * sizeof(WCHAR));
|
||||||
wcscpy(WindowText, (PWSTR)lParam);
|
wcscpy(WindowText, (PWSTR)lParam);
|
||||||
SetPropW(hWnd, WindowTextAtom, WindowText);
|
SetPropW(hWnd, WindowTextAtom, WindowText);
|
||||||
}
|
}
|
||||||
|
@ -1195,11 +1554,11 @@ DefWindowProcW(HWND hWnd,
|
||||||
if (WindowTextAtom != 0 &&
|
if (WindowTextAtom != 0 &&
|
||||||
(WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
|
(WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
|
||||||
{
|
{
|
||||||
User32FreeHeap(WindowText);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
|
||||||
}
|
}
|
||||||
if (WindowTextAtom != 0)
|
if (WindowTextAtom != 0)
|
||||||
{
|
{
|
||||||
GlobalDeleteAtom(WindowTextAtom);
|
GlobalDeleteAtom((ATOM)(DWORD)WindowTextAtom);
|
||||||
}
|
}
|
||||||
/* FIXME: Destroy scroll bars here as well. */
|
/* FIXME: Destroy scroll bars here as well. */
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: menu.c,v 1.5 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: menu.c,v 1.6 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/menu.c
|
* FILE: lib/user32/windows/menu.c
|
||||||
|
@ -72,7 +72,7 @@ MenuFindItem(HMENU* hMenu, UINT* nPos, UINT wFlags)
|
||||||
POPUP_MENU* Menu;
|
POPUP_MENU* Menu;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
if ((*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
|
if ((ULONG)(*hMenu) == 0xFFFF || (Menu = MenuGetMenu(*hMenu)) == NULL)
|
||||||
{
|
{
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: message.c,v 1.10 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: message.c,v 1.11 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <user32.h>
|
#include <user32.h>
|
||||||
|
#include <string.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
LPARAM
|
LPARAM
|
||||||
|
@ -73,7 +74,7 @@ User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
LPSTR TempString;
|
LPSTR TempString;
|
||||||
LPSTR InString;
|
LPSTR InString;
|
||||||
InString = (LPSTR)lParam;
|
InString = (LPSTR)lParam;
|
||||||
TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(lParam));
|
TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(InString));
|
||||||
strcpy(TempString, InString);
|
strcpy(TempString, InString);
|
||||||
RtlInitAnsiString(&AnsiString, TempString);
|
RtlInitAnsiString(&AnsiString, TempString);
|
||||||
UnicodeString.Length = wParam;
|
UnicodeString.Length = wParam;
|
||||||
|
@ -109,7 +110,7 @@ User32ConvertToAsciiMessage(UINT* Msg, WPARAM* wParam, LPARAM* lParam)
|
||||||
ANSI_STRING AString;
|
ANSI_STRING AString;
|
||||||
|
|
||||||
CsW = (CREATESTRUCTW*)(*lParam);
|
CsW = (CREATESTRUCTW*)(*lParam);
|
||||||
CsA = User32AllocHeap(sizeof(CREATESTRUCTA));
|
CsA = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(CREATESTRUCTA));
|
||||||
memcpy(CsA, CsW, sizeof(CREATESTRUCTW));
|
memcpy(CsA, CsW, sizeof(CREATESTRUCTW));
|
||||||
|
|
||||||
RtlInitUnicodeString(&UString, CsW->lpszName);
|
RtlInitUnicodeString(&UString, CsW->lpszName);
|
||||||
|
@ -476,7 +477,7 @@ RegisterWindowMessageA(LPCSTR lpString)
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
UINT Atom;
|
UINT Atom;
|
||||||
|
|
||||||
Result = RtlCreateUnicodeStringFromAsciiz(&String, lpString);
|
Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: prop.c,v 1.4 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: prop.c,v 1.5 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -63,20 +63,22 @@ HANDLE STDCALL
|
||||||
GetPropA(HWND hWnd, LPCSTR lpString)
|
GetPropA(HWND hWnd, LPCSTR lpString)
|
||||||
{
|
{
|
||||||
PWSTR lpWString;
|
PWSTR lpWString;
|
||||||
|
UNICODE_STRING UString;
|
||||||
HANDLE Ret;
|
HANDLE Ret;
|
||||||
if (HIWORD(lpString))
|
if (HIWORD(lpString))
|
||||||
{
|
{
|
||||||
lpWString = User32ConvertString(lpString);
|
RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
|
||||||
|
lpWString = UString.Buffer;
|
||||||
if (lpWString == NULL)
|
if (lpWString == NULL)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Ret = GetPropW(hWnd, lpWString);
|
Ret = GetPropW(hWnd, lpWString);
|
||||||
User32FreeString(lpWString);
|
RtlFreeUnicodeString(&UString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ret = GetPropW(hWnd, lpString);
|
Ret = GetPropW(hWnd, (LPWSTR)lpString);
|
||||||
}
|
}
|
||||||
return(Ret);
|
return(Ret);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,7 @@ GetPropW(HWND hWnd, LPCWSTR lpString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Atom = LOWORD(lpString);
|
Atom = LOWORD((DWORD)lpString);
|
||||||
}
|
}
|
||||||
return(NtUserGetProp(hWnd, Atom));
|
return(NtUserGetProp(hWnd, Atom));
|
||||||
}
|
}
|
||||||
|
@ -100,17 +102,19 @@ HANDLE STDCALL
|
||||||
RemovePropA(HWND hWnd, LPCSTR lpString)
|
RemovePropA(HWND hWnd, LPCSTR lpString)
|
||||||
{
|
{
|
||||||
PWSTR lpWString;
|
PWSTR lpWString;
|
||||||
|
UNICODE_STRING UString;
|
||||||
HANDLE Ret;
|
HANDLE Ret;
|
||||||
|
|
||||||
if (HIWORD(lpString))
|
if (HIWORD(lpString))
|
||||||
{
|
{
|
||||||
lpWString = User32ConvertString(lpString);
|
RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
|
||||||
|
lpWString = UString.Buffer;
|
||||||
if (lpWString == NULL)
|
if (lpWString == NULL)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Ret = RemovePropW(hWnd, lpWString);
|
Ret = RemovePropW(hWnd, lpWString);
|
||||||
User32FreeString(lpWString);
|
RtlFreeUnicodeString(&UString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,7 +134,7 @@ RemovePropW(HWND hWnd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Atom = LOWORD(lpString);
|
Atom = LOWORD((DWORD)lpString);
|
||||||
}
|
}
|
||||||
return(NtUserRemoveProp(hWnd, Atom));
|
return(NtUserRemoveProp(hWnd, Atom));
|
||||||
}
|
}
|
||||||
|
@ -139,21 +143,23 @@ WINBOOL STDCALL
|
||||||
SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
|
SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
|
||||||
{
|
{
|
||||||
PWSTR lpWString;
|
PWSTR lpWString;
|
||||||
|
UNICODE_STRING UString;
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
|
|
||||||
if (HIWORD(lpString))
|
if (HIWORD(lpString))
|
||||||
{
|
{
|
||||||
lpWString = User32ConvertString(lpString);
|
RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
|
||||||
|
lpWString = UString.Buffer;
|
||||||
if (lpWString == NULL)
|
if (lpWString == NULL)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Ret = SetPropW(hWnd, lpWString, hData);
|
Ret = SetPropW(hWnd, lpWString, hData);
|
||||||
User32FreeString(lpWString);
|
RtlFreeUnicodeString(&UString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ret = SetPropW(hWnd, lpString, hData);
|
Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
|
||||||
}
|
}
|
||||||
return(Ret);
|
return(Ret);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +174,7 @@ SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Atom = LOWORD(lpString);
|
Atom = LOWORD((DWORD)lpString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(NtUserSetProp(hWnd, Atom, hData));
|
return(NtUserSetProp(hWnd, Atom, hData));
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: rect.c,v 1.10 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: rect.c,v 1.11 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -87,6 +87,7 @@ IntersectRect(LPRECT lprcDst,
|
||||||
lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
|
lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
|
||||||
lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
|
lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
|
||||||
lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
|
lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
|
||||||
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: text.c,v 1.3 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: text.c,v 1.4 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -83,6 +83,7 @@ CharNextExA(
|
||||||
LPCSTR lpCurrentChar,
|
LPCSTR lpCurrentChar,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
return (LPSTR)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPWSTR
|
LPWSTR
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.13 2002/09/08 10:23:12 chorns Exp $
|
/* $Id: window.c,v 1.14 2002/09/17 23:46:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -50,8 +50,7 @@ User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
Result.Rect = CallbackArgs->Rect;
|
Result.Rect = CallbackArgs->Rect;
|
||||||
}
|
}
|
||||||
DbgPrint("Returning result %d.\n", Result);
|
DbgPrint("Returning result %d.\n", Result);
|
||||||
ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
|
return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
|
||||||
/* Doesn't return. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -75,8 +74,7 @@ User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
0, (LPARAM)&CallbackArgs->MinMaxInfo);
|
0, (LPARAM)&CallbackArgs->MinMaxInfo);
|
||||||
Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
|
Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
|
||||||
DbgPrint("Returning result %d.\n", Result);
|
DbgPrint("Returning result %d.\n", Result);
|
||||||
ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
|
return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
|
||||||
/* Doesn't return. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -99,8 +97,7 @@ User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
|
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
|
||||||
(LPARAM)&CallbackArgs->CreateStruct);
|
(LPARAM)&CallbackArgs->CreateStruct);
|
||||||
DbgPrint("Returning result %d.\n", Result);
|
DbgPrint("Returning result %d.\n", Result);
|
||||||
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
|
||||||
/* Doesn't return. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -123,8 +120,7 @@ User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
|
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
|
||||||
(LPARAM)&CallbackArgs->CreateStruct);
|
(LPARAM)&CallbackArgs->CreateStruct);
|
||||||
DbgPrint("Returning result %d.\n", Result);
|
DbgPrint("Returning result %d.\n", Result);
|
||||||
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
|
||||||
/* Doesn't return. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -164,8 +160,7 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
|
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
|
||||||
CallbackArgs->Msg, CallbackArgs->wParam,
|
CallbackArgs->Msg, CallbackArgs->wParam,
|
||||||
CallbackArgs->lParam);
|
CallbackArgs->lParam);
|
||||||
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
|
||||||
/* Doesn't return. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
|
@ -582,8 +577,7 @@ GetAncestor(HWND hwnd, UINT gaFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
GetClientRect(HWND hWnd,
|
GetClientRect(HWND hWnd, LPRECT lpRect)
|
||||||
LPRECT lpRect)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -918,4 +912,30 @@ WindowFromPoint(POINT Point)
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int STDCALL
|
||||||
|
MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
|
||||||
|
{
|
||||||
|
POINT FromOffset, ToOffset;
|
||||||
|
LONG XMove, YMove;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
NtUserGetClientOrigin(hWndFrom, &FromOffset);
|
||||||
|
NtUserGetClientOrigin(hWndTo, &ToOffset);
|
||||||
|
XMove = ToOffset.x - FromOffset.x;
|
||||||
|
YMove = ToOffset.y - FromOffset.y;
|
||||||
|
for (i = 0; i < cPoints; i++)
|
||||||
|
{
|
||||||
|
lpPoints[i].x += XMove;
|
||||||
|
lpPoints[i].y += YMove;
|
||||||
|
}
|
||||||
|
return(MAKELONG(LOWORD(XMove), LOWORD(YMove)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WINBOOL STDCALL
|
||||||
|
ScreenToClient(HWND hWnd, LPPOINT lpPoint)
|
||||||
|
{
|
||||||
|
return(MapWindowPoints(NULL, hWnd, lpPoint, 1));
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue