Commit 22945d5a authored by Alexandre Julliard's avatar Alexandre Julliard

Release 950202

Wed Feb 1 19:27:55 1995 Alexandre Julliard (julliard@lamisun.epfl.ch) * [windows/nonclient.c] [windows/winpos.c] Implemented maximized windows. Implemented icon positioning and ArrangeIconicWindows(). Bug fixes in SetWindowPos(). * [windows/painting.c] Implemented GetControlBrush(). Window frame is no longer contained in the update region. * [windows/win.c] Destroy owned windows upon DestroyWindow(). Sun Jan 29 16:17:22 1995 David Metcalfe <david@prism.demon.co.uk> * [controls/edit.c] Changed line terminator to \r\n to be compatible with Windows. Fixed bug in text selection. Sun Jan 29 14:10:22 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/shell.c] Rewrote RegCreateKey and RegOpenKey, since they were completely broken. Fixed a bug in RegQueryKeyValue. Implemented RegEnumKey These functions now work somewhat more the way Windows programs expect them to work.
parent 18506558
This is release 950122 of Wine the MS Windows emulator. This is still a
This is release 950202 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work.
Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other Sunday.
WHAT'S NEW with Wine-950122: (see ChangeLog for details)
- ELF format support
- New disassembler based on Mach code, replacing the gdb code
- Faster regions
WHAT'S NEW with Wine-950202: (see ChangeLog for details)
- Maximized windows
- Edit control now uses \r\n for line endings
- Better registry functions
- Lots of bug fixes
See the README file in the distribution for installation instructions.
......@@ -17,11 +17,11 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950122.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950122.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950122.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950122.tar.gz
ftp.wonderland.org:/Wine/Wine-950122.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950202.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950202.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950202.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950202.tar.gz
ftp.wonderland.org:/Wine/Wine-950202.tar.gz
If you submitted a patch, please check to make sure it has been
included in the new release.
......
----------------------------------------------------------------------
Wed Feb 1 19:27:55 1995 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [windows/nonclient.c] [windows/winpos.c]
Implemented maximized windows.
Implemented icon positioning and ArrangeIconicWindows().
Bug fixes in SetWindowPos().
* [windows/painting.c]
Implemented GetControlBrush().
Window frame is no longer contained in the update region.
* [windows/win.c]
Destroy owned windows upon DestroyWindow().
Sun Jan 29 16:17:22 1995 David Metcalfe <david@prism.demon.co.uk>
* [controls/edit.c]
Changed line terminator to \r\n to be compatible with
Windows. Fixed bug in text selection.
Sun Jan 29 14:10:22 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [misc/shell.c]
Rewrote RegCreateKey and RegOpenKey, since they were completely broken.
Fixed a bug in RegQueryKeyValue. Implemented RegEnumKey
These functions now work somewhat more the way Windows programs expect
them to work.
----------------------------------------------------------------------
Sun Jan 22 18:55:33 1995 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [loader/resource.c] [objects/dib.c]
......
......@@ -47,10 +47,11 @@ then
fi
echo
echo -n 'Use the XPM library (Y/N) [N]? '
echo -n 'Use the XPM library (Y/N) [Y]? '
read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
if [ "$input" = 'n' -o "$input" = 'N' ]
then :
else
XPM='#define USE_XPM'
ALLDEFINES="$ALLDEFINES -DUSE_XPM"
fi
......
- Find all the remaining bugs!
- ES_LEFT, ES_RIGHT and ES_CENTER. ES_RIGHT and ES_CENTER cannot be
used with single line edit controls or be combined with ES_AUTOHSCROLL.
- Hide selection when window loses focus and ES_NOHIDESEL to disable
this functionality.
- ES_LOWERCASE and ES_UPPERCASE.
- ES_PASSWORD and EM_PASSWORDCHAR.
- ES_OEMCONVERT. Probably won't do anything very much.
- ES_READONLY.
- ES_WANTRETURN and Ctrl-Enter to move to next line when this
functionality is enabled.
- Implement undo buffer correctly. Windows allows the user to undo
entered text as well as deleted text. You can also undo an undo.
- Add word wrap - this is a very big change!
......@@ -278,7 +278,10 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break;
case EM_SETHANDLE:
HideCaret(hwnd);
EDIT_SetHandleMsg(hwnd, wParam);
SetCaretPos(es->WndCol, es->WndRow * es->txtht);
ShowCaret(hwnd);
break;
case EM_SETMODIFY:
......@@ -431,7 +434,13 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
SetCaretPos(es->WndCol, es->WndRow * es->txtht);
ShowCaret(hwnd);
break;
#if 0
case WM_SETREDRAW:
dprintf_edit(stddeb, "WM_SETREDRAW: hwnd=%d, wParam=%x\n",
hwnd, wParam);
lResult = 0;
break;
#endif
case WM_SETTEXT:
EDIT_SetTextMsg(hwnd, lParam);
break;
......@@ -548,11 +557,14 @@ long EDIT_CreateMsg(HWND hwnd, LONG lParam)
char *text;
/* initialize state variable structure */
/* --- char width array */
hdc = GetDC(hwnd);
/* --- char width array */
/* only initialise chars <= 32 as X returns strange widths */
/* for other chars */
charWidths = (short *)EDIT_HeapAddr(hwnd, es->hCharWidths);
memset(charWidths, 0, 256 * sizeof(short));
GetCharWidth(hdc, 0, 255, charWidths);
GetCharWidth(hdc, 32, 254, &charWidths[32]);
/* --- other structure variables */
GetTextMetrics(hdc, &tm);
......@@ -737,7 +749,7 @@ HANDLE EDIT_GetTextLine(HWND hwnd, int selection)
dprintf_edit(stddeb,"GetTextLine %d\n", selection);
cp = cp1 = EDIT_TextLine(hwnd, selection);
/* advance through line */
while (*cp && *cp != '\n')
while (*cp && *cp != '\r')
{
len++;
cp++;
......@@ -804,7 +816,7 @@ int EDIT_LineLength(HWND hwnd, int num)
char *cp1;
if(!cp)return 0;
cp1 = strchr(cp, '\n');
cp1 = strchr(cp, '\r');
return cp1 ? (int)(cp1 - cp) : strlen(cp);
}
......@@ -1094,7 +1106,7 @@ HANDLE EDIT_GetStr(HWND hwnd, char *lp, int off, int len, int *diff)
dprintf_edit(stddeb,"EDIT_GetStr lp='%s' off=%d len=%d\n", lp, off, len);
if (off<0) off=0;
if (off < 0) off = 0;
while (i < off)
{
s_i = i;
......@@ -1111,6 +1123,8 @@ HANDLE EDIT_GetStr(HWND hwnd, char *lp, int off, int len, int *diff)
ch1 = ch;
while (i < len + off)
{
if (*(lp + ch) == '\r' || *(lp + ch) == '\n')
break;
i += EDIT_CharWidth(hwnd, (BYTE)(*(lp + ch)), i);
ch++;
}
......@@ -1191,8 +1205,9 @@ void EDIT_KeyTyped(HWND hwnd, short ch)
if (*currchar == '\0' && IsMultiLine())
{
/* insert a newline at end of text */
*currchar = '\n';
*(currchar + 1) = '\0';
*currchar = '\r';
*(currchar + 1) = '\n';
*(currchar + 2) = '\0';
EDIT_BuildTextPointers(hwnd);
}
......@@ -1220,9 +1235,19 @@ void EDIT_KeyTyped(HWND hwnd, short ch)
currchar = CurrChar;
}
/* make space for new character and put char in buffer */
memmove(currchar + 1, currchar, strlen(currchar) + 1);
*currchar = ch;
EDIT_ModTextPointers(hwnd, es->CurrLine + 1, 1);
if (ch == '\n')
{
memmove(currchar + 2, currchar, strlen(currchar) + 1);
*currchar = '\r';
*(currchar + 1) = '\n';
EDIT_ModTextPointers(hwnd, es->CurrLine + 1, 2);
}
else
{
memmove(currchar + 1, currchar, strlen(currchar) + 1);
*currchar = ch;
EDIT_ModTextPointers(hwnd, es->CurrLine + 1, 1);
}
es->TextChanged = TRUE;
NOTIFY_PARENT(hwnd, EN_UPDATE);
......@@ -1347,7 +1372,7 @@ void EDIT_Forward(HWND hwnd)
if (*CurrChar == '\0')
return;
if (*CurrChar == '\n')
if (*CurrChar == '\r')
{
EDIT_Home(hwnd);
EDIT_Downward(hwnd);
......@@ -1465,7 +1490,7 @@ void EDIT_End(HWND hwnd)
EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
while (*CurrChar && *CurrChar != '\n')
while (*CurrChar && *CurrChar != '\r')
{
es->WndCol += EDIT_CharWidth(hwnd, (BYTE)(*CurrChar), es->WndCol + es->wleft);
es->CurrCol++;
......@@ -2557,7 +2582,7 @@ void EDIT_ExtendSel(HWND hwnd, int x, int y)
if (es->WndCol > EDIT_StrLength(hwnd, cp, len, 0) - es->wleft || end)
es->WndCol = EDIT_StrLength(hwnd, cp, len, 0) - es->wleft;
es->CurrCol = EDIT_PixelToChar(hwnd, es->CurrLine, &(es->WndCol));
es->SelEndCol = es->CurrCol - 1;
es->SelEndCol = es->CurrCol;
bel = es->SelEndLine;
bec = es->SelEndCol;
......@@ -2622,10 +2647,15 @@ void EDIT_WriteSel(HWND hwnd, int y, int start, int end)
if (end == -1)
end = EDIT_LineLength(hwnd, y);
/* For some reason Rectangle, when called with R2_XORPEN filling,
* appears to leave a 2 pixel gap between characters and between
* lines. I have kludged this by adding on two pixels to ecol and
* to the line height in the call to Rectangle.
*/
scol = EDIT_StrLength(hwnd, cp, start, 0);
if (scol > rc.right) return;
if (scol < rc.left) scol = rc.left;
ecol = EDIT_StrLength(hwnd, cp, end, 0);
ecol = EDIT_StrLength(hwnd, cp, end, 0) + 2; /* ??? */
if (ecol < rc.left) return;
if (ecol > rc.right) ecol = rc.right;
......@@ -2633,7 +2663,7 @@ void EDIT_WriteSel(HWND hwnd, int y, int start, int end)
hbrush = GetStockObject(BLACK_BRUSH);
holdbrush = (HBRUSH)SelectObject(hdc, (HANDLE)hbrush);
olddm = SetROP2(hdc, R2_XORPEN);
Rectangle(hdc, scol, y * es->txtht, ecol, (y + 1) * es->txtht);
Rectangle(hdc, scol, y * es->txtht, ecol, (y + 1) * es->txtht + 2);
SetROP2(hdc, olddm);
SelectObject(hdc, (HANDLE)holdbrush);
ReleaseDC(hwnd, hdc);
......@@ -3054,7 +3084,7 @@ void EDIT_SetHandleMsg(HWND hwnd, WORD wParam)
if (IsMultiLine())
{
es->hText = wParam;
es->MaxTextLen = EDIT_HeapSize(hwnd, es->hText);
es->textlen = EDIT_HeapSize(hwnd, es->hText);
es->wlines = 0;
es->wtop = es->wleft = 0;
es->CurrLine = es->CurrCol = 0;
......@@ -3063,7 +3093,10 @@ void EDIT_SetHandleMsg(HWND hwnd, WORD wParam)
es->textwidth = 0;
es->SelBegLine = es->SelBegCol = 0;
es->SelEndLine = es->SelEndCol = 0;
dprintf_edit(stddeb, "EDIT_SetHandleMsg: textlen=%d\n",
es->textlen);
EDIT_BuildTextPointers(hwnd);
es->PaintBkgd = TRUE;
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......
......@@ -896,8 +896,6 @@ void ShowScrollBar( HWND hwnd, WORD wBar, BOOL fShow )
}
SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
| SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
/* FIXME: Hack until SetWindowPos works correctly */
InvalidateRect( hwnd, NULL, TRUE );
}
......
......@@ -320,7 +320,7 @@ length 540
#323 GETMESSAGE2
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
#326 GETCONTROLBRUSH
326 pascal16 GetControlBrush(word word word) GetControlBrush(1 2 3)
331 pascal EnableHardwareInput(word) EnableHardwareInput(1)
332 return UserYield 0 0
#333 ISUSERIDLE
......
......@@ -10,6 +10,8 @@
#include "windows.h"
extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
extern void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack );
extern void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint );
extern LONG NC_HandleNCPaint( HWND hwnd );
extern LONG NC_HandleNCActivate( HWND hwnd, WORD wParam );
......
......@@ -48,7 +48,6 @@ typedef struct tagWND
HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags (see below) */
Window window; /* X window (only for top-level windows) */
RECT rectClientSave; /* where client rect is saved when icon*/
HMENU hSysMenu; /* window's copy of System Menu */
HANDLE hProp; /* Handle of Properties List */
HTASK hTask; /* Task Handle of the owner */
......
......@@ -2711,6 +2711,7 @@ Fc(HANDLE,FindResource,HANDLE,a,LPSTR,b,LPSTR,c)
Fc(HANDLE,LocalReAlloc,HANDLE,a,WORD,b,WORD,c)
Fc(HBITMAP,CreateCompatibleBitmap,HDC,a,short,b,short,c)
Fc(HBITMAP,CreateDiscardableBitmap,HDC,a,short,b,short,c)
Fc(HBRUSH,GetControlBrush,HWND,a,HDC,b,WORD,c)
Fc(HDC,GetDCEx,HWND,a,HRGN,b,DWORD,c)
Fc(HPALETTE,SelectPalette,HDC,a,HPALETTE,b,BOOL,c)
Fc(HPEN,CreatePen,short,a,short,b,COLORREF,c)
......
......@@ -22,8 +22,6 @@ typedef struct
extern HWND WINPOS_NextWindowFromPoint( HWND hwnd, POINT pt );
extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack );
extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect,
RECT *oldClientRect, WINDOWPOS *winpos,
......
......@@ -203,7 +203,8 @@ HINSTANCE LoadImage(char *module, int filetype, int change_dir)
if (read(wpnt->fd, wpnt->mz_header, sizeof(struct mz_header_s)) !=
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
fprintf(stderr, "Unable to read MZ header from file '%s'\n", buffer);
exit(1);
}
/* This field is ignored according to "Windows Internals", p.242 */
......
......@@ -4,7 +4,6 @@
#include "stdio.h"
#include "windows.h"
#include "win.h"
#include "user.h"
#define WN_SUCCESS 0x0000
......
......@@ -23,6 +23,7 @@ WineRelocatableTarget($(MODULE),,$(RCOBJS))
$(RCOBJS): winerc $(TOP)/include/windows.h
includes::
touch $(RCSRCS:.rc=.h)
clean::
$(RM) $(RCSRCS:.rc=.c) $(RCSRCS:.rc=.h)
......
......@@ -757,8 +757,10 @@ int main(int argc, char **argv)
sprintf(filename, "dll_%s.S", LowerDLLName);
fp = fopen(filename, "w");
#ifdef __ELF__
fprintf (fp, "#define __ASSEMBLY__\n");
fprintf (fp, "#include <asm/segment.h>\n");
#endif
fprintf(fp, "\t.globl " PREFIX "%s_Dispatch\n", UpperDLLName);
fprintf(fp, PREFIX "%s_Dispatch:\n", UpperDLLName);
fprintf(fp, "\tandl\t$0x0000ffff,%%esp\n");
......
......@@ -82,7 +82,6 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
lpcur = (CURSORALLOC *)GlobalLock(hCursor);
memset(lpcur, 0, sizeof(CURSORALLOC));
if (instance == (HANDLE)NULL) {
instance = hSysRes;
switch((LONG)cursor_name) {
case IDC_ARROW:
lpcur->xcursor = XCreateFontCursor(display, XC_top_left_arrow);
......
......@@ -283,23 +283,13 @@ LONG MDIMaximizeChild(HWND parent, HWND child, MDICLIENTINFO *ci)
LONG MDIRestoreChild(HWND parent, MDICLIENTINFO *ci)
{
HWND child;
WND *w = WIN_FindWndPtr(parent);
LPRECT lprect = &ci->rectRestore;
dprintf_mdi(stddeb,"restoring mdi child\n");
child = ci->hwndActiveChild;
w->dwStyle &= ~WS_MAXIMIZE;
SetWindowPos(child, 0, lprect->left, lprect->top,
lprect->right - lprect->left + 1,
lprect->bottom - lprect->top + 1,
SWP_NOACTIVATE | SWP_NOZORDER);
ci->flagChildMaximized = FALSE;
ShowWindow(child, SW_RESTORE); /* display the window */
SendMessage(GetParent(parent), WM_NCPAINT, 0, 0);
MDIBringChildToTop(parent, child, FALSE, FALSE);
return 0;
......
......@@ -110,6 +110,82 @@ void AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
}
/*******************************************************************
* NC_GetMinMaxInfo
*
* Get the minimized and maximized information for a window.
*/
void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack )
{
HANDLE minmaxHandle;
MINMAXINFO MinMax, *pMinMax;
short xinc, yinc;
WND *wndPtr = WIN_FindWndPtr( hwnd );
/* 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 (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;
if ((wndPtr->ptMaxPos.x != -1) || (wndPtr->ptMaxPos.y != -1))
MinMax.ptMaxPosition = wndPtr->ptMaxPos;
else
{
MinMax.ptMaxPosition.x = -xinc;
MinMax.ptMaxPosition.y = -yinc;
}
minmaxHandle = USER_HEAP_ALLOC( LMEM_MOVEABLE, sizeof(MINMAXINFO) );
if (minmaxHandle)
{
pMinMax = (MINMAXINFO *) USER_HEAP_ADDR( minmaxHandle );
memcpy( pMinMax, &MinMax, sizeof(MinMax) );
SendMessage( hwnd, WM_GETMINMAXINFO, 0, (LONG)pMinMax );
}
else pMinMax = &MinMax;
/* Some sanity checks */
pMinMax->ptMaxTrackSize.x = max( pMinMax->ptMaxTrackSize.x,
pMinMax->ptMinTrackSize.x );
pMinMax->ptMaxTrackSize.y = max( pMinMax->ptMaxTrackSize.y,
pMinMax->ptMinTrackSize.y );
if (maxSize) *maxSize = pMinMax->ptMaxSize;
if (maxPos) *maxPos = pMinMax->ptMaxPosition;
if (minTrack) *minTrack = pMinMax->ptMinTrackSize;
if (maxTrack) *maxTrack = pMinMax->ptMaxTrackSize;
if (minmaxHandle) USER_HEAP_FREE( minmaxHandle );
}
/***********************************************************************
* NC_HandleNCCalcSize
*
......@@ -841,7 +917,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt )
/* Get min/max info */
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
NC_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
sizingRect = wndPtr->rectWindow;
if (wndPtr->dwStyle & WS_CHILD)
GetClientRect( wndPtr->hwndParent, &mouseRect );
......@@ -1162,7 +1238,8 @@ LONG NC_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam )
switch(wParam) /* Hit test */
{
case HTCAPTION:
SendMessage( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, lParam );
SendMessage( hwnd, WM_SYSCOMMAND,
IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam );
break;
case HTSYSMENU:
......@@ -1239,7 +1316,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt )
case SC_SCREENSAVE:
if (wParam == SC_ABOUTWINE)
{ extern char sysres_DIALOG_2[];
DialogBoxIndirectPtr( hSysRes, sysres_DIALOG_2,
DialogBoxIndirectPtr( wndPtr->hInstance, sysres_DIALOG_2,
hwnd, (WNDPROC)AboutWine_Proc );
}
break;
......
/*
* Window painting functions
*
* Copyright 1993 Alexandre Julliard
* Copyright 1993, 1994, 1995 Alexandre Julliard
*/
#include <stdio.h>
......@@ -104,12 +104,22 @@ void PaintRect(HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush, LPRECT rect)
/***********************************************************************
* GetControlBrush (USER.326)
*/
HBRUSH GetControlBrush( HWND hwnd, HDC hdc, WORD control )
{
return (HBRUSH)SendMessage( GetParent(hwnd), WM_CTLCOLOR,
hdc, MAKELONG( hwnd, control ) );
}
/***********************************************************************
* RedrawWindow (USER.290)
*/
BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags )
{
HRGN tmpRgn, hrgn = 0;
RECT rectClient, rectWindow;
HRGN tmpRgn, hrgn;
RECT rectClient;
WND * wndPtr;
if (!hwnd) hwnd = GetDesktopWindow();
......@@ -129,111 +139,68 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags )
hwnd, hrgnUpdate, flags);
}
GetClientRect( hwnd, &rectClient );
rectWindow = wndPtr->rectWindow;
OffsetRect(&rectWindow, -wndPtr->rectClient.left, -wndPtr->rectClient.top);
if (flags & RDW_INVALIDATE) /* Invalidate */
{
if (hrgnUpdate) /* Invalidate a region */
{
if (flags & RDW_FRAME) tmpRgn = CreateRectRgnIndirect(&rectWindow);
else tmpRgn = CreateRectRgnIndirect( &rectClient );
if (!tmpRgn) return FALSE;
hrgn = CreateRectRgn( 0, 0, 0, 0 );
if (CombineRgn( hrgn, hrgnUpdate, tmpRgn, RGN_AND ) == NULLREGION)
{
DeleteObject( hrgn );
hrgn = 0;
}
DeleteObject( tmpRgn );
}
else /* Invalidate a rectangle */
{
RECT rect;
if (flags & RDW_FRAME)
{
if (rectUpdate) IntersectRect( &rect, rectUpdate, &rectWindow);
else rect = rectWindow;
}
else
{
if (rectUpdate) IntersectRect( &rect, rectUpdate, &rectClient);
else rect = rectClient;
}
if (!IsRectEmpty(&rect)) hrgn = CreateRectRgnIndirect( &rect );
}
/* Set update region */
if (hrgn)
{
if (!wndPtr->hrgnUpdate)
{
wndPtr->hrgnUpdate = hrgn;
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
MSG_IncPaintCount( wndPtr->hmemTaskQ );
}
else
{
tmpRgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( tmpRgn, wndPtr->hrgnUpdate, hrgn, RGN_OR );
DeleteObject( wndPtr->hrgnUpdate );
DeleteObject( hrgn );
wndPtr->hrgnUpdate = tmpRgn;
}
}
if (wndPtr->hrgnUpdate) /* Is there already an update region? */
{
tmpRgn = CreateRectRgn( 0, 0, 0, 0 );
if ((hrgn = hrgnUpdate) == 0)
hrgn = CreateRectRgnIndirect( rectUpdate ? rectUpdate :
&rectClient );
CombineRgn( tmpRgn, wndPtr->hrgnUpdate, hrgn, RGN_OR );
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = tmpRgn;
if (!hrgnUpdate) DeleteObject( hrgn );
}
else /* No update region yet */
{
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
MSG_IncPaintCount( wndPtr->hmemTaskQ );
if (hrgnUpdate)
{
wndPtr->hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( wndPtr->hrgnUpdate, hrgnUpdate, 0, RGN_COPY );
}
else wndPtr->hrgnUpdate = CreateRectRgnIndirect( rectUpdate ?
rectUpdate : &rectClient );
}
if (flags & RDW_FRAME) wndPtr->flags |= WIN_NEEDS_NCPAINT;
if (flags & RDW_ERASE) wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
flags |= RDW_FRAME; /* Force invalidating the frame of children */
}
else if (flags & RDW_VALIDATE) /* Validate */
{
if (flags & RDW_NOERASE) wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
if (!(hrgn = CreateRectRgn( 0, 0, 0, 0 ))) return FALSE;
/* Remove frame from update region */
if (wndPtr->hrgnUpdate && (flags & RDW_NOFRAME))
{
if (!(tmpRgn = CreateRectRgnIndirect( &rectClient )))
return FALSE;
if (CombineRgn(hrgn,tmpRgn,wndPtr->hrgnUpdate,RGN_AND) == NULLREGION)
{
DeleteObject( hrgn );
hrgn = 0;
}
DeleteObject( tmpRgn );
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = hrgn;
hrgn = CreateRectRgn( 0, 0, 0, 0 );
}
/* Set update region */
if (wndPtr->hrgnUpdate)
{
int res;
if (hrgnUpdate) /* Validate a region */
{
res = CombineRgn(hrgn,wndPtr->hrgnUpdate,hrgnUpdate,RGN_DIFF);
}
else /* Validate a rectangle */
{
if (rectUpdate) tmpRgn = CreateRectRgnIndirect( rectUpdate );
else tmpRgn = CreateRectRgnIndirect( &rectWindow );
res = CombineRgn( hrgn, wndPtr->hrgnUpdate, tmpRgn, RGN_DIFF );
DeleteObject( tmpRgn );
}
DeleteObject( wndPtr->hrgnUpdate );
if (res == NULLREGION)
{
DeleteObject( hrgn );
wndPtr->hrgnUpdate = 0;
/* We need an update region in order to validate anything */
if (wndPtr->hrgnUpdate)
{
if (!hrgnUpdate && !rectUpdate)
{
/* Special case: validate everything */
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = 0;
}
else
{
tmpRgn = CreateRectRgn( 0, 0, 0, 0 );
if ((hrgn = hrgnUpdate) == 0)
hrgn = CreateRectRgnIndirect( rectUpdate );
if (CombineRgn( tmpRgn, wndPtr->hrgnUpdate,
hrgn, RGN_DIFF ) == NULLREGION)
{
DeleteObject( tmpRgn );
tmpRgn = 0;
}
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = tmpRgn;
if (!hrgnUpdate) DeleteObject( hrgn );
}
if (!wndPtr->hrgnUpdate) /* No more update region */
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
MSG_DecPaintCount( wndPtr->hmemTaskQ );
}
else wndPtr->hrgnUpdate = hrgn;
}
}
if (flags & RDW_NOFRAME) wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
if (flags & RDW_NOERASE) wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
}
/* Set/clear internal paint flag */
......@@ -393,7 +360,6 @@ BOOL GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
*/
int GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
{
HRGN hrgnClip;
int retval;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return ERROR;
......@@ -403,13 +369,8 @@ int GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
SetRectRgn( hrgn, 0, 0, 0, 0 );
return NULLREGION;
}
hrgnClip = CreateRectRgn( 0, 0,
wndPtr->rectClient.right-wndPtr->rectClient.left,
wndPtr->rectClient.bottom-wndPtr->rectClient.top);
if (!hrgnClip) return ERROR;
retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, hrgnClip, RGN_AND );
retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY );
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN );
DeleteObject( hrgnClip );
return retval;
}
......
......@@ -400,7 +400,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Send the WM_GETMINMAXINFO message and fix the size if needed */
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
if ( maxSize.x < width)
{
......@@ -532,6 +532,21 @@ BOOL DestroyWindow( HWND hwnd )
ReleaseCapture();
WIN_SendParentNotify( hwnd, WM_DESTROY, MAKELONG(hwnd, wndPtr->wIDmenu) );
/* Recursively destroy owned windows */
for (;;)
{
HWND hwndSibling = GetWindow( hwnd, GW_HWNDFIRST );
while (hwndSibling)
{
WND *siblingPtr = WIN_FindWndPtr( hwndSibling );
if (siblingPtr->hwndOwner == hwnd) break;
hwndSibling = siblingPtr->hwndNext;
}
if (hwndSibling) DestroyWindow( hwndSibling );
else break;
}
/* Send destroy messages and destroy children */
SendMessage( hwnd, WM_DESTROY, 0, 0 );
......@@ -560,7 +575,6 @@ void CloseWindow(HWND hWnd)
}
/***********************************************************************
* OpenIcon (USER.44)
*/
......@@ -572,7 +586,6 @@ BOOL OpenIcon(HWND hWnd)
}
/***********************************************************************
* FindWindow (USER.50)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment