mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 00:31:27 +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(
|
NtUserGetWindowDC(
|
||||||
HWND hWnd);
|
HWND hWnd);
|
||||||
|
|
||||||
DWORD
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserGetWindowPlacement(
|
NtUserGetWindowPlacement(
|
||||||
DWORD Unknown0,
|
HWND hWnd,
|
||||||
DWORD Unknown1);
|
WINDOWPLACEMENT *lpwndpl);
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -1546,11 +1546,11 @@ NtUserSetWindowLong(
|
||||||
LONG NewValue,
|
LONG NewValue,
|
||||||
BOOL Ansi);
|
BOOL Ansi);
|
||||||
|
|
||||||
DWORD
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserSetWindowPlacement(
|
NtUserSetWindowPlacement(
|
||||||
DWORD Unknown0,
|
HWND hWnd,
|
||||||
DWORD Unknown1);
|
WINDOWPLACEMENT *lpwndpl);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL NtUserSetWindowPos(
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -752,12 +752,38 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
|
||||||
LRESULT
|
LRESULT
|
||||||
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
||||||
{
|
{
|
||||||
|
WINDOWPLACEMENT wp;
|
||||||
|
|
||||||
switch (wParam & 0xfff0)
|
switch (wParam & 0xfff0)
|
||||||
{
|
{
|
||||||
case SC_MOVE:
|
case SC_MOVE:
|
||||||
case SC_SIZE:
|
case SC_SIZE:
|
||||||
DefWndDoSizeMove(hWnd, wParam);
|
DefWndDoSizeMove(hWnd, wParam);
|
||||||
break;
|
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:
|
case SC_CLOSE:
|
||||||
SendMessageA(hWnd, WM_CLOSE, 0, 0);
|
SendMessageA(hWnd, WM_CLOSE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -807,7 +807,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
||||||
break;
|
break;
|
||||||
case HTMAXBUTTON:
|
case HTMAXBUTTON:
|
||||||
Btn = DFCS_CAPTIONMAX;
|
Btn = DFCS_CAPTIONMAX;
|
||||||
SCMsg = SC_MAXIMIZE;
|
SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
|
||||||
HasBtn = (Style & WS_MAXIMIZEBOX);
|
HasBtn = (Style & WS_MAXIMIZEBOX);
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -1124,14 +1124,13 @@ GetWindowModuleFileNameW(HWND hwnd,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
GetWindowPlacement(HWND hWnd,
|
GetWindowPlacement(HWND hWnd,
|
||||||
WINDOWPLACEMENT *lpwndpl)
|
WINDOWPLACEMENT *lpwndpl)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return (WINBOOL)NtUserGetWindowPlacement(hWnd, lpwndpl);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1419,8 +1418,7 @@ WINBOOL STDCALL
|
||||||
SetWindowPlacement(HWND hWnd,
|
SetWindowPlacement(HWND hWnd,
|
||||||
CONST WINDOWPLACEMENT *lpwndpl)
|
CONST WINDOWPLACEMENT *lpwndpl)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return (WINBOOL)NtUserSetWindowPlacement(hWnd, (WINDOWPLACEMENT *)lpwndpl);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ typedef struct _WINDOW_OBJECT
|
||||||
WNDPROC WndProcW;
|
WNDPROC WndProcW;
|
||||||
PETHREAD OwnerThread;
|
PETHREAD OwnerThread;
|
||||||
HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/
|
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_OBJECT; /* PWINDOW_OBJECT already declared at top of file */
|
||||||
|
|
||||||
/* Window flags. */
|
/* Window flags. */
|
||||||
|
|
|
@ -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: 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -2629,15 +2629,50 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD STDCALL
|
BOOL STDCALL
|
||||||
NtUserGetWindowPlacement(DWORD Unknown0,
|
NtUserGetWindowPlacement(HWND hWnd,
|
||||||
DWORD Unknown1)
|
WINDOWPLACEMENT *lpwndpl)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
WINDOWPLACEMENT Safepl;
|
||||||
return 0;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
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
|
BOOL STDCALL
|
||||||
NtUserSetWindowPlacement(DWORD Unknown0,
|
NtUserSetWindowPlacement(HWND hWnd,
|
||||||
DWORD Unknown1)
|
WINDOWPLACEMENT *lpwndpl)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
WINDOWPLACEMENT Safepl;
|
||||||
return 0;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
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
|
* 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: 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -184,6 +184,11 @@ WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
|
||||||
{
|
{
|
||||||
InternalPos =
|
InternalPos =
|
||||||
ExAllocatePool(NonPagedPool, sizeof(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);
|
IntSetProp(WindowObject, AtomInternalPos, InternalPos);
|
||||||
InternalPos->IconTitle = 0;
|
InternalPos->IconTitle = 0;
|
||||||
InternalPos->NormalRect = WindowObject->WindowRect;
|
InternalPos->NormalRect = WindowObject->WindowRect;
|
||||||
|
@ -259,7 +264,7 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
|
||||||
WinPosShowIconTitle(WindowObject, FALSE);
|
WinPosShowIconTitle(WindowObject, FALSE);
|
||||||
WindowObject->Style &= ~WS_MINIMIZE;
|
WindowObject->Style &= ~WS_MINIMIZE;
|
||||||
}
|
}
|
||||||
WindowObject->Style |= WS_MINIMIZE;
|
WindowObject->Style |= WS_MAXIMIZE;
|
||||||
NtGdiSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y,
|
NtGdiSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y,
|
||||||
Size.x, Size.y);
|
Size.x, Size.y);
|
||||||
break;
|
break;
|
||||||
|
@ -287,13 +292,11 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
|
||||||
{
|
{
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
else
|
WindowObject->Style &= ~WS_MAXIMIZE;
|
||||||
{
|
|
||||||
WindowObject->Style &= ~WS_MAXIMIZE;
|
|
||||||
}
|
|
||||||
*NewPos = InternalPos->NormalRect;
|
*NewPos = InternalPos->NormalRect;
|
||||||
NewPos->right -= NewPos->left;
|
NewPos->right -= NewPos->left;
|
||||||
NewPos->bottom -= NewPos->top;
|
NewPos->bottom -= NewPos->top;
|
||||||
|
DPRINT1("Restoring window to %d, %d, %d, %d\n", NewPos->left, NewPos->top, NewPos->right, NewPos->bottom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue