mirror of
https://github.com/reactos/reactos.git
synced 2024-07-22 04:08:08 +00:00
no message
svn path=/trunk/; revision=583
This commit is contained in:
parent
fad2f584e9
commit
01034d9c59
|
@ -4,6 +4,11 @@ WINBOOL STDCALL DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
|
|||
{
|
||||
|
||||
}
|
||||
WINBOOL DrawIcon(HDC hDC, int xLeft, int yTop, HICON hIcon
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include <windows.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
DCE *firstDCE = 0;
|
||||
HDC defaultDCstate = 0;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_AllocDCE
|
||||
*
|
||||
|
@ -82,7 +84,7 @@ void DCE_DeleteClipRgn( DCE* dce )
|
|||
|
||||
dce->hClipRgn = 0;
|
||||
|
||||
//TRACE(dc,"\trestoring VisRgn\n");
|
||||
//DPRINT("\trestoring VisRgn\n");
|
||||
|
||||
RestoreVisRgn(dce->hDC);
|
||||
|
||||
|
@ -317,4 +319,92 @@ INT DCE_ExcludeRgn( HDC hDC, WND* wnd, HRGN hRgn )
|
|||
OffsetRgn(hRgn, pt.x, pt.y);
|
||||
|
||||
return ExtSelectClipRgn( hDC, hRgn, RGN_DIFF );
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_InvalidateDCE
|
||||
*
|
||||
* It is called from SetWindowPos() - we have to mark as dirty all busy
|
||||
* DCE's for windows that have pWnd->parent as an ansector and whose client
|
||||
* rect intersects with specified update rectangle.
|
||||
*/
|
||||
WINBOOL DCE_InvalidateDCE(WND* pWnd, const RECT* pRectUpdate)
|
||||
{
|
||||
WND* wndScope = pWnd->parent;
|
||||
WINBOOL bRet = FALSE;
|
||||
|
||||
if( wndScope )
|
||||
{
|
||||
DCE *dce;
|
||||
|
||||
DPRINT("scope hwnd = %04x, (%i,%i - %i,%i)\n",
|
||||
wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
|
||||
pRectUpdate->right,pRectUpdate->bottom);
|
||||
// if(TRACE_ON(dc))
|
||||
// DCE_DumpCache();
|
||||
|
||||
/* walk all DCEs and fixup non-empty entries */
|
||||
|
||||
for (dce = firstDCE; (dce); dce = dce->next)
|
||||
{
|
||||
if( !(dce->DCXflags & DCX_DCEEMPTY) )
|
||||
{
|
||||
WND* wndCurrent = WIN_FindWndPtr(dce->hwndCurrent);
|
||||
|
||||
if( wndCurrent && wndCurrent != WIN_GetDesktop() )
|
||||
{
|
||||
WND* wnd = wndCurrent;
|
||||
INT xoffset = 0, yoffset = 0;
|
||||
|
||||
if( (wndCurrent == wndScope) && !(dce->DCXflags & DCX_CLIPCHILDREN) ) continue;
|
||||
|
||||
/* check if DCE window is within the z-order scope */
|
||||
|
||||
for( wnd = wndCurrent; wnd; wnd = wnd->parent )
|
||||
{
|
||||
if( wnd == wndScope )
|
||||
{
|
||||
RECT wndRect;
|
||||
|
||||
wndRect = wndCurrent->rectWindow;
|
||||
|
||||
OffsetRect( &wndRect, xoffset - wndCurrent->rectClient.left,
|
||||
yoffset - wndCurrent->rectClient.top);
|
||||
|
||||
if (pWnd == wndCurrent ||
|
||||
IntersectRect( &wndRect, &wndRect, pRectUpdate ))
|
||||
{
|
||||
if( !(dce->DCXflags & DCX_DCEBUSY) )
|
||||
{
|
||||
/* Don't bother with visible regions of unused DCEs */
|
||||
|
||||
DPRINT("\tpurged %08x dce [%04x]\n",
|
||||
(unsigned)dce, wndCurrent->hwndSelf);
|
||||
|
||||
dce->hwndCurrent = 0;
|
||||
dce->DCXflags &= DCX_CACHE;
|
||||
dce->DCXflags |= DCX_DCEEMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set dirty bits in the hDC and DCE structs */
|
||||
|
||||
DPRINT("\tfixed up %08x dce [%04x]\n",
|
||||
(unsigned)dce, wndCurrent->hwndSelf);
|
||||
|
||||
dce->DCXflags |= DCX_DCEDIRTY;
|
||||
//SetHookFlags(dce->hDC, DCHF_INVALIDATEVISRGN);
|
||||
bRet = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
xoffset += wnd->rectClient.left;
|
||||
yoffset += wnd->rectClient.top;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* dce list */
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
|
|
@ -6,17 +6,25 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include "user.h"
|
||||
#include "heap.h"
|
||||
#include "nonclient.h"
|
||||
#include "winpos.h"
|
||||
#include "dce.h"
|
||||
#include "sysmetrics.h"
|
||||
#include "debug.h"
|
||||
#include "spy.h"
|
||||
#include "tweak.h"
|
||||
#include "wine/winuser.h"
|
||||
#include <user32/nc.h>
|
||||
#include <user32/heapdup.h>
|
||||
#include <user32/winpos.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/sysmetr.h>
|
||||
#include <user32/paint.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
|
||||
void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush );
|
||||
|
||||
#define WM_CTLCOLOR 0x0019
|
||||
#define WM_ISACTIVEICON 0x0035
|
||||
#define WM_DROPOBJECT 0x022A
|
||||
#define WM_QUERYDROPOBJECT 0x022B
|
||||
|
||||
#define DRAG_FILE 0x454C4946
|
||||
|
||||
/* Last COLOR id */
|
||||
#define COLOR_MAX COLOR_BTNHIGHLIGHT
|
||||
|
@ -33,7 +41,7 @@ static short iMenuSysKey = 0;
|
|||
*
|
||||
* Handle the WM_WINDOWPOSCHANGED message.
|
||||
*/
|
||||
static void DEFWND_HandleWindowPosChanged( WND *wndPtr, UINT flags )
|
||||
void DEFWND_HandleWindowPosChanged( WND *wndPtr, UINT flags )
|
||||
{
|
||||
WPARAM wp = SIZE_RESTORED;
|
||||
|
||||
|
@ -61,16 +69,15 @@ void DEFWND_SetTextA( WND *wndPtr, LPCSTR text )
|
|||
{
|
||||
if (!text) text = "";
|
||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||
wndPtr->text = HEAP_strdupA( GetProcessHeap(), 0, text );
|
||||
wndPtr->pDriver->pSetText(wndPtr, wndPtr->text);
|
||||
wndPtr->text = (void *)HEAP_strdupA( GetProcessHeap(), 0, text );
|
||||
}
|
||||
|
||||
|
||||
void DEFWND_SetTextW( WND *wndPtr, LPCSTR text )
|
||||
void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text )
|
||||
{
|
||||
if (!text) text = "";
|
||||
if (!text) text = L"";
|
||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||
wndPtr->text = HEAP_strdupW( GetProcessHeap(), 0, text );
|
||||
wndPtr->text = (void *)HEAP_strdupW( GetProcessHeap(), 0, text );
|
||||
|
||||
}
|
||||
/***********************************************************************
|
||||
|
@ -108,11 +115,11 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType )
|
|||
/***********************************************************************
|
||||
* DEFWND_SetRedraw
|
||||
*/
|
||||
static void DEFWND_SetRedraw( WND* wndPtr, WPARAM wParam )
|
||||
void DEFWND_SetRedraw( WND* wndPtr, WPARAM wParam )
|
||||
{
|
||||
WINBOOL bVisible = wndPtr->dwStyle & WS_VISIBLE;
|
||||
|
||||
TRACE(win,"%04x %i\n", wndPtr->hwndSelf, (wParam!=0) );
|
||||
DPRINT("%04x %i\n", (UINT)wndPtr->hwndSelf, (wParam!=0) );
|
||||
|
||||
if( wParam )
|
||||
{
|
||||
|
@ -138,16 +145,19 @@ static void DEFWND_SetRedraw( WND* wndPtr, WPARAM wParam )
|
|||
*
|
||||
* Default window procedure for messages that are the same in Win and Win.
|
||||
*/
|
||||
static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
||||
LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
POINT pt;
|
||||
switch(msg)
|
||||
{
|
||||
case WM_NCPAINT:
|
||||
return NC_HandleNCPaint( wndPtr->hwndSelf, (HRGN)wParam );
|
||||
|
||||
case WM_NCHITTEST:
|
||||
return NC_HandleNCHitTest( wndPtr->hwndSelf, MAKEPOINT(lParam) );
|
||||
pt.x = LOWORD(lParam);
|
||||
pt.y = HIWORD(lParam);
|
||||
return NC_HandleNCHitTest( wndPtr->hwndSelf, pt);
|
||||
|
||||
case WM_NCLBUTTONDOWN:
|
||||
return NC_HandleNCLButtonDown( wndPtr, wParam, lParam );
|
||||
|
@ -175,7 +185,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
TrackPopupMenu(wndPtr->hSysMenu,TPM_LEFTALIGN | TPM_RETURNCMD,LOWORD(lParam),HIWORD(lParam),0,wndPtr->hwndSelf,NULL);
|
||||
DestroyMenu(wndPtr->hSysMenu);
|
||||
*/
|
||||
FIXME(win,"Display default popup menu\n");
|
||||
DPRINT("Fixme Display default popup menu\n");
|
||||
/* Track system popup if click was in the caption area. */
|
||||
}
|
||||
break;
|
||||
|
@ -204,7 +214,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
SYSMETRICS_CXICON)/2;
|
||||
int y = (wndPtr->rectWindow.bottom - wndPtr->rectWindow.top -
|
||||
SYSMETRICS_CYICON)/2;
|
||||
TRACE(win,"Painting class icon: vis rect=(%i,%i - %i,%i)\n",
|
||||
DPRINT("Painting class icon: vis rect=(%i,%i - %i,%i)\n",
|
||||
ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom );
|
||||
DrawIcon( hdc, x, y, wndPtr->class->hIcon );
|
||||
}
|
||||
|
@ -272,7 +282,10 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
|
||||
|
||||
case WM_GETTEXTLENGTH:
|
||||
if (wndPtr->text) return (LRESULT)strlen(wndPtr->text);
|
||||
if (wndPtr->text && wndPtr->class->bUnicode == TRUE)
|
||||
return (LRESULT)lstrlenW(wndPtr->text);
|
||||
else if (wndPtr->text && wndPtr->class->bUnicode == FALSE)
|
||||
return (LRESULT)lstrlenA(wndPtr->text);
|
||||
return 0;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
|
@ -283,8 +296,9 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
return NC_HandleSetCursor( wndPtr->hwndSelf, wParam, lParam );
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
return NC_HandleSysCommand( wndPtr->hwndSelf, wParam,
|
||||
MAKEPOINT(lParam) );
|
||||
pt.x = LOWORD(lParam);
|
||||
pt.y = HIWORD(lParam);
|
||||
return NC_HandleSysCommand( wndPtr->hwndSelf, wParam,pt);
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(wParam == VK_F10) iF10Key = VK_F10;
|
||||
|
@ -357,7 +371,8 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
break;
|
||||
|
||||
case WM_CANCELMODE:
|
||||
if (wndPtr->parent == WIN_GetDesktop()) EndMenu();
|
||||
//if (wndPtr->parent == WIN_GetDesktop())
|
||||
//EndMenu();
|
||||
if (GetCapture() == wndPtr->hwndSelf) ReleaseCapture();
|
||||
break;
|
||||
|
||||
|
@ -374,6 +389,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
#if 0
|
||||
HICON hIcon=0;
|
||||
UINT len;
|
||||
|
||||
|
@ -382,7 +398,10 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
if((hIcon=LoadIcon(wndPtr->hInstance,MAKEINTRESOURCE(len))))
|
||||
return (LRESULT)hIcon;
|
||||
return (LRESULT)LoadIcon(0,IDI_APPLICATION);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_ISACTIVEICON:
|
||||
|
@ -396,4 +415,16 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LPVOID HEAP_strdupAtoW(HANDLE hHeap,DWORD dwFlags, LPCSTR lpszAsciiString )
|
|||
{
|
||||
int i;
|
||||
INT len = lstrlenA(lpszAsciiString);
|
||||
LPWSTR lpszUnicodeString = HeapAlloc( GetProcessHeap(), 0, (len + 1)*2 );
|
||||
LPWSTR lpszUnicodeString = HeapAlloc(hHeap, dwFlags, (len + 1)*2 );
|
||||
for(i=0;i<len;i++)
|
||||
lpszUnicodeString[i] = lpszAsciiString[i];
|
||||
lpszUnicodeString[i] = 0;
|
||||
|
@ -19,7 +19,7 @@ LPVOID HEAP_strdupWtoA(HANDLE hHeap,DWORD dwFlags, LPCWSTR lpszUnicodeString )
|
|||
{
|
||||
int i;
|
||||
INT len = lstrlenW(lpszUnicodeString);
|
||||
LPSTR lpszAsciiString = HeapAlloc( GetProcessHeap(), 0, (len + 1) );
|
||||
LPSTR lpszAsciiString = HeapAlloc(hHeap, dwFlags, (len + 1) );
|
||||
for(i=0;i<len;i++)
|
||||
lpszAsciiString[i] = lpszUnicodeString[i];
|
||||
lpszAsciiString[i] = 0;
|
||||
|
@ -28,16 +28,7 @@ LPVOID HEAP_strdupWtoA(HANDLE hHeap,DWORD dwFlags, LPCWSTR lpszUnicodeString )
|
|||
|
||||
//FIXME should use multi byte strings instead
|
||||
|
||||
LPVOID HEAP_wcsdup(HANDLE hHeap, DWORD dwFlags, LPCWSTR lpszUnicodeString )
|
||||
{
|
||||
int i;
|
||||
INT len = lstrlenW(lpszUnicodeString);
|
||||
LPWSTR lpszString = HeapAlloc( GetProcessHeap(), 0, (len + 1)*2 );
|
||||
for(i=0;i<len;i++)
|
||||
lpszString[i] = lpszUnicodeString[i];
|
||||
lpszString[i] = 0;
|
||||
return lpszString;
|
||||
}
|
||||
|
||||
|
||||
int lstrcpynWtoA( LPSTR ptr1, LPWSTR ptr2, int n )
|
||||
{
|
||||
|
@ -92,19 +83,19 @@ int lpstrncpyW( LPWSTR ptr1,LPWSTR ptr2, int n)
|
|||
}
|
||||
}
|
||||
|
||||
LPSTR HEAP_strdupA(LPSTR ptr)
|
||||
LPSTR HEAP_strdupA(HANDLE hHeap,DWORD dwFlags,LPCSTR ptr)
|
||||
{
|
||||
INT len = lstrlenA(ptr);
|
||||
LPSTR lpszString = HeapAlloc( GetProcessHeap(), 0, (len + 1) );
|
||||
LPSTR lpszString = HeapAlloc(hHeap, dwFlags, (len + 1) );
|
||||
if ( lpszString != NULL )
|
||||
lstrcpyA(lpszString,ptr);
|
||||
|
||||
return lpszString;
|
||||
}
|
||||
LPWSTR HEAP_strdupW(LPWSTR ptr)
|
||||
LPWSTR HEAP_strdupW(HANDLE hHeap,DWORD dwFlags,LPCWSTR ptr)
|
||||
{
|
||||
INT len = lstrlenW(ptr);
|
||||
LPWSTR lpszString = HeapAlloc( GetProcessHeap(), 0, (len + 1)*2 );
|
||||
LPWSTR lpszString = HeapAlloc(hHeap, dwFlags, (len + 1)*2 );
|
||||
if ( lpszString != NULL )
|
||||
lstrcpyW(lpszString,ptr);
|
||||
|
||||
|
|
|
@ -1342,7 +1342,7 @@ WINBOOL MENU_PatchResidentPopup( HQUEUE checkQueue, WND* checkWnd )
|
|||
str++;
|
||||
}
|
||||
|
||||
if ( ! (text = HEAP_wcsdup(GetProcessHeap,0, str ) ))
|
||||
if ( ! (text = HEAP_strdupW(GetProcessHeap,0, str ) ))
|
||||
return FALSE;
|
||||
item->text = text;
|
||||
}
|
||||
|
|
|
@ -640,7 +640,8 @@ WINBOOL MSG_PeekMessage( LPMSG msg, HWND hwnd, WORD first, WORD last,
|
|||
while(1)
|
||||
{
|
||||
hQueue = GetFastQueue();
|
||||
msgQueue = (MESSAGEQUEUE *)GlobalLock( hQueue );
|
||||
// msgQueue = (MESSAGEQUEUE *)GlobalLock( hQueue );
|
||||
msgQueue = (MESSAGEQUEUE *) hQueue;
|
||||
if (!msgQueue) return FALSE;
|
||||
msgQueue->changeBits = 0;
|
||||
|
||||
|
@ -1045,10 +1046,16 @@ HTASK GetCurrentTask(void)
|
|||
}
|
||||
|
||||
//FIXME
|
||||
HQUEUE hThreadQ;
|
||||
int init = 0;
|
||||
MESSAGEQUEUE Queue;
|
||||
HQUEUE hThreadQ = &Queue;;
|
||||
|
||||
HQUEUE GetThreadQueue( DWORD thread )
|
||||
{
|
||||
if ( init == 0 ) {
|
||||
init = 1;
|
||||
memset(&Queue,0,sizeof(MESSAGEQUEUE));
|
||||
}
|
||||
return hThreadQ;
|
||||
}
|
||||
|
||||
|
|
251
reactos/lib/user32/internal/paint.c
Normal file
251
reactos/lib/user32/internal/paint.c
Normal file
|
@ -0,0 +1,251 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <user32/paint.h>
|
||||
|
||||
/*
|
||||
* Window painting functions
|
||||
*
|
||||
* Copyright 1993, 1994, 1995 Alexandre Julliard
|
||||
*
|
||||
* FIXME: Do not repaint full nonclient area all the time. Instead, compute
|
||||
* intersection with hrgnUpdate (which should be moved from client to
|
||||
* window coords as well, lookup 'the pain' comment in the winpos.c).
|
||||
*/
|
||||
|
||||
/* Last CTLCOLOR id */
|
||||
//#define CTLCOLOR_MAX CTLCOLOR_STATIC
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PAINT_RedrawWindow
|
||||
*
|
||||
* FIXME: Windows uses WM_SYNCPAINT to cut down the number of intertask
|
||||
* SendMessage() calls. This is a comment inside DefWindowProc() source
|
||||
* from 16-bit SDK:
|
||||
*
|
||||
* This message avoids lots of inter-app message traffic
|
||||
* by switching to the other task and continuing the
|
||||
* recursion there.
|
||||
*
|
||||
* wParam = flags
|
||||
* LOWORD(lParam) = hrgnClip
|
||||
* HIWORD(lParam) = hwndSkip (not used; always NULL)
|
||||
*
|
||||
* All in all, a prime candidate for a rewrite.
|
||||
*/
|
||||
WINBOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
|
||||
HRGN hrgnUpdate, UINT flags, UINT control )
|
||||
{
|
||||
WINBOOL bIcon;
|
||||
HRGN hrgn;
|
||||
RECT rectClient;
|
||||
WND* wndPtr;
|
||||
WND **list, **ppWnd;
|
||||
|
||||
if (!hwnd) hwnd = GetDesktopWindow();
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
|
||||
if (!WIN_IsWindowDrawable( wndPtr, !(flags & RDW_FRAME) ) )
|
||||
return TRUE; /* No redraw needed */
|
||||
|
||||
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
|
||||
if (rectUpdate)
|
||||
{
|
||||
DPRINT( "%04x %d,%d-%d,%d %04x flags=%04x\n",
|
||||
hwnd, rectUpdate->left, rectUpdate->top,
|
||||
rectUpdate->right, rectUpdate->bottom, hrgnUpdate, flags );
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT( "%04x NULL %04x flags=%04x\n", hwnd, hrgnUpdate, flags);
|
||||
}
|
||||
|
||||
GetClientRect( hwnd, &rectClient );
|
||||
|
||||
if (flags & RDW_INVALIDATE) /* Invalidate */
|
||||
{
|
||||
int rgnNotEmpty = COMPLEXREGION;
|
||||
|
||||
if (wndPtr->hrgnUpdate > 1) /* Is there already an update region? */
|
||||
{
|
||||
if ((hrgn = hrgnUpdate) == 0)
|
||||
hrgn = CreateRectRgnIndirect( rectUpdate ? rectUpdate :
|
||||
&rectClient );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate,
|
||||
hrgn, RGN_OR );
|
||||
if (!hrgnUpdate) DeleteObject( hrgn );
|
||||
}
|
||||
else /* No update region yet */
|
||||
{
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_IncPaintCount( wndPtr->hmemTaskQ );
|
||||
if (hrgnUpdate)
|
||||
{
|
||||
wndPtr->hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, hrgnUpdate,
|
||||
0, RGN_COPY );
|
||||
}
|
||||
else wndPtr->hrgnUpdate = CreateRectRgnIndirect( rectUpdate ?
|
||||
rectUpdate : &rectClient );
|
||||
}
|
||||
|
||||
if (flags & RDW_FRAME) wndPtr->flags |= WIN_NEEDS_NCPAINT;
|
||||
|
||||
/* restrict update region to client area (FIXME: correct?) */
|
||||
if (wndPtr->hrgnUpdate)
|
||||
{
|
||||
HRGN clientRgn = CreateRectRgnIndirect( &rectClient );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, clientRgn,
|
||||
wndPtr->hrgnUpdate, RGN_AND );
|
||||
DeleteObject( clientRgn );
|
||||
}
|
||||
|
||||
/* check for bogus update region */
|
||||
if ( rgnNotEmpty == NULLREGION )
|
||||
{
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate=0;
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
}
|
||||
else
|
||||
if (flags & RDW_ERASE) wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
|
||||
flags |= RDW_FRAME; /* Force children frame invalidation */
|
||||
}
|
||||
else if (flags & RDW_VALIDATE) /* Validate */
|
||||
{
|
||||
/* We need an update region in order to validate anything */
|
||||
if (wndPtr->hrgnUpdate > 1)
|
||||
{
|
||||
if (!hrgnUpdate && !rectUpdate)
|
||||
{
|
||||
/* Special case: validate everything */
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((hrgn = hrgnUpdate) == 0)
|
||||
hrgn = CreateRectRgnIndirect( rectUpdate );
|
||||
if (CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate,
|
||||
hrgn, RGN_DIFF ) == NULLREGION)
|
||||
{
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
}
|
||||
if (!hrgnUpdate) DeleteObject( hrgn );
|
||||
}
|
||||
if (!wndPtr->hrgnUpdate) /* No more update region */
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
}
|
||||
if (flags & RDW_NOFRAME) wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
|
||||
if (flags & RDW_NOERASE) wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
}
|
||||
|
||||
/* Set/clear internal paint flag */
|
||||
|
||||
if (flags & RDW_INTERNALPAINT)
|
||||
{
|
||||
if ( wndPtr->hrgnUpdate <= 1 && !(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_IncPaintCount( wndPtr->hmemTaskQ );
|
||||
wndPtr->flags |= WIN_INTERNAL_PAINT;
|
||||
}
|
||||
else if (flags & RDW_NOINTERNALPAINT)
|
||||
{
|
||||
if ( wndPtr->hrgnUpdate <= 1 && (wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
wndPtr->flags &= ~WIN_INTERNAL_PAINT;
|
||||
}
|
||||
|
||||
/* Erase/update window */
|
||||
|
||||
if (flags & RDW_UPDATENOW)
|
||||
{
|
||||
if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
|
||||
SendMessageA( hwnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
|
||||
}
|
||||
else if (flags & RDW_ERASENOW)
|
||||
{
|
||||
if (wndPtr->flags & WIN_NEEDS_NCPAINT)
|
||||
WIN_UpdateNCArea( wndPtr, FALSE);
|
||||
|
||||
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
|
||||
{
|
||||
HDC hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
|
||||
DCX_INTERSECTRGN | DCX_USESTYLE |
|
||||
DCX_KEEPCLIPRGN | DCX_WINDOWPAINT |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
if (hdc)
|
||||
{
|
||||
if (SendMessageA( hwnd, (bIcon) ? WM_ICONERASEBKGND
|
||||
: WM_ERASEBKGND,
|
||||
(WPARAM)hdc, 0 ))
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
ReleaseDC( hwnd, hdc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Recursively process children */
|
||||
|
||||
if (!(flags & RDW_NOCHILDREN) &&
|
||||
((flags & RDW_ALLCHILDREN) || !(wndPtr->dwStyle & WS_CLIPCHILDREN)) &&
|
||||
!(wndPtr->dwStyle & WS_MINIMIZE) )
|
||||
{
|
||||
if ( hrgnUpdate || rectUpdate )
|
||||
{
|
||||
if (!(hrgn = CreateRectRgn( 0, 0, 0, 0 ))) return TRUE;
|
||||
if( !hrgnUpdate )
|
||||
{
|
||||
control |= (RDW_C_DELETEHRGN | RDW_C_USEHRGN);
|
||||
if( !(hrgnUpdate = CreateRectRgnIndirect( rectUpdate )) )
|
||||
{
|
||||
DeleteObject( hrgn );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if( (list = WIN_BuildWinArray( wndPtr, 0, NULL )) )
|
||||
{
|
||||
for (ppWnd = list; *ppWnd; ppWnd++)
|
||||
{
|
||||
wndPtr = *ppWnd;
|
||||
if (!IsWindow(wndPtr->hwndSelf)) continue;
|
||||
if (wndPtr->dwStyle & WS_VISIBLE)
|
||||
{
|
||||
SetRectRgn( hrgn,
|
||||
wndPtr->rectWindow.left, wndPtr->rectWindow.top,
|
||||
wndPtr->rectWindow.right, wndPtr->rectWindow.bottom );
|
||||
if (CombineRgn( hrgn, hrgn, hrgnUpdate, RGN_AND ))
|
||||
{
|
||||
OffsetRgn( hrgn, -wndPtr->rectClient.left,
|
||||
-wndPtr->rectClient.top );
|
||||
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, hrgn, flags,
|
||||
RDW_C_USEHRGN );
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list );
|
||||
}
|
||||
DeleteObject( hrgn );
|
||||
if (control & RDW_C_DELETEHRGN) DeleteObject( hrgnUpdate );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (list = WIN_BuildWinArray( wndPtr, 0, NULL )) )
|
||||
{
|
||||
for (ppWnd = list; *ppWnd; ppWnd++)
|
||||
{
|
||||
wndPtr = *ppWnd;
|
||||
if (IsWindow( wndPtr->hwndSelf ))
|
||||
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, flags, 0 );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ void QUEUE_WaitBits( WORD bits )
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetFastQueue() ))) return;
|
||||
if (!(queue = (MESSAGEQUEUE *)( GetFastQueue() ))) return;
|
||||
|
||||
if (queue->changeBits & bits)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,8 @@ HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM classAtom)
|
|||
wndPtr->hmemTaskQ = GetFastQueue();
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
wndPtr->hwndLastActive = wndPtr->hwndSelf;
|
||||
wndPtr->dwStyle = cs->style & ~WS_VISIBLE;
|
||||
// wndPtr->dwStyle = cs->style & ~WS_VISIBLE;
|
||||
wndPtr->dwStyle = cs->style | WS_VISIBLE;
|
||||
wndPtr->dwExStyle = cs->dwExStyle;
|
||||
wndPtr->wIDmenu = 0;
|
||||
wndPtr->helpContext = 0;
|
||||
|
@ -828,6 +829,7 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate)
|
|||
*/
|
||||
WINBOOL WIN_IsWindowDrawable( WND* wnd, WINBOOL icon )
|
||||
{
|
||||
|
||||
if( (wnd->dwStyle & WS_MINIMIZE &&
|
||||
icon && wnd->class->hIcon) ||
|
||||
!(wnd->dwStyle & WS_VISIBLE) ) return FALSE;
|
||||
|
|
|
@ -3,7 +3,7 @@ all: user32.exe
|
|||
INTERNAL_OBJECTS = internal/property.o internal/menu.o internal/heapdup.o internal/nc.o\
|
||||
internal/scroll.o 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/text.o internal/defwnd.o internal/paint.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
|
||||
|
@ -12,7 +12,7 @@ MISC_OBJECTS = misc/sprintf.o misc/dllmain.o misc/string.o misc/sysmetr.o\
|
|||
WINDOWS_OBJECTS = windows/wndproc.o windows/win.o windows/hook.o windows/spy.o\
|
||||
windows/queue.o windows/winpos.o windows/class.o windows/menu.o windows/dc.o\
|
||||
windows/timer.o windows/rect.o windows/msg.o windows/input.o windows/property.o\
|
||||
windows/focus.o
|
||||
windows/focus.o windows/paint.o
|
||||
|
||||
GRAPHICS_OBJECTS = graphics/rect.o graphics/caret.o graphics/text.o graphics/syscol.o graphics/fill.o\
|
||||
graphics/draw.o
|
||||
|
|
|
@ -18,7 +18,7 @@ int main(int argc, char **argv)
|
|||
MSG msg;
|
||||
WNDCLASSEX wc1;
|
||||
HINSTANCE hInst = 0;
|
||||
int nWinMode = 0;
|
||||
int nWinMode = SW_SHOWMAXIMIZED;
|
||||
|
||||
wc1.hInstance = hInst;
|
||||
wc1.lpszClassName = szName;
|
||||
|
@ -38,18 +38,22 @@ int main(int argc, char **argv)
|
|||
|
||||
if ( !RegisterClassEx(&wc1)) return 0;
|
||||
|
||||
hwnd = CreateWindowEx(0, szName, "test", WS_OVERLAPPEDWINDOW,
|
||||
hwnd = CreateWindowEx(0, szName, "test", WS_OVERLAPPEDWINDOW| WS_VISIBLE,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
|
||||
NULL,NULL,hInst, NULL);
|
||||
|
||||
|
||||
|
||||
ShowWindow(hwnd,nWinMode);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
while(GetMessage(&msg,NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
SendMessageW( hwnd, WM_MOVE, 0,MAKELONG(0,0));
|
||||
//while(GetMessage(&msg,NULL, 0, 0))
|
||||
//{
|
||||
// TranslateMessage(&msg);
|
||||
// DispatchMessage(&msg);
|
||||
//}
|
||||
Sleep(10000);
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#include <windows.h>
|
||||
|
||||
SHORT GetKeyState( int nVirtKey )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
STDCALL
|
||||
ToAscii(
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <windows.h>
|
||||
#include <user32/class.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/heapdup.h>
|
||||
|
||||
CLASS *rootClass;
|
||||
|
@ -100,8 +101,10 @@ ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc)
|
|||
classPtr->hbrBackground = (HBRUSH)wc->hbrBackground;
|
||||
classPtr->bUnicode = FALSE;
|
||||
|
||||
classPtr->dce = (wc->style & CS_CLASSDC) ?
|
||||
CreateDC( "DISPLAY", NULL,NULL,NULL ) : NULL;
|
||||
if (wc->style & CS_CLASSDC)
|
||||
classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ;
|
||||
else classPtr->style |= CS_OWNDC;
|
||||
|
||||
|
||||
|
||||
if ( wc->lpszMenuName != NULL ) {
|
||||
|
|
|
@ -272,234 +272,3 @@ HDC GetWindowDC(HWND hWnd )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* BeginPaint (USER.10)
|
||||
*/
|
||||
HDC
|
||||
STDCALL
|
||||
BeginPaint(
|
||||
HWND hWnd,
|
||||
LPPAINTSTRUCT lpPaint)
|
||||
{
|
||||
WINBOOL bIcon;
|
||||
HRGN hrgnUpdate;
|
||||
WND *wndPtr = WIN_FindWndPtr( hWnd );
|
||||
if (!wndPtr) return 0;
|
||||
|
||||
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
|
||||
|
||||
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
||||
|
||||
if (wndPtr->flags & WIN_NEEDS_NCPAINT) WIN_UpdateNCArea( wndPtr, TRUE );
|
||||
|
||||
if (((hrgnUpdate = wndPtr->hrgnUpdate) != 0) ||
|
||||
(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
wndPtr->flags &= ~WIN_INTERNAL_PAINT;
|
||||
|
||||
HideCaret( hWnd );
|
||||
|
||||
DPRINT("hrgnUpdate = %04x, \n", hrgnUpdate);
|
||||
|
||||
/* When bIcon is TRUE hrgnUpdate is automatically in window coordinates
|
||||
* (because rectClient == rectWindow for WS_MINIMIZE windows).
|
||||
*/
|
||||
|
||||
if (wndPtr->class->style & CS_PARENTDC)
|
||||
{
|
||||
/* Don't clip the output to the update region for CS_PARENTDC window */
|
||||
if(hrgnUpdate > 1)
|
||||
DeleteObject(hrgnUpdate);
|
||||
lpPaint->hdc = GetDCEx( hWnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPaint->hdc = GetDCEx(hWnd, hrgnUpdate, DCX_INTERSECTRGN |
|
||||
DCX_WINDOWPAINT | DCX_USESTYLE |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
}
|
||||
|
||||
DPRINT("hdc = %04x\n", lpPaint->hdc);
|
||||
|
||||
if (!lpPaint->hdc)
|
||||
{
|
||||
//WARN(win, "GetDCEx() failed in BeginPaint(), hWnd=%04x\n", hWnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GetClipBox( lpPaint->hdc, &lpPaint->rcPaint );
|
||||
|
||||
DPRINT("box = (%i,%i - %i,%i)\n", lpPaint->rcPaint.left, lpPaint->rcPaint.top,
|
||||
lpPaint->rcPaint.right, lpPaint->rcPaint.bottom );
|
||||
|
||||
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
|
||||
{
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
lpPaint->fErase = !SendMessageA(hWnd, (bIcon) ? WM_ICONERASEBKGND
|
||||
: WM_ERASEBKGND,
|
||||
(WPARAM)lpPaint->hdc, 0 );
|
||||
}
|
||||
else lpPaint->fErase = TRUE;
|
||||
|
||||
return lpPaint->hdc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL EndPaint( HWND hWnd, const PAINTSTRUCT *lpPaint )
|
||||
{
|
||||
ReleaseDC( hWnd, lpPaint->hdc );
|
||||
ShowCaret( hWnd );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RedrawWindow (USER32.426)
|
||||
*/
|
||||
WINBOOL STDCALL RedrawWindow( HWND hwnd, const RECT *rectUpdate,
|
||||
HRGN hrgnUpdate, UINT flags )
|
||||
{
|
||||
return PAINT_RedrawWindow( hwnd, rectUpdate, hrgnUpdate, flags, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* UpdateWindow (USER32.567)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
UpdateWindow(
|
||||
HWND hWnd)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InvalidateRgn (USER32.9)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
InvalidateRgn(
|
||||
HWND hWnd,
|
||||
HRGN hRgn,
|
||||
WINBOOL bErase)
|
||||
{
|
||||
return PAINT_RedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase ? RDW_ERASE : 0), 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InvalidateRect (USER32.8)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
InvalidateRect(
|
||||
HWND hWnd ,
|
||||
CONST RECT *lpRect,
|
||||
WINBOOL bErase)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, lpRect, 0,
|
||||
RDW_INVALIDATE | (bErase ? RDW_ERASE : 0), 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ValidateRgn (USER32.572)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
ValidateRgn(
|
||||
HWND hWnd,
|
||||
HRGN hRgn)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, NULL, hRgn, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ValidateRect (USER32.571)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
ValidateRect(
|
||||
HWND hWnd ,
|
||||
CONST RECT *lpRect)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, lpRect, 0, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRect (USER32.297)
|
||||
*/
|
||||
WINBOOL STDCALL GetUpdateRect( HWND hwnd, LPRECT rect, WINBOOL erase )
|
||||
{
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return FALSE;
|
||||
|
||||
if (rect)
|
||||
{
|
||||
if (wndPtr->hrgnUpdate > 1)
|
||||
{
|
||||
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR) return FALSE;
|
||||
GetRgnBox( hrgn, rect );
|
||||
DeleteObject( hrgn );
|
||||
}
|
||||
else SetRectEmpty( rect );
|
||||
}
|
||||
return ((UINT)wndPtr->hrgnUpdate > 1);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRgn (USER32.298)
|
||||
*/
|
||||
INT STDCALL GetUpdateRgn( HWND hwnd, HRGN hrgn, WINBOOL erase )
|
||||
{
|
||||
INT retval;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return ERROR;
|
||||
|
||||
if ((UINT)wndPtr->hrgnUpdate <= 1)
|
||||
{
|
||||
SetRectRgn( hrgn, 0, 0, 0, 0 );
|
||||
return NULLREGION;
|
||||
}
|
||||
retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY );
|
||||
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExcludeUpdateRgn (USER32.195)
|
||||
*/
|
||||
INT STDCALL ExcludeUpdateRgn( HDC hdc, HWND hwnd )
|
||||
{
|
||||
RECT rect;
|
||||
WND * wndPtr;
|
||||
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return ERROR;
|
||||
|
||||
if (wndPtr->hrgnUpdate)
|
||||
{
|
||||
INT ret;
|
||||
HRGN hrgn = CreateRectRgn(wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top,
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
if( wndPtr->hrgnUpdate > 1 )
|
||||
CombineRgn(hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY);
|
||||
|
||||
/* do ugly coordinate translations in dce.c */
|
||||
|
||||
ret = DCE_ExcludeRgn( hdc, wndPtr, hrgn );
|
||||
DeleteObject( hrgn );
|
||||
return ret;
|
||||
}
|
||||
return GetClipBox( hdc, &rect );
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
|
||||
HRGN hrgnUpdate, UINT flags, UINT control )
|
||||
{
|
||||
}
|
313
reactos/lib/user32/windows/paint.c
Normal file
313
reactos/lib/user32/windows/paint.c
Normal file
|
@ -0,0 +1,313 @@
|
|||
/*
|
||||
* Window painting functions
|
||||
*
|
||||
* Copyright 1993, 1994, 1995 Alexandre Julliard
|
||||
*
|
||||
* FIXME: Do not repaint full nonclient area all the time. Instead, compute
|
||||
* intersection with hrgnUpdate (which should be moved from client to
|
||||
* window coords as well, lookup 'the pain' comment in the winpos.c).
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <user32/paint.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/queue.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
|
||||
/* Last CTLCOLOR id */
|
||||
//#define CTLCOLOR_MAX CTLCOLOR_STATIC
|
||||
|
||||
#if 0
|
||||
/***********************************************************************
|
||||
* WIN_UpdateNCArea
|
||||
*
|
||||
*/
|
||||
void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate)
|
||||
{
|
||||
POINT16 pt = {0, 0};
|
||||
HRGN hClip = 1;
|
||||
|
||||
TRACE(nonclient,"hwnd %04x, hrgnUpdate %04x\n",
|
||||
wnd->hwndSelf, wnd->hrgnUpdate );
|
||||
|
||||
/* desktop window doesn't have nonclient area */
|
||||
if(wnd == WIN_GetDesktop())
|
||||
{
|
||||
wnd->flags &= ~WIN_NEEDS_NCPAINT;
|
||||
return;
|
||||
}
|
||||
|
||||
if( wnd->hrgnUpdate > 1 )
|
||||
{
|
||||
ClientToScreen16(wnd->hwndSelf, &pt);
|
||||
|
||||
hClip = CreateRectRgn( 0, 0, 0, 0 );
|
||||
if (!CombineRgn( hClip, wnd->hrgnUpdate, 0, RGN_COPY ))
|
||||
{
|
||||
DeleteObject(hClip);
|
||||
hClip = 1;
|
||||
}
|
||||
else
|
||||
OffsetRgn( hClip, pt.x, pt.y );
|
||||
|
||||
if (bUpdate)
|
||||
{
|
||||
/* exclude non-client area from update region */
|
||||
HRGN hrgn = CreateRectRgn( 0, 0,
|
||||
wnd->rectClient.right - wnd->rectClient.left,
|
||||
wnd->rectClient.bottom - wnd->rectClient.top);
|
||||
|
||||
if (hrgn && (CombineRgn( wnd->hrgnUpdate, wnd->hrgnUpdate,
|
||||
hrgn, RGN_AND) == NULLREGION))
|
||||
{
|
||||
DeleteObject( wnd->hrgnUpdate );
|
||||
wnd->hrgnUpdate = 1;
|
||||
}
|
||||
|
||||
DeleteObject( hrgn );
|
||||
}
|
||||
}
|
||||
|
||||
wnd->flags &= ~WIN_NEEDS_NCPAINT;
|
||||
|
||||
if ((wnd->hwndSelf == GetActiveWindow()) &&
|
||||
!(wnd->flags & WIN_NCACTIVATED))
|
||||
{
|
||||
wnd->flags |= WIN_NCACTIVATED;
|
||||
if( hClip > 1) DeleteObject( hClip );
|
||||
hClip = 1;
|
||||
}
|
||||
|
||||
if (hClip) SendMessage16( wnd->hwndSelf, WM_NCPAINT, hClip, 0L );
|
||||
|
||||
if (hClip > 1) DeleteObject( hClip );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
HDC
|
||||
STDCALL
|
||||
BeginPaint(
|
||||
HWND hWnd,
|
||||
LPPAINTSTRUCT lpPaint)
|
||||
{
|
||||
WINBOOL bIcon;
|
||||
HRGN hrgnUpdate;
|
||||
WND *wndPtr = WIN_FindWndPtr( hWnd );
|
||||
if (!wndPtr) return 0;
|
||||
|
||||
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
|
||||
|
||||
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
||||
|
||||
if (wndPtr->flags & WIN_NEEDS_NCPAINT) WIN_UpdateNCArea( wndPtr, TRUE );
|
||||
|
||||
if (((hrgnUpdate = wndPtr->hrgnUpdate) != 0) ||
|
||||
(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
wndPtr->flags &= ~WIN_INTERNAL_PAINT;
|
||||
|
||||
HideCaret( hWnd );
|
||||
|
||||
DPRINT("hrgnUpdate = %04x, \n", hrgnUpdate);
|
||||
|
||||
/* When bIcon is TRUE hrgnUpdate is automatically in window coordinates
|
||||
* (because rectClient == rectWindow for WS_MINIMIZE windows).
|
||||
*/
|
||||
|
||||
if (wndPtr->class->style & CS_PARENTDC)
|
||||
{
|
||||
/* Don't clip the output to the update region for CS_PARENTDC window */
|
||||
if(hrgnUpdate > 1)
|
||||
DeleteObject(hrgnUpdate);
|
||||
lpPaint->hdc = GetDCEx( hWnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPaint->hdc = GetDCEx(hWnd, hrgnUpdate, DCX_INTERSECTRGN |
|
||||
DCX_WINDOWPAINT | DCX_USESTYLE |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
}
|
||||
|
||||
DPRINT("hdc = %04x\n", lpPaint->hdc);
|
||||
|
||||
if (!lpPaint->hdc)
|
||||
{
|
||||
//WARN(win, "GetDCEx() failed in BeginPaint(), hWnd=%04x\n", hWnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GetClipBox( lpPaint->hdc, &lpPaint->rcPaint );
|
||||
|
||||
DPRINT("box = (%i,%i - %i,%i)\n", lpPaint->rcPaint.left, lpPaint->rcPaint.top,
|
||||
lpPaint->rcPaint.right, lpPaint->rcPaint.bottom );
|
||||
|
||||
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
|
||||
{
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
lpPaint->fErase = !SendMessageA(hWnd, (bIcon) ? WM_ICONERASEBKGND
|
||||
: WM_ERASEBKGND,
|
||||
(WPARAM)lpPaint->hdc, 0 );
|
||||
}
|
||||
else lpPaint->fErase = TRUE;
|
||||
|
||||
return lpPaint->hdc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL EndPaint( HWND hWnd, const PAINTSTRUCT *lpPaint )
|
||||
{
|
||||
ReleaseDC( hWnd, lpPaint->hdc );
|
||||
ShowCaret( hWnd );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RedrawWindow (USER32.426)
|
||||
*/
|
||||
WINBOOL STDCALL RedrawWindow( HWND hwnd, const RECT *rectUpdate,
|
||||
HRGN hrgnUpdate, UINT flags )
|
||||
{
|
||||
return PAINT_RedrawWindow( hwnd, rectUpdate, hrgnUpdate, flags, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* UpdateWindow (USER32.567)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
UpdateWindow(
|
||||
HWND hWnd)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InvalidateRgn (USER32.9)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
InvalidateRgn(
|
||||
HWND hWnd,
|
||||
HRGN hRgn,
|
||||
WINBOOL bErase)
|
||||
{
|
||||
return PAINT_RedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase ? RDW_ERASE : 0), 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InvalidateRect (USER32.8)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
InvalidateRect(
|
||||
HWND hWnd ,
|
||||
CONST RECT *lpRect,
|
||||
WINBOOL bErase)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, lpRect, 0,
|
||||
RDW_INVALIDATE | (bErase ? RDW_ERASE : 0), 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ValidateRgn (USER32.572)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
ValidateRgn(
|
||||
HWND hWnd,
|
||||
HRGN hRgn)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, NULL, hRgn, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ValidateRect (USER32.571)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
ValidateRect(
|
||||
HWND hWnd ,
|
||||
CONST RECT *lpRect)
|
||||
{
|
||||
return PAINT_RedrawWindow( hWnd, lpRect, 0, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRect (USER32.297)
|
||||
*/
|
||||
WINBOOL STDCALL GetUpdateRect( HWND hwnd, LPRECT rect, WINBOOL erase )
|
||||
{
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return FALSE;
|
||||
|
||||
if (rect)
|
||||
{
|
||||
if (wndPtr->hrgnUpdate > 1)
|
||||
{
|
||||
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR) return FALSE;
|
||||
GetRgnBox( hrgn, rect );
|
||||
DeleteObject( hrgn );
|
||||
}
|
||||
else SetRectEmpty( rect );
|
||||
}
|
||||
return ((UINT)wndPtr->hrgnUpdate > 1);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRgn (USER32.298)
|
||||
*/
|
||||
INT STDCALL GetUpdateRgn( HWND hwnd, HRGN hrgn, WINBOOL erase )
|
||||
{
|
||||
INT retval;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return ERROR;
|
||||
|
||||
if ((UINT)wndPtr->hrgnUpdate <= 1)
|
||||
{
|
||||
SetRectRgn( hrgn, 0, 0, 0, 0 );
|
||||
return NULLREGION;
|
||||
}
|
||||
retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY );
|
||||
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExcludeUpdateRgn (USER32.195)
|
||||
*/
|
||||
INT STDCALL ExcludeUpdateRgn( HDC hdc, HWND hwnd )
|
||||
{
|
||||
RECT rect;
|
||||
WND * wndPtr;
|
||||
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return ERROR;
|
||||
|
||||
if (wndPtr->hrgnUpdate)
|
||||
{
|
||||
INT ret;
|
||||
HRGN hrgn = CreateRectRgn(wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top,
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
if( wndPtr->hrgnUpdate > 1 )
|
||||
CombineRgn(hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY);
|
||||
|
||||
/* do ugly coordinate translations in dce.c */
|
||||
|
||||
ret = DCE_ExcludeRgn( hdc, wndPtr, hrgn );
|
||||
DeleteObject( hrgn );
|
||||
return ret;
|
||||
}
|
||||
return GetClipBox( hdc, &rect );
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/winproc.h>
|
||||
#include <user32/nc.h>
|
||||
//#include <user32/defwnd.h>
|
||||
|
||||
//#include <user32/heapdup.h>
|
||||
|
||||
#define MDICREATESTRUCTA MDICREATESTRUCT
|
||||
|
@ -104,25 +107,132 @@ LRESULT WINAPI CallWindowProcW(
|
|||
*/
|
||||
|
||||
|
||||
//FIXME DefWindowProcW should be fundamental
|
||||
|
||||
LRESULT WINAPI DefWindowProcA(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
/***********************************************************************
|
||||
* DefWindowProcA [USER32.126]
|
||||
*
|
||||
*/
|
||||
LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
return 0;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
LRESULT result = 0;
|
||||
|
||||
if (!wndPtr) return 0;
|
||||
// SPY_EnterMessage( SPY_DEFWNDPROC, hwnd, msg, wParam, lParam );
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
|
||||
if (cs->lpszName) DEFWND_SetTextA( wndPtr, cs->lpszName );
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCCALCSIZE:
|
||||
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
result = WINPOS_HandleWindowPosChanging( wndPtr,
|
||||
(WINDOWPOS *)lParam );
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
WINDOWPOS * winPos = (WINDOWPOS *)lParam;
|
||||
DEFWND_HandleWindowPosChanged( wndPtr, winPos->flags );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_GETTEXT:
|
||||
if (wParam && wndPtr->text)
|
||||
{
|
||||
lstrcpynA( (LPSTR)lParam, wndPtr->text, wParam );
|
||||
result = (LRESULT)lstrlenA( (LPSTR)lParam );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETTEXT:
|
||||
DEFWND_SetTextA( wndPtr, (LPSTR)lParam );
|
||||
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
|
||||
break;
|
||||
|
||||
default:
|
||||
result = DEFWND_DefWinProc( wndPtr, msg, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
|
||||
// SPY_ExitMessage( SPY_RESULT_DEFWND, hwnd, msg, result );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
LRESULT WINAPI DefWindowProcW(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
/***********************************************************************
|
||||
* DefWindowProcW [USER32.127] Calls default window message handler
|
||||
*
|
||||
* Calls default window procedure for messages not processed
|
||||
* by application.
|
||||
*
|
||||
* RETURNS
|
||||
* Return value is dependent upon the message.
|
||||
*/
|
||||
LRESULT WINAPI DefWindowProcW( HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
return 0;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
LRESULT result = 0;
|
||||
|
||||
if (!wndPtr) return 0;
|
||||
// SPY_EnterMessage( SPY_DEFWNDPROC, hwnd, msg, wParam, lParam );
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
|
||||
if (cs->lpszName) DEFWND_SetTextW( wndPtr, cs->lpszName );
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCCALCSIZE:
|
||||
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
result = WINPOS_HandleWindowPosChanging( wndPtr,
|
||||
(WINDOWPOS *)lParam );
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
WINDOWPOS * winPos = (WINDOWPOS *)lParam;
|
||||
DEFWND_HandleWindowPosChanged( wndPtr, winPos->flags );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_GETTEXT:
|
||||
if (wParam && wndPtr->text)
|
||||
{
|
||||
lstrcpynW( (LPWSTR)lParam, wndPtr->text, wParam );
|
||||
result = (LRESULT)lstrlenW( (LPWSTR)lParam );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETTEXT:
|
||||
DEFWND_SetTextW( wndPtr, (LPSTR)lParam );
|
||||
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
|
||||
break;
|
||||
|
||||
default:
|
||||
result = DEFWND_DefWinProc( wndPtr, msg, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
|
||||
// SPY_ExitMessage( SPY_RESULT_DEFWND, hwnd, msg, result );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
Loading…
Reference in a new issue