mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
implemented maximize/restore and minimize buttons for windows, minimize and restore need to be fixed, they don't work properly
svn path=/trunk/; revision=7129
This commit is contained in:
parent
764ff71a49
commit
e437baff45
7 changed files with 124 additions and 35 deletions
|
@ -887,11 +887,11 @@ STDCALL
|
|||
NtUserGetWindowDC(
|
||||
HWND hWnd);
|
||||
|
||||
DWORD
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserGetWindowPlacement(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1);
|
||||
HWND hWnd,
|
||||
WINDOWPLACEMENT *lpwndpl);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
@ -1546,11 +1546,11 @@ NtUserSetWindowLong(
|
|||
LONG NewValue,
|
||||
BOOL Ansi);
|
||||
|
||||
DWORD
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserSetWindowPlacement(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1);
|
||||
HWND hWnd,
|
||||
WINDOWPLACEMENT *lpwndpl);
|
||||
|
||||
BOOL
|
||||
STDCALL NtUserSetWindowPos(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: defwnd.c,v 1.110 2003/12/11 16:24:06 gvg Exp $
|
||||
/* $Id: defwnd.c,v 1.111 2003/12/19 23:20:05 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -752,12 +752,38 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
|
|||
LRESULT
|
||||
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
||||
{
|
||||
WINDOWPLACEMENT wp;
|
||||
|
||||
switch (wParam & 0xfff0)
|
||||
{
|
||||
case SC_MOVE:
|
||||
case SC_SIZE:
|
||||
DefWndDoSizeMove(hWnd, wParam);
|
||||
break;
|
||||
case SC_MINIMIZE:
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
if(GetWindowPlacement(hWnd, &wp))
|
||||
{
|
||||
wp.showCmd = SW_MINIMIZE;
|
||||
SetWindowPlacement(hWnd, &wp);
|
||||
}
|
||||
break;
|
||||
case SC_MAXIMIZE:
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
if(GetWindowPlacement(hWnd, &wp))
|
||||
{
|
||||
wp.showCmd = SW_MAXIMIZE;
|
||||
SetWindowPlacement(hWnd, &wp);
|
||||
}
|
||||
break;
|
||||
case SC_RESTORE:
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
if(GetWindowPlacement(hWnd, &wp))
|
||||
{
|
||||
wp.showCmd = SW_RESTORE;
|
||||
SetWindowPlacement(hWnd, &wp);
|
||||
}
|
||||
break;
|
||||
case SC_CLOSE:
|
||||
SendMessageA(hWnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
|
|
|
@ -807,7 +807,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
break;
|
||||
case HTMAXBUTTON:
|
||||
Btn = DFCS_CAPTIONMAX;
|
||||
SCMsg = SC_MAXIMIZE;
|
||||
SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
|
||||
HasBtn = (Style & WS_MAXIMIZEBOX);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: window.c,v 1.90 2003/12/18 16:47:27 navaraf Exp $
|
||||
/* $Id: window.c,v 1.91 2003/12/19 23:20:05 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -1124,14 +1124,13 @@ GetWindowModuleFileNameW(HWND hwnd,
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
WINBOOL STDCALL
|
||||
GetWindowPlacement(HWND hWnd,
|
||||
WINDOWPLACEMENT *lpwndpl)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
return (WINBOOL)NtUserGetWindowPlacement(hWnd, lpwndpl);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1419,8 +1418,7 @@ WINBOOL STDCALL
|
|||
SetWindowPlacement(HWND hWnd,
|
||||
CONST WINDOWPLACEMENT *lpwndpl)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
return (WINBOOL)NtUserSetWindowPlacement(hWnd, (WINDOWPLACEMENT *)lpwndpl);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ typedef struct _WINDOW_OBJECT
|
|||
WNDPROC WndProcW;
|
||||
PETHREAD OwnerThread;
|
||||
HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/
|
||||
RECT NormalRect;
|
||||
} WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */
|
||||
|
||||
/* Window flags. */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.168 2003/12/18 13:00:56 gvg Exp $
|
||||
/* $Id: window.c,v 1.169 2003/12/19 23:20:06 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -2629,15 +2629,50 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserGetWindowPlacement(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
BOOL STDCALL
|
||||
NtUserGetWindowPlacement(HWND hWnd,
|
||||
WINDOWPLACEMENT *lpwndpl)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
WINDOWPLACEMENT Safepl;
|
||||
NTSTATUS Status;
|
||||
|
||||
return 0;
|
||||
WindowObject = IntGetWindowObject(hWnd);
|
||||
if (WindowObject == NULL)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return FALSE;
|
||||
}
|
||||
if(Safepl.length != sizeof(WINDOWPLACEMENT))
|
||||
{
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME - fill structure */
|
||||
Safepl.flags = 0;
|
||||
Safepl.showCmd = ((WindowObject->Style & WINDOWOBJECT_RESTOREMAX) ? SW_MAXIMIZE : SW_SHOWNORMAL);
|
||||
|
||||
Status = MmCopyToCaller(lpwndpl, &Safepl, sizeof(WINDOWPLACEMENT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2999,15 +3034,41 @@ NtUserSetWindowFNID(DWORD Unknown0,
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowPlacement(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
BOOL STDCALL
|
||||
NtUserSetWindowPlacement(HWND hWnd,
|
||||
WINDOWPLACEMENT *lpwndpl)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
WINDOWPLACEMENT Safepl;
|
||||
NTSTATUS Status;
|
||||
|
||||
return 0;
|
||||
WindowObject = IntGetWindowObject(hWnd);
|
||||
if (WindowObject == NULL)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return FALSE;
|
||||
}
|
||||
if(Safepl.length != sizeof(WINDOWPLACEMENT))
|
||||
{
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME - change window status */
|
||||
WinPosShowWindow(WindowObject->Self, Safepl.showCmd);
|
||||
|
||||
IntReleaseWindowObject(WindowObject);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: winpos.c,v 1.56 2003/12/15 21:51:10 weiden Exp $
|
||||
/* $Id: winpos.c,v 1.57 2003/12/19 23:20:06 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -184,6 +184,11 @@ WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
|
|||
{
|
||||
InternalPos =
|
||||
ExAllocatePool(NonPagedPool, sizeof(INTERNALPOS));
|
||||
if(!InternalPos)
|
||||
{
|
||||
DPRINT1("Failed to allocate INTERNALPOS structure for window 0x%x\n", WindowObject->Self);
|
||||
return NULL;
|
||||
}
|
||||
IntSetProp(WindowObject, AtomInternalPos, InternalPos);
|
||||
InternalPos->IconTitle = 0;
|
||||
InternalPos->NormalRect = WindowObject->WindowRect;
|
||||
|
@ -259,7 +264,7 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
|
|||
WinPosShowIconTitle(WindowObject, FALSE);
|
||||
WindowObject->Style &= ~WS_MINIMIZE;
|
||||
}
|
||||
WindowObject->Style |= WS_MINIMIZE;
|
||||
WindowObject->Style |= WS_MAXIMIZE;
|
||||
NtGdiSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y,
|
||||
Size.x, Size.y);
|
||||
break;
|
||||
|
@ -287,13 +292,11 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
|
|||
{
|
||||
return(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowObject->Style &= ~WS_MAXIMIZE;
|
||||
}
|
||||
*NewPos = InternalPos->NormalRect;
|
||||
NewPos->right -= NewPos->left;
|
||||
NewPos->bottom -= NewPos->top;
|
||||
DPRINT1("Restoring window to %d, %d, %d, %d\n", NewPos->left, NewPos->top, NewPos->right, NewPos->bottom);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue