*/
#include <windows.h>
-#include <user32/widgets.h>
+#include <user32/paint.h>
#include <user32/sysmetr.h>
#include <user32/win.h>
#include <user32/heapdup.h>
WND* wndPtr;
HWND hWnd;
- if( wnd->dwStyle & WS_CHILD )
- hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME, NULL,
+
+
+ if( wnd->dwStyle & WS_CHILD ) {
+
+ hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME_A, NULL,
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
- else
- hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME, NULL,
+ }
+ else {
+
+ hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME_A, NULL,
WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->hwndSelf, 0, wnd->hInstance, NULL );
+
+ }
wndPtr = WIN_FindWndPtr( hWnd );
if( wndPtr )
{
#include <windows.h>
+//#include <user32/uitools.h>
#include <user32/debug.h>
WINBOOL STDCALL DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
else
return UITOOLS95_DrawRectEdge(hdc, rc, edge, flags);
}
-WINBOOL DrawIcon(HDC hDC, int xLeft, int yTop, HICON hIcon
- )
-{
- return FALSE;
-}
-
-WINBOOL
-STDCALL
-DrawIconEx(HDC hdc, int xLeft, int yTop,
- HICON hIcon, int cxWidth, int cyWidth,
- UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
-{
-}
-
-WINBOOL
-STDCALL
-DrawFocusRect(
- HDC hDC,
- CONST RECT * lprc)
-{
-}
\ No newline at end of file
#include <windows.h>
#include <user32/win.h>
+#include <user32/paint.h>
+
-/***********************************************************************
- * FillWindow (USER.324)
- */
void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush )
{
RECT rect;
GetClientRect( hwnd, &rect );
- // DPtoLP16( hdc, (LPPOINT16)&rect, 2 );
PaintRect( hwndParent, hwnd, hdc, hbrush, &rect );
}
}
-/***********************************************************************
- * GetControlBrush (USER.326)
- */
-HBRUSH STDCALL GetControlBrush( HWND hwnd, HDC hdc, UINT ctlType )
-{
- WND* wndPtr = WIN_FindWndPtr( hwnd );
- if((ctlType <= CTLCOLOR_MAX) && wndPtr )
- {
- WND* parent;
- if( wndPtr->dwStyle & WS_POPUP ) parent = wndPtr->owner;
- else parent = wndPtr->parent;
- if( !parent ) parent = wndPtr;
- return (HBRUSH)PAINT_GetControlBrush( parent->hwndSelf, hwnd, hdc, ctlType );
- }
- return (HBRUSH)0;
-}
+
INT STDCALL FrameRect( HDC hdc, const RECT *rect, HBRUSH hbrush )
{
HICON hIcon,
PICONINFO piconinfo)
{
+
+ return TRUE;
}
-HICON LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName )
+HICON
+STDCALL
+LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName )
{
HRSRC hrsrc;
ICONINFO *IconInfo;
return LoadStandardIcon((UINT)lpIconName);
}
//RT_GROUP_ICON
-hrsrc = FindResourceExA(hInstance,RT_GROUP_ICON, lpIconName, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
+ hrsrc = FindResourceExA(hInstance,RT_GROUP_ICON, lpIconName, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
if ( hrsrc == NULL )
return NULL;
return CreateIconIndirect(IconInfo);
}
-HICON LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName )
+HICON
+STDCALL
+LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName )
{
HRSRC hrsrc;
ICONINFO *IconInfo;
}
return NULL;
+}
+
+WINBOOL STDCALL DrawIcon(HDC hDC, int xLeft, int yTop, HICON hIcon )
+{
+
+ return DrawIconEx( hDC, xLeft, yTop,hIcon, -1, -1,0,NULL, DI_DEFAULTSIZE);
+}
+
+WINBOOL
+STDCALL
+DrawIconEx(HDC hdc, int xLeft, int yTop,
+ HICON hIcon, int cxWidth, int cyWidth,
+ UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
+{
+ //ICONINFO IconInfo;
+ //SIZE Size;;
+ //GetIconInfo(hIcon,&IconInfo);
+ //GetBitmapDimensionEx(IconInfo.hbmMask,&Size);
+ return FALSE;
+}
+
+WINBOOL
+STDCALL
+DrawFocusRect(
+ HDC hDC,
+ CONST RECT * lprc)
+{
+ return FALSE;
}
\ No newline at end of file
HDC defaultDCstate = 0;
+/***********************************************************************
+ * REGION_UnionRectWithRgn
+ * Adds a rectangle to a HRGN32
+ * A helper used by scroll.c
+ */
+WINBOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
+{
+
+ HRGN hRgn;
+ hRgn = CreateRectRgn(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
+
+ CombineRgn(hrgn,hrgn,hRgn, RGN_DIFF);
+
+ return TRUE;
+}
+
+
/***********************************************************************
* DCE_AllocDCE
*
* Allocate a new DCE.
*/
-DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
+DCE *DCE_AllocDCE( struct tagWND * wndPtr, DCE_TYPE type )
{
DCE * dce;
+
+
if (!(dce = HeapAlloc( GetProcessHeap(), 0, sizeof(DCE) ))) return NULL;
- if (!(dce->hDC = CreateDC( "DISPLAY", NULL, NULL, NULL )))
+ if (!(dce->hDC = CreateDC( "DISPLAY", NULL, NULL, NULL)))
{
HeapFree( GetProcessHeap(), 0, dce );
return 0;
}
- /* store DCE handle in DC hook data field */
-
- //SetDCHook( dce->hDC, (FARPROC)DCHook, (DWORD)dce );
-
- dce->hwndCurrent = hWnd;
+
+ /* store DCE handle in DC hook data field */
+ if ( wndPtr != NULL ) {
+ OffsetWindowOrgEx(dce->hDC,-wndPtr->rectWindow.left, -wndPtr->rectWindow.top, NULL );
+ dce->hwndCurrent = wndPtr->hwndSelf;
+ }
+ else
+ dce->hwndCurrent = NULL;
dce->hClipRgn = 0;
dce->next = firstDCE;
firstDCE = dce;
+
+ FillRect(dce->hDC,&(wndPtr->rectWindow),GetStockObject(GRAY_BRUSH));
+
+#if 0
if( type != DCE_CACHE_DC ) /* owned or class DC */
{
dce->DCXflags = DCX_DCEBUSY;
- if( hWnd )
+ if( wndPtr != NULL )
{
- WND* wnd = WIN_FindWndPtr(hWnd);
+
- if( wnd->dwStyle & WS_CLIPCHILDREN ) dce->DCXflags |= DCX_CLIPCHILDREN;
- if( wnd->dwStyle & WS_CLIPSIBLINGS ) dce->DCXflags |= DCX_CLIPSIBLINGS;
+ if( wndPtr->dwStyle & WS_CLIPCHILDREN ) dce->DCXflags |= DCX_CLIPCHILDREN;
+ if( wndPtr->dwStyle & WS_CLIPSIBLINGS ) dce->DCXflags |= DCX_CLIPSIBLINGS;
}
//SetHookFlags(dce->hDC,DCHF_INVALIDATEVISRGN);
}
else dce->DCXflags = DCX_CACHE | DCX_DCEEMPTY;
-
+#endif
return dce;
}
//DPRINT("\trestoring VisRgn\n");
- RestoreVisRgn(dce->hDC);
+ SelectClipRgn(dce->hDC,NULL);
}
#include <user32/debug.h>
-void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush );
#define WM_CTLCOLOR 0x0019
#define WM_ISACTIVEICON 0x0035
{
if (!text) text = "";
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
- wndPtr->text = (void *)HEAP_strdupA( GetProcessHeap(), 0, text );
- NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
+ wndPtr->text = (void *)HEAP_strdupA( GetProcessHeap(), 0, text );
+ if ( wndPtr->dwStyle & WS_CAPTION )
+ NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
+
+
}
if (!text) text = L"";
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
wndPtr->text = (void *)HEAP_strdupW( GetProcessHeap(), 0, text );
- NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
+ if ( wndPtr->dwStyle & WS_CAPTION )
+ NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
}
/***********************************************************************
* Copyright 1993, 1994, 1996 Alexandre Julliard
*/
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS system libraries
+ * FILE: lib/user32/internal/dialog.c
+ * PURPOSE: Reads resources and creates dialogs
+ * PROGRAMER: Boudewijn Dekker
+ * UPDATE HISTORY:
+ * 09/09/99: Modified
+ * TODO Fixup fonts and fonts and text metrics
+ Warnings
+ references to libc
+ */
+
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
xBaseUnit = xBaseUnit * 5 / 4;
- DPRINT( "base units = %d,%d\n",
- xBaseUnit, yBaseUnit );
return TRUE;
}
result->cx = DlgTemplate->cx;
result->cy = DlgTemplate->cy;
+ printf("%d %d %d %d\n",result->x, result->y, result->cx, result->cy);
+
p = &(DlgTemplate->cy);
p++;
break;
}
+ result->caption = L"";
+
/* Get the window caption */
if ( *p != 0 ) {
result->caption = (LPCWSTR)p;
p += lstrlenW( (LPCWSTR)p ) + 1;
-
+
+
/* Get the font name */
if (result->style & DS_SETFONT)
if (result->dialogEx)
{
result->weight = *p; p++;
- result->italic = *p; p++;
+ result->italic = LOBYTE(*p); p++;
}
else
{
result->italic = FALSE;
}
result->faceName = (LPCWSTR)p;
- p += lstrlenW( (LPCWSTR)p );
- p++;
+ p += lstrlenW( (LPCWSTR)p ) + 1;
}
- } else {
- result->caption = L"";
- }
+ }
+ else if ( *(p+1) != 0 ) {
+ p++;
+
+ /* Get the font name */
+
+ if (result->style & DS_SETFONT)
+ {
+ result->pointSize = *p;
+ p++;
+ if (result->dialogEx)
+ {
+ result->weight = *p; p++;
+ result->italic = LOBYTE(*p); p++;
+ }
+ else
+ {
+ result->weight = FW_DONTCARE;
+ result->italic = FALSE;
+ }
+ result->faceName = (LPCWSTR)p;
+ p += lstrlenW( (LPCWSTR)p ) + 1;
+
+ }
+ }
+
break;
}
+
+ result->caption = L"";
+
/* Get the window caption */
if ( *p != 0 ) {
result->caption = (LPCWSTR)p;
p += lstrlenW( (LPCWSTR)p ) + 1;
-
+
+
+ /* Get the font name */
+
+ if (result->style & DS_SETFONT)
+ {
+ result->pointSize = *p;
+ p++;
+ if (result->dialogEx)
+ {
+ result->weight = *p; p++;
+ result->italic = LOBYTE(*p); p++;
+ }
+ else
+ {
+ result->weight = FW_DONTCARE;
+ result->italic = FALSE;
+ }
+ result->faceName = (LPCWSTR)p;
+ p += lstrlenW( (LPCWSTR)p ) + 1;
+
+ }
+ }
+ else if ( *(p+1) != 0 ) {
+ p++;
+
/* Get the font name */
if (result->style & DS_SETFONT)
p += lstrlenW( (LPCWSTR)p ) + 1;
}
- } else
- result->caption = L"";
+ }
/* First control is on dword boundary */
info->cx = DlgItemTemplate->cx;
info->cy = DlgItemTemplate->cy;
-
+
info->id = DlgItemTemplate->id;
info->className = (LPCSTR)HEAP_strdupW(GetProcessHeap(),0,class_names[id - 0x80]);
else
info->className = NULL;
-
- printf("%S\n",info->className);
-
p++;
}
else
static const WCHAR class_names[6][10] =
{
- { L"Button" }, /* 0x80 */
- { L"Edit"}, /* 0x81 */
- { L"Static" }, /* 0x82 */
- { L"ListBox"}, /* 0x83 */
- { L"ScrollBar" }, /* 0x84 */
- { L"ComboBox" } /* 0x85 */
+ { BUTTON_CLASS_NAME }, /* 0x80 */
+ { EDIT_CLASS_NAME }, /* 0x81 */
+ { STATIC_CLASS_NAME }, /* 0x82 */
+ { LISTBOX_CLASS_NAME}, /* 0x83 */
+ { SCROLLBAR_CLASS_NAME }, /* 0x84 */
+ { COMBOBOX_CLASS_NAME } /* 0x85 */
};
p++;
id = (WORD)*(p);
else
template = (void *)DIALOG_GetControl( (LPDLGITEMTEMPLATE)template, &info );
+
+
hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
(LPCWSTR)info.className,
(LPCWSTR)info.windowName,
- info.style | WS_CHILD | WS_THICKFRAME | WS_VISIBLE,
- info.x * dlgInfo->xBaseUnit / 4,
- info.y * dlgInfo->yBaseUnit / 8,
- info.cx * dlgInfo->xBaseUnit / 4 ,
- info.cy * dlgInfo->yBaseUnit / 8,
+ info.style | WS_CHILD | WS_VISIBLE ,
+ info.x * dlgInfo->xBaseUnit / 4,
+ info.y * dlgInfo->yBaseUnit / 4,
+ info.cx * dlgInfo->xBaseUnit / 4,
+ info.cy * dlgInfo->yBaseUnit / 4,
hWndDialog, (HMENU)info.id,
hInst, info.data );
hwndDefButton = hwndCtrl;
dlgInfo->idResult = GetWindowLong( hwndCtrl, GWL_ID );
}
+
+
}
}
return TRUE;
xUnit = xBaseUnit;
yUnit = yBaseUnit;
+
+
/* Parse dialog template */
FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY,
FF_DONTCARE, (LPCWSTR)template.faceName );
+
if (hFont)
{
TEXTMETRIC tm;
HFONT oldFont;
+ HDC hdc;
+ /* Calculate the dialog base units */
- HDC hdc = GetDC(0);
- oldFont = SelectObject( hdc, hFont );
- GetTextMetrics( hdc, &tm );
- SelectObject( hdc, oldFont );
- ReleaseDC( 0, hdc );
+ hdc = CreateDC( L"DISPLAY", NULL, NULL, NULL );
+ SelectObject( hdc, hFont );
+ GetTextMetrics( hdc, &tm );
+ DeleteDC( hdc );
+
+
xUnit = tm.tmAveCharWidth;
yUnit = tm.tmHeight;
if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
xBaseUnit = xBaseUnit * 5 / 4; /* See DIALOG_Init() */
}
+
}
rect.left = rect.top = 0;
rect.right = template.cx * xUnit / 4;
rect.bottom = template.cy * yUnit / 8;
+
+ //rect.left = template.x;
+ //rect.top = template.y;
+
+ //rect.right = template.cx + template.x;
+ //rect.bottom = template.cy + template.y;
+
if (template.style & DS_MODALFRAME)
template.exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx( &rect, template.style,
rect.right -= rect.left;
rect.bottom -= rect.top;
+
if ((INT)template.x == CW_USEDEFAULT)
{
rect.left = rect.top = CW_USEDEFAULT;
if (template.style & DS_CENTER)
{
rect.left = (SYSMETRICS_CXSCREEN - rect.right) / 2;
- rect.top = (SYSMETRICS_CYSCREEN - rect.bottom) / 2;
+ rect.top = (SYSMETRICS_CYSCREEN - rect.bottom) / 3;
}
else
{
// template.style & ~WS_VISIBLE
-template.style |= WS_VISIBLE;
-template.style |= WS_THICKFRAME;
+//template.style |= WS_VISIBLE;
+//template.style |= WS_THICKFRAME;
+//template.style |= WS_SYSMENU;
hwnd = CreateWindowExW(template.exStyle, (LPCWSTR)template.className,
(LPCWSTR)template.caption,
- template.style ,
+ template.style & ~WS_VISIBLE ,
rect.left, rect.top, rect.right, rect.bottom ,
owner, hMenu, hInst, NULL );
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->dlgProc = dlgProc;
- dlgInfo->hUserFont = hFont;
+ //dlgInfo->hUserFont = hFont;
+ dlgInfo->hUserFont = NULL;
+
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
if (MSG_SendMessage( wndPtr, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param))
SetFocus( dlgInfo->hwndFocus );
+
- //if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
- //{
+ if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
+ {
ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
UpdateWindow( hwnd );
- // }
-
+ }
- PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0,
- RDW_INVALIDATE | RDW_ALLCHILDREN |
- RDW_FRAME | RDW_ERASENOW | RDW_ERASE, 0 );
return hwnd;
}
rect->top = rect->left = 0;
rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
-
- if ((wndPtr->dwStyle & WS_ICONIC) || (wndPtr->flags & WIN_MANAGED)) return;
+// || (wndPtr->flags & WIN_MANAGED)
+ if ((wndPtr->dwStyle & WS_ICONIC) ) return;
/* Remove frame from rectangle */
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
- if ((wndPtr->dwStyle & WS_ICONIC) || (wndPtr->flags & WIN_MANAGED)) return;
+// || (wndPtr->flags & WIN_MANAGED)
+ if ((wndPtr->dwStyle & WS_ICONIC) ) return;
/* Remove frame from rectangle */
if (HAS_FIXEDFRAME (wndPtr->dwStyle, wndPtr->dwExStyle ))
if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
- if (!(wndPtr->flags & WIN_MANAGED))
+// if (!(wndPtr->flags & WIN_MANAGED))
{
/* Check borders */
if (HAS_THICKFRAME( wndPtr->dwStyle ))
if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
- if (!(wndPtr->flags & WIN_MANAGED))
+// if (!(wndPtr->flags & WIN_MANAGED))
{
/* Check borders */
if (HAS_SIZEFRAME( wndPtr->dwStyle ))
HBITMAP hbitmap;
WND *wndPtr = WIN_FindWndPtr( hwnd );
- if( !(wndPtr->flags & WIN_MANAGED) )
+// if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
WND *wndPtr = WIN_FindWndPtr( hwnd );
HDC hdcMem;
- if( !(wndPtr->flags & WIN_MANAGED) )
+// if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
WND *wndPtr = WIN_FindWndPtr( hwnd );
HDC hdcMem;
- if( !(wndPtr->flags & WIN_MANAGED) )
+// if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
- if( !(wndPtr->flags & WIN_MANAGED) )
+// if( !(wndPtr->flags & WIN_MANAGED) )
{
HICON hIcon = 0;
RECT rect;
HDC hdcMem;
WND *wndPtr = WIN_FindWndPtr( hwnd );
- if( !(wndPtr->flags & WIN_MANAGED) )
+// if( !(wndPtr->flags & WIN_MANAGED) )
{
BITMAP bmp;
HBITMAP hBmp, hOldBmp;
HDC hdcMem;
- if( !(wndPtr->flags & WIN_MANAGED) ) {
+// if( !(wndPtr->flags & WIN_MANAGED) )
+ {
GetBitmapDimensionEx((bm = IsZoomed(hwnd) ?
(down ? hbitmapRestoreD : hbitmapRestore ) :
(down ? hbitmapMaximizeD : hbitmapMaximize)),
SIZE bmsz;
HBITMAP bm;
HDC hdcMem;
-
- if( !(wndPtr->flags & WIN_MANAGED) &&
- GetBitmapDimensionEx((bm = down ? hbitmapMinimizeD :
+// !(wndPtr->flags & WIN_MANAGED) &&
+ if( GetBitmapDimensionEx((bm = down ? hbitmapMinimizeD :
hbitmapMinimize), &bmsz)) {
NC_GetInsideRect95( hwnd, &rect );
WND * wndPtr = WIN_FindWndPtr( hwnd );
char buffer[256];
- if (wndPtr->flags & WIN_MANAGED) return;
+// if (wndPtr->flags & WIN_MANAGED) return;
if (!hbitmapClose)
{
SetBkMode( hdc, TRANSPARENT );
DrawTextA( hdc, buffer, -1, &r,
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
+
+
}
}
WND *wndPtr = WIN_FindWndPtr( hwnd );
char buffer[256];
HPEN hPrevPen;
- int txt;
+ int txtlen;
- if (wndPtr->flags & WIN_MANAGED) return;
+// if (wndPtr->flags & WIN_MANAGED) return;
hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) );
MoveToEx( hdc, r.left, r.bottom - 1, NULL );
LineTo( hdc, r.right, r.bottom - 1 );
SelectObject( hdc, hPrevPen );
- // r.bottom - 2;
+ r.bottom - 2;
FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
}
if ( wndPtr->class->bUnicode )
- txt = GetWindowTextW( hwnd, buffer, sizeof(buffer) );
+ txtlen = GetWindowTextW( hwnd, buffer, sizeof(buffer) );
else
- txt = GetWindowTextA( hwnd, buffer, sizeof(buffer) );
+ txtlen = GetWindowTextA( hwnd, buffer, sizeof(buffer) );
- if (txt) {
+ if (txtlen > 0 && txtlen < sizeof(buffer) ) {
NONCLIENTMETRICS nclm;
HFONT hFont, hOldFont;
nclm.cbSize = sizeof(NONCLIENTMETRICS);
if ( wndPtr->class->bUnicode )
DrawTextW( hdc, buffer, -1, &r,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
- else
+ else {
DrawTextA( hdc, buffer, -1, &r,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
+ }
DeleteObject(SelectObject (hdc, hOldFont));
}
}
if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return;
- if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
+ if (ExcludeClipRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
wndPtr->rectClient.top-wndPtr->rectWindow.top,
wndPtr->rectClient.right-wndPtr->rectWindow.left,
wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
+
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
- if (!(wndPtr->flags & WIN_MANAGED))
+// if (!(wndPtr->flags & WIN_MANAGED))
{
if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
(wndPtr->dwExStyle & WS_EX_DLGMODALFRAME))
{
SelectObject( hdc, GetStockObject(NULL_BRUSH) );
- Rectangle( hdc, 0, 0, rect.right, rect.bottom );
+ Rectangle( hdc, rect.top, rect.left, rect.right, rect.bottom );
InflateRect( &rect, -1, -1 );
}
if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return;
- if (ExcludeVisRect( hdc, wndPtr->rectClient.left -wndPtr->rectWindow.left,
+ if (ExcludeClipRect( hdc, wndPtr->rectClient.left -wndPtr->rectWindow.left,
wndPtr->rectClient.top -wndPtr->rectWindow.top,
wndPtr->rectClient.right -wndPtr->rectWindow.left,
wndPtr->rectClient.bottom -wndPtr->rectWindow.top )
return;
}
+
+
rect.top = rect.left = 0;
rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
+ //rect = wndPtr->rectWindow;
+
+ printf("::%d %d\n", rect.right, rect.bottom);
+
+
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
- if(!(wndPtr->flags & WIN_MANAGED)) {
+ //if((wndPtr->flags & WIN_MANAGED)) {
if ((wndPtr->dwStyle & WS_BORDER) && ((wndPtr->dwStyle & WS_DLGFRAME) ||
(wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) || (wndPtr->dwStyle & WS_THICKFRAME))) {
DrawEdge(hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
NC_DrawCaption95 (hdc, &r, hwnd, wndPtr->dwStyle,
wndPtr->dwExStyle, active);
}
- }
+ //}
if (HAS_MENU(wndPtr))
{
{
WND* wndPtr = WIN_FindWndPtr( hwnd );
- if( wndPtr && wndPtr->dwStyle & WS_VISIBLE )
+ //if( wndPtr && wndPtr->dwStyle & WS_VISIBLE )
{
if( wndPtr->dwStyle & WS_MINIMIZE )
WINPOS_RedrawIconTitle( hwnd );
capturePoint = pt = *(POINT*)&dwPoint;
- if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) ||
- (wndPtr->flags & WIN_MANAGED)) return;
+// || (wndPtr->flags & WIN_MANAGED)
+ if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) )
+ return;
if ((wParam & 0xfff0) == SC_MOVE)
{
if (HOOK_IsHooked( WH_CBT ))
{
if ( wndPtr->class->bUnicode == FALSE ) {
- if( HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, hwnd,(LPARAM)&sizingRect) )
+ if( HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE,(WPARAM) hwnd,(LPARAM)&sizingRect) )
sizingRect = wndPtr->rectWindow;
}
else {
- if( HOOK_CallHooksW( WH_CBT, HCBT_MOVESIZE, hwnd,(LPARAM)&sizingRect) )
+ if( HOOK_CallHooksW( WH_CBT, HCBT_MOVESIZE, (WPARAM) hwnd,(LPARAM)&sizingRect) )
sizingRect = wndPtr->rectWindow;
}
}
GetClientRect( hwnd, &rectClient );
+ OffsetRect(&rectClient,5,16);
+
if (flags & RDW_INVALIDATE) /* Invalidate */
{
int rgnNotEmpty = COMPLEXREGION;
if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
SendMessageA( hwnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
}
- else if (flags & RDW_ERASENOW)
+ else
+//if (flags & RDW_ERASENOW)
{
//if (wndPtr->flags & WIN_NEEDS_NCPAINT)
WIN_UpdateNCArea( wndPtr, FALSE);
return TRUE;
}
+
+
/***********************************************************************
* GetControlBrush Not A Win32 API
*/
if (!pWnd)
- return (HANDLE)0;
+ return;
{
PROPERTY *prop, *next;
WND *pWnd;
- INT ret = -1;
- int i;
+ int i = 0;
if (!(pWnd = WIN_FindWndPtr( hwnd )))
return FALSE;
#include <windows.h>
-INT SelectVisRgn(HDC hdc,HRGN hrgn)
-{
- return SelectClipRgn(hdc,hrgn);
-}
-INT RestoreVisRgn(HDC hdc)
-{
- return SelectClipRgn(hdc,NULL);
-}
-INT ExcludeVisRect(HDC hDC,INT nLeftRect,INT nTopRect,INT nRightRect,INT nBottomRect)
-{
- return ExcludeClipRect(hDC, nLeftRect, nTopRect,nRightRect,nBottomRect );
-}
-
-
-HRGN InquireVisRgn(HDC hdc)
-{
- return hdc;
-}
-HRGN SaveVisRgn(HDC hdc)
-{
- return NULL;
-}
-
-/***********************************************************************
- * REGION_UnionRectWithRgn
- * Adds a rectangle to a HRGN32
- * A helper used by scroll.c
- */
-WINBOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
-{
-
- return TRUE;
-}
\ No newline at end of file
wndPtr->parent = WIN_FindWndPtr( cs->hWndParent );
wndPtr->owner = NULL;
}
+ else {
+ wndPtr->owner = NULL;
+ wndPtr->parent = NULL;
+ }
+
+/*
else
{
wndPtr->parent = pWndDesktop;
else
wndPtr->owner = WIN_GetTopParentPtr(WIN_FindWndPtr(cs->hWndParent));
}
-
+ */
wndPtr->winproc = classPtr->winproc;
wndPtr->dwMagic = WND_MAGIC;
- /* Get class or window DC if needed */
-
- if (classPtr->style & CS_OWNDC) wndPtr->dce = DCE_AllocDCE(hWnd,DCE_WINDOW_DC);
- else if (classPtr->style & CS_CLASSDC) wndPtr->dce = classPtr->dce;
- else wndPtr->dce = DCE_AllocDCE(hWnd,DCE_WINDOW_DC);;
-
GetStartupInfoW((STARTUPINFO *)&StartupInfo);
if (cs->x == CW_USEDEFAULT)
{
}
else
{
- cs->cx = 600; /* FIXME */
- cs->cy = 400;
+ cs->cx = SYSMETRICS_CXSCREEN;
+ cs->cy = SYSMETRICS_CYSCREEN;
}
}
- /* Send the WM_GETMINMAXINFO message and fix the size if needed */
+ /* Send the WM_GETMINMAXINFO message and fix the size if needed and appropriate */
- if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
- {
- WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack);
- if (maxSize.x < cs->cx) cs->cx = maxSize.x;
- if (maxSize.y < cs->cy) cs->cy = maxSize.y;
- if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
- if (cs->cy < minTrack.y ) cs->cy = minTrack.y;
- }
+ if ( !(cs->style & (WS_POPUP | WS_CHILD) )) {
+
+ if ((cs->style & WS_THICKFRAME) )
+ {
+
+ WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack);
+ if (maxSize.x < cs->cx) cs->cx = maxSize.x;
+ if (maxSize.y < cs->cy) cs->cy = maxSize.y;
+ if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
+ if (cs->cy < minTrack.y ) cs->cy = minTrack.y;
+ }
+
+
+ }
if(cs->style & WS_CHILD)
{
if(cs->cx < 0) cs->cx = 0;
wndPtr->rectWindow.right = cs->x + cs->cx;
wndPtr->rectWindow.bottom = cs->y + cs->cy;
+ wndPtr->rectClient= wndPtr->rectWindow;
- wndPtr->rectClient = wndPtr->rectWindow;
+
+ printf(":%d %d %d %d\n", wndPtr->rectWindow.left, wndPtr->rectWindow.top,
+ wndPtr->rectWindow.right, wndPtr->rectWindow.bottom);
+
+ /* Get class or window DC if needed */
+
+ if (classPtr->style & CS_OWNDC)
+ wndPtr->dce = DCE_AllocDCE(wndPtr,DCE_WINDOW_DC);
+ else if (classPtr->style & CS_CLASSDC)
+ wndPtr->dce = classPtr->dce;
+ else if ( classPtr->style & CS_PARENTDC)
+ wndPtr->dce = wndPtr->parent->dce;
+ else wndPtr->dce = DCE_AllocDCE(wndPtr,DCE_WINDOW_DC);;
+
+
+ //wndPtr->rectClient.top = wndPtr->rectClient.left = 0;
+ //wndPtr->rectClient.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
+ //wndPtr->rectClient.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
/* Set the window menu */
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWCREATED, (INT)hWnd, 0L, classPtr->bUnicode);
-
return hWnd;
}
+WINBOOL WIN_GetClientRect(WND *wndPtr, LPRECT lpRect )
+{
+ if ( lpRect == NULL )
+ return FALSE;
+ lpRect->left = lpRect->top = lpRect->right = lpRect->bottom = 0;
+ if (wndPtr)
+ {
+ lpRect->right = wndPtr->rectClient.right - wndPtr->rectClient.left;
+ lpRect->bottom = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
+ }
+ return TRUE;
+}
+
/*******************************************************************
* GetSysModalWindow16 (USER.52)
internal/win.o internal/dce.o internal/msg.o internal/queue.o\
internal/signal.o internal/event.o internal/timer.o internal/region.o\
internal/text.o internal/defwnd.o internal/paint.o internal/uitools.o\
- internal/dialog.o
+ internal/dialog.o internal/winpos.o
MISC_OBJECTS = misc/sprintf.o misc/dllmain.o misc/string.o misc/sysmetr.o\
misc/main.o misc/bitmap.o misc/cursor.o misc/vk.o
-# $Id: makefile_rex,v 1.7 1999/08/29 13:44:58 dwelch Exp $
+# $Id: makefile_rex,v 1.8 1999/12/01 22:30:45 ariadne Exp $
#
# ReactOS Operating System
#
all: $(DLLTARGET)
-MISC_OBJECTS = misc/sprintf.o misc/exitwin.o misc/dllmain.o #misc/string.o
+MISC_OBJECTS = misc/sprintf.o misc/exitwin.o misc/dllmain.o misc/string.o misc/sysmetr.o
#RESOURCE_OBJECT = $(TARGET).coff
-WINDOWS_OBJECTS = windows/message.o windows/wndproc.o windows/win.o windows/hook.o windows/spy.o\
+WINDOWS_OBJECTS = windows/msg.o windows/wndproc.o windows/win.o windows/hook.o windows/spy.o\
#windows/queue.o
OBJECTS = $(MISC_OBJECTS) $(WINDOWS_OBJECTS)
HBITMAP BITMAP_LoadBitmapW(HINSTANCE instance,LPCWSTR name, UINT loadflags);
-HBITMAP LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName)
+
+
+HBITMAP
+STDCALL
+LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName)
{
return BITMAP_LoadBitmapW(hInstance, lpBitmapName, 0);
}
-HBITMAP LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
+HBITMAP
+STDCALL
+LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
{
return CreateBitmap(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CXSMICON),
int main(int argc, char **argv)
{
- WIDGETS_Init();
-#if 0
+
+
HWND hwnd;
HWND User32hWnd;
HMENU hmenu;
HANDLE hMod, hrsrc;
RECT rect, cl;
+ WIDGETS_Init();
+
wc1.hInstance = hInst;
wc1.lpszClassName = szName;
wc1.lpfnWndProc = WindowFunc;
hwnd = CreateWindowEx
(0, szName, "test2", WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
+ CW_USEDEFAULT,CW_USEDEFAULT,100,100,
NULL,NULL,hInst, NULL);
- MessageBox(NULL,"Hallo","Hallo",MB_OK);
+
ShowWindow(hwnd,nWinMode);
UpdateWindow(hwnd);
-#endif
- MessageBox(NULL,"xxx","yyyy",MB_OK);
-#if 0
+
+
+
+ MessageBox(hwnd,"xxx","yyyy",MB_OK);
+
GetWindowRect(hwnd,&rect);
GetClientRect(hwnd,&cl);
printf("%d\n",(rect.left - rect.right) - (cl.left - cl.right));
SetWindowText(hwnd,"Hallo3");
- DrawMenuBar(hwnd);
+// DrawMenuBar(hwnd);
// SendMessage( hwnd, WM_MOVE, 0,MAKELONG(0,0));
// SendMessage( hwnd, WM_PAINT, GetWindowDC(hwnd),0);
while(GetMessage(&msg,NULL, 0, 0))
}
Sleep(10000);
return msg.wParam;
-#endif
+
}
* Copyright 1996 Marcus Meissner
*/
+#include <ddk/ntddk.h>
#include <windows.h>
#include <string.h>
#include <stdarg.h>
#include <wchar.h>
-#include <ddk/ntddk.h>
+
/* Funny to divide them between user and kernel. */
#include <windows.h>
-SHORT GetKeyState( int nVirtKey )
+SHORT
+STDCALL
+GetKeyState( int nVirtKey )
+{
+ return 0;
+}
+
+UINT
+STDCALL
+GetKBCodePage(
+ VOID)
{
return 0;
}
+SHORT
+STDCALL
+GetAsyncKeyState(
+ int vKey)
+{
+ return 0;
+}
+
+
+WINBOOL
+STDCALL
+GetKeyboardState(
+ PBYTE lpKeyState)
+{
+ return FALSE;
+}
+
+
+WINBOOL
+STDCALL
+SetKeyboardState(
+ LPBYTE lpKeyState)
+{
+ return FALSE;
+}
+
+
+int
+STDCALL
+GetKeyboardType(
+ int nTypeFlag)
+{
+ return 0;
+}
+
+
int
STDCALL
ToAscii(
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,13,RES_UINT_FILE_VERSION
+ FILEVERSION 0,0,13,0
PRODUCTVERSION 0,0,13,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "user32.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
- VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
+
END
END
BLOCK "VarFileInfo"
FONT 8, "MS Sans Serif"
BEGIN
ICON "", 1088, 9, 20, 16, 16, WS_CHILD | WS_VISIBLE
- LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
+ LTEXT "", 100, 48, 16, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "&OK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Yes", 6, 206, 26, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
\ No newline at end of file
return atom;
}
-WINBOOL UnregisterClassA(LPCSTR lpClassName, HINSTANCE hInstance )
+WINBOOL STDCALL UnregisterClassA(LPCSTR lpClassName, HINSTANCE hInstance )
{
CLASS *classPtr;
classPtr = CLASS_FindClassByAtom( STRING2ATOMA(lpClassName), hInstance );
-WINBOOL UnregisterClassW(LPCWSTR lpClassName, HINSTANCE hInstance )
+WINBOOL STDCALL UnregisterClassW(LPCWSTR lpClassName, HINSTANCE hInstance )
{
CLASS *classPtr;
classPtr = CLASS_FindClassByAtom( STRING2ATOMW(lpClassName), hInstance );
}
-WINBOOL GetClassInfoA( HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASS lpWndClass )
+WINBOOL STDCALL GetClassInfoA( HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASS lpWndClass )
{
- return FALSE;
+ CLASS *classPtr;
+ ATOM a;
+
+ if ( HIWORD(lpClassName) != 0 )
+ a = FindAtomA(lpClassName);
+ else
+ a = lpClassName;
+
+ classPtr = CLASS_FindClassByAtom( a, hInstance );
+ if ( classPtr == NULL )
+ return FALSE;
+
+
+ lpWndClass->style = classPtr->style;
+ lpWndClass->lpfnWndProc = classPtr->winproc;
+ lpWndClass->cbClsExtra = classPtr->cbWndExtra;
+ lpWndClass->cbClsExtra = classPtr->cbClsExtra;
+ lpWndClass->hInstance = classPtr->hInstance;
+ lpWndClass->hIcon = classPtr->hIcon;
+ lpWndClass->hCursor = classPtr->hCursor;
+ lpWndClass->hbrBackground = classPtr->hbrBackground;
+ return TRUE;
}
-WINBOOL GetClassInfoW( HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASS lpWndClass )
+WINBOOL STDCALL GetClassInfoW( HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASS lpWndClass )
{
CLASS *classPtr;
ATOM a;
}
-WINBOOL GetClassInfoExA( HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASSEX lpWndClass )
+WINBOOL STDCALL GetClassInfoExA( HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASSEX lpWndClassEx )
{
- return FALSE;
+ CLASS *classPtr;
+ ATOM a;
+
+ if ( HIWORD(lpClassName) != 0 )
+ a = FindAtomA(lpClassName);
+ else
+ a = (ATOM)lpClassName;
+
+ classPtr = CLASS_FindClassByAtom( a, hInstance );
+ if ( classPtr == NULL )
+ return FALSE;
+
+
+ if ( lpWndClassEx ->cbSize != sizeof(WNDCLASSEX) )
+ return FALSE;
+
+
+ lpWndClassEx->style = classPtr->style;
+ lpWndClassEx->lpfnWndProc = classPtr->winproc;
+ lpWndClassEx->cbClsExtra = classPtr->cbWndExtra;
+ lpWndClassEx->cbClsExtra = classPtr->cbClsExtra;
+ lpWndClassEx->hInstance = classPtr->hInstance;
+ lpWndClassEx->hIcon = classPtr->hIcon;
+ lpWndClassEx->hCursor = classPtr->hCursor;
+ lpWndClassEx->hbrBackground = classPtr->hbrBackground;
+
+
+ return TRUE;
}
-WINBOOL GetClassInfoExW( HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASSEX lpWndClassEx )
+WINBOOL STDCALL GetClassInfoExW( HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASSEX lpWndClassEx )
{
CLASS *classPtr;
return TRUE;
}
-int GetClassNameA(HWND hWnd, LPSTR lpClassName, int nMaxCount )
+int STDCALL GetClassNameA(HWND hWnd, LPSTR lpClassName, int nMaxCount )
{
WND *wndPtr = WIN_FindWndPtr(hWnd);
}
-int GetClassNameW(HWND hWnd, LPWSTR lpClassName, int nMaxCount )
+int STDCALL GetClassNameW(HWND hWnd, LPWSTR lpClassName, int nMaxCount )
{
WND *wndPtr = WIN_FindWndPtr(hWnd);
}
-DWORD GetClassLongA(HWND hWnd, int nIndex )
+DWORD STDCALL GetClassLongA(HWND hWnd, int nIndex )
{
WND * wndPtr;
return 0;
}
-DWORD GetClassLongW(HWND hWnd, int nIndex )
+DWORD STDCALL GetClassLongW(HWND hWnd, int nIndex )
{
WND * wndPtr;
extern DCE *firstDCE;
-INT SelectVisRgn(HDC hdc,HRGN hrgn);
-INT ExcludeVisRect(HDC hDC,INT nLeftRect,INT nTopRect,INT nRightRect,INT nBottomRect);
-INT RestoreVisRgn(HDC hdc);
HDC STDCALL GetDC( HWND hWnd )
*/
-HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
+HDC STDCALL GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{
HRGN hrgnVisible = 0;
HDC hdc = 0;
/* fixup flags */
-#if 0
- if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC)))
- flags |= DCX_CACHE;
-
- if (flags & DCX_USESTYLE)
- {
- flags &= ~( DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
-
- if( wndPtr->dwStyle & WS_CLIPSIBLINGS )
- flags |= DCX_CLIPSIBLINGS;
-
- if ( !(flags & DCX_WINDOW) )
- {
- if (wndPtr->class->style & CS_PARENTDC) flags |= DCX_PARENTCLIP;
-
- if (wndPtr->dwStyle & WS_CLIPCHILDREN &&
- !(wndPtr->dwStyle & WS_MINIMIZE) ) flags |= DCX_CLIPCHILDREN;
- }
- else flags |= DCX_CACHE;
- }
-
-
- if( flags & DCX_NOCLIPCHILDREN )
- {
- flags |= DCX_CACHE;
- flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
- }
-
-
- if (flags & DCX_WINDOW)
- flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
-
-#endif
if (!(wndPtr->dwStyle & WS_CHILD) || !wndPtr->parent )
flags &= ~DCX_PARENTCLIP;
dcxFlags = flags & (DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_CACHE | DCX_WINDOW);
-#if 0
- if (flags & DCX_CACHE)
- {
- DCE* dceEmpty;
- DCE* dceUnused;
-
- dceEmpty = dceUnused = NULL;
- /* Strategy: First, we attempt to find a non-empty but unused DCE with
- * compatible flags. Next, we look for an empty entry. If the cache is
- * full we have to purge one of the unused entries.
- */
-
- for (dce = firstDCE; (dce); dce = dce->next)
- {
- if ((dce->DCXflags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE )
- {
- dceUnused = dce;
-
- if (dce->DCXflags & DCX_DCEEMPTY)
- dceEmpty = dce;
- else
- if ((dce->hwndCurrent == hwnd)
- && ((dce->DCXflags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
- DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)) == dcxFlags))
- {
- DPRINT("\tfound valid %08x dce [%04x], flags %08x\n",
- (unsigned)dce, hwnd, (unsigned)dcxFlags );
- bUpdateVisRgn = FALSE;
- bUpdateClipOrigin = TRUE;
- break;
- }
- }
- }
- if (!dce) dce = (dceEmpty) ? dceEmpty : dceUnused;
- }
- else
- {
- if (wndPtr->class->style & CS_OWNDC)
- dce = wndPtr->dce;
- else if ( wndPtr->class->style & CS_CLASSDC)
- dce = wndPtr->class->dce;
- else
- return 0;
-
- if( dce->hwndCurrent == hwnd )
- {
- DPRINT("\tskipping hVisRgn update\n");
- bUpdateVisRgn = FALSE; /* updated automatically, via DCHook() */
-
- if( (dce->DCXflags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) &&
- (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) )
- {
- /* This is likely to be a nested BeginPaint(). */
-
- if( dce->hClipRgn != hrgnClip )
- {
- DPRINT("fixme new hrgnClip[%04x] smashes the previous[%04x]\n",
- hrgnClip, dce->hClipRgn );
- DCE_DeleteClipRgn( dce );
- }
- else
- RestoreVisRgn(dce->hDC);
- }
- }
- }
- if (!dce) return 0;
-
-#endif
dce = wndPtr->dce;
dce->hwndCurrent = hwnd;
dce->hClipRgn = 0;
dce->DCXflags = dcxFlags | (flags & DCX_WINDOWPAINT) | DCX_DCEBUSY;
hdc = dce->hDC;
-
- //if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
- //bUpdateVisRgn = bUpdateVisRgn || (dc->w.flags & DC_DIRTY);
+
/* recompute visible region */
- //wndPtr->pDriver->pSetDrawable( wndPtr, dc, flags, bUpdateClipOrigin );
+
if( bUpdateVisRgn )
{
DPRINT("updating visrgn for %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
if ((hwnd == GetDesktopWindow())) {
hrgnVisible = CreateRectRgn( 0, 0, SYSMETRICS_CXSCREEN,
SYSMETRICS_CYSCREEN );
-// (rootWindow == DefaultRootWindow(display))
}
else
{
//dc->w.flags &= ~DC_DIRTY;
dce->DCXflags &= ~DCX_DCEDIRTY;
- SelectVisRgn( hdc, hrgnVisible );
+ SelectClipRgn( hdc, hrgnVisible );
}
else
DPRINT("no visrgn update %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
if( flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) )
{
- if( !hrgnVisible ) hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
+ if( !hrgnVisible )
+ hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
dce->DCXflags |= flags & (DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_EXCLUDERGN);
dce->hClipRgn = hrgnClip;
DPRINT( "\tsaved VisRgn, clipRgn = %04x\n", hrgnClip);
- SaveVisRgn( hdc );
+
CombineRgn( hrgnVisible, hrgnClip, 0, RGN_COPY );
DCE_OffsetVisRgn( hdc, hrgnVisible );
- CombineRgn( hrgnVisible, InquireVisRgn( hdc ), hrgnVisible,
- (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
- SelectVisRgn( hdc, hrgnVisible );
+
+ SelectClipRgn( hdc, hrgnVisible );
}
if( hrgnVisible ) DeleteObject( hrgnVisible );
return 0;
}
-HDC GetWindowDC(HWND hWnd )
+HDC STDCALL GetWindowDC(HWND hWnd )
{
if (!hWnd) hWnd = GetDesktopWindow();
return GetDCEx( hWnd, 0, DCX_USESTYLE | DCX_WINDOW );
#include <user32/widgets.h>
#include <user32/dialog.h>
#include <user32/win.h>
+#include <user32/paint.h>
*
* FIXME: I don't know if this is correct
*/
-HHOOK SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId )
+HHOOK STDCALL SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId )
{
return HOOK_SetHook( idHook, lpfn, HOOK_WINA, hMod, dwThreadId );
*
* FIXME: I don't know if this is correct
*/
-HHOOK SetWindowsHookExW(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId )
+HHOOK STDCALL SetWindowsHookExW(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId )
{
- return HOOK_SetHook( idHook, lpfn, HOOK_WIN32W, hMod, dwThreadId );
+ return HOOK_SetHook( idHook, lpfn, HOOK_WINW, hMod, dwThreadId );
}
WINBOOL HOOK_RemoveHook( HANDLE hook )
{
HOOKDATA *data;
- HANDLE *prevHook;
+ HANDLE *prevHook = NULL;
+++ /dev/null
-#include <windows.h>
-#include <user32/message.h>
-#include <user32/winproc.h>
-#include <user32/win.h>
-#include <user32/spy.h>
-#include <user32/hook.h>
-
-
-/***********************************************************************
- * SendMessage Send Window Message
- *
- * Sends a message to the window procedure of the specified window.
- * SendMessage() will not return until the called window procedure
- * either returns or calls ReplyMessage().
- *
- * Use PostMessage() to send message and return immediately. A window
- * procedure may use InSendMessage() to detect
- * SendMessage()-originated messages.
- *
- * Applications which communicate via HWND_BROADCAST may use
- * RegisterWindowMessage() to obtain a unique message to avoid conflicts
- * with other applications.
- *
- * CONFORMANCE
- *
- * ECMA-234, Win
- */
-
-
-#if 0
-LRESULT STDCALL SendMessageA( HWND hwnd, UINT msg, WPARAM wParam,
- LPARAM lParam )
-{
- return MSG_SendMessage( hwnd, msg, wParam, lParam, FALSE );
-}
-
-
-
-LRESULT STDCALL SendMessageW( HWND hwnd, UINT msg, WPARAM wParam,
- LPARAM lParam )
-{
- return MSG_SendMessage( hwnd, msg, wParam, lParam, TRUE );
-}
-#endif
-
-
-/***********************************************************************
- * MSG_SendMessage
- *
- * Implementation of an inter-task SendMessage.
- */
-LRESULT MSG_SendMessage( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, WINBOOL bUnicode )
-{
- WND * wndPtr;
- LRESULT ret;
- MSG msg;
-
-
-// SPY_EnterMessage( SPY_SENDMESSAGE, hwnd, msg, wParam, lParam );
-#if 0
- WND **list, **ppWnd;
- if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST)
- {
- if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
- return TRUE;
- for (ppWnd = list; *ppWnd; ppWnd++)
- {
- wndPtr = *ppWnd;
- if (!WIN_IsWindow(wndPtr->hwndSelf))
- continue;
- if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION)
- MSG_SendMessage( wndPtr->hwndSelf, message, wParam, lParam, bUnicode );
- }
- WIN_DestroyList( list );
- return TRUE;
- }
-#endif
-
- if (HOOK_IsHooked( WH_CALLWNDPROC ))
- MSG_CallWndProcHook( (LPMSG)&hwnd, FALSE);
-
- if (!(wndPtr = WIN_FindWndPtr( hwnd )))
- {
- return 0;
- }
-
-
- msg.hwnd = hwnd;
- msg.message = message;
- msg.wParam = wParam;
- msg.lParam = lParam;
- msg.time = 0;
- msg.pt.x = 0;
- msg.pt.y = 0;
-
-
- // SPY_ExitMessage( SPY_RESULT_OK, hwnd, msg, ret );
- return ret;
-}
-
-
-
-/************************************************************************
- * MSG_CallWndProcHook
- */
-void MSG_CallWndProcHook( LPMSG pmsg, WINBOOL bUnicode )
-{
- CWPSTRUCT cwp;
-
- cwp.lParam = pmsg->lParam;
- cwp.wParam = pmsg->wParam;
- cwp.message = pmsg->message;
- cwp.hwnd = pmsg->hwnd;
-
- if (bUnicode)
- HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
- else
- HOOK_CallHooksA( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp );
-
- pmsg->lParam = cwp.lParam;
- pmsg->wParam = cwp.wParam;
- pmsg->message = cwp.message;
- pmsg->hwnd = cwp.hwnd;
-}
-
-
-/***********************************************************************
- * MSG_InternalGetMessage
- *
- * GetMessage() function for internal use. Behave like GetMessage(),
- * but also call message filters and optionally send WM_ENTERIDLE messages.
- * 'hwnd' must be the handle of the dialog or menu window.
- * 'code' is the message filter value (MSGF_??? codes).
- */
-WINBOOL MSG_InternalGetMessage( MSG *msg, HWND hwnd, HWND hwndOwner,
- WPARAM code, WORD flags, WINBOOL sendIdle )
-{
-}
\ No newline at end of file
const RECT *prLClip, HRGN hrgnUpdate,
LPRECT rcUpdate )
{
-#if 0
+
+
RECT rClip;
POINT src, dest;
INT ldx, ldy;
-
+ SIZE vportExt;
+ SIZE wndExt;
+ POINT DCOrg;
if (!hdc ) return FALSE;
-
+
+ GetViewportExtEx( hdc,&vportExt);
+ GetWindowExtEx(hdc, &wndExt);
+ GetDCOrgEx(hdc,&DCOrg);
/* compute device clipping region */
return FALSE;
}
- SaveVisRgn( hdc );
- IntersectVisRect( hdc, rClip.left, rClip.top,
- rClip.right, rClip.bottom );
+
+ /// IntersectVisRect( hdc, rClip.left, rClip.top,
+ // rClip.right, rClip.bottom );
/* translate coordinates */
- ldx = dx * dc->wndExtX / dc->vportExtX;
- ldy = dy * dc->wndExtY / dc->vportExtY;
+
+ ldx = dx * wndExt.cx / vportExt.cx;
+ ldy = dy * wndExt.cy / vportExt.cy;
if (dx > 0)
dest.x = (src.x = rClip.left) + ldx;
/* restore clipping region */
- RestoreVisRgn( hdc );
+ SelectClipRgn( hdc,NULL );
/* compute update areas */
- if ( (hrgnUpdate || rcUpdate) && dc->w.hVisRgn )
+ //&& dc->w.hVisRgn
+ if ( (hrgnUpdate || rcUpdate) )
{
HRGN hrgn = (hrgnUpdate) ? hrgnUpdate : CreateRectRgn( 0,0,0,0 );
HRGN hrgnClip;
- LPtoDP( hdc, (LPPOINT)&rClip, 2 );
- OffsetRect( &rClip, dc->w.DCOrgX, dc->w.DCOrgY );
+ //LPtoDP( hdc, (LPPOINT)&rClip, 2 );
+ OffsetRect( &rClip, DCOrg.x, DCOrg.y );
hrgnClip = CreateRectRgnIndirect( &rClip );
- CombineRgn( hrgn, dc->w.hVisRgn, hrgnClip, RGN_AND );
+ //CombineRgn( hrgn, dc->w.hVisRgn, hrgnClip, RGN_AND );
OffsetRgn( hrgn, dx, dy );
- CombineRgn( hrgn, dc->w.hVisRgn, hrgn, RGN_DIFF );
+ //CombineRgn( hrgn, dc->w.hVisRgn, hrgn, RGN_DIFF );
CombineRgn( hrgn, hrgn, hrgnClip, RGN_AND );
- OffsetRgn( hrgn, -dc->w.DCOrgX, -dc->w.DCOrgY );
+ OffsetRgn( hrgn, -DCOrg.x, -DCOrg.y );
if( rcUpdate ) GetRgnBox( hrgnUpdate, rcUpdate );
if (!hrgnUpdate) DeleteObject( hrgn );
DeleteObject( hrgnClip );
}
-#endif
+
return TRUE;
}
#include <windows.h>
-UINT SetTimer( HWND hWnd,UINT nIDEvent,
+UINT STDCALL SetTimer( HWND hWnd,UINT nIDEvent,
UINT uElapse, TIMERPROC lpTimerFunc
)
{
return FALSE;
}
-WINBOOL IsWindow(HANDLE hWnd)
+WINBOOL STDCALL IsWindow(HANDLE hWnd)
{
if (WIN_FindWndPtr( hWnd ) == NULL) return FALSE;
return TRUE;
WINBOOL STDCALL IsWindowUnicode( HWND hWnd )
{
WND * wndPtr;
-// What if handle is invalid ??
if (!(wndPtr = WIN_FindWndPtr(hWnd)))
return FALSE;
}
-/***********************************************************************
- * ShowWindow (USER32.534)
- */
-WINBOOL STDCALL ShowWindow( HWND hwnd, INT cmd )
-{
- WND* wndPtr = WIN_FindWndPtr( hwnd );
- WINBOOL wasVisible = FALSE, showFlag;
- RECT newPos = {0, 0, 0, 0};
- int swp = 0;
-
- if (!wndPtr) return FALSE;
-
-// DPRINT("hwnd=%04x, cmd=%d\n", hwnd, cmd);
-#ifdef OPTIMIZATION
-
- wasVisible = (wndPtr->dwStyle & WS_VISIBLE) != 0;
-#endif
-
- switch(cmd)
- {
- case SW_HIDE:
- if (!wasVisible) return FALSE;
- swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
- SWP_NOACTIVATE | SWP_NOZORDER;
- break;
-
- case SW_SHOWMINNOACTIVE:
- swp |= SWP_NOACTIVATE | SWP_NOZORDER;
- /* fall through */
- case SW_SHOWMINIMIZED:
- swp |= SWP_SHOWWINDOW;
- /* fall through */
- case SW_MINIMIZE:
- swp |= SWP_FRAMECHANGED;
- if( !(wndPtr->dwStyle & WS_MINIMIZE) )
- swp |= WINPOS_MinMaximize( wndPtr, SW_MINIMIZE, &newPos );
- else swp |= SWP_NOSIZE | SWP_NOMOVE;
- break;
-
- case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
- swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
- if( !(wndPtr->dwStyle & WS_MAXIMIZE) )
- swp |= WINPOS_MinMaximize( wndPtr, SW_MAXIMIZE, &newPos );
- else swp |= SWP_NOSIZE | SWP_NOMOVE;
- break;
-
- case SW_SHOWNA:
- swp |= SWP_NOACTIVATE | SWP_NOZORDER;
- /* fall through */
- case SW_SHOW:
- swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
- break;
-
- case SW_SHOWNOACTIVATE:
- swp |= SWP_NOZORDER;
- if (GetActiveWindow()) swp |= SWP_NOACTIVATE;
- /* fall through */
- case SW_SHOWNORMAL: /* same as SW_NORMAL: */
- case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
- case SW_RESTORE:
- swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
-
- if( wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE) )
- swp |= WINPOS_MinMaximize( wndPtr, SW_RESTORE, &newPos );
- else swp |= SWP_NOSIZE | SWP_NOMOVE;
- break;
- }
-
- showFlag = (cmd != SW_HIDE);
- if (showFlag != wasVisible)
- {
- SendMessageW( hwnd, WM_SHOWWINDOW, showFlag, 0 );
- if (!IsWindow( hwnd )) return wasVisible;
- }
-
- if ((wndPtr->dwStyle & WS_CHILD) &&
- !IsWindowVisible( wndPtr->parent->hwndSelf ) &&
- (swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE) )
- {
- /* Don't call SetWindowPos() on invisible child windows */
- if (cmd == SW_HIDE) wndPtr->dwStyle &= ~WS_VISIBLE;
- else wndPtr->dwStyle |= WS_VISIBLE;
- }
- else
- {
- /* We can't activate a child window */
- if (wndPtr->dwStyle & WS_CHILD) swp |= SWP_NOACTIVATE | SWP_NOZORDER;
- SetWindowPos( hwnd, HWND_TOP,
- newPos.left, newPos.top, newPos.right, newPos.bottom, swp );
- if (!IsWindow( hwnd )) return wasVisible;
- else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( wndPtr, TRUE );
- }
- if (wndPtr->flags & WIN_NEED_SIZE)
- {
- /* should happen only in CreateWindowEx() */
- int wParam = SIZE_RESTORED;
-
- wndPtr->flags &= ~WIN_NEED_SIZE;
- if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED;
- else if (wndPtr->dwStyle & WS_MINIMIZE) wParam = SIZE_MINIMIZED;
- SendMessageW( hwnd, WM_SIZE, wParam,
- MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
- wndPtr->rectClient.bottom-wndPtr->rectClient.top));
- SendMessageW( hwnd, WM_MOVE, 0,
- MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) );
- }
-
-
- // SendMessage(hwnd, WM_NCACTIVATE,TRUE,0);
- // SendMessage(hwnd, WM_NCPAINT,CreateRectRgn(100,100,100, 100) ,0);
-
-
-
- return wasVisible;
-}
/*******************************************************************
#include <windows.h>
#include <string.h>
#include <user32/sysmetr.h>
+#include <user32/caret.h>
#include <user32/win.h>
#include <user32/queue.h>
#include <user32/winpos.h>
#include <user32/paint.h>
#include <user32/debug.h>
-HWND ICONTITLE_Create( WND *pWnd );
HWND GetSysModalWindow(void);
-/* ----- internal variables ----- */
-
-static HWND hwndActive = 0; /* Currently active window */
-static HWND hwndPrevActive = 0; /* Previously active window */
-//static HWND hGlobalShellWindow=0; /*the shell*/
-
-static LPCSTR atomInternalPos;
-
extern MESSAGEQUEUE* pActiveQueue;
HWND STDCALL GetActiveWindow(void)
-{
- return hwndActive;
+{
+ return WINPOS_GetActiveWindow();
}
-HWND SetActiveWindow(HWND hWnd )
+HWND STDCALL SetActiveWindow(HWND hWnd )
{
HWND hPrev;
hPrev = GetActiveWindow();
return NULL;
}
-WINBOOL
-STDCALL
-SetWindowPos(
- HWND hWnd, HWND hWndInsertAfter ,
+
+/***********************************************************************
+ * ShowWindow (USER32.534)
+ */
+WINBOOL STDCALL ShowWindow( HWND hwnd, INT cmd )
+{
+ WND* wndPtr = WIN_FindWndPtr( hwnd );
+ WINBOOL wasVisible = FALSE, showFlag;
+ RECT newPos = {0, 0, 100, 100};
+ int swp = 0;
+
+ if (!wndPtr) return FALSE;
+
+#ifdef OPTIMIZATION
+
+ wasVisible = (wndPtr->dwStyle & WS_VISIBLE) != 0;
+#endif
+
+ switch(cmd)
+ {
+ case SW_HIDE:
+ if (!wasVisible) return FALSE;
+ swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
+ SWP_NOACTIVATE | SWP_NOZORDER;
+ break;
+
+ case SW_SHOWMINNOACTIVE:
+ swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+ /* fall through */
+ case SW_SHOWMINIMIZED:
+ swp |= SWP_SHOWWINDOW;
+ /* fall through */
+ case SW_MINIMIZE:
+ swp |= SWP_FRAMECHANGED;
+ if( !(wndPtr->dwStyle & WS_MINIMIZE) )
+ swp |= WINPOS_MinMaximize( wndPtr, SW_MINIMIZE, &newPos );
+ else swp |= SWP_NOSIZE | SWP_NOMOVE;
+ break;
+
+ case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
+ swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
+ if( !(wndPtr->dwStyle & WS_MAXIMIZE) )
+ swp |= WINPOS_MinMaximize( wndPtr, SW_MAXIMIZE, &newPos );
+ else swp |= SWP_NOSIZE | SWP_NOMOVE;
+ break;
+
+ case SW_SHOWNA:
+ swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+ /* fall through */
+ case SW_SHOW:
+ swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+ break;
+
+ case SW_SHOWNOACTIVATE:
+ swp |= SWP_NOZORDER;
+ if (GetActiveWindow()) swp |= SWP_NOACTIVATE;
+ /* fall through */
+ case SW_SHOWNORMAL: /* same as SW_NORMAL: */
+ case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
+ case SW_RESTORE:
+ swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
+
+ if( wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE) )
+ swp |= WINPOS_MinMaximize( wndPtr, SW_RESTORE, &newPos );
+ else swp |= SWP_NOSIZE | SWP_NOMOVE;
+ break;
+ }
+
+ showFlag = (cmd != SW_HIDE);
+ if (showFlag != wasVisible)
+ {
+ SendMessageW( hwnd, WM_SHOWWINDOW, showFlag, 0 );
+ if (!IsWindow( hwnd )) return wasVisible;
+ }
+
+ if ((wndPtr->dwStyle & WS_CHILD) &&
+ !IsWindowVisible( wndPtr->parent->hwndSelf ) &&
+ (swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE) )
+ {
+ /* Don't call SetWindowPos() on invisible child windows */
+ if (cmd == SW_HIDE) wndPtr->dwStyle &= ~WS_VISIBLE;
+ else wndPtr->dwStyle |= WS_VISIBLE;
+ }
+ else
+ {
+ /* We can't activate a child window */
+ if (wndPtr->dwStyle & WS_CHILD) swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+ SetWindowPos( hwnd, HWND_TOP,
+ newPos.left, newPos.top, newPos.right, newPos.bottom, swp );
+ if (!IsWindow( hwnd )) return wasVisible;
+ else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( wndPtr, TRUE );
+ }
+
+ if (wndPtr->flags & WIN_NEED_SIZE)
+ {
+ /* should happen only in CreateWindowEx() */
+ int wParam = SIZE_RESTORED;
+
+ wndPtr->flags &= ~WIN_NEED_SIZE;
+ if (wndPtr->dwStyle & WS_MAXIMIZE)
+ wParam = SIZE_MAXIMIZED;
+ else if (wndPtr->dwStyle & WS_MINIMIZE)
+ wParam = SIZE_MINIMIZED;
+ SendMessageW( hwnd, WM_SIZE, wParam,
+ MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
+ wndPtr->rectClient.bottom-wndPtr->rectClient.top));
+ SendMessageW( hwnd, WM_MOVE, 0,
+ MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) );
+ }
+
+ SetWindowPos( hwnd, HWND_TOP,
+ newPos.left, newPos.top, newPos.right, newPos.bottom, swp );
+
+ // SendMessage(hwnd, WM_NCACTIVATE,TRUE,0);
+ // SendMessage(hwnd, WM_NCPAINT,CreateRectRgn(100,100,100, 100) ,0);
+
+
+
+ return wasVisible;
+}
+
+
+WINBOOL STDCALL SetWindowPos( HWND hWnd, HWND hWndInsertAfter ,
int X, int Y,
int cx, int cy,
UINT flags)
* TODO: Optimize conditions that trigger DCE update.
*/
+#if 0
if( (((winpos.flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) &&
wndPtr->dwStyle & WS_VISIBLE) ||
(flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)) )
}
DeleteObject(visRgn);
}
-
+#endif
if (flags & SWP_SHOWWINDOW)
{
wndPtr->dwStyle |= WS_VISIBLE;
}
if (hWnd == CARET_GetHwnd()) DestroyCaret();
- if (winpos.hwnd == hwndActive)
+ if (winpos.hwnd == GetActiveWindow())
WINPOS_ActivateOtherWindow( wndPtr );
}
-/***********************************************************************
- * WINPOS_CreateInternalPosAtom
- */
-WINBOOL WINPOS_CreateInternalPosAtom()
-{
- LPSTR str = "SysIP";
- atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
- return (atomInternalPos) ? TRUE : FALSE;
-}
-
-/***********************************************************************
- * WINPOS_CheckInternalPos
- *
- * Called when a window is destroyed.
- */
-void WINPOS_CheckInternalPos( HWND hwnd )
-{
- LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
-
- if( hwnd == hwndPrevActive ) hwndPrevActive = 0;
- if( hwnd == hwndActive )
- {
- hwndActive = 0;
- DPRINT("\tattempt to activate destroyed window!\n");
- }
-
- if( lpPos )
- {
- //if( IsWindow(lpPos->hwndIconTitle) )
- // DestroyWindow( lpPos->hwndIconTitle );
- //HeapFree( GetProcessHeap(), 0, lpPos );
- }
-}
-
-/***********************************************************************
- * WINPOS_FindIconPos
- *
- * Find a suitable place for an iconic window.
- */
-static POINT WINPOS_FindIconPos( WND* wndPtr, POINT pt )
-{
- RECT rectParent;
- short x, y, xspacing, yspacing;
-
- if ( wndPtr->parent != NULL ) {
- GetClientRect( wndPtr->parent->hwndSelf, &rectParent );
- }
- else {
-
- rectParent.left = 0;
- rectParent.right = SYSMETRICS_CXFULLSCREEN;
-
- rectParent.top = 0;
- rectParent.right = SYSMETRICS_CYFULLSCREEN;
- }
-
- if ((pt.x >= rectParent.left) && (pt.x + SYSMETRICS_CXICON < rectParent.right) &&
- (pt.y >= rectParent.top) && (pt.y + SYSMETRICS_CYICON < rectParent.bottom))
- return pt; /* The icon already has a suitable position */
-
- xspacing = SYSMETRICS_CXICONSPACING;
- yspacing = SYSMETRICS_CYICONSPACING;
-
- y = rectParent.bottom;
- for (;;)
- {
- for (x = rectParent.left; x <= rectParent.right-xspacing; x += xspacing)
- {
- /* Check if another icon already occupies this spot */
- WND *childPtr = NULL;
- if ( wndPtr->parent )
- childPtr = wndPtr->parent->child;
- while (childPtr)
- {
- if ((childPtr->dwStyle & WS_MINIMIZE) && (childPtr != wndPtr))
- {
- if ((childPtr->rectWindow.left < x + xspacing) &&
- (childPtr->rectWindow.right >= x) &&
- (childPtr->rectWindow.top <= y) &&
- (childPtr->rectWindow.bottom > y - yspacing))
- break; /* There's a window in there */
- }
- childPtr = childPtr->next;
- }
- if (!childPtr) /* No window was found, so it's OK for us */
- {
- pt.x = x + (xspacing - SYSMETRICS_CXICON) / 2;
- pt.y = y - (yspacing + SYSMETRICS_CYICON) / 2;
- return pt;
- }
- }
- y -= yspacing;
- }
-}
-
-/***********************************************************************
- * WINPOS_WindowFromPoint
- *
- * Find the window and hittest for a given point.
- */
-INT WINPOS_WindowFromPoint( WND* wndScope, POINT pt, WND **ppWnd )
-{
- WND *wndPtr;
- INT hittest = HTERROR;
- POINT xy = pt;
-
- *ppWnd = NULL;
- wndPtr = wndScope->child;
- if( wndScope->flags & WIN_MANAGED )
- {
- /* this prevents mouse clicks from going "through" scrollbars in managed mode */
- if( pt.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right ||
- pt.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom )
- goto hittest;
- }
- MapWindowPoints( GetDesktopWindow(), wndScope->hwndSelf, &xy, 1 );
-
- for (;;)
- {
- while (wndPtr)
- {
- /* If point is in window, and window is visible, and it */
- /* is enabled (or it's a top-level window), then explore */
- /* its children. Otherwise, go to the next window. */
-
- if ((wndPtr->dwStyle & WS_VISIBLE) &&
- (!(wndPtr->dwStyle & WS_DISABLED) ||
- ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)) &&
- (xy.x >= wndPtr->rectWindow.left) &&
- (xy.x < wndPtr->rectWindow.right) &&
- (xy.y >= wndPtr->rectWindow.top) &&
- (xy.y < wndPtr->rectWindow.bottom))
- {
- *ppWnd = wndPtr; /* Got a suitable window */
-
- /* If window is minimized or disabled, return at once */
- if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
- if (wndPtr->dwStyle & WS_DISABLED) return HTERROR;
-
- /* If point is not in client area, ignore the children */
- if ((xy.x < wndPtr->rectClient.left) ||
- (xy.x >= wndPtr->rectClient.right) ||
- (xy.y < wndPtr->rectClient.top) ||
- (xy.y >= wndPtr->rectClient.bottom)) break;
-
- xy.x -= wndPtr->rectClient.left;
- xy.y -= wndPtr->rectClient.top;
- wndPtr = wndPtr->child;
- }
- else wndPtr = wndPtr->next;
- }
-
-hittest:
- /* If nothing found, try the scope window */
- if (!*ppWnd) *ppWnd = wndScope;
-
- /* Send the WM_NCHITTEST message (only if to the same task) */
- if ((*ppWnd)->hmemTaskQ == GetFastQueue())
- {
- hittest = (INT)SendMessageA( (*ppWnd)->hwndSelf, WM_NCHITTEST,
- 0, MAKELONG( pt.x, pt.y ) );
- if (hittest != HTTRANSPARENT) return hittest; /* Found the window */
- }
- else return HTCLIENT;
-
- /* If no children found in last search, make point relative to parent */
- if (!wndPtr)
- {
- xy.x += (*ppWnd)->rectClient.left;
- xy.y += (*ppWnd)->rectClient.top;
- }
-
- /* Restart the search from the next sibling */
- wndPtr = (*ppWnd)->next;
- *ppWnd = (*ppWnd)->parent;
- }
-}
-
-/*******************************************************************
- * WINPOS_GetWinOffset
- *
- * Calculate the offset between the origin of the two windows. Used
- * to implement MapWindowPoints.
- */
-void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo,
- POINT *offset )
-{
- WND * wndPtr;
-
- offset->x = offset->y = 0;
- if (hwndFrom == hwndTo ) return;
-
- /* Translate source window origin to screen coords */
- if (hwndFrom)
- {
- if (!(wndPtr = WIN_FindWndPtr( hwndFrom )))
- {
- //ERR(win,"bad hwndFrom = %04x\n",hwndFrom);
- return;
- }
- while (wndPtr->parent)
- {
- offset->x += wndPtr->rectClient.left;
- offset->y += wndPtr->rectClient.top;
- wndPtr = wndPtr->parent;
- }
- }
-
- /* Translate origin to destination window coords */
- if (hwndTo)
- {
- if (!(wndPtr = WIN_FindWndPtr( hwndTo )))
- {
- //ERR(win,"bad hwndTo = %04x\n", hwndTo );
- return;
- }
- while (wndPtr->parent)
- {
- offset->x -= wndPtr->rectClient.left;
- offset->y -= wndPtr->rectClient.top;
- wndPtr = wndPtr->parent;
- }
- }
-}
-
-/*******************************************************************
- * WINPOS_CanActivate
- */
-WINBOOL WINPOS_CanActivate(WND* pWnd)
-{
- if( pWnd && ((pWnd->dwStyle & (WS_DISABLED | WS_VISIBLE | WS_CHILD))
- == WS_VISIBLE) ) return TRUE;
- return FALSE;
-}
-
-/***********************************************************************
- * WINPOS_InitInternalPos
- */
-LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt,
- LPRECT restoreRect )
-{
- LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( wnd->hwndSelf,
- atomInternalPos );
- if( !lpPos )
- {
- /* this happens when the window is minimized/maximized
- * for the first time (rectWindow is not adjusted yet) */
-
- lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
- if( !lpPos ) return NULL;
-
- SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
- lpPos->hwndIconTitle = 0; /* defer until needs to be shown */
- memcpy( &lpPos->rectNormal, &wnd->rectWindow ,sizeof(RECT));
- *(UINT*)&lpPos->ptIconPos = *(UINT*)&lpPos->ptMaxPos = 0xFFFFFFFF;
- }
-
-
- if( wnd->dwStyle & WS_MINIMIZE )
- memcpy( &lpPos->ptIconPos, &pt,sizeof(POINT) );
- else if( wnd->dwStyle & WS_MAXIMIZE )
- memcpy( &lpPos->ptMaxPos, &pt,sizeof(POINT) );
- else if( restoreRect )
- memcpy( &lpPos->rectNormal, restoreRect, sizeof(RECT) );
-
- return lpPos;
-}
-
-/***********************************************************************
- * WINPOS_RedrawIconTitle
- */
-WINBOOL WINPOS_RedrawIconTitle( HWND hWnd )
-{
- LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hWnd, atomInternalPos );
- if( lpPos )
- {
- if( lpPos->hwndIconTitle )
- {
- SendMessageA( lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
- InvalidateRect( lpPos->hwndIconTitle, NULL, TRUE );
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/***********************************************************************
- * WINPOS_ShowIconTitle
- */
-WINBOOL WINPOS_ShowIconTitle( WND* pWnd, WINBOOL bShow )
-{
- LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( pWnd->hwndSelf, atomInternalPos );
-
- if( lpPos && !(pWnd->flags & WIN_MANAGED))
- {
- HWND hWnd = lpPos->hwndIconTitle;
-
- //DPRINT("0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
-
-// if( !hWnd )
-// lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
- if( bShow )
- {
- pWnd = WIN_FindWndPtr(hWnd);
-
- if( !(pWnd->dwStyle & 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;
-}
-
-/*******************************************************************
- * WINPOS_GetMinMaxInfo
- *
- * Get the minimized and maximized information for a window.
- */
-void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
- POINT *minTrack, POINT *maxTrack )
-{
- LPINTERNALPOS lpPos;
- MINMAXINFO MinMax;
- INT xinc, yinc;
-
- /* Compute default values */
-
- MinMax.ptMaxSize.x = SYSMETRICS_CXSCREEN;
- MinMax.ptMaxSize.y = SYSMETRICS_CYSCREEN;
- MinMax.ptMinTrackSize.x = SYSMETRICS_CXMINTRACK;
- MinMax.ptMinTrackSize.y = SYSMETRICS_CYMINTRACK;
- MinMax.ptMaxTrackSize.x = SYSMETRICS_CXSCREEN;
- MinMax.ptMaxTrackSize.y = SYSMETRICS_CYSCREEN;
-
- if (wndPtr->flags & WIN_MANAGED) xinc = yinc = 0;
- else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
- {
- xinc = SYSMETRICS_CXDLGFRAME;
- yinc = SYSMETRICS_CYDLGFRAME;
- }
- else
- {
- xinc = yinc = 0;
- if (HAS_THICKFRAME(wndPtr->dwStyle))
- {
- xinc += SYSMETRICS_CXFRAME;
- yinc += SYSMETRICS_CYFRAME;
- }
- if (wndPtr->dwStyle & WS_BORDER)
- {
- xinc += SYSMETRICS_CXBORDER;
- yinc += SYSMETRICS_CYBORDER;
- }
- }
- MinMax.ptMaxSize.x += 2 * xinc;
- MinMax.ptMaxSize.y += 2 * yinc;
-
- lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );
- if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
- memcpy( &MinMax.ptMaxPosition, &lpPos->ptMaxPos,sizeof(POINT) );
- else
- {
- MinMax.ptMaxPosition.x = -xinc;
- MinMax.ptMaxPosition.y = -yinc;
- }
-
- MSG_SendMessage( wndPtr, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
-
- /* Some sanity checks */
-
-
- 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;
-}
-
-/***********************************************************************
- * WINPOS_MinMaximize
- *
- * Fill in lpRect and return additional flags to be used with SetWindowPos().
- * This function assumes that 'cmd' is different from the current window
- * state.
- */
-UINT WINPOS_MinMaximize( WND* wndPtr, UINT cmd, LPRECT lpRect )
-{
- UINT swpFlags = 0;
- POINT size = { wndPtr->rectWindow.left, wndPtr->rectWindow.top };
- LPINTERNALPOS lpPos = WINPOS_InitInternalPos( wndPtr, size,
- &wndPtr->rectWindow );
-
-
- //DPRINT("0x%04x %u\n", wndPtr->hwndSelf, cmd );
-
-
- if (HOOK_CallHooks(WH_CBT, HCBT_MINMAX, (INT)wndPtr->hwndSelf, cmd, wndPtr->class->bUnicode )) {
- swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
- return swpFlags;
- }
-
-
-
- if (lpPos)
- {
- if( wndPtr->dwStyle & WS_MINIMIZE )
- {
- if( !MSG_SendMessage( wndPtr->hwndSelf, WM_QUERYOPEN, 0, 0L ) )
- return (SWP_NOSIZE | SWP_NOMOVE);
- swpFlags |= SWP_NOCOPYBITS;
- }
- switch( cmd )
- {
- case SW_MINIMIZE:
- if( wndPtr->dwStyle & WS_MAXIMIZE)
- {
- wndPtr->flags |= WIN_RESTORE_MAX;
- wndPtr->dwStyle &= ~WS_MAXIMIZE;
- }
- else
- wndPtr->flags &= ~WIN_RESTORE_MAX;
- wndPtr->dwStyle |= WS_MINIMIZE;
-
- lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
-
- SetRect( lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
- SYSMETRICS_CXICON, SYSMETRICS_CYICON );
- swpFlags |= SWP_NOCOPYBITS;
- break;
-
- case SW_MAXIMIZE:
-
- WINPOS_GetMinMaxInfo( wndPtr, &size, &lpPos->ptMaxPos, NULL, NULL );
-
- if( wndPtr->dwStyle & WS_MINIMIZE )
- {
- WINPOS_ShowIconTitle( wndPtr, FALSE );
- wndPtr->dwStyle &= ~WS_MINIMIZE;
- }
- wndPtr->dwStyle |= WS_MAXIMIZE;
-
- SetRect( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
- size.x, size.y );
- break;
-
- case SW_RESTORE:
- if( wndPtr->dwStyle & WS_MINIMIZE )
- {
- wndPtr->dwStyle &= ~WS_MINIMIZE;
- WINPOS_ShowIconTitle( wndPtr, FALSE );
- if( wndPtr->flags & WIN_RESTORE_MAX)
- {
- /* Restore to maximized position */
- WINPOS_GetMinMaxInfo( wndPtr, &size,&lpPos->ptMaxPos, NULL, NULL);
- wndPtr->dwStyle |= WS_MAXIMIZE;
- SetRect( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
- break;
- }
- }
- else
- if( !(wndPtr->dwStyle & WS_MAXIMIZE) ) return (UINT)(-1);
- else wndPtr->dwStyle &= ~WS_MAXIMIZE;
-
- /* Restore to normal position */
-
- *lpRect = lpPos->rectNormal;
- lpRect->right -= lpRect->left;
- lpRect->bottom -= lpRect->top;
-
- break;
- }
- } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
- return swpFlags;
-}
-
-/***********************************************************************
- * WINPOS_SetPlacement
- */
-WINBOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl,
- UINT flags )
-{
- WND *pWnd = WIN_FindWndPtr( hwnd );
- if( pWnd )
- {
- LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
- *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
-
- if( flags & PLACE_MIN ) lpPos->ptIconPos = wndpl->ptMinPosition;
- if( flags & PLACE_MAX ) lpPos->ptMaxPos = wndpl->ptMaxPosition;
- if( flags & PLACE_RECT) lpPos->rectNormal = wndpl->rcNormalPosition;
-
- if( pWnd->dwStyle & WS_MINIMIZE )
- {
- WINPOS_ShowIconTitle( pWnd, FALSE );
- if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
- SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
- 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
- }
- else if( pWnd->dwStyle & WS_MAXIMIZE )
- {
- if( !EMPTYPOINT(lpPos->ptMaxPos) )
- SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
- 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
- }
- else if( flags & PLACE_RECT )
- SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
- lpPos->rectNormal.right - lpPos->rectNormal.left,
- lpPos->rectNormal.bottom - lpPos->rectNormal.top,
- SWP_NOZORDER | SWP_NOACTIVATE );
-
- ShowWindow( hwnd, wndpl->showCmd );
- if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
- {
- if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd, TRUE );
-
- /* SDK: ...valid only the next time... */
- if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-/*******************************************************************
- * WINPOS_SetActiveWindow
- *
- * SetActiveWindow() back-end. This is the only function that
- * can assign active status to a window. It must be called only
- * for the top level windows.
- */
-WINBOOL WINPOS_SetActiveWindow( HWND hWnd, WINBOOL fMouse, WINBOOL fChangeFocus)
-{
- CBTACTIVATESTRUCT* cbtStruct;
- WND* wndPtr, *wndTemp;
- //HQUEUE hOldActiveQueue, hNewActiveQueue;
- WORD wIconized = 0;
-
- /* paranoid checks */
- if( hWnd == GetDesktopWindow || hWnd == hwndActive ) return 0;
-
-/* if (wndPtr && (GetFastQueue() != wndPtr->hmemTaskQ))
- * return 0;
- */
- wndPtr = WIN_FindWndPtr(hWnd);
- //hOldActiveQueue = (pActiveQueue)?pActiveQueue->self : 0;
-
- if( (wndTemp = WIN_FindWndPtr(hwndActive)) )
- wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
-
-
-#if 0
- /* call CBT hook chain */
- if ((cbtStruct = SEGPTR_NEW(CBTACTIVATESTRUCT16)))
- {
- LRESULT wRet;
- cbtStruct->fMouse = fMouse;
- cbtStruct->hWndActive = hwndActive;
- wRet = HOOK_CallHooks16( WH_CBT, HCBT_ACTIVATE, (WPARAM16)hWnd,
- (LPARAM)SEGPTR_GET(cbtStruct) );
- SEGPTR_FREE(cbtStruct);
- if (wRet) return wRet;
- }
-#endif
-
- /* set prev active wnd to current active wnd and send notification */
- if ((hwndPrevActive = hwndActive) && IsWindow(hwndPrevActive))
- {
- if (!SendMessageA( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 ))
- {
- //if (GetSysModalWindow16() != hWnd) return 0;
- /* disregard refusal if hWnd is sysmodal */
- }
-
-
- SendMessageA( hwndPrevActive, WM_ACTIVATE,
- MAKEWPARAM( WA_INACTIVE, wIconized ),
- (LPARAM)hWnd );
-
-
- /* check if something happened during message processing */
- if( hwndPrevActive != hwndActive ) return 0;
- }
-
- /* set active wnd */
- hwndActive = hWnd;
-
- /* send palette messages */
- if (hWnd && SendMessage( hWnd, WM_QUERYNEWPALETTE, 0, 0L))
- SendMessage((HWND)-1, WM_PALETTEISCHANGING, (WPARAM)hWnd, 0L );
-
- /* if prev wnd is minimized redraw icon title */
- if( IsIconic( hwndPrevActive ) ) WINPOS_RedrawIconTitle(hwndPrevActive);
-
-#if DESKTOP
- /* managed windows will get ConfigureNotify event */
- if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && !(wndPtr->flags & WIN_MANAGED))
- {
- /* check Z-order and bring hWnd to the top */
- for (wndTemp = WIN_GetDesktop()->child; wndTemp; wndTemp = wndTemp->next)
- if (wndTemp->dwStyle & WS_VISIBLE) break;
-
- if( wndTemp != wndPtr )
- SetWindowPos(hWnd, HWND_TOP, 0,0,0,0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
- if (!IsWindow(hWnd)) return 0;
- }
-
-#endif
-
-#if 0
- hNewActiveQueue = wndPtr ? wndPtr->hmemTaskQ : 0;
-
- /* send WM_ACTIVATEAPP if necessary */
- if (hOldActiveQueue != hNewActiveQueue)
- {
- WND **list, **ppWnd;
-
- if ((list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
- {
- for (ppWnd = list; *ppWnd; ppWnd++)
- {
- if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
-
- if ((*ppWnd)->hmemTaskQ == hOldActiveQueue)
- SendMessage16( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP,
- 0, QUEUE_GetQueueTask(hNewActiveQueue) );
- }
- HeapFree( SystemHeap, 0, list );
- }
-
- pActiveQueue = (hNewActiveQueue)
- ? (MESSAGEQUEUE*) GlobalLock16(hNewActiveQueue) : NULL;
-
- if ((list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
- {
- for (ppWnd = list; *ppWnd; ppWnd++)
- {
- if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
-
- if ((*ppWnd)->hmemTaskQ == hNewActiveQueue)
- SendMessage( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP,
- 1, QUEUE_GetQueueTask( hOldActiveQueue ) );
- }
- HeapFree( SystemHeap, 0, list );
- }
- if (!IsWindow(hWnd)) return 0;
- }
-
-#endif
- if (hWnd)
- {
- /* walk up to the first unowned window */
- wndTemp = wndPtr;
- while (wndTemp->owner) wndTemp = wndTemp->owner;
- /* and set last active owned popup */
- wndTemp->hwndLastActive = hWnd;
-
- wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
- SendMessageA( hWnd, WM_NCACTIVATE, TRUE, 0 );
-
- SendMessageA( hWnd, WM_ACTIVATE,
- MAKEWPARAM( (fMouse) ? WA_CLICKACTIVE : WA_ACTIVE, wIconized),
- (LPARAM)hwndPrevActive );
-
-
- if( !IsWindow(hWnd) ) return 0;
- }
-#if 0
- /* change focus if possible */
- if( fChangeFocus && GetFocus() )
- if( WIN_GetTopParent(GetFocus()) != hwndActive )
- FOCUS_SwitchFocus( GetFocus(),
- (wndPtr && (wndPtr->dwStyle & WS_MINIMIZE))?
- 0:
- hwndActive
- );
-#endif
-
- /* if active wnd is minimized redraw icon title */
- if( IsIconic(hwndActive) ) WINPOS_RedrawIconTitle(hwndActive);
-
- return (hWnd == hwndActive);
-}
-
-/*******************************************************************
- * WINPOS_ActivateOtherWindow
- *
- * Activates window other than pWnd.
- */
-WINBOOL WINPOS_ActivateOtherWindow(WND* pWnd)
-{
- WINBOOL bRet = 0;
- WND* pWndTo = NULL;
-
- if( pWnd->hwndSelf == hwndPrevActive )
- hwndPrevActive = 0;
-
- if( hwndActive != pWnd->hwndSelf &&
- ( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
- return 0;
-
- if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
- !WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
- {
- WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
-
- pWndTo = WIN_FindWndPtr(hwndPrevActive);
-
- while( !WINPOS_CanActivate(pWndTo) )
- {
- /* by now owned windows should've been taken care of */
-
- pWndTo = pWndPtr->next;
- pWndPtr = pWndTo;
- if( !pWndTo ) break;
- }
- }
-
- bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : NULL, FALSE, TRUE );
-
- /* switch desktop queue to current active */
- if( pWndTo ) WIN_GetDesktop()->hmemTaskQ = pWndTo->hmemTaskQ;
-
- hwndPrevActive = 0;
- return bRet;
-}
-
-/*******************************************************************
- * WINPOS_ChangeActiveWindow
- *
- */
-WINBOOL WINPOS_ChangeActiveWindow( HWND hWnd, WINBOOL mouseMsg )
-{
- WND *wndPtr = WIN_FindWndPtr(hWnd);
-
- if (!hWnd) return WINPOS_SetActiveWindow( 0, mouseMsg, TRUE );
-
- if( !wndPtr ) return FALSE;
-
- /* child windows get WM_CHILDACTIVATE message */
- if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD )
- return MSG_SendMessage(wndPtr, WM_CHILDACTIVATE, 0, 0L);
-
- /* owned popups imply owner activation - not sure */
- if ((wndPtr->dwStyle & WS_POPUP) && wndPtr->owner &&
- (wndPtr->owner->dwStyle & WS_VISIBLE ) &&
- !(wndPtr->owner->dwStyle & WS_DISABLED ))
- {
- if (!(wndPtr = wndPtr->owner)) return FALSE;
- hWnd = wndPtr->hwndSelf;
- }
-
- if( hWnd == hwndActive ) return FALSE;
-
- if( !WINPOS_SetActiveWindow(hWnd ,mouseMsg ,TRUE) )
- return FALSE;
-
-#if DESKTOP
- /* switch desktop queue to current active */
- if( wndPtr->parent == WIN_GetDesktop())
- WIN_GetDesktop()->hmemTaskQ = wndPtr->hmemTaskQ;
-#endif
- return TRUE;
-}
-
-
-/***********************************************************************
- * WINPOS_SendNCCalcSize
- *
- * Send a WM_NCCALCSIZE message to a window.
- * All parameters are read-only except newClientRect.
- * oldWindowRect, oldClientRect and winpos must be non-NULL only
- * when calcValidRect is TRUE.
- */
-LONG WINPOS_SendNCCalcSize( HWND hwnd, WINBOOL calcValidRect,
- RECT *newWindowRect, RECT *oldWindowRect,
- RECT *oldClientRect, WINDOWPOS *winpos,
- RECT *newClientRect )
-{
- NCCALCSIZE_PARAMS params;
- WINDOWPOS winposCopy;
- LONG result;
-
- params.rgrc[0] = *newWindowRect;
- if (calcValidRect)
- {
- winposCopy = *winpos;
- params.rgrc[1] = *oldWindowRect;
- params.rgrc[2] = *oldClientRect;
- params.lppos = &winposCopy;
- }
- result = SendMessageA( hwnd, WM_NCCALCSIZE, calcValidRect,
- (LPARAM)¶ms );
-
- *newClientRect = params.rgrc[0];
- return result;
-}
-
-
-/***********************************************************************
- * WINPOS_HandleWindowPosChanging
- *
- * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
- */
-LONG WINPOS_HandleWindowPosChangingA( WND *wndPtr, WINDOWPOS *winpos )
-{
- POINT maxSize, minTrack;
- if (winpos->flags & SWP_NOSIZE) return 0;
- if ((wndPtr->dwStyle & WS_THICKFRAME) ||
- ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
- {
- WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
- if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
- if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
- if (!(wndPtr->dwStyle & WS_MINIMIZE))
- {
- if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
- if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
- }
- }
- return 0;
-}
-
-
-/***********************************************************************
- * WINPOS_HandleWindowPosChanging
- *
- * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
- */
-LONG WINPOS_HandleWindowPosChanging( WND *wndPtr, WINDOWPOS *winpos )
-{
- POINT maxSize;
- if (winpos->flags & SWP_NOSIZE) return 0;
- if ((wndPtr->dwStyle & WS_THICKFRAME) ||
- ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
- {
- WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, NULL, NULL );
- winpos->cx = min( winpos->cx, maxSize.x );
- winpos->cy = min( winpos->cy, maxSize.y );
- }
- return 0;
-}
-
-
-/***********************************************************************
- * WINPOS_MoveWindowZOrder
- *
- * Move a window in Z order, invalidating everything that needs it.
- * Only necessary for windows without associated X window.
- */
-void WINPOS_MoveWindowZOrder( HWND hwnd, HWND hwndAfter )
-{
- WINBOOL movingUp;
- WND *pWndAfter, *pWndCur, *wndPtr = WIN_FindWndPtr( hwnd );
-
- /* We have two possible cases:
- * - The window is moving up: we have to invalidate all areas
- * of the window that were covered by other windows
- * - The window is moving down: we have to invalidate areas
- * of other windows covered by this one.
- */
-
- if (hwndAfter == HWND_TOP)
- {
- movingUp = TRUE;
- }
- else if (hwndAfter == HWND_BOTTOM)
- {
- if (!wndPtr->next) return; /* Already at the bottom */
- movingUp = FALSE;
- }
- else
- {
- if (!(pWndAfter = WIN_FindWndPtr( hwndAfter ))) return;
- if (wndPtr->next == pWndAfter) return; /* Already placed right */
-
- /* Determine which window we encounter first in Z-order */
- pWndCur = wndPtr->parent->child;
- while ((pWndCur != wndPtr) && (pWndCur != pWndAfter))
- pWndCur = pWndCur->next;
- movingUp = (pWndCur == pWndAfter);
- }
-
- if (movingUp)
- {
- WND *pWndPrevAfter = wndPtr->next;
- WIN_UnlinkWindow( hwnd );
- WIN_LinkWindow( hwnd, hwndAfter );
- pWndCur = wndPtr->next;
- while (pWndCur != pWndPrevAfter)
- {
- RECT rect = { pWndCur->rectWindow.left,
- pWndCur->rectWindow.top,
- pWndCur->rectWindow.right,
- pWndCur->rectWindow.bottom };
- OffsetRect( &rect, -wndPtr->rectClient.left,
- -wndPtr->rectClient.top );
- PAINT_RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE | RDW_ALLCHILDREN |
- RDW_FRAME | RDW_ERASE, 0 );
- pWndCur = pWndCur->next;
- }
- }
- else /* Moving down */
- {
- pWndCur = wndPtr->next;
- WIN_UnlinkWindow( hwnd );
- WIN_LinkWindow( hwnd, hwndAfter );
- while (pWndCur != wndPtr)
- {
- RECT rect = { pWndCur->rectWindow.left,
- pWndCur->rectWindow.top,
- pWndCur->rectWindow.right,
- pWndCur->rectWindow.bottom };
- OffsetRect( &rect, -pWndCur->rectClient.left,
- -pWndCur->rectClient.top );
- PAINT_RedrawWindow( pWndCur->hwndSelf, &rect, 0, RDW_INVALIDATE |
- RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE, 0 );
- pWndCur = pWndCur->next;
- }
- }
-}
-
-/***********************************************************************
- * WINPOS_ReorderOwnedPopups
- *
- * fix Z order taking into account owned popups -
- * basically we need to maintain them above the window that owns them
- */
-HWND WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter,WND* wndPtr,WORD flags)
-{
- WND* w = WIN_GetDesktop()->child;
-
- if( wndPtr->dwStyle & WS_POPUP && wndPtr->owner )
- {
- /* implement "local z-order" between the top and owner window */
-
- HWND hwndLocalPrev = HWND_TOP;
-
- if( hwndInsertAfter != HWND_TOP )
- {
- while( w != wndPtr->owner )
- {
- if (w != wndPtr) hwndLocalPrev = w->hwndSelf;
- if( hwndLocalPrev == hwndInsertAfter ) break;
- w = w->next;
- }
- hwndInsertAfter = hwndLocalPrev;
- }
-
- }
- else if( wndPtr->dwStyle & WS_CHILD ) return hwndInsertAfter;
-
- w = WIN_GetDesktop()->child;
- while( w )
- {
- if( w == wndPtr ) break;
-
- if( w->dwStyle & WS_POPUP && w->owner == wndPtr )
- {
- SetWindowPos(w->hwndSelf, hwndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
- SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_DEFERERASE);
- hwndInsertAfter = w->hwndSelf;
- }
- w = w->next;
- }
-
- return hwndInsertAfter;
-}
-
-/***********************************************************************
- * WINPOS_SizeMoveClean
- *
- * Make window look nice without excessive repainting
- *
- * the pain:
- *
- * visible regions are in window coordinates
- * update regions are in window client coordinates
- * client and window rectangles are in parent client coordinates
- *
- * FIXME: Move visible and update regions to the same coordinate system
- * (either parent client or window). This is a lot of work though.
- */
-UINT WINPOS_SizeMoveClean( WND* Wnd, HRGN oldVisRgn,
- LPRECT lpOldWndRect,
- LPRECT lpOldClientRect, UINT uFlags )
-{
- HRGN newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS);
- HRGN dirtyRgn = CreateRectRgn(0,0,0,0);
- int other, my;
-
-
-
- if( (lpOldWndRect->right - lpOldWndRect->left) != (Wnd->rectWindow.right - Wnd->rectWindow.left) ||
- (lpOldWndRect->bottom - lpOldWndRect->top) != (Wnd->rectWindow.bottom - Wnd->rectWindow.top) )
- uFlags |= SMC_DRAWFRAME;
-
- CombineRgn( dirtyRgn, newVisRgn, 0, RGN_COPY);
-
- if( !(uFlags & SMC_NOCOPY) )
- CombineRgn( newVisRgn, newVisRgn, oldVisRgn, RGN_AND );
-
- /* map regions to the parent client area */
-
- OffsetRgn( dirtyRgn, Wnd->rectWindow.left, Wnd->rectWindow.top );
- OffsetRgn( oldVisRgn, lpOldWndRect->left, lpOldWndRect->top );
-
- /* compute invalidated region outside Wnd - (in client coordinates of the parent window) */
-
- other = CombineRgn(dirtyRgn, oldVisRgn, dirtyRgn, RGN_DIFF);
-
- /* map visible region to the Wnd client area */
-
- OffsetRgn( newVisRgn, Wnd->rectWindow.left - Wnd->rectClient.left,
- Wnd->rectWindow.top - Wnd->rectClient.top );
-
- /* substract previously invalidated region from the Wnd visible region */
-
- my = (Wnd->hrgnUpdate > 1) ? CombineRgn( newVisRgn, newVisRgn,
- Wnd->hrgnUpdate, RGN_DIFF)
- : COMPLEXREGION;
-
- if( uFlags & SMC_NOCOPY ) /* invalidate Wnd visible region */
- {
- if (my != NULLREGION)
- PAINT_RedrawWindow( Wnd->hwndSelf, NULL, newVisRgn, RDW_INVALIDATE |
- RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE, RDW_C_USEHRGN );
- else if(uFlags & SMC_DRAWFRAME)
- Wnd->flags |= WIN_NEEDS_NCPAINT;
- }
- else /* bitblt old client area */
- {
- HDC hDC;
- int update;
- HRGN updateRgn;
- int xfrom,yfrom,xto,yto,width,height;
-
- if( uFlags & SMC_DRAWFRAME )
- {
- /* copy only client area, frame will be redrawn anyway */
-
- xfrom = lpOldClientRect->left; yfrom = lpOldClientRect->top;
- xto = Wnd->rectClient.left; yto = Wnd->rectClient.top;
- width = lpOldClientRect->right - xfrom; height = lpOldClientRect->bottom - yfrom;
- updateRgn = CreateRectRgn( 0, 0, width, height );
- CombineRgn( newVisRgn, newVisRgn, updateRgn, RGN_AND );
- SetRectRgn( updateRgn, 0, 0, Wnd->rectClient.right - xto,
- Wnd->rectClient.bottom - yto );
- }
- else
- {
- xfrom = lpOldWndRect->left; yfrom = lpOldWndRect->top;
- xto = Wnd->rectWindow.left; yto = Wnd->rectWindow.top;
- width = lpOldWndRect->right - xfrom; height = lpOldWndRect->bottom - yfrom;
- updateRgn = CreateRectRgn( xto - Wnd->rectClient.left,
- yto - Wnd->rectClient.top,
- Wnd->rectWindow.right - Wnd->rectClient.left,
- Wnd->rectWindow.bottom - Wnd->rectClient.top );
- }
-
- CombineRgn( newVisRgn, newVisRgn, updateRgn, RGN_AND );
-
- /* substract new visRgn from target rect to get a region that won't be copied */
-
- update = CombineRgn( updateRgn, updateRgn, newVisRgn, RGN_DIFF );
-
- /* Blt valid bits using parent window DC */
-
- if( Wnd->parent && my != NULLREGION && (xfrom != xto || yfrom != yto) )
- {
-
- /* compute clipping region in parent client coordinates */
-
- OffsetRgn( newVisRgn, Wnd->rectClient.left, Wnd->rectClient.top );
- CombineRgn( oldVisRgn, oldVisRgn, newVisRgn, RGN_OR );
-
-// REMOVED DCX_KEEPCLIPRGN
-
- hDC = GetDCEx( Wnd->parent->hwndSelf, oldVisRgn,
- DCX_INTERSECTRGN | DCX_CACHE | DCX_CLIPSIBLINGS);
-
- BitBlt( hDC, xto, yto, width, height, hDC, xfrom, yfrom, SRCCOPY );
- ReleaseDC( Wnd->parent->hwndSelf, hDC);
-
- }
-
- if( update != NULLREGION )
- PAINT_RedrawWindow( Wnd->hwndSelf, NULL, updateRgn, RDW_INVALIDATE |
- RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE, RDW_C_USEHRGN );
- else if( uFlags & SMC_DRAWFRAME ) Wnd->flags |= WIN_NEEDS_NCPAINT;
- DeleteObject( updateRgn );
- }
-
- /* erase uncovered areas */
-
- if( !(uFlags & SMC_NOPARENTERASE) && (other != NULLREGION ) )
- PAINT_RedrawWindow( Wnd->parent->hwndSelf, NULL, dirtyRgn,
- RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE, RDW_C_USEHRGN );
- DeleteObject(dirtyRgn);
- DeleteObject(newVisRgn);
- return uFlags;
-}
-
/***********************************************************************
* MoveWindow (USER32.399)
*/