mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
- Made a start on implemented window moving.
- Implemented capturing input. - Implemented some of window activation. - Fixed a bug in NtUserGetAncestor - Don't return the desktop window for GA_ROOT. svn path=/trunk/; revision=5287
This commit is contained in:
parent
fc10a5b013
commit
d7c14e4f71
23 changed files with 1006 additions and 199 deletions
|
@ -350,9 +350,11 @@ NtUserFillWindow 4
|
|||
NtUserFindExistingCursorIcon 3
|
||||
NtUserFindWindowEx 4
|
||||
NtUserFlashWindowEx 1
|
||||
NtUserGetActiveWindow 0
|
||||
NtUserGetAltTabInfo 6
|
||||
NtUserGetAncestor 2
|
||||
NtUserGetAsyncKeyState 1
|
||||
NtUserGetCapture 0
|
||||
NtUserGetCaretBlinkTime 0
|
||||
NtUserGetCaretPos 1
|
||||
NtUserGetClassInfo 5
|
||||
|
|
|
@ -4240,6 +4240,14 @@ extern "C" {
|
|||
#define FSHIFT (4)
|
||||
#define FVIRTKEY (1)
|
||||
|
||||
/* MENUINFO structure */
|
||||
#define MIM_MAXHEIGHT 0x00000001
|
||||
#define MIM_BACKGROUND 0x00000002
|
||||
#define MIM_HELPID 0x00000004
|
||||
#define MIM_MENUDATA 0x00000008
|
||||
#define MIM_STYLE 0x00000010
|
||||
#define MIM_APPLYTOSUBMENUS 0x80000000
|
||||
|
||||
/* MENUITEMINFO structure */
|
||||
#define MIIM_CHECKMARKS (8)
|
||||
#define MIIM_DATA (32)
|
||||
|
|
|
@ -973,6 +973,7 @@ extern "C" {
|
|||
#define WM_KEYDOWN (256)
|
||||
#define WM_KEYUP (257)
|
||||
#define WM_KILLFOCUS (8)
|
||||
#define WM_SETVISIBLE (9)
|
||||
#define WM_LBUTTONDBLCLK (515)
|
||||
#define WM_LBUTTONDOWN (513)
|
||||
#define WM_LBUTTONUP (514)
|
||||
|
|
|
@ -1210,15 +1210,15 @@ NtUserSendNotifyMessage(
|
|||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetActiveWindow(
|
||||
DWORD Unknown0);
|
||||
HWND STDCALL
|
||||
NtUserSetActiveWindow(HWND Wnd);
|
||||
HWND STDCALL
|
||||
NtUserGetActiveWindow(VOID);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetCapture(
|
||||
DWORD Unknown0);
|
||||
HWND STDCALL
|
||||
NtUserSetCapture(HWND Wnd);
|
||||
HWND STDCALL
|
||||
NtUserGetCapture(VOID);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.21 2003/07/21 01:59:51 royce Exp $
|
||||
# $Id: Makefile,v 1.22 2003/07/27 11:54:42 dwelch Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -68,7 +68,8 @@ WINDOWS_OBJECTS = \
|
|||
windows/paint.o \
|
||||
windows/prop.o \
|
||||
windows/rect.o \
|
||||
windows/text.o
|
||||
windows/text.o \
|
||||
windows/winpos.o
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
$(MISC_OBJECTS) \
|
||||
|
|
2
reactos/lib/user32/include/cursor.h
Normal file
2
reactos/lib/user32/include/cursor.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
HCURSOR
|
||||
CursorIconToCursor(HICON hIcon, BOOL SemiTransparent);
|
|
@ -5,6 +5,7 @@
|
|||
* PURPOSE: Window management definitions
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <user32/wininternal.h>
|
||||
|
||||
#define IS_ATOM(x) \
|
||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||
|
@ -12,3 +13,9 @@
|
|||
VOID
|
||||
UserSetupInternalPos(VOID);
|
||||
VOID UserDrawSysMenuButton( HWND hWnd, HDC hDC, BOOL down );
|
||||
PINTERNALPOS
|
||||
UserGetInternalPos(HWND hWnd);
|
||||
ULONG
|
||||
UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
ULONG
|
||||
UserHasThickFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
|
|
5
reactos/lib/user32/include/winpos.h
Normal file
5
reactos/lib/user32/include/winpos.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
BOOL
|
||||
WinPosShowIconTitle(HWND hWnd, BOOL bShow);
|
||||
UINT STDCALL
|
||||
WinPosGetMinMaxInfo(HWND hWnd, POINT* MaxSize, POINT* MaxPos,
|
||||
POINT* MinTrack, POINT* MaxTrack);
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.26 2003/07/23 04:52:44 jimtabor Exp $
|
||||
/* $Id: stubs.c,v 1.27 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -163,31 +163,6 @@ EnableScrollBar(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HWND
|
||||
STDCALL
|
||||
GetActiveWindow(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HWND
|
||||
STDCALL
|
||||
GetCapture(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -435,19 +410,6 @@ RegisterHotKey(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
ReleaseCapture(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -484,33 +446,6 @@ ScrollWindowEx(
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HWND
|
||||
STDCALL
|
||||
SetActiveWindow(
|
||||
HWND hWnd)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HWND
|
||||
STDCALL
|
||||
SetCapture(
|
||||
HWND hWnd)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
|
@ -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: cursor.c,v 1.7 2003/07/20 00:06:16 ekohl Exp $
|
||||
/* $Id: cursor.c,v 1.8 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/cursor.c
|
||||
|
@ -203,3 +203,10 @@ ShowCursor(WINBOOL bShow)
|
|||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HCURSOR
|
||||
CursorIconToCursor(HICON hIcon, BOOL SemiTransparent)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: defwnd.c,v 1.56 2003/07/26 15:48:47 dwelch Exp $
|
||||
/* $Id: defwnd.c,v 1.57 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -17,6 +17,8 @@
|
|||
#include <user32/wininternal.h>
|
||||
#include <string.h>
|
||||
#include <menu.h>
|
||||
#include <cursor.h>
|
||||
#include <winpos.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -178,6 +180,13 @@ DefFrameProcW(HWND hWnd,
|
|||
return((LRESULT)0);
|
||||
}
|
||||
|
||||
PINTERNALPOS
|
||||
UserGetInternalPos(HWND hWnd)
|
||||
{
|
||||
PINTERNALPOS lpPos;
|
||||
lpPos = (PINTERNALPOS)GetPropA(hWnd, (LPSTR)(DWORD)AtomInternalPos);
|
||||
return(lpPos);
|
||||
}
|
||||
|
||||
BOOL
|
||||
DefWndRedrawIconTitle(HWND hWnd)
|
||||
|
@ -244,7 +253,6 @@ UserHasBigFrameStyle(ULONG Style, ULONG ExStyle)
|
|||
(ExStyle & WS_EX_DLGMODALFRAME));
|
||||
}
|
||||
|
||||
|
||||
void UserGetInsideRectNC( HWND hWnd, RECT *rect )
|
||||
{
|
||||
RECT WindowRect;
|
||||
|
@ -553,8 +561,7 @@ DefWndHitTestNC(HWND hWnd, POINT Point)
|
|||
|
||||
GetWindowRect(hWnd, &WindowRect);
|
||||
if (!PtInRect(&WindowRect, Point))
|
||||
{
|
||||
|
||||
{
|
||||
return(HTNOWHERE);
|
||||
}
|
||||
if (Style & WS_MINIMIZE)
|
||||
|
@ -905,23 +912,426 @@ DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
return((LRESULT)SetCursor(LoadCursorW(0, IDC_ARROW)));
|
||||
}
|
||||
|
||||
static LONG
|
||||
DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint)
|
||||
{
|
||||
LONG hittest = 0;
|
||||
POINT pt;
|
||||
MSG msg;
|
||||
RECT rectWindow;
|
||||
ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
|
||||
|
||||
GetWindowRect(hWnd, &rectWindow);
|
||||
|
||||
if ((wParam & 0xfff0) == SC_MOVE)
|
||||
{
|
||||
/* Move pointer at the center of the caption */
|
||||
RECT rect;
|
||||
UserGetInsideRectNC(hWnd, &rect);
|
||||
if (Style & WS_SYSMENU)
|
||||
rect.left += GetSystemMetrics(SM_CXSIZE) + 1;
|
||||
if (Style & WS_MINIMIZEBOX)
|
||||
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
||||
if (Style & WS_MAXIMIZEBOX)
|
||||
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
||||
pt.x = rectWindow.left + (rect.right - rect.left) / 2;
|
||||
pt.y = rectWindow.top + rect.top + GetSystemMetrics(SM_CYSIZE)/2;
|
||||
hittest = HTCAPTION;
|
||||
*capturePoint = pt;
|
||||
}
|
||||
else /* SC_SIZE */
|
||||
{
|
||||
while(!hittest)
|
||||
{
|
||||
GetMessage(&msg, NULL, 0, 0);
|
||||
switch(msg.message)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
hittest = DefWndHitTestNC(hWnd, msg.pt);
|
||||
if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
|
||||
hittest = 0;
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
return 0;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
switch(msg.wParam)
|
||||
{
|
||||
case VK_UP:
|
||||
hittest = HTTOP;
|
||||
pt.x =(rectWindow.left+rectWindow.right)/2;
|
||||
pt.y = rectWindow.top + GetSystemMetrics(SM_CYFRAME) / 2;
|
||||
break;
|
||||
case VK_DOWN:
|
||||
hittest = HTBOTTOM;
|
||||
pt.x =(rectWindow.left+rectWindow.right)/2;
|
||||
pt.y = rectWindow.bottom - GetSystemMetrics(SM_CYFRAME) / 2;
|
||||
break;
|
||||
case VK_LEFT:
|
||||
hittest = HTLEFT;
|
||||
pt.x = rectWindow.left + GetSystemMetrics(SM_CXFRAME) / 2;
|
||||
pt.y =(rectWindow.top+rectWindow.bottom)/2;
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
hittest = HTRIGHT;
|
||||
pt.x = rectWindow.right - GetSystemMetrics(SM_CXFRAME) / 2;
|
||||
pt.y =(rectWindow.top+rectWindow.bottom)/2;
|
||||
break;
|
||||
case VK_RETURN:
|
||||
case VK_ESCAPE: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
*capturePoint = pt;
|
||||
}
|
||||
SetCursorPos( pt.x, pt.y );
|
||||
DefWndHandleSetCursor(hWnd, (WPARAM)hWnd, MAKELONG(hittest, WM_MOUSEMOVE));
|
||||
return hittest;
|
||||
}
|
||||
|
||||
#define ON_LEFT_BORDER(hit) \
|
||||
(((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
|
||||
#define ON_RIGHT_BORDER(hit) \
|
||||
(((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
|
||||
#define ON_TOP_BORDER(hit) \
|
||||
(((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
|
||||
#define ON_BOTTOM_BORDER(hit) \
|
||||
(((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
|
||||
|
||||
VOID STATIC
|
||||
UserDrawWindowFrame(HDC hdc, const RECT *rect,
|
||||
ULONG width, ULONG height, DWORD rop )
|
||||
{
|
||||
HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
|
||||
PatBlt( hdc, rect->left, rect->top,
|
||||
rect->right - rect->left - width, height, rop );
|
||||
PatBlt( hdc, rect->left, rect->top + height, width,
|
||||
rect->bottom - rect->top - height, rop );
|
||||
PatBlt( hdc, rect->left + width, rect->bottom - 1,
|
||||
rect->right - rect->left - width, -height, rop );
|
||||
PatBlt( hdc, rect->right - 1, rect->top, -width,
|
||||
rect->bottom - rect->top - height, rop );
|
||||
SelectObject( hdc, hbrush );
|
||||
}
|
||||
|
||||
VOID STATIC
|
||||
UserDrawMovingFrame(HDC hdc, RECT *rect, BOOL thickframe)
|
||||
{
|
||||
if (thickframe)
|
||||
{
|
||||
UserDrawWindowFrame(hdc, rect, GetSystemMetrics(SM_CXFRAME),
|
||||
GetSystemMetrics(SM_CYFRAME), PATINVERT );
|
||||
}
|
||||
else DrawFocusRect( hdc, rect );
|
||||
}
|
||||
|
||||
VOID STATIC
|
||||
DefWndDoSizeMove(HWND hwnd, WORD wParam)
|
||||
{
|
||||
MSG msg;
|
||||
RECT sizingRect, mouseRect, origRect;
|
||||
HDC hdc;
|
||||
LONG hittest = (LONG)(wParam & 0x0f);
|
||||
HCURSOR hDragCursor = 0, hOldCursor = 0;
|
||||
POINT minTrack, maxTrack;
|
||||
POINT capturePoint, pt;
|
||||
ULONG Style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
ULONG ExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
BOOL thickframe = UserHasThickFrameStyle(Style, ExStyle);
|
||||
BOOL iconic = Style & WS_MINIMIZE;
|
||||
BOOL moved = FALSE;
|
||||
DWORD dwPoint = GetMessagePos();
|
||||
BOOL DragFullWindows = FALSE;
|
||||
HWND hWndParent;
|
||||
|
||||
SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
|
||||
|
||||
pt.x = SLOWORD(dwPoint);
|
||||
pt.y = SHIWORD(dwPoint);
|
||||
capturePoint = pt;
|
||||
|
||||
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((wParam & 0xfff0) == SC_MOVE)
|
||||
{
|
||||
if (!hittest)
|
||||
{
|
||||
hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint);
|
||||
}
|
||||
if (!hittest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else /* SC_SIZE */
|
||||
{
|
||||
if (!thickframe)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (hittest && hittest != HTSYSMENU)
|
||||
{
|
||||
hittest += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCapture(hwnd);
|
||||
hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint);
|
||||
if (!hittest)
|
||||
{
|
||||
ReleaseCapture();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Style & WS_CHILD)
|
||||
{
|
||||
hWndParent = GetParent(hwnd);
|
||||
}
|
||||
|
||||
/* Get min/max info */
|
||||
|
||||
WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack);
|
||||
GetWindowRect(hwnd, &sizingRect);
|
||||
origRect = sizingRect;
|
||||
if (Style & WS_CHILD)
|
||||
{
|
||||
GetClientRect(hWndParent, &mouseRect );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN));
|
||||
}
|
||||
if (ON_LEFT_BORDER(hittest))
|
||||
{
|
||||
mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x );
|
||||
mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x );
|
||||
}
|
||||
else if (ON_RIGHT_BORDER(hittest))
|
||||
{
|
||||
mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x );
|
||||
mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x );
|
||||
}
|
||||
if (ON_TOP_BORDER(hittest))
|
||||
{
|
||||
mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y );
|
||||
mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y);
|
||||
}
|
||||
else if (ON_BOTTOM_BORDER(hittest))
|
||||
{
|
||||
mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y );
|
||||
mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
|
||||
}
|
||||
if (Style & WS_CHILD)
|
||||
{
|
||||
MapWindowPoints( hWndParent, 0, (LPPOINT)&mouseRect, 2 );
|
||||
}
|
||||
SendMessageA( hwnd, WM_ENTERSIZEMOVE, 0, 0 );
|
||||
|
||||
if (GetCapture() != hwnd) SetCapture( hwnd );
|
||||
|
||||
if (Style & WS_CHILD)
|
||||
{
|
||||
/* Retrieve a default cache DC (without using the window style) */
|
||||
hdc = GetDCEx(hWndParent, 0, DCX_CACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
hdc = GetDC( 0 );
|
||||
}
|
||||
|
||||
if( iconic ) /* create a cursor for dragging */
|
||||
{
|
||||
HICON hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
|
||||
if(!hIcon) hIcon = (HICON)SendMessage( hwnd, WM_QUERYDRAGICON, 0, 0L);
|
||||
if( hIcon ) hDragCursor = CursorIconToCursor( hIcon, TRUE );
|
||||
if( !hDragCursor ) iconic = FALSE;
|
||||
}
|
||||
|
||||
/* invert frame if WIN31_LOOK to indicate mouse click on caption */
|
||||
if( !iconic && !DragFullWindows)
|
||||
{
|
||||
UserDrawMovingFrame( hdc, &sizingRect, thickframe );
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
GetMessage(&msg, 0, 0, 0);
|
||||
|
||||
/* Exit on button-up, Return, or Esc */
|
||||
if ((msg.message == WM_LBUTTONUP) ||
|
||||
((msg.message == WM_KEYDOWN) &&
|
||||
((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break;
|
||||
|
||||
if (msg.message == WM_PAINT)
|
||||
{
|
||||
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
|
||||
UpdateWindow( msg.hwnd );
|
||||
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
|
||||
continue; /* We are not interested in other messages */
|
||||
|
||||
pt = msg.pt;
|
||||
|
||||
if (msg.message == WM_KEYDOWN) switch(msg.wParam)
|
||||
{
|
||||
case VK_UP: pt.y -= 8; break;
|
||||
case VK_DOWN: pt.y += 8; break;
|
||||
case VK_LEFT: pt.x -= 8; break;
|
||||
case VK_RIGHT: pt.x += 8; break;
|
||||
}
|
||||
|
||||
pt.x = max( pt.x, mouseRect.left );
|
||||
pt.x = min( pt.x, mouseRect.right );
|
||||
pt.y = max( pt.y, mouseRect.top );
|
||||
pt.y = min( pt.y, mouseRect.bottom );
|
||||
|
||||
dx = pt.x - capturePoint.x;
|
||||
dy = pt.y - capturePoint.y;
|
||||
|
||||
if (dx || dy)
|
||||
{
|
||||
if( !moved )
|
||||
{
|
||||
moved = TRUE;
|
||||
|
||||
if( iconic ) /* ok, no system popup tracking */
|
||||
{
|
||||
hOldCursor = SetCursor(hDragCursor);
|
||||
ShowCursor( TRUE );
|
||||
WinPosShowIconTitle( hwnd, FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
|
||||
else
|
||||
{
|
||||
RECT newRect = sizingRect;
|
||||
WPARAM wpSizingHit = 0;
|
||||
|
||||
if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy );
|
||||
if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
|
||||
else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
|
||||
if (ON_TOP_BORDER(hittest)) newRect.top += dy;
|
||||
else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
|
||||
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
|
||||
capturePoint = pt;
|
||||
|
||||
/* determine the hit location */
|
||||
if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
|
||||
wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
|
||||
SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect );
|
||||
|
||||
if (!iconic)
|
||||
{
|
||||
if(!DragFullWindows)
|
||||
UserDrawMovingFrame( hdc, &newRect, thickframe );
|
||||
else {
|
||||
/* To avoid any deadlocks, all the locks on the windows
|
||||
structures must be suspended before the SetWindowPos */
|
||||
SetWindowPos( hwnd, 0, newRect.left, newRect.top,
|
||||
newRect.right - newRect.left,
|
||||
newRect.bottom - newRect.top,
|
||||
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
|
||||
}
|
||||
}
|
||||
sizingRect = newRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseCapture();
|
||||
if( iconic )
|
||||
{
|
||||
if( moved ) /* restore cursors, show icon title later on */
|
||||
{
|
||||
ShowCursor( FALSE );
|
||||
SetCursor( hOldCursor );
|
||||
}
|
||||
DestroyCursor( hDragCursor );
|
||||
}
|
||||
else if(!DragFullWindows)
|
||||
UserDrawMovingFrame( hdc, &sizingRect, thickframe );
|
||||
|
||||
if (Style & WS_CHILD)
|
||||
ReleaseDC( hWndParent, hdc );
|
||||
else
|
||||
ReleaseDC( 0, hdc );
|
||||
|
||||
SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
|
||||
SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
|
||||
|
||||
/* window moved or resized */
|
||||
if (moved)
|
||||
{
|
||||
/* if the moving/resizing isn't canceled call SetWindowPos
|
||||
* with the new position or the new size of the window
|
||||
*/
|
||||
if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
|
||||
{
|
||||
/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
|
||||
if(!DragFullWindows)
|
||||
SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
|
||||
sizingRect.right - sizingRect.left,
|
||||
sizingRect.bottom - sizingRect.top,
|
||||
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
|
||||
}
|
||||
else { /* restore previous size/position */
|
||||
if(DragFullWindows)
|
||||
SetWindowPos( hwnd, 0, origRect.left, origRect.top,
|
||||
origRect.right - origRect.left,
|
||||
origRect.bottom - origRect.top,
|
||||
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if( IsWindow(hwnd) )
|
||||
if( Style & WS_MINIMIZE )
|
||||
{
|
||||
/* Single click brings up the system menu when iconized */
|
||||
|
||||
if( !moved )
|
||||
{
|
||||
if( Style & WS_SYSMENU )
|
||||
SendMessageA( hwnd, WM_SYSCOMMAND,
|
||||
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
|
||||
}
|
||||
else WinPosShowIconTitle( hwnd, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LRESULT
|
||||
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
||||
{
|
||||
switch (wParam)
|
||||
switch (wParam & 0xfff0)
|
||||
{
|
||||
case SC_MOVE:
|
||||
case SC_SIZE:
|
||||
DefWndDoSizeMove(hWnd, wParam);
|
||||
break;
|
||||
case SC_CLOSE:
|
||||
SendMessageA(hWnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
case SC_MOUSEMENU:
|
||||
case SC_MOUSEMENU:
|
||||
MenuTrackMouseMenuBar(hWnd, wParam, Pt);
|
||||
break;
|
||||
case SC_KEYMENU:
|
||||
case SC_KEYMENU:
|
||||
MenuTrackKbdMenuBar(hWnd, wParam, Pt.x);
|
||||
break;
|
||||
default:
|
||||
/* FIXME: Implement */
|
||||
/* FIXME: Implement */
|
||||
UNIMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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: menu.c,v 1.9 2003/07/26 15:48:47 dwelch Exp $
|
||||
/* $Id: menu.c,v 1.10 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/menu.c
|
||||
|
@ -64,6 +64,11 @@ typedef struct _POPUP_MENU
|
|||
ULONG Flags;
|
||||
HWND hWnd;
|
||||
HWND hWndOwner;
|
||||
HBRUSH hbrBack;
|
||||
ULONG HelpId;
|
||||
ULONG cyMax;
|
||||
ULONG MenuData;
|
||||
ULONG Style;
|
||||
} POPUP_MENU, *PPOPUP_MENU;
|
||||
|
||||
static HFONT hMenuFont = 0;
|
||||
|
@ -500,13 +505,11 @@ GetMenu(HWND hWnd)
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetMenuBarInfo(
|
||||
HWND hwnd,
|
||||
LONG idObject,
|
||||
LONG idItem,
|
||||
PMENUBARINFO pmbi)
|
||||
WINBOOL STDCALL
|
||||
GetMenuBarInfo(HWND hwnd,
|
||||
LONG idObject,
|
||||
LONG idItem,
|
||||
PMENUBARINFO pmbi)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
|
@ -525,66 +528,125 @@ GetMenuCheckMarkDimensions(VOID)
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
UINT
|
||||
STDCALL
|
||||
GetMenuDefaultItem(
|
||||
HMENU hMenu,
|
||||
UINT fByPos,
|
||||
UINT gmdiFlags)
|
||||
UINT STDCALL
|
||||
GetMenuDefaultItem(HMENU hMenu,
|
||||
UINT fByPos,
|
||||
UINT gmdiFlags)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
PPOPUP_MENU Menu;
|
||||
PMENUITEM Item;
|
||||
ULONG i;
|
||||
|
||||
Menu = MenuGetMenu(hMenu);
|
||||
|
||||
if (Menu->Items == NULL)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
Item = Menu->Items;
|
||||
while (!(Item->State & MFS_DEFAULT))
|
||||
{
|
||||
i++;
|
||||
Item++;
|
||||
if (i >= Menu->NrItems)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(gmdiFlags & GMDI_USEDISABLED) && (Item->State & MFS_DISABLED))
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ((Item->TypeData & MF_POPUP) && (gmdiFlags & GMDI_GOINTOPOPUPS))
|
||||
{
|
||||
UINT Ret;
|
||||
Ret = GetMenuDefaultItem(Item->SubMenu, fByPos, gmdiFlags);
|
||||
if (Ret != -1)
|
||||
{
|
||||
return(Ret);
|
||||
}
|
||||
}
|
||||
return(fByPos ? i : Item->Id);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetMenuInfo(
|
||||
HMENU hmenu,
|
||||
LPCMENUINFO lpcmi)
|
||||
WINBOOL STDCALL
|
||||
GetMenuInfo(HMENU hmenu,
|
||||
LPMENUINFO lpcmi)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
PPOPUP_MENU Menu;
|
||||
|
||||
Menu = MenuGetMenu(hmenu);
|
||||
|
||||
if (lpcmi->fMask & MIM_BACKGROUND)
|
||||
{
|
||||
lpcmi->hbrBack = Menu->hbrBack;
|
||||
}
|
||||
if (lpcmi->fMask & MIM_HELPID)
|
||||
{
|
||||
lpcmi->dwContextHelpID = Menu->HelpId;
|
||||
}
|
||||
if (lpcmi->fMask & MIM_MAXHEIGHT)
|
||||
{
|
||||
lpcmi->cyMax = Menu->cyMax;
|
||||
}
|
||||
if (lpcmi->fMask & MIM_MENUDATA)
|
||||
{
|
||||
lpcmi->dwMenuData = Menu->MenuData;
|
||||
}
|
||||
if (lpcmi->fMask & MIM_STYLE)
|
||||
{
|
||||
lpcmi->dwStyle = Menu->Style;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int STDCALL
|
||||
GetMenuItemCount(HMENU hMenu)
|
||||
{
|
||||
PPOPUP_MENU Menu = MenuGetMenu(hMenu);
|
||||
return(Menu->NrItems);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
UINT STDCALL
|
||||
GetMenuItemID(HMENU hMenu,
|
||||
int nPos)
|
||||
{
|
||||
PMENUITEM Item;
|
||||
|
||||
Item = MenuFindItem(&hMenu, &nPos, MF_BYPOSITION);
|
||||
if (Item == NULL)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
if (Item->TypeData & MF_POPUP)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
return(Item->Id);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
GetMenuItemCount(
|
||||
HMENU hMenu)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
UINT
|
||||
STDCALL
|
||||
GetMenuItemID(
|
||||
HMENU hMenu,
|
||||
int nPos)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
WINBOOL STDCALL
|
||||
GetMenuItemInfoA(
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
|
@ -615,16 +677,14 @@ GetMenuItemInfoW(
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetMenuItemRect(
|
||||
HWND hWnd,
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
LPRECT lprcItem)
|
||||
WINBOOL STDCALL
|
||||
GetMenuItemRect(HWND hWnd,
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
LPRECT lprcItem)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -803,25 +863,20 @@ LoadMenuA(HINSTANCE hInstance,
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
HMENU
|
||||
STDCALL
|
||||
LoadMenuIndirectA(
|
||||
CONST MENUTEMPLATE *lpMenuTemplate)
|
||||
HMENU STDCALL
|
||||
LoadMenuIndirectA(CONST MENUTEMPLATE *lpMenuTemplate)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HMENU)0;
|
||||
return(LoadMenuIndirectW(lpMenuTemplate));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HMENU
|
||||
STDCALL
|
||||
LoadMenuIndirectW(
|
||||
CONST MENUTEMPLATE *lpMenuTemplate)
|
||||
HMENU STDCALL
|
||||
LoadMenuIndirectW(CONST MENUTEMPLATE *lpMenuTemplate)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (HMENU)0;
|
||||
|
@ -909,16 +964,40 @@ RemoveMenu(
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetMenu(
|
||||
HWND hWnd,
|
||||
HMENU hMenu)
|
||||
WINBOOL STDCALL
|
||||
SetMenu(HWND hWnd,
|
||||
HMENU hMenu)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
|
||||
|
||||
if (Style & WS_CHILD)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (GetCapture() == hWnd)
|
||||
{
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
SetWindowLong(hWnd, GWL_ID, (LONG)hMenu);
|
||||
|
||||
if (hMenu != 0)
|
||||
{
|
||||
PPOPUP_MENU Menu;
|
||||
|
||||
Menu = MenuGetMenu(hMenu);
|
||||
|
||||
Menu->hWnd = hWnd;
|
||||
Menu->Height = 0;
|
||||
}
|
||||
if (IsWindowVisible(hWnd))
|
||||
{
|
||||
SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: message.c,v 1.18 2003/07/10 21:04:32 chorns Exp $
|
||||
/* $Id: message.c,v 1.19 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -690,4 +690,35 @@ RegisterWindowMessageW(LPCWSTR lpString)
|
|||
return(NtUserRegisterWindowMessage(&String));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HWND STDCALL
|
||||
SetCapture(HWND hWnd)
|
||||
{
|
||||
return(NtUserSetCapture(hWnd));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HWND STDCALL
|
||||
GetCapture(VOID)
|
||||
{
|
||||
return(NtUserGetCapture());
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
WINBOOL STDCALL
|
||||
ReleaseCapture(VOID)
|
||||
{
|
||||
NtUserSetCapture(NULL);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: window.c,v 1.47 2003/07/25 23:02:21 royce Exp $
|
||||
/* $Id: window.c,v 1.48 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -24,7 +24,7 @@ static BOOL ControlsInitCalled = FALSE;
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
ULONG
|
||||
WinHasThickFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
WinHasThickFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return((Style & WS_THICKFRAME) &&
|
||||
(!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
|
||||
|
@ -1602,5 +1602,4 @@ ClientToScreen(HWND hWnd, LPPOINT lpPoint)
|
|||
return (MapWindowPoints( hWnd, NULL, lpPoint, 1 ));
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
137
reactos/lib/user32/windows/winpos.c
Normal file
137
reactos/lib/user32/windows/winpos.c
Normal file
|
@ -0,0 +1,137 @@
|
|||
/* $Id: winpos.c,v 1.7 2003/07/27 11:54:41 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/window.c
|
||||
* PURPOSE: Window management
|
||||
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* UPDATE HISTORY:
|
||||
* 06-06-2001 CSH Created
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32.h>
|
||||
#include <window.h>
|
||||
#include <user32/callback.h>
|
||||
#include <user32/regcontrol.h>
|
||||
#include <user32/wininternal.h>
|
||||
#include <window.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
BOOL
|
||||
WinPosShowIconTitle(HWND hWnd, BOOL bShow)
|
||||
{
|
||||
PINTERNALPOS lpPos = UserGetInternalPos(hWnd);
|
||||
|
||||
if( lpPos)
|
||||
{
|
||||
HWND hWnd = lpPos->IconTitle;
|
||||
|
||||
if( !hWnd )
|
||||
lpPos->IconTitle = hWnd = NULL; /*ICONTITLE_Create( pWnd );*/
|
||||
if( bShow )
|
||||
{
|
||||
ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
|
||||
if( !(Style & WS_VISIBLE) )
|
||||
{
|
||||
SendMessageA( hWnd, WM_SHOWWINDOW, TRUE, 0 );
|
||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
|
||||
}
|
||||
}
|
||||
else ShowWindow( hWnd, SW_HIDE );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
UINT STDCALL
|
||||
WinPosGetMinMaxInfo(HWND hWnd, POINT* MaxSize, POINT* MaxPos,
|
||||
POINT* MinTrack, POINT* MaxTrack)
|
||||
{
|
||||
MINMAXINFO MinMax;
|
||||
INT XInc, YInc;
|
||||
INTERNALPOS* Pos;
|
||||
ULONG Style = GetWindowLong(hWnd, GWL_STYLE);
|
||||
ULONG ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
||||
|
||||
/* Get default values. */
|
||||
MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
|
||||
MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
|
||||
MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
|
||||
MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
|
||||
MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
|
||||
MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
if (UserHasDlgFrameStyle(Style, ExStyle))
|
||||
{
|
||||
XInc = GetSystemMetrics(SM_CXDLGFRAME);
|
||||
YInc = GetSystemMetrics(SM_CYDLGFRAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
XInc = YInc = 0;
|
||||
if (UserHasThickFrameStyle(Style, ExStyle))
|
||||
{
|
||||
XInc += GetSystemMetrics(SM_CXFRAME);
|
||||
YInc += GetSystemMetrics(SM_CYFRAME);
|
||||
}
|
||||
if (Style & WS_BORDER)
|
||||
{
|
||||
XInc += GetSystemMetrics(SM_CXBORDER);
|
||||
YInc += GetSystemMetrics(SM_CYBORDER);
|
||||
}
|
||||
}
|
||||
MinMax.ptMaxSize.x += 2 * XInc;
|
||||
MinMax.ptMaxSize.y += 2 * YInc;
|
||||
|
||||
Pos = UserGetInternalPos(hWnd);
|
||||
if (Pos != NULL)
|
||||
{
|
||||
MinMax.ptMaxPosition = Pos->MaxPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinMax.ptMaxPosition.x -= XInc;
|
||||
MinMax.ptMaxPosition.y -= YInc;
|
||||
}
|
||||
|
||||
SendMessage(hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax);
|
||||
|
||||
MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,
|
||||
MinMax.ptMinTrackSize.x);
|
||||
MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y,
|
||||
MinMax.ptMinTrackSize.y);
|
||||
|
||||
if (MaxSize) *MaxSize = MinMax.ptMaxSize;
|
||||
if (MaxPos) *MaxPos = MinMax.ptMaxPosition;
|
||||
if (MinTrack) *MinTrack = MinMax.ptMinTrackSize;
|
||||
if (MaxTrack) *MaxTrack = MinMax.ptMaxTrackSize;
|
||||
|
||||
return 0; //FIXME: what does it return?
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HWND STDCALL
|
||||
GetActiveWindow(VOID)
|
||||
{
|
||||
return(NtUserGetActiveWindow());
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HWND STDCALL
|
||||
SetActiveWindow(HWND hWnd)
|
||||
{
|
||||
return(NtUserSetActiveWindow(hWnd));
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ typedef struct _DESKTOP_OBJECT
|
|||
/* Handle of the desktop window. */
|
||||
HANDLE DesktopWindow;
|
||||
HANDLE PrevActiveWindow;
|
||||
struct _WINDOW_OBJECT* CaptureWindow;
|
||||
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
||||
|
||||
|
||||
|
|
|
@ -113,6 +113,11 @@ HWND FASTCALL W32kSetFocusWindow (HWND hWnd);
|
|||
DWORD FASTCALL
|
||||
W32kGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid);
|
||||
|
||||
ULONG
|
||||
UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
ULONG
|
||||
UserHasThickFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
|
||||
#endif /* __WIN32K_WINDOW_H */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -45,6 +45,12 @@ VOID FASTCALL
|
|||
W32kEndDesktopGraphics(VOID);
|
||||
HDC FASTCALL
|
||||
W32kGetScreenDC(VOID);
|
||||
VOID STDCALL
|
||||
W32kSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
|
||||
struct _WINDOW_OBJECT* STDCALL
|
||||
W32kGetCaptureWindow(VOID);
|
||||
VOID STDCALL
|
||||
W32kSetCaptureWindow(struct _WINDOW_OBJECT* Window);
|
||||
|
||||
#endif /* __WIN32K_WINSTA_H */
|
||||
|
||||
|
|
|
@ -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: msgqueue.c,v 1.11 2003/07/25 23:53:36 dwelch Exp $
|
||||
/* $Id: msgqueue.c,v 1.12 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -138,9 +138,14 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
|||
POINT Point;
|
||||
ULONG Click = 0;
|
||||
|
||||
/* FIXME: Handle window capture. */
|
||||
|
||||
*HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window);
|
||||
if ((Window = W32kGetCaptureWindow()) == NULL)
|
||||
{
|
||||
*HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window);
|
||||
}
|
||||
else
|
||||
{
|
||||
*HitTest = HTCLIENT;
|
||||
}
|
||||
|
||||
if (Window == NULL)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.17 2003/07/25 23:02:21 royce Exp $
|
||||
/* $Id: stubs.c,v 1.18 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1173,16 +1173,6 @@ NtUserSendInput(
|
|||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetCapture(
|
||||
DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetClipboardData(
|
||||
|
|
|
@ -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.68 2003/07/25 23:02:21 royce Exp $
|
||||
/* $Id: window.c,v 1.69 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -108,9 +108,9 @@ NtUserGetAncestor(HWND hWnd, UINT Flags)
|
|||
}
|
||||
|
||||
pChainEnumerator = Window;
|
||||
while(pChainEnumerator->Parent != NULL)
|
||||
while(!W32kIsDesktopWindow(pChainEnumerator->Parent->Self))
|
||||
{
|
||||
pChainEnumerator = pChainEnumerator->Parent;
|
||||
pChainEnumerator = pChainEnumerator->Parent;
|
||||
}
|
||||
|
||||
hRoot = pChainEnumerator->Self;
|
||||
|
@ -1634,14 +1634,6 @@ NtUserScrollWindowEx(DWORD Unknown0,
|
|||
return 0;
|
||||
}
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserSetActiveWindow(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserSetImeOwnerWindow(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
|
@ -1963,7 +1955,55 @@ NtUserWindowFromPoint(DWORD Unknown0,
|
|||
HWND STDCALL
|
||||
NtUserGetDesktopWindow()
|
||||
{
|
||||
return W32kGetDesktopWindow();
|
||||
return W32kGetDesktopWindow();
|
||||
}
|
||||
|
||||
HWND STDCALL
|
||||
NtUserGetCapture(VOID)
|
||||
{
|
||||
PWINDOW_OBJECT Window;
|
||||
Window = W32kGetCaptureWindow();
|
||||
if (Window != NULL)
|
||||
{
|
||||
return(Window->Self);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
HWND STDCALL
|
||||
NtUserSetCapture(HWND Wnd)
|
||||
{
|
||||
PWINDOW_OBJECT Window;
|
||||
PWINDOW_OBJECT Prev;
|
||||
|
||||
Prev = W32kGetCaptureWindow();
|
||||
|
||||
if (Prev != NULL)
|
||||
{
|
||||
W32kSendMessage(Prev->Self, WM_CAPTURECHANGED, 0L, (LPARAM)Wnd, FALSE);
|
||||
}
|
||||
|
||||
if (Wnd == NULL)
|
||||
{
|
||||
W32kSetCaptureWindow(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Window = W32kGetWindowObject(Wnd);
|
||||
W32kSetCaptureWindow(Window);
|
||||
W32kReleaseWindowObject(Window);
|
||||
}
|
||||
if (Prev != NULL)
|
||||
{
|
||||
return(Prev->Self);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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.13 2003/07/10 00:24:04 chorns Exp $
|
||||
/* $Id: winpos.c,v 1.14 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -360,7 +360,7 @@ WinPosChangeActiveWindow(HWND hWnd, BOOL MouseMsg)
|
|||
WM_ACTIVATE,
|
||||
MAKELONG(MouseMsg ? WA_CLICKACTIVE : WA_CLICKACTIVE,
|
||||
(WindowObject->Style & WS_MINIMIZE) ? 1 : 0),
|
||||
W32kGetDesktopWindow()); /* FIXME: Previous active window */
|
||||
(LPARAM)W32kGetDesktopWindow()); /* FIXME: Previous active window */
|
||||
|
||||
W32kReleaseWindowObject(WindowObject);
|
||||
|
||||
|
@ -894,4 +894,110 @@ WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint,
|
|||
|
||||
return(HitTest);
|
||||
}
|
||||
|
||||
BOOL
|
||||
WinPosSetActiveWindow(PWINDOW_OBJECT Window, BOOL Mouse, BOOL ChangeFocus)
|
||||
{
|
||||
PUSER_MESSAGE_QUEUE ActiveQueue;
|
||||
HWND PrevActive;
|
||||
|
||||
ActiveQueue = W32kGetFocusMessageQueue();
|
||||
if (ActiveQueue != NULL)
|
||||
{
|
||||
PrevActive = ActiveQueue->ActiveWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
PrevActive = NULL;
|
||||
}
|
||||
|
||||
if (Window->Self == W32kGetActiveDesktop() || Window->Self == PrevActive)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (PrevActive != NULL)
|
||||
{
|
||||
PWINDOW_OBJECT PrevActiveWindow = W32kGetWindowObject(PrevActive);
|
||||
WORD Iconised = HIWORD(PrevActiveWindow->Style & WS_MINIMIZE);
|
||||
if (!W32kSendMessage(PrevActive, WM_NCACTIVATE, FALSE, 0, TRUE))
|
||||
{
|
||||
/* FIXME: Check if the new window is system modal. */
|
||||
return(FALSE);
|
||||
}
|
||||
W32kSendMessage(PrevActive,
|
||||
WM_ACTIVATE,
|
||||
MAKEWPARAM(WA_INACTIVE, Iconised),
|
||||
(LPARAM)Window->Self,
|
||||
TRUE);
|
||||
/* FIXME: Check if anything changed while processing the message. */
|
||||
W32kReleaseWindowObject(PrevActiveWindow);
|
||||
}
|
||||
|
||||
if (Window != NULL)
|
||||
{
|
||||
Window->MessageQueue->ActiveWindow = Window->Self;
|
||||
}
|
||||
else if (ActiveQueue != NULL)
|
||||
{
|
||||
ActiveQueue->ActiveWindow = NULL;
|
||||
}
|
||||
|
||||
/* FIXME: Send palette messages. */
|
||||
|
||||
/* FIXME: Redraw icon title of previously active window. */
|
||||
|
||||
/* FIXME: Bring the window to the top. */
|
||||
|
||||
/* FIXME: Send WM_ACTIVATEAPP */
|
||||
|
||||
W32kSetFocusMessageQueue(Window->MessageQueue);
|
||||
|
||||
/* FIXME: Send activate messages. */
|
||||
|
||||
/* FIXME: Change focus. */
|
||||
|
||||
/* FIXME: Redraw new window icon title. */
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
HWND STDCALL
|
||||
NtUserGetActiveWindow(VOID)
|
||||
{
|
||||
PUSER_MESSAGE_QUEUE ActiveQueue;
|
||||
|
||||
ActiveQueue = W32kGetFocusMessageQueue();
|
||||
if (ActiveQueue == NULL)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
return(ActiveQueue->ActiveWindow);
|
||||
}
|
||||
|
||||
HWND STDCALL
|
||||
NtUserSetActiveWindow(HWND hWnd)
|
||||
{
|
||||
PWINDOW_OBJECT Window;
|
||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||
HWND Prev;
|
||||
|
||||
Window = W32kGetWindowObject(hWnd);
|
||||
if (Window == NULL || (Window->Style & (WS_DISABLED | WS_CHILD)))
|
||||
{
|
||||
W32kReleaseWindowObject(Window);
|
||||
return(0);
|
||||
}
|
||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||
if (Window->MessageQueue != ThreadQueue)
|
||||
{
|
||||
W32kReleaseWindowObject(Window);
|
||||
return(0);
|
||||
}
|
||||
Prev = Window->MessageQueue->ActiveWindow;
|
||||
WinPosSetActiveWindow(Window, FALSE, FALSE);
|
||||
W32kReleaseWindowObject(Window);
|
||||
return(Prev);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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: winsta.c,v 1.18 2003/07/25 23:02:21 royce Exp $
|
||||
/* $Id: winsta.c,v 1.19 2003/07/27 11:54:42 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -81,6 +81,14 @@ W32kGetDesktopObject ( HDESK hDesk )
|
|||
return W32kGetActiveDesktop();
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
W32kSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
||||
{
|
||||
PDESKTOP_OBJECT pdo = W32kGetActiveDesktop();
|
||||
|
||||
pdo->ActiveMessageQueue = NewQueue;
|
||||
}
|
||||
|
||||
PUSER_MESSAGE_QUEUE FASTCALL
|
||||
W32kGetFocusMessageQueue(VOID)
|
||||
{
|
||||
|
@ -95,6 +103,28 @@ W32kGetFocusMessageQueue(VOID)
|
|||
return (PUSER_MESSAGE_QUEUE)pdo->ActiveMessageQueue;
|
||||
}
|
||||
|
||||
PWINDOW_OBJECT STDCALL
|
||||
W32kGetCaptureWindow(VOID)
|
||||
{
|
||||
PDESKTOP_OBJECT pdo = W32kGetActiveDesktop();
|
||||
if (!pdo)
|
||||
{
|
||||
DPRINT("No active desktop\n");
|
||||
return(NULL);
|
||||
}
|
||||
return(pdo->CaptureWindow);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
W32kSetCaptureWindow(PWINDOW_OBJECT Window)
|
||||
{
|
||||
PDESKTOP_OBJECT pdo = W32kGetActiveDesktop();
|
||||
if (!pdo)
|
||||
{
|
||||
DPRINT("No active desktop\n");
|
||||
}
|
||||
pdo->CaptureWindow = Window;
|
||||
}
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
InitWindowStationImpl(VOID)
|
||||
|
|
Loading…
Reference in a new issue