no message

svn path=/trunk/; revision=586
This commit is contained in:
Boudewijn Dekker 1999-07-11 14:19:14 +00:00
parent 6ef820374f
commit 581f2c7495
26 changed files with 4210 additions and 158 deletions

View file

@ -1,5 +1,6 @@
#ifndef DEBUG_H
#define DEBUG_H
#include <stdio.h>
#define DPRINT printf
//#define DPRINT printf
#define DPRINT(args...)
#endif

View file

@ -7,5 +7,5 @@ int lpstrncpyA( LPSTR ptr1,LPSTR ptr2, int nMaxCount);
int lpstrncpyW( LPWSTR ptr1,LPWSTR ptr2, int nMaxCount);
LPVOID HEAP_strdupAtoW(HANDLE hHeap,DWORD dwFlags, LPCSTR lpszAsciiString );
LPVOID HEAP_strdupWtoA(HANDLE hHeap,DWORD dwFlags, LPCWSTR lpszUnicodeString );
LPSTR HEAP_strdupA(LPSTR ptr);
LPWSTR HEAP_strdupW(LPWSTR ptr);
LPSTR HEAP_strdupA(HANDLE hHeap,DWORD dwFlags, LPCSTR ptr);
LPWSTR HEAP_strdupW(HANDLE hHeap,DWORD dwFlags, LPCWSTR ptr);

View file

@ -0,0 +1,22 @@
#include <user32/win.h>
#include <user32/queue.h>
#include <user32/debug.h>
#define DCX_DCEEMPTY 0x00000800
#define DCX_DCEBUSY 0x00001000
#define DCX_DCEDIRTY 0x00002000
#define DCX_WINDOWPAINT 0x00020000
#define DCX_KEEPCLIPRGN 0x00040000
#define DCX_NOCLIPCHILDREN 0x00080000
#define DCX_USESTYLE 0x00010000
WINBOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags, UINT control );

View file

@ -73,7 +73,7 @@ typedef struct tagWND
HINSTANCE hInstance; /* Window hInstance (from CreateWindow) */
RECT rectClient; /* Client area rel. to parent client area */
RECT rectWindow; /* Whole window rel. to parent client area */
LPWSTR text; /* Window text */
void *text; /* Window text */
void *pVScroll; /* Vertical scroll-bar info */
void *pHScroll; /* Horizontal scroll-bar info */
void *pProp; /* Pointer to properties list */
@ -197,7 +197,8 @@ typedef struct
/* Window functions */
HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM atomName );
WND* WIN_FindWndPtr( HWND hwnd );
#define WIN_FindWndPtr(hwnd) (WND *)hwnd
//WND* WIN_FindWndPtr( HWND hwnd );
WND* WIN_GetDesktop(void);
void WIN_DumpWindow( HWND hwnd );
void WIN_WalkWindows( HWND hwnd, int indent );

View file

@ -81,4 +81,13 @@ LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt,
LPRECT restoreRect );
WINBOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl,
UINT flags );
void WINPOS_MoveWindowZOrder( HWND hwnd, HWND hwndAfter );
UINT WINPOS_SizeMoveClean( WND* Wnd, HRGN oldVisRgn,
LPRECT lpOldWndRect,
LPRECT lpOldClientRect, UINT uFlags );
HWND WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter,WND* wndPtr,WORD flags);
#endif /* __WINE_WINPOS_H */

View file

@ -1,8 +1,15 @@
#include <windows.h>
#include <user32/debug.h>
WINBOOL STDCALL DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
{
DPRINT("graphics %04x %d,%d-%d,%d %04x %04x\n",
hdc, rc->left, rc->top, rc->right, rc->bottom, edge, flags );
if(flags & BF_DIAGONAL)
return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
else
return UITOOLS95_DrawRectEdge(hdc, rc, edge, flags);
}
WINBOOL DrawIcon(HDC hDC, int xLeft, int yTop, HICON hIcon
)

View file

@ -0,0 +1,66 @@
#include <windows.h>
HICON
STDCALL
CreateIcon(
HINSTANCE hInstance,
int nWidth,
int nHeight,
BYTE cPlanes,
BYTE cBitsPixel,
CONST BYTE *lpbANDbits,
CONST BYTE *lpbXORbits)
{
#if 0
ICONINFO IconInfo;
IconInfo.fIcon = TRUE;
IconInfo.hbmMask = NULL;
IconInfo.hbmColor = NULL;
return CreateIconIndirect( &IconInfo );
#endif
}
HICON
STDCALL
CreateIconIndirect(
PICONINFO piconinfo)
{
}
HICON
STDCALL
CopyIcon(
HICON hIcon)
{
}
WINBOOL
STDCALL
GetIconInfo(
HICON hIcon,
PICONINFO piconinfo)
{
}
HICON LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName )
{
return CreateIcon(hInstance, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
0,0,NULL,NULL);
}
HICON LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName )
{
return CreateIcon(hInstance, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
0,0,NULL,NULL);
}

View file

@ -9,18 +9,91 @@
#include <windows.h>
//#include <user32/syscolor.h>
#include <user32/nc.h>
void SYSCOLOR_SetColor( int index, COLORREF color );
void SYSCOLOR_Init(void);
static const char * const DefSysColors[] =
{
"Scrollbar", "224 224 224", /* COLOR_SCROLLBAR */
"Background", "192 192 192", /* COLOR_BACKGROUND */
"ActiveTitle", "0 64 128", /* COLOR_ACTIVECAPTION */
"InactiveTitle", "255 255 255", /* COLOR_INACTIVECAPTION */
"Menu", "255 255 255", /* COLOR_MENU */
"Window", "255 255 255", /* COLOR_WINDOW */
"WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
"MenuText", "0 0 0", /* COLOR_MENUTEXT */
"WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
"TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
"ActiveBorder", "128 128 128", /* COLOR_ACTIVEBORDER */
"InactiveBorder", "255 255 255", /* COLOR_INACTIVEBORDER */
"AppWorkspace", "255 255 232", /* COLOR_APPWORKSPACE */
"Hilight", "224 224 224", /* COLOR_HIGHLIGHT */
"HilightText", "0 0 0", /* COLOR_HIGHLIGHTTEXT */
"ButtonFace", "192 192 192", /* COLOR_BTNFACE */
"ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
"GrayText", "192 192 192", /* COLOR_GRAYTEXT */
"ButtonText", "0 0 0", /* COLOR_BTNTEXT */
"InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */
"ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
"3DDarkShadow", "32 32 32", /* COLOR_3DDKSHADOW */
"3DLight", "192 192 192", /* COLOR_3DLIGHT */
"InfoText", "0 0 0", /* COLOR_INFOTEXT */
"InfoBackground", "255 255 192", /* COLOR_INFOBK */
"AlternateButtonFace", "184 180 184", /* COLOR_ALTERNATEBTNFACE */
"HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
"GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
"GradientInactiveTitle", "184 180 184" /* COLOR_GRADIENTINACTIVECAPTION */
};
static const char * const DefSysColors95[] =
{
"Scrollbar", "223 223 223", /* COLOR_SCROLLBAR */
"Background", "192 192 192", /* COLOR_BACKGROUND */
"ActiveTitle", "0 0 128", /* COLOR_ACTIVECAPTION */
"InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
"Menu", "192 192 192", /* COLOR_MENU */
"Window", "255 255 255", /* COLOR_WINDOW */
"WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
"MenuText", "0 0 0", /* COLOR_MENUTEXT */
"WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
"TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
"ActiveBorder", "192 192 192", /* COLOR_ACTIVEBORDER */
"InactiveBorder", "192 192 192", /* COLOR_INACTIVEBORDER */
"AppWorkspace", "128 128 128", /* COLOR_APPWORKSPACE */
"Hilight", "0 0 128", /* COLOR_HIGHLIGHT */
"HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
"ButtonFace", "192 192 192", /* COLOR_BTNFACE */
"ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
"GrayText", "192 192 192", /* COLOR_GRAYTEXT */
"ButtonText", "0 0 0", /* COLOR_BTNTEXT */
"InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */
"ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
"3DDarkShadow", "0 0 0", /* COLOR_3DDKSHADOW */
"3DLight", "223 223 223", /* COLOR_3DLIGHT */
"InfoText", "0 0 0", /* COLOR_INFOTEXT */
"InfoBackground", "255 255 192", /* COLOR_INFOBK */
"AlternateButtonFace", "184 180 184", /* COLOR_ALTERNATEBTNFACE */
"HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
"GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
"GradientInactiveTitle", "184 180 184" /* COLOR_GRADIENTINACTIVECAPTION */
};
//#define NUM_SYS_COLORS (COLOR_GRADIENTINACTIVECAPTION+1)
#define NUM_SYS_COLORS 100
#define NUM_SYS_COLORS 29
static COLORREF SysColors[NUM_SYS_COLORS];
static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
static HPEN SysColorPens[NUM_SYS_COLORS];
static char bSysColorInit = FALSE;
DWORD STDCALL GetSysColor( INT nIndex )
{
if ( bSysColorInit == FALSE )
SYSCOLOR_Init();
if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
return SysColors[nIndex];
else
@ -29,7 +102,6 @@ DWORD STDCALL GetSysColor( INT nIndex )
/*************************************************************************
* SetSysColors (USER.505)
*/
@ -38,6 +110,8 @@ WINBOOL STDCALL SetSysColors( INT nChanges, const INT *lpSysColor,
{
int i;
if ( bSysColorInit == FALSE )
SYSCOLOR_Init();
for (i = 0; i < nChanges; i++)
{
SYSCOLOR_SetColor( lpSysColor[i], lpColorValues[i] );
@ -57,6 +131,8 @@ WINBOOL STDCALL SetSysColors( INT nChanges, const INT *lpSysColor,
HBRUSH STDCALL GetSysColorBrush( INT index )
{
if ( bSysColorInit == FALSE )
SYSCOLOR_Init();
if (0 <= index && index < NUM_SYS_COLORS)
return SysColorBrushes[index];
@ -66,6 +142,44 @@ HBRUSH STDCALL GetSysColorBrush( INT index )
/////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************
* GetSysColorPen (Not a Windows API)
*
* This function is new to the Wine lib -- it does not exist in
* Windows. However, it is a natural complement for GetSysColorBrush
* in the Win API and is needed quite a bit inside Wine.
*/
HPEN STDCALL GetSysColorPen( INT index )
{
/* We can assert here, because this function is internal to Wine */
//assert (0 <= index && index < NUM_SYS_COLORS);
if ( bSysColorInit == FALSE )
SYSCOLOR_Init();
return SysColorPens[index];
}
/*************************************************************************
* SYSCOLOR_Init
*/
void SYSCOLOR_Init(void)
{
int i, r, g, b;
const char * const *p;
char buffer[100];
p = (TWEAK_WineLook == WIN31_LOOK) ? DefSysColors : DefSysColors95;
for (i = 0; i < NUM_SYS_COLORS; i++, p += 2)
{
// GetProfileString32A( "colors", p[0], p[1], buffer, 100 );
if (sscanf( p[1], " %d %d %d", &r, &g, &b ) != 3) r = g = b = 0;
SYSCOLOR_SetColor( i, RGB(r,g,b) );
}
bSysColorInit = TRUE;
}
void SYSCOLOR_SetColor( int index, COLORREF color )
{
if (index < 0 || index >= NUM_SYS_COLORS) return;
@ -78,18 +192,4 @@ void SYSCOLOR_SetColor( int index, COLORREF color )
/***********************************************************************
* GetSysColorPen (Not a Windows API)
*
* This function is new to the Wine lib -- it does not exist in
* Windows. However, it is a natural complement for GetSysColorBrush
* in the Win API and is needed quite a bit inside Wine.
*/
HPEN STDCALL GetSysColorPen( INT index )
{
/* We can assert here, because this function is internal to Wine */
//assert (0 <= index && index < NUM_SYS_COLORS);
return SysColorPens[index];
}

View file

@ -10,7 +10,7 @@ DrawTextA(
DRAWTEXTPARAMS dtp;
dtp.cbSize = sizeof(DRAWTEXTPARAMS);
dtp.iTabLength = 0;
//return TEXT_DrawTextEx(hDC,(void *)lpString, nCount,lpRect,uFormat, &dtp, FALSE);
return TEXT_DrawTextEx(hDC,(void *)lpString, nCount,lpRect,uFormat, &dtp, FALSE);
}

View file

@ -0,0 +1,905 @@
/*
* Dialog functions
*
* Copyright 1993, 1994, 1996 Alexandre Julliard
*/
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "dialog.h"
#include "drive.h"
#include "heap.h"
#include "win.h"
#include "ldt.h"
#include "user.h"
#include "winproc.h"
#include "message.h"
#include "sysmetrics.h"
#include "debug.h"
/* Dialog control information */
typedef struct
{
DWORD style;
DWORD exStyle;
DWORD helpId;
INT16 x;
INT16 y;
INT16 cx;
INT16 cy;
UINT32 id;
LPCSTR className;
LPCSTR windowName;
LPVOID data;
} DLG_CONTROL_INFO;
/* Dialog template */
typedef struct
{
DWORD style;
DWORD exStyle;
DWORD helpId;
UINT16 nbItems;
INT16 x;
INT16 y;
INT16 cx;
INT16 cy;
LPCSTR menuName;
LPCSTR className;
LPCSTR caption;
WORD pointSize;
WORD weight;
WINBOOL italic;
LPCSTR faceName;
WINBOOL dialogEx;
} DLG_TEMPLATE;
/* Dialog base units */
static WORD xBaseUnit = 0, yBaseUnit = 0;
/***********************************************************************
* DIALOG_Init
*
* Initialisation of the dialog manager.
*/
WINBOOL DIALOG_Init(void)
{
TEXTMETRIC16 tm;
HDC16 hdc;
/* Calculate the dialog base units */
if (!(hdc = CreateDC16( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
GetTextMetrics16( hdc, &tm );
DeleteDC32( hdc );
xBaseUnit = tm.tmAveCharWidth;
yBaseUnit = tm.tmHeight;
/* Dialog units are based on a proportional system font */
/* so we adjust them a bit for a fixed font. */
if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
xBaseUnit = xBaseUnit * 5 / 4;
TRACE(dialog, "base units = %d,%d\n",
xBaseUnit, yBaseUnit );
return TRUE;
}
/***********************************************************************
* DIALOG_GetControl16
*
* Return the class and text of the control pointed to by ptr,
* fill the header structure and return a pointer to the next control.
*/
static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
{
static char buffer[10];
int int_id;
info->x = GET_WORD(p); p += sizeof(WORD);
info->y = GET_WORD(p); p += sizeof(WORD);
info->cx = GET_WORD(p); p += sizeof(WORD);
info->cy = GET_WORD(p); p += sizeof(WORD);
info->id = GET_WORD(p); p += sizeof(WORD);
info->style = GET_DWORD(p); p += sizeof(DWORD);
info->exStyle = 0;
if (*p & 0x80)
{
switch((BYTE)*p)
{
case 0x80: strcpy( buffer, "BUTTON" ); break;
case 0x81: strcpy( buffer, "EDIT" ); break;
case 0x82: strcpy( buffer, "STATIC" ); break;
case 0x83: strcpy( buffer, "LISTBOX" ); break;
case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
case 0x85: strcpy( buffer, "COMBOBOX" ); break;
default: buffer[0] = '\0'; break;
}
info->className = buffer;
p++;
}
else
{
info->className = p;
p += strlen(p) + 1;
}
int_id = ((BYTE)*p == 0xff);
if (int_id)
{
/* Integer id, not documented (?). Only works for SS_ICON controls */
info->windowName = (LPCSTR)(UINT32)GET_WORD(p+1);
p += 3;
}
else
{
info->windowName = p;
p += strlen(p) + 1;
}
info->data = (LPVOID)(*p ? p + 1 : NULL); /* FIXME: should be a segptr */
p += *p + 1;
if(int_id)
TRACE(dialog," %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
info->className, LOWORD(info->windowName),
info->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)info->data);
else
TRACE(dialog," %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
info->className, info->windowName,
info->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)info->data);
return p;
}
/***********************************************************************
* DIALOG_GetControl32
*
* Return the class and text of the control pointed to by ptr,
* fill the header structure and return a pointer to the next control.
*/
static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
WINBOOL dialogEx )
{
if (dialogEx)
{
info->helpId = GET_DWORD(p); p += 2;
info->exStyle = GET_DWORD(p); p += 2;
info->style = GET_DWORD(p); p += 2;
}
else
{
info->helpId = 0;
info->style = GET_DWORD(p); p += 2;
info->exStyle = GET_DWORD(p); p += 2;
}
info->x = GET_WORD(p); p++;
info->y = GET_WORD(p); p++;
info->cx = GET_WORD(p); p++;
info->cy = GET_WORD(p); p++;
if (dialogEx)
{
/* id is a DWORD for DIALOGEX */
info->id = GET_DWORD(p);
p += 2;
}
else
{
info->id = GET_WORD(p);
p++;
}
if (GET_WORD(p) == 0xffff)
{
static const WCHAR class_names[6][10] =
{
{ 'B','u','t','t','o','n', }, /* 0x80 */
{ 'E','d','i','t', }, /* 0x81 */
{ 'S','t','a','t','i','c', }, /* 0x82 */
{ 'L','i','s','t','B','o','x', }, /* 0x83 */
{ 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
{ 'C','o','m','b','o','B','o','x', } /* 0x85 */
};
WORD id = GET_WORD(p+1);
if ((id >= 0x80) && (id <= 0x85))
info->className = (LPCSTR)class_names[id - 0x80];
else
{
info->className = NULL;
ERR( dialog, "Unknown built-in class id %04x\n", id );
}
p += 2;
}
else
{
info->className = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
}
if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
{
info->windowName = (LPCSTR)(UINT32)GET_WORD(p + 1);
p += 2;
}
else
{
info->windowName = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
}
TRACE(dialog," %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
debugstr_w( (LPCWSTR)info->className ),
debugres_w( (LPCWSTR)info->windowName ),
info->id, info->x, info->y, info->cx, info->cy,
info->style, info->exStyle, info->helpId );
if (GET_WORD(p))
{
if (TRACE_ON(dialog))
{
WORD i, count = GET_WORD(p) / sizeof(WORD);
TRACE(dialog, " BEGIN\n");
TRACE(dialog, " ");
for (i = 0; i < count; i++) DUMP( "%04x,", GET_WORD(p+i+1) );
DUMP("\n");
TRACE(dialog, " END\n" );
}
info->data = (LPVOID)(p + 1);
p += GET_WORD(p) / sizeof(WORD);
}
else info->data = NULL;
p++;
/* Next control is on dword boundary */
return (const WORD *)((((int)p) + 3) & ~3);
}
/***********************************************************************
* DIALOG_CreateControls
*
* Create the control windows for a dialog.
*/
static WINBOOL DIALOG_CreateControls( WND *pWnd, LPCSTR template,
const DLG_TEMPLATE *dlgTemplate,
HINSTANCE32 hInst, WINBOOL win32 )
{
DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
DLG_CONTROL_INFO info;
HWND32 hwndCtrl, hwndDefButton = 0;
INT32 items = dlgTemplate->nbItems;
TRACE(dialog, " BEGIN\n" );
while (items--)
{
if (!win32)
{
HINSTANCE16 instance;
template = DIALOG_GetControl16( template, &info );
if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
((pWnd->dwStyle & DS_LOCALEDIT) != DS_LOCALEDIT))
{
if (!dlgInfo->hDialogHeap)
{
dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
if (!dlgInfo->hDialogHeap)
{
ERR(dialog, "Insufficient memory to create heap for edit control\n" );
continue;
}
LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
}
instance = dlgInfo->hDialogHeap;
}
else instance = (HINSTANCE16)hInst;
hwndCtrl = CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
info.className, info.windowName,
info.style | WS_CHILD,
info.x * dlgInfo->xBaseUnit / 4,
info.y * dlgInfo->yBaseUnit / 8,
info.cx * dlgInfo->xBaseUnit / 4,
info.cy * dlgInfo->yBaseUnit / 8,
pWnd->hwndSelf, (HMENU16)info.id,
instance, info.data );
}
else
{
template = (LPCSTR)DIALOG_GetControl32( (WORD *)template, &info,
dlgTemplate->dialogEx );
hwndCtrl = CreateWindowEx32W( info.exStyle | WS_EX_NOPARENTNOTIFY,
(LPCWSTR)info.className,
(LPCWSTR)info.windowName,
info.style | WS_CHILD,
info.x * dlgInfo->xBaseUnit / 4,
info.y * dlgInfo->yBaseUnit / 8,
info.cx * dlgInfo->xBaseUnit / 4,
info.cy * dlgInfo->yBaseUnit / 8,
pWnd->hwndSelf, (HMENU32)info.id,
hInst, info.data );
}
if (!hwndCtrl) return FALSE;
/* Send initialisation messages to the control */
if (dlgInfo->hUserFont) SendMessage32A( hwndCtrl, WM_SETFONT,
(WPARAM32)dlgInfo->hUserFont, 0 );
if (SendMessage32A(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
{
/* If there's already a default push-button, set it back */
/* to normal and use this one instead. */
if (hwndDefButton)
SendMessage32A( hwndDefButton, BM_SETSTYLE32,
BS_PUSHBUTTON,FALSE );
hwndDefButton = hwndCtrl;
dlgInfo->idResult = GetWindowWord32( hwndCtrl, GWW_ID );
}
}
TRACE(dialog, " END\n" );
return TRUE;
}
/***********************************************************************
* DIALOG_ParseTemplate16
*
* Fill a DLG_TEMPLATE structure from the dialog template, and return
* a pointer to the first control.
*/
static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
{
result->style = GET_DWORD(p); p += sizeof(DWORD);
result->exStyle = 0;
result->nbItems = *p++;
result->x = GET_WORD(p); p += sizeof(WORD);
result->y = GET_WORD(p); p += sizeof(WORD);
result->cx = GET_WORD(p); p += sizeof(WORD);
result->cy = GET_WORD(p); p += sizeof(WORD);
TRACE(dialog, "DIALOG %d, %d, %d, %d\n",
result->x, result->y, result->cx, result->cy );
TRACE(dialog, " STYLE %08lx\n", result->style );
/* Get the menu name */
switch( (BYTE)*p )
{
case 0:
result->menuName = 0;
p++;
break;
case 0xff:
result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
p += 3;
TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
break;
default:
result->menuName = p;
TRACE(dialog, " MENU '%s'\n", p );
p += strlen(p) + 1;
break;
}
/* Get the class name */
if (*p)
{
result->className = p;
TRACE(dialog, " CLASS '%s'\n", result->className );
}
else result->className = DIALOG_CLASS_ATOM;
p += strlen(p) + 1;
/* Get the window caption */
result->caption = p;
p += strlen(p) + 1;
TRACE(dialog, " CAPTION '%s'\n", result->caption );
/* Get the font name */
if (result->style & DS_SETFONT)
{
result->pointSize = GET_WORD(p);
p += sizeof(WORD);
result->faceName = p;
p += strlen(p) + 1;
TRACE(dialog, " FONT %d,'%s'\n",
result->pointSize, result->faceName );
}
return p;
}
/***********************************************************************
* DIALOG_ParseTemplate32
*
* Fill a DLG_TEMPLATE structure from the dialog template, and return
* a pointer to the first control.
*/
static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
{
const WORD *p = (const WORD *)template;
result->style = GET_DWORD(p); p += 2;
if (result->style == 0xffff0001) /* DIALOGEX resource */
{
result->dialogEx = TRUE;
result->helpId = GET_DWORD(p); p += 2;
result->exStyle = GET_DWORD(p); p += 2;
result->style = GET_DWORD(p); p += 2;
}
else
{
result->dialogEx = FALSE;
result->helpId = 0;
result->exStyle = GET_DWORD(p); p += 2;
}
result->nbItems = GET_WORD(p); p++;
result->x = GET_WORD(p); p++;
result->y = GET_WORD(p); p++;
result->cx = GET_WORD(p); p++;
result->cy = GET_WORD(p); p++;
TRACE( dialog, "DIALOG%s %d, %d, %d, %d, %ld\n",
result->dialogEx ? "EX" : "", result->x, result->y,
result->cx, result->cy, result->helpId );
TRACE( dialog, " STYLE 0x%08lx\n", result->style );
TRACE( dialog, " EXSTYLE 0x%08lx\n", result->exStyle );
/* Get the menu name */
switch(GET_WORD(p))
{
case 0x0000:
result->menuName = NULL;
p++;
break;
case 0xffff:
result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
p += 2;
TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
break;
default:
result->menuName = (LPCSTR)p;
TRACE(dialog, " MENU %s\n", debugstr_w( (LPCWSTR)p ));
p += lstrlen32W( (LPCWSTR)p ) + 1;
break;
}
/* Get the class name */
switch(GET_WORD(p))
{
case 0x0000:
result->className = DIALOG_CLASS_ATOM;
p++;
break;
case 0xffff:
result->className = (LPCSTR)(UINT32)GET_WORD( p + 1 );
p += 2;
TRACE(dialog, " CLASS %04x\n", LOWORD(result->className) );
break;
default:
result->className = (LPCSTR)p;
TRACE(dialog, " CLASS %s\n", debugstr_w( (LPCWSTR)p ));
p += lstrlen32W( (LPCWSTR)p ) + 1;
break;
}
/* Get the window caption */
result->caption = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
TRACE(dialog, " CAPTION %s\n", debugstr_w( (LPCWSTR)result->caption ) );
/* Get the font name */
if (result->style & DS_SETFONT)
{
result->pointSize = GET_WORD(p);
p++;
if (result->dialogEx)
{
result->weight = GET_WORD(p); p++;
result->italic = LOBYTE(GET_WORD(p)); p++;
}
else
{
result->weight = FW_DONTCARE;
result->italic = FALSE;
}
result->faceName = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
TRACE(dialog, " FONT %d, %s, %d, %s\n",
result->pointSize, debugstr_w( (LPCWSTR)result->faceName ),
result->weight, result->italic ? "TRUE" : "FALSE" );
}
/* First control is on dword boundary */
return (LPCSTR)((((int)p) + 3) & ~3);
}
/***********************************************************************
* DIALOG_CreateIndirect
*/
HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
WINBOOL win32Template, HWND32 owner,
DLGPROC16 dlgProc, LPARAM param,
WINDOWPROCTYPE procType )
{
HMENU16 hMenu = 0;
HFONT16 hFont = 0;
HWND32 hwnd;
RECT32 rect;
WND * wndPtr;
DLG_TEMPLATE template;
DIALOGINFO * dlgInfo;
WORD xUnit = xBaseUnit;
WORD yUnit = yBaseUnit;
/* Parse dialog template */
if (!dlgTemplate) return 0;
if (win32Template)
dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
else
dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
/* Load menu */
if (template.menuName)
{
if (!win32Template)
{
LPSTR str = SEGPTR_STRDUP( template.menuName );
hMenu = LoadMenu16( hInst, SEGPTR_GET(str) );
SEGPTR_FREE( str );
}
else hMenu = LoadMenu32W( hInst, (LPCWSTR)template.menuName );
}
/* Create custom font if needed */
if (template.style & DS_SETFONT)
{
/* The font height must be negative as it is a point size */
/* (see CreateFont() documentation in the Windows SDK). */
if (win32Template)
hFont = CreateFont32W( -template.pointSize, 0, 0, 0,
template.weight, template.italic, FALSE,
FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY,
FF_DONTCARE, (LPCWSTR)template.faceName );
else
hFont = CreateFont16( -template.pointSize, 0, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
PROOF_QUALITY, FF_DONTCARE,
template.faceName );
if (hFont)
{
TEXTMETRIC16 tm;
HFONT16 oldFont;
HDC32 hdc = GetDC32(0);
oldFont = SelectObject32( hdc, hFont );
GetTextMetrics16( hdc, &tm );
SelectObject32( hdc, oldFont );
ReleaseDC32( 0, hdc );
xUnit = tm.tmAveCharWidth;
yUnit = tm.tmHeight;
if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
xBaseUnit = xBaseUnit * 5 / 4; /* See DIALOG_Init() */
}
}
/* Create dialog main window */
rect.left = rect.top = 0;
rect.right = template.cx * xUnit / 4;
rect.bottom = template.cy * yUnit / 8;
if (template.style & DS_MODALFRAME)
template.exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx32( &rect, template.style,
hMenu ? TRUE : FALSE , template.exStyle );
rect.right -= rect.left;
rect.bottom -= rect.top;
if ((INT16)template.x == CW_USEDEFAULT16)
{
rect.left = rect.top = (procType == WIN_PROC_16) ? CW_USEDEFAULT16
: CW_USEDEFAULT32;
}
else
{
if (template.style & DS_CENTER)
{
rect.left = (SYSMETRICS_CXSCREEN - rect.right) / 2;
rect.top = (SYSMETRICS_CYSCREEN - rect.bottom) / 2;
}
else
{
rect.left += template.x * xUnit / 4;
rect.top += template.y * yUnit / 8;
}
if ( !(template.style & WS_CHILD) )
{
INT16 dX, dY;
if( !(template.style & DS_ABSALIGN) )
ClientToScreen32( owner, (POINT32 *)&rect );
/* try to fit it into the desktop */
if( (dX = rect.left + rect.right + SYSMETRICS_CXDLGFRAME
- SYSMETRICS_CXSCREEN) > 0 ) rect.left -= dX;
if( (dY = rect.top + rect.bottom + SYSMETRICS_CYDLGFRAME
- SYSMETRICS_CYSCREEN) > 0 ) rect.top -= dY;
if( rect.left < 0 ) rect.left = 0;
if( rect.top < 0 ) rect.top = 0;
}
}
if (procType == WIN_PROC_16)
hwnd = CreateWindowEx16(template.exStyle, template.className,
template.caption, template.style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom,
owner, hMenu, hInst, NULL );
else
hwnd = CreateWindowEx32W(template.exStyle, (LPCWSTR)template.className,
(LPCWSTR)template.caption,
template.style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom,
owner, hMenu, hInst, NULL );
if (!hwnd)
{
if (hFont) DeleteObject32( hFont );
if (hMenu) DestroyMenu32( hMenu );
return 0;
}
wndPtr = WIN_FindWndPtr( hwnd );
wndPtr->flags |= WIN_ISDIALOG;
wndPtr->helpContext = template.helpId;
/* Initialise dialog extra data */
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
WINPROC_SetProc( &dlgInfo->dlgProc, dlgProc, procType, WIN_PROC_WINDOW );
dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
dlgInfo->msgResult = 0;
dlgInfo->idResult = 0;
dlgInfo->flags = 0;
dlgInfo->hDialogHeap = 0;
if (dlgInfo->hUserFont)
SendMessage32A( hwnd, WM_SETFONT, (WPARAM32)dlgInfo->hUserFont, 0 );
/* Create controls */
if (DIALOG_CreateControls( wndPtr, dlgTemplate, &template,
hInst, win32Template ))
{
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
if (SendMessage32A( hwnd, WM_INITDIALOG, (WPARAM32)dlgInfo->hwndFocus, param ))
SetFocus32( dlgInfo->hwndFocus );
if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
{
ShowWindow32( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
UpdateWindow32( hwnd );
}
return hwnd;
}
if( IsWindow32(hwnd) ) DestroyWindow32( hwnd );
return 0;
}
/**********************************************************************
* DIALOG_DlgDirSelect
*
* Helper function for DlgDirSelect*
*/
static WINBOOL DIALOG_DlgDirSelect( HWND32 hwnd, LPSTR str, INT32 len,
INT32 id, WINBOOL win32, WINBOOL unicode,
WINBOOL combo )
{
char *buffer, *ptr;
INT32 item, size;
WINBOOL ret;
HWND32 listbox = GetDlgItem32( hwnd, id );
TRACE(dialog, "%04x '%s' %d\n", hwnd, str, id );
if (!listbox) return FALSE;
if (win32)
{
item = SendMessage32A(listbox, combo ? CB_GETCURSEL32
: LB_GETCURSEL32, 0, 0 );
if (item == LB_ERR) return FALSE;
size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN32
: LB_GETTEXTLEN32, 0, 0 );
if (size == LB_ERR) return FALSE;
}
else
{
item = SendMessage32A(listbox, combo ? CB_GETCURSEL16
: LB_GETCURSEL16, 0, 0 );
if (item == LB_ERR) return FALSE;
size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN16
: LB_GETTEXTLEN16, 0, 0 );
if (size == LB_ERR) return FALSE;
}
if (!(buffer = SEGPTR_ALLOC( size+1 ))) return FALSE;
if (win32)
SendMessage32A( listbox, combo ? CB_GETLBTEXT32 : LB_GETTEXT32,
item, (LPARAM)buffer );
else
SendMessage16( listbox, combo ? CB_GETLBTEXT16 : LB_GETTEXT16,
item, (LPARAM)SEGPTR_GET(buffer) );
if ((ret = (buffer[0] == '['))) /* drive or directory */
{
if (buffer[1] == '-') /* drive */
{
buffer[3] = ':';
buffer[4] = 0;
ptr = buffer + 2;
}
else
{
buffer[strlen(buffer)-1] = '\\';
ptr = buffer + 1;
}
}
else ptr = buffer;
if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len );
else lstrcpyn32A( str, ptr, len );
SEGPTR_FREE( buffer );
TRACE(dialog, "Returning %d '%s'\n", ret, str );
return ret;
}
/**********************************************************************
* DIALOG_DlgDirList
*
* Helper function for DlgDirList*
*/
static INT32 DIALOG_DlgDirList( HWND32 hDlg, LPSTR spec, INT32 idLBox,
INT32 idStatic, UINT32 attrib, WINBOOL combo )
{
int drive;
HWND32 hwnd;
LPSTR orig_spec = spec;
#define SENDMSG(msg,wparam,lparam) \
((attrib & DDL_POSTMSGS) ? PostMessage32A( hwnd, msg, wparam, lparam ) \
: SendMessage32A( hwnd, msg, wparam, lparam ))
TRACE(dialog, "%04x '%s' %d %d %04x\n",
hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
if (spec && spec[0] && (spec[1] == ':'))
{
drive = toupper( spec[0] ) - 'A';
spec += 2;
if (!DRIVE_SetCurrentDrive( drive )) return FALSE;
}
else drive = DRIVE_GetCurrentDrive();
/* If the path exists and is a directory, chdir to it */
if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
else
{
char *p, *p2;
p = spec;
if ((p2 = strrchr( p, '\\' ))) p = p2;
if ((p2 = strrchr( p, '/' ))) p = p2;
if (p != spec)
{
char sep = *p;
*p = 0;
if (!DRIVE_Chdir( drive, spec ))
{
*p = sep; /* Restore the original spec */
return FALSE;
}
spec = p + 1;
}
}
TRACE(dialog, "path=%c:\\%s mask=%s\n",
'A' + drive, DRIVE_GetDosCwd(drive), spec );
if (idLBox && ((hwnd = GetDlgItem32( hDlg, idLBox )) != 0))
{
SENDMSG( combo ? CB_RESETCONTENT32 : LB_RESETCONTENT32, 0, 0 );
if (attrib & DDL_DIRECTORY)
{
if (!(attrib & DDL_EXCLUSIVE))
{
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
(LPARAM)spec ) == LB_ERR)
return FALSE;
}
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
(attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
(LPARAM)"*.*" ) == LB_ERR)
return FALSE;
}
else
{
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32, attrib,
(LPARAM)spec ) == LB_ERR)
return FALSE;
}
}
if (idStatic && ((hwnd = GetDlgItem32( hDlg, idStatic )) != 0))
{
char temp[512];
int drive = DRIVE_GetCurrentDrive();
strcpy( temp, "A:\\" );
temp[0] += drive;
lstrcpyn32A( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
CharLower32A( temp );
/* Can't use PostMessage() here, because the string is on the stack */
SetDlgItemText32A( hDlg, idStatic, temp );
}
if (orig_spec && (spec != orig_spec))
{
/* Update the original file spec */
char *p = spec;
while ((*orig_spec++ = *p++));
}
return TRUE;
#undef SENDMSG
}
/**********************************************************************
* DIALOG_DlgDirListW
*
* Helper function for DlgDirList*32W
*/
static INT32 DIALOG_DlgDirListW( HWND32 hDlg, LPWSTR spec, INT32 idLBox,
INT32 idStatic, UINT32 attrib, WINBOOL combo )
{
if (spec)
{
LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
INT32 ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
attrib, combo );
lstrcpyAtoW( spec, specA );
HeapFree( GetProcessHeap(), 0, specA );
return ret;
}
return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );
}

View file

@ -1093,16 +1093,16 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
// if (TWEAK_WineLook == WIN31_LOOK) {
if (TWEAK_WineLook == WIN31_LOOK) {
SelectObject( hDC,(HGDIOBJ)GetSysColorPen(COLOR_WINDOWFRAME) );
MoveToEx( hDC, lprect->left, lprect->bottom,NULL );
LineTo( hDC, lprect->right, lprect->bottom );
// }
// else {
// SelectObject( hDC,(HGDIOBJ) GetSysColorPen(COLOR_3DFACE));
// MoveToEx( hDC, lprect->left, lprect->bottom,NULL );
// LineTo( hDC, lprect->right, lprect->bottom );
// }
}
else {
SelectObject( hDC,(HGDIOBJ) GetSysColorPen(COLOR_3DFACE));
MoveToEx( hDC, lprect->left, lprect->bottom,NULL );
LineTo( hDC, lprect->right, lprect->bottom );
}
if (lppop->nItems == 0) return SYSMETRICS_CYMENU;
for (i = 0; i < lppop->nItems; i++)

View file

@ -142,6 +142,20 @@ NC_AdjustRectOuter95 (LPRECT rect, DWORD style, WINBOOL menu, DWORD exStyle)
#endif
}
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (exStyle & WS_EX_TOOLWINDOW)
rect->top -= SYSMETRICS_CYSMCAPTION;
else
rect->top -= SYSMETRICS_CYCAPTION;
}
} else {
if (style & WS_BORDER)
InflateRect( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER);
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (exStyle & WS_EX_TOOLWINDOW)
@ -1174,7 +1188,8 @@ static void NC_DrawCaption95(
MoveToEx( hdc, r.left, r.bottom - 1, NULL );
LineTo( hdc, r.right, r.bottom - 1 );
SelectObject( hdc, hPrevPen );
r.bottom--;
r.bottom-2;
FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) );

View file

@ -93,7 +93,8 @@ void QUEUE_WalkQueues(void)
*/
WINBOOL QUEUE_IsExitingQueue( HQUEUE hQueue )
{
return (hExitingQueue && (hQueue == hExitingQueue));
return FALSE;
// return (hExitingQueue && (hQueue == hExitingQueue));
}

File diff suppressed because it is too large Load diff

View file

@ -80,8 +80,7 @@ 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;
@ -135,9 +134,11 @@ HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM classAtom)
/* 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 = NULL;
else wndPtr->dce = DCE_AllocDCE(hWnd,DCE_WINDOW_DC);;
GetStartupInfoW((STARTUPINFO *)&StartupInfo);
if (cs->x == CW_USEDEFAULT)
@ -199,6 +200,8 @@ HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM classAtom)
wndPtr->rectWindow.top = cs->y;
wndPtr->rectWindow.right = cs->x + cs->cx;
wndPtr->rectWindow.bottom = cs->y + cs->cy;
wndPtr->rectClient = wndPtr->rectWindow;
@ -229,12 +232,20 @@ HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM classAtom)
maxPos.x = wndPtr->rectWindow.left;
maxPos.y = wndPtr->rectWindow.top;
if( SendMessageW( hWnd, WM_NCCREATE, 0, (LPARAM)cs) == 0)
{
if ( classPtr->bUnicode == TRUE ) {
if( SendMessageW( hWnd, WM_NCCREATE, 0, (LPARAM)cs) == 0)
{
/* Abort window creation */
WIN_DestroyWindow( wndPtr );
return NULL;
WIN_DestroyWindow( wndPtr );
return NULL;
}
} else {
if( SendMessageA( hWnd, WM_NCCREATE, 0, (LPARAM)cs) == 0)
{
/* Abort window creation */
WIN_DestroyWindow( wndPtr );
return NULL;
}
}
/* Insert the window in the linked list */
@ -245,7 +256,9 @@ HANDLE WIN_CreateWindowEx( CREATESTRUCTW *cs, ATOM classAtom)
NULL, NULL, 0, &wndPtr->rectClient );
OffsetRect(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left,
maxPos.y - wndPtr->rectWindow.top);
if( (SendMessageW( hWnd, WM_CREATE, 0, (LPARAM)cs )) == -1 )
if( (SendMessageA( hWnd, WM_CREATE, 0, (LPARAM)cs )) == -1 )
{
WIN_UnlinkWindow( hWnd );
WIN_DestroyWindow( wndPtr );
@ -636,6 +649,9 @@ WND * WIN_FindWndPtr( HWND hWnd )
#endif
#undef WIN_FindWndPtr
WND* WIN_FindWndPtr( HWND hwnd );
WND * WIN_FindWndPtr( HWND hwnd )
{
WND * ptr;
@ -651,6 +667,7 @@ WND * WIN_FindWndPtr( HWND hwnd )
}
return ptr;
}
WND* WIN_GetDesktop(void)
{
return NULL;
@ -830,13 +847,17 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate)
WINBOOL WIN_IsWindowDrawable( WND* wnd, WINBOOL icon )
{
return TRUE;
if ( wnd == NULL )
return FALSE;
if( (wnd->dwStyle & WS_MINIMIZE &&
icon && wnd->class->hIcon) ||
!(wnd->dwStyle & WS_VISIBLE) ) return FALSE;
for(wnd = wnd->parent; wnd; wnd = wnd->parent)
if( wnd->dwStyle & WS_MINIMIZE ||
!(wnd->dwStyle & WS_VISIBLE) ) break;
return (wnd == NULL);
return wnd == NULL;
}
@ -886,6 +907,9 @@ void WIN_SendDestroyMsg( WND* pWnd )
}
/*******************************************************************
* GetSysModalWindow16 (USER.52)
*/

View file

@ -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/defwnd.o internal/paint.o
internal/text.o internal/defwnd.o internal/paint.o internal/uitools.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
@ -15,14 +15,14 @@ WINDOWS_OBJECTS = windows/wndproc.o windows/win.o windows/hook.o windows/spy.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
graphics/draw.o graphics/icon.o
RESOURCE_OBJECTS = resources/sysres.o
OBJECTS = $(MISC_OBJECTS) $(INTERNAL_OBJECTS) $(GRAPHICS_OBJECTS) $(RESOURCE_OBJECTS) $(WINDOWS_OBJECTS)
user32.exe: $(OBJECTS)
$(LD) $(OBJECTS) F:/gnu/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/crt1.o F:/gnu/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/libgdi32.a F:/gnu/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/libkernel32.a F:/gnu/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/libcrtdll.a -o user32.exe
$(LD) $(OBJECTS) F:/gnu/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/crt1.o ./libgdi32.a ./libkernel32.a ./libcrtdll.a -o user32.exe
dummy:

View file

@ -9,6 +9,9 @@ HBITMAP LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName)
HBITMAP LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
{
return CreateBitmap(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CXSMICON),
1,1, NULL );
return NULL;
// return BITMAP_LoadBitmap32W(hInstance, lpBitmapName, 0);
}
@ -16,6 +19,9 @@ HBITMAP LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
HBITMAP BITMAP_LoadBitmapW(HINSTANCE instance,LPCWSTR name,
UINT loadflags)
{
return CreateBitmap(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CXSMICON),
1,1, NULL );
#if 0
HBITMAP hbitmap = 0;
HDC hdc;

View file

@ -9,16 +9,20 @@ int _CRT_glob = 0;
int __main(int argc, char **argv)
{
return 0;
}
int main(int argc, char **argv)
{
HWND hwnd;
HMENU hmenu;
MSG msg;
WNDCLASSEX wc1;
HINSTANCE hInst = 0;
int nWinMode = SW_SHOWMAXIMIZED;
int nWinMode = SW_SHOW;
RECT rect;
wc1.hInstance = hInst;
wc1.lpszClassName = szName;
@ -38,21 +42,26 @@ int main(int argc, char **argv)
if ( !RegisterClassEx(&wc1)) return 0;
hwnd = CreateWindowEx(0, szName, "test", WS_OVERLAPPEDWINDOW| WS_VISIBLE,
hmenu = CreateMenu();
hwnd = CreateWindowEx(0, szName, "test", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,hInst, NULL);
NULL,hmenu,hInst, NULL);
ShowWindow(hwnd,nWinMode);
UpdateWindow(hwnd);
SendMessageW( hwnd, WM_MOVE, 0,MAKELONG(0,0));
//while(GetMessage(&msg,NULL, 0, 0))
//{
// TranslateMessage(&msg);
// DispatchMessage(&msg);
//}
SetWindowText(hwnd,"Hallo");
DrawMenuBar(hwnd);
// SendMessage( hwnd, WM_MOVE, 0,MAKELONG(0,0));
// SendMessage( hwnd, WM_PAINT, GetWindowDC(hwnd),0);
while(GetMessage(&msg,NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(10000);
return msg.wParam;
}

View file

@ -31,7 +31,7 @@ short sysMetrics[SM_CMETRICS+1] = {
32, // [SM_CYCURSOR] /* 14 */
19, // [SM_CYMENU] /* 15 */
800, // [SM_CXFULLSCREEN] /* 16 */
0, // [SM_CYFULLSCREEN] /* 17 */
600, // [SM_CYFULLSCREEN] /* 17 */
0, // [SM_CYKANJIWINDOW] /* 18 */
0, // [SM_MOUSEPRESENT] /* 19 */
0, // [SM_CYVSCROLL] /* 20 */
@ -42,12 +42,12 @@ short sysMetrics[SM_CMETRICS+1] = {
0, // [SM_RESERVED2] /* 25 */
0, // [SM_RESERVED3] /* 26 */
0, // [SM_RESERVED4] /* 27 */
0, // [SM_CXMIN] /* 28 */
0, // [SM_CYMIN] /* 29 */
0, // [SM_CXSIZE] /* 30 */
0, // [SM_CYSIZE] /* 31 */
0, // [SM_CXFRAME] /* 32 */
0, // [SM_CYFRAME] /* 33 */
112, // [SM_CXMIN] /* 28 */
27, // [SM_CYMIN] /* 29 */
17, // [SM_CXSIZE] /* 30 */
17, // [SM_CYSIZE] /* 31 */
4, // [SM_CXFRAME] /* 32 */
4, // [SM_CYFRAME] /* 33 */
0, // [SM_CXMINTRACK] /* 34 */
0, // [SM_CYMINTRACK] /* 35 */
0, // [SM_CXDOUBLECLK] /* 36 */
@ -63,17 +63,17 @@ short sysMetrics[SM_CMETRICS+1] = {
// [SM_CXFRAME] /* win40 name change */
// [SM_CYFRAME] /* win40 name change */
0, // [SM_SECURE] /* 44 */
0, // [SM_CXEDGE] /* 45 */
0, // [SM_CYEDGE] /* 46 */
2, // [SM_CXEDGE] /* 45 */ // sysMetrics[SM_CXBORDER] + 1;
2, // [SM_CYEDGE] /* 46 */
0, // [SM_CXMINSPACING] /* 47 */
0, // [SM_CYMINSPACING] /* 48 */
0, // [SM_CXSMICON] /* 49 */
0, // [SM_CYSMICON] /* 50 */
14, // [SM_CXSMICON] /* 49 */
14, // [SM_CYSMICON] /* 50 */
0, // [SM_CYSMCAPTION] /* 51 */
0, // [SM_CXSMSIZE] /* 52 */
0, // [SM_CYSMSIZE] /* 53 */
0, // [SM_CXMENUSIZE] /* 54 */
0, // [SM_CYMENUSIZE] /* 55 */
19, // [SM_CXMENUSIZE] /* 54 */
19, // [SM_CYMENUSIZE] /* 55 */
8, // [SM_ARRANGE] /* 56 */
160, // [SM_CXMINIMIZED] /* 57 */
24, // [SM_CYMINIMIZED] /* 58 */

View file

@ -103,9 +103,9 @@ ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc)
if (wc->style & CS_CLASSDC)
classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ;
else classPtr->style |= CS_OWNDC;
else
classPtr->dce = NULL;
if ( wc->lpszMenuName != NULL ) {
len = lstrlenA(wc->lpszMenuName);

View file

@ -39,9 +39,12 @@ INT RestoreVisRgn(HDC hdc);
HDC STDCALL GetDC( HWND hWnd )
{
WND *wndPtr;
if (!hWnd)
return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE | DCX_WINDOW );
return GetDCEx( hWnd, 0, DCX_USESTYLE );
hWnd= GetDesktopWindow();
if (!(wndPtr = WIN_FindWndPtr( hWnd ))) return 0;
return wndPtr->dce->hDC;
}
/***********************************************************************
@ -51,6 +54,8 @@ HDC STDCALL GetDC( HWND hWnd )
*
* FIXME: Full support for hrgnClip == 1 (alias for entire window).
*/
HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{
HRGN hrgnVisible = 0;
@ -69,7 +74,10 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
/* fixup flags */
if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC))) flags |= DCX_CACHE;
#if 0
if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC)))
flags |= DCX_CACHE;
if (flags & DCX_USESTYLE)
{
@ -88,15 +96,19 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
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;
if (flags & DCX_WINDOW)
flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
#endif
if (!(wndPtr->dwStyle & WS_CHILD) || !wndPtr->parent )
flags &= ~DCX_PARENTCLIP;
else if( flags & DCX_PARENTCLIP )
@ -116,6 +128,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
dcxFlags = flags & (DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_CACHE | DCX_WINDOW);
#if 0
if (flags & DCX_CACHE)
{
DCE* dceEmpty;
@ -137,9 +150,9 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
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))
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 );
@ -153,7 +166,13 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
}
else
{
dce = (wndPtr->class->style & CS_OWNDC) ? wndPtr->dce : wndPtr->class->dce;
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");
@ -177,6 +196,9 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
}
if (!dce) return 0;
#endif
dce = wndPtr->dce;
dce->hwndCurrent = hwnd;
dce->hClipRgn = 0;
dce->DCXflags = dcxFlags | (flags & DCX_WINDOWPAINT) | DCX_DCEBUSY;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,292 @@
#define UNICODE
#include <windows.h>
#include <user32/win.h>
#include <user32/resource.h>
#define MB_TYPEMASK 0x0000000F
#define MB_ICONMASK 0x000000F0
#define MB_DEFMASK 0x00000F00
LRESULT CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam );
// FIXME ?????????
/* Static text */
#define stc1 0x0440
/**************************************************************************
* MessageBoxA (USER.391)
*
* NOTES
* The WARN is here to help debug erroneous MessageBoxes
* Use: -debugmsg warn+dialog,+relay
*/
INT STDCALL MessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type)
{
return MessageBoxExA(hWnd,text,title,type,0);
}
/**************************************************************************
* MessageBoxW (USER.396)
*/
INT STDCALL MessageBoxW( HWND hWnd, LPCWSTR text, LPCWSTR title,
UINT type )
{
return MessageBoxExW(hWnd,text,title,type,0);
}
/**************************************************************************
* MessageBoxExA (USER.392)
*/
INT STDCALL MessageBoxExA( HWND hWnd, LPCSTR text, LPCSTR title,
UINT type, WORD langid )
{
MSGBOXPARAMS mbox;
if (title == NULL)
title="Error";
if (text == NULL)
text=" ";
mbox.lpszCaption = title;
mbox.lpszText = text;
mbox.dwStyle = type;
return DialogBoxIndirectParamA( WIN_GetWindowInstance(hWnd),
SYSRES_GetResPtr( SYSRES_DIALOG_MSGBOX ),
hWnd, MSGBOX_DlgProc, (LPARAM)&mbox );
}
/**************************************************************************
* MessageBoxExW (USER.393)
*/
INT STDCALL MessageBoxExW( HWND hWnd, LPCWSTR text, LPCWSTR title,
UINT type, WORD langid )
{
MSGBOXPARAMS mbox;
if (title == NULL)
title=L"Error";
if (text == NULL)
text=L" ";
mbox.lpszCaption = title;
mbox.lpszText = text;
mbox.dwStyle = type;
return DialogBoxIndirectParamW( WIN_GetWindowInstance(hWnd),
SYSRES_GetResPtr( SYSRES_DIALOG_MSGBOX ),
hWnd, MSGBOX_DlgProc, (LPARAM)&mbox );
}
/**************************************************************************
* MessageBoxIndirectA (USER.394)
*/
INT STDCALL MessageBoxIndirectA( LPMSGBOXPARAMS msgbox )
{
return DialogBoxIndirectParamA( msgbox->hInstance,
SYSRES_GetResPtr( SYSRES_DIALOG_MSGBOX ),
msgbox->hwndOwner, MSGBOX_DlgProc,
(LPARAM)msgbox );
}
/**************************************************************************
* MessageBoxIndirectW (USER.395)
*/
INT STDCALL MessageBoxIndirectW( LPMSGBOXPARAMS msgbox )
{
return DialogBoxIndirectParamW( msgbox->hInstance,
SYSRES_GetResPtr( SYSRES_DIALOG_MSGBOX ),
msgbox->hwndOwner, MSGBOX_DlgProc,
(LPARAM)msgbox );
}
/**************************************************************************
* MSGBOX_DlgProc
*
* Dialog procedure for message boxes.
*/
LRESULT CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
static HFONT hFont = 0;
LPMSGBOXPARAMS lpmb;
RECT rect, textrect;
HWND hItem;
HDC hdc;
LRESULT lRet;
int i, buttons, bwidth, bheight, theight, wwidth, bpos;
int borheight, iheight, tiheight;
NONCLIENTMETRICS nclm;
switch(message) {
case WM_INITDIALOG:
lpmb = (LPMSGBOXPARAMS)lParam;
nclm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
hFont = CreateFontIndirect(&nclm.lfMessageFont);
/* set button font */
for (i=1; i < 8; i++)
SendDlgItemMessageW (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
/* set text font */
SendDlgItemMessageW (hwnd, 100, WM_SETFONT, (WPARAM)hFont, 0);
if (lpmb->lpszCaption)
SetWindowTextW(hwnd, lpmb->lpszCaption);
SetWindowTextW(GetDlgItem(hwnd, 100), lpmb->lpszText);
/* Hide not selected buttons */
switch(lpmb->dwStyle & MB_TYPEMASK) {
case MB_OK:
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
/* fall through */
case MB_OKCANCEL:
ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
break;
case MB_ABORTRETRYIGNORE:
ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
break;
case MB_YESNO:
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
/* fall through */
case MB_YESNOCANCEL:
ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
break;
}
/* Set the icon */
switch(lpmb->dwStyle & MB_ICONMASK) {
case MB_ICONEXCLAMATION:
SendDlgItemMessage(hwnd, stc1, STM_SETICON,
(WPARAM)LoadIcon(0, IDI_EXCLAMATION), 0);
break;
case MB_ICONQUESTION:
SendDlgItemMessage(hwnd, stc1, STM_SETICON,
(WPARAM)LoadIcon(0, IDI_QUESTION), 0);
break;
case MB_ICONASTERISK:
SendDlgItemMessage(hwnd, stc1, STM_SETICON,
(WPARAM)LoadIcon(0, IDI_ASTERISK), 0);
break;
case MB_ICONHAND:
default:
SendDlgItemMessage(hwnd, stc1, STM_SETICON,
(WPARAM)LoadIcon(0, IDI_HAND), 0);
break;
}
/* Position everything */
GetWindowRect(hwnd, &rect);
borheight = rect.bottom - rect.top;
wwidth = rect.right - rect.left;
GetClientRect(hwnd, &rect);
borheight -= rect.bottom - rect.top;
/* Get the icon height */
GetWindowRect(GetDlgItem(hwnd, 1088), &rect);
iheight = rect.bottom - rect.top;
/* Get the number of visible buttons and their width */
GetWindowRect(GetDlgItem(hwnd, 2), &rect);
bheight = rect.bottom - rect.top;
bwidth = rect.left;
GetWindowRect(GetDlgItem(hwnd, 1), &rect);
bwidth -= rect.left;
for (buttons = 0, i = 1; i < 8; i++)
{
hItem = GetDlgItem(hwnd, i);
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
buttons++;
}
/* Get the text size */
hItem = GetDlgItem(hwnd, 100);
GetWindowRect(hItem, &textrect);
MapWindowPoints(0, hwnd, (LPPOINT)&textrect, 2);
GetClientRect(hItem, &rect);
hdc = GetDC(hItem);
lRet = DrawTextW( hdc, lpmb->lpszText, -1, &rect,
DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
theight = rect.bottom - rect.top;
tiheight = 16 + max(iheight, theight);
ReleaseDC(hItem, hdc);
/* Position the text */
SetWindowPos(hItem, 0, textrect.left, (tiheight - theight) / 2,
rect.right - rect.left, theight,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Position the icon */
hItem = GetDlgItem(hwnd, 1088);
GetWindowRect(hItem, &rect);
MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2);
SetWindowPos(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Resize the window */
SetWindowPos(hwnd, 0, 0, 0, wwidth, 8 + tiheight + bheight + borheight,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Position the buttons */
bpos = (wwidth - bwidth * buttons) / 2;
GetWindowRect(GetDlgItem(hwnd, 1), &rect);
for (buttons = i = 0; i < 7; i++) {
/* some arithmetic to get the right order for YesNoCancel windows */
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE) {
if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8)) {
SetFocus(hItem);
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
}
SetWindowPos(hItem, 0, bpos, tiheight, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
bpos += bwidth;
}
}
return 0;
break;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
case IDCANCEL:
case IDABORT:
case IDRETRY:
case IDIGNORE:
case IDYES:
case IDNO:
if ( hFont)
DeleteObject (hFont);
EndDialog(hwnd, wParam);
break;
}
default:
break;
}
return 0;
}

View file

@ -18,73 +18,7 @@
/* 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
@ -123,7 +57,7 @@ BeginPaint(
if (wndPtr->class->style & CS_PARENTDC)
{
/* Don't clip the output to the update region for CS_PARENTDC window */
if(hrgnUpdate > 1)
if(hrgnUpdate > (HRGN)1)
DeleteObject(hrgnUpdate);
lpPaint->hdc = GetDCEx( hWnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE |
(bIcon ? DCX_WINDOW : 0) );
@ -250,7 +184,7 @@ WINBOOL STDCALL GetUpdateRect( HWND hwnd, LPRECT rect, WINBOOL erase )
if (rect)
{
if (wndPtr->hrgnUpdate > 1)
if (wndPtr->hrgnUpdate > (HRGN)1)
{
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR) return FALSE;
@ -298,7 +232,7 @@ INT STDCALL ExcludeUpdateRgn( HDC hdc, HWND hwnd )
wndPtr->rectWindow.top - wndPtr->rectClient.top,
wndPtr->rectClient.right - wndPtr->rectClient.left,
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
if( wndPtr->hrgnUpdate > 1 )
if( wndPtr->hrgnUpdate > (HRGN)1 )
CombineRgn(hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY);
/* do ugly coordinate translations in dce.c */

View file

@ -676,6 +676,10 @@ WINBOOL STDCALL ShowWindow( HWND hwnd, INT cmd )
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;
}

View file

@ -11,8 +11,9 @@
#include <user32/queue.h>
#include <user32/winpos.h>
#include <user32/hook.h>
//#include <user32/dce.h>
//#include <user32/nc.h>
#include <user32/dce.h>
#include <user32/nc.h>
#include <user32/paint.h>
#include <user32/debug.h>
HWND ICONTITLE_Create( WND *pWnd );
@ -171,14 +172,298 @@ HWND SetActiveWindow(HWND hWnd )
return NULL;
}
WINBOOL
STDCALL
SetWindowPos(HWND hWnd, HWND hWndInsertAfter ,
int X, int Y,
int cx, int cy, UINT flags)
SetWindowPos(
HWND hWnd,
HWND hWndInsertAfter ,
int X,
int Y,
int cx,
int cy,
UINT flags)
{
return FALSE;
WINDOWPOS winpos;
WND * wndPtr;
RECT newWindowRect, newClientRect, oldWindowRect;
HRGN visRgn = 0;
HWND tempInsertAfter= 0;
int result = 0;
UINT uFlags;
WINBOOL resync = FALSE;
DPRINT("hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n",
hWnd, X, Y, X+cx, Y+cy, flags);
/* Check window handle */
if (hWnd == GetDesktopWindow()) return FALSE;
if (!(wndPtr = WIN_FindWndPtr( hWnd ))) return FALSE;
if(wndPtr->dwStyle & WS_VISIBLE)
flags &= ~SWP_SHOWWINDOW;
else
{
uFlags |= SMC_NOPARENTERASE;
flags &= ~SWP_HIDEWINDOW;
if (!(flags & SWP_SHOWWINDOW)) flags |= SWP_NOREDRAW;
}
/* Check for windows that may not be resized
FIXME: this should be done only for Windows 3.0 programs
if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW ) )
flags |= SWP_NOSIZE | SWP_NOMOVE;
*/
/* Check dimensions */
if (cx <= 0) cx = 1;
if (cy <= 0) cy = 1;
/* Check flags */
if (hWnd == hwndActive) flags |= SWP_NOACTIVATE; /* Already active */
if ((wndPtr->rectWindow.right - wndPtr->rectWindow.left == cx) &&
(wndPtr->rectWindow.bottom - wndPtr->rectWindow.top == cy))
flags |= SWP_NOSIZE; /* Already the right size */
if ((wndPtr->rectWindow.left == X) && (wndPtr->rectWindow.top == Y))
flags |= SWP_NOMOVE; /* Already the right position */
/* Check hWndInsertAfter */
if (!(flags & (SWP_NOZORDER | SWP_NOACTIVATE)))
{
/* Ignore TOPMOST flags when activating a window */
/* _and_ moving it in Z order. */
if ((hWndInsertAfter == HWND_TOPMOST) ||
(hWndInsertAfter == HWND_NOTOPMOST))
hWndInsertAfter = HWND_TOP;
}
/* TOPMOST not supported yet */
if ((hWndInsertAfter == HWND_TOPMOST) ||
(hWndInsertAfter == HWND_NOTOPMOST)) hWndInsertAfter = HWND_TOP;
/* hWndInsertAfter must be a sibling of the window */
if ((hWndInsertAfter != HWND_TOP) && (hWndInsertAfter != HWND_BOTTOM))
{
WND* wnd = WIN_FindWndPtr(hWndInsertAfter);
if( wnd ) {
if( wnd->parent != wndPtr->parent ) return FALSE;
if( wnd->next == wndPtr ) flags |= SWP_NOZORDER;
}
}
else
{
/* FIXME: the following optimization is no good for "X-ed" windows */
if (hWndInsertAfter == HWND_TOP && wndPtr->parent)
flags |= ( wndPtr->parent->child == wndPtr)? SWP_NOZORDER: 0;
else /* HWND_BOTTOM */
flags |= ( wndPtr->next )? 0: SWP_NOZORDER;
}
/* Fill the WINDOWPOS structure */
winpos.hwnd = hWnd;
winpos.hwndInsertAfter = hWndInsertAfter;
winpos.x = X;
winpos.y = Y;
winpos.cx = cx;
winpos.cy = cy;
winpos.flags = flags;
/* Send WM_WINDOWPOSCHANGING message */
if (!(winpos.flags & SWP_NOSENDCHANGING))
SendMessageA( hWnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)&winpos );
/* Calculate new position and size */
newWindowRect = wndPtr->rectWindow;
newClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? wndPtr->rectWindow
: wndPtr->rectClient;
if (!(winpos.flags & SWP_NOSIZE))
{
newWindowRect.right = newWindowRect.left + winpos.cx;
newWindowRect.bottom = newWindowRect.top + winpos.cy;
}
if (!(winpos.flags & SWP_NOMOVE))
{
newWindowRect.left = winpos.x;
newWindowRect.top = winpos.y;
newWindowRect.right += winpos.x - wndPtr->rectWindow.left;
newWindowRect.bottom += winpos.y - wndPtr->rectWindow.top;
OffsetRect( &newClientRect, winpos.x - wndPtr->rectWindow.left,
winpos.y - wndPtr->rectWindow.top );
}
winpos.flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
/* Reposition window in Z order */
if (!(winpos.flags & SWP_NOZORDER))
{
/* reorder owned popups if hwnd is top-level window
*/
if( wndPtr->parent == WIN_GetDesktop() )
hWndInsertAfter = WINPOS_ReorderOwnedPopups( hWndInsertAfter,
wndPtr, winpos.flags );
// if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
//{
// WIN_UnlinkWindow( winpos.hwnd );
// WIN_LinkWindow( winpos.hwnd, hWndInsertAfter );
//}
else WINPOS_MoveWindowZOrder( winpos.hwnd, hWndInsertAfter );
}
if ( !(winpos.flags & SWP_NOREDRAW) &&
((winpos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED))
!= (SWP_NOMOVE | SWP_NOSIZE)) )
visRgn = DCE_GetVisRgn(hWnd, DCX_WINDOW | DCX_CLIPSIBLINGS);
/* Send WM_NCCALCSIZE message to get new client area */
if( (winpos.flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
{
result = WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect,
&wndPtr->rectWindow, &wndPtr->rectClient,
&winpos, &newClientRect );
/* FIXME: WVR_ALIGNxxx */
if( newClientRect.left != wndPtr->rectClient.left ||
newClientRect.top != wndPtr->rectClient.top )
winpos.flags &= ~SWP_NOCLIENTMOVE;
if( (newClientRect.right - newClientRect.left !=
wndPtr->rectClient.right - wndPtr->rectClient.left) ||
(newClientRect.bottom - newClientRect.top !=
wndPtr->rectClient.bottom - wndPtr->rectClient.top) )
winpos.flags &= ~SWP_NOCLIENTSIZE;
}
else
if( !(flags & SWP_NOMOVE) && (newClientRect.left != wndPtr->rectClient.left ||
newClientRect.top != wndPtr->rectClient.top) )
winpos.flags &= ~SWP_NOCLIENTMOVE;
/* Update active DCEs
* TODO: Optimize conditions that trigger DCE update.
*/
if( (((winpos.flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) &&
wndPtr->dwStyle & WS_VISIBLE) ||
(flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)) )
{
RECT rect;
UnionRect(&rect, &newWindowRect, &wndPtr->rectWindow);
DCE_InvalidateDCE(wndPtr, &rect);
}
/* change geometry */
oldWindowRect = wndPtr->rectWindow;
{
RECT oldClientRect = wndPtr->rectClient;
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
if( oldClientRect.bottom - oldClientRect.top ==
newClientRect.bottom - newClientRect.top ) result &= ~WVR_VREDRAW;
if( oldClientRect.right - oldClientRect.left ==
newClientRect.right - newClientRect.left ) result &= ~WVR_HREDRAW;
if( !(flags & (SWP_NOREDRAW | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) )
{
uFlags |= ((winpos.flags & SWP_NOCOPYBITS) ||
(result >= WVR_HREDRAW && result < WVR_VALIDRECTS)) ? SMC_NOCOPY : 0;
uFlags |= (winpos.flags & SWP_FRAMECHANGED) ? SMC_DRAWFRAME : 0;
if( (winpos.flags & SWP_AGG_NOGEOMETRYCHANGE) != SWP_AGG_NOGEOMETRYCHANGE )
uFlags = WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect,
&oldClientRect, uFlags);
else
{
/* adjust the frame and do not erase the parent */
if( winpos.flags & SWP_FRAMECHANGED ) wndPtr->flags |= WIN_NEEDS_NCPAINT;
if( winpos.flags & SWP_NOZORDER ) uFlags |= SMC_NOPARENTERASE;
}
}
DeleteObject(visRgn);
}
if (flags & SWP_SHOWWINDOW)
{
wndPtr->dwStyle |= WS_VISIBLE;
{
if (!(flags & SWP_NOREDRAW))
PAINT_RedrawWindow( winpos.hwnd, NULL, 0,
RDW_INVALIDATE | RDW_ALLCHILDREN |
RDW_FRAME | RDW_ERASENOW | RDW_ERASE, 0 );
}
}
else if (flags & SWP_HIDEWINDOW)
{
wndPtr->dwStyle &= ~WS_VISIBLE;
if (!(flags & SWP_NOREDRAW))
PAINT_RedrawWindow( wndPtr->parent->hwndSelf, &oldWindowRect,
0, RDW_INVALIDATE | RDW_ALLCHILDREN |
RDW_ERASE | RDW_ERASENOW, 0 );
uFlags |= SMC_NOPARENTERASE;
if ((winpos.hwnd == GetFocus()) ||
IsChild( winpos.hwnd, GetFocus()))
{
/* Revert focus to parent */
SetFocus( GetParent(winpos.hwnd) );
}
if (hWnd == CARET_GetHwnd()) DestroyCaret();
if (winpos.hwnd == hwndActive)
WINPOS_ActivateOtherWindow( wndPtr );
}
/* Activate the window */
if (!(flags & SWP_NOACTIVATE))
WINPOS_ChangeActiveWindow( winpos.hwnd, FALSE );
/* Repaint the window */
// if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
// EVENT_Synchronize(); /* Wait for all expose events */
//if (!GetCapture())
// EVENT_DummyMotionNotify(); /* Simulate a mouse event to set the cursor */
if (wndPtr->parent && !(flags & SWP_DEFERERASE) && !(uFlags & SMC_NOPARENTERASE) )
PAINT_RedrawWindow( wndPtr->parent->hwndSelf, NULL, 0, RDW_ALLCHILDREN | RDW_ERASENOW, 0 );
else if(wndPtr->parent && wndPtr->parent == WIN_GetDesktop() && wndPtr->parent->flags & WIN_NEEDS_ERASEBKGND )
PAINT_RedrawWindow( wndPtr->parent->hwndSelf, NULL, 0, RDW_NOCHILDREN | RDW_ERASENOW, 0 );
/* And last, send the WM_WINDOWPOSCHANGED message */
DPRINT("\tstatus flags = %04x\n", winpos.flags & SWP_AGG_STATUSFLAGS);
if ( resync ||
(((winpos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) &&
!(winpos.flags & SWP_NOSENDCHANGING)) )
{
SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos );
//if (resync) EVENT_Synchronize ();
}
return TRUE;
}
@ -466,7 +751,7 @@ WINBOOL WINPOS_ShowIconTitle( WND* pWnd, WINBOOL bShow )
{
HWND hWnd = lpPos->hwndIconTitle;
//TRACE(win,"0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
//DPRINT("0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
// if( !hWnd )
// lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
@ -570,7 +855,7 @@ UINT WINPOS_MinMaximize( WND* wndPtr, UINT cmd, LPRECT lpRect )
&wndPtr->rectWindow );
//TRACE(win,"0x%04x %u\n", wndPtr->hwndSelf, cmd );
//DPRINT("0x%04x %u\n", wndPtr->hwndSelf, cmd );
if ( wndPtr->class->bUnicode ) {
if (HOOK_CallHooksW(WH_CBT, HCBT_MINMAX, (INT)wndPtr->hwndSelf, cmd)) {
@ -1101,7 +1386,7 @@ UINT WINPOS_SizeMoveClean( WND* Wnd, HRGN oldVisRgn,
/* Blt valid bits using parent window DC */
if( my != NULLREGION && (xfrom != xto || yfrom != yto) )
if( Wnd->parent && my != NULLREGION && (xfrom != xto || yfrom != yto) )
{
/* compute clipping region in parent client coordinates */
@ -1114,9 +1399,10 @@ UINT WINPOS_SizeMoveClean( WND* Wnd, HRGN oldVisRgn,
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 )