Commit 1e9ac798 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960606

Wed Jun 5 20:13:54 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/button.c] [controls/listbox.c] Fixed wParam of WM_DRAWITEM message. * [if1632/Makefile.in] [loader/builtin.c] Remove WPROCS32 DLL, as the relay code can call Wine routines directly. * [loader/module.c] [loader/ne_image.c] Fixed initial stack layout for self-loading modules. * [tools/build.c] Fixed data segment building for Win16 modules. * [windows/defdlg.c] Implemented Win32 versions of DefDlgProc(). * [windows/dialog.c] Merged Win16 and Win32 dialog code. Added support for control extra data in dialog item template. * [windows/win.c] Unified Win16 and Win32 versions of CreateWindow(). Implemented Win32 version of GetWindowLong(). * [windows/winproc.c] Changed the implementation of window procedures, so that 16-bit winprocs are valid segmented pointers. Sun Jun 2 16:39:46 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [misc/registry.c] Fixed another bug in the w95 loader. Quietened some debug output. Sun Jun 2 10:00:22 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> * [windows/winproc.c] Bug fix: WM_PARENTNOTIFY: don't fall through to WM_SETTEXT. Sat Jun 1 12:37:22 1996 Tristan Tarrant <tst@sthinc.demon.co.uk> * [resources/TODO] [resources/sysres_It.rc] Updated font dialog box. Thu May 30 21:05:19 1996 Albrecht Kleine <kleine@ak.sax.de> * [include/commdlg.h] [misc/commdlg.c] ChooseFont() and ChooseColor(): Bugfixes and added more support for some CF_* and CC_* flags: dialog templates and font size control. Bugfix in structure definition of CHOOSECOLOR definition. * [ipc/dde_proc.c] [windows/event.c] Replaced SendMessage with SendMessage16 and added inclusion of dde_proc.h for error-free compilation of ipc module. Thu May 30 19:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/scroll.c] Made ScrollDC to save/restore current clipping region. * [misc/clipboard.c] [windows/event.c] Implemented most of the previously missing features (not tested), improved text pasting from/to X. * [if1632/user.spec] [if1632/gdi.spec] [objects/dc.c] [objects/gdiobj.c] [objects/clipping.c] [windows/dce.c] [windows/winpos.c] [windows/painting.c] Updated DCE code, implemented dynamic invalidation of owned DCs. This fixes a lot of problems with scrolling in WinWord. Not sure about the effect on -desktop. Wed May 29 23:35:44 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [win32/time.c] [if1632/kernel32.spec] Added SetSystemTime and SetTimeZoneInformation. * [if1632/kernel32.spec] Added lstrcat, lstrcatA, lstrcmp, lstrcmpA, lstrcpy, lstrlen. * [include/windows.h] Added SYSTEM_POWER_STATUS structure and prototypes for GetSystemPowerStatus, SetSystemPowerState, SetSystemTime. * [include/kernel32.h] Added a prototype for SetTimeZoneInformation. * [win32/environment.c] [if1632/kernel32.spec] Added GetSystemPowerStatus and SetSystemPowerState stubs.
parent ef702d89
This is release 960528 of Wine the MS Windows emulator. This is still a This is release 960606 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work. features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry. forget to include a ChangeLog entry.
WHAT'S NEW with Wine-960528: (see ChangeLog for details) WHAT'S NEW with Wine-960606: (see ChangeLog for details)
- First attempt at inter-task SendMessage(); still broken. - More Win32 code.
- Window repainting fixes.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
...@@ -15,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before ...@@ -15,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960528.tar.gz sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960606.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960528.tar.gz tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960606.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960528.tar.gz ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960606.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960528.tar.gz aris.com:/pub/linux/ALPHA/Wine/development/Wine-960606.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Wed Jun 5 20:13:54 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/button.c] [controls/listbox.c]
Fixed wParam of WM_DRAWITEM message.
* [if1632/Makefile.in] [loader/builtin.c]
Remove WPROCS32 DLL, as the relay code can call Wine routines
directly.
* [loader/module.c] [loader/ne_image.c]
Fixed initial stack layout for self-loading modules.
* [tools/build.c]
Fixed data segment building for Win16 modules.
* [windows/defdlg.c]
Implemented Win32 versions of DefDlgProc().
* [windows/dialog.c]
Merged Win16 and Win32 dialog code.
Added support for control extra data in dialog item template.
* [windows/win.c]
Unified Win16 and Win32 versions of CreateWindow().
Implemented Win32 version of GetWindowLong().
* [windows/winproc.c]
Changed the implementation of window procedures, so that 16-bit
winprocs are valid segmented pointers.
Sun Jun 2 16:39:46 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [misc/registry.c]
Fixed another bug in the w95 loader. Quietened some debug output.
Sun Jun 2 10:00:22 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [windows/winproc.c]
Bug fix: WM_PARENTNOTIFY: don't fall through to WM_SETTEXT.
Sat Jun 1 12:37:22 1996 Tristan Tarrant <tst@sthinc.demon.co.uk>
* [resources/TODO] [resources/sysres_It.rc]
Updated font dialog box.
Thu May 30 21:05:19 1996 Albrecht Kleine <kleine@ak.sax.de>
* [include/commdlg.h] [misc/commdlg.c]
ChooseFont() and ChooseColor():
Bugfixes and added more support for some CF_* and CC_* flags:
dialog templates and font size control.
Bugfix in structure definition of CHOOSECOLOR definition.
* [ipc/dde_proc.c] [windows/event.c]
Replaced SendMessage with SendMessage16 and added inclusion of
dde_proc.h for error-free compilation of ipc module.
Thu May 30 19:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/scroll.c]
Made ScrollDC to save/restore current clipping region.
* [misc/clipboard.c] [windows/event.c]
Implemented most of the previously missing features (not tested),
improved text pasting from/to X.
* [if1632/user.spec] [if1632/gdi.spec] [objects/dc.c]
[objects/gdiobj.c] [objects/clipping.c] [windows/dce.c]
[windows/winpos.c] [windows/painting.c]
Updated DCE code, implemented dynamic invalidation of owned DCs.
This fixes a lot of problems with scrolling in WinWord. Not
sure about the effect on -desktop.
Wed May 29 23:35:44 1996 Jukka Iivonen <iivonen@cc.helsinki.fi>
* [win32/time.c] [if1632/kernel32.spec]
Added SetSystemTime and SetTimeZoneInformation.
* [if1632/kernel32.spec]
Added lstrcat, lstrcatA, lstrcmp, lstrcmpA, lstrcpy, lstrlen.
* [include/windows.h]
Added SYSTEM_POWER_STATUS structure and prototypes for
GetSystemPowerStatus, SetSystemPowerState, SetSystemTime.
* [include/kernel32.h]
Added a prototype for SetTimeZoneInformation.
* [win32/environment.c] [if1632/kernel32.spec]
Added GetSystemPowerStatus and SetSystemPowerState stubs.
----------------------------------------------------------------------
Tue May 28 19:36:36 1996 Alexandre Julliard <julliard@lrc.epfl.ch> Tue May 28 19:36:36 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/combo.c] * [controls/combo.c]
......
...@@ -519,5 +519,6 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action ) ...@@ -519,5 +519,6 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
dis.hDC = hDC; dis.hDC = hDC;
dis.itemData = 0; dis.itemData = 0;
GetClientRect32( wndPtr->hwndSelf, &dis.rcItem ); GetClientRect32( wndPtr->hwndSelf, &dis.rcItem );
SendMessage32A( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, 1, (LPARAM)&dis); SendMessage32A( GetParent(wndPtr->hwndSelf), WM_DRAWITEM,
wndPtr->wIDmenu, (LPARAM)&dis );
} }
...@@ -60,12 +60,12 @@ static int COMBO_Init() ...@@ -60,12 +60,12 @@ static int COMBO_Init()
LPHEADCOMBO ComboGetStorageHeader(HWND hwnd) LPHEADCOMBO ComboGetStorageHeader(HWND hwnd)
{ {
return (LPHEADCOMBO)GetWindowLong(hwnd,4); return (LPHEADCOMBO)GetWindowLong32A(hwnd,4);
} }
LPHEADLIST ComboGetListHeader(HWND hwnd) LPHEADLIST ComboGetListHeader(HWND hwnd)
{ {
return (LPHEADLIST)GetWindowLong(hwnd,0); return (LPHEADLIST)GetWindowLong32A(hwnd,0);
} }
int CreateComboStruct(HWND hwnd, LONG style) int CreateComboStruct(HWND hwnd, LONG style)
...@@ -118,7 +118,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -118,7 +118,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
LPHEADLIST lphl; LPHEADLIST lphl;
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
LONG style = 0; LONG style = 0;
LONG cstyle = GetWindowLong(hwnd,GWL_STYLE); LONG cstyle = GetWindowLong32A(hwnd,GWL_STYLE);
RECT16 rect,lboxrect; RECT16 rect,lboxrect;
WND* wndPtr = WIN_FindWndPtr(hwnd); WND* wndPtr = WIN_FindWndPtr(hwnd);
char className[] = "COMBOLBOX"; /* Hack so that class names are > 0x10000 */ char className[] = "COMBOLBOX"; /* Hack so that class names are > 0x10000 */
...@@ -172,21 +172,21 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -172,21 +172,21 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
if ((cstyle & 3) != CBS_DROPDOWNLIST) if ((cstyle & 3) != CBS_DROPDOWNLIST)
lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0, lphc->hWndEdit = CreateWindow16( editName, NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT,
0, 0, rect.right-6-CBitWidth, 0, 0, rect.right-6-CBitWidth,
lphl->StdItemHeight+2*SYSMETRICS_CYBORDER, lphl->StdItemHeight+2*SYSMETRICS_CYBORDER,
hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), 0L); hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), NULL );
lboxrect.top+=lphc->LBoxTop; lboxrect.top+=lphc->LBoxTop;
lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0, style | lphc->hWndLBox = CreateWindow16( className, NULL, style |
((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) | ((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) |
((cstyle & WS_VSCROLL)? WS_VSCROLL : 0), ((cstyle & WS_VSCROLL)? WS_VSCROLL : 0),
lboxrect.left, lboxrect.top, lboxrect.left, lboxrect.top,
lboxrect.right - lboxrect.left, lboxrect.right - lboxrect.left,
lboxrect.bottom - lboxrect.top, lboxrect.bottom - lboxrect.top,
hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd), hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd),
(SEGPTR)hwnd ); (LPVOID)(HWND32)hwnd );
wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL); wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL);
...@@ -628,7 +628,7 @@ static BOOL CBCheckSize(HWND hwnd) ...@@ -628,7 +628,7 @@ static BOOL CBCheckSize(HWND hwnd)
{ {
LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
LPHEADLIST lphl = ComboGetListHeader(hwnd); LPHEADLIST lphl = ComboGetListHeader(hwnd);
LONG cstyle = GetWindowLong(hwnd,GWL_STYLE); LONG cstyle = GetWindowLong32A(hwnd,GWL_STYLE);
RECT16 cRect,wRect; RECT16 cRect,wRect;
if (lphc->hWndLBox == 0) return FALSE; if (lphc->hWndLBox == 0) return FALSE;
...@@ -781,11 +781,7 @@ LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -781,11 +781,7 @@ LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
HWND CLBoxGetCombo(HWND hwnd) HWND CLBoxGetCombo(HWND hwnd)
{ {
#ifdef WINELIB32 return (HWND)GetWindowLong32A(hwnd,0);
return (HWND)GetWindowLong(hwnd,0);
#else
return (HWND)GetWindowWord(hwnd,0);
#endif
} }
LPHEADLIST CLBoxGetListHeader(HWND hwnd) LPHEADLIST CLBoxGetListHeader(HWND hwnd)
...@@ -799,11 +795,7 @@ LPHEADLIST CLBoxGetListHeader(HWND hwnd) ...@@ -799,11 +795,7 @@ LPHEADLIST CLBoxGetListHeader(HWND hwnd)
static LRESULT CBLCreate( HWND hwnd, WPARAM wParam, LPARAM lParam ) static LRESULT CBLCreate( HWND hwnd, WPARAM wParam, LPARAM lParam )
{ {
CREATESTRUCT16 *createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); CREATESTRUCT16 *createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
#ifdef WINELIB32 SetWindowLong32A(hwnd,0,(LONG)createStruct->lpCreateParams);
SetWindowLong(hwnd,0,(LONG)createStruct->lpCreateParams);
#else
SetWindowWord(hwnd,0,LOWORD(createStruct->lpCreateParams));
#endif
return 0; return 0;
} }
......
...@@ -95,9 +95,9 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent) ...@@ -95,9 +95,9 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
lphl->hSelf = hwnd; lphl->hSelf = hwnd;
if (CtlType==ODT_COMBOBOX) /* use the "faked" style for COMBOLBOX */ if (CtlType==ODT_COMBOBOX) /* use the "faked" style for COMBOLBOX */
/* LBS_SORT instead CBS_SORT e.g. */ /* LBS_SORT instead CBS_SORT e.g. */
lphl->dwStyle = MAKELONG(LOWORD(styles),HIWORD(GetWindowLong(hwnd,GWL_STYLE))); lphl->dwStyle = MAKELONG(LOWORD(styles),HIWORD(GetWindowLong32A(hwnd,GWL_STYLE)));
else else
lphl->dwStyle = GetWindowLong(hwnd,GWL_STYLE); /* use original style dword */ lphl->dwStyle = GetWindowLong32A(hwnd,GWL_STYLE); /* use original style dword */
lphl->hParent = parent; lphl->hParent = parent;
lphl->StdItemHeight = 15; /* FIXME: should get the font height */ lphl->StdItemHeight = 15; /* FIXME: should get the font height */
lphl->OwnerDrawn = styles & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE); lphl->OwnerDrawn = styles & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE);
...@@ -146,7 +146,7 @@ void DestroyListBoxStruct(LPHEADLIST lphl) ...@@ -146,7 +146,7 @@ void DestroyListBoxStruct(LPHEADLIST lphl)
static LPHEADLIST ListBoxGetStorageHeader(HWND hwnd) static LPHEADLIST ListBoxGetStorageHeader(HWND hwnd)
{ {
return (LPHEADLIST)GetWindowLong(hwnd,0); return (LPHEADLIST)GetWindowLong32A(hwnd,0);
} }
/* Send notification "code" as part of a WM_COMMAND-message if hwnd /* Send notification "code" as part of a WM_COMMAND-message if hwnd
...@@ -245,7 +245,7 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, ...@@ -245,7 +245,7 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls,
dis.itemAction = itemAction; dis.itemAction = itemAction;
dis.itemState = itemState; dis.itemState = itemState;
CONV_RECT16TO32( rect, &dis.rcItem ); CONV_RECT16TO32( rect, &dis.rcItem );
SendMessage32A( lphl->hParent, WM_DRAWITEM, 0, (LPARAM)&dis ); SendMessage32A( lphl->hParent, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis );
return; return;
} }
if (itemAction == ODA_DRAWENTIRE || itemAction == ODA_SELECT) { if (itemAction == ODA_DRAWENTIRE || itemAction == ODA_SELECT) {
...@@ -315,7 +315,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls) ...@@ -315,7 +315,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
*lpmeasure = lpls->mis; *lpmeasure = lpls->mis;
lpmeasure->itemHeight = lphl->StdItemHeight; lpmeasure->itemHeight = lphl->StdItemHeight;
SendMessage16(lphl->hParent, WM_MEASUREITEM, 0, (LPARAM)USER_HEAP_SEG_ADDR(hTemp)); SendMessage16(lphl->hParent, WM_MEASUREITEM, lphl->CtlID, (LPARAM)USER_HEAP_SEG_ADDR(hTemp));
if (lphl->dwStyle & LBS_OWNERDRAWFIXED) { if (lphl->dwStyle & LBS_OWNERDRAWFIXED) {
if (lpmeasure->itemHeight > lphl->StdItemHeight) if (lpmeasure->itemHeight > lphl->StdItemHeight)
...@@ -765,7 +765,7 @@ int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar) ...@@ -765,7 +765,7 @@ int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar)
static LONG LBCreate(HWND hwnd, WORD wParam, LONG lParam) static LONG LBCreate(HWND hwnd, WORD wParam, LONG lParam)
{ {
LPHEADLIST lphl; LPHEADLIST lphl;
LONG dwStyle = GetWindowLong(hwnd,GWL_STYLE); LONG dwStyle = GetWindowLong32A(hwnd,GWL_STYLE);
RECT16 rect; RECT16 rect;
CreateListBoxStruct(hwnd, ODT_LISTBOX, dwStyle, GetParent(hwnd)); CreateListBoxStruct(hwnd, ODT_LISTBOX, dwStyle, GetParent(hwnd));
...@@ -978,7 +978,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) ...@@ -978,7 +978,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
} }
#ifndef WINELIB #ifndef WINELIB
if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT) if (GetWindowLong32A(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT)
if( DragDetect(lphl->hSelf,MAKEPOINT16(lParam)) ) if( DragDetect(lphl->hSelf,MAKEPOINT16(lParam)) )
SendMessage16(lphl->hParent, WM_BEGINDRAG,0,0L); SendMessage16(lphl->hParent, WM_BEGINDRAG,0,0L);
#endif #endif
......
...@@ -774,11 +774,12 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y) ...@@ -774,11 +774,12 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y)
if (!pTopPWnd) if (!pTopPWnd)
{ {
pTopPWnd = WIN_FindWndPtr(CreateWindow16( POPUPMENU_CLASS_ATOM, (SEGPTR)0, pTopPWnd = WIN_FindWndPtr(CreateWindow16( POPUPMENU_CLASS_ATOM, NULL,
WS_POPUP | WS_BORDER, x, y, WS_POPUP | WS_BORDER, x, y,
menu->Width + 2*SYSMETRICS_CXBORDER, menu->Width + 2*SYSMETRICS_CXBORDER,
menu->Height + 2*SYSMETRICS_CYBORDER, menu->Height + 2*SYSMETRICS_CYBORDER,
0, 0, wndPtr->hInstance, (SEGPTR)hmenu )); 0, 0, wndPtr->hInstance,
(LPVOID)(HMENU32)hmenu ));
if (!pTopPWnd) return FALSE; if (!pTopPWnd) return FALSE;
skip_init = TRUE; skip_init = TRUE;
} }
...@@ -786,11 +787,12 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y) ...@@ -786,11 +787,12 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y)
if( uSubPWndLevel ) if( uSubPWndLevel )
{ {
/* create new window for the submenu */ /* create new window for the submenu */
HWND hWnd = CreateWindow16( POPUPMENU_CLASS_ATOM, (SEGPTR)0, HWND hWnd = CreateWindow16( POPUPMENU_CLASS_ATOM, NULL,
WS_POPUP | WS_BORDER, x, y, WS_POPUP | WS_BORDER, x, y,
menu->Width + 2*SYSMETRICS_CXBORDER, menu->Width + 2*SYSMETRICS_CXBORDER,
menu->Height + 2*SYSMETRICS_CYBORDER, menu->Height + 2*SYSMETRICS_CYBORDER,
menu->hWnd, 0, wndPtr->hInstance, (SEGPTR)hmenu ); menu->hWnd, 0, wndPtr->hInstance,
(LPVOID)(HMENU32)hmenu );
if( !hWnd ) return FALSE; if( !hWnd ) return FALSE;
menu->hWnd = hWnd; menu->hWnd = hWnd;
} }
...@@ -1832,13 +1834,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ...@@ -1832,13 +1834,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT16 *cs = (CREATESTRUCT16*)PTR_SEG_TO_LIN(lParam); CREATESTRUCT16 *cs = (CREATESTRUCT16*)PTR_SEG_TO_LIN(lParam);
#ifdef WINELIB32 SetWindowLong32A( hwnd, 0, (LONG)cs->lpCreateParams );
HMENU hmenu = (HMENU) (cs->lpCreateParams);
SetWindowLong( hwnd, 0, hmenu );
#else
HMENU hmenu = (HMENU) ((int)cs->lpCreateParams & 0xffff);
SetWindowWord( hwnd, 0, hmenu );
#endif
return 0; return 0;
} }
...@@ -1850,12 +1846,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ...@@ -1850,12 +1846,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
PAINTSTRUCT16 ps; PAINTSTRUCT16 ps;
BeginPaint16( hwnd, &ps ); BeginPaint16( hwnd, &ps );
MENU_DrawPopupMenu( hwnd, ps.hdc, MENU_DrawPopupMenu( hwnd, ps.hdc,
#ifdef WINELIB32 (HMENU)GetWindowLong32A( hwnd, 0 ) );
(HMENU)GetWindowLong( hwnd, 0 )
#else
(HMENU)GetWindowWord( hwnd, 0 )
#endif
);
EndPaint16( hwnd, &ps ); EndPaint16( hwnd, &ps );
return 0; return 0;
} }
...@@ -1872,12 +1863,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ...@@ -1872,12 +1863,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
break; break;
case WM_USER: case WM_USER:
if( wParam ) if (wParam) SetWindowLong32A( hwnd, 0, (HMENU)wParam );
#ifdef WINELIB32
SetWindowLong( hwnd, 0, (HMENU)wParam );
#else
SetWindowWord( hwnd, 0, (HMENU)wParam );
#endif
break; break;
default: default:
return DefWindowProc16(hwnd, message, wParam, lParam); return DefWindowProc16(hwnd, message, wParam, lParam);
......
...@@ -42,7 +42,6 @@ DLLS = \ ...@@ -42,7 +42,6 @@ DLLS = \
winsock.spec \ winsock.spec \
winspool.spec \ winspool.spec \
wprocs.spec \ wprocs.spec \
wprocs32.spec \
wsock32.spec wsock32.spec
SPEC_FILES = $(DLLS:.spec=.S) SPEC_FILES = $(DLLS:.spec=.S)
......
...@@ -156,9 +156,9 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) ...@@ -156,9 +156,9 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
180 pascal16 SetDCState(word word) SetDCState 180 pascal16 SetDCState(word word) SetDCState
181 pascal16 RectInRegionOld(word ptr) RectInRegion16 181 pascal16 RectInRegionOld(word ptr) RectInRegion16
188 stub GetTextExtentEx 188 stub GetTextExtentEx
190 stub SetDCHook 190 pascal16 SetDCHook(word segptr long) SetDCHook
191 stub GetDCHook 191 pascal GetDCHook(word ptr) GetDCHook
192 stub SetHookFlags 192 pascal16 SetHookFlags(word word) SetHookFlags
193 stub SetBoundsRect 193 stub SetBoundsRect
194 stub GetBoundsRect 194 stub GetBoundsRect
195 stub SelectBitmap 195 stub SelectBitmap
......
...@@ -510,7 +510,7 @@ base 1 ...@@ -510,7 +510,7 @@ base 1
0504 stub SetProcessShutdownParameters 0504 stub SetProcessShutdownParameters
0505 stub SetProcessWorkingSetSize 0505 stub SetProcessWorkingSetSize
0506 stub SetStdHandle 0506 stub SetStdHandle
0507 stub SetSystemTime 0507 stdcall SetSystemTime(ptr) SetSystemTime
0508 stub SetSystemTimeAdjustment 0508 stub SetSystemTimeAdjustment
0509 stub SetTapeParameters 0509 stub SetTapeParameters
0510 stub SetTapePosition 0510 stub SetTapePosition
...@@ -518,7 +518,7 @@ base 1 ...@@ -518,7 +518,7 @@ base 1
0512 stub SetThreadContext 0512 stub SetThreadContext
0513 stub SetThreadLocale 0513 stub SetThreadLocale
0514 stub SetThreadPriority 0514 stub SetThreadPriority
0515 stub SetTimeZoneInformation 0515 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation
0516 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter 0516 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter
0517 stub SetVDMCurrentDirectories 0517 stub SetVDMCurrentDirectories
0518 stub SetVolumeLabelA 0518 stub SetVolumeLabelA
...@@ -601,22 +601,22 @@ base 1 ...@@ -601,22 +601,22 @@ base 1
0595 stub _lopen 0595 stub _lopen
0596 stub _lread 0596 stub _lread
0597 stub _lwrite 0597 stub _lwrite
0598 stub lstrcat 0598 stdcall lstrcat(ptr ptr) strcat
0599 stub lstrcatA 0599 stdcall lstrcatA(ptr ptr) strcat
0600 stub lstrcatW 0600 stub lstrcatW
0601 stub lstrcmp 0601 stdcall lstrcmp(ptr ptr) strcmp
0602 stub lstrcmpA 0602 stdcall lstrcmpA(ptr ptr) strcmp
0603 stub lstrcmpW 0603 stub lstrcmpW
0604 stub lstrcmpi 0604 stub lstrcmpi
0605 stub lstrcmpiA 0605 stub lstrcmpiA
0606 stub lstrcmpiW 0606 stub lstrcmpiW
0607 stub lstrcpy 0607 stdcall lstrcpy(ptr ptr) strcpy
0608 stdcall lstrcpyA(ptr ptr) strcpy 0608 stdcall lstrcpyA(ptr ptr) strcpy
0609 stub lstrcpyW 0609 stub lstrcpyW
0610 stub lstrcpyn 0610 stub lstrcpyn
0611 stub lstrcpynA 0611 stub lstrcpynA
0612 stub lstrcpynW 0612 stub lstrcpynW
0613 stub lstrlen 0613 stdcall lstrlen(ptr) strlen
0614 stdcall lstrlenA(ptr) strlen 0614 stdcall lstrlenA(ptr) strlen
0615 stub lstrlenW 0615 stub lstrlenW
#late additions #late additions
...@@ -625,7 +625,7 @@ base 1 ...@@ -625,7 +625,7 @@ base 1
0618 stub GetPrivateProfileStructA 0618 stub GetPrivateProfileStructA
0619 stub GetPrivateProfileStructW 0619 stub GetPrivateProfileStructW
0620 stub GetProcessVersion 0620 stub GetProcessVersion
0621 stub GetSystemPowerStatus 0621 stdcall GetSystemPowerStatus(ptr) GetSystemPowerStatus
0622 stub GetSystemTimeAsFileTime 0622 stub GetSystemTimeAsFileTime
0623 stub HeapCreateTagsW 0623 stub HeapCreateTagsW
0624 stub HeapExtend 0624 stub HeapExtend
...@@ -634,7 +634,7 @@ base 1 ...@@ -634,7 +634,7 @@ base 1
0627 stub HeapUsage 0627 stub HeapUsage
0628 stub IsDebuggerPresent 0628 stub IsDebuggerPresent
0629 stub PostQueuedCompletionStatus 0629 stub PostQueuedCompletionStatus
0630 stub SetSystemPowerState 0630 stdcall SetSystemPowerState(byte byte) SetSystemPowerState
0631 stub WritePrivateProfileStructA 0631 stub WritePrivateProfileStructA
0632 stub WritePrivateProfileStructW 0632 stub WritePrivateProfileStructW
0633 stub MakeCriticalSectionGlobal 0633 stub MakeCriticalSectionGlobal
...@@ -40,7 +40,7 @@ heap 65520 ...@@ -40,7 +40,7 @@ heap 65520
38 pascal16 GetWindowTextLength(word) GetWindowTextLength 38 pascal16 GetWindowTextLength(word) GetWindowTextLength
39 pascal16 BeginPaint(word ptr) BeginPaint16 39 pascal16 BeginPaint(word ptr) BeginPaint16
40 pascal16 EndPaint(word ptr) EndPaint16 40 pascal16 EndPaint(word ptr) EndPaint16
41 pascal16 CreateWindow(segptr segptr long s_word s_word s_word s_word 41 pascal16 CreateWindow(ptr ptr long s_word s_word s_word s_word
word word word segptr) CreateWindow16 word word word segptr) CreateWindow16
42 pascal16 ShowWindow(word word) ShowWindow 42 pascal16 ShowWindow(word word) ShowWindow
43 pascal16 CloseWindow(word) CloseWindow 43 pascal16 CloseWindow(word) CloseWindow
...@@ -86,9 +86,9 @@ heap 65520 ...@@ -86,9 +86,9 @@ heap 65520
83 pascal16 FrameRect(word ptr word) FrameRect16 83 pascal16 FrameRect(word ptr word) FrameRect16
84 pascal16 DrawIcon(word s_word s_word word) DrawIcon 84 pascal16 DrawIcon(word s_word s_word word) DrawIcon
85 pascal16 DrawText(word ptr s_word ptr word) DrawText16 85 pascal16 DrawText(word ptr s_word ptr word) DrawText16
87 pascal16 DialogBox(word segptr word segptr) DialogBox 87 pascal16 DialogBox(word segptr word segptr) DialogBox16
88 pascal16 EndDialog(word s_word) EndDialog 88 pascal16 EndDialog(word s_word) EndDialog
89 pascal16 CreateDialog(word segptr word segptr) CreateDialog 89 pascal16 CreateDialog(word segptr word segptr) CreateDialog16
90 pascal16 IsDialogMessage(word ptr) IsDialogMessage 90 pascal16 IsDialogMessage(word ptr) IsDialogMessage
91 pascal16 GetDlgItem(word word) GetDlgItem 91 pascal16 GetDlgItem(word word) GetDlgItem
92 pascal16 SetDlgItemText(word word segptr) SetDlgItemText16 92 pascal16 SetDlgItemText(word word segptr) SetDlgItemText16
...@@ -134,7 +134,7 @@ heap 65520 ...@@ -134,7 +134,7 @@ heap 65520
132 pascal SetClassLong(word s_word long) SetClassLong16 132 pascal SetClassLong(word s_word long) SetClassLong16
133 pascal16 GetWindowWord(word s_word) GetWindowWord 133 pascal16 GetWindowWord(word s_word) GetWindowWord
134 pascal16 SetWindowWord(word s_word word) SetWindowWord 134 pascal16 SetWindowWord(word s_word word) SetWindowWord
135 pascal GetWindowLong(word s_word) GetWindowLong 135 pascal GetWindowLong(word s_word) GetWindowLong16
136 pascal SetWindowLong(word s_word long) SetWindowLong16 136 pascal SetWindowLong(word s_word long) SetWindowLong16
137 pascal16 OpenClipboard(word) OpenClipboard 137 pascal16 OpenClipboard(word) OpenClipboard
138 pascal16 CloseClipboard() CloseClipboard 138 pascal16 CloseClipboard() CloseClipboard
...@@ -218,8 +218,8 @@ heap 65520 ...@@ -218,8 +218,8 @@ heap 65520
215 pascal16 FlushComm(word word) FlushComm 215 pascal16 FlushComm(word word) FlushComm
#216 USERSEEUSERDO #216 USERSEEUSERDO
217 pascal16 LookupMenuHandle(word s_word) LookupMenuHandle 217 pascal16 LookupMenuHandle(word s_word) LookupMenuHandle
218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect 218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect16
219 pascal16 CreateDialogIndirect(word segptr word segptr) CreateDialogIndirect 219 pascal16 CreateDialogIndirect(word ptr word segptr) CreateDialogIndirect16
220 pascal16 LoadMenuIndirect(ptr) LoadMenuIndirect16 220 pascal16 LoadMenuIndirect(ptr) LoadMenuIndirect16
221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC 221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC
222 pascal16 GetKeyboardState(ptr) GetKeyboardState 222 pascal16 GetKeyboardState(ptr) GetKeyboardState
...@@ -239,12 +239,12 @@ heap 65520 ...@@ -239,12 +239,12 @@ heap 65520
236 pascal16 GetCapture() GetCapture 236 pascal16 GetCapture() GetCapture
237 pascal16 GetUpdateRgn(word word word) GetUpdateRgn 237 pascal16 GetUpdateRgn(word word word) GetUpdateRgn
238 pascal16 ExcludeUpdateRgn(word word) ExcludeUpdateRgn 238 pascal16 ExcludeUpdateRgn(word word) ExcludeUpdateRgn
239 pascal16 DialogBoxParam(word segptr word segptr long) DialogBoxParam 239 pascal16 DialogBoxParam(word segptr word segptr long) DialogBoxParam16
240 pascal16 DialogBoxIndirectParam(word word word segptr long) 240 pascal16 DialogBoxIndirectParam(word word word segptr long)
DialogBoxIndirectParam DialogBoxIndirectParam16
241 pascal16 CreateDialogParam(word segptr word segptr long) CreateDialogParam 241 pascal16 CreateDialogParam(word segptr word segptr long) CreateDialogParam16
242 pascal16 CreateDialogIndirectParam(word segptr word segptr long) 242 pascal16 CreateDialogIndirectParam(word ptr word segptr long)
CreateDialogIndirectParam CreateDialogIndirectParam16
243 pascal GetDialogBaseUnits() GetDialogBaseUnits 243 pascal GetDialogBaseUnits() GetDialogBaseUnits
244 pascal16 EqualRect(ptr ptr) EqualRect16 244 pascal16 EqualRect(ptr ptr) EqualRect16
245 stub EnableCommNotification 245 stub EnableCommNotification
...@@ -302,7 +302,7 @@ heap 65520 ...@@ -302,7 +302,7 @@ heap 65520
300 stub UnloadInstalledDrivers 300 stub UnloadInstalledDrivers
#301 BOZOSLIVEHERE :-)) <- this is actually EditWndProc #301 BOZOSLIVEHERE :-)) <- this is actually EditWndProc
#306 BEAR306 #306 BEAR306
308 pascal DefDlgProc(word word word long) DefDlgProc 308 pascal DefDlgProc(word word word long) DefDlgProc16
309 pascal16 GetClipCursor(ptr) GetClipCursor16 309 pascal16 GetClipCursor(ptr) GetClipCursor16
314 stub SignalProc 314 stub SignalProc
319 pascal16 ScrollWindowEx(word s_word s_word ptr ptr word ptr word) 319 pascal16 ScrollWindowEx(word s_word s_word ptr ptr word ptr word)
...@@ -327,7 +327,7 @@ heap 65520 ...@@ -327,7 +327,7 @@ heap 65520
357 stub LoadDIBIconHandler 357 stub LoadDIBIconHandler
358 pascal16 IsMenu(word) IsMenu 358 pascal16 IsMenu(word) IsMenu
359 pascal16 GetDCEx(word word long) GetDCEx 359 pascal16 GetDCEx(word word long) GetDCEx
362 stub DCHook 362 pascal16 DCHook(word word long long) DCHook
364 stub LookupIconIDFromDirectoryEx 364 stub LookupIconIDFromDirectoryEx
368 pascal16 CopyIcon(word word) CopyIcon 368 pascal16 CopyIcon(word word) CopyIcon
369 pascal16 CopyCursor(word word) CopyCursor 369 pascal16 CopyCursor(word word) CopyCursor
...@@ -397,7 +397,7 @@ heap 65520 ...@@ -397,7 +397,7 @@ heap 65520
449 stub DrawState 449 stub DrawState
450 stub CreateIconFromResourceEx 450 stub CreateIconFromResourceEx
451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel
452 pascal16 CreateWindowEx(long segptr segptr long s_word s_word s_word s_word 452 pascal16 CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
word word word segptr) CreateWindowEx16 word word word segptr) CreateWindowEx16
454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx16 454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx16
455 pascal16 GetIconID(word long) GetIconID 455 pascal16 GetIconID(word long) GetIconID
......
...@@ -71,15 +71,11 @@ base 1 ...@@ -71,15 +71,11 @@ base 1
0066 stub CreateCursor 0066 stub CreateCursor
0067 stub CreateDesktopA 0067 stub CreateDesktopA
0068 stub CreateDesktopW 0068 stub CreateDesktopW
0069 stdcall CreateDialogIndirectParamA(long ptr long ptr long) 0069 stdcall CreateDialogIndirectParamA(long ptr long ptr long) CreateDialogIndirectParam32A
USER32_CreateDialogIndirectParamA
0070 stub CreateDialogIndirectParamAorW 0070 stub CreateDialogIndirectParamAorW
0071 stdcall CreateDialogIndirectParamW(long ptr long ptr long) 0071 stdcall CreateDialogIndirectParamW(long ptr long ptr long) CreateDialogIndirectParam32W
USER32_CreateDialogIndirectParamW 0072 stdcall CreateDialogParamA(long ptr long ptr long) CreateDialogParam32A
0072 stdcall CreateDialogParamA(long ptr long ptr long) 0073 stdcall CreateDialogParamW(long ptr long ptr long) CreateDialogParam32W
USER32_CreateDialogParamA
0073 stdcall CreateDialogParamW(long ptr long ptr long)
USER32_CreateDialogParamW
0074 stub CreateIcon 0074 stub CreateIcon
0075 stub CreateIconFromResource 0075 stub CreateIconFromResource
0076 stub CreateIconFromResourceEx 0076 stub CreateIconFromResourceEx
...@@ -127,8 +123,8 @@ base 1 ...@@ -127,8 +123,8 @@ base 1
0116 stub DdeSetUserHandle 0116 stub DdeSetUserHandle
0117 stub DdeUnaccessData 0117 stub DdeUnaccessData
0118 stub DdeUninitialize 0118 stub DdeUninitialize
0119 stub DefDlgProcA 0119 stdcall DefDlgProcA(long long long long) DefDlgProc32A
0120 stub DefDlgProcW 0120 stdcall DefDlgProcW(long long long long) DefDlgProc32W
0121 stdcall DefFrameProcA(long long long long long) DefFrameProc32A 0121 stdcall DefFrameProcA(long long long long long) DefFrameProc32A
0122 stdcall DefFrameProcW(long long long long long) DefFrameProc32W 0122 stdcall DefFrameProcW(long long long long long) DefFrameProc32W
0123 stdcall DefMDIChildProcA(long long long long) DefMDIChildProc32A 0123 stdcall DefMDIChildProcA(long long long long) DefMDIChildProc32A
...@@ -143,13 +139,11 @@ base 1 ...@@ -143,13 +139,11 @@ base 1
0132 stub DestroyIcon 0132 stub DestroyIcon
0133 stub DestroyMenu 0133 stub DestroyMenu
0134 stub DestroyWindow 0134 stub DestroyWindow
0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) 0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A
USER32_DialogBoxIndirectParamA
0136 stub DialogBoxIndirectParamAorW 0136 stub DialogBoxIndirectParamAorW
0137 stdcall DialogBoxIndirectParamW(long ptr long ptr long) 0137 stdcall DialogBoxIndirectParamW(long ptr long ptr long) DialogBoxIndirectParam32W
USER32_DialogBoxIndirectParamW 0138 stdcall DialogBoxParamA(long ptr long ptr long) DialogBoxParam32A
0138 stdcall DialogBoxParamA(long ptr long ptr long) USER32_DialogBoxParamA 0139 stdcall DialogBoxParamW(long ptr long ptr long) DialogBoxParam32W
0139 stdcall DialogBoxParamW(long ptr long ptr long) USER32_DialogBoxParamW
0140 stdcall DispatchMessageA(ptr) USER32_DispatchMessageA 0140 stdcall DispatchMessageA(ptr) USER32_DispatchMessageA
0141 stub DispatchMessageW 0141 stub DispatchMessageW
0142 stub DlgDirListA 0142 stub DlgDirListA
...@@ -314,8 +308,8 @@ base 1 ...@@ -314,8 +308,8 @@ base 1
0301 stdcall GetWindow(long long) GetWindow 0301 stdcall GetWindow(long long) GetWindow
0302 stub GetWindowContextHelpId 0302 stub GetWindowContextHelpId
0303 stdcall GetWindowDC(long) GetWindowDC 0303 stdcall GetWindowDC(long) GetWindowDC
0304 stub GetWindowLongA 0304 stdcall GetWindowLongA(long long) GetWindowLong32A
0305 stub GetWindowLongW 0305 stdcall GetWindowLongW(long long) GetWindowLong32W
0306 stdcall GetWindowPlacement(long ptr) GetWindowPlacement32 0306 stdcall GetWindowPlacement(long ptr) GetWindowPlacement32
0307 stdcall GetWindowRect(long ptr) GetWindowRect32 0307 stdcall GetWindowRect(long ptr) GetWindowRect32
0308 stdcall GetWindowTextA(long ptr long) GetWindowText32A 0308 stdcall GetWindowTextA(long ptr long) GetWindowText32A
......
...@@ -7,7 +7,7 @@ type win16 ...@@ -7,7 +7,7 @@ type win16
5 pascal ComboBoxWndProc(word word word long) ComboBoxWndProc 5 pascal ComboBoxWndProc(word word word long) ComboBoxWndProc
6 pascal EditWndProc(word word word long) EditWndProc 6 pascal EditWndProc(word word word long) EditWndProc
7 pascal PopupMenuWndProc(word word word long) PopupMenuWndProc 7 pascal PopupMenuWndProc(word word word long) PopupMenuWndProc
9 pascal DefDlgProc(word word word long) DefDlgProc 9 pascal DefDlgProc(word word word long) DefDlgProc16
10 pascal MDIClientWndProc(word word word long) MDIClientWndProc 10 pascal MDIClientWndProc(word word word long) MDIClientWndProc
13 pascal SystemMessageBoxProc(word word word long) SystemMessageBoxProc 13 pascal SystemMessageBoxProc(word word word long) SystemMessageBoxProc
14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc 14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc
......
name wprocs32
type win32
2 stdcall StaticWndProc(long long long long) StaticWndProc32
3 stdcall ScrollBarWndProc(long long long long) ScrollBarWndProc32
4 stdcall ListBoxWndProc(long long long long) ListBoxWndProc32
5 stdcall ComboBoxWndProc(long long long long) ComboBoxWndProc32
6 stdcall EditWndProc(long long long long) EditWndProc32
7 stdcall PopupMenuWndProc(long long long long) PopupMenuWndProc32
9 stdcall DefDlgProc(long long long long) DefDlgProc32
10 stdcall MDIClientWndProc(long long long long) MDIClientWndProc32
11 stdcall DefWindowProc(long long long long) DefWindowProc32A
13 stdcall SystemMessageBoxProc(long long long long) SystemMessageBoxProc32
14 stdcall FileOpenDlgProc(long long long long) FileOpenDlgProc32
15 stdcall FileSaveDlgProc(long long long long) FileSaveDlgProc32
16 stdcall ColorDlgProc(long long long long) ColorDlgProc32
17 stdcall FindTextDlgProc(long long long long) FindTextDlgProc32
18 stdcall ReplaceTextDlgProc(long long long long) ReplaceTextDlgProc32
19 stdcall PrintSetupDlgProc(long long long long) PrintSetupDlgProc32
20 stdcall PrintDlgProc(long long long long) PrintDlgProc32
21 stdcall AboutDlgProc(long long long long) AboutDlgProc32
22 stdcall ComboLBoxWndProc(long long long long) ComboLBoxWndProc32
23 stdcall CARET_Callback(long long long long) CARET_Callback
...@@ -39,7 +39,7 @@ extern GC BITMAP_monoGC, BITMAP_colorGC; ...@@ -39,7 +39,7 @@ extern GC BITMAP_monoGC, BITMAP_colorGC;
extern BOOL BITMAP_Init(void); extern BOOL BITMAP_Init(void);
extern int BITMAP_GetObject( BITMAPOBJ * bmp, int count, LPSTR buffer ); extern int BITMAP_GetObject( BITMAPOBJ * bmp, int count, LPSTR buffer );
extern BOOL BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bitmap ); extern BOOL BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bitmap );
extern HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap, extern HBITMAP BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
BITMAPOBJ * bmp ); BITMAPOBJ * bmp );
/* objects/dib.c */ /* objects/dib.c */
......
...@@ -27,7 +27,6 @@ typedef struct ...@@ -27,7 +27,6 @@ typedef struct
extern BOOL BRUSH_Init(void); extern BOOL BRUSH_Init(void);
extern int BRUSH_GetObject( BRUSHOBJ * brush, int count, LPSTR buffer ); extern int BRUSH_GetObject( BRUSHOBJ * brush, int count, LPSTR buffer );
extern BOOL BRUSH_DeleteObject( HBRUSH hbrush, BRUSHOBJ * brush ); extern BOOL BRUSH_DeleteObject( HBRUSH hbrush, BRUSHOBJ * brush );
extern HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, extern HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush );
BRUSHOBJ * brush );
#endif /* __WINE_BRUSH_H */ #endif /* __WINE_BRUSH_H */
...@@ -34,6 +34,7 @@ extern LONG CallTo16_long_wwl ( FARPROC, WORD, WORD, WORD, LONG ); ...@@ -34,6 +34,7 @@ extern LONG CallTo16_long_wwl ( FARPROC, WORD, WORD, WORD, LONG );
extern WORD CallTo16_word_llwl ( FARPROC, WORD, LONG, LONG, WORD, LONG ); extern WORD CallTo16_word_llwl ( FARPROC, WORD, LONG, LONG, WORD, LONG );
extern LONG CallTo16_long_wwwl ( FARPROC, WORD, WORD, WORD, WORD, LONG ); extern LONG CallTo16_long_wwwl ( FARPROC, WORD, WORD, WORD, WORD, LONG );
extern WORD CallTo16_word_lwww ( FARPROC, WORD, LONG, WORD, WORD, WORD ); extern WORD CallTo16_word_lwww ( FARPROC, WORD, LONG, WORD, WORD, WORD );
extern WORD CallTo16_word_wwll ( FARPROC, WORD, WORD, WORD, LONG, LONG);
extern WORD CallTo16_word_wllwl( FARPROC, WORD, WORD, LONG, LONG, WORD, LONG ); extern WORD CallTo16_word_wllwl( FARPROC, WORD, WORD, LONG, LONG, WORD, LONG );
extern WORD CallTo16_word_wwlll( FARPROC, WORD, WORD, WORD, LONG, LONG, LONG ); extern WORD CallTo16_word_wwlll( FARPROC, WORD, WORD, WORD, LONG, LONG, LONG );
extern LONG CallTo16_long_lllllllwlwwwl( FARPROC, WORD, LONG, LONG, LONG, extern LONG CallTo16_long_lllllllwlwwwl( FARPROC, WORD, LONG, LONG, LONG,
...@@ -71,6 +72,8 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax, ...@@ -71,6 +72,8 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax,
CallTo16_long_wwwl( func, ds, hwnd, msg, wParam, lParam ) CallTo16_long_wwwl( func, ds, hwnd, msg, wParam, lParam )
#define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \ #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \
CallTo16_word_lwww( func, CURRENT_DS, lpch, ichCurrent, cch, code ) CallTo16_word_lwww( func, CURRENT_DS, lpch, ichCurrent, cch, code )
#define CallDCHookProc( func, hdc, code, data, lparam) \
CallTo16_word_wwll( func, CURRENT_DS, hdc, code, data, lparam )
#define CallWndProcNCCREATE16( func, ds, exStyle, clsName, winName, style, \ #define CallWndProcNCCREATE16( func, ds, exStyle, clsName, winName, style, \
x, y, cx, cy, hparent, hmenu, instance, \ x, y, cx, cy, hparent, hmenu, instance, \
params, hwnd, msg, wParam, lParam ) \ params, hwnd, msg, wParam, lParam ) \
...@@ -124,6 +127,8 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD ); ...@@ -124,6 +127,8 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
(*func)( hwnd, msg, wParam, lParam ) (*func)( hwnd, msg, wParam, lParam )
#define CallWndProc32( func, hwnd, msg, wParam, lParam ) \ #define CallWndProc32( func, hwnd, msg, wParam, lParam ) \
(*func)( hwnd, msg, wParam, lParam ) (*func)( hwnd, msg, wParam, lParam )
#define CallDCHookProc( func, hdc, code, data, lparam ) \
(*func)( hdc, code, data, lparam )
#define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \ #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \
(*func)( lpch, ichCurrent, cch, code ) (*func)( lpch, ichCurrent, cch, code )
......
...@@ -17,7 +17,7 @@ typedef struct tagCLASS ...@@ -17,7 +17,7 @@ typedef struct tagCLASS
UINT32 magic; /* Magic number */ UINT32 magic; /* Magic number */
UINT32 cWindows; /* Count of existing windows */ UINT32 cWindows; /* Count of existing windows */
UINT32 style; /* Class style */ UINT32 style; /* Class style */
WNDPROC16 lpfnWndProc; /* Window procedure */ HANDLE32 winproc; /* Window procedure */
INT32 cbClsExtra; /* Class extra bytes */ INT32 cbClsExtra; /* Class extra bytes */
INT32 cbWndExtra; /* Window extra bytes */ INT32 cbWndExtra; /* Window extra bytes */
LPSTR menuNameA; /* Default menu name (ASCII string) */ LPSTR menuNameA; /* Default menu name (ASCII string) */
......
#ifndef __WINE_CLIPBOARD_H #ifndef __WINE_CLIPBOARD_H
#define __WINE_CLIPBOARD_H #define __WINE_CLIPBOARD_H
extern void CLIPBOARD_ReadSelection(Window w,Atom prop); void CLIPBOARD_ReadSelection(Window w,Atom prop);
void CLIPBOARD_ReleaseSelection(HWND hwnd); void CLIPBOARD_ReleaseSelection(HWND hwnd);
void CLIPBOARD_DisOwn(HWND hWnd);
BOOL CLIPBOARD_IsPresent(WORD wFormat);
#endif /* __WINE_CLIPBOARD_H */ #endif /* __WINE_CLIPBOARD_H */
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
* COMMDLG - Common Wine Dialog ... :-) * COMMDLG - Common Wine Dialog ... :-)
*/ */
#ifndef COMMDLG_H #ifndef __WINE_COMMDLG_H
#define COMMDLG_H #define __WINE_COMMDLG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "wintypes.h" /* needed for CHOOSEFONT structure */ #include "wintypes.h" /* needed for CHOOSEFONT structure */
...@@ -87,7 +91,7 @@ typedef struct { ...@@ -87,7 +91,7 @@ typedef struct {
DWORD Flags; DWORD Flags;
LPARAM lCustData; LPARAM lCustData;
UINT (*lpfnHook)(HWND, UINT, WPARAM, LPARAM); UINT (*lpfnHook)(HWND, UINT, WPARAM, LPARAM);
LPCSTR lpTemplateName; SEGPTR lpTemplateName;
} CHOOSECOLOR; } CHOOSECOLOR;
typedef CHOOSECOLOR *LPCHOOSECOLOR; typedef CHOOSECOLOR *LPCHOOSECOLOR;
...@@ -306,6 +310,8 @@ LRESULT FormatCharDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); ...@@ -306,6 +310,8 @@ LRESULT FormatCharDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
#pragma pack(4) #pragma pack(4)
#endif #endif
#endif /* #ifdef COMMDLG_H */ #ifdef __cplusplus
}
#endif
#endif /* __WINE_COMMDLG_H */
...@@ -10,11 +10,12 @@ ...@@ -10,11 +10,12 @@
#include "gdi.h" #include "gdi.h"
extern void DC_InitDC( HDC hdc ); extern void DC_InitDC( DC* dc );
extern BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ); extern BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors );
extern BOOL DC_SetupGCForBrush( DC * dc ); extern BOOL DC_SetupGCForBrush( DC * dc );
extern BOOL DC_SetupGCForPen( DC * dc ); extern BOOL DC_SetupGCForPen( DC * dc );
extern BOOL DC_SetupGCForText( DC * dc ); extern BOOL DC_SetupGCForText( DC * dc );
extern BOOL DC_CallHookProc( DC * dc, WORD code, LPARAM lParam );
extern const int DC_XROPfunction[]; extern const int DC_XROPfunction[];
......
...@@ -9,6 +9,21 @@ ...@@ -9,6 +9,21 @@
#include "windows.h" #include "windows.h"
/* additional DCX flags
*/
#define DCX_NORESETATTR 0x00000004
#define DCX_EXCLUDEUPDATE 0x00000100
#define DCX_INTERSECTUPDATE 0x00000200
#define DCX_LOCKWINDOWUPDATE 0x00000400
#define DCX_NORECOMPUTE 0x00100000
#define DCX_VALIDATE 0x00200000
#define DCX_DCEBUSY 0x00001000
#define DCX_WINDOWPAINT 0x00020000
#define DCX_KEEPCLIPRGN 0x00040000
#define DCX_NOCLIPCHILDREN 0x00080000
typedef enum typedef enum
{ {
DCE_CACHE_DC, /* This is a cached DC (allocated by USER) */ DCE_CACHE_DC, /* This is a cached DC (allocated by USER) */
...@@ -20,17 +35,17 @@ typedef enum ...@@ -20,17 +35,17 @@ typedef enum
typedef struct tagDCE typedef struct tagDCE
{ {
HANDLE hNext; HANDLE hNext;
HDC hDC;
HWND hwndCurrent; HWND hwndCurrent;
HDC hdc; HWND hwndDC;
HRGN hClipRgn;
DCE_TYPE type; DCE_TYPE type;
BOOL inUse; DWORD DCXflags;
WORD xOrigin;
WORD yOrigin;
} DCE; } DCE;
extern void DCE_Init(void); extern void DCE_Init(void);
extern HANDLE DCE_AllocDCE( DCE_TYPE type ); extern HANDLE DCE_AllocDCE( HWND hWnd, DCE_TYPE type );
extern void DCE_FreeDCE( HANDLE hdce ); extern void DCE_FreeDCE( HANDLE hdce );
#endif /* DCE_H */ #endif /* DCE_H */
...@@ -9,19 +9,14 @@ ...@@ -9,19 +9,14 @@
#include "windows.h" #include "windows.h"
extern BOOL DIALOG_Init(void);
extern HWND DIALOG_GetFirstTabItem( HWND hwndDlg );
#pragma pack(1)
/* Dialog info structure. /* Dialog info structure.
* This structure is stored into the window extra bytes (cbWndExtra). * This structure is stored into the window extra bytes (cbWndExtra).
* sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30). * sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30).
*/ */
typedef struct typedef struct
{ {
LONG msgResult; /* Result of EndDialog() / Default button id */ INT32 msgResult; /* Result of EndDialog() / Default button id */
WNDPROC dlgProc; /* Dialog procedure */ HANDLE32 dlgProc; /* Dialog procedure */
LONG userInfo; /* User information (for DWL_USER) */ LONG userInfo; /* User information (for DWL_USER) */
HWND hwndFocus; /* Current control with focus */ HWND hwndFocus; /* Current control with focus */
HFONT hUserFont; /* Dialog font */ HFONT hUserFont; /* Dialog font */
...@@ -32,38 +27,7 @@ typedef struct ...@@ -32,38 +27,7 @@ typedef struct
HANDLE hDialogHeap; HANDLE hDialogHeap;
} DIALOGINFO; } DIALOGINFO;
extern BOOL DIALOG_Init(void);
/* Dialog control header */ extern HWND DIALOG_GetFirstTabItem( HWND hwndDlg );
typedef struct
{
DWORD style;
WORD x;
WORD y;
WORD cx;
WORD cy;
WORD id;
} DLGCONTROLHEADER;
/* Dialog template */
typedef struct
{
DWORD style;
WORD nbItems;
WORD x;
WORD y;
WORD cx;
WORD cy;
SEGPTR menuName;
SEGPTR className;
SEGPTR caption;
WORD pointSize;
SEGPTR faceName;
} DLGTEMPLATE;
#pragma pack(4)
extern WORD xBaseUnit,yBaseUnit;
int DIALOG_DoDialogBox( HWND hwnd, HWND owner );
#endif /* DIALOG_H */ #endif /* DIALOG_H */
...@@ -185,6 +185,9 @@ typedef struct tagDC ...@@ -185,6 +185,9 @@ typedef struct tagDC
{ {
GDIOBJHDR header; GDIOBJHDR header;
WORD saveLevel; WORD saveLevel;
DWORD dwHookData;
FARPROC16 hookProc;
HDC hSelf;
WIN_DC_INFO w; WIN_DC_INFO w;
union union
{ {
...@@ -193,9 +196,18 @@ typedef struct tagDC ...@@ -193,9 +196,18 @@ typedef struct tagDC
} u; } u;
} DC; } DC;
/* DC hook codes */
#define DCHC_INVALIDVISRGN 0x0001
#define DCHC_DELETEDC 0x0002
#define DCHF_INVALIDATEVISRGN 0x0001
#define DCHF_VALIDATEVISRGN 0x0002
/* DC flags */ /* DC flags */
#define DC_MEMORY 1 /* It is a memory DC */ #define DC_MEMORY 0x0001 /* It is a memory DC */
#define DC_SAVED 2 /* It is a saved DC */ #define DC_SAVED 0x0002 /* It is a saved DC */
#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
/* Last 32 bytes are reserved for stock object handles */ /* Last 32 bytes are reserved for stock object handles */
#define GDI_HEAP_SIZE 0xffe0 #define GDI_HEAP_SIZE 0xffe0
...@@ -267,6 +279,10 @@ extern BOOL GDI_Init(void); ...@@ -267,6 +279,10 @@ extern BOOL GDI_Init(void);
extern HANDLE GDI_AllocObject( WORD, WORD ); extern HANDLE GDI_AllocObject( WORD, WORD );
extern BOOL GDI_FreeObject( HANDLE ); extern BOOL GDI_FreeObject( HANDLE );
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD ); extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern FARPROC16 GDI_GetDefDCHook(void);
#define UpdateDirtyDC(dc) \
DC_CallHookProc(dc, DCHC_INVALIDVISRGN, 0)
extern Display * display; extern Display * display;
extern Screen * screen; extern Screen * screen;
......
...@@ -119,4 +119,6 @@ typedef struct ...@@ -119,4 +119,6 @@ typedef struct
#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200
#define FILE_ATTRIBUTE_XACTION_WRITE 0x0400 #define FILE_ATTRIBUTE_XACTION_WRITE 0x0400
BOOL SetTimeZoneInformation(const TIME_ZONE_INFORMATION*);
#endif /* __WINE_KERNEL32_H */ #endif /* __WINE_KERNEL32_H */
...@@ -127,7 +127,6 @@ extern WORD MODULE_GetOrdinal( HMODULE hModule, const char *name ); ...@@ -127,7 +127,6 @@ extern WORD MODULE_GetOrdinal( HMODULE hModule, const char *name );
extern SEGPTR MODULE_GetEntryPoint( HMODULE hModule, WORD ordinal ); extern SEGPTR MODULE_GetEntryPoint( HMODULE hModule, WORD ordinal );
extern BOOL MODULE_SetEntryPoint( HMODULE hModule, WORD ordinal, WORD offset ); extern BOOL MODULE_SetEntryPoint( HMODULE hModule, WORD ordinal, WORD offset );
extern FARPROC16 MODULE_GetWndProcEntry16( const char *name ); extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
extern FARPROC32 MODULE_GetWndProcEntry32( const char *name );
/* builtin.c */ /* builtin.c */
extern BOOL BUILTIN_Init(void); extern BOOL BUILTIN_Init(void);
......
...@@ -35,16 +35,6 @@ typedef struct { ...@@ -35,16 +35,6 @@ typedef struct {
WORD cy WINE_PACKED; WORD cy WINE_PACKED;
} DLGTEMPLATE32; } DLGTEMPLATE32;
typedef struct {
DWORD style;
DWORD dwExtendedStyle;
short x WINE_PACKED;
short y WINE_PACKED;
short cx WINE_PACKED;
short cy WINE_PACKED;
WORD id WINE_PACKED;
} DLGITEMTEMPLATE32;
typedef struct tagMSG32 typedef struct tagMSG32
{ {
DWORD hwnd; DWORD hwnd;
......
...@@ -34,10 +34,10 @@ typedef struct tagWND ...@@ -34,10 +34,10 @@ typedef struct tagWND
struct tagWND *parent; /* Window parent (from CreateWindow) */ struct tagWND *parent; /* Window parent (from CreateWindow) */
struct tagWND *owner; /* Window owner */ struct tagWND *owner; /* Window owner */
CLASS *class; /* Window class */ CLASS *class; /* Window class */
HANDLE32 winproc; /* Window procedure */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
HWND16 hwndSelf; /* Handle of this window */ HWND16 hwndSelf; /* Handle of this window */
HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */ HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */
WNDPROC16 lpfnWndProc; /* Window procedure */
RECT16 rectClient; /* Client area rel. to parent client area */ RECT16 rectClient; /* Client area rel. to parent client area */
RECT16 rectWindow; /* Whole window rel. to parent client area */ RECT16 rectWindow; /* Whole window rel. to parent client area */
RECT16 rectNormal; /* Window rect. when in normal state */ RECT16 rectNormal; /* Window rect. when in normal state */
...@@ -57,6 +57,7 @@ typedef struct tagWND ...@@ -57,6 +57,7 @@ typedef struct tagWND
Window window; /* X window (only for top-level windows) */ Window window; /* X window (only for top-level windows) */
HMENU hSysMenu; /* window's copy of System Menu */ HMENU hSysMenu; /* window's copy of System Menu */
HANDLE hProp; /* Handle of Properties List */ HANDLE hProp; /* Handle of Properties List */
DWORD userdata; /* User private data */
DWORD wExtra[1]; /* Window extra bytes */ DWORD wExtra[1]; /* Window extra bytes */
} WND; } WND;
......
/* Initial draft attempt of windows.h, by Peter MacDonald, pmacdona@sanjuan.uvic.ca */ /* Initial draft attempt of windows.h, by Peter MacDonald, pmacdona@sanjuan.uvic.ca */
#ifndef WINDOWS_H #ifndef __WINE_WINDOWS_H
#define WINDOWS_H #define __WINE_WINDOWS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "wintypes.h" #include "wintypes.h"
#include "winuser.h" #include "winuser.h"
...@@ -544,8 +548,6 @@ typedef struct tagMSG ...@@ -544,8 +548,6 @@ typedef struct tagMSG
POINT16 pt WINE_PACKED; POINT16 pt WINE_PACKED;
} MSG, *LPMSG; } MSG, *LPMSG;
#define MAKEINTATOM(i) ((SEGPTR)MAKELONG((i),0))
/* Raster operations */ /* Raster operations */
#define R2_BLACK 1 #define R2_BLACK 1
...@@ -2795,6 +2797,17 @@ typedef struct { ...@@ -2795,6 +2797,17 @@ typedef struct {
DWORD dmDisplayFrequency; DWORD dmDisplayFrequency;
} DEVMODE; } DEVMODE;
typedef struct _SYSTEM_POWER_STATUS
{
BOOL ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE reserved;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
#ifndef WINELIB #ifndef WINELIB
#pragma pack(4) #pragma pack(4)
#endif #endif
...@@ -2863,10 +2876,6 @@ HANDLE CreateCursorIconIndirect(HANDLE,CURSORICONINFO*,const BYTE*,const BYT ...@@ -2863,10 +2876,6 @@ HANDLE CreateCursorIconIndirect(HANDLE,CURSORICONINFO*,const BYTE*,const BYT
HDC CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*); HDC CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
HBRUSH CreateDIBPatternBrush(HGLOBAL,UINT); HBRUSH CreateDIBPatternBrush(HGLOBAL,UINT);
HBITMAP CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT); HBITMAP CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT);
HWND CreateDialog(HINSTANCE,SEGPTR,HWND,DLGPROC);
HWND CreateDialogIndirect(HINSTANCE,SEGPTR,HWND,DLGPROC);
HWND CreateDialogIndirectParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM);
HWND CreateDialogParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM);
HBITMAP CreateDiscardableBitmap(HDC,INT,INT); HBITMAP CreateDiscardableBitmap(HDC,INT,INT);
HRGN CreateEllipticRgn(INT32,INT32,INT32,INT32); HRGN CreateEllipticRgn(INT32,INT32,INT32,INT32);
HFONT CreateFont(INT,INT,INT,INT,INT,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR); HFONT CreateFont(INT,INT,INT,INT,INT,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR);
...@@ -2885,7 +2894,6 @@ HRGN CreateRectRgn(INT32,INT32,INT32,INT32); ...@@ -2885,7 +2894,6 @@ HRGN CreateRectRgn(INT32,INT32,INT32,INT32);
HRGN CreateRoundRectRgn(INT32,INT32,INT32,INT32,INT32,INT32); HRGN CreateRoundRectRgn(INT32,INT32,INT32,INT32,INT32,INT32);
HBRUSH CreateSolidBrush(COLORREF); HBRUSH CreateSolidBrush(COLORREF);
void DebugBreak(void); void DebugBreak(void);
LRESULT DefDlgProc(HWND,UINT,WPARAM,LPARAM);
DWORD DefHookProc(short,WORD,DWORD,HHOOK*); DWORD DefHookProc(short,WORD,DWORD,HHOOK*);
HDWP16 DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT); HDWP16 DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT);
ATOM DeleteAtom(ATOM); ATOM DeleteAtom(ATOM);
...@@ -2898,10 +2906,6 @@ BOOL DestroyCursor(HCURSOR); ...@@ -2898,10 +2906,6 @@ BOOL DestroyCursor(HCURSOR);
BOOL DestroyIcon(HICON); BOOL DestroyIcon(HICON);
BOOL DestroyMenu(HMENU); BOOL DestroyMenu(HMENU);
BOOL DestroyWindow(HWND); BOOL DestroyWindow(HWND);
INT DialogBox(HINSTANCE,SEGPTR,HWND,DLGPROC);
INT DialogBoxIndirect(HINSTANCE,HANDLE,HWND,DLGPROC);
INT DialogBoxIndirectParam(HINSTANCE,HANDLE,HWND,DLGPROC,LONG);
INT DialogBoxParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LONG);
HANDLE DirectResAlloc(HANDLE,WORD,WORD); HANDLE DirectResAlloc(HANDLE,WORD,WORD);
void DirectedYield(HTASK); void DirectedYield(HTASK);
LONG DispatchMessage(const MSG*); LONG DispatchMessage(const MSG*);
...@@ -2920,7 +2924,6 @@ BOOL EnableMenuItem(HMENU,UINT,UINT); ...@@ -2920,7 +2924,6 @@ BOOL EnableMenuItem(HMENU,UINT,UINT);
BOOL EnableScrollBar(HWND,UINT,UINT); BOOL EnableScrollBar(HWND,UINT,UINT);
BOOL EnableWindow(HWND,BOOL); BOOL EnableWindow(HWND,BOOL);
BOOL EndDeferWindowPos(HDWP16); BOOL EndDeferWindowPos(HDWP16);
BOOL EndDialog(HWND,INT);
BOOL EnumChildWindows(HWND,WNDENUMPROC,LPARAM); BOOL EnumChildWindows(HWND,WNDENUMPROC,LPARAM);
UINT EnumClipboardFormats(UINT); UINT EnumClipboardFormats(UINT);
INT EnumFontFamilies(HDC,LPCSTR,FONTENUMPROC,LPARAM); INT EnumFontFamilies(HDC,LPCSTR,FONTENUMPROC,LPARAM);
...@@ -2989,6 +2992,7 @@ DWORD GetCurrentTime(void); ...@@ -2989,6 +2992,7 @@ DWORD GetCurrentTime(void);
HCURSOR GetCursor(void); HCURSOR GetCursor(void);
HDC GetDC(HWND); HDC GetDC(HWND);
HDC GetDCEx(HWND,HRGN,DWORD); HDC GetDCEx(HWND,HRGN,DWORD);
DWORD GetDCHook(HDC,FARPROC16*);
DWORD GetDCOrg(HDC); DWORD GetDCOrg(HDC);
HDC GetDCState(HDC); HDC GetDCState(HDC);
int GetDIBits(HDC,HANDLE,WORD,WORD,LPSTR,LPBITMAPINFO,WORD); int GetDIBits(HDC,HANDLE,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
...@@ -3071,6 +3075,7 @@ HMENU GetSystemMenu(HWND,BOOL); ...@@ -3071,6 +3075,7 @@ HMENU GetSystemMenu(HWND,BOOL);
int GetSystemMetrics(WORD); int GetSystemMetrics(WORD);
WORD GetSystemPaletteEntries(HDC,WORD,WORD,LPPALETTEENTRY); WORD GetSystemPaletteEntries(HDC,WORD,WORD,LPPALETTEENTRY);
WORD GetSystemPaletteUse(HDC); WORD GetSystemPaletteUse(HDC);
BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
VOID GetSystemTime(LPSYSTEMTIME); /* Win32 */ VOID GetSystemTime(LPSYSTEMTIME); /* Win32 */
DWORD GetTabbedTextExtent(HDC,LPSTR,int,int,LPINT16); DWORD GetTabbedTextExtent(HDC,LPSTR,int,int,LPINT16);
HINSTANCE GetTaskDS(void); HINSTANCE GetTaskDS(void);
...@@ -3247,6 +3252,7 @@ BOOL SetConvertParams(int,int); ...@@ -3247,6 +3252,7 @@ BOOL SetConvertParams(int,int);
BOOL32 SetCurrentDirectory(LPCSTR); BOOL32 SetCurrentDirectory(LPCSTR);
HCURSOR SetCursor(HCURSOR); HCURSOR SetCursor(HCURSOR);
void SetCursorPos(short,short); void SetCursorPos(short,short);
BOOL SetDCHook(HDC,FARPROC16,DWORD);
void SetDCState(HDC,HDC); void SetDCState(HDC,HDC);
int SetDIBits(HDC,HANDLE,WORD,WORD,LPSTR,LPBITMAPINFO,WORD); int SetDIBits(HDC,HANDLE,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
int SetDIBitsToDevice(HDC,short,short,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD); int SetDIBitsToDevice(HDC,short,short,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
...@@ -3257,6 +3263,7 @@ int SetEnvironment(LPSTR,LPSTR,WORD); ...@@ -3257,6 +3263,7 @@ int SetEnvironment(LPSTR,LPSTR,WORD);
UINT SetErrorMode(UINT); UINT SetErrorMode(UINT);
HWND SetFocus(HWND); HWND SetFocus(HWND);
WORD SetHandleCount(WORD); WORD SetHandleCount(WORD);
WORD SetHookFlags(HDC,WORD);
void SetKeyboardState(BYTE*); void SetKeyboardState(BYTE*);
WORD SetMapMode(HDC,WORD); WORD SetMapMode(HDC,WORD);
DWORD SetMapperFlags(HDC,DWORD); DWORD SetMapperFlags(HDC,DWORD);
...@@ -3283,6 +3290,8 @@ LONG SetSwapAreaSize(WORD); ...@@ -3283,6 +3290,8 @@ LONG SetSwapAreaSize(WORD);
void SetSysColors(int,LPINT16,COLORREF*); void SetSysColors(int,LPINT16,COLORREF*);
HWND SetSysModalWindow(HWND); HWND SetSysModalWindow(HWND);
WORD SetSystemPaletteUse(HDC,WORD); WORD SetSystemPaletteUse(HDC,WORD);
BOOL SetSystemPowerState(BOOL, BOOL);
BOOL SetSystemTime(const SYSTEMTIME*);
WORD SetSystemTimer(HWND,WORD,WORD,FARPROC); WORD SetSystemTimer(HWND,WORD,WORD,FARPROC);
HQUEUE SetTaskQueue(HTASK,HQUEUE); HQUEUE SetTaskQueue(HTASK,HQUEUE);
WORD SetTextAlign(HDC,WORD); WORD SetTextAlign(HDC,WORD);
...@@ -3332,6 +3341,7 @@ void UnlockSegment(HGLOBAL); ...@@ -3332,6 +3341,7 @@ void UnlockSegment(HGLOBAL);
BOOL UnrealizeObject(HBRUSH); BOOL UnrealizeObject(HBRUSH);
int UpdateColors(HDC); int UpdateColors(HDC);
void UpdateWindow(HWND32); void UpdateWindow(HWND32);
void UserYield(void);
void ValidateCodeSegments(void); void ValidateCodeSegments(void);
LPSTR ValidateFreeSpaces(void); LPSTR ValidateFreeSpaces(void);
void ValidateRgn(HWND32,HRGN32); void ValidateRgn(HWND32,HRGN32);
...@@ -3370,13 +3380,13 @@ int wvsprintf(LPSTR,LPCSTR,LPCSTR); ...@@ -3370,13 +3380,13 @@ int wvsprintf(LPSTR,LPCSTR,LPCSTR);
/* Declarations for functions that are the same in Win16 and Win32 */ /* Declarations for functions that are the same in Win16 and Win32 */
BOOL16 EndDialog(HWND32,INT32);
INT16 ExcludeUpdateRgn(HDC32,HWND32); INT16 ExcludeUpdateRgn(HDC32,HWND32);
void FillWindow(HWND16,HWND16,HDC16,HBRUSH16); void FillWindow(HWND16,HWND16,HDC16,HBRUSH16);
DWORD GetBitmapDimension(HBITMAP16); DWORD GetBitmapDimension(HBITMAP16);
WORD GetClassWord(HWND32,INT32); WORD GetClassWord(HWND32,INT32);
DWORD GetLogicalDrives(void); DWORD GetLogicalDrives(void);
INT16 GetUpdateRgn(HWND32,HRGN32,BOOL32); INT16 GetUpdateRgn(HWND32,HRGN32,BOOL32);
LONG GetWindowLong(HWND32,INT32);
WORD GetWindowWord(HWND32,INT32); WORD GetWindowWord(HWND32,INT32);
INT16 OffsetRgn(HRGN32,INT32,INT32); INT16 OffsetRgn(HRGN32,INT32,INT32);
DWORD OffsetViewportOrg(HDC16,INT16,INT16); DWORD OffsetViewportOrg(HDC16,INT16,INT16);
...@@ -3429,6 +3439,26 @@ BOOL32 ClipCursor32(const RECT32*); ...@@ -3429,6 +3439,26 @@ BOOL32 ClipCursor32(const RECT32*);
BOOL16 CopyRect16(RECT16*,const RECT16*); BOOL16 CopyRect16(RECT16*,const RECT16*);
BOOL32 CopyRect32(RECT32*,const RECT32*); BOOL32 CopyRect32(RECT32*,const RECT32*);
#define CopyRect WINELIB_NAME(CopyRect) #define CopyRect WINELIB_NAME(CopyRect)
HWND16 CreateDialog16(HINSTANCE16,SEGPTR,HWND16,DLGPROC);
#define CreateDialog32A(inst,ptr,hwnd,dlg) \
CreateDialogParam32A(inst,ptr,hwnd,dlg,0)
#define CreateDialog32W(inst,ptr,hwnd,dlg) \
CreateDialogParam32W(inst,ptr,hwnd,dlg,0)
#define CreateDialog WINELIB_NAME_AW(CreateDialog)
HWND16 CreateDialogIndirect16(HINSTANCE16,LPCVOID,HWND16,DLGPROC);
#define CreateDialogIndirect32A(inst,ptr,hwnd,dlg) \
CreateDialogIndirectParam32A(inst,ptr,hwnd,dlg,0)
#define CreateDialogIndirect32W(inst,ptr,hwnd,dlg) \
CreateDialogIndirectParam32W(inst,ptr,hwnd,dlg,0)
#define CreateDialogIndirect WINELIB_NAME_AW(CreateDialogIndirect)
HWND16 CreateDialogIndirectParam16(HINSTANCE16,LPCVOID,HWND16,DLGPROC,LPARAM);
HWND32 CreateDialogIndirectParam32A(HINSTANCE32,LPCVOID,HWND32,DLGPROC,LPARAM);
HWND32 CreateDialogIndirectParam32W(HINSTANCE32,LPCVOID,HWND32,DLGPROC,LPARAM);
#define CreateDialogIndirectParam WINELIB_NAME_AW(CreateDialogIndirectParam)
HWND16 CreateDialogParam16(HINSTANCE16,SEGPTR,HWND16,DLGPROC,LPARAM);
HWND32 CreateDialogParam32A(HINSTANCE32,LPCSTR,HWND32,DLGPROC,LPARAM);
HWND32 CreateDialogParam32W(HINSTANCE32,LPCWSTR,HWND32,DLGPROC,LPARAM);
#define CreateDialogParam WINELIB_NAME_AW(CreateDialogParam)
HRGN16 CreateEllipticRgnIndirect16(const RECT16 *); HRGN16 CreateEllipticRgnIndirect16(const RECT16 *);
HRGN32 CreateEllipticRgnIndirect32(const RECT32 *); HRGN32 CreateEllipticRgnIndirect32(const RECT32 *);
#define CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect) #define CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect)
...@@ -3441,7 +3471,7 @@ HRGN32 CreatePolygonRgn32(const POINT32*,INT32,INT32); ...@@ -3441,7 +3471,7 @@ HRGN32 CreatePolygonRgn32(const POINT32*,INT32,INT32);
HRGN16 CreateRectRgnIndirect16(const RECT16*); HRGN16 CreateRectRgnIndirect16(const RECT16*);
HRGN32 CreateRectRgnIndirect32(const RECT32*); HRGN32 CreateRectRgnIndirect32(const RECT32*);
#define CreateRectRgnIndirect WINELIB_NAME(CreateRectRgnIndirect) #define CreateRectRgnIndirect WINELIB_NAME(CreateRectRgnIndirect)
HWND16 CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR); HWND16 CreateWindow16(LPCSTR,LPCSTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,LPVOID);
#define CreateWindow32A(className,titleName,style,x,y,width,height,\ #define CreateWindow32A(className,titleName,style,x,y,width,height,\
parent,menu,instance,param) \ parent,menu,instance,param) \
CreateWindowEx32A(0,className,titleName,style,x,y,width,height,\ CreateWindowEx32A(0,className,titleName,style,x,y,width,height,\
...@@ -3451,10 +3481,14 @@ HWND16 CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HME ...@@ -3451,10 +3481,14 @@ HWND16 CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HME
CreateWindowEx32W(0,className,titleName,style,x,y,width,height,\ CreateWindowEx32W(0,className,titleName,style,x,y,width,height,\
parent,menu,instance,param) parent,menu,instance,param)
#define CreateWindow WINELIB_NAME_AW(CreateWindow) #define CreateWindow WINELIB_NAME_AW(CreateWindow)
HWND16 CreateWindowEx16(DWORD,SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR); HWND16 CreateWindowEx16(DWORD,LPCSTR,LPCSTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,LPVOID);
HWND32 CreateWindowEx32A(DWORD,LPCSTR,LPCSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID); HWND32 CreateWindowEx32A(DWORD,LPCSTR,LPCSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID);
HWND32 CreateWindowEx32W(DWORD,LPCWSTR,LPCWSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID); HWND32 CreateWindowEx32W(DWORD,LPCWSTR,LPCWSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID);
#define CreateWindowEx WINELIB_NAME_AW(CreateWindowEx) #define CreateWindowEx WINELIB_NAME_AW(CreateWindowEx)
LRESULT DefDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
LRESULT DefDlgProc32A(HWND32,UINT32,WPARAM32,LPARAM);
LRESULT DefDlgProc32W(HWND32,UINT32,WPARAM32,LPARAM);
#define DefDlgProc WINELIB_NAME_AW(DefDlgProc)
LRESULT DefFrameProc16(HWND16,HWND16,UINT16,WPARAM16,LPARAM); LRESULT DefFrameProc16(HWND16,HWND16,UINT16,WPARAM16,LPARAM);
LRESULT DefFrameProc32A(HWND32,HWND32,UINT32,WPARAM32,LPARAM); LRESULT DefFrameProc32A(HWND32,HWND32,UINT32,WPARAM32,LPARAM);
LRESULT DefFrameProc32W(HWND32,HWND32,UINT32,WPARAM32,LPARAM); LRESULT DefFrameProc32W(HWND32,HWND32,UINT32,WPARAM32,LPARAM);
...@@ -3467,6 +3501,26 @@ LRESULT DefWindowProc16(HWND16,UINT16,WPARAM16,LPARAM); ...@@ -3467,6 +3501,26 @@ LRESULT DefWindowProc16(HWND16,UINT16,WPARAM16,LPARAM);
LRESULT DefWindowProc32A(HWND32,UINT32,WPARAM32,LPARAM); LRESULT DefWindowProc32A(HWND32,UINT32,WPARAM32,LPARAM);
LRESULT DefWindowProc32W(HWND32,UINT32,WPARAM32,LPARAM); LRESULT DefWindowProc32W(HWND32,UINT32,WPARAM32,LPARAM);
#define DefWindowProc WINELIB_NAME_AW(DefWindowProc) #define DefWindowProc WINELIB_NAME_AW(DefWindowProc)
INT16 DialogBox16(HINSTANCE16,SEGPTR,HWND16,DLGPROC);
#define DialogBox32A(inst,template,owner,func) \
DialogBoxParam32A(inst,template,owner,func,0)
#define DialogBox32W(inst,template,owner,func) \
DialogBoxParam32W(inst,template,owner,func,0)
#define DialogBox WINELIB_NAME_AW(DialogBox)
INT16 DialogBoxIndirect16(HINSTANCE16,HANDLE16,HWND16,DLGPROC);
#define DialogBoxIndirect32A(inst,template,owner,func) \
DialogBoxIndirectParam32A(inst,template,owner,func,0)
#define DialogBoxIndirect32W(inst,template,owner,func) \
DialogBoxIndirectParam32W(inst,template,owner,func,0)
#define DialogBoxIndirect WINELIB_NAME_AW(DialogBoxIndirect)
INT16 DialogBoxIndirectParam16(HINSTANCE16,HANDLE16,HWND16,DLGPROC,LPARAM);
INT32 DialogBoxIndirectParam32A(HINSTANCE32,LPCVOID,HWND32,DLGPROC,LPARAM);
INT32 DialogBoxIndirectParam32W(HINSTANCE32,LPCVOID,HWND32,DLGPROC,LPARAM);
#define DialogBoxIndirectParam WINELIB_NAME_AW(DialogBoxIndirectParam)
INT16 DialogBoxParam16(HINSTANCE16,SEGPTR,HWND16,DLGPROC,LPARAM);
INT32 DialogBoxParam32A(HINSTANCE32,LPCSTR,HWND32,DLGPROC,LPARAM);
INT32 DialogBoxParam32W(HINSTANCE32,LPCWSTR,HWND32,DLGPROC,LPARAM);
#define DialogBoxParam WINELIB_NAME_AW(DialogBoxParam)
INT16 DlgDirListComboBox16(HWND16,LPCSTR,INT16,INT16,UINT16); INT16 DlgDirListComboBox16(HWND16,LPCSTR,INT16,INT16,UINT16);
INT32 DlgDirListComboBox32A(HWND32,LPCSTR,INT32,INT32,UINT32); INT32 DlgDirListComboBox32A(HWND32,LPCSTR,INT32,INT32,UINT32);
INT32 DlgDirListComboBox32W(HWND32,LPCWSTR,INT32,INT32,UINT32); INT32 DlgDirListComboBox32W(HWND32,LPCWSTR,INT32,INT32,UINT32);
...@@ -3574,6 +3628,10 @@ BOOL32 GetViewportOrgEx32(HDC32,LPPOINT32); ...@@ -3574,6 +3628,10 @@ BOOL32 GetViewportOrgEx32(HDC32,LPPOINT32);
BOOL16 GetWindowExtEx16(HDC16,LPPOINT16); BOOL16 GetWindowExtEx16(HDC16,LPPOINT16);
BOOL32 GetWindowExtEx32(HDC32,LPPOINT32); BOOL32 GetWindowExtEx32(HDC32,LPPOINT32);
#define GetWindowExtEx WINELIB_NAME(GetWindowExtEx) #define GetWindowExtEx WINELIB_NAME(GetWindowExtEx)
LONG GetWindowLong16(HWND16,INT16);
LONG GetWindowLong32A(HWND32,INT32);
LONG GetWindowLong32W(HWND32,INT32);
#define GetWindowLong WINELIB_NAME_AW(GetWindowLong)
BOOL16 GetWindowOrgEx16(HDC16,LPPOINT16); BOOL16 GetWindowOrgEx16(HDC16,LPPOINT16);
BOOL32 GetWindowOrgEx32(HDC32,LPPOINT32); BOOL32 GetWindowOrgEx32(HDC32,LPPOINT32);
#define GetWindowOrgEx WINELIB_NAME(GetWindowOrgEx) #define GetWindowOrgEx WINELIB_NAME(GetWindowOrgEx)
...@@ -3890,4 +3948,9 @@ HWND32 WindowFromPoint32(POINT32); ...@@ -3890,4 +3948,9 @@ HWND32 WindowFromPoint32(POINT32);
#ifdef WINELIB #ifdef WINELIB
#define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x) #define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x)
#endif #endif
#endif /* WINDOWS_H */
#ifdef __cplusplus
}
#endif
#endif /* __WINE_WINDOWS_H */
...@@ -17,9 +17,11 @@ typedef enum ...@@ -17,9 +17,11 @@ typedef enum
WIN_PROC_32W WIN_PROC_32W
} WINDOWPROCTYPE; } WINDOWPROCTYPE;
extern WNDPROC16 WINPROC_AllocWinProc( WNDPROC32 func, WINDOWPROCTYPE type ); extern HANDLE32 WINPROC_AllocWinProc( UINT32 func, WINDOWPROCTYPE type );
extern WINDOWPROCTYPE WINPROC_GetWinProcType( WNDPROC16 func ); extern HANDLE32 WINPROC_CopyWinProc( HANDLE32 handle );
extern WNDPROC32 WINPROC_GetWinProcFunc( WNDPROC16 func ); extern void WINPROC_FreeWinProc( HANDLE32 handle );
extern void WINPROC_FreeWinProc( WNDPROC16 func ); extern WINDOWPROCTYPE WINPROC_GetWinProcType( HANDLE32 handle );
extern WNDPROC16 WINPROC_GetFunc16( HANDLE32 handle );
extern WNDPROC32 WINPROC_GetFunc32( HANDLE32 handle );
#endif /* __WINE_WINPROC_H */ #endif /* __WINE_WINPROC_H */
...@@ -345,6 +345,7 @@ typedef FARPROC HOOKPROC; ...@@ -345,6 +345,7 @@ typedef FARPROC HOOKPROC;
(((DWORD)((WORD)(high))) << 16))) (((DWORD)((WORD)(high))) << 16)))
#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high)) #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
#define MAKEWPARAM(low,high) ((WPARAM32)MAKELONG(low,high)) #define MAKEWPARAM(low,high) ((WPARAM32)MAKELONG(low,high))
#define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
#define SELECTOROF(ptr) (HIWORD(ptr)) #define SELECTOROF(ptr) (HIWORD(ptr))
#define OFFSETOF(ptr) (LOWORD(ptr)) #define OFFSETOF(ptr) (LOWORD(ptr))
......
...@@ -452,7 +452,7 @@ int DDE_GetRemoteMessage() ...@@ -452,7 +452,7 @@ int DDE_GetRemoteMessage()
remote_message->wParam, (int)remote_message->lParam); remote_message->wParam, (int)remote_message->lParam);
/* execute the recieved message */ /* execute the recieved message */
passed= SendMessage(dde_window, remote_message->message, passed= SendMessage16(dde_window, remote_message->message,
remote_message->wParam, remote_message->lParam); remote_message->wParam, remote_message->lParam);
/* Tell the sended, that the message is here */ /* Tell the sended, that the message is here */
...@@ -481,7 +481,7 @@ int DDE_GetRemoteMessage() ...@@ -481,7 +481,7 @@ int DDE_GetRemoteMessage()
{ {
if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) { if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) {
if (was_sent) if (was_sent)
SendMessage( wndPtr->hwndSelf, remote_message->message, SendMessage16( wndPtr->hwndSelf, remote_message->message,
remote_message->wParam, remote_message->lParam ); remote_message->wParam, remote_message->lParam );
else else
PostMessage( wndPtr->hwndSelf, remote_message->message, PostMessage( wndPtr->hwndSelf, remote_message->message,
...@@ -528,7 +528,7 @@ void DDE_TestDDE(HWND hwnd) ...@@ -528,7 +528,7 @@ void DDE_TestDDE(HWND hwnd)
if (hwnd==0) if (hwnd==0)
hwnd=-1; hwnd=-1;
/* just send a message to see how things are going */ /* just send a message to see how things are going */
SendMessage( hwnd, WM_DDE_INITIATE, 0, 0); SendMessage16( hwnd, WM_DDE_INITIATE, 0, 0);
} }
void dde_proc_delete(int proc_idx) void dde_proc_delete(int proc_idx)
...@@ -553,7 +553,7 @@ void stop_wait(int a) ...@@ -553,7 +553,7 @@ void stop_wait(int a)
static void print_dde_message(char *desc, MSG *msg) static void print_dde_message(char *desc, MSG *msg)
{ {
extern const char *MessageTypeNames[]; /* extern const char *MessageTypeNames[];*/
extern int debug_last_handle_size; extern int debug_last_handle_size;
WORD wStatus,hWord; WORD wStatus,hWord;
void *ptr; void *ptr;
...@@ -571,7 +571,7 @@ static void print_dde_message(char *desc, MSG *msg) ...@@ -571,7 +571,7 @@ static void print_dde_message(char *desc, MSG *msg)
fprintf(stddeb,"%s", desc); fprintf(stddeb,"%s", desc);
fprintf(stddeb,"%04x %04x==%s %04x %08lx ", fprintf(stddeb,"%04x %04x==%s %04x %08lx ",
msg->hwnd, msg->message,MessageTypeNames[msg->message], msg->hwnd, msg->message,"",/*MessageTypeNames[msg->message],*/
msg->wParam, msg->lParam); msg->wParam, msg->lParam);
switch(msg->message) { switch(msg->message) {
case WM_DDE_INITIATE: case WM_DDE_INITIATE:
......
...@@ -103,16 +103,6 @@ WNDPROC MODULE_GetWndProcEntry16( char *name ) ...@@ -103,16 +103,6 @@ WNDPROC MODULE_GetWndProcEntry16( char *name )
return ErrorProc; return ErrorProc;
} }
/***********************************************************************
* MODULE_GetWndProcEntry32 (not a Windows API function)
*
* Return an entry point from the WPROCS32 dll.
*/
WNDPROC MODULE_GetWndProcEntry32( char *name )
{
return MODULE_GetWndProcEntry16( name );
}
void DEBUG_EnterDebugger(void) void DEBUG_EnterDebugger(void)
{ {
} }
......
...@@ -103,7 +103,6 @@ extern const DLL_DESCRIPTOR KERNEL32_Descriptor; ...@@ -103,7 +103,6 @@ extern const DLL_DESCRIPTOR KERNEL32_Descriptor;
extern const DLL_DESCRIPTOR NTDLL_Descriptor; extern const DLL_DESCRIPTOR NTDLL_Descriptor;
extern const DLL_DESCRIPTOR SHELL32_Descriptor; extern const DLL_DESCRIPTOR SHELL32_Descriptor;
extern const DLL_DESCRIPTOR USER32_Descriptor; extern const DLL_DESCRIPTOR USER32_Descriptor;
extern const DLL_DESCRIPTOR WPROCS32_Descriptor;
extern const DLL_DESCRIPTOR WINSPOOL_Descriptor; extern const DLL_DESCRIPTOR WINSPOOL_Descriptor;
extern const DLL_DESCRIPTOR WSOCK32_Descriptor; extern const DLL_DESCRIPTOR WSOCK32_Descriptor;
...@@ -151,7 +150,6 @@ static BUILTIN_DLL BuiltinDLLs[] = ...@@ -151,7 +150,6 @@ static BUILTIN_DLL BuiltinDLLs[] =
{ &NTDLL_Descriptor, 0 }, { &NTDLL_Descriptor, 0 },
{ &SHELL32_Descriptor, 0 }, { &SHELL32_Descriptor, 0 },
{ &USER32_Descriptor, 0 }, { &USER32_Descriptor, 0 },
{ &WPROCS32_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &WINSPOOL_Descriptor, 0 }, { &WINSPOOL_Descriptor, 0 },
{ &WSOCK32_Descriptor, 0 }, { &WSOCK32_Descriptor, 0 },
/* Last entry */ /* Last entry */
......
...@@ -775,25 +775,6 @@ FARPROC16 MODULE_GetWndProcEntry16( const char *name ) ...@@ -775,25 +775,6 @@ FARPROC16 MODULE_GetWndProcEntry16( const char *name )
/*********************************************************************** /***********************************************************************
* MODULE_GetWndProcEntry32 (not a Windows API function)
*
* Return an entry point from the WPROCS32 dll.
*/
#ifndef WINELIB
FARPROC32 MODULE_GetWndProcEntry32( const char *name )
{
FARPROC32 ret;
static HMODULE hModule = 0;
if (!hModule) hModule = GetModuleHandle( "WPROCS32" );
if (!(ret = PE_GetProcAddress( hModule, name )))
fprintf( stderr, "GetWndProc32: %s not found, please report\n", name );
return ret;
}
#endif
/***********************************************************************
* MODULE_GetModuleName * MODULE_GetModuleName
*/ */
LPSTR MODULE_GetModuleName( HMODULE hModule ) LPSTR MODULE_GetModuleName( HMODULE hModule )
...@@ -1003,7 +984,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock ) ...@@ -1003,7 +984,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
char *p; char *p;
/* Try with prepending the path of the current module */ /* Try with prepending the path of the current module */
GetModuleFileName( hModule, buffer, 256 ); GetModuleFileName( hModule, buffer, sizeof(buffer) );
if (!(p = strrchr( buffer, '\\' ))) p = buffer; if (!(p = strrchr( buffer, '\\' ))) p = buffer;
memcpy( p + 1, pstr + 1, *pstr ); memcpy( p + 1, pstr + 1, *pstr );
strcpy( p + 1 + *pstr, ".dll" ); strcpy( p + 1 + *pstr, ".dll" );
...@@ -1033,6 +1014,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock ) ...@@ -1033,6 +1014,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
/* Handle self loading modules */ /* Handle self loading modules */
SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule); SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
SELFLOADHEADER *selfloadheader; SELFLOADHEADER *selfloadheader;
STACK16FRAME *stack16Top;
HMODULE hselfload = GetModuleHandle("WPROCS"); HMODULE hselfload = GetModuleHandle("WPROCS");
WORD oldss, oldsp, saved_dgroup = pSegTable[pModule->dgroup - 1].selector; WORD oldss, oldsp, saved_dgroup = pSegTable[pModule->dgroup - 1].selector;
fprintf (stderr, "Warning: %*.*s is a self-loading module\n" fprintf (stderr, "Warning: %*.*s is a self-loading module\n"
...@@ -1054,7 +1036,18 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock ) ...@@ -1054,7 +1036,18 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
oldss = IF1632_Saved16_ss; oldss = IF1632_Saved16_ss;
oldsp = IF1632_Saved16_sp; oldsp = IF1632_Saved16_sp;
IF1632_Saved16_ss = pModule->self_loading_sel; IF1632_Saved16_ss = pModule->self_loading_sel;
IF1632_Saved16_sp = 0xFF00; IF1632_Saved16_sp = 0xFF00 - sizeof(*stack16Top);
stack16Top = CURRENT_STACK16;
stack16Top->saved_ss = 0;
stack16Top->saved_sp = 0;
stack16Top->ds = stack16Top->es = pModule->self_loading_sel;
stack16Top->entry_point = 0;
stack16Top->entry_ip = 0;
stack16Top->entry_cs = 0;
stack16Top->bp = 0;
stack16Top->ip = 0;
stack16Top->cs = 0;
if (!IF1632_Stack32_base) { if (!IF1632_Stack32_base) {
STACK32FRAME* frame32; STACK32FRAME* frame32;
char *stack32Top; char *stack32Top;
......
...@@ -65,6 +65,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -65,6 +65,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
#ifndef WINELIB #ifndef WINELIB
/* Implement self loading segments */ /* Implement self loading segments */
SELFLOADHEADER *selfloadheader; SELFLOADHEADER *selfloadheader;
STACK16FRAME *stack16Top;
WORD oldss, oldsp, oldselector, newselector; WORD oldss, oldsp, oldselector, newselector;
selfloadheader = (SELFLOADHEADER *) selfloadheader = (SELFLOADHEADER *)
PTR_SEG_OFF_TO_LIN(pSegTable->selector,0); PTR_SEG_OFF_TO_LIN(pSegTable->selector,0);
...@@ -72,7 +73,17 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -72,7 +73,17 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
oldsp = IF1632_Saved16_sp; oldsp = IF1632_Saved16_sp;
oldselector = pSeg->selector; oldselector = pSeg->selector;
IF1632_Saved16_ss = pModule->self_loading_sel; IF1632_Saved16_ss = pModule->self_loading_sel;
IF1632_Saved16_sp = 0xFF00; IF1632_Saved16_sp = 0xFF00 - sizeof(*stack16Top);
stack16Top = CURRENT_STACK16;
stack16Top->saved_ss = 0;
stack16Top->saved_sp = 0;
stack16Top->ds = stack16Top->es = pModule->self_loading_sel;
stack16Top->entry_point = 0;
stack16Top->entry_ip = 0;
stack16Top->entry_cs = 0;
stack16Top->bp = 0;
stack16Top->ip = 0;
stack16Top->cs = 0;
/* FIXME: we probably need to pass a DOS file handle here */ /* FIXME: we probably need to pass a DOS file handle here */
newselector = CallTo16_word_www(selfloadheader->LoadAppSeg, newselector = CallTo16_word_www(selfloadheader->LoadAppSeg,
pModule->self_loading_sel, hModule, fd, segnum); pModule->self_loading_sel, hModule, fd, segnum);
......
...@@ -171,6 +171,16 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule) ...@@ -171,6 +171,16 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
mod_ptr[i] = LoadModule(name,(LPVOID)-1); mod_ptr[i] = LoadModule(name,(LPVOID)-1);
if(mod_ptr[i]<=(HMODULE)32) if(mod_ptr[i]<=(HMODULE)32)
{ {
char *p, buffer[256];
/* Try with prepending the path of the current module */
GetModuleFileName( hModule, buffer, sizeof(buffer) );
if (!(p = strrchr( buffer, '\\' ))) p = buffer;
strcpy( p + 1, name );
mod_ptr[i] = LoadModule( buffer, (LPVOID)-1 );
}
if(mod_ptr[i]<=(HMODULE)32)
{
fprintf(stderr,"Module %s not found\n",name); fprintf(stderr,"Module %s not found\n",name);
exit(0); exit(0);
} }
......
...@@ -2,27 +2,33 @@ ...@@ -2,27 +2,33 @@
* 'Wine' Clipboard function handling * 'Wine' Clipboard function handling
* *
* Copyright 1994 Martin Ayotte * Copyright 1994 Martin Ayotte
static char Copyright[] = "Copyright Martin Ayotte, 1994"; * 1996 Alex Korobka
*/ *
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <windows.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include "windows.h"
#include "win.h" #include "win.h"
#include "message.h" #include "message.h"
#include "clipboard.h" #include "clipboard.h"
#include "xmalloc.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#define CF_REGFORMATBASE 0xC000
typedef struct tagCLIPFORMAT { typedef struct tagCLIPFORMAT {
WORD wFormatID; WORD wFormatID;
WORD wRefCount; WORD wRefCount;
WORD wDataPresent;
LPSTR Name; LPSTR Name;
HANDLE hData; HANDLE hData;
DWORD BufSize; DWORD BufSize;
...@@ -30,36 +36,132 @@ typedef struct tagCLIPFORMAT { ...@@ -30,36 +36,132 @@ typedef struct tagCLIPFORMAT {
void *NextFormat; void *NextFormat;
} CLIPFORMAT, *LPCLIPFORMAT; } CLIPFORMAT, *LPCLIPFORMAT;
static HWND hWndClipboardOwner = 0; /* *************************************************************************
static HWND hWndViewer = 0; * internal variables
static WORD LastRegFormat = 0xC000; */
static HWND hWndClipOwner = 0; /* current clipboard owner */
static HWND hWndClipWindow = 0; /* window that opened clipboard */
static HWND hWndViewer = 0; /* start of viewers chain */
static BOOL bClipChanged = FALSE;
static WORD LastRegFormat = CF_REGFORMATBASE;
static Bool wait_for_selection = False; static Bool wait_for_selection = False;
static Bool wineOwnsSelection = False; static Bool wineOwnsSelection = False;
CLIPFORMAT ClipFormats[12] = { CLIPFORMAT ClipFormats[16] = {
{ CF_TEXT, 1, "Text", (HANDLE)NULL, 0, NULL, &ClipFormats[1] }, { CF_TEXT, 1, 0, "Text", (HANDLE)NULL, 0, NULL, &ClipFormats[1] },
{ CF_BITMAP, 1, "Bitmap", (HANDLE)NULL, 0, &ClipFormats[0], &ClipFormats[2] }, { CF_BITMAP, 1, 0, "Bitmap", (HANDLE)NULL, 0, &ClipFormats[0], &ClipFormats[2] },
{ CF_METAFILEPICT, 1, "MetaFile Picture", (HANDLE)NULL, 0, &ClipFormats[1], &ClipFormats[3] }, { CF_METAFILEPICT, 1, 0, "MetaFile Picture", (HANDLE)NULL, 0, &ClipFormats[1], &ClipFormats[3] },
{ CF_SYLK, 1, "Sylk", (HANDLE)NULL, 0, &ClipFormats[2], &ClipFormats[4] }, { CF_SYLK, 1, 0, "Sylk", (HANDLE)NULL, 0, &ClipFormats[2], &ClipFormats[4] },
{ CF_DIF, 1, "DIF", (HANDLE)NULL, 0, &ClipFormats[3], &ClipFormats[5] }, { CF_DIF, 1, 0, "DIF", (HANDLE)NULL, 0, &ClipFormats[3], &ClipFormats[5] },
{ CF_TIFF, 1, "TIFF", (HANDLE)NULL, 0, &ClipFormats[4], &ClipFormats[6] }, { CF_TIFF, 1, 0, "TIFF", (HANDLE)NULL, 0, &ClipFormats[4], &ClipFormats[6] },
{ CF_OEMTEXT, 1, "OEM Text", (HANDLE)NULL, 0, &ClipFormats[5], &ClipFormats[7] }, { CF_OEMTEXT, 1, 0, "OEM Text", (HANDLE)NULL, 0, &ClipFormats[5], &ClipFormats[7] },
{ CF_DIB, 1, "DIB", (HANDLE)NULL, 0, &ClipFormats[6], &ClipFormats[8] }, { CF_DIB, 1, 0, "DIB", (HANDLE)NULL, 0, &ClipFormats[6], &ClipFormats[8] },
{ CF_PALETTE, 1, "Palette", (HANDLE)NULL, 0, &ClipFormats[7], &ClipFormats[9] }, { CF_PALETTE, 1, 0, "Palette", (HANDLE)NULL, 0, &ClipFormats[7], &ClipFormats[9] },
{ CF_PENDATA, 1, "PenData", (HANDLE)NULL, 0, &ClipFormats[8], &ClipFormats[10] }, { CF_PENDATA, 1, 0, "PenData", (HANDLE)NULL, 0, &ClipFormats[8], &ClipFormats[10] },
{ CF_RIFF, 1, "RIFF", (HANDLE)NULL, 0, &ClipFormats[9], &ClipFormats[11] }, { CF_RIFF, 1, 0, "RIFF", (HANDLE)NULL, 0, &ClipFormats[9], &ClipFormats[11] },
{ CF_WAVE, 1, "Wave", (HANDLE)NULL, 0, &ClipFormats[10], NULL } { CF_WAVE, 1, 0, "Wave", (HANDLE)NULL, 0, &ClipFormats[10], &ClipFormats[12] },
{ CF_OWNERDISPLAY, 1, 0, "Owner Display", (HANDLE)NULL, 0, &ClipFormats[11], &ClipFormats[13] },
{ CF_DSPTEXT, 1, 0, "DSPText", (HANDLE)NULL, 0, &ClipFormats[12], &ClipFormats[14] },
{ CF_DSPMETAFILEPICT, 1, 0, "DSPMetaFile Picture", (HANDLE)NULL, 0, &ClipFormats[13], &ClipFormats[15] },
{ CF_DSPBITMAP, 1, 0, "DSPBitmap", (HANDLE)NULL, 0, &ClipFormats[14], NULL }
}; };
/************************************************************************** /**************************************************************************
* CLIPBOARD_DisOwn
*/
void CLIPBOARD_DisOwn(HWND hWnd)
{
LPCLIPFORMAT lpFormat = ClipFormats;
if( hWnd != hWndClipOwner || !hWndClipOwner ) return;
SendMessage16(hWndClipOwner,WM_RENDERALLFORMATS,0,0L);
/* check if all formats were rendered */
while(lpFormat)
{
if( lpFormat->wDataPresent && !lpFormat->hData )
{
dprintf_clipboard(stddeb,"\tdata missing for clipboard format %i\n", lpFormat->wFormatID);
lpFormat->wDataPresent = 0;
}
lpFormat = lpFormat->NextFormat;
}
hWndClipOwner = 0;
}
/**************************************************************************
* CLIPBOARD_DeleteRecord
*/
void CLIPBOARD_DeleteRecord(LPCLIPFORMAT lpFormat)
{
if( lpFormat->wFormatID >= CF_GDIOBJFIRST &&
lpFormat->wFormatID <= CF_GDIOBJLAST )
DeleteObject(lpFormat->hData);
else if( lpFormat->hData )
GlobalFree16(lpFormat->hData);
lpFormat->wDataPresent = 0;
lpFormat->hData = 0;
bClipChanged = TRUE;
}
/**************************************************************************
* CLIPBOARD_RequestXSelection
*/
BOOL CLIPBOARD_RequestXSelection()
{
wait_for_selection=True;
dprintf_clipboard(stddeb,"Requesting selection\n");
XConvertSelection(display,XA_PRIMARY,XA_STRING,
XInternAtom(display,"PRIMARY_TEXT",False),
WIN_GetXWindow(hWndClipWindow),CurrentTime);
/* TODO: need time-out for broken clients */
while(wait_for_selection) EVENT_WaitXEvent(-1);
return (BOOL)ClipFormats[0].wDataPresent;
}
/**************************************************************************
* CLIPBOARD_IsPresent
*/
BOOL CLIPBOARD_IsPresent(WORD wFormat)
{
LPCLIPFORMAT lpFormat = ClipFormats;
while(TRUE) {
if (lpFormat == NULL) return FALSE;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
return (lpFormat->wDataPresent);
}
/**************************************************************************
* OpenClipboard [USER.137] * OpenClipboard [USER.137]
*/ */
BOOL OpenClipboard(HWND hWnd) BOOL OpenClipboard(HWND hWnd)
{ {
if (hWndClipboardOwner != 0) return FALSE; BOOL bRet = FALSE;
hWndClipboardOwner = hWnd; dprintf_clipboard(stddeb,"OpenClipboard(%04x) = ", hWnd);
dprintf_clipboard(stddeb,"OpenClipboard(%04x); !\n", hWnd);
return TRUE; if (!hWndClipWindow)
{
hWndClipWindow = hWnd;
bRet = TRUE;
}
bClipChanged = FALSE;
dprintf_clipboard(stddeb,"%i\n", bRet);
return bRet;
} }
...@@ -68,9 +170,13 @@ BOOL OpenClipboard(HWND hWnd) ...@@ -68,9 +170,13 @@ BOOL OpenClipboard(HWND hWnd)
*/ */
BOOL CloseClipboard() BOOL CloseClipboard()
{ {
if (hWndClipboardOwner == 0) return FALSE;
hWndClipboardOwner = 0;
dprintf_clipboard(stddeb,"CloseClipboard(); !\n"); dprintf_clipboard(stddeb,"CloseClipboard(); !\n");
if (hWndClipWindow == 0) return FALSE;
hWndClipWindow = 0;
if (bClipChanged && hWndViewer) SendMessage16(hWndViewer,WM_DRAWCLIPBOARD,0,0L);
return TRUE; return TRUE;
} }
...@@ -81,16 +187,26 @@ BOOL CloseClipboard() ...@@ -81,16 +187,26 @@ BOOL CloseClipboard()
BOOL EmptyClipboard() BOOL EmptyClipboard()
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
if (hWndClipboardOwner == 0) return FALSE;
dprintf_clipboard(stddeb,"EmptyClipboard(); !\n"); dprintf_clipboard(stddeb,"EmptyClipboard()\n");
while(TRUE) {
if (lpFormat == NULL) break; if (hWndClipWindow == 0) return FALSE;
if (lpFormat->hData != 0) {
GlobalFree16(lpFormat->hData); /* destroy private objects */
lpFormat->hData = 0;
} if (hWndClipOwner)
SendMessage16(hWndClipOwner,WM_DESTROYCLIPBOARD,0,0L);
while(lpFormat)
{
if ( lpFormat->wDataPresent )
CLIPBOARD_DeleteRecord( lpFormat );
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
hWndClipOwner = hWndClipWindow;
if(wineOwnsSelection){ if(wineOwnsSelection){
dprintf_clipboard(stddeb,"Losing selection\n"); dprintf_clipboard(stddeb,"Losing selection\n");
wineOwnsSelection=False; wineOwnsSelection=False;
...@@ -106,8 +222,8 @@ BOOL EmptyClipboard() ...@@ -106,8 +222,8 @@ BOOL EmptyClipboard()
HWND GetClipboardOwner() HWND GetClipboardOwner()
{ {
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetClipboardOwner() = %04x !\n", hWndClipboardOwner); "GetClipboardOwner() = %04x !\n", hWndClipOwner);
return hWndClipboardOwner; return hWndClipOwner;
} }
...@@ -117,20 +233,40 @@ HWND GetClipboardOwner() ...@@ -117,20 +233,40 @@ HWND GetClipboardOwner()
HANDLE SetClipboardData(WORD wFormat, HANDLE hData) HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
Window owner;
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"SetClipboardDate(%04X, %04x) !\n", wFormat, hData); "SetClipboardDate(%04X, %04x) !\n", wFormat, hData);
while(TRUE) {
while(TRUE)
{
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
/* doc says we shouldn't use CurrentTime */
/* should we become owner of CLIPBOARD as well? */ /* Acquire X selection:
XSetSelectionOwner(display,XA_PRIMARY,WIN_GetXWindow(hWndClipboardOwner),CurrentTime); *
* doc says we shouldn't use CurrentTime
* should we become owner of CLIPBOARD as well?
*/
owner = WIN_GetXWindow(hWndClipWindow);
XSetSelectionOwner(display,XA_PRIMARY,owner,CurrentTime);
if( XGetSelectionOwner(display,XA_PRIMARY) == owner )
{
wineOwnsSelection = True; wineOwnsSelection = True;
dprintf_clipboard(stddeb,"Getting selection\n"); dprintf_clipboard(stddeb,"Getting selection\n");
if (lpFormat->hData != 0) GlobalFree16(lpFormat->hData); }
if ( lpFormat->wDataPresent )
CLIPBOARD_DeleteRecord(lpFormat);
bClipChanged = TRUE;
lpFormat->wDataPresent = TRUE;
lpFormat->hData = hData; lpFormat->hData = hData;
return lpFormat->hData; return lpFormat->hData;
} }
...@@ -141,22 +277,26 @@ HANDLE SetClipboardData(WORD wFormat, HANDLE hData) ...@@ -141,22 +277,26 @@ HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
HANDLE GetClipboardData(WORD wFormat) HANDLE GetClipboardData(WORD wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb,"GetClipboardData(%04X) !\n", wFormat); dprintf_clipboard(stddeb,"GetClipboardData(%04X)\n", wFormat);
if (!hWndClipboardOwner) return 0;
if(wFormat == CF_TEXT && !wineOwnsSelection) if (!hWndClipWindow) return 0;
{ wait_for_selection=True;
dprintf_clipboard(stddeb,"Requesting selection\n"); /* if(wFormat == CF_TEXT && !wineOwnsSelection)
XConvertSelection(display,XA_PRIMARY,XA_STRING, CLIPBOARD_RequestXSelection();
XInternAtom(display,"PRIMARY_TEXT",False), */
WIN_GetXWindow(hWndClipboardOwner),CurrentTime);
/* TODO: need time-out for broken clients */
while(wait_for_selection) EVENT_WaitXEvent(-1);
}
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
if( lpFormat->wDataPresent && !lpFormat->hData )
if( IsWindow(hWndClipOwner) )
SendMessage16(hWndClipOwner,WM_RENDERFORMAT,(WPARAM)lpFormat->wFormatID,0L);
else
dprintf_clipboard(stddeb,"\thWndClipOwner is lost\n");
return lpFormat->hData; return lpFormat->hData;
} }
...@@ -168,17 +308,21 @@ INT CountClipboardFormats() ...@@ -168,17 +308,21 @@ INT CountClipboardFormats()
{ {
int FormatCount = 0; int FormatCount = 0;
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb,"CountClipboardFormats()\n");
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) break; if (lpFormat == NULL) break;
if (lpFormat->hData != 0) { if (lpFormat->wDataPresent)
dprintf_clipboard(stddeb, {
"CountClipboardFormats // Find Not Empty (%04x) !\n", dprintf_clipboard(stddeb, "\tdata found for format %i\n", lpFormat->wFormatID);
lpFormat->hData);
FormatCount++; FormatCount++;
} }
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
dprintf_clipboard(stddeb,"CountClipboardFormats() = %d !\n", FormatCount);
dprintf_clipboard(stddeb,"\ttotal %d\n", FormatCount);
return FormatCount; return FormatCount;
} }
...@@ -189,28 +333,37 @@ INT CountClipboardFormats() ...@@ -189,28 +333,37 @@ INT CountClipboardFormats()
UINT EnumClipboardFormats(UINT wFormat) UINT EnumClipboardFormats(UINT wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb,"EnumClipboardFormats(%04X) !\n", wFormat);
dprintf_clipboard(stddeb,"EnumClipboardFormats(%04X)\n", wFormat);
if( (!wFormat || wFormat == CF_TEXT) && !wineOwnsSelection)
CLIPBOARD_RequestXSelection();
if (wFormat == 0) { if (wFormat == 0) {
if (lpFormat->hData != 0) if (lpFormat->wDataPresent)
return lpFormat->wFormatID; return lpFormat->wFormatID;
else else
wFormat = lpFormat->wFormatID; wFormat = lpFormat->wFormatID;
} }
/* walk up to the specified format record */
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
dprintf_clipboard(stddeb,"EnumClipboardFormats // Find Last (%04X) !\n",
lpFormat->wFormatID); /* find next format with available data */
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->hData != 0) break; if (lpFormat->wDataPresent ) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
dprintf_clipboard(stddeb,
"EnumClipboardFormats // Find Not Empty Id=%04X hData=%04x !\n", dprintf_clipboard(stddeb, "\t got not empty - Id=%04X hData=%04x !\n",
lpFormat->wFormatID, lpFormat->hData); lpFormat->wFormatID, lpFormat->hData);
return lpFormat->wFormatID; return lpFormat->wFormatID;
} }
...@@ -223,27 +376,41 @@ WORD RegisterClipboardFormat(LPCSTR FormatName) ...@@ -223,27 +376,41 @@ WORD RegisterClipboardFormat(LPCSTR FormatName)
{ {
LPCLIPFORMAT lpNewFormat; LPCLIPFORMAT lpNewFormat;
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
if (FormatName == NULL) return 0; if (FormatName == NULL) return 0;
dprintf_clipboard(stddeb,"RegisterClipboardFormat('%s') !\n", FormatName);
/* walk format chain to see if it's already registered */
while(TRUE) { while(TRUE) {
if (lpFormat->NextFormat == NULL) break; if ( !strcmp(lpFormat->Name,FormatName) )
{
lpFormat->wRefCount++;
return lpFormat->wFormatID;
}
if ( lpFormat->NextFormat == NULL ) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
lpNewFormat = (LPCLIPFORMAT)malloc(sizeof(CLIPFORMAT));
if (lpNewFormat == NULL) return 0; /* allocate storage for new format entry */
lpNewFormat = (LPCLIPFORMAT)xmalloc(sizeof(CLIPFORMAT));
lpFormat->NextFormat = lpNewFormat; lpFormat->NextFormat = lpNewFormat;
dprintf_clipboard(stddeb,"RegisterClipboardFormat('%s') !\n", FormatName);
lpNewFormat->wFormatID = LastRegFormat; lpNewFormat->wFormatID = LastRegFormat;
lpNewFormat->wRefCount = 1; lpNewFormat->wRefCount = 1;
lpNewFormat->Name = (LPSTR)malloc(strlen(FormatName) + 1);
if (lpNewFormat->Name == NULL) { lpNewFormat->Name = (LPSTR)xmalloc(strlen(FormatName) + 1);
free(lpNewFormat);
return 0;
}
strcpy(lpNewFormat->Name, FormatName); strcpy(lpNewFormat->Name, FormatName);
lpNewFormat->wDataPresent = 0;
lpNewFormat->hData = 0; lpNewFormat->hData = 0;
lpNewFormat->BufSize = 0; lpNewFormat->BufSize = 0;
lpNewFormat->PrevFormat = lpFormat; lpNewFormat->PrevFormat = lpFormat;
lpNewFormat->NextFormat = NULL; lpNewFormat->NextFormat = NULL;
return LastRegFormat++; return LastRegFormat++;
} }
...@@ -254,21 +421,26 @@ WORD RegisterClipboardFormat(LPCSTR FormatName) ...@@ -254,21 +421,26 @@ WORD RegisterClipboardFormat(LPCSTR FormatName)
int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen) int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetClipboardFormat(%04X, %p, %d) !\n", wFormat, retStr, maxlen); "GetClipboardFormat(%04X, %p, %d) !\n", wFormat, retStr, maxlen);
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
if (lpFormat->Name == NULL) return 0;
if (lpFormat->Name == NULL ||
lpFormat->wFormatID < CF_REGFORMATBASE) return 0;
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetClipboardFormat // Name='%s' !\n", lpFormat->Name); "GetClipboardFormat // Name='%s' !\n", lpFormat->Name);
maxlen = MIN(maxlen - 1, strlen(lpFormat->Name));
dprintf_clipboard(stddeb,"GetClipboardFormat // maxlen=%d !\n", maxlen); strncpy(retStr, lpFormat->Name, maxlen - 1);
memcpy(retStr, lpFormat->Name, maxlen);
retStr[maxlen] = 0; retStr[maxlen] = 0;
return maxlen;
return strlen(retStr);
} }
...@@ -278,7 +450,9 @@ int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen) ...@@ -278,7 +450,9 @@ int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
HWND SetClipboardViewer(HWND hWnd) HWND SetClipboardViewer(HWND hWnd)
{ {
HWND hwndPrev = hWndViewer; HWND hwndPrev = hWndViewer;
dprintf_clipboard(stddeb,"SetClipboardViewer(%04x) !\n", hWnd);
dprintf_clipboard(stddeb,"SetClipboardViewer(%04x)\n", hWnd);
hWndViewer = hWnd; hWndViewer = hWnd;
return hwndPrev; return hwndPrev;
} }
...@@ -289,7 +463,8 @@ HWND SetClipboardViewer(HWND hWnd) ...@@ -289,7 +463,8 @@ HWND SetClipboardViewer(HWND hWnd)
*/ */
HWND GetClipboardViewer() HWND GetClipboardViewer()
{ {
dprintf_clipboard(stddeb,"GetClipboardFormat() = %04x !\n", hWndViewer); dprintf_clipboard(stddeb,"GetClipboardFormat() = %04x\n", hWndViewer);
return hWndViewer; return hWndViewer;
} }
...@@ -299,8 +474,16 @@ HWND GetClipboardViewer() ...@@ -299,8 +474,16 @@ HWND GetClipboardViewer()
*/ */
BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext) BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
{ {
dprintf_clipboard(stdnimp, BOOL bRet = 0;
"ChangeClipboardChain(%04x, %04x) !\n", hWnd, hWndNext);
dprintf_clipboard(stdnimp, "ChangeClipboardChain(%04x, %04x)\n", hWnd, hWndNext);
if( hWndViewer )
bRet = !SendMessage16( hWndViewer, WM_CHANGECBCHAIN, (WPARAM)hWnd, (LPARAM)hWndNext);
else
dprintf_clipboard(stddeb,"ChangeClipboardChain: hWndViewer is lost\n");
if( hWnd == hWndViewer ) hWndViewer = hWndNext;
return 0; return 0;
} }
...@@ -311,16 +494,12 @@ BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext) ...@@ -311,16 +494,12 @@ BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
*/ */
BOOL IsClipboardFormatAvailable(WORD wFormat) BOOL IsClipboardFormatAvailable(WORD wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb,"IsClipboardFormatAvailable(%04X) !\n", wFormat); dprintf_clipboard(stddeb,"IsClipboardFormatAvailable(%04X) !\n", wFormat);
if(wFormat == CF_TEXT && !wineOwnsSelection) /* obtain selection as text if possible */
return GetClipboardData(CF_TEXT)!=0; if(wFormat == CF_TEXT && !wineOwnsSelection)
while(TRUE) { CLIPBOARD_RequestXSelection();
if (lpFormat == NULL) return FALSE;
if (lpFormat->wFormatID == wFormat) break; return CLIPBOARD_IsPresent(wFormat);
lpFormat = lpFormat->NextFormat;
}
return (lpFormat->hData != 0);
} }
...@@ -330,8 +509,8 @@ BOOL IsClipboardFormatAvailable(WORD wFormat) ...@@ -330,8 +509,8 @@ BOOL IsClipboardFormatAvailable(WORD wFormat)
HWND GetOpenClipboardWindow() HWND GetOpenClipboardWindow()
{ {
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetOpenClipboardWindow() = %04x !\n", hWndClipboardOwner); "GetOpenClipboardWindow() = %04x\n", hWndClipWindow);
return hWndClipboardOwner; return hWndClipWindow;
} }
...@@ -359,18 +538,24 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop) ...@@ -359,18 +538,24 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop)
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
if(prop==None) if(prop==None)
hText=0; hText=0;
else{ else
{
Atom atype=None; Atom atype=None;
int aformat; int aformat;
unsigned long nitems,remain; unsigned long nitems,remain;
unsigned char *val=NULL; unsigned char *val=NULL;
dprintf_clipboard(stddeb,"Received prop %s\n",XGetAtomName(display,prop)); dprintf_clipboard(stddeb,"Received prop %s\n",XGetAtomName(display,prop));
/* TODO: Properties longer than 64K */ /* TODO: Properties longer than 64K */
if(XGetWindowProperty(display,w,prop,0,0x3FFF,True,XA_STRING, if(XGetWindowProperty(display,w,prop,0,0x3FFF,True,XA_STRING,
&atype, &aformat, &nitems, &remain, &val)!=Success) &atype, &aformat, &nitems, &remain, &val)!=Success)
printf("couldn't read property\n"); fprintf(stderr,"couldn't read property\n");
dprintf_clipboard(stddeb,"Type %s,Format %d,nitems %ld,value %s\n", dprintf_clipboard(stddeb,"Type %s,Format %d,nitems %ld,value %s\n",
XGetAtomName(display,atype),aformat,nitems,val); XGetAtomName(display,atype),aformat,nitems,val);
if(atype!=XA_STRING || aformat!=8){ if(atype!=XA_STRING || aformat!=8){
fprintf(stderr,"Property not set\n"); fprintf(stderr,"Property not set\n");
hText=0; hText=0;
...@@ -382,13 +567,19 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop) ...@@ -382,13 +567,19 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop)
} }
XFree(val); XFree(val);
} }
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return; if (lpFormat == NULL) return;
if (lpFormat->wFormatID == CF_TEXT) break; if (lpFormat->wFormatID == CF_TEXT) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
if (lpFormat->hData != 0) GlobalFree16(lpFormat->hData);
if (lpFormat->wDataPresent)
CLIPBOARD_DeleteRecord(lpFormat);
wait_for_selection=False; wait_for_selection=False;
lpFormat->wDataPresent = TRUE;
lpFormat->hData = hText; lpFormat->hData = hText;
dprintf_clipboard(stddeb,"Received selection\n"); dprintf_clipboard(stddeb,"Received selection\n");
} }
......
...@@ -84,7 +84,7 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn) ...@@ -84,7 +84,7 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn)
} }
hInst = WIN_GetWindowInstance( lpofn->hwndOwner ); hInst = WIN_GetWindowInstance( lpofn->hwndOwner );
bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpofn->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpofn->hwndOwner,
MODULE_GetWndProcEntry16("FileOpenDlgProc"), MODULE_GetWndProcEntry16("FileOpenDlgProc"),
(DWORD)lpofn ); (DWORD)lpofn );
...@@ -126,7 +126,7 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn) ...@@ -126,7 +126,7 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn)
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_SAVE_FILE ); else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_SAVE_FILE );
hInst = WIN_GetWindowInstance( lpofn->hwndOwner ); hInst = WIN_GetWindowInstance( lpofn->hwndOwner );
bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpofn->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpofn->hwndOwner,
MODULE_GetWndProcEntry16("FileSaveDlgProc"), MODULE_GetWndProcEntry16("FileSaveDlgProc"),
(DWORD)lpofn); (DWORD)lpofn);
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)) if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
...@@ -416,7 +416,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -416,7 +416,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
notification = HIWORD(lParam); notification = HIWORD(lParam);
#endif #endif
lpofn = (LPOPENFILENAME)GetWindowLong(hWnd, DWL_USER); lpofn = (LPOPENFILENAME)GetWindowLong32A(hWnd, DWL_USER);
switch (control) switch (control)
{ {
case lst1: /* file list */ case lst1: /* file list */
...@@ -591,7 +591,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -591,7 +591,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{ {
LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong(hWnd, DWL_USER); LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong32A(hWnd, DWL_USER);
if (wMsg!=WM_INITDIALOG) if (wMsg!=WM_INITDIALOG)
if (FILEDLG_HookCallChk(lpofn)) if (FILEDLG_HookCallChk(lpofn))
...@@ -634,7 +634,7 @@ LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) ...@@ -634,7 +634,7 @@ LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{ {
LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong(hWnd, DWL_USER); LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong32A(hWnd, DWL_USER);
if (wMsg!=WM_INITDIALOG) if (wMsg!=WM_INITDIALOG)
if (FILEDLG_HookCallChk(lpofn)) if (FILEDLG_HookCallChk(lpofn))
...@@ -677,31 +677,13 @@ LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) ...@@ -677,31 +677,13 @@ LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
/*********************************************************************** /***********************************************************************
* ChooseColor (COMMDLG.5)
*/
BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
{
HANDLE hInst, hDlgTmpl;
BOOL bRet;
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_COLOR );
hInst = WIN_GetWindowInstance( lpChCol->hwndOwner );
bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpChCol->hwndOwner,
MODULE_GetWndProcEntry16("ColorDlgProc"),
(DWORD)lpChCol );
SYSRES_FreeResource( hDlgTmpl );
return bRet;
}
/***********************************************************************
* FindTextDlg (COMMDLG.11) * FindTextDlg (COMMDLG.11)
*/ */
BOOL FindText(LPFINDREPLACE lpFind) BOOL FindText(LPFINDREPLACE lpFind)
{ {
HANDLE hInst, hDlgTmpl; HANDLE hInst, hDlgTmpl;
BOOL bRet; BOOL bRet;
SEGPTR ptr; LPCVOID ptr;
/* /*
* FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
...@@ -713,8 +695,8 @@ BOOL FindText(LPFINDREPLACE lpFind) ...@@ -713,8 +695,8 @@ BOOL FindText(LPFINDREPLACE lpFind)
*/ */
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_FIND_TEXT ); hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_FIND_TEXT );
hInst = WIN_GetWindowInstance( lpFind->hwndOwner ); hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
if (!(ptr = (SEGPTR)WIN16_GlobalLock16( hDlgTmpl ))) return -1; if (!(ptr = GlobalLock16( hDlgTmpl ))) return -1;
bRet = CreateDialogIndirectParam( hInst, ptr, lpFind->hwndOwner, bRet = CreateDialogIndirectParam16( hInst, ptr, lpFind->hwndOwner,
MODULE_GetWndProcEntry16("FindTextDlgProc"), MODULE_GetWndProcEntry16("FindTextDlgProc"),
(DWORD)lpFind ); (DWORD)lpFind );
GlobalUnlock16( hDlgTmpl ); GlobalUnlock16( hDlgTmpl );
...@@ -730,7 +712,7 @@ BOOL ReplaceText(LPFINDREPLACE lpFind) ...@@ -730,7 +712,7 @@ BOOL ReplaceText(LPFINDREPLACE lpFind)
{ {
HANDLE hInst, hDlgTmpl; HANDLE hInst, hDlgTmpl;
BOOL bRet; BOOL bRet;
SEGPTR ptr; LPCVOID ptr;
/* /*
* FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
...@@ -742,8 +724,8 @@ BOOL ReplaceText(LPFINDREPLACE lpFind) ...@@ -742,8 +724,8 @@ BOOL ReplaceText(LPFINDREPLACE lpFind)
*/ */
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_REPLACE_TEXT ); hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_REPLACE_TEXT );
hInst = WIN_GetWindowInstance( lpFind->hwndOwner ); hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
if (!(ptr = (SEGPTR)WIN16_GlobalLock16( hDlgTmpl ))) return -1; if (!(ptr = GlobalLock16( hDlgTmpl ))) return -1;
bRet = CreateDialogIndirectParam( hInst, ptr, lpFind->hwndOwner, bRet = CreateDialogIndirectParam16( hInst, ptr, lpFind->hwndOwner,
MODULE_GetWndProcEntry16("ReplaceTextDlgProc"), MODULE_GetWndProcEntry16("ReplaceTextDlgProc"),
(DWORD)lpFind ); (DWORD)lpFind );
GlobalUnlock16( hDlgTmpl ); GlobalUnlock16( hDlgTmpl );
...@@ -806,7 +788,7 @@ static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -806,7 +788,7 @@ static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING ); int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING );
int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING ); int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING );
lpfr = (LPFINDREPLACE)GetWindowLong(hWnd, DWL_USER); lpfr = (LPFINDREPLACE)GetWindowLong32A(hWnd, DWL_USER);
switch (wParam) { switch (wParam) {
case IDOK: case IDOK:
GetDlgItemText16(hWnd, edt1, lpfr->lpstrFindWhat, lpfr->wFindWhatLen); GetDlgItemText16(hWnd, edt1, lpfr->lpstrFindWhat, lpfr->wFindWhatLen);
...@@ -898,7 +880,7 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -898,7 +880,7 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING ); int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING );
int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING ); int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING );
lpfr = (LPFINDREPLACE)GetWindowLong(hWnd, DWL_USER); lpfr = (LPFINDREPLACE)GetWindowLong32A(hWnd, DWL_USER);
switch (wParam) { switch (wParam) {
case IDOK: case IDOK:
GetDlgItemText16(hWnd, edt1, lpfr->lpstrFindWhat, lpfr->wFindWhatLen); GetDlgItemText16(hWnd, edt1, lpfr->lpstrFindWhat, lpfr->wFindWhatLen);
...@@ -989,7 +971,7 @@ BOOL PrintDlg(LPPRINTDLG lpPrint) ...@@ -989,7 +971,7 @@ BOOL PrintDlg(LPPRINTDLG lpPrint)
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_PRINT ); hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_PRINT );
hInst = WIN_GetWindowInstance( lpPrint->hwndOwner ); hInst = WIN_GetWindowInstance( lpPrint->hwndOwner );
bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpPrint->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpPrint->hwndOwner,
(lpPrint->Flags & PD_PRINTSETUP) ? (lpPrint->Flags & PD_PRINTSETUP) ?
MODULE_GetWndProcEntry16("PrintSetupDlgProc") : MODULE_GetWndProcEntry16("PrintSetupDlgProc") :
MODULE_GetWndProcEntry16("PrintDlgProc"), MODULE_GetWndProcEntry16("PrintDlgProc"),
...@@ -1095,7 +1077,48 @@ short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) ...@@ -1095,7 +1077,48 @@ short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
} }
/* --------------------------- Choose Color Dialog ------------------------------ */ /* ------------------------ Choose Color Dialog --------------------------- */
/***********************************************************************
* ChooseColor (COMMDLG.5)
*/
BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
{
HINSTANCE hInst;
HANDLE hDlgTmpl, hResInfo;
BOOL bRet;
dprintf_commdlg(stddeb,"ChooseColor\n");
if (!lpChCol) return FALSE;
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChCol->hInstance;
else if (lpChCol->Flags & CC_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChCol->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_COLOR );
if (!hDlgTmpl)
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
hInst = WIN_GetWindowInstance( lpChCol->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpChCol->hwndOwner,
MODULE_GetWndProcEntry16("ColorDlgProc"),
(DWORD)lpChCol );
if (!(lpChCol->Flags & CC_ENABLETEMPLATEHANDLE))
{
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet;
}
static const COLORREF predefcolors[6][8]= static const COLORREF predefcolors[6][8]=
{ {
...@@ -1456,7 +1479,7 @@ static void CC_PaintTriangle(HWND hDlg,int y) ...@@ -1456,7 +1479,7 @@ static void CC_PaintTriangle(HWND hDlg,int y)
int oben; int oben;
RECT16 rect; RECT16 rect;
HWND hwnd=GetDlgItem(hDlg,0x2be); HWND hwnd=GetDlgItem(hDlg,0x2be);
struct CCPRIVATE *lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE *lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */
{ {
...@@ -1496,7 +1519,7 @@ static void CC_PaintCross(HWND hDlg,int x,int y) ...@@ -1496,7 +1519,7 @@ static void CC_PaintCross(HWND hDlg,int x,int y)
HDC hDC; HDC hDC;
int w=GetDialogBaseUnits(); int w=GetDialogBaseUnits();
HWND hwnd=GetDlgItem(hDlg,0x2c6); HWND hwnd=GetDlgItem(hDlg,0x2c6);
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
RECT16 rect; RECT16 rect;
POINT16 point; POINT16 point;
HPEN16 hPen; HPEN16 hPen;
...@@ -1541,7 +1564,7 @@ static void CC_PrepareColorGraph(HWND hDlg) ...@@ -1541,7 +1564,7 @@ static void CC_PrepareColorGraph(HWND hDlg)
{ {
int sdif,hdif,xdif,ydif,r,g,b,hue,sat; int sdif,hdif,xdif,ydif,r,g,b,hue,sat;
HWND hwnd=GetDlgItem(hDlg,0x2c6); HWND hwnd=GetDlgItem(hDlg,0x2c6);
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
HBRUSH hbrush; HBRUSH hbrush;
HDC hdc ; HDC hdc ;
RECT16 rect,client; RECT16 rect,client;
...@@ -1584,7 +1607,7 @@ static void CC_PrepareColorGraph(HWND hDlg) ...@@ -1584,7 +1607,7 @@ static void CC_PrepareColorGraph(HWND hDlg)
static void CC_PaintColorGraph(HWND hDlg) static void CC_PaintColorGraph(HWND hDlg)
{ {
HWND hwnd=GetDlgItem(hDlg,0x2c6); HWND hwnd=GetDlgItem(hDlg,0x2c6);
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
HDC hDC; HDC hDC;
RECT16 rect; RECT16 rect;
if (IsWindowVisible(hwnd)) /* if full size */ if (IsWindowVisible(hwnd)) /* if full size */
...@@ -1643,7 +1666,7 @@ static void CC_PaintLumBar(HWND hDlg,int hue,int sat) ...@@ -1643,7 +1666,7 @@ static void CC_PaintLumBar(HWND hDlg,int hue,int sat)
static void CC_EditSetRGB(HWND hDlg,COLORREF cr) static void CC_EditSetRGB(HWND hDlg,COLORREF cr)
{ {
char buffer[10]; char buffer[10];
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
int r=GetRValue(cr); int r=GetRValue(cr);
int g=GetGValue(cr); int g=GetGValue(cr);
int b=GetBValue(cr); int b=GetBValue(cr);
...@@ -1666,7 +1689,7 @@ static void CC_EditSetRGB(HWND hDlg,COLORREF cr) ...@@ -1666,7 +1689,7 @@ static void CC_EditSetRGB(HWND hDlg,COLORREF cr)
static void CC_EditSetHSL(HWND hDlg,int h,int s,int l) static void CC_EditSetHSL(HWND hDlg,int h,int s,int l)
{ {
char buffer[10]; char buffer[10];
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
lpp->updating=TRUE; lpp->updating=TRUE;
if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */
{ {
...@@ -1688,7 +1711,7 @@ static void CC_EditSetHSL(HWND hDlg,int h,int s,int l) ...@@ -1688,7 +1711,7 @@ static void CC_EditSetHSL(HWND hDlg,int h,int s,int l)
static void CC_SwitchToFullSize(HWND hDlg,COLORREF result,LPRECT16 lprect) static void CC_SwitchToFullSize(HWND hDlg,COLORREF result,LPRECT16 lprect)
{ {
int i; int i;
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
EnableWindow(GetDlgItem(hDlg,0x2cf),FALSE); EnableWindow(GetDlgItem(hDlg,0x2cf),FALSE);
CC_PrepareColorGraph(hDlg); CC_PrepareColorGraph(hDlg);
...@@ -1885,7 +1908,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -1885,7 +1908,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
UINT cokmsg; UINT cokmsg;
HDC hdc; HDC hdc;
COLORREF *cr; COLORREF *cr;
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
dprintf_commdlg(stddeb,"CC_WMCommand wParam=%x lParam=%lx\n",wParam,lParam); dprintf_commdlg(stddeb,"CC_WMCommand wParam=%x lParam=%lx\n",wParam,lParam);
switch (wParam) switch (wParam)
{ {
...@@ -2008,7 +2031,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2008,7 +2031,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
*/ */
static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam) static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam)
{ {
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
/* we have to paint dialog children except text and buttons */ /* we have to paint dialog children except text and buttons */
CC_PaintPredefColorArray(hDlg,6,8); CC_PaintPredefColorArray(hDlg,6,8);
...@@ -2035,7 +2058,7 @@ static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2035,7 +2058,7 @@ static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam)
*/ */
static LRESULT CC_WMLButtonDown(HWND hDlg, WPARAM wParam, LPARAM lParam) static LRESULT CC_WMLButtonDown(HWND hDlg, WPARAM wParam, LPARAM lParam)
{ {
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
int r,g,b,i; int r,g,b,i;
i=0; i=0;
if (CC_MouseCheckPredefColorArray(hDlg,0x2d0,6,8,lParam,&lpp->lpcc->rgbResult)) if (CC_MouseCheckPredefColorArray(hDlg,0x2d0,6,8,lParam,&lpp->lpcc->rgbResult))
...@@ -2085,7 +2108,7 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message, ...@@ -2085,7 +2108,7 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message,
UINT wParam, LONG lParam) UINT wParam, LONG lParam)
{ {
int res; int res;
struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER);
if (message!=WM_INITDIALOG) if (message!=WM_INITDIALOG)
{ {
if (!lpp) if (!lpp)
...@@ -2142,15 +2165,38 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message, ...@@ -2142,15 +2165,38 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message,
*/ */
BOOL ChooseFont(LPCHOOSEFONT lpChFont) BOOL ChooseFont(LPCHOOSEFONT lpChFont)
{ {
HANDLE hInst, hDlgTmpl; HINSTANCE hInst;
HANDLE hDlgTmpl, hResInfo;
BOOL bRet; BOOL bRet;
dprintf_commdlg(stddeb,"ChooseFont\n"); dprintf_commdlg(stddeb,"ChooseFont\n");
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_FONT ); if (!lpChFont) return FALSE;
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChFont->hInstance;
else if (lpChFont->Flags & CF_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChFont->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_FONT );
if (!hDlgTmpl)
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
hInst = WIN_GetWindowInstance( lpChFont->hwndOwner ); hInst = WIN_GetWindowInstance( lpChFont->hwndOwner );
bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpChFont->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpChFont->hwndOwner,
MODULE_GetWndProcEntry16("FormatCharDlgProc"), MODULE_GetWndProcEntry16("FormatCharDlgProc"),
(DWORD)lpChFont ); (DWORD)lpChFont );
SYSRES_FreeResource( hDlgTmpl ); if (!(lpChFont->Flags & CF_ENABLETEMPLATEHANDLE))
{
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet; return bRet;
} }
...@@ -2188,7 +2234,7 @@ int FontFamilyEnumProc(LPLOGFONT lplf ,LPTEXTMETRIC lptm, int nFontType, LPARAM ...@@ -2188,7 +2234,7 @@ int FontFamilyEnumProc(LPLOGFONT lplf ,LPTEXTMETRIC lptm, int nFontType, LPARAM
WORD w; WORD w;
HWND hwnd=LOWORD(lParam); HWND hwnd=LOWORD(lParam);
HWND hDlg=GetParent(hwnd); HWND hDlg=GetParent(hwnd);
LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong(hDlg, DWL_USER); LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);
dprintf_commdlg(stddeb,"FontFamilyEnumProc: font=%s (nFontType=%d)\n", dprintf_commdlg(stddeb,"FontFamilyEnumProc: font=%s (nFontType=%d)\n",
lplf->lfFaceName,nFontType); lplf->lfFaceName,nFontType);
...@@ -2294,7 +2340,7 @@ int FontStyleEnumProc(LPLOGFONT lplf ,LPTEXTMETRIC lptm, int nFontType, LPARAM l ...@@ -2294,7 +2340,7 @@ int FontStyleEnumProc(LPLOGFONT lplf ,LPTEXTMETRIC lptm, int nFontType, LPARAM l
HWND hcmb2=LOWORD(lParam); HWND hcmb2=LOWORD(lParam);
HWND hcmb3=HIWORD(lParam); HWND hcmb3=HIWORD(lParam);
HWND hDlg=GetParent(hcmb3); HWND hDlg=GetParent(hcmb3);
LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong(hDlg, DWL_USER); LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);
int i; int i;
dprintf_commdlg(stddeb,"FontStyleEnumProc: (nFontType=%d)\n",nFontType); dprintf_commdlg(stddeb,"FontStyleEnumProc: (nFontType=%d)\n",nFontType);
...@@ -2544,7 +2590,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2544,7 +2590,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM wParam, LPARAM lParam) LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM wParam, LPARAM lParam)
{ {
LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong(hDlg, DWL_USER); LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);
if (lpcf->Flags & CF_EFFECTS) if (lpcf->Flags & CF_EFFECTS)
if (HIWORD(lParam)==CTLCOLOR_STATIC && GetDlgCtrlID(LOWORD(lParam))==stc6) if (HIWORD(lParam)==CTLCOLOR_STATIC && GetDlgCtrlID(LOWORD(lParam))==stc6)
...@@ -2566,7 +2612,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2566,7 +2612,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
int i,j; int i,j;
long l; long l;
HDC hdc; HDC hdc;
LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong(hDlg, DWL_USER); LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);
LPLOGFONT lpxx=PTR_SEG_TO_LIN(lpcf->lpLogFont); LPLOGFONT lpxx=PTR_SEG_TO_LIN(lpcf->lpLogFont);
dprintf_commdlg(stddeb,"FormatCharDlgProc // WM_COMMAND lParam=%08lX\n", lParam); dprintf_commdlg(stddeb,"FormatCharDlgProc // WM_COMMAND lParam=%08lX\n", lParam);
...@@ -2642,6 +2688,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2642,6 +2688,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS; lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;
lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS; lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;
lpxx->lfQuality=DEFAULT_QUALITY; lpxx->lfQuality=DEFAULT_QUALITY;
lpcf->iPointSize= -10*lpxx->lfHeight;
hFont=CreateFontIndirect(lpxx); hFont=CreateFontIndirect(lpxx);
if (hFont) if (hFont)
...@@ -2665,7 +2712,16 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2665,7 +2712,16 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf); CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);
break; break;
case IDOK:EndDialog(hDlg, TRUE); case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
( (lpcf->Flags & CF_LIMITSIZE) &&
(-lpxx->lfHeight >= lpcf->nSizeMin) &&
(-lpxx->lfHeight <= lpcf->nSizeMax)))
EndDialog(hDlg, TRUE);
else
{
sprintf(buffer,"Select a font size among %d and %d points.",lpcf->nSizeMin,lpcf->nSizeMax);
MessageBox(hDlg,buffer,NULL,MB_OK);
}
return(TRUE); return(TRUE);
case IDCANCEL:EndDialog(hDlg, FALSE); case IDCANCEL:EndDialog(hDlg, FALSE);
return(TRUE); return(TRUE);
...@@ -2682,7 +2738,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) ...@@ -2682,7 +2738,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT FormatCharDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) LRESULT FormatCharDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong(hDlg, DWL_USER); LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);
if (message!=WM_INITDIALOG) if (message!=WM_INITDIALOG)
{ {
int res=0; int res=0;
......
...@@ -13,6 +13,6 @@ static char Copyright[] = "Copyright Bob Amstadt, 1994"; ...@@ -13,6 +13,6 @@ static char Copyright[] = "Copyright Bob Amstadt, 1994";
INT Escape(HDC hdc, INT nEscape, INT cbInput, INT Escape(HDC hdc, INT nEscape, INT cbInput,
LPCSTR lpszInData, LPVOID lpvOutData) LPCSTR lpszInData, LPVOID lpvOutData)
{ {
fprintf(stderr, "Escape(nEscape = %04x)\n", nEscape); /* fprintf(stderr, "Escape(nEscape = %04x)\n", nEscape); */
return 0; return 0;
} }
...@@ -880,11 +880,10 @@ _w95_walk_tree(LPKEYSTRUCT lpkey,struct _w95key *key) { ...@@ -880,11 +880,10 @@ _w95_walk_tree(LPKEYSTRUCT lpkey,struct _w95key *key) {
while (key) { while (key) {
if (key->name == NULL) { if (key->name == NULL) {
fprintf(stderr,"key with dkeaddr %lx not loaded, skipping hierarchy\n", fprintf(stderr,"_w95_walk_tree:Please report: key with dkeaddr %lx not loaded, skipping hierarchy\n",
key->dkeaddr key->dkeaddr
); );
key = key->next; return;
continue;
} }
lpxkey=_find_or_add_key(lpkey,strdupA2W(key->name)); lpxkey=_find_or_add_key(lpkey,strdupA2W(key->name));
...@@ -963,7 +962,9 @@ _w95dkelookup(unsigned long dkeaddr,int n,struct _w95nr2da *nr2da,struct _w95key ...@@ -963,7 +962,9 @@ _w95dkelookup(unsigned long dkeaddr,int n,struct _w95nr2da *nr2da,struct _w95key
for (i=0;i<n;i++) for (i=0;i<n;i++)
if (nr2da[(i+off)%n].dkeaddr == dkeaddr) if (nr2da[(i+off)%n].dkeaddr == dkeaddr)
return keys+nr2da[(i+off)%n].nr; return keys+nr2da[(i+off)%n].nr;
fprintf(stderr,"search didn't found dkeaddr %lx?\n",dkeaddr); /* 0x3C happens often, just report unusual values */
if (dkeaddr!=0x3c)
dprintf_reg(stddeb,"search hasn't found dkeaddr %lx?\n",dkeaddr);
return NULL; return NULL;
} }
...@@ -1043,7 +1044,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1043,7 +1044,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
where = 0x40; where = 0x40;
end = rgdbsection; end = rgdbsection;
nrofdkes = (end-where)/sizeof(struct dke); nrofdkes = (end-where)/sizeof(struct dke)+100;
data = (char*)xmalloc(end-where); data = (char*)xmalloc(end-where);
if ((end-where)!=read(fd,data,end-where)) if ((end-where)!=read(fd,data,end-where))
return; return;
...@@ -1052,6 +1053,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1052,6 +1053,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
keys = (struct _w95key*)xmalloc(nrofdkes * sizeof(struct _w95key)); keys = (struct _w95key*)xmalloc(nrofdkes * sizeof(struct _w95key));
memset(keys,'\0',nrofdkes*sizeof(struct _w95key)); memset(keys,'\0',nrofdkes*sizeof(struct _w95key));
nr2da= (struct _w95nr2da*)xmalloc(nrofdkes * sizeof(struct _w95nr2da)); nr2da= (struct _w95nr2da*)xmalloc(nrofdkes * sizeof(struct _w95nr2da));
memset(nr2da,'\0',nrofdkes*sizeof(struct _w95nr2da));
for (i=0;i<nrofdkes;i++) { for (i=0;i<nrofdkes;i++) {
struct dke dke; struct dke dke;
...@@ -1080,6 +1082,8 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1080,6 +1082,8 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
dkeaddr = dkeaddr & ~0xFFF; dkeaddr = dkeaddr & ~0xFFF;
} }
if (nr>nrofdkes) { if (nr>nrofdkes) {
/* 0xFFFFFFFF happens often, just report unusual values */
if (nr!=0xFFFFFFFF)
dprintf_reg(stddeb,"nr %ld exceeds nrofdkes %d, skipping.\n",nr,nrofdkes); dprintf_reg(stddeb,"nr %ld exceeds nrofdkes %d, skipping.\n",nr,nrofdkes);
continue; continue;
} }
...@@ -1091,8 +1095,13 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1091,8 +1095,13 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
break; break;
if (x==-1) if (x==-1)
break; /* finished reading if we got only 0 */ break; /* finished reading if we got only 0 */
if (nr) if (nr) {
if ( (dke.next!=(long)keys[nr].next) ||
(dke.nextsub!=(long)keys[nr].nextsub) ||
(dke.prevlvl!=(long)keys[nr].prevlvl)
)
dprintf_reg(stddeb,"key doubled? nr=%ld,key->dkeaddr=%lx,dkeaddr=%lx\n",nr,keys[nr].dkeaddr,dkeaddr); dprintf_reg(stddeb,"key doubled? nr=%ld,key->dkeaddr=%lx,dkeaddr=%lx\n",nr,keys[nr].dkeaddr,dkeaddr);
}
continue; continue;
} }
nr2da[i].nr = nr; nr2da[i].nr = nr;
...@@ -1144,7 +1153,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1144,7 +1153,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
nextrgdb = curdata+off_next_rgdb; nextrgdb = curdata+off_next_rgdb;
curdata+=0x20; curdata+=0x20;
} else { } else {
dprintf_reg(stddeb,"at end of RGDB section, but no next header. Breaking.\n"); dprintf_reg(stddeb,"at end of RGDB section, but no next header (%x of %lx). Breaking.\n",curdata-data,end-rgdbsection);
break; break;
} }
} }
...@@ -1157,22 +1166,12 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { ...@@ -1157,22 +1166,12 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
XREAD(&dkh,sizeof(dkh)); XREAD(&dkh,sizeof(dkh));
nr = dkh.nrLS + (dkh.nrMS<<8); nr = dkh.nrLS + (dkh.nrMS<<8);
if (nr>nrofdkes) { if ((nr>nrofdkes) || (dkh.nrLS == 0xFFFF)) {
if (dkh.nrLS == 0xFFFF) { if (dkh.nrLS == 0xFFFF) {
curdata+= dkh.nextkeyoff - bytesread; /* skip over key using nextkeyoff */
XREAD(magic,4); curdata+=dkh.nextkeyoff-sizeof(struct dkh);
if (strcmp(magic,"RGDB")) {
if ((curdata-data)<end)
dprintf_reg(stddeb,"while skipping to next RGDB block found magic %s\n",magic);
break;
}
curdata+=0x1c;
continue; continue;
} }
if (dkh.nrLS == 0xFFFE) {
dprintf_reg(stddeb,"0xFFFE at %x\n",curdata-data);
break;
}
dprintf_reg(stddeb,"haven't found nr %ld.\n",nr); dprintf_reg(stddeb,"haven't found nr %ld.\n",nr);
key = &xkey; key = &xkey;
memset(key,'\0',sizeof(xkey)); memset(key,'\0',sizeof(xkey));
......
...@@ -361,7 +361,7 @@ INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon) ...@@ -361,7 +361,7 @@ INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
if (!hIcon) hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON)); if (!hIcon) hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON));
handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ); handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX );
if (!handle) return FALSE; if (!handle) return FALSE;
bRet = DialogBoxIndirectParam( WIN_GetWindowInstance( hWnd ), bRet = DialogBoxIndirectParam16( WIN_GetWindowInstance( hWnd ),
handle, hWnd, handle, hWnd,
MODULE_GetWndProcEntry16("AboutDlgProc"), MODULE_GetWndProcEntry16("AboutDlgProc"),
(LONG)hIcon ); (LONG)hIcon );
......
...@@ -191,9 +191,16 @@ static const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -191,9 +191,16 @@ static const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0130 */ /* 0x0130 */
NULL, "wm_lbtrackpoint", NULL,
NULL, NULL, NULL, NULL, NULL, NULL, "wm_lbtrackpoint", /* 0x0131 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "WM_CTLCOLORMSGBOX", /* 0x0132 */
"WM_CTLCOLOREDIT", /* 0x0133 */
"WM_CTLCOLORLISTBOX", /* 0x0134 */
"WM_CTLCOLORBTN", /* 0x0135 */
"WM_CTLCOLORDLG", /* 0x0136 */
"WM_CTLCOLORSCROLLBAR", /* 0x0137 */
"WM_CTLCOLORSTATIC", /* 0x0138 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0140 - Win32 Comboboxes */ /* 0x0140 - Win32 Comboboxes */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define MAX_OP_LEN 6 /* Longest opcode + 1 for the terminating 0 */ #define MAX_OP_LEN 6 /* Longest opcode + 1 for the terminating 0 */
extern void CLIPPING_UpdateGCRegion(DC* );
static const unsigned char BITBLT_Opcodes[256][MAX_OP_LEN] = static const unsigned char BITBLT_Opcodes[256][MAX_OP_LEN] =
{ {
{ OP(PAT,DST,GXclear) }, /* 0x00 0 */ { OP(PAT,DST,GXclear) }, /* 0x00 0 */
...@@ -1031,6 +1033,9 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, ...@@ -1031,6 +1033,9 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000)); useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000));
if (!dcSrc && useSrc) return FALSE; if (!dcSrc && useSrc) return FALSE;
if (dcDst->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion( dcDst );
if (dcSrc && (dcSrc->w.flags & DC_DIRTY)) CLIPPING_UpdateGCRegion( dcSrc );
/* Map the coordinates to device coords */ /* Map the coordinates to device coords */
xDst = dcDst->w.DCOrgX + XLPTODP( dcDst, xDst ); xDst = dcDst->w.DCOrgX + XLPTODP( dcDst, xDst );
...@@ -1270,7 +1275,7 @@ BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height, ...@@ -1270,7 +1275,7 @@ BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height,
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
dprintf_bitblt(stddeb, dprintf_bitblt(stddeb,
"BitBlt: %04x %d,%d %d bpp -> %04x %d,%d %dx%dx%d rop=%06lx\n", "BitBlt: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop); hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
......
...@@ -122,11 +122,17 @@ HBITMAP CreateBitmap( INT width, INT height, UINT planes, UINT bpp, LPVOID bits ...@@ -122,11 +122,17 @@ HBITMAP CreateBitmap( INT width, INT height, UINT planes, UINT bpp, LPVOID bits
*/ */
HBITMAP CreateCompatibleBitmap( HDC hdc, INT width, INT height ) HBITMAP CreateCompatibleBitmap( HDC hdc, INT width, INT height )
{ {
HBITMAP hbmpRet = 0;
DC * dc; DC * dc;
dprintf_gdi(stddeb, "CreateCompatibleBitmap: %04x %dx%d\n", dprintf_gdi(stddeb, "CreateCompatibleBitmap(%04x,%d,%d) = \n",
hdc, width, height ); hdc, width, height );
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
return CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL );
hbmpRet = CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL );
dprintf_gdi(stddeb,"\t\t%04x\n", hbmpRet);
return hbmpRet;
} }
...@@ -278,7 +284,7 @@ int BITMAP_GetObject( BITMAPOBJ * bmp, int count, LPSTR buffer ) ...@@ -278,7 +284,7 @@ int BITMAP_GetObject( BITMAPOBJ * bmp, int count, LPSTR buffer )
/*********************************************************************** /***********************************************************************
* BITMAP_SelectObject * BITMAP_SelectObject
*/ */
HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap, HBITMAP BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
BITMAPOBJ * bmp ) BITMAPOBJ * bmp )
{ {
HRGN hrgn; HRGN hrgn;
...@@ -300,7 +306,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap, ...@@ -300,7 +306,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
XFreeGC( display, dc->u.x.gc ); XFreeGC( display, dc->u.x.gc );
dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL ); dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL );
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel; dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
DC_InitDC( hdc ); DC_InitDC( dc );
} }
else CLIPPING_UpdateGCRegion( dc ); /* Just update GC clip region */ else CLIPPING_UpdateGCRegion( dc ); /* Just update GC clip region */
return prevHandle; return prevHandle;
......
...@@ -334,14 +334,14 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap ) ...@@ -334,14 +334,14 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
/*********************************************************************** /***********************************************************************
* BRUSH_SelectObject * BRUSH_SelectObject
*/ */
HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
{ {
HBITMAP hBitmap; HBITMAP hBitmap;
BITMAPINFO * bmpInfo; BITMAPINFO * bmpInfo;
HBRUSH prevHandle = dc->w.hBrush; HBRUSH prevHandle = dc->w.hBrush;
dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n", dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
hdc,hbrush); dc->hSelf,hbrush);
if (dc->header.wMagic == METAFILE_DC_MAGIC) if (dc->header.wMagic == METAFILE_DC_MAGIC)
{ {
switch (brush->logbrush.lbStyle) switch (brush->logbrush.lbStyle)
...@@ -400,7 +400,7 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) ...@@ -400,7 +400,7 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HANDLE)brush->logbrush.lbHatch ))) if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HANDLE)brush->logbrush.lbHatch )))
{ {
int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor ); int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
hBitmap = CreateDIBitmap( hdc, &bmpInfo->bmiHeader, CBM_INIT, hBitmap = CreateDIBitmap( dc->hSelf, &bmpInfo->bmiHeader, CBM_INIT,
((char *)bmpInfo) + size, bmpInfo, ((char *)bmpInfo) + size, bmpInfo,
(WORD) brush->logbrush.lbColor ); (WORD) brush->logbrush.lbColor );
BRUSH_SelectPatternBrush( dc, hBitmap ); BRUSH_SelectPatternBrush( dc, hBitmap );
......
...@@ -50,6 +50,13 @@ void CLIPPING_UpdateGCRegion( DC * dc ) ...@@ -50,6 +50,13 @@ void CLIPPING_UpdateGCRegion( DC * dc )
fprintf( stderr, "UpdateGCRegion: hVisRgn is zero. Please report this.\n" ); fprintf( stderr, "UpdateGCRegion: hVisRgn is zero. Please report this.\n" );
exit(1); exit(1);
} }
if (dc->w.flags & DC_DIRTY)
{
UpdateDirtyDC(dc);
dc->w.flags &= ~DC_DIRTY;
}
if (!dc->w.hClipRgn) if (!dc->w.hClipRgn)
CombineRgn( dc->w.hGCClipRgn, dc->w.hVisRgn, 0, RGN_COPY ); CombineRgn( dc->w.hGCClipRgn, dc->w.hVisRgn, 0, RGN_COPY );
else else
...@@ -80,6 +87,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn ) ...@@ -80,6 +87,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn )
dc->w.hClipRgn = 0; dc->w.hClipRgn = 0;
retval = SIMPLEREGION; /* Clip region == whole DC */ retval = SIMPLEREGION; /* Clip region == whole DC */
} }
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
return retval; return retval;
} }
...@@ -96,6 +104,8 @@ int SelectVisRgn( HDC hdc, HRGN hrgn ) ...@@ -96,6 +104,8 @@ int SelectVisRgn( HDC hdc, HRGN hrgn )
dprintf_clipping(stddeb, "SelectVisRgn: %04x %04x\n", hdc, hrgn ); dprintf_clipping(stddeb, "SelectVisRgn: %04x %04x\n", hdc, hrgn );
dc->w.flags &= ~DC_DIRTY;
retval = CombineRgn( dc->w.hVisRgn, hrgn, 0, RGN_COPY ); retval = CombineRgn( dc->w.hVisRgn, hrgn, 0, RGN_COPY );
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
return retval; return retval;
...@@ -271,6 +281,7 @@ int ExcludeVisRect( HDC hdc, short left, short top, short right, short bottom ) ...@@ -271,6 +281,7 @@ int ExcludeVisRect( HDC hdc, short left, short top, short right, short bottom )
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "ExcludeVisRect: %04x %dx%d,%dx%d\n", dprintf_clipping(stddeb, "ExcludeVisRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, TRUE ); return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, TRUE );
} }
...@@ -285,6 +296,7 @@ int IntersectVisRect( HDC hdc, short left, short top, ...@@ -285,6 +296,7 @@ int IntersectVisRect( HDC hdc, short left, short top,
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "IntersectVisRect: %04x %dx%d,%dx%d\n", dprintf_clipping(stddeb, "IntersectVisRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, FALSE ); return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, FALSE );
} }
...@@ -299,6 +311,10 @@ BOOL PtVisible( HDC hdc, short x, short y ) ...@@ -299,6 +311,10 @@ BOOL PtVisible( HDC hdc, short x, short y )
dprintf_clipping(stddeb, "PtVisible: %04x %d,%d\n", hdc, x, y ); dprintf_clipping(stddeb, "PtVisible: %04x %d,%d\n", hdc, x, y );
if (!dc->w.hGCClipRgn) return FALSE; if (!dc->w.hGCClipRgn) return FALSE;
if( dc->w.flags & DC_DIRTY ) UpdateDirtyDC(dc);
dc->w.flags &= ~DC_DIRTY;
return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) ); return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
} }
...@@ -375,6 +391,9 @@ HRGN SaveVisRgn( HDC hdc ) ...@@ -375,6 +391,9 @@ HRGN SaveVisRgn( HDC hdc )
fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" ); fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" );
exit(1); exit(1);
} }
if( dc->w.flags & DC_DIRTY ) UpdateDirtyDC(dc);
dc->w.flags &= ~DC_DIRTY;
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC ))) if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC )))
return 0; return 0;
if (!(copy = CreateRectRgn( 0, 0, 0, 0 ))) return 0; if (!(copy = CreateRectRgn( 0, 0, 0, 0 ))) return 0;
......
...@@ -14,11 +14,13 @@ ...@@ -14,11 +14,13 @@
#include "color.h" #include "color.h"
#include "debug.h" #include "debug.h"
#include "font.h" #include "font.h"
#include "callback.h"
#include "xmalloc.h" #include "xmalloc.h"
static DeviceCaps * displayDevCaps = NULL; static DeviceCaps * displayDevCaps = NULL;
extern void CLIPPING_UpdateGCRegion( DC * dc ); /* objects/clipping.c */ extern void CLIPPING_UpdateGCRegion( DC * dc ); /* objects/clipping.c */
extern BOOL DCHook( HDC, WORD, DWORD, DWORD ); /* windows/dce.c */
/* Default DC values */ /* Default DC values */
static const WIN_DC_INFO DC_defaultValues = static const WIN_DC_INFO DC_defaultValues =
...@@ -142,15 +144,14 @@ void DC_FillDevCaps( DeviceCaps * caps ) ...@@ -142,15 +144,14 @@ void DC_FillDevCaps( DeviceCaps * caps )
* *
* Setup device-specific DC values for a newly created DC. * Setup device-specific DC values for a newly created DC.
*/ */
void DC_InitDC( HDC hdc ) void DC_InitDC( DC* dc )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); RealizeDefaultPalette( dc->hSelf );
RealizeDefaultPalette( hdc ); SetTextColor( dc->hSelf, dc->w.textColor );
SetTextColor( hdc, dc->w.textColor ); SetBkColor( dc->hSelf, dc->w.backgroundColor );
SetBkColor( hdc, dc->w.backgroundColor ); SelectObject( dc->hSelf, dc->w.hPen );
SelectObject( hdc, dc->w.hPen ); SelectObject( dc->hSelf, dc->w.hBrush );
SelectObject( hdc, dc->w.hBrush ); SelectObject( dc->hSelf, dc->w.hFont );
SelectObject( hdc, dc->w.hFont );
XSetGraphicsExposures( display, dc->u.x.gc, False ); XSetGraphicsExposures( display, dc->u.x.gc, False );
XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors ); XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors );
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
...@@ -191,6 +192,8 @@ BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) ...@@ -191,6 +192,8 @@ BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors )
val.background = COLOR_PixelToPalette[val.background]; val.background = COLOR_PixelToPalette[val.background];
} }
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
val.function = DC_XROPfunction[dc->w.ROPmode-1]; val.function = DC_XROPfunction[dc->w.ROPmode-1];
val.fill_style = dc->u.x.brush.fillStyle; val.fill_style = dc->u.x.brush.fillStyle;
switch(val.fill_style) switch(val.fill_style)
...@@ -262,6 +265,8 @@ BOOL DC_SetupGCForPen( DC * dc ) ...@@ -262,6 +265,8 @@ BOOL DC_SetupGCForPen( DC * dc )
if (dc->u.x.pen.style == PS_NULL) return FALSE; if (dc->u.x.pen.style == PS_NULL) return FALSE;
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
if ((screenDepth <= 8) && /* FIXME: Should check for palette instead */ if ((screenDepth <= 8) && /* FIXME: Should check for palette instead */
((dc->w.ROPmode == R2_BLACK) || (dc->w.ROPmode == R2_WHITE))) ((dc->w.ROPmode == R2_BLACK) || (dc->w.ROPmode == R2_WHITE)))
{ {
...@@ -309,6 +314,9 @@ BOOL DC_SetupGCForText( DC * dc ) ...@@ -309,6 +314,9 @@ BOOL DC_SetupGCForText( DC * dc )
fprintf( stderr, "DC_SetupGCForText: fstruct is NULL. Please report this\n" ); fprintf( stderr, "DC_SetupGCForText: fstruct is NULL. Please report this\n" );
return FALSE; return FALSE;
} }
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
val.function = GXcopy; /* Text is always GXcopy */ val.function = GXcopy; /* Text is always GXcopy */
val.foreground = dc->w.textPixel; val.foreground = dc->w.textPixel;
val.background = dc->w.backgroundPixel; val.background = dc->w.backgroundPixel;
...@@ -322,6 +330,26 @@ BOOL DC_SetupGCForText( DC * dc ) ...@@ -322,6 +330,26 @@ BOOL DC_SetupGCForText( DC * dc )
/*********************************************************************** /***********************************************************************
* DC_CallHookProc
*/
BOOL DC_CallHookProc(DC* dc, WORD code, LPARAM lParam)
{
BOOL bRet = 0;
FARPROC ptr = GDI_GetDefDCHook();
dprintf_dc(stddeb,"CallDCHook: code %04x\n", code);
/* if 16-bit callback is, in fact, a thunk to DCHook simply call DCHook */
if( dc->hookProc && !(dc->w.flags & (DC_SAVED | DC_MEMORY)) )
bRet = (dc->hookProc == ptr) ?
DCHook(dc->hSelf, code, dc->dwHookData, lParam):
CallDCHookProc(dc->hookProc, dc->hSelf, code, dc->dwHookData, lParam);
return bRet;
}
/***********************************************************************
* GetDCState (GDI.179) * GetDCState (GDI.179)
*/ */
HDC GetDCState( HDC hdc ) HDC GetDCState( HDC hdc )
...@@ -338,6 +366,8 @@ HDC GetDCState( HDC hdc ) ...@@ -338,6 +366,8 @@ HDC GetDCState( HDC hdc )
memset( &newdc->u.x, 0, sizeof(newdc->u.x) ); memset( &newdc->u.x, 0, sizeof(newdc->u.x) );
memcpy( &newdc->w, &dc->w, sizeof(dc->w) ); memcpy( &newdc->w, &dc->w, sizeof(dc->w) );
memcpy( &newdc->u.x.pen, &dc->u.x.pen, sizeof(dc->u.x.pen) ); memcpy( &newdc->u.x.pen, &dc->u.x.pen, sizeof(dc->u.x.pen) );
newdc->hSelf = (HDC)handle;
newdc->saveLevel = 0; newdc->saveLevel = 0;
newdc->w.flags |= DC_SAVED; newdc->w.flags |= DC_SAVED;
...@@ -474,7 +504,11 @@ HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initDa ...@@ -474,7 +504,11 @@ HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initDa
DC_FillDevCaps( displayDevCaps ); DC_FillDevCaps( displayDevCaps );
} }
dc->hSelf = (HDC)handle;
dc->saveLevel = 0; dc->saveLevel = 0;
dc->dwHookData = 0L;
dc->hookProc = (SEGPTR)NULL;
memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) ); memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) );
memset( &dc->u.x, 0, sizeof(dc->u.x) ); memset( &dc->u.x, 0, sizeof(dc->u.x) );
...@@ -491,7 +525,7 @@ HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initDa ...@@ -491,7 +525,7 @@ HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initDa
return 0; return 0;
} }
DC_InitDC( handle ); DC_InitDC( dc );
return handle; return handle;
} }
...@@ -531,7 +565,11 @@ HDC CreateCompatibleDC( HDC hdc ) ...@@ -531,7 +565,11 @@ HDC CreateCompatibleDC( HDC hdc )
} }
bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
dc->hSelf = (HDC)handle;
dc->saveLevel = 0; dc->saveLevel = 0;
dc->dwHookData = 0L;
dc->hookProc = (SEGPTR)NULL;
memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) ); memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) );
memset( &dc->u.x, 0, sizeof(dc->u.x) ); memset( &dc->u.x, 0, sizeof(dc->u.x) );
...@@ -551,7 +589,7 @@ HDC CreateCompatibleDC( HDC hdc ) ...@@ -551,7 +589,7 @@ HDC CreateCompatibleDC( HDC hdc )
return 0; return 0;
} }
DC_InitDC( handle ); DC_InitDC( dc );
return handle; return handle;
} }
...@@ -713,3 +751,60 @@ DWORD SetDCOrg( HDC hdc, short x, short y ) ...@@ -713,3 +751,60 @@ DWORD SetDCOrg( HDC hdc, short x, short y )
dc->w.DCOrgY = y; dc->w.DCOrgY = y;
return prevOrg; return prevOrg;
} }
/***********************************************************************
* SetDCHook (GDI.190)
*/
BOOL SetDCHook( HDC hDC, FARPROC16 hookProc, DWORD dwHookData )
{
DC *dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC );
dprintf_dc( stddeb, "SetDCHook: hookProc %08x, default is %08x\n",
(unsigned)hookProc,(unsigned)GDI_GetDefDCHook() );
if (!dc) return FALSE;
dc->hookProc = hookProc;
dc->dwHookData = dwHookData;
return TRUE;
}
/***********************************************************************
* GetDCHook (GDI.191)
*/
DWORD GetDCHook( HDC hDC, FARPROC16 *phookProc )
{
DC *dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC );
if (!dc) return 0;
*phookProc = dc->hookProc;
return dc->dwHookData;
}
/***********************************************************************
* SetHookFlags (GDI.192)
*/
WORD SetHookFlags(HDC hDC, WORD flags)
{
DC* dc = (DC*)GDI_GetObjPtr( hDC, DC_MAGIC );
if( dc )
{
WORD wRet = dc->w.flags & DC_DIRTY;
/* "Undocumented Windows" info is slightly
* confusing
*/
dprintf_dc(stddeb,"SetHookFlags: hDC %04x, flags %04x\n",hDC,flags);
if( flags & DCHF_INVALIDATEVISRGN )
dc->w.flags |= DC_DIRTY;
else if( flags & DCHF_VALIDATEVISRGN || !flags )
dc->w.flags &= ~DC_DIRTY;
return wRet;
}
return 0;
}
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "debug.h" #include "debug.h"
#include "xmalloc.h" #include "xmalloc.h"
extern void CLIPPING_UpdateGCRegion(DC* );
/*********************************************************************** /***********************************************************************
* DIB_GetImageWidthBytes * DIB_GetImageWidthBytes
...@@ -575,6 +576,8 @@ static int DIB_SetImageBits( DC *dc, WORD lines, WORD depth, LPSTR bits, ...@@ -575,6 +576,8 @@ static int DIB_SetImageBits( DC *dc, WORD lines, WORD depth, LPSTR bits,
if (!(colorMapping = DIB_BuildColorMap( dc, coloruse, depth, info ))) if (!(colorMapping = DIB_BuildColorMap( dc, coloruse, depth, info )))
return 0; return 0;
if( dc->w.flags & DC_DIRTY ) CLIPPING_UpdateGCRegion(dc);
/* Transfer the pixels */ /* Transfer the pixels */
XCREATEIMAGE(bmpImage, infoWidth, lines, depth ); XCREATEIMAGE(bmpImage, infoWidth, lines, depth );
......
...@@ -785,7 +785,12 @@ DWORD SetMapperFlags(HDC hDC, DWORD dwFlag) ...@@ -785,7 +785,12 @@ DWORD SetMapperFlags(HDC hDC, DWORD dwFlag)
*/ */
BOOL GetCharABCWidths(HDC hdc, UINT wFirstChar, UINT wLastChar, LPABC lpABC) BOOL GetCharABCWidths(HDC hdc, UINT wFirstChar, UINT wLastChar, LPABC lpABC)
{ {
/* No TrueType fonts in Wine */
/* No TrueType fonts in Wine so far */
fprintf(stdnimp,"STUB: GetCharABCWidths(%04x,%04x,%04x,%08x)\n",
hdc,wFirstChar,wLastChar,(unsigned)lpABC);
return FALSE; return FALSE;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "brush.h" #include "brush.h"
#include "font.h" #include "font.h"
#include "heap.h" #include "heap.h"
#include "module.h"
#include "palette.h" #include "palette.h"
#include "pen.h" #include "pen.h"
#include "region.h" #include "region.h"
...@@ -152,16 +153,23 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] = ...@@ -152,16 +153,23 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
(GDIOBJHDR *) &SystemFixedFont (GDIOBJHDR *) &SystemFixedFont
}; };
static FARPROC16 defDCHookCallback;
/*********************************************************************** /***********************************************************************
* GDI_Init * GDI_Init
* *
* GDI initialisation. * GDI initialization.
*/ */
BOOL GDI_Init(void) BOOL GDI_Init(void)
{ {
HPALETTE16 hpalette; HPALETTE16 hpalette;
defDCHookCallback = (FARPROC16)MODULE_GetEntryPoint(GetModuleHandle("USER"),
362 /* DCHook */ );
dprintf_gdi( stddeb, "DCHook: 16-bit callback is %08x\n",
(unsigned)defDCHookCallback );
/* Create default palette */ /* Create default palette */
if (!(hpalette = COLOR_Init())) return FALSE; if (!(hpalette = COLOR_Init())) return FALSE;
...@@ -171,11 +179,11 @@ BOOL GDI_Init(void) ...@@ -171,11 +179,11 @@ BOOL GDI_Init(void)
if (!BITMAP_Init()) return FALSE; if (!BITMAP_Init()) return FALSE;
/* Initialise brush dithering */ /* Initialize brush dithering */
if (!BRUSH_Init()) return FALSE; if (!BRUSH_Init()) return FALSE;
/* Initialise fonts */ /* Initialize fonts */
if (!FONT_Init()) return FALSE; if (!FONT_Init()) return FALSE;
...@@ -184,6 +192,15 @@ BOOL GDI_Init(void) ...@@ -184,6 +192,15 @@ BOOL GDI_Init(void)
/*********************************************************************** /***********************************************************************
* GDI_GetDefDCHook
*/
FARPROC16 GDI_GetDefDCHook(void)
{
return defDCHookCallback;
}
/***********************************************************************
* GDI_AllocObject * GDI_AllocObject
*/ */
HANDLE GDI_AllocObject( WORD size, WORD magic ) HANDLE GDI_AllocObject( WORD size, WORD magic )
...@@ -321,7 +338,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) ...@@ -321,7 +338,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
GDIOBJHDR * ptr = NULL; GDIOBJHDR * ptr = NULL;
DC * dc; DC * dc;
dprintf_gdi(stddeb, "SelectObject: %04x %04x\n", hdc, handle ); dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", hdc, handle );
if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE)) if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
ptr = StockObjects[handle - FIRST_STOCK_HANDLE]; ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
else else
...@@ -340,9 +357,9 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) ...@@ -340,9 +357,9 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
case PEN_MAGIC: case PEN_MAGIC:
return PEN_SelectObject( dc, handle, (PENOBJ *)ptr ); return PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
case BRUSH_MAGIC: case BRUSH_MAGIC:
return BRUSH_SelectObject( hdc, dc, handle, (BRUSHOBJ *)ptr ); return BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
case BITMAP_MAGIC: case BITMAP_MAGIC:
return BITMAP_SelectObject( hdc, dc, handle, (BITMAPOBJ *)ptr ); return BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
case FONT_MAGIC: case FONT_MAGIC:
return FONT_SelectObject( dc, handle, (FONTOBJ *)ptr ); return FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
case REGION_MAGIC: case REGION_MAGIC:
......
...@@ -338,9 +338,9 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, ...@@ -338,9 +338,9 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
if (!DC_SetupGCForText( dc )) return TRUE; if (!DC_SetupGCForText( dc )) return TRUE;
font = dc->u.x.font.fstruct; font = dc->u.x.font.fstruct;
dprintf_text(stddeb,"ExtTextOut: %d,%d '%*.*s', %d flags=%d\n", dprintf_text(stddeb,"ExtTextOut: hdc=%04x %d,%d '%*.*s', %d flags=%d\n",
x, y, count, count, str, count, flags); hdc, x, y, count, count, str, count, flags);
if (lprect != NULL) dprintf_text(stddeb, "rect %d %d %d %d\n", if (lprect != NULL) dprintf_text(stddeb, "\trect=(%d,%d- %d,%d)\n",
lprect->left, lprect->top, lprect->left, lprect->top,
lprect->right, lprect->bottom ); lprect->right, lprect->bottom );
...@@ -363,6 +363,9 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, ...@@ -363,6 +363,9 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
if (rect.bottom < rect.top) SWAP_INT( rect.top, rect.bottom ); if (rect.bottom < rect.top) SWAP_INT( rect.top, rect.bottom );
} }
dprintf_text(stddeb,"\treal coord: x=%i, y=%i, rect=(%d,%d-%d,%d)\n",
x, y, rect.left, rect.top, rect.right, rect.bottom);
/* Draw the rectangle */ /* Draw the rectangle */
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
...@@ -394,6 +397,7 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, ...@@ -394,6 +397,7 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
x -= info.width / 2; x -= info.width / 2;
break; break;
} }
switch( dc->w.textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) switch( dc->w.textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) )
{ {
case TA_TOP: case TA_TOP:
......
Sun Jun 2 13:14:55 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* Program icons: repaint on WM_NCPAINT or WM_PAINTICON
Sun Apr 14 20:09:19 1996 Pablo Saratxaga <srtxg@linux.chanae.stben.be> Sun Apr 14 20:09:19 1996 Pablo Saratxaga <srtxg@linux.chanae.stben.be>
* [Fr.rc] (new) * [Fr.rc] (new)
......
...@@ -32,7 +32,8 @@ static LRESULT PROGRAM_ProgramWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARA ...@@ -32,7 +32,8 @@ static LRESULT PROGRAM_ProgramWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARA
return(0); return(0);
} }
case WM_PAINT: case WM_PAINTICON:
case WM_NCPAINT:
{ {
PROGRAM *program; PROGRAM *program;
PAINTSTRUCT ps; PAINTSTRUCT ps;
...@@ -205,6 +206,7 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName, ...@@ -205,6 +206,7 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
SetWindowLong(program->hWnd, 0, (LONG) hProgram); SetWindowLong(program->hWnd, 0, (LONG) hProgram);
ShowWindow (program->hWnd, SW_SHOWMINIMIZED); ShowWindow (program->hWnd, SW_SHOWMINIMIZED);
SetWindowPos (program->hWnd, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
UpdateWindow (program->hWnd); UpdateWindow (program->hWnd);
return hProgram; return hProgram;
......
...@@ -63,6 +63,7 @@ and translate it to your language. It's okay for: ...@@ -63,6 +63,7 @@ and translate it to your language. It's okay for:
* English * English
* German * German
* Finnish * Finnish
* Italian
..... .....
Thank you. Thank you.
......
...@@ -38,7 +38,6 @@ FONT 10, "System" ...@@ -38,7 +38,6 @@ FONT 10, "System"
ICON "", 1088, 195, 10, 18, 20 ICON "", 1088, 195, 10, 18, 20
} }
OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134 OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Apri" CAPTION "Apri"
...@@ -131,16 +130,32 @@ FONT 8, "Helv" ...@@ -131,16 +130,32 @@ FONT 8, "Helv"
COMBOBOX 1138, 168, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP COMBOBOX 1138, 168, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
} }
CHOOSE_FONT DIALOG DISCARDABLE 13, 54, 264, 147
CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Font" CAPTION "Font"
FONT 8, "Helv" FONT 8, "Helv"
{ {
LTEXT "Font:", 1088, 6, 6, 40, 9 LTEXT "&Font:",1088 ,6,3,40,9
LTEXT "", 1089, 60, 6, 150, 9 COMBOBOX 1136 ,6,13,94,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
PUSHBUTTON "Annulla", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP LTEXT "St&ile:",1089 ,108,3,44,9
COMBOBOX 1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
LTEXT "&Dimensione:",1090,179,3,30,9
COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
DEFPUSHBUTTON "OK",IDOK,218,6,40,14,WS_GROUP
PUSHBUTTON "Annulla",IDCANCEL,218,23,40,14,WS_GROUP
PUSHBUTTON "A&pplica", 1026,218,40,40,14,WS_GROUP
PUSHBUTTON "&Aiuto" , 1038,218,57,40,14,WS_GROUP
GROUPBOX "Effetti",1072,6,72,84,34,WS_GROUP
CHECKBOX "&Barrato", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "&Sottolineato", 1041, 10,94,50,10, BS_AUTOCHECKBOX
LTEXT "&Colore:", 1091 ,6,110,30,9
COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Esempio",1073,98,72,160,49,WS_GROUP
CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
......
...@@ -1016,21 +1016,18 @@ static void BuildSpec16Files(void) ...@@ -1016,21 +1016,18 @@ static void BuildSpec16Files(void)
break; break;
case TYPE_BYTE: case TYPE_BYTE:
printf( "/* %s.%d */\n", DLLName, i);
odp->offset = data_offset; odp->offset = data_offset;
data_offset += StoreVariableCode( data, 1, odp); data_offset += StoreVariableCode( data + data_offset, 1, odp);
break; break;
case TYPE_WORD: case TYPE_WORD:
printf( "/* %s.%d */\n", DLLName, i);
odp->offset = data_offset; odp->offset = data_offset;
data_offset += StoreVariableCode( data, 2, odp); data_offset += StoreVariableCode( data + data_offset, 2, odp);
break; break;
case TYPE_LONG: case TYPE_LONG:
printf( "/* %s.%d */\n", DLLName, i);
odp->offset = data_offset; odp->offset = data_offset;
data_offset += StoreVariableCode( data, 4, odp); data_offset += StoreVariableCode( data + data_offset, 4, odp);
break; break;
case TYPE_RETURN: case TYPE_RETURN:
......
...@@ -21,8 +21,7 @@ C_SRCS = \ ...@@ -21,8 +21,7 @@ C_SRCS = \
struct32.c \ struct32.c \
thread.c \ thread.c \
time.c \ time.c \
user32.c \ user32.c
winprocs.c
all: $(MODULE).o all: $(MODULE).o
......
...@@ -37,3 +37,33 @@ LPSTR GetCommandLineA(void) ...@@ -37,3 +37,33 @@ LPSTR GetCommandLineA(void)
return buffer; return buffer;
} }
/***********************************************************************
* GetSystemPowerStatus (KERNEL32.621)
*/
BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
{
return FALSE; /* no power management support */
}
/***********************************************************************
* SetSystemPowerState (KERNEL32.630)
*/
BOOL SetSystemPowerState(BOOL suspend_or_hibernate, BOOL force_flag)
{
/* suspend_or_hibernate flag: w95 does not support
this feature anyway */
for ( ;0; )
{
if ( force_flag )
{
}
else
{
}
}
return TRUE;
}
...@@ -60,6 +60,43 @@ VOID GetSystemTime(LPSYSTEMTIME systime) ...@@ -60,6 +60,43 @@ VOID GetSystemTime(LPSYSTEMTIME systime)
systime->wMilliseconds = (tv.tv_usec / 1000) % 1000; systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
} }
/***********************************************************************
* SetSystemTime (KERNEL32.507)
*/
BOOL SetSystemTime(const SYSTEMTIME *systime)
{
struct timeval tv;
struct timezone tz;
struct tm t;
time_t sec;
/* call gettimeofday to get the current timezone */
gettimeofday(&tv, &tz);
/* get the number of seconds */
t.tm_sec = systime->wSecond;
t.tm_min = systime->wMinute;
t.tm_hour = systime->wHour;
t.tm_mday = systime->wDay;
t.tm_mon = systime->wMonth;
t.tm_year = systime->wYear;
sec = mktime (&t);
/* set the new time */
tv.tv_sec = sec;
tv.tv_usec = systime->wMilliseconds * 1000;
if (settimeofday(&tv, &tz))
{
return FALSE;
}
else
{
return TRUE;
}
}
/*********************************************************************** /***********************************************************************
* GetTimeZoneInformation (KERNEL32.302) * GetTimeZoneInformation (KERNEL32.302)
*/ */
...@@ -78,6 +115,27 @@ DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo) ...@@ -78,6 +115,27 @@ DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo)
return TIME_ZONE_ID_UNKNOWN; return TIME_ZONE_ID_UNKNOWN;
} }
/***********************************************************************
* SetTimeZoneInformation (KERNEL32.515)
*/
BOOL SetTimeZoneInformation(const TIME_ZONE_INFORMATION *tzinfo)
{
struct timezone tz;
tz.tz_minuteswest = tzinfo->Bias;
tz.tz_dsttime = DST_NONE;
if (settimeofday(NULL, &tz))
{
return FALSE;
}
else
{
return TRUE;
}
}
/*********************************************************************** /***********************************************************************
* Sleep (KERNEL32.523) * Sleep (KERNEL32.523)
*/ */
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "struct32.h" #include "struct32.h"
#include "resource32.h" #include "resource32.h"
#include "string32.h" #include "string32.h"
#include "dialog.h"
#include "win.h" #include "win.h"
#include "winproc.h" #include "winproc.h"
#include "debug.h" #include "debug.h"
...@@ -68,275 +67,6 @@ UINT USER32_SetTimer(HWND hwnd, UINT id, UINT timeout, void *proc) ...@@ -68,275 +67,6 @@ UINT USER32_SetTimer(HWND hwnd, UINT id, UINT timeout, void *proc)
return SetTimer( hwnd, id, timeout, MAKE_SEGPTR(proc)); return SetTimer( hwnd, id, timeout, MAKE_SEGPTR(proc));
} }
/* WARNING: It has not been verified that the signature or semantics
of the corresponding NT function is the same */
HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam,int A)
{
DLGTEMPLATE32 *dlgTempl=templ;
DLGITEMTEMPLATE32 *dlgitem;
WORD *ptr;
DWORD MenuName=0;
DWORD ClassName=0;
DWORD szFontName=0;
WORD wPointSize;
HFONT hFont=0;
HMENU hMenu=0;
DWORD exStyle;
DWORD szCaption;
RECT16 rect;
DIALOGINFO *dlgInfo;
WND *wndPtr;
WORD xUnit = xBaseUnit;
WORD yUnit = yBaseUnit;
int i;
DWORD ClassId;
DWORD Text;
HWND hwnd,hwndCtrl;
HWND hwndDefButton=0;
WCHAR buffer[200];
/* parse the dialog template header*/
exStyle = dlgTempl->dwExtendedStyle;
ptr = (WORD*)(dlgTempl+1);
switch(*ptr){
case 0: MenuName=0;ptr++;break;
case 0xFFFF: MenuName=*(ptr+1);ptr+=2;break;
default: MenuName = (DWORD)ptr;
ptr += STRING32_lstrlenW(ptr)+1;
}
switch(*ptr){
case 0: ClassName = DIALOG_CLASS_ATOM;ptr++;break;
case 0xFFFF: ClassName = *(ptr+1);ptr+=2;break;
default: ClassName = (DWORD)ptr;
ptr += STRING32_lstrlenW(ptr)+1;
}
szCaption=(DWORD)ptr;
ptr+=STRING32_lstrlenW(ptr)+1;
if(dlgTempl->style & DS_SETFONT)
{
wPointSize = *ptr;
ptr++;
szFontName = (DWORD)ptr;
ptr+=STRING32_lstrlenW(ptr)+1;
}
if(MenuName) hMenu=WIN32_LoadMenuW(hInst,(LPWSTR)MenuName);
if(dlgTempl->style & DS_SETFONT)
{
fprintf(stderr,"Win32: dialog fonts not supported yet\n");
}
/* Create dialog main window */
rect.left = rect.top = 0;
rect.right = dlgTempl->cx * xUnit / 4;
rect.bottom = dlgTempl->cy * yUnit / 8;
/* FIXME: proper modalframe handling ??*/
if (dlgTempl->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx16( &rect, dlgTempl->style,
hMenu ? TRUE : FALSE , exStyle );
rect.right -= rect.left;
rect.bottom -= rect.top;
if(dlgTempl->x == CW_USEDEFAULT16)
rect.left = rect.top = CW_USEDEFAULT16;
else{
rect.left += dlgTempl->x * xUnit / 4;
rect.top += dlgTempl->y * yUnit / 8;
if (!(dlgTempl->style & DS_ABSALIGN))
ClientToScreen16(hWndParent, (POINT16 *)&rect );
}
/* FIXME: Here is the place to consider A */
hwnd = CreateWindowEx32W(exStyle, (LPWSTR)ClassName, (LPWSTR)szCaption,
dlgTempl->style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom,
hWndParent, hMenu, hInst, 0);
if(!hwnd)
{
if(hFont)DeleteObject(hFont);
if(hMenu)DeleteObject(hMenu);
return 0;
}
wndPtr = WIN_FindWndPtr(hwnd);
/* FIXME: should purge junk from system menu, but windows/dialog.c
says this does not belong here */
/* Create control windows */
dprintf_dialog(stddeb, " BEGIN\n" );
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->msgResult = 0; /* This is used to store the default button id */
dlgInfo->hDialogHeap = 0;
for (i = 0; i < dlgTempl->noOfItems; i++)
{
if((int)ptr&3)
ptr++;
dlgitem = (DLGITEMTEMPLATE32*)ptr;
ptr = (WORD*)(dlgitem+1);
if(*ptr == 0xFFFF) {
/* FIXME: ignore HIBYTE? */
ClassId = *(ptr+1);
ptr+=2;
}else{
ClassId = (DWORD)ptr;
ptr += STRING32_lstrlenW(ptr)+1;
}
if(*ptr == 0xFFFF) {
Text = *(ptr+1);
ptr+=2;
}else{
Text = (DWORD)ptr;
ptr += STRING32_lstrlenW(ptr)+1;
}
if(!HIWORD(ClassId))
{
switch(LOWORD(ClassId))
{
case 0x80: STRING32_AnsiToUni(buffer,"BUTTON" ); break;
case 0x81: STRING32_AnsiToUni( buffer, "EDIT" ); break;
case 0x82: STRING32_AnsiToUni( buffer, "STATIC" ); break;
case 0x83: STRING32_AnsiToUni( buffer, "LISTBOX" ); break;
case 0x84: STRING32_AnsiToUni( buffer, "SCROLLBAR" ); break;
case 0x85: STRING32_AnsiToUni( buffer, "COMBOBOX" ); break;
default: buffer[0] = '\0'; break;
}
ClassId = (DWORD)buffer;
}
/*FIXME: debugging output*/
/*FIXME: local edit ?*/
exStyle = dlgitem->dwExtendedStyle|WS_EX_NOPARENTNOTIFY;
if(*ptr)
{
fprintf(stderr,"having data\n");
}
ptr++;
hwndCtrl = CreateWindowEx32W(WS_EX_NOPARENTNOTIFY,
(LPWSTR)ClassId, (LPWSTR)Text,
dlgitem->style | WS_CHILD,
dlgitem->x * xUnit / 4,
dlgitem->y * yUnit / 8,
dlgitem->cx * xUnit / 4,
dlgitem->cy * yUnit / 8,
hwnd, (HMENU)((DWORD)dlgitem->id),
hInst, (SEGPTR)0 );
SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
/* Send initialisation messages to the control */
if (hFont) SendMessage32A( hwndCtrl, WM_SETFONT, (WPARAM)hFont, 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->msgResult = GetWindowWord( hwndCtrl, GWW_ID );
}
}
dprintf_dialog(stddeb, " END\n" );
/* Initialise dialog extra data */
dlgInfo->dlgProc = WINPROC_AllocWinProc(lpDialogFunc,WIN_PROC_32A);
dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
dlgInfo->hwndFocus = DIALOG_GetFirstTabItem( hwnd );
/* Send initialisation messages and set focus */
if (dlgInfo->hUserFont)
SendMessage32A( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
if (SendMessage32A( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, dwInitParam ))
SetFocus( dlgInfo->hwndFocus );
if (dlgTempl->style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
return hwnd;
}
HWND USER32_CreateDialogIndirectParamW(HINSTANCE hInst,LPVOID dlgTempl,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
return USER32_CreateDialogIndirectParamAorW(hInst,dlgTempl,hWndParent,
lpDialogFunc,dwInitParam,0);
}
HWND USER32_CreateDialogIndirectParamA(HINSTANCE hInst,LPVOID dlgTempl,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
return USER32_CreateDialogIndirectParamAorW(hInst,dlgTempl,hWndParent,
lpDialogFunc,dwInitParam,1);
}
HWND USER32_CreateDialogParamW(HINSTANCE hInst,LPCWSTR lpszName,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HANDLE32 hrsrc;
hrsrc=FindResource32(hInst,lpszName,(LPWSTR)RT_DIALOG);
if(!hrsrc)return 0;
return USER32_CreateDialogIndirectParamW(hInst,
LoadResource32(hInst, hrsrc),hWndParent,lpDialogFunc,dwInitParam);
}
HWND USER32_CreateDialogParamA(HINSTANCE hInst,LPCSTR lpszName,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HWND res;
if(!HIWORD(lpszName))
res = USER32_CreateDialogParamW(hInst,(LPCWSTR)lpszName,hWndParent,
lpDialogFunc,dwInitParam);
else{
LPWSTR uni=STRING32_DupAnsiToUni(lpszName);
res=USER32_CreateDialogParamW(hInst,uni,hWndParent,
lpDialogFunc,dwInitParam);
}
return res;
}
int USER32_DialogBoxIndirectParamW(HINSTANCE hInstance,LPVOID dlgTempl,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HWND hwnd;
hwnd = USER32_CreateDialogIndirectParamW(hInstance,dlgTempl,
hWndParent,lpDialogFunc,dwInitParam);
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
return -1;
}
int USER32_DialogBoxIndirectParamA(HINSTANCE hInstance,LPVOID dlgTempl,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HWND hwnd;
hwnd = USER32_CreateDialogIndirectParamA(hInstance,dlgTempl,
hWndParent,lpDialogFunc,dwInitParam);
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
return -1;
}
int USER32_DialogBoxParamW(HINSTANCE hInstance,LPCWSTR lpszName,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HWND hwnd;
hwnd = USER32_CreateDialogParamW(hInstance,lpszName,
hWndParent,lpDialogFunc,dwInitParam);
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
return -1;
}
int USER32_DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpszName,
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
{
HWND hwnd;
hwnd = USER32_CreateDialogParamA(hInstance,lpszName,
hWndParent,lpDialogFunc,dwInitParam);
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
return -1;
}
int USER32_wsprintfA( int *args ) int USER32_wsprintfA( int *args )
{ {
......
/*
* Win32 WndProc function stubs
*
* Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
*
* These functions are simply lParam fixers for the Win16 routines
*/
#include <stdio.h>
#include "windows.h"
#ifndef WINELIB32
#include "winerror.h"
#include "kernel32.h"
#include "wintypes.h"
#include "struct32.h"
#include "wincon.h"
#include "stackframe.h"
#include "stddebug.h"
#include "debug.h"
BOOL UsesLParamPtr(DWORD message)
{
switch (message) {
case WM_NCCREATE:
case WM_NCCALCSIZE:
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
case WM_GETTEXT:
case WM_SETTEXT:
case WM_GETMINMAXINFO:
return TRUE;
default:
return FALSE;
}
}
BOOL WIN32_CallWindowProcTo16(LRESULT(*func)(HWND,UINT,WPARAM,LPARAM),
HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
WINDOWPOS16 wp;
union{
MINMAXINFO16 mmi;
NCCALCSIZE_PARAMS16 nccs;
CREATESTRUCT16 cs;
} st;
WINDOWPOS32 *pwp;
CREATESTRUCT32A *pcs;
LONG result;
if(!lParam || !UsesLParamPtr(msg))
return func(hwnd,msg,wParam,lParam);
switch(msg)
{
case WM_GETMINMAXINFO:
STRUCT32_MINMAXINFO32to16((void*)lParam,&st.mmi);
result=func(hwnd,msg,wParam,MAKE_SEGPTR(&st.mmi));
STRUCT32_MINMAXINFO16to32(&st.mmi,(void*)lParam);
return result;
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
STRUCT32_WINDOWPOS32to16((void*)lParam,&wp);
result=func(hwnd,msg,wParam,MAKE_SEGPTR(&wp));
STRUCT32_WINDOWPOS16to32(&wp,(void*)lParam);
return result;
case WM_NCCALCSIZE:
pwp=((NCCALCSIZE_PARAMS32*)lParam)->lppos;
STRUCT32_NCCALCSIZE32to16Flat((void*)lParam,&st.nccs,wParam);
if (wParam && pwp) {
STRUCT32_WINDOWPOS32to16(pwp,&wp);
st.nccs.lppos = &wp;
}else
st.nccs.lppos = 0;
result=func(hwnd,msg,wParam,MAKE_SEGPTR(&st.nccs));
STRUCT32_NCCALCSIZE16to32Flat(&st.nccs,(void*)lParam,wParam);
if (wParam && pwp)
STRUCT32_WINDOWPOS16to32(&wp,pwp);
return result;
case WM_NCCREATE:
pcs = (CREATESTRUCT32A*)lParam;
STRUCT32_CREATESTRUCT32Ato16((void*)lParam,&st.cs);
st.cs.lpszName = HIWORD(pcs->lpszName) ?
MAKE_SEGPTR(pcs->lpszName) : pcs->lpszName;
st.cs.lpszClass = HIWORD(pcs->lpszClass) ?
MAKE_SEGPTR(pcs->lpszClass) : pcs->lpszClass;
result=func(hwnd,msg,wParam,MAKE_SEGPTR(&st.cs));
STRUCT32_CREATESTRUCT16to32A(&st.cs,(void*)lParam);
pcs->lpszName = HIWORD(pcs->lpszName) ?
PTR_SEG_TO_LIN(st.cs.lpszName) : pcs->lpszName;
pcs->lpszClass = HIWORD(pcs-> lpszClass) ?
PTR_SEG_TO_LIN(st.cs.lpszClass) : pcs-> lpszClass;
return result;
case WM_GETTEXT:
case WM_SETTEXT:
return func(hwnd,msg,wParam,MAKE_SEGPTR((void*)lParam));
default:
fprintf(stderr,"No support for 32-16 msg 0x%x\n",msg);
}
return func(hwnd,msg,wParam,MAKE_SEGPTR((void*)lParam));
}
extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ColorDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT EditWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT FileOpenDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT FileSaveDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT FindTextDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ListBoxWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT MDIClientWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT PopupMenuWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT PrintDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT StaticWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM,LPARAM);
LRESULT StaticWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(StaticWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ScrollBarWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ScrollBarWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ListBoxWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ListBoxWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ComboBoxWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ComboBoxWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT EditWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(EditWndProc,(HWND)hwnd, msg, wParam,lParam);
}
LRESULT PopupMenuWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(PopupMenuWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT DefDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(DefDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT MDIClientWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(MDIClientWndProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT SystemMessageBoxProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(SystemMessageBoxProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT FileOpenDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(FileOpenDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT FileSaveDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(FileSaveDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ColorDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ColorDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT FindTextDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(FindTextDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ReplaceTextDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ReplaceTextDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT PrintSetupDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(PrintSetupDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT PrintDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(PrintDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT AboutDlgProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(AboutDlgProc,(HWND)hwnd, msg, wParam, lParam);
}
LRESULT ComboLBoxWndProc32(DWORD hwnd, DWORD msg, DWORD wParam, DWORD lParam)
{
return WIN32_CallWindowProcTo16(ComboLBoxWndProc,(HWND)hwnd, msg, wParam, lParam);
}
#endif
...@@ -43,11 +43,11 @@ void CLASS_DumpClass( CLASS *ptr ) ...@@ -43,11 +43,11 @@ void CLASS_DumpClass( CLASS *ptr )
fprintf( stderr, "Class %p:\n", ptr ); fprintf( stderr, "Class %p:\n", ptr );
fprintf( stderr, fprintf( stderr,
"next=%p name=%04x '%s' style=%08x wndProc=%08lx\n" "next=%p name=%04x '%s' style=%08x wndProc=%08x\n"
"inst=%04x hdce=%04x icon=%04x cursor=%04x bkgnd=%04x\n" "inst=%04x hdce=%04x icon=%04x cursor=%04x bkgnd=%04x\n"
"clsExtra=%d winExtra=%d #windows=%d\n", "clsExtra=%d winExtra=%d #windows=%d\n",
ptr->next, ptr->atomName, className, ptr->style, ptr->next, ptr->atomName, className, ptr->style,
(DWORD)ptr->lpfnWndProc, ptr->hInstance, ptr->hdce, ptr->winproc, ptr->hInstance, ptr->hdce,
ptr->hIcon, ptr->hCursor, ptr->hbrBackground, ptr->hIcon, ptr->hCursor, ptr->hbrBackground,
ptr->cbClsExtra, ptr->cbWndExtra, ptr->cWindows ); ptr->cbClsExtra, ptr->cbWndExtra, ptr->cWindows );
if (ptr->cbClsExtra) if (ptr->cbClsExtra)
...@@ -76,7 +76,7 @@ void CLASS_WalkClasses(void) ...@@ -76,7 +76,7 @@ void CLASS_WalkClasses(void)
{ {
GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) ); GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) );
fprintf( stderr, "%08x %-20.20s %08x %08x\n", (UINT32)ptr, className, fprintf( stderr, "%08x %-20.20s %08x %08x\n", (UINT32)ptr, className,
ptr->style, (UINT32)ptr->lpfnWndProc ); ptr->style, ptr->winproc );
} }
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
} }
...@@ -160,13 +160,12 @@ static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) ...@@ -160,13 +160,12 @@ static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
* *
* Set the window procedure and return the old one. * Set the window procedure and return the old one.
*/ */
static WNDPROC16 CLASS_SetWndProc( CLASS *classPtr, WNDPROC16 proc, static HANDLE32 CLASS_SetWndProc( CLASS *classPtr, HANDLE32 proc,
WINDOWPROCTYPE type ) WINDOWPROCTYPE type )
{ {
WNDPROC16 oldProc = classPtr->lpfnWndProc; HANDLE32 oldProc = classPtr->winproc;
if (type == WIN_PROC_16) classPtr->lpfnWndProc = proc; classPtr->winproc = WINPROC_AllocWinProc( proc, type );
else classPtr->lpfnWndProc = WINPROC_AllocWinProc( (WNDPROC32)proc, type ); if (oldProc) WINPROC_FreeWinProc( oldProc );
WINPROC_FreeWinProc( oldProc );
return oldProc; return oldProc;
} }
...@@ -274,7 +273,7 @@ CLASS *CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance ) ...@@ -274,7 +273,7 @@ CLASS *CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance )
*/ */
static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance, static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance,
DWORD style, INT32 classExtra, DWORD style, INT32 classExtra,
INT32 winExtra, WNDPROC16 wndProc, INT32 winExtra, HANDLE32 wndProc,
WINDOWPROCTYPE wndProcType ) WINDOWPROCTYPE wndProcType )
{ {
CLASS *classPtr; CLASS *classPtr;
...@@ -309,14 +308,14 @@ static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance, ...@@ -309,14 +308,14 @@ static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance,
classPtr->magic = CLASS_MAGIC; classPtr->magic = CLASS_MAGIC;
classPtr->cWindows = 0; classPtr->cWindows = 0;
classPtr->style = style; classPtr->style = style;
classPtr->lpfnWndProc = 0; classPtr->winproc = 0;
classPtr->cbWndExtra = winExtra; classPtr->cbWndExtra = winExtra;
classPtr->cbClsExtra = classExtra; classPtr->cbClsExtra = classExtra;
classPtr->hInstance = hInstance; classPtr->hInstance = hInstance;
classPtr->atomName = atom; classPtr->atomName = atom;
classPtr->menuNameA = 0; classPtr->menuNameA = 0;
classPtr->menuNameW = 0; classPtr->menuNameW = 0;
classPtr->hdce = (style&CS_CLASSDC) ? DCE_AllocDCE(DCE_CLASS_DC): 0; classPtr->hdce = (style&CS_CLASSDC) ? DCE_AllocDCE(0, DCE_CLASS_DC): 0;
CLASS_SetWndProc( classPtr, wndProc, wndProcType ); CLASS_SetWndProc( classPtr, wndProc, wndProcType );
/* Other values must be set by caller */ /* Other values must be set by caller */
...@@ -339,7 +338,8 @@ ATOM RegisterClass16( const WNDCLASS16 *wc ) ...@@ -339,7 +338,8 @@ ATOM RegisterClass16( const WNDCLASS16 *wc )
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
wc->lpfnWndProc, WIN_PROC_16 ))) (HANDLE32)wc->lpfnWndProc,
WIN_PROC_16 )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
return 0; return 0;
...@@ -375,7 +375,7 @@ ATOM RegisterClass32A( const WNDCLASS32A* wc ) ...@@ -375,7 +375,7 @@ ATOM RegisterClass32A( const WNDCLASS32A* wc )
if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
(WNDPROC16)wc->lpfnWndProc, (HANDLE32)wc->lpfnWndProc,
WIN_PROC_32A ))) WIN_PROC_32A )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
...@@ -410,7 +410,7 @@ ATOM RegisterClass32W( const WNDCLASS32W* wc ) ...@@ -410,7 +410,7 @@ ATOM RegisterClass32W( const WNDCLASS32W* wc )
if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
(WNDPROC16)wc->lpfnWndProc, (HANDLE32)wc->lpfnWndProc,
WIN_PROC_32W ))) WIN_PROC_32W )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
...@@ -444,7 +444,8 @@ ATOM RegisterClassEx16( const WNDCLASSEX16 *wc ) ...@@ -444,7 +444,8 @@ ATOM RegisterClassEx16( const WNDCLASSEX16 *wc )
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
wc->lpfnWndProc, WIN_PROC_16 ))) (HANDLE32)wc->lpfnWndProc,
WIN_PROC_16 )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
return 0; return 0;
...@@ -480,7 +481,7 @@ ATOM RegisterClassEx32A( const WNDCLASSEX32A* wc ) ...@@ -480,7 +481,7 @@ ATOM RegisterClassEx32A( const WNDCLASSEX32A* wc )
if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
(WNDPROC16)wc->lpfnWndProc, (HANDLE32)wc->lpfnWndProc,
WIN_PROC_32A ))) WIN_PROC_32A )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
...@@ -515,7 +516,7 @@ ATOM RegisterClassEx32W( const WNDCLASSEX32W* wc ) ...@@ -515,7 +516,7 @@ ATOM RegisterClassEx32W( const WNDCLASSEX32W* wc )
if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0;
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
wc->cbClsExtra, wc->cbWndExtra, wc->cbClsExtra, wc->cbWndExtra,
(WNDPROC16)wc->lpfnWndProc, (HANDLE32)wc->lpfnWndProc,
WIN_PROC_32W ))) WIN_PROC_32W )))
{ {
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
...@@ -620,9 +621,19 @@ WORD GetClassWord( HWND32 hwnd, INT32 offset ) ...@@ -620,9 +621,19 @@ WORD GetClassWord( HWND32 hwnd, INT32 offset )
*/ */
LONG GetClassLong16( HWND hwnd, INT16 offset ) LONG GetClassLong16( HWND hwnd, INT16 offset )
{ {
DWORD ret = GetClassLong32A( hwnd, offset ); LONG ret;
if ((offset == GCL_MENUNAME) && HIWORD(ret))
return (LONG)SEGPTR_GET((void *)ret); /* Name needs to be a SEGPTR */ switch( offset )
{
case GCL_MENUNAME:
ret = GetClassLong32A( hwnd, offset );
return (LONG)SEGPTR_GET( (void *)ret );
case GCL_WNDPROC:
ret = GetClassLong32A( hwnd, offset );
return (LONG)WINPROC_GetFunc16( (HANDLE32)ret );
default:
return GetClassLong32A( hwnd, offset );
}
return (LONG)ret; return (LONG)ret;
} }
...@@ -645,8 +656,9 @@ LONG GetClassLong32A( HWND hwnd, INT32 offset ) ...@@ -645,8 +656,9 @@ LONG GetClassLong32A( HWND hwnd, INT32 offset )
case GCL_STYLE: return (LONG)wndPtr->class->style; case GCL_STYLE: return (LONG)wndPtr->class->style;
case GCL_CBWNDEXTRA: return (LONG)wndPtr->class->cbWndExtra; case GCL_CBWNDEXTRA: return (LONG)wndPtr->class->cbWndExtra;
case GCL_CBCLSEXTRA: return (LONG)wndPtr->class->cbClsExtra; case GCL_CBCLSEXTRA: return (LONG)wndPtr->class->cbClsExtra;
case GCL_WNDPROC: return (LONG)wndPtr->class->lpfnWndProc;
case GCL_HMODULE: return (LONG)wndPtr->class->hInstance; case GCL_HMODULE: return (LONG)wndPtr->class->hInstance;
case GCL_WNDPROC:
return (LONG)WINPROC_GetFunc32( wndPtr->class->winproc );
case GCL_MENUNAME: case GCL_MENUNAME:
return (LONG)CLASS_GetMenuNameA( wndPtr->class ); return (LONG)CLASS_GetMenuNameA( wndPtr->class );
case GCL_HBRBACKGROUND: case GCL_HBRBACKGROUND:
...@@ -727,7 +739,7 @@ LONG SetClassLong16( HWND hwnd, INT16 offset, LONG newval ) ...@@ -727,7 +739,7 @@ LONG SetClassLong16( HWND hwnd, INT16 offset, LONG newval )
{ {
case GCL_WNDPROC: case GCL_WNDPROC:
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
return (LONG)CLASS_SetWndProc( wndPtr->class, (WNDPROC16)newval, return (LONG)CLASS_SetWndProc( wndPtr->class, (HANDLE32)newval,
WIN_PROC_16 ); WIN_PROC_16 );
case GCL_MENUNAME: case GCL_MENUNAME:
return SetClassLong32A( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) ); return SetClassLong32A( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) );
...@@ -764,7 +776,7 @@ LONG SetClassLong32A( HWND hwnd, INT32 offset, LONG newval ) ...@@ -764,7 +776,7 @@ LONG SetClassLong32A( HWND hwnd, INT32 offset, LONG newval )
CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval ); CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval );
return 0; /* Old value is now meaningless anyway */ return 0; /* Old value is now meaningless anyway */
case GCL_WNDPROC: case GCL_WNDPROC:
return (LONG)CLASS_SetWndProc( wndPtr->class, (WNDPROC16)newval, return (LONG)CLASS_SetWndProc( wndPtr->class, (HANDLE32)newval,
WIN_PROC_32A ); WIN_PROC_32A );
case GCL_HBRBACKGROUND: case GCL_HBRBACKGROUND:
case GCL_HCURSOR: case GCL_HCURSOR:
...@@ -797,7 +809,7 @@ LONG SetClassLong32W( HWND hwnd, INT32 offset, LONG newval ) ...@@ -797,7 +809,7 @@ LONG SetClassLong32W( HWND hwnd, INT32 offset, LONG newval )
switch(offset) switch(offset)
{ {
case GCL_WNDPROC: case GCL_WNDPROC:
return (LONG)CLASS_SetWndProc( wndPtr->class, (WNDPROC16)newval, return (LONG)CLASS_SetWndProc( wndPtr->class, (HANDLE32)newval,
WIN_PROC_32W ); WIN_PROC_32W );
case GCL_MENUNAME: case GCL_MENUNAME:
CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval ); CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval );
...@@ -854,7 +866,7 @@ BOOL GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ) ...@@ -854,7 +866,7 @@ BOOL GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc )
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = (UINT16)classPtr->style; wc->style = (UINT16)classPtr->style;
wc->lpfnWndProc = classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc16( classPtr->winproc );
wc->cbClsExtra = (INT16)classPtr->cbClsExtra; wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
wc->cbWndExtra = (INT16)classPtr->cbWndExtra; wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
wc->hInstance = (HINSTANCE16)classPtr->hInstance; wc->hInstance = (HINSTANCE16)classPtr->hInstance;
...@@ -882,7 +894,7 @@ BOOL GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASS32A *wc ) ...@@ -882,7 +894,7 @@ BOOL GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASS32A *wc )
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = classPtr->style; wc->style = classPtr->style;
wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc32( classPtr->winproc );
wc->cbClsExtra = classPtr->cbClsExtra; wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra; wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = classPtr->hInstance; wc->hInstance = classPtr->hInstance;
...@@ -908,7 +920,7 @@ BOOL GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASS32W *wc ) ...@@ -908,7 +920,7 @@ BOOL GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASS32W *wc )
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = classPtr->style; wc->style = classPtr->style;
wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc32( classPtr->winproc );
wc->cbClsExtra = classPtr->cbClsExtra; wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra; wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = classPtr->hInstance; wc->hInstance = classPtr->hInstance;
...@@ -937,7 +949,7 @@ BOOL GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 *wc ) ...@@ -937,7 +949,7 @@ BOOL GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 *wc )
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = classPtr->style; wc->style = classPtr->style;
wc->lpfnWndProc = classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc16( classPtr->winproc );
wc->cbClsExtra = (INT16)classPtr->cbClsExtra; wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
wc->cbWndExtra = (INT16)classPtr->cbWndExtra; wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
wc->hInstance = (HINSTANCE16)classPtr->hInstance; wc->hInstance = (HINSTANCE16)classPtr->hInstance;
...@@ -966,7 +978,7 @@ BOOL GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASSEX32A *wc ) ...@@ -966,7 +978,7 @@ BOOL GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASSEX32A *wc )
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = classPtr->style; wc->style = classPtr->style;
wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc32( classPtr->winproc );
wc->cbClsExtra = classPtr->cbClsExtra; wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra; wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = classPtr->hInstance; wc->hInstance = classPtr->hInstance;
...@@ -993,7 +1005,7 @@ BOOL GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASSEX32W *wc) ...@@ -993,7 +1005,7 @@ BOOL GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASSEX32W *wc)
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
(hInstance != classPtr->hInstance)) return FALSE; (hInstance != classPtr->hInstance)) return FALSE;
wc->style = classPtr->style; wc->style = classPtr->style;
wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; wc->lpfnWndProc = WINPROC_GetFunc32( classPtr->winproc );
wc->cbClsExtra = classPtr->cbClsExtra; wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra; wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = classPtr->hInstance; wc->hInstance = classPtr->hInstance;
......
...@@ -2,9 +2,18 @@ ...@@ -2,9 +2,18 @@
* USER DCE functions * USER DCE functions
* *
* Copyright 1993 Alexandre Julliard * Copyright 1993 Alexandre Julliard
* 1996 Alex Korobka
* *
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; *
*/ * Note: Visible regions of CS_OWNDC/CS_CLASSDC window DCs
* have to be updated dynamically.
*
* Internal DCX flags:
*
* DCX_DCEBUSY - dce structure is in use
* DCX_KEEPCLIPRGN - do not delete clipping region in ReleaseDC
* DCX_WINDOWPAINT - BeginPaint specific flag
*/
#include "dce.h" #include "dce.h"
#include "class.h" #include "class.h"
...@@ -21,30 +30,48 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993"; ...@@ -21,30 +30,48 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
static HANDLE firstDCE = 0; static HANDLE firstDCE = 0;
static HDC defaultDCstate = 0; static HDC defaultDCstate = 0;
BOOL DCHook(HDC, WORD, DWORD, DWORD);
/*********************************************************************** /***********************************************************************
* DCE_AllocDCE * DCE_AllocDCE
* *
* Allocate a new DCE. * Allocate a new DCE.
*/ */
HANDLE DCE_AllocDCE( DCE_TYPE type ) HANDLE DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
{ {
DCE * dce; DCE * dce;
HANDLE handle = USER_HEAP_ALLOC( sizeof(DCE) ); HANDLE handle = USER_HEAP_ALLOC( sizeof(DCE) );
if (!handle) return 0; if (!handle) return 0;
dce = (DCE *) USER_HEAP_LIN_ADDR( handle ); dce = (DCE *) USER_HEAP_LIN_ADDR( handle );
if (!(dce->hdc = CreateDC( "DISPLAY", NULL, NULL, NULL ))) if (!(dce->hDC = CreateDC( "DISPLAY", NULL, NULL, NULL )))
{ {
USER_HEAP_FREE( handle ); USER_HEAP_FREE( handle );
return 0; return 0;
} }
dce->hwndCurrent = 0;
dce->type = type; /* store DCE handle in DC hook data field */
dce->inUse = (type != DCE_CACHE_DC);
dce->xOrigin = 0; SetDCHook(dce->hDC, GDI_GetDefDCHook(), MAKELONG(handle,DC_MAGIC));
dce->yOrigin = 0;
dce->hwndCurrent = hWnd;
dce->hNext = firstDCE; dce->hNext = firstDCE;
dce->hClipRgn = 0;
firstDCE = handle; firstDCE = handle;
if( type != DCE_CACHE_DC )
{
dce->DCXflags = DCX_DCEBUSY;
if( hWnd )
{
WND* wnd = WIN_FindWndPtr(hWnd);
if( wnd->dwStyle & WS_CLIPCHILDREN ) dce->DCXflags |= DCX_CLIPCHILDREN;
if( wnd->dwStyle & WS_CLIPSIBLINGS ) dce->DCXflags |= DCX_CLIPSIBLINGS;
}
SetHookFlags(dce->hDC,DCHF_INVALIDATEVISRGN);
}
else dce->DCXflags = DCX_CACHE;
return handle; return handle;
} }
...@@ -64,10 +91,77 @@ void DCE_FreeDCE( HANDLE hdce ) ...@@ -64,10 +91,77 @@ void DCE_FreeDCE( HANDLE hdce )
handle = &prev->hNext; handle = &prev->hNext;
} }
if (*handle == hdce) *handle = dce->hNext; if (*handle == hdce) *handle = dce->hNext;
DeleteDC( dce->hdc );
SetDCHook(dce->hDC,(SEGPTR)NULL,0L);
DeleteDC( dce->hDC );
if( dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN) )
DeleteObject(dce->hClipRgn);
USER_HEAP_FREE( hdce ); USER_HEAP_FREE( hdce );
} }
/***********************************************************************
* DCE_FindDCE
*/
HANDLE DCE_FindDCE(HDC hDC)
{
HANDLE hdce = firstDCE;
DCE* dce;
while( hdce )
{
dce = (DCE *) USER_HEAP_LIN_ADDR(hdce);
if( dce->hDC == hDC ) break;
hdce = dce->hNext;
}
return hdce;
}
/***********************************************************************
* DCE_InvalidateDCE
*/
BOOL DCE_InvalidateDCE(WND* wndScope, RECT16* pRectUpdate)
{
HANDLE hdce;
DCE* dce;
if( !wndScope ) return 0;
dprintf_dc(stddeb,"InvalidateDCE: scope hwnd = %04x, (%i,%i - %i,%i)\n",
wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
pRectUpdate->right,pRectUpdate->bottom);
for( hdce = firstDCE; (hdce); hdce=dce->hNext)
{
dce = (DCE*)USER_HEAP_LIN_ADDR(hdce);
if( dce->DCXflags & DCX_DCEBUSY )
{
WND * wndCurrent, * wnd;
wnd = wndCurrent = WIN_FindWndPtr(dce->hwndCurrent);
/* desktop is not critical */
if( wnd == WIN_GetDesktop() ) continue;
for( ; wnd ; wnd = wnd->parent )
if( wnd == wndScope )
{
RECT16 wndRect = wndCurrent->rectWindow;
dprintf_dc(stddeb,"\tgot hwnd %04x\n", wndCurrent->hwndSelf);
MapWindowPoints16(wndCurrent->parent->hwndSelf, wndScope->hwndSelf,
(LPPOINT16)&wndRect, 2);
if( IntersectRect16(&wndRect,&wndRect,pRectUpdate) )
SetHookFlags(dce->hDC, DCHF_INVALIDATEVISRGN);
break;
}
}
}
return 1;
}
/*********************************************************************** /***********************************************************************
* DCE_Init * DCE_Init
...@@ -80,9 +174,9 @@ void DCE_Init() ...@@ -80,9 +174,9 @@ void DCE_Init()
for (i = 0; i < NB_DCE; i++) for (i = 0; i < NB_DCE; i++)
{ {
if (!(handle = DCE_AllocDCE( DCE_CACHE_DC ))) return; if (!(handle = DCE_AllocDCE( 0, DCE_CACHE_DC ))) return;
dce = (DCE *) USER_HEAP_LIN_ADDR( handle ); dce = (DCE *) USER_HEAP_LIN_ADDR( handle );
if (!defaultDCstate) defaultDCstate = GetDCState( dce->hdc ); if (!defaultDCstate) defaultDCstate = GetDCState( dce->hDC );
} }
} }
...@@ -186,9 +280,11 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) ...@@ -186,9 +280,11 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
int xoffset, yoffset; int xoffset, yoffset;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
/* Get visible rectangle and create a region with it */ /* Get visible rectangle and create a region with it
* FIXME: do we really need to calculate vis rgns for X windows?
*/
if (!DCE_GetVisRect( wndPtr, !(flags & DCX_WINDOW), &rect )) if (!wndPtr || !DCE_GetVisRect( wndPtr, !(flags & DCX_WINDOW), &rect ))
{ {
return CreateRectRgn( 0, 0, 0, 0 ); /* Visible region is empty */ return CreateRectRgn( 0, 0, 0, 0 ); /* Visible region is empty */
} }
...@@ -281,11 +377,10 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags ) ...@@ -281,11 +377,10 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags )
} }
} }
/*********************************************************************** /***********************************************************************
* GetDCEx (USER.359) * GetDCEx (USER.359)
*/ *
/* Unimplemented flags: DCX_LOCKWINDOWUPDATE * Unimplemented flags: DCX_LOCKWINDOWUPDATE
*/ */
HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{ {
...@@ -295,89 +390,134 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -295,89 +390,134 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
DCE * dce; DCE * dce;
DC * dc; DC * dc;
WND * wndPtr; WND * wndPtr;
DWORD dcx_flags = 0;
BOOL need_update = TRUE;
dprintf_dc(stddeb,"GetDCEx: hwnd %04x, hrgnClip %04x, flags %08x\n", hwnd, hrgnClip, (unsigned)flags);
if (hwnd)
{
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
}
else wndPtr = NULL;
if (flags & DCX_USESTYLE) if (flags & DCX_USESTYLE)
{ {
/* Set the flags according to the window style. */ flags &= ~( DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
/* Not sure if this is the real meaning of the DCX_USESTYLE flag... */
flags &= ~(DCX_CACHE | DCX_CLIPCHILDREN | if( wndPtr->dwStyle & WS_CLIPSIBLINGS )
DCX_CLIPSIBLINGS | DCX_PARENTCLIP); flags |= DCX_CLIPSIBLINGS;
if (wndPtr)
if ( !(flags & DCX_WINDOW) )
{ {
if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC))) if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC)))
flags |= DCX_CACHE; flags |= DCX_CACHE;
if (wndPtr->class->style & CS_PARENTDC) flags |= DCX_PARENTCLIP; if (wndPtr->class->style & CS_PARENTDC) flags |= DCX_PARENTCLIP;
if (wndPtr->dwStyle & WS_CLIPCHILDREN) flags |= DCX_CLIPCHILDREN;
if (wndPtr->dwStyle & WS_CLIPSIBLINGS) flags |= DCX_CLIPSIBLINGS; if (wndPtr->dwStyle & WS_CLIPCHILDREN &&
!(wndPtr->dwStyle & WS_MINIMIZE) ) flags |= DCX_CLIPCHILDREN;
} }
else flags |= DCX_CACHE; else flags |= DCX_CACHE;
} }
/* Can only use PARENTCLIP on child windows */ if( flags & DCX_NOCLIPCHILDREN )
if (!wndPtr || !(wndPtr->dwStyle & WS_CHILD)) flags &= ~DCX_PARENTCLIP; {
flags |= DCX_CACHE;
flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
if (hwnd==GetDesktopWindow() || !(wndPtr->dwStyle & WS_CHILD)) flags &= ~DCX_PARENTCLIP;
/* Whole window DC implies using cache DC and not clipping children */
if (flags & DCX_WINDOW) flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE; if (flags & DCX_WINDOW) flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
if( flags & DCX_PARENTCLIP )
{
flags |= DCX_CACHE;
if( !(flags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN)) )
if( (wndPtr->dwStyle & WS_VISIBLE) && (wndPtr->parent->dwStyle & WS_VISIBLE) )
{
flags &= ~DCX_CLIPCHILDREN;
if( wndPtr->parent->dwStyle & WS_CLIPSIBLINGS )
flags |= DCX_CLIPSIBLINGS;
}
}
if (flags & DCX_CACHE) if (flags & DCX_CACHE)
{ {
for (hdce = firstDCE; (hdce); hdce = dce->hNext) for (hdce = firstDCE; (hdce); hdce = dce->hNext)
{ {
if (!(dce = (DCE *) USER_HEAP_LIN_ADDR( hdce ))) return 0; if (!(dce = (DCE *) USER_HEAP_LIN_ADDR( hdce ))) return 0;
if ((dce->type == DCE_CACHE_DC) && (!dce->inUse)) break; if ((dce->DCXflags & DCX_CACHE) && !(dce->DCXflags & DCX_DCEBUSY)) break;
} }
} }
else hdce = wndPtr->hdce; else
{
hdce = (wndPtr->class->style & CS_OWNDC)?wndPtr->hdce:wndPtr->class->hdce;
dce = (DCE *) USER_HEAP_LIN_ADDR( hdce );
if( dce->hwndCurrent == hwnd )
{
dprintf_dc(stddeb,"\tskipping hVisRgn update\n");
need_update = FALSE;
}
if( hrgnClip && dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN))
{
fprintf(stdnimp,"GetDCEx: hClipRgn collision!\n");
DeleteObject(dce->hClipRgn);
need_update = TRUE;
}
}
dcx_flags = flags & ( DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_CACHE | DCX_WINDOW | DCX_WINDOWPAINT);
if (!hdce) return 0; if (!hdce) return 0;
dce = (DCE *) USER_HEAP_LIN_ADDR( hdce ); dce = (DCE *) USER_HEAP_LIN_ADDR( hdce );
dce->hwndCurrent = hwnd; dce->hwndCurrent = hwnd;
dce->inUse = TRUE; dce->hClipRgn = 0;
hdc = dce->hdc; dce->DCXflags = dcx_flags | DCX_DCEBUSY;
hdc = dce->hDC;
/* Initialize DC */
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
DCE_SetDrawable( wndPtr, dc, flags ); DCE_SetDrawable( wndPtr, dc, flags );
if (hwnd) if( need_update || dc->w.flags & DC_DIRTY )
{ {
if (flags & DCX_PARENTCLIP) /* Get a VisRgn for the parent */ dprintf_dc(stddeb,"updating hDC anyway\n");
if (flags & DCX_PARENTCLIP)
{ {
WND *parentPtr = wndPtr->parent; WND *parentPtr = wndPtr->parent;
DWORD newflags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | dcx_flags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_WINDOW); DCX_WINDOW);
if (parentPtr->dwStyle & WS_CLIPSIBLINGS) if (parentPtr->dwStyle & WS_CLIPSIBLINGS)
newflags |= DCX_CLIPSIBLINGS; dcx_flags |= DCX_CLIPSIBLINGS;
hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, newflags ); hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, dcx_flags );
if (flags & DCX_WINDOW) if (flags & DCX_WINDOW)
OffsetRgn( hrgnVisible, -wndPtr->rectWindow.left, OffsetRgn( hrgnVisible, -wndPtr->rectWindow.left,
-wndPtr->rectWindow.top ); -wndPtr->rectWindow.top );
else OffsetRgn( hrgnVisible, -wndPtr->rectClient.left, else OffsetRgn( hrgnVisible, -wndPtr->rectClient.left,
-wndPtr->rectClient.top ); -wndPtr->rectClient.top );
} }
else hrgnVisible = DCE_GetVisRgn( hwnd, flags ); else if( hwnd==GetDesktopWindow() ) hrgnVisible = CreateRectRgn( 0, 0, SYSMETRICS_CXSCREEN,
}
else /* Get a VisRgn for the whole screen */
{
hrgnVisible = CreateRectRgn( 0, 0, SYSMETRICS_CXSCREEN,
SYSMETRICS_CYSCREEN); SYSMETRICS_CYSCREEN);
} else hrgnVisible = DCE_GetVisRgn( hwnd, flags );
dc->w.flags &= ~DC_DIRTY;
/* Intersect VisRgn with the given region */ SelectVisRgn( hdc, hrgnVisible );
}
else hrgnVisible = CreateRectRgn(0,0,0,0);
if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN)) if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
{ {
CombineRgn( hrgnVisible, hrgnVisible, hrgnClip, dce->DCXflags |= flags & (DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_EXCLUDERGN);
dce->hClipRgn = hrgnClip;
dprintf_dc(stddeb, "\tsaved VisRgn, clipRgn = %04x\n", hrgnClip);
SaveVisRgn( hdc );
CombineRgn( hrgnVisible, InquireVisRgn( hdc ), hrgnClip,
(flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF ); (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
}
SelectVisRgn( hdc, hrgnVisible ); SelectVisRgn( hdc, hrgnVisible );
}
DeleteObject( hrgnVisible ); DeleteObject( hrgnVisible );
dprintf_dc(stddeb, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n", dprintf_dc(stddeb, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n",
...@@ -385,12 +525,13 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -385,12 +525,13 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
return hdc; return hdc;
} }
/*********************************************************************** /***********************************************************************
* GetDC (USER.66) * GetDC (USER.66)
*/ */
HDC GetDC( HWND hwnd ) HDC GetDC( HWND hwnd )
{ {
if( !hwnd ) return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE | DCX_WINDOW );
return GetDCEx( hwnd, 0, DCX_USESTYLE ); return GetDCEx( hwnd, 0, DCX_USESTYLE );
} }
...@@ -400,15 +541,14 @@ HDC GetDC( HWND hwnd ) ...@@ -400,15 +541,14 @@ HDC GetDC( HWND hwnd )
*/ */
HDC GetWindowDC( HWND hwnd ) HDC GetWindowDC( HWND hwnd )
{ {
int flags = DCX_CACHE | DCX_WINDOW;
if (hwnd) if (hwnd)
{ {
WND * wndPtr; WND * wndPtr;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
/* if (wndPtr->dwStyle & WS_CLIPCHILDREN) flags |= DCX_CLIPCHILDREN; */
if (wndPtr->dwStyle & WS_CLIPSIBLINGS) flags |= DCX_CLIPSIBLINGS;
} }
return GetDCEx( hwnd, 0, flags ); else hwnd = GetDesktopWindow();
return GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
} }
...@@ -425,14 +565,98 @@ int ReleaseDC( HWND hwnd, HDC hdc ) ...@@ -425,14 +565,98 @@ int ReleaseDC( HWND hwnd, HDC hdc )
for (hdce = firstDCE; (hdce); hdce = dce->hNext) for (hdce = firstDCE; (hdce); hdce = dce->hNext)
{ {
if (!(dce = (DCE *) USER_HEAP_LIN_ADDR( hdce ))) return 0; if (!(dce = (DCE *) USER_HEAP_LIN_ADDR( hdce ))) return 0;
if (dce->inUse && (dce->hdc == hdc)) break; if (dce->hDC == hdc) break;
} }
if (!hdce) return 0; if (!hdce) return 0;
if (!(dce->DCXflags & DCX_DCEBUSY) ) return 0;
/* restore previous visible region */
if ( dce->DCXflags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN) &&
(dce->DCXflags & DCX_CACHE || dce->DCXflags & DCX_WINDOWPAINT) )
{
dprintf_dc(stddeb,"\tcleaning up visrgn...\n");
dce->DCXflags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN | DCX_WINDOWPAINT);
if( dce->DCXflags & DCX_KEEPCLIPRGN )
dce->DCXflags &= ~DCX_KEEPCLIPRGN;
else
{
if( dce->hClipRgn > 1 )
DeleteObject( dce->hClipRgn );
dce->hClipRgn = 0;
}
dce->hClipRgn = 0;
RestoreVisRgn(dce->hDC);
}
if (dce->type == DCE_CACHE_DC) if (dce->DCXflags & DCX_CACHE)
{ {
SetDCState( dce->hdc, defaultDCstate ); SetDCState( dce->hDC, defaultDCstate );
dce->inUse = FALSE; dce->DCXflags &= ~DCX_DCEBUSY;
} }
return 1; return 1;
} }
/***********************************************************************
* DCHook (USER.362)
*
* See "Undoc. Windows" for hints (DC, SetDCHook, SetHookFlags)..
*/
BOOL DCHook(HDC hDC, WORD code, DWORD data, DWORD lParam)
{
HANDLE hdce;
HRGN hVisRgn;
dprintf_dc(stddeb,"DCHook: hDC = %04x, %i\n", hDC, code);
if( HIWORD(data) == DC_MAGIC )
hdce = (HANDLE)LOWORD(data);
else
hdce = DCE_FindDCE(hDC);
if( !hdce ) return 0;
switch( code )
{
case DCHC_INVALIDVISRGN:
{
DCE* dce = (DCE*) USER_HEAP_LIN_ADDR(hdce);
if( dce->DCXflags & DCX_DCEBUSY )
{
SetHookFlags(hDC, DCHF_VALIDATEVISRGN);
hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags);
dprintf_dc(stddeb,"\tapplying saved clipRgn\n");
/* clip this region with saved clipping region */
if ( (dce->DCXflags & DCX_INTERSECTRGN && dce->hClipRgn != 1) ||
( dce->DCXflags & DCX_EXCLUDERGN && dce->hClipRgn) )
{
if( (!dce->hClipRgn && dce->DCXflags & DCX_INTERSECTRGN) ||
(dce->hClipRgn == 1 && dce->DCXflags & DCX_EXCLUDERGN) )
SetRectRgn(hVisRgn,0,0,0,0);
else
CombineRgn(hVisRgn, hVisRgn, dce->hClipRgn,
(dce->DCXflags & DCX_EXCLUDERGN)? RGN_DIFF:RGN_AND);
}
SelectVisRgn(hDC, hVisRgn);
DeleteObject(hVisRgn);
}
else
dprintf_dc(stddeb,"DCHook: DC is not in use!\n");
}
break;
case DCHC_DELETEDC: /* FIXME: ?? */
break;
default:
fprintf(stdnimp,"DCHook: unknown code\n");
}
return 0;
}
/* /*
* Default dialog procedure * Default dialog procedure
* *
* Copyright 1993 Alexandre Julliard * Copyright 1993, 1996 Alexandre Julliard
* *
*/ */
#include "windows.h" #include "windows.h"
#include "dialog.h" #include "dialog.h"
#include "win.h" #include "win.h"
#include "stddebug.h" #include "winproc.h"
/* #define DEBUG_DIALOG */
#include "debug.h"
/*********************************************************************** /***********************************************************************
* DEFDLG_SetFocus * DEFDLG_SetFocus
...@@ -110,37 +109,22 @@ static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo, ...@@ -110,37 +109,22 @@ static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo,
/*********************************************************************** /***********************************************************************
* DefDlgProc (USER.308) * DEFDLG_Proc
*
* Implementation of DefDlgProc(). Only handle messages that need special
* handling for dialogs.
*/ */
LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam, DIALOGINFO *dlgInfo )
{ {
DIALOGINFO * dlgInfo; switch(msg)
BOOL result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
if (dlgInfo->dlgProc)
{
/* Call dialog procedure */
result = (BOOL)CallWindowProc16( dlgInfo->dlgProc, hwnd,
msg, wParam, lParam );
/* Check if window destroyed by dialog procedure */
wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return result;
}
if (!result) switch(msg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
break; return 0;
case WM_ERASEBKGND: case WM_ERASEBKGND:
FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH)CTLCOLOR_DLG ); FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH)CTLCOLOR_DLG );
return TRUE; return 1;
case WM_NCDESTROY: case WM_NCDESTROY:
...@@ -166,28 +150,34 @@ LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) ...@@ -166,28 +150,34 @@ LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
dlgInfo->hMenu = 0; dlgInfo->hMenu = 0;
} }
/* Delete window procedure */
if (dlgInfo->dlgProc)
{
WINPROC_FreeWinProc( dlgInfo->dlgProc );
dlgInfo->dlgProc = 0;
}
/* Window clean-up */ /* Window clean-up */
DefWindowProc16( hwnd, msg, wParam, lParam ); return DefWindowProc32A( hwnd, msg, wParam, lParam );
break;
case WM_SHOWWINDOW: case WM_SHOWWINDOW:
if (!wParam) DEFDLG_SaveFocus( hwnd, dlgInfo ); if (!wParam) DEFDLG_SaveFocus( hwnd, dlgInfo );
return DefWindowProc16( hwnd, msg, wParam, lParam ); return DefWindowProc32A( hwnd, msg, wParam, lParam );
case WM_ACTIVATE: case WM_ACTIVATE:
if (wParam) DEFDLG_RestoreFocus( hwnd, dlgInfo ); if (wParam) DEFDLG_RestoreFocus( hwnd, dlgInfo );
else DEFDLG_SaveFocus( hwnd, dlgInfo ); else DEFDLG_SaveFocus( hwnd, dlgInfo );
break; return 0;
case WM_SETFOCUS: case WM_SETFOCUS:
DEFDLG_RestoreFocus( hwnd, dlgInfo ); DEFDLG_RestoreFocus( hwnd, dlgInfo );
break; return 0;
case DM_SETDEFID: case DM_SETDEFID:
if (dlgInfo->fEnd) return TRUE; if (dlgInfo->fEnd) return 1;
DEFDLG_SetDefButton( hwnd, dlgInfo, DEFDLG_SetDefButton( hwnd, dlgInfo,
wParam ? GetDlgItem( hwnd, wParam ) : 0 ); wParam ? GetDlgItem( hwnd, wParam ) : 0 );
return TRUE; return 1;
case DM_GETDEFID: case DM_GETDEFID:
if (dlgInfo->fEnd || !dlgInfo->msgResult) return 0; if (dlgInfo->fEnd || !dlgInfo->msgResult) return 0;
...@@ -207,16 +197,142 @@ LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) ...@@ -207,16 +197,142 @@ LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest ); if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest );
DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest ); DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
} }
break; return 0;
case WM_CLOSE: case WM_CLOSE:
EndDialog( hwnd, TRUE ); EndDialog( hwnd, TRUE );
DestroyWindow( hwnd ); DestroyWindow( hwnd );
return 0; return 0;
}
return 0;
}
/***********************************************************************
* DefDlgProc16 (USER.308)
*/
LRESULT DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam )
{
DIALOGINFO * dlgInfo;
BOOL16 result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
if (dlgInfo->dlgProc)
{
/* Call dialog procedure */
result = (BOOL16)CallWindowProc16( (WNDPROC16)dlgInfo->dlgProc, hwnd,
msg, wParam, lParam );
/* Check if window was destroyed by dialog procedure */
if (result || !IsWindow( hwnd )) return result;
}
switch(msg)
{
case WM_INITDIALOG:
case WM_ERASEBKGND:
case WM_NCDESTROY:
case WM_SHOWWINDOW:
case WM_ACTIVATE:
case WM_SETFOCUS:
case DM_SETDEFID:
case DM_GETDEFID:
case WM_NEXTDLGCTL:
case WM_CLOSE:
return DEFDLG_Proc( (HWND32)hwnd, msg, (WPARAM32)wParam,
lParam, dlgInfo );
default: default:
return DefWindowProc16( hwnd, msg, wParam, lParam ); return DefWindowProc16( hwnd, msg, wParam, lParam );
} }
}
/***********************************************************************
* DefDlgProc32A (USER32.119)
*/
LRESULT DefDlgProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
{
DIALOGINFO * dlgInfo;
BOOL16 result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
if (dlgInfo->dlgProc)
{
/* Call dialog procedure */
result = (BOOL16)CallWindowProc32A( (WNDPROC32)dlgInfo->dlgProc, hwnd,
msg, wParam, lParam );
/* Check if window was destroyed by dialog procedure */
if (result || !IsWindow( hwnd )) return result;
}
switch(msg)
{
case WM_INITDIALOG:
case WM_ERASEBKGND:
case WM_NCDESTROY:
case WM_SHOWWINDOW:
case WM_ACTIVATE:
case WM_SETFOCUS:
case DM_SETDEFID:
case DM_GETDEFID:
case WM_NEXTDLGCTL:
case WM_CLOSE:
return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
default:
return DefWindowProc32A( hwnd, msg, wParam, lParam );
}
}
/***********************************************************************
* DefDlgProc32W (USER32.120)
*/
LRESULT DefDlgProc32W( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
{
DIALOGINFO * dlgInfo;
BOOL16 result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
if (dlgInfo->dlgProc)
{
/* Call dialog procedure */
result = (BOOL16)CallWindowProc32W( (WNDPROC32)dlgInfo->dlgProc, hwnd,
msg, wParam, lParam );
return result; /* Check if window was destroyed by dialog procedure */
if (result || !IsWindow( hwnd )) return result;
}
switch(msg)
{
case WM_INITDIALOG:
case WM_ERASEBKGND:
case WM_NCDESTROY:
case WM_SHOWWINDOW:
case WM_ACTIVATE:
case WM_SETFOCUS:
case DM_SETDEFID:
case DM_GETDEFID:
case WM_NEXTDLGCTL:
case WM_CLOSE:
return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
default:
return DefWindowProc32W( hwnd, msg, wParam, lParam );
}
} }
...@@ -377,7 +377,7 @@ LRESULT DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, ...@@ -377,7 +377,7 @@ LRESULT DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
if (wParam && wndPtr->text) if (wParam && wndPtr->text)
{ {
lstrcpyn( (LPSTR)PTR_SEG_TO_LIN(lParam), wndPtr->text, wParam ); lstrcpyn( (LPSTR)PTR_SEG_TO_LIN(lParam), wndPtr->text, wParam );
return (LRESULT)strlen( (LPSTR)PTR_SEG_TO_LIN(lParam) ) + 1; result = (LRESULT)strlen( (LPSTR)PTR_SEG_TO_LIN(lParam) ) + 1;
} }
break; break;
...@@ -442,7 +442,7 @@ LRESULT DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, ...@@ -442,7 +442,7 @@ LRESULT DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
if (wParam && wndPtr->text) if (wParam && wndPtr->text)
{ {
lstrcpyn( (LPSTR)lParam, wndPtr->text, wParam ); lstrcpyn( (LPSTR)lParam, wndPtr->text, wParam );
return (LRESULT)strlen( (LPSTR)lParam ) + 1; result = (LRESULT)strlen( (LPSTR)lParam ) + 1;
} }
break; break;
......
/* /*
* Dialog functions * Dialog functions
* *
* Copyright 1993, 1994 Alexandre Julliard * Copyright 1993, 1994, 1996 Alexandre Julliard
*
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -13,15 +12,50 @@ ...@@ -13,15 +12,50 @@
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
#include "ldt.h" #include "ldt.h"
#include "resource32.h"
#include "stackframe.h" #include "stackframe.h"
#include "string32.h"
#include "user.h" #include "user.h"
#include "winproc.h"
#include "message.h" #include "message.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_DIALOG */
#include "debug.h" #include "debug.h"
/* Dialog control information */
typedef struct
{
DWORD style;
DWORD exStyle;
INT16 x;
INT16 y;
INT16 cx;
INT16 cy;
UINT16 id;
LPCSTR className;
LPCSTR windowName;
LPVOID data;
} DLG_CONTROL_INFO;
/* Dialog template */
typedef struct
{
DWORD style;
DWORD exStyle;
UINT16 nbItems;
INT16 x;
INT16 y;
INT16 cx;
INT16 cy;
LPCSTR menuName;
LPCSTR className;
LPCSTR caption;
WORD pointSize;
LPCSTR faceName;
} DLG_TEMPLATE;
/* Dialog base units */ /* Dialog base units */
WORD xBaseUnit = 0, yBaseUnit = 0; static WORD xBaseUnit = 0, yBaseUnit = 0;
/*********************************************************************** /***********************************************************************
...@@ -36,9 +70,9 @@ BOOL DIALOG_Init() ...@@ -36,9 +70,9 @@ BOOL DIALOG_Init()
/* Calculate the dialog base units */ /* Calculate the dialog base units */
if (!(hdc = GetDC( 0 ))) return FALSE; if (!(hdc = CreateDC( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
GetTextMetrics( hdc, &tm ); GetTextMetrics( hdc, &tm );
ReleaseDC( 0, hdc ); DeleteDC( hdc );
xBaseUnit = tm.tmAveCharWidth; xBaseUnit = tm.tmAveCharWidth;
yBaseUnit = tm.tmHeight; yBaseUnit = tm.tmHeight;
...@@ -67,96 +101,278 @@ HWND DIALOG_GetFirstTabItem( HWND hwndDlg ) ...@@ -67,96 +101,278 @@ HWND DIALOG_GetFirstTabItem( HWND hwndDlg )
/*********************************************************************** /***********************************************************************
* DIALOG_GetControl * DIALOG_GetControl16
* *
* Return the class and text of the control pointed to by ptr, * Return the class and text of the control pointed to by ptr,
* fill the header structure and return a pointer to the next control. * fill the header structure and return a pointer to the next control.
*/ */
static SEGPTR DIALOG_GetControl( SEGPTR ptr, DLGCONTROLHEADER *header, static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
SEGPTR *class, SEGPTR *text )
{ {
unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN( ptr ); static char buffer[10];
unsigned char *p = base;
header->x = GET_WORD(p); p += sizeof(WORD); info->x = GET_WORD(p); p += sizeof(WORD);
header->y = GET_WORD(p); p += sizeof(WORD); info->y = GET_WORD(p); p += sizeof(WORD);
header->cx = GET_WORD(p); p += sizeof(WORD); info->cx = GET_WORD(p); p += sizeof(WORD);
header->cy = GET_WORD(p); p += sizeof(WORD); info->cy = GET_WORD(p); p += sizeof(WORD);
header->id = GET_WORD(p); p += sizeof(WORD); info->id = GET_WORD(p); p += sizeof(WORD);
header->style = GET_DWORD(p); p += sizeof(DWORD); info->style = GET_DWORD(p); p += sizeof(DWORD);
info->exStyle = 0;
if (*p & 0x80) if (*p & 0x80)
{ {
*class = MAKEINTRESOURCE( *p ); 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++; p++;
} }
else else
{ {
*class = ptr + (WORD)(p - base); info->className = p;
p += strlen(p) + 1; p += strlen(p) + 1;
} }
dprintf_dialog(stddeb, " %s ", info->className );
if (*p == 0xff) if ((BYTE)*p == 0xff)
{ {
/* Integer id, not documented (?). Only works for SS_ICON controls */ /* Integer id, not documented (?). Only works for SS_ICON controls */
*text = MAKEINTRESOURCE( GET_WORD(p+1) ); info->windowName = (LPCSTR)(UINT32)GET_WORD(p+1);
p += 4; p += 3;
dprintf_dialog( stddeb,"%04x", LOWORD(info->windowName) );
} }
else else
{ {
*text = ptr + (WORD)(p - base); info->windowName = p;
p += strlen(p) + 2; p += strlen(p) + 1;
dprintf_dialog(stddeb,"'%s'", info->windowName );
} }
return ptr + (WORD)(p - base);
info->data = (LPVOID)(*p ? p + 1 : NULL); /* FIXME: is this right? */
p += *p + 1;
dprintf_dialog( stddeb," %d, %d, %d, %d, %d, %08lx, %08lx\n",
info->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)info->data);
return p;
} }
/*********************************************************************** /***********************************************************************
* DIALOG_ParseTemplate * DIALOG_GetControl32
* *
* Fill a DLGTEMPLATE structure from the dialog template, and return * Return the class and text of the control pointed to by ptr,
* a pointer to the first control. * fill the header structure and return a pointer to the next control.
*/
static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info )
{
static WCHAR buffer[10];
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++;
info->id = GET_WORD(p); p++;
if (GET_WORD(p) == 0xffff)
{
switch(GET_WORD(p+1))
{
case 0x80: STRING32_AnsiToUni( buffer, "BUTTON" ); break;
case 0x81: STRING32_AnsiToUni( buffer, "EDIT" ); break;
case 0x82: STRING32_AnsiToUni( buffer, "STATIC" ); break;
case 0x83: STRING32_AnsiToUni( buffer, "LISTBOX" ); break;
case 0x84: STRING32_AnsiToUni( buffer, "SCROLLBAR" ); break;
case 0x85: STRING32_AnsiToUni( buffer, "COMBOBOX" ); break;
default: buffer[0] = '\0'; break;
}
info->className = (LPCSTR)buffer;
p += 2;
}
else
{
info->className = (LPCSTR)p;
p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
}
dprintf_dialog(stddeb, " %p ", info->className );
if (GET_WORD(p) == 0xffff)
{
info->windowName = (LPCSTR)(p + 1);
p += 2;
dprintf_dialog( stddeb,"%04x", LOWORD(info->windowName) );
}
else
{
info->windowName = (LPCSTR)p;
p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
dprintf_dialog(stddeb,"'%p'", info->windowName );
}
if (GET_WORD(p))
{
info->data = (LPVOID)(p + 1);
p += GET_WORD(p) / sizeof(WORD);
}
else info->data = NULL;
p++;
dprintf_dialog( stddeb," %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
info->id, info->x, info->y, info->cx, info->cy,
info->style, info->exStyle, (DWORD)info->data);
/* Next control is on dword boundary */
return (const WORD *)((((int)p) + 3) & ~3);
}
/***********************************************************************
* DIALOG_CreateControls
*
* Create the control windows for a dialog.
*/ */
static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result ) static BOOL32 DIALOG_CreateControls( WND *pWnd, LPCSTR template, INT32 items,
HINSTANCE32 hInst, BOOL win32 )
{ {
unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN(template); DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
unsigned char * p = base; DLG_CONTROL_INFO info;
HWND32 hwndCtrl, hwndDefButton = 0;
dprintf_dialog(stddeb, " BEGIN\n" );
while (items--)
{
if (!win32)
{
HINSTANCE16 instance;
template = DIALOG_GetControl16( template, &info );
if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
((info.style & DS_LOCALEDIT) != DS_LOCALEDIT))
{
if (!dlgInfo->hDialogHeap)
{
dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
if (!dlgInfo->hDialogHeap)
{
fprintf( stderr, "CreateDialogIndirectParam: 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, (HMENU)info.id,
instance, info.data );
}
else
{
template = (LPCSTR)DIALOG_GetControl32( (WORD *)template, &info );
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, (HMENU)info.id,
hInst, info.data );
}
if (!hwndCtrl) return FALSE;
/* Make the control last one in Z-order, so that controls remain
in the order in which they were created */
SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
/* Send initialisation messages to the control */
if (dlgInfo->hUserFont) SendMessage32A( hwndCtrl, WM_SETFONT,
(WPARAM)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->msgResult = GetWindowWord( hwndCtrl, GWW_ID );
}
}
dprintf_dialog(stddeb, " 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->style = GET_DWORD(p); p += sizeof(DWORD);
result->exStyle = 0;
result->nbItems = *p++; result->nbItems = *p++;
result->x = GET_WORD(p); p += sizeof(WORD); result->x = GET_WORD(p); p += sizeof(WORD);
result->y = GET_WORD(p); p += sizeof(WORD); result->y = GET_WORD(p); p += sizeof(WORD);
result->cx = GET_WORD(p); p += sizeof(WORD); result->cx = GET_WORD(p); p += sizeof(WORD);
result->cy = GET_WORD(p); p += sizeof(WORD); result->cy = GET_WORD(p); p += sizeof(WORD);
dprintf_dialog( stddeb, "DIALOG %d, %d, %d, %d\n",
result->x, result->y, result->cx, result->cy );
dprintf_dialog( stddeb, " STYLE %08lx\n", result->style );
/* Get the menu name */ /* Get the menu name */
if (*p == 0xff) switch( (BYTE)*p )
{
result->menuName = MAKEINTRESOURCE( GET_WORD(p+1) );
p += 3;
}
else if (*p)
{
result->menuName = template + (WORD)(p - base);
p += strlen(p) + 1;
}
else
{ {
case 0:
result->menuName = 0; result->menuName = 0;
p++; p++;
break;
case 0xff:
result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
p += 3;
dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
break;
default:
result->menuName = p;
dprintf_dialog( stddeb, " MENU '%s'\n", p );
p += strlen(p) + 1;
break;
} }
/* Get the class name */ /* Get the class name */
if (*p) result->className = template + (WORD)(p - base); if (*p)
{
result->className = p;
dprintf_dialog( stddeb, " CLASS '%s'\n", result->className );
}
else result->className = DIALOG_CLASS_ATOM; else result->className = DIALOG_CLASS_ATOM;
p += strlen(p) + 1; p += strlen(p) + 1;
/* Get the window caption */ /* Get the window caption */
result->caption = template + (WORD)(p - base); result->caption = p;
p += strlen(p) + 1; p += strlen(p) + 1;
dprintf_dialog( stddeb, " CAPTION '%s'\n", result->caption );
/* Get the font name */ /* Get the font name */
...@@ -164,114 +380,130 @@ static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result ) ...@@ -164,114 +380,130 @@ static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result )
{ {
result->pointSize = GET_WORD(p); result->pointSize = GET_WORD(p);
p += sizeof(WORD); p += sizeof(WORD);
result->faceName = template + (WORD)(p - base); result->faceName = p;
p += strlen(p) + 1; p += strlen(p) + 1;
dprintf_dialog( stddeb, " FONT %d,'%s'\n",
result->pointSize, result->faceName );
} }
return p;
return template + (WORD)(p - base);
} }
/*********************************************************************** /***********************************************************************
* DIALOG_DisplayTemplate * DIALOG_ParseTemplate32
*
* Fill a DLG_TEMPLATE structure from the dialog template, and return
* a pointer to the first control.
*/ */
static void DIALOG_DisplayTemplate( DLGTEMPLATE * result ) static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
{ {
dprintf_dialog(stddeb, "DIALOG %d, %d, %d, %d\n", result->x, result->y, const WORD *p = (const WORD *)template;
result->cx, result->cy );
dprintf_dialog(stddeb, " STYLE %08lx\n", result->style ); result->style = GET_DWORD(p); p += 2;
dprintf_dialog( stddeb, " CAPTION '%s'\n", result->exStyle = GET_DWORD(p); p += 2;
(char *)PTR_SEG_TO_LIN(result->caption) ); 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++;
dprintf_dialog( stddeb, "DIALOG %d, %d, %d, %d\n",
result->x, result->y, result->cx, result->cy );
dprintf_dialog( stddeb, " STYLE %08lx\n", result->style );
dprintf_dialog( stddeb, " EXSTYLE %08lx\n", result->exStyle );
if (HIWORD(result->className)) /* Get the menu name */
dprintf_dialog( stddeb, " CLASS '%s'\n",
(char *)PTR_SEG_TO_LIN(result->className) );
else
dprintf_dialog( stddeb, " CLASS #%d\n", LOWORD(result->className) );
if (HIWORD(result->menuName)) switch(GET_WORD(p))
dprintf_dialog( stddeb, " MENU '%s'\n", {
(char *)PTR_SEG_TO_LIN(result->menuName) ); case 0x0000:
else if (LOWORD(result->menuName)) result->menuName = NULL;
p++;
break;
case 0xffff:
result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
p += 2;
dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) ); dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
break;
default:
result->menuName = (LPCSTR)p;
dprintf_dialog( stddeb, " MENU '%p'\n", p );
p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
break;
}
if (result->style & DS_SETFONT) /* Get the class name */
dprintf_dialog( stddeb, " FONT %d,'%s'\n", result->pointSize,
(char *)PTR_SEG_TO_LIN(result->faceName) );
}
/***********************************************************************
* CreateDialog (USER.89)
*/
HWND CreateDialog( HINSTANCE hInst, SEGPTR dlgTemplate,
HWND owner, DLGPROC dlgProc )
{
return CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, 0 );
}
/*********************************************************************** switch(GET_WORD(p))
* CreateDialogParam (USER.241) {
*/ case 0x0000:
HWND CreateDialogParam( HINSTANCE hInst, SEGPTR dlgTemplate, result->className = DIALOG_CLASS_ATOM;
HWND owner, DLGPROC dlgProc, LPARAM param ) p++;
{ break;
HWND hwnd = 0; case 0xffff:
HRSRC hRsrc; result->className = (LPCSTR)(UINT32)GET_WORD( p + 1 );
HGLOBAL hmem; p += 2;
SEGPTR data; dprintf_dialog(stddeb, " CLASS %04x\n", LOWORD(result->className) );
break;
default:
result->className = (LPCSTR)p;
dprintf_dialog( stddeb, " CLASS '%p'\n", p );
p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
break;
}
dprintf_dialog(stddeb, "CreateDialogParam: %04x,%08lx,%04x,%08lx,%ld\n", /* Get the window caption */
hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0; result->caption = (LPCSTR)p;
if (!(hmem = LoadResource( hInst, hRsrc ))) return 0; p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
if (!(data = WIN16_LockResource( hmem ))) hwnd = 0; dprintf_dialog( stddeb, " CAPTION '%p'\n", result->caption );
else hwnd = CreateDialogIndirectParam(hInst, data, owner, dlgProc, param);
FreeResource( hmem );
return hwnd;
}
/* Get the font name */
/*********************************************************************** if (result->style & DS_SETFONT)
* CreateDialogIndirect (USER.219) {
*/ result->pointSize = GET_WORD(p);
HWND CreateDialogIndirect( HINSTANCE hInst, SEGPTR dlgTemplate, p++;
HWND owner, DLGPROC dlgProc ) result->faceName = (LPCSTR)p;
{ p += STRING32_lstrlenW( (LPCWSTR)p ) + 1;
return CreateDialogIndirectParam( hInst, dlgTemplate, owner, dlgProc, 0 ); dprintf_dialog( stddeb, " FONT %d,'%p'\n",
result->pointSize, result->faceName );
}
/* First control is on dword boundary */
return (LPCSTR)((((int)p) + 3) & ~3);
} }
/*********************************************************************** /***********************************************************************
* CreateDialogIndirectParam (USER.242) * DIALOG_CreateIndirect
*/ */
HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
HWND owner, DLGPROC dlgProc, LPARAM param ) HWND owner, HANDLE32 dlgProc,
LPARAM param, BOOL win32 )
{ {
HMENU hMenu = 0; HMENU hMenu = 0;
HFONT hFont = 0; HFONT hFont = 0;
HWND hwnd, hwndCtrl; HWND hwnd;
RECT16 rect; RECT16 rect;
WND * wndPtr; WND * wndPtr;
int i; DLG_TEMPLATE template;
DLGTEMPLATE template;
SEGPTR headerPtr;
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
DWORD exStyle = 0;
WORD xUnit = xBaseUnit; WORD xUnit = xBaseUnit;
WORD yUnit = yBaseUnit; WORD yUnit = yBaseUnit;
/* Parse dialog template */ /* Parse dialog template */
if (!dlgTemplate) return 0; if (!dlgTemplate) return 0;
headerPtr = DIALOG_ParseTemplate( dlgTemplate, &template ); if (win32) dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
if (debugging_dialog) DIALOG_DisplayTemplate( &template ); else dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
/* Load menu */ /* Load menu */
if (template.menuName) hMenu = LoadMenu( hInst, template.menuName ); if (template.menuName)
{
LPSTR str = SEGPTR_STRDUP( template.menuName ); /* FIXME: win32 */
hMenu = LoadMenu( hInst, SEGPTR_GET(str) );
SEGPTR_FREE( str );
}
/* Create custom font if needed */ /* Create custom font if needed */
...@@ -282,7 +514,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -282,7 +514,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
hFont = CreateFont( -template.pointSize, 0, 0, 0, FW_DONTCARE, hFont = CreateFont( -template.pointSize, 0, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, DEFAULT_QUALITY, FF_DONTCARE,
(LPSTR)PTR_SEG_TO_LIN(template.faceName) ); template.faceName ); /* FIXME: win32 */
if (hFont) if (hFont)
{ {
TEXTMETRIC tm; TEXTMETRIC tm;
...@@ -306,9 +538,10 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -306,9 +538,10 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
rect.left = rect.top = 0; rect.left = rect.top = 0;
rect.right = template.cx * xUnit / 4; rect.right = template.cx * xUnit / 4;
rect.bottom = template.cy * yUnit / 8; rect.bottom = template.cy * yUnit / 8;
if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME; if (template.style & DS_MODALFRAME)
template.exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx16( &rect, template.style, AdjustWindowRectEx16( &rect, template.style,
hMenu ? TRUE : FALSE , exStyle ); hMenu ? TRUE : FALSE , template.exStyle );
rect.right -= rect.left; rect.right -= rect.left;
rect.bottom -= rect.top; rect.bottom -= rect.top;
...@@ -322,10 +555,17 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -322,10 +555,17 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
ClientToScreen16( owner, (POINT16 *)&rect ); ClientToScreen16( owner, (POINT16 *)&rect );
} }
hwnd = CreateWindowEx16( exStyle, template.className, template.caption, if (win32)
hwnd = CreateWindowEx32W(template.exStyle, (LPCWSTR)template.className,
(LPCWSTR)template.caption,
template.style & ~WS_VISIBLE, template.style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom, rect.left, rect.top, rect.right, rect.bottom,
owner, hMenu, hInst, (SEGPTR)0 ); owner, hMenu, hInst, NULL );
else
hwnd = CreateWindowEx16(template.exStyle, template.className,
template.caption, template.style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom,
owner, hMenu, hInst, NULL );
if (!hwnd) if (!hwnd)
{ {
if (hFont) DeleteObject( hFont ); if (hFont) DeleteObject( hFont );
...@@ -334,137 +574,161 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -334,137 +574,161 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
} }
wndPtr = WIN_FindWndPtr( hwnd ); wndPtr = WIN_FindWndPtr( hwnd );
/* Create control windows */ /* Initialise dialog extra data */
dprintf_dialog(stddeb, " BEGIN\n" );
dlgInfo = (DIALOGINFO *)wndPtr->wExtra; dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->dlgProc = dlgProc;
dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
dlgInfo->msgResult = 0; /* This is used to store the default button id */ dlgInfo->msgResult = 0; /* This is used to store the default button id */
dlgInfo->hDialogHeap = 0; dlgInfo->hDialogHeap = 0;
for (i = 0; i < template.nbItems; i++) /* Create controls */
{
DLGCONTROLHEADER header;
SEGPTR className, winName;
HWND hwndDefButton = 0;
char buffer[10];
headerPtr = DIALOG_GetControl( headerPtr, &header, if (!DIALOG_CreateControls( wndPtr, dlgTemplate, template.nbItems,
&className, &winName ); hInst, win32 ))
if (!HIWORD(className))
{
switch(LOWORD(className))
{ {
case 0x80: strcpy( buffer, "BUTTON" ); break; DestroyWindow( hwnd );
case 0x81: strcpy( buffer, "EDIT" ); break; return 0;
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;
}
className = MAKE_SEGPTR(buffer);
} }
if (HIWORD(className)) /* Send initialisation messages and set focus */
dprintf_dialog(stddeb, " %s ", (char*)PTR_SEG_TO_LIN(className));
else dprintf_dialog(stddeb, " %04x ", LOWORD(className) );
if (HIWORD(winName))
dprintf_dialog(stddeb,"'%s'", (char *)PTR_SEG_TO_LIN(winName) );
else dprintf_dialog(stddeb,"%04x", LOWORD(winName) );
dprintf_dialog(stddeb," %d, %d, %d, %d, %d, %08lx\n", dlgInfo->hwndFocus = DIALOG_GetFirstTabItem( hwnd );
header.id, header.x, header.y, if (dlgInfo->hUserFont)
header.cx, header.cy, header.style ); SendMessage32A( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
if (SendMessage32A(hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param))
SetFocus( dlgInfo->hwndFocus );
if (template.style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
return hwnd;
}
if (HIWORD(className) &&
!strcmp( (char *)PTR_SEG_TO_LIN(className), "EDIT") &&
((header.style & DS_LOCALEDIT) != DS_LOCALEDIT))
{
if (!dlgInfo->hDialogHeap)
{
dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
if (!dlgInfo->hDialogHeap)
{
fprintf(stderr,"CreateDialogIndirectParam: Insufficient memory to create heap for edit control\n");
continue;
}
LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
}
hwndCtrl = CreateWindowEx16(WS_EX_NOPARENTNOTIFY, className, winName,
header.style | WS_CHILD,
header.x * xUnit / 4,
header.y * yUnit / 8,
header.cx * xUnit / 4,
header.cy * yUnit / 8,
hwnd, (HMENU)header.id,
dlgInfo->hDialogHeap, (SEGPTR)0 );
}
else
{
hwndCtrl = CreateWindowEx16( WS_EX_NOPARENTNOTIFY, className,
winName,
header.style | WS_CHILD,
header.x * xUnit / 4,
header.y * yUnit / 8,
header.cx * xUnit / 4,
header.cy * yUnit / 8,
hwnd, (HMENU)header.id,
hInst, (SEGPTR)0 );
}
/* Make the control last one in Z-order, so that controls remain /***********************************************************************
in the order in which they were created */ * CreateDialog16 (USER.89)
SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0, */
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); HWND16 CreateDialog16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
HWND16 owner, DLGPROC dlgProc )
{
return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
}
/* Send initialisation messages to the control */
if (hFont) SendMessage16( hwndCtrl, WM_SETFONT, (WPARAM)hFont, 0 ); /***********************************************************************
if (SendMessage16( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON) * CreateDialogParam16 (USER.241)
*/
HWND16 CreateDialogParam16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
HWND16 owner, DLGPROC dlgProc, LPARAM param )
{
HWND16 hwnd = 0;
HRSRC hRsrc;
HGLOBAL16 hmem;
LPCVOID data;
dprintf_dialog(stddeb, "CreateDialogParam16: %04x,%08lx,%04x,%08lx,%ld\n",
hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0;
if (!(hmem = LoadResource( hInst, hRsrc ))) return 0;
if (!(data = LockResource( hmem ))) hwnd = 0;
else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
dlgProc, param );
FreeResource( hmem );
return hwnd;
}
/***********************************************************************
* CreateDialogParam32A (USER32.72)
*/
HWND32 CreateDialogParam32A( HINSTANCE32 hInst, LPCSTR name,
HWND32 owner, DLGPROC dlgProc, LPARAM param )
{
if (HIWORD(name))
{ {
/* If there's already a default push-button, set it back */ LPWSTR str = STRING32_DupAnsiToUni( name );
/* to normal and use this one instead. */ HWND32 hwnd = CreateDialogParam32W( hInst, str, owner, dlgProc, param);
if (hwndDefButton) free( str );
SendMessage32A( hwndDefButton, BM_SETSTYLE32, return hwnd;
BS_PUSHBUTTON,FALSE );
hwndDefButton = hwndCtrl;
dlgInfo->msgResult = GetWindowWord( hwndCtrl, GWW_ID );
}
} }
return CreateDialogParam32W( hInst, (LPCWSTR)name, owner, dlgProc, param );
}
dprintf_dialog(stddeb, " END\n" );
/* Initialise dialog extra data */ /***********************************************************************
* CreateDialogParam32W (USER32.73)
*/
HWND32 CreateDialogParam32W( HINSTANCE32 hInst, LPCWSTR name,
HWND32 owner, DLGPROC dlgProc, LPARAM param )
{
HANDLE32 hrsrc = FindResource32( hInst, name, (LPWSTR)RT_DIALOG );
if (!hrsrc) return 0;
return CreateDialogIndirectParam32W( hInst, LoadResource32( hInst, hrsrc ),
owner, dlgProc, param );
}
dlgInfo->dlgProc = dlgProc;
dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
dlgInfo->hwndFocus = DIALOG_GetFirstTabItem( hwnd );
/* Send initialisation messages and set focus */ /***********************************************************************
* CreateDialogIndirect16 (USER.219)
*/
HWND16 CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
HWND16 owner, DLGPROC dlgProc )
{
return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
}
if (dlgInfo->hUserFont)
SendMessage16( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 ); /***********************************************************************
if (SendMessage16( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param )) * CreateDialogIndirectParam16 (USER.242)
SetFocus( dlgInfo->hwndFocus ); */
if (template.style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW); HWND16 CreateDialogIndirectParam16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
return hwnd; HWND16 owner, DLGPROC dlgProc,
LPARAM param )
{
HANDLE32 proc = WINPROC_AllocWinProc( (UINT32)dlgProc, WIN_PROC_16 );
return DIALOG_CreateIndirect( hInst, dlgTemplate,
owner, proc, param, FALSE );
}
/***********************************************************************
* CreateDialogIndirectParam32A (USER32.69)
*/
HWND32 CreateDialogIndirectParam32A( HINSTANCE32 hInst, LPCVOID dlgTemplate,
HWND32 owner, DLGPROC dlgProc,
LPARAM param )
{
HANDLE32 proc = WINPROC_AllocWinProc( (UINT32)dlgProc, WIN_PROC_32A );
return DIALOG_CreateIndirect( hInst, dlgTemplate,
owner, proc, param, TRUE );
}
/***********************************************************************
* CreateDialogIndirectParam32W (USER32.71)
*/
HWND32 CreateDialogIndirectParam32W( HINSTANCE32 hInst, LPCVOID dlgTemplate,
HWND32 owner, DLGPROC dlgProc,
LPARAM param )
{
HANDLE32 proc = WINPROC_AllocWinProc( (UINT32)dlgProc, WIN_PROC_32W );
return DIALOG_CreateIndirect( hInst, dlgTemplate,
owner, proc, param, TRUE );
} }
/*********************************************************************** /***********************************************************************
* DIALOG_DoDialogBox * DIALOG_DoDialogBox
*/ */
int DIALOG_DoDialogBox( HWND hwnd, HWND owner ) static INT32 DIALOG_DoDialogBox( HWND hwnd, HWND owner )
{ {
WND * wndPtr; WND * wndPtr;
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
HANDLE msgHandle; HANDLE msgHandle;
MSG* lpmsg; MSG* lpmsg;
int retval; INT32 retval;
/* Owner must be a top-level window */ /* Owner must be a top-level window */
owner = WIN_GetTopParent( owner ); owner = WIN_GetTopParent( owner );
...@@ -495,62 +759,108 @@ int DIALOG_DoDialogBox( HWND hwnd, HWND owner ) ...@@ -495,62 +759,108 @@ int DIALOG_DoDialogBox( HWND hwnd, HWND owner )
/*********************************************************************** /***********************************************************************
* DialogBox (USER.87) * DialogBox16 (USER.87)
*/ */
INT DialogBox( HINSTANCE hInst, SEGPTR dlgTemplate, INT16 DialogBox16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
HWND owner, DLGPROC dlgProc ) HWND16 owner, DLGPROC dlgProc )
{ {
return DialogBoxParam( hInst, dlgTemplate, owner, dlgProc, 0 ); return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
} }
/*********************************************************************** /***********************************************************************
* DialogBoxParam (USER.239) * DialogBoxParam16 (USER.239)
*/ */
INT DialogBoxParam( HINSTANCE hInst, SEGPTR dlgTemplate, INT16 DialogBoxParam16( HINSTANCE16 hInst, SEGPTR template,
HWND owner, DLGPROC dlgProc, LPARAM param ) HWND16 owner, DLGPROC dlgProc, LPARAM param )
{ {
HWND hwnd; HWND16 hwnd = CreateDialogParam16( hInst, template, owner, dlgProc, param);
if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
dprintf_dialog(stddeb, "DialogBoxParam: %04x,%08lx,%04x,%08lx,%ld\n",
hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param ); /***********************************************************************
hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param ); * DialogBoxParam32A (USER32.138)
*/
INT32 DialogBoxParam32A( HINSTANCE32 hInst, LPCSTR name,
HWND32 owner, DLGPROC dlgProc, LPARAM param )
{
HWND32 hwnd = CreateDialogParam32A( hInst, name, owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner ); if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1; return -1;
} }
/*********************************************************************** /***********************************************************************
* DialogBoxIndirect (USER.218) * DialogBoxParam32W (USER32.139)
*/ */
INT DialogBoxIndirect( HINSTANCE hInst, HANDLE dlgTemplate, INT32 DialogBoxParam32W( HINSTANCE32 hInst, LPCWSTR name,
HWND owner, DLGPROC dlgProc ) HWND32 owner, DLGPROC dlgProc, LPARAM param )
{ {
return DialogBoxIndirectParam( hInst, dlgTemplate, owner, dlgProc, 0 ); HWND32 hwnd = CreateDialogParam32W( hInst, name, owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1;
} }
/*********************************************************************** /***********************************************************************
* DialogBoxIndirectParam (USER.240) * DialogBoxIndirect16 (USER.218)
*/ */
INT DialogBoxIndirectParam( HINSTANCE hInst, HANDLE dlgTemplate, INT16 DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
HWND owner, DLGPROC dlgProc, LPARAM param ) HWND16 owner, DLGPROC dlgProc )
{ {
HWND hwnd; return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
SEGPTR ptr; }
if (!(ptr = (SEGPTR)WIN16_GlobalLock16( dlgTemplate ))) return -1; /***********************************************************************
hwnd = CreateDialogIndirectParam( hInst, ptr, owner, dlgProc, param ); * DialogBoxIndirectParam16 (USER.240)
*/
INT16 DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
HWND16 owner, DLGPROC dlgProc, LPARAM param )
{
HWND16 hwnd;
LPCVOID ptr;
if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
hwnd = CreateDialogIndirectParam16( hInst, ptr, owner, dlgProc, param );
GlobalUnlock16( dlgTemplate ); GlobalUnlock16( dlgTemplate );
if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
/***********************************************************************
* DialogBoxIndirectParam32A (USER32.135)
*/
INT32 DialogBoxIndirectParam32A( HINSTANCE32 hInstance, LPCVOID template,
HWND32 owner, DLGPROC dlgProc ,LPARAM param )
{
HWND32 hwnd = CreateDialogIndirectParam32A( hInstance, template,
owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
/***********************************************************************
* DialogBoxIndirectParam32W (USER32.137)
*/
INT32 DialogBoxIndirectParam32W( HINSTANCE32 hInstance, LPCVOID template,
HWND32 owner, DLGPROC dlgProc ,LPARAM param )
{
HWND32 hwnd = CreateDialogIndirectParam32W( hInstance, template,
owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner ); if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1; return -1;
} }
/*********************************************************************** /***********************************************************************
* EndDialog (USER.88) * EndDialog (USER.88) (USER32.173)
*/ */
BOOL EndDialog( HWND hwnd, INT retval ) BOOL16 EndDialog( HWND32 hwnd, INT32 retval )
{ {
WND * wndPtr = WIN_FindWndPtr( hwnd ); WND * wndPtr = WIN_FindWndPtr( hwnd );
DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra; DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "registers.h" #include "registers.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "dde_proc.h"
#ifdef ndef #ifdef ndef
...@@ -628,14 +629,18 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event ) ...@@ -628,14 +629,18 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
*/ */
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
{ {
if (hwnd == GetDesktopWindow()) /* FIXME: with -desktop xxx we get this event _before_ desktop
* window structure is created. WIN_GetDesktop() check is a hack.
*/
if ( !WIN_GetDesktop() || hwnd == GetDesktopWindow())
{ {
desktopX = event->x; desktopX = event->x;
desktopY = event->y; desktopY = event->y;
} }
else else
{ {
/* A managed window; most of this code is shamelessly /* Managed window; most of this code is shamelessly
* stolen from SetWindowPos - FIXME: outdated * stolen from SetWindowPos - FIXME: outdated
*/ */
...@@ -710,17 +715,20 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) ...@@ -710,17 +715,20 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
static void EVENT_SelectionRequest( HWND hwnd, XSelectionRequestEvent *event ) static void EVENT_SelectionRequest( HWND hwnd, XSelectionRequestEvent *event )
{ {
XSelectionEvent result; XSelectionEvent result;
Atom rprop; Atom rprop = None;
Window request=event->requestor; Window request = event->requestor;
rprop=None;
if(event->target == XA_STRING) if(event->target == XA_STRING)
{ {
HANDLE hText; HANDLE hText;
LPSTR text; LPSTR text;
rprop=event->property;
if(rprop == None)rprop=event->target; rprop = event->property;
if(event->selection!=XA_PRIMARY)rprop=None;
else if(!IsClipboardFormatAvailable(CF_TEXT))rprop=None; if(rprop == None) rprop = event->target;
if(event->selection!=XA_PRIMARY) rprop = None;
else if(!CLIPBOARD_IsPresent(CF_TEXT)) rprop = None;
else{ else{
/* Don't worry if we can't open */ /* Don't worry if we can't open */
BOOL couldOpen=OpenClipboard(hwnd); BOOL couldOpen=OpenClipboard(hwnd);
...@@ -733,8 +741,10 @@ static void EVENT_SelectionRequest( HWND hwnd, XSelectionRequestEvent *event ) ...@@ -733,8 +741,10 @@ static void EVENT_SelectionRequest( HWND hwnd, XSelectionRequestEvent *event )
if(couldOpen)CloseClipboard(); if(couldOpen)CloseClipboard();
} }
} }
if(rprop==None) dprintf_event(stddeb,"Request for %s ignored\n",
XGetAtomName(display,event->target)); if(rprop==None)
dprintf_event(stddeb,"Request for %s ignored\n", XGetAtomName(display,event->target));
result.type=SelectionNotify; result.type=SelectionNotify;
result.display=display; result.display=display;
result.requestor=request; result.requestor=request;
......
...@@ -356,10 +356,11 @@ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam ) ...@@ -356,10 +356,11 @@ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam )
style |= (WS_VISIBLE | WS_OVERLAPPEDWINDOW); style |= (WS_VISIBLE | WS_OVERLAPPEDWINDOW);
} }
hwnd = CreateWindow16( cs->szClass, cs->szTitle, style, hwnd = CreateWindow16( (LPCSTR)PTR_SEG_TO_LIN(cs->szClass),
(LPCSTR)PTR_SEG_TO_LIN(cs->szTitle), style,
cs->x, cs->y, cs->cx, cs->cy, parent, cs->x, cs->y, cs->cx, cs->cy, parent,
(HMENU)(DWORD)(WORD)wIDmenu, w->hInstance, (HMENU)(DWORD)(WORD)wIDmenu, w->hInstance,
(SEGPTR)lParam); (LPVOID)lParam);
if (hwnd) if (hwnd)
{ {
......
...@@ -699,7 +699,8 @@ LRESULT SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam) ...@@ -699,7 +699,8 @@ LRESULT SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam)
} }
SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam );
ret = CallWindowProc16( wndPtr->lpfnWndProc, hwnd, msg, wParam, lParam ); ret = CallWindowProc16( (WNDPROC16)wndPtr->winproc,
hwnd, msg, wParam, lParam );
SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, ret ); SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, ret );
return ret; return ret;
} }
...@@ -738,7 +739,7 @@ LRESULT SendMessage32A(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) ...@@ -738,7 +739,7 @@ LRESULT SendMessage32A(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
} }
SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam );
ret = CallWindowProc32A( (WNDPROC32)wndPtr->lpfnWndProc, ret = CallWindowProc32A( (WNDPROC32)wndPtr->winproc,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret );
return ret; return ret;
...@@ -778,7 +779,7 @@ LRESULT SendMessage32W(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) ...@@ -778,7 +779,7 @@ LRESULT SendMessage32W(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
} }
SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam );
ret = CallWindowProc32W( (WNDPROC32)wndPtr->lpfnWndProc, ret = CallWindowProc32W( (WNDPROC32)wndPtr->winproc,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret );
return ret; return ret;
...@@ -869,14 +870,14 @@ LONG DispatchMessage( const MSG* msg ) ...@@ -869,14 +870,14 @@ LONG DispatchMessage( const MSG* msg )
if (!msg->hwnd) return 0; if (!msg->hwnd) return 0;
if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0; if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0;
if (!wndPtr->lpfnWndProc) return 0; if (!wndPtr->winproc) return 0;
painting = (msg->message == WM_PAINT); painting = (msg->message == WM_PAINT);
if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
/* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ /* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
SPY_EnterMessage( SPY_DISPATCHMESSAGE16, msg->hwnd, msg->message, SPY_EnterMessage( SPY_DISPATCHMESSAGE16, msg->hwnd, msg->message,
msg->wParam, msg->lParam ); msg->wParam, msg->lParam );
retval = CallWindowProc16( wndPtr->lpfnWndProc, msg->hwnd, msg->message, retval = CallWindowProc16( wndPtr->winproc, msg->hwnd, msg->message,
msg->wParam, msg->lParam ); msg->wParam, msg->lParam );
SPY_ExitMessage( SPY_RESULT_OK16, msg->hwnd, msg->message, retval ); SPY_ExitMessage( SPY_RESULT_OK16, msg->hwnd, msg->message, retval );
......
...@@ -99,11 +99,10 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ...@@ -99,11 +99,10 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
bwidth = rect.left; bwidth = rect.left;
GetWindowRect16(GetDlgItem(hwnd, 1), &rect); GetWindowRect16(GetDlgItem(hwnd, 1), &rect);
bwidth -= rect.left; bwidth -= rect.left;
for (buttons = 0, i = 1; i < 8; i++) { for (buttons = 0, i = 1; i < 8; i++)
{
hItem = GetDlgItem(hwnd, i); hItem = GetDlgItem(hwnd, i);
if (GetWindowLong(hItem, GWL_STYLE) & WS_VISIBLE) { if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) buttons++;
buttons++;
}
} }
/* Get the text size */ /* Get the text size */
...@@ -141,7 +140,7 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ...@@ -141,7 +140,7 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
for (buttons = i = 0; i < 7; i++) { for (buttons = i = 0; i < 7; i++) {
/* some arithmetic to get the right order for YesNoCancel windows */ /* some arithmetic to get the right order for YesNoCancel windows */
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1); hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
if (GetWindowLong(hItem, GWL_STYLE) & WS_VISIBLE) { if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) {
if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) { if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) {
SetFocus(hItem); SetFocus(hItem);
SendMessage32A( hItem, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE ); SendMessage32A( hItem, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE );
...@@ -187,7 +186,7 @@ int MessageBox(HWND hWnd, LPCSTR text, LPCSTR title, WORD type) ...@@ -187,7 +186,7 @@ int MessageBox(HWND hWnd, LPCSTR text, LPCSTR title, WORD type)
handle = SYSRES_LoadResource( SYSRES_DIALOG_MSGBOX ); handle = SYSRES_LoadResource( SYSRES_DIALOG_MSGBOX );
if (!handle) return 0; if (!handle) return 0;
ret = DialogBoxIndirectParam( WIN_GetWindowInstance(hWnd), ret = DialogBoxIndirectParam16( WIN_GetWindowInstance(hWnd),
handle, hWnd, handle, hWnd,
MODULE_GetWndProcEntry16("SystemMessageBoxProc"), MODULE_GetWndProcEntry16("SystemMessageBoxProc"),
(LONG)&mbox ); (LONG)&mbox );
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "win.h" #include "win.h"
#include "queue.h" #include "queue.h"
#include "gdi.h" #include "gdi.h"
#include "dce.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_WIN */ /* #define DEBUG_WIN */
#include "debug.h" #include "debug.h"
...@@ -104,8 +105,14 @@ HDC16 BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps ) ...@@ -104,8 +105,14 @@ HDC16 BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
HideCaret( hwnd ); HideCaret( hwnd );
lps->hdc = GetDCEx( hwnd, hrgnUpdate, DCX_INTERSECTRGN | DCX_USESTYLE ); dprintf_win(stddeb,"hrgnUpdate = %04x, ", hrgnUpdate);
if(hrgnUpdate > 1) DeleteObject( hrgnUpdate );
lps->hdc = GetDCEx( hwnd, hrgnUpdate, DCX_INTERSECTRGN | DCX_WINDOWPAINT | DCX_USESTYLE );
dprintf_win(stddeb,"hdc = %04x\n", lps->hdc);
/* pseudocode from "Internals" doesn't delete hrgnUpdate - yet another clue
that ReleaseDC should take care of it (hence DCX_KEEPCLIPRGN) */
if (!lps->hdc) if (!lps->hdc)
{ {
...@@ -348,7 +355,7 @@ BOOL32 RedrawWindow32( HWND32 hwnd, const RECT32 *rectUpdate, ...@@ -348,7 +355,7 @@ BOOL32 RedrawWindow32( HWND32 hwnd, const RECT32 *rectUpdate,
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND) if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
{ {
HDC hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate, HDC hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
DCX_INTERSECTRGN | DCX_USESTYLE ); DCX_INTERSECTRGN | DCX_USESTYLE | DCX_KEEPCLIPRGN | DCX_WINDOWPAINT);
if (hdc) if (hdc)
{ {
/* Don't send WM_ERASEBKGND to icons */ /* Don't send WM_ERASEBKGND to icons */
......
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
/* #define DEBUG_SCROLL */ /* #define DEBUG_SCROLL */
#include "debug.h" #include "debug.h"
extern HRGN DCE_GetVisRgn(HWND, WORD); /* windows/dce.c */
extern HWND CARET_GetHwnd(); /* windows/caret.c */
extern HRGN DCE_GetVisRgn(HWND, WORD); extern void CLIPPING_UpdateGCRegion(DC* ); /* objects/clipping.c */
extern HWND CARET_GetHwnd();
static int RgnType; static int RgnType;
...@@ -112,9 +111,7 @@ BOOL SCROLL_ScrollChildren( HWND hScroll, short dx, short dy) ...@@ -112,9 +111,7 @@ BOOL SCROLL_ScrollChildren( HWND hScroll, short dx, short dy)
/************************************************************************* /*************************************************************************
* ScrollWindow (USER.61) * ScrollWindow (USER.61)
* *
* FIXME: a bit broken
*/ */
void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect) void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect)
{ {
HDC hdc; HDC hdc;
...@@ -192,13 +189,13 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRec ...@@ -192,13 +189,13 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRec
/************************************************************************* /*************************************************************************
* ScrollDC (USER.221) * ScrollDC (USER.221)
* *
* FIXME: half-broken
*/ */
BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
HRGN hrgnUpdate, LPRECT16 rcUpdate) HRGN hrgnUpdate, LPRECT16 rcUpdate)
{ {
HRGN hrgnClip; HRGN hrgnClip = 0;
HRGN hrgnScrollClip = 0;
RECT16 rectClip;
POINT16 src, dest; POINT16 src, dest;
short width, height; short width, height;
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
...@@ -207,20 +204,37 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, ...@@ -207,20 +204,37 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
dx, dy, hrgnUpdate, rcUpdate, cliprc, rc ? rc->left : 0, dx, dy, hrgnUpdate, rcUpdate, cliprc, rc ? rc->left : 0,
rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 ); rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 );
if (rc == NULL) if (rc == NULL || !hdc || !dc)
return FALSE; return FALSE;
if (!dc) /* set clipping region */
{
fprintf(stdnimp,"ScrollDC: Invalid HDC\n");
return FALSE;
}
if (cliprc) if (cliprc)
IntersectRect16(&rectClip,rc,cliprc);
else
rectClip = *rc;
if( rectClip.left >= rectClip.right || rectClip.top >= rectClip.bottom )
return FALSE;
hrgnClip = GetClipRgn(hdc);
hrgnScrollClip = CreateRectRgnIndirect16(&rectClip);
if( hrgnClip )
{ {
hrgnClip = CreateRectRgnIndirect16(cliprc); /* call UpdateGCRegion directly to avoid
SelectClipRgn(hdc, hrgnClip); * one more temporary region
*/
CombineRgn( hrgnScrollClip, hrgnClip, 0, RGN_COPY );
SetRectRgn( hrgnClip, rectClip.left, rectClip.top, rectClip.right, rectClip.bottom );
CLIPPING_UpdateGCRegion( dc );
} }
else
SelectClipRgn( hdc, hrgnScrollClip );
/* translate coordinates */
if (dx > 0) if (dx > 0)
{ {
...@@ -246,10 +260,14 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, ...@@ -246,10 +260,14 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
width = rc->right - rc->left - abs(dx); width = rc->right - rc->left - abs(dx);
height = rc->bottom - rc->top - abs(dy); height = rc->bottom - rc->top - abs(dy);
/* copy bits */
if (!BitBlt(hdc, dest.x, dest.y, width, height, hdc, src.x, src.y, if (!BitBlt(hdc, dest.x, dest.y, width, height, hdc, src.x, src.y,
SRCCOPY)) SRCCOPY))
return FALSE; return FALSE;
/* compute update areas */
if (hrgnUpdate) if (hrgnUpdate)
{ {
HRGN hrgn1,hrgn2; HRGN hrgn1,hrgn2;
...@@ -291,6 +309,11 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, ...@@ -291,6 +309,11 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
UnionRect16( rcUpdate, &rx, &ry ); UnionRect16( rcUpdate, &rx, &ry );
} }
/* restore clipping region */
SelectClipRgn( hdc, (hrgnClip)?hrgnScrollClip:0 );
DeleteObject( hrgnScrollClip );
return TRUE; return TRUE;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 1993, 1994 Alexandre Julliard * Copyright 1993, 1994 Alexandre Julliard
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include "shm_main_blk.h" #include "shm_main_blk.h"
#include "dde_proc.h" #include "dde_proc.h"
#include "callback.h" #include "callback.h"
#include "clipboard.h"
#include "winproc.h" #include "winproc.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_WIN */ /* #define DEBUG_WIN */
...@@ -90,13 +92,13 @@ void WIN_DumpWindow( HWND hwnd ) ...@@ -90,13 +92,13 @@ void WIN_DumpWindow( HWND hwnd )
fprintf( stderr, fprintf( stderr,
"next=%p child=%p parent=%p owner=%p class=%p '%s'\n" "next=%p child=%p parent=%p owner=%p class=%p '%s'\n"
"inst=%04x taskQ=%04x updRgn=%04x active=%04x hdce=%04x idmenu=%04x\n" "inst=%04x taskQ=%04x updRgn=%04x active=%04x hdce=%04x idmenu=%04x\n"
"style=%08lx exstyle=%08lx wndproc=%08lx text='%s'\n" "style=%08lx exstyle=%08lx wndproc=%08x text='%s'\n"
"client=%d,%d-%d,%d window=%d,%d-%d,%d iconpos=%d,%d maxpos=%d,%d\n" "client=%d,%d-%d,%d window=%d,%d-%d,%d iconpos=%d,%d maxpos=%d,%d\n"
"sysmenu=%04x flags=%04x props=%04x vscroll=%04x hscroll=%04x\n", "sysmenu=%04x flags=%04x props=%04x vscroll=%04x hscroll=%04x\n",
ptr->next, ptr->child, ptr->parent, ptr->owner, ptr->next, ptr->child, ptr->parent, ptr->owner,
ptr->class, className, ptr->hInstance, ptr->hmemTaskQ, ptr->class, className, ptr->hInstance, ptr->hmemTaskQ,
ptr->hrgnUpdate, ptr->hwndLastActive, ptr->hdce, ptr->wIDmenu, ptr->hrgnUpdate, ptr->hwndLastActive, ptr->hdce, ptr->wIDmenu,
ptr->dwStyle, ptr->dwExStyle, (DWORD)ptr->lpfnWndProc, ptr->dwStyle, ptr->dwExStyle, ptr->winproc,
ptr->text ? ptr->text : "", ptr->text ? ptr->text : "",
ptr->rectClient.left, ptr->rectClient.top, ptr->rectClient.right, ptr->rectClient.left, ptr->rectClient.top, ptr->rectClient.right,
ptr->rectClient.bottom, ptr->rectWindow.left, ptr->rectWindow.top, ptr->rectClient.bottom, ptr->rectWindow.left, ptr->rectWindow.top,
...@@ -142,11 +144,9 @@ void WIN_WalkWindows( HWND hwnd, int indent ) ...@@ -142,11 +144,9 @@ void WIN_WalkWindows( HWND hwnd, int indent )
GlobalGetAtomName16(ptr->class->atomName,className,sizeof(className)); GlobalGetAtomName16(ptr->class->atomName,className,sizeof(className));
fprintf( stderr, "%08lx %-6.4x %-17.17s %08x %04x:%04x\n", fprintf( stderr, "%08lx %-6.4x %-17.17s %08x %08x\n",
(DWORD)ptr, ptr->hmemTaskQ, className, (DWORD)ptr, ptr->hmemTaskQ, className,
(unsigned) ptr->dwStyle, (unsigned) ptr->dwStyle, ptr->winproc );
HIWORD(ptr->lpfnWndProc),
LOWORD(ptr->lpfnWndProc));
if (ptr->child) WIN_WalkWindows( ptr->child->hwndSelf, indent+1 ); if (ptr->child) WIN_WalkWindows( ptr->child->hwndSelf, indent+1 );
ptr = ptr->next; ptr = ptr->next;
...@@ -307,12 +307,11 @@ void WIN_SendParentNotify( HWND hwnd, WORD event, WORD idChild, LONG lValue ) ...@@ -307,12 +307,11 @@ void WIN_SendParentNotify( HWND hwnd, WORD event, WORD idChild, LONG lValue )
* *
* Set the window procedure and return the old one. * Set the window procedure and return the old one.
*/ */
static WNDPROC16 WIN_SetWndProc(WND *pWnd, WNDPROC16 proc, WINDOWPROCTYPE type) static HANDLE32 WIN_SetWndProc( WND *pWnd, HANDLE32 proc, WINDOWPROCTYPE type)
{ {
WNDPROC16 oldProc = pWnd->lpfnWndProc; HANDLE32 oldProc = pWnd->winproc;
if (type == WIN_PROC_16) pWnd->lpfnWndProc = proc; pWnd->winproc = WINPROC_AllocWinProc( proc, type );
else pWnd->lpfnWndProc = WINPROC_AllocWinProc( (WNDPROC32)proc, type ); if (oldProc) WINPROC_FreeWinProc( oldProc );
WINPROC_FreeWinProc( oldProc );
return oldProc; return oldProc;
} }
...@@ -382,6 +381,8 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -382,6 +381,8 @@ BOOL WIN_CreateDesktopWindow(void)
HDC hdc; HDC hdc;
HWND hwndDesktop; HWND hwndDesktop;
dprintf_win(stddeb,"Creating desktop window\n");
if (!(class = CLASS_FindClassByAtom( DESKTOP_CLASS_ATOM, 0 ))) if (!(class = CLASS_FindClassByAtom( DESKTOP_CLASS_ATOM, 0 )))
return FALSE; return FALSE;
...@@ -394,6 +395,7 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -394,6 +395,7 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop->parent = NULL; pWndDesktop->parent = NULL;
pWndDesktop->owner = NULL; pWndDesktop->owner = NULL;
pWndDesktop->class = class; pWndDesktop->class = class;
pWndDesktop->winproc = WINPROC_CopyWinProc( class->winproc );
pWndDesktop->dwMagic = WND_MAGIC; pWndDesktop->dwMagic = WND_MAGIC;
pWndDesktop->hwndSelf = hwndDesktop; pWndDesktop->hwndSelf = hwndDesktop;
pWndDesktop->hInstance = 0; pWndDesktop->hInstance = 0;
...@@ -411,7 +413,6 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -411,7 +413,6 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop->hmemTaskQ = 0; /* Desktop does not belong to a task */ pWndDesktop->hmemTaskQ = 0; /* Desktop does not belong to a task */
pWndDesktop->hrgnUpdate = 0; pWndDesktop->hrgnUpdate = 0;
pWndDesktop->hwndLastActive = hwndDesktop; pWndDesktop->hwndLastActive = hwndDesktop;
pWndDesktop->lpfnWndProc = (WNDPROC16)0;
pWndDesktop->dwStyle = WS_VISIBLE | WS_CLIPCHILDREN | pWndDesktop->dwStyle = WS_VISIBLE | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS; WS_CLIPSIBLINGS;
pWndDesktop->dwExStyle = 0; pWndDesktop->dwExStyle = 0;
...@@ -423,8 +424,8 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -423,8 +424,8 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop->window = rootWindow; pWndDesktop->window = rootWindow;
pWndDesktop->hSysMenu = 0; pWndDesktop->hSysMenu = 0;
pWndDesktop->hProp = 0; pWndDesktop->hProp = 0;
WIN_SetWndProc( pWndDesktop, class->lpfnWndProc, pWndDesktop->userdata = 0;
WINPROC_GetWinProcType(class->lpfnWndProc) );
EVENT_RegisterWindow( pWndDesktop->window, hwndDesktop ); EVENT_RegisterWindow( pWndDesktop->window, hwndDesktop );
SendMessage32A( hwndDesktop, WM_NCCREATE, 0, 0 ); SendMessage32A( hwndDesktop, WM_NCCREATE, 0, 0 );
if ((hdc = GetDC( hwndDesktop )) != 0) if ((hdc = GetDC( hwndDesktop )) != 0)
...@@ -441,27 +442,37 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -441,27 +442,37 @@ BOOL WIN_CreateDesktopWindow(void)
* *
* Implementation of CreateWindowEx(). * Implementation of CreateWindowEx().
*/ */
static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
INT16 x, INT16 y, INT16 width, INT16 height, BOOL unicode )
HWND parent, HMENU menu, HINSTANCE16 instance )
{ {
CLASS *classPtr; CLASS *classPtr;
WND *wndPtr; WND *wndPtr;
HWND16 hwnd; HWND16 hwnd;
POINT16 maxSize, maxPos, minTrack, maxTrack; POINT16 maxSize, maxPos, minTrack, maxTrack;
LRESULT wmcreate;
dprintf_win( stddeb, "CreateWindowEx: " );
if (HIWORD(cs->lpszName)) dprintf_win( stddeb, "'%s' ", cs->lpszName );
else dprintf_win( stddeb, "#%04x ", LOWORD(cs->lpszName) );
if (HIWORD(cs->lpszClass)) dprintf_win( stddeb, "'%s' ", cs->lpszClass );
else dprintf_win( stddeb, "#%04x ", LOWORD(cs->lpszClass) );
dprintf_win( stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %p\n",
cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy,
cs->hwndParent, cs->hMenu, cs->hInstance, cs->lpCreateParams);
/* Find the parent window */ /* Find the parent window */
if (parent) if (cs->hwndParent)
{ {
/* Make sure parent is valid */ /* Make sure parent is valid */
if (!IsWindow( parent )) if (!IsWindow( cs->hwndParent ))
{ {
fprintf( stderr, "CreateWindowEx: bad parent %04x\n", parent ); fprintf( stderr, "CreateWindowEx: bad parent %04x\n", cs->hwndParent );
return 0; return 0;
} }
} }
else if (style & WS_CHILD) else if (cs->style & WS_CHILD)
{ {
fprintf( stderr, "CreateWindowEx: no parent for child window\n" ); fprintf( stderr, "CreateWindowEx: no parent for child window\n" );
return 0; /* WS_CHILD needs a parent */ return 0; /* WS_CHILD needs a parent */
...@@ -469,7 +480,8 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -469,7 +480,8 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
/* Find the window class */ /* Find the window class */
if (!(classPtr = CLASS_FindClassByAtom( classAtom, GetExePtr(instance) ))) if (!(classPtr = CLASS_FindClassByAtom( classAtom,
GetExePtr(cs->hInstance) )))
{ {
char buffer[256]; char buffer[256];
GlobalGetAtomName32A( classAtom, buffer, sizeof(buffer) ); GlobalGetAtomName32A( classAtom, buffer, sizeof(buffer) );
...@@ -479,14 +491,14 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -479,14 +491,14 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
/* Fix the coordinates */ /* Fix the coordinates */
if (x == CW_USEDEFAULT16) x = y = 0; if (cs->x == CW_USEDEFAULT32) cs->x = cs->y = 0;
if (width == CW_USEDEFAULT16) if (cs->cx == CW_USEDEFAULT32)
{ {
/* if (!(style & (WS_CHILD | WS_POPUP))) width = height = 0; /* if (!(cs->style & (WS_CHILD | WS_POPUP))) cs->cx = cs->cy = 0;
else */ else */
{ {
width = 600; cs->cx = 600;
height = 400; cs->cy = 400;
} }
} }
...@@ -504,13 +516,16 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -504,13 +516,16 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd ); wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd );
wndPtr->next = NULL; wndPtr->next = NULL;
wndPtr->child = NULL; wndPtr->child = NULL;
wndPtr->parent = (style & WS_CHILD) ? WIN_FindWndPtr( parent ) : pWndDesktop; wndPtr->parent = (cs->style & WS_CHILD) ?
wndPtr->owner = (style & WS_CHILD) ? NULL : WIN_FindWndPtr(WIN_GetTopParent(parent)); WIN_FindWndPtr( cs->hwndParent ) : pWndDesktop;
wndPtr->owner = (cs->style & WS_CHILD) ? NULL :
WIN_FindWndPtr(WIN_GetTopParent(cs->hwndParent));
wndPtr->window = 0; wndPtr->window = 0;
wndPtr->class = classPtr; wndPtr->class = classPtr;
wndPtr->winproc = WINPROC_CopyWinProc( classPtr->winproc );
wndPtr->dwMagic = WND_MAGIC; wndPtr->dwMagic = WND_MAGIC;
wndPtr->hwndSelf = hwnd; wndPtr->hwndSelf = hwnd;
wndPtr->hInstance = instance; wndPtr->hInstance = cs->hInstance;
wndPtr->ptIconPos.x = -1; wndPtr->ptIconPos.x = -1;
wndPtr->ptIconPos.y = -1; wndPtr->ptIconPos.y = -1;
wndPtr->ptMaxPos.x = -1; wndPtr->ptMaxPos.x = -1;
...@@ -519,71 +534,66 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -519,71 +534,66 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
wndPtr->hmemTaskQ = GetTaskQueue(0); wndPtr->hmemTaskQ = GetTaskQueue(0);
wndPtr->hrgnUpdate = 0; wndPtr->hrgnUpdate = 0;
wndPtr->hwndLastActive = hwnd; wndPtr->hwndLastActive = hwnd;
wndPtr->lpfnWndProc = (WNDPROC16)0; wndPtr->dwStyle = cs->style & ~WS_VISIBLE;
wndPtr->dwStyle = style & ~WS_VISIBLE; wndPtr->dwExStyle = cs->dwExStyle;
wndPtr->dwExStyle = exStyle;
wndPtr->wIDmenu = 0; wndPtr->wIDmenu = 0;
wndPtr->flags = 0; wndPtr->flags = 0;
wndPtr->hVScroll = 0; wndPtr->hVScroll = 0;
wndPtr->hHScroll = 0; wndPtr->hHScroll = 0;
wndPtr->hSysMenu = MENU_GetDefSysMenu(); wndPtr->hSysMenu = MENU_GetDefSysMenu();
wndPtr->hProp = 0; wndPtr->hProp = 0;
wndPtr->userdata = 0;
if (classPtr->cbWndExtra) memset( wndPtr->wExtra, 0, classPtr->cbWndExtra); if (classPtr->cbWndExtra) memset( wndPtr->wExtra, 0, classPtr->cbWndExtra);
classPtr->cWindows++; classPtr->cWindows++;
/* Correct the window style */ /* Correct the window style */
if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ if (!(cs->style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
{ {
wndPtr->dwStyle |= WS_CAPTION | WS_CLIPSIBLINGS; wndPtr->dwStyle |= WS_CAPTION | WS_CLIPSIBLINGS;
wndPtr->flags |= WIN_NEED_SIZE; wndPtr->flags |= WIN_NEED_SIZE;
} }
if (exStyle & WS_EX_DLGMODALFRAME) wndPtr->dwStyle &= ~WS_THICKFRAME; if (cs->dwExStyle & WS_EX_DLGMODALFRAME) wndPtr->dwStyle &= ~WS_THICKFRAME;
/* Get class or window DC if needed */ /* Get class or window DC if needed */
if (classPtr->style & CS_OWNDC) wndPtr->hdce = DCE_AllocDCE(DCE_WINDOW_DC); if (classPtr->style & CS_OWNDC) wndPtr->hdce = DCE_AllocDCE(hwnd, DCE_WINDOW_DC);
else if (classPtr->style & CS_CLASSDC) wndPtr->hdce = classPtr->hdce; else if (classPtr->style & CS_CLASSDC) wndPtr->hdce = classPtr->hdce;
else wndPtr->hdce = 0; else wndPtr->hdce = 0;
/* Set the window procedure */
WIN_SetWndProc( wndPtr, classPtr->lpfnWndProc,
WINPROC_GetWinProcType(classPtr->lpfnWndProc) );
/* Insert the window in the linked list */ /* Insert the window in the linked list */
WIN_LinkWindow( hwnd, HWND_TOP ); WIN_LinkWindow( hwnd, HWND_TOP );
/* Send the WM_GETMINMAXINFO message and fix the size if needed */ /* Send the WM_GETMINMAXINFO message and fix the size if needed */
if ((style & WS_THICKFRAME) || !(style & (WS_POPUP | WS_CHILD))) if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
{ {
NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack ); NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
if (maxSize.x < width) width = maxSize.x; if (maxSize.x < cs->cx) cs->cx = maxSize.x;
if (maxSize.y < height) height = maxSize.y; if (maxSize.y < cs->cy) cs->cy = maxSize.y;
} }
if (width <= 0) width = 1; if (cs->cx <= 0) cs->cx = 1;
if (height <= 0) height = 1; if (cs->cy <= 0) cs->cy = 1;
wndPtr->rectWindow.left = x; wndPtr->rectWindow.left = cs->x;
wndPtr->rectWindow.top = y; wndPtr->rectWindow.top = cs->y;
wndPtr->rectWindow.right = x + width; wndPtr->rectWindow.right = cs->x + cs->cx;
wndPtr->rectWindow.bottom = y + height; wndPtr->rectWindow.bottom = cs->y + cs->cy;
wndPtr->rectClient = wndPtr->rectWindow; wndPtr->rectClient = wndPtr->rectWindow;
wndPtr->rectNormal = wndPtr->rectWindow; wndPtr->rectNormal = wndPtr->rectWindow;
/* Create the X window (only for top-level windows, and then only */ /* Create the X window (only for top-level windows, and then only */
/* when there's no desktop window) */ /* when there's no desktop window) */
if (!(style & WS_CHILD) && (rootWindow == DefaultRootWindow(display))) if (!(cs->style & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
{ {
XSetWindowAttributes win_attr; XSetWindowAttributes win_attr;
Atom XA_WM_DELETE_WINDOW; Atom XA_WM_DELETE_WINDOW;
if (Options.managed && ((style & (WS_DLGFRAME | WS_THICKFRAME)) || if (Options.managed && ((cs->style & (WS_DLGFRAME | WS_THICKFRAME)) ||
(exStyle & WS_EX_DLGMODALFRAME))) (cs->dwExStyle & WS_EX_DLGMODALFRAME)))
{ {
win_attr.event_mask = ExposureMask | KeyPressMask | win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask | KeyReleaseMask | PointerMotionMask |
...@@ -604,8 +614,8 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -604,8 +614,8 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful; win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0); win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = CURSORICON_XCursor; win_attr.cursor = CURSORICON_XCursor;
wndPtr->window = XCreateWindow( display, rootWindow, x, y, wndPtr->window = XCreateWindow( display, rootWindow, cs->x, cs->y,
width, height, 0, CopyFromParent, cs->cx, cs->cy, 0, CopyFromParent,
InputOutput, CopyFromParent, InputOutput, CopyFromParent,
CWEventMask | CWOverrideRedirect | CWEventMask | CWOverrideRedirect |
CWColormap | CWCursor | CWSaveUnder | CWColormap | CWCursor | CWSaveUnder |
...@@ -613,9 +623,9 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -613,9 +623,9 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW", XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW",
False ); False );
XSetWMProtocols( display, wndPtr->window, &XA_WM_DELETE_WINDOW, 1 ); XSetWMProtocols( display, wndPtr->window, &XA_WM_DELETE_WINDOW, 1 );
if (parent) /* Get window owner */ if (cs->hwndParent) /* Get window owner */
{ {
Window win = WIN_GetXWindow( parent ); Window win = WIN_GetXWindow( cs->hwndParent );
if (win) XSetTransientForHint( display, wndPtr->window, win ); if (win) XSetTransientForHint( display, wndPtr->window, win );
} }
EVENT_RegisterWindow( wndPtr->window, hwnd ); EVENT_RegisterWindow( wndPtr->window, hwnd );
...@@ -623,86 +633,107 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style, ...@@ -623,86 +633,107 @@ static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, DWORD style,
/* Set the window menu */ /* Set the window menu */
if ((style & WS_CAPTION) && !(style & WS_CHILD)) if ((cs->style & WS_CAPTION) && !(cs->style & WS_CHILD))
{ {
if (menu) SetMenu(hwnd, menu); if (cs->hMenu) SetMenu(hwnd, cs->hMenu);
else else
{ {
#if 0 /* FIXME: should check if classPtr->menuNameW can be used as is */ #if 0 /* FIXME: should check if classPtr->menuNameW can be used as is */
if (classPtr->menuNameA) if (classPtr->menuNameA)
menu = HIWORD(classPtr->menuNameA) ? cs->hMenu = HIWORD(classPtr->menuNameA) ?
LoadMenu( instance, SEGPTR_GET(classPtr->menuNameA) ) : LoadMenu(cs->hInstance,SEGPTR_GET(classPtr->menuNameA)):
LoadMenu( instance, (SEGPTR)classPtr->menuNameA ); LoadMenu(cs->hInstance,(SEGPTR)classPtr->menuNameA);
#else #else
SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME ); SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME );
if (menuName) menu = LoadMenu( instance, menuName ); if (menuName) cs->hMenu = LoadMenu( cs->hInstance, menuName );
#endif #endif
} }
if (menu) SetMenu( hwnd, menu ); if (cs->hMenu) SetMenu( hwnd, cs->hMenu );
} }
else wndPtr->wIDmenu = (UINT)menu; else wndPtr->wIDmenu = (UINT)cs->hMenu;
return hwnd; /* Send the WM_CREATE message */
}
if (unicode)
{
if (!SendMessage32W( hwnd, WM_NCCREATE, 0, (LPARAM)cs)) wmcreate = -1;
else
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = SendMessage32W( hwnd, WM_CREATE, 0, (LPARAM)cs );
}
}
else
{
if (!SendMessage32A( hwnd, WM_NCCREATE, 0, (LPARAM)cs)) wmcreate = -1;
else
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = SendMessage32A( hwnd, WM_CREATE, 0, (LPARAM)cs );
}
}
if (wmcreate == -1)
{
/* Abort window creation */
dprintf_win(stddeb,"CreateWindowEx: wmcreate==-1, aborting\n");
WIN_DestroyWindow( hwnd );
return 0;
}
/* Send the size messages */
/***********************************************************************
* WIN_FinalWindowInit
*/
static HWND WIN_FinalWindowInit( WND *wndPtr, DWORD style )
{
if (!(wndPtr->flags & WIN_NEED_SIZE)) if (!(wndPtr->flags & WIN_NEED_SIZE))
{ {
/* send it anyway */ /* send it anyway */
SendMessage16( wndPtr->hwndSelf, WM_SIZE, SIZE_RESTORED, SendMessage16( hwnd, WM_SIZE, SIZE_RESTORED,
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
wndPtr->rectClient.bottom-wndPtr->rectClient.top)); wndPtr->rectClient.bottom-wndPtr->rectClient.top));
SendMessage16( wndPtr->hwndSelf, WM_MOVE, 0, SendMessage16( hwnd, WM_MOVE, 0, MAKELONG( wndPtr->rectClient.left,
MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) ); wndPtr->rectClient.top ));
} }
WIN_SendParentNotify( wndPtr->hwndSelf, WM_CREATE, wndPtr->wIDmenu, WIN_SendParentNotify( hwnd, WM_CREATE, wndPtr->wIDmenu, (LONG)hwnd );
(LONG)wndPtr->hwndSelf ); if (!IsWindow(hwnd)) return 0;
if (!IsWindow(wndPtr->hwndSelf)) return 0;
/* Show the window, maximizing or minimizing if needed */ /* Show the window, maximizing or minimizing if needed */
if (wndPtr->dwStyle & WS_MINIMIZE) if (wndPtr->dwStyle & WS_MINIMIZE)
{ {
wndPtr->dwStyle &= ~WS_MAXIMIZE; wndPtr->dwStyle &= ~WS_MAXIMIZE;
WINPOS_FindIconPos( wndPtr->hwndSelf ); WINPOS_FindIconPos( hwnd );
SetWindowPos(wndPtr->hwndSelf, 0, wndPtr->ptIconPos.x, SetWindowPos( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
wndPtr->ptIconPos.y, SYSMETRICS_CXICON, SYSMETRICS_CYICON, SYSMETRICS_CXICON, SYSMETRICS_CYICON, SWP_FRAMECHANGED |
SWP_FRAMECHANGED | (cs->style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
(style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
} }
else if (wndPtr->dwStyle & WS_MAXIMIZE) else if (wndPtr->dwStyle & WS_MAXIMIZE)
{ {
POINT16 maxSize, maxPos, minTrack, maxTrack; POINT16 maxSize, maxPos, minTrack, maxTrack;
NC_GetMinMaxInfo( wndPtr->hwndSelf, &maxSize, &maxPos, NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
&minTrack, &maxTrack ); SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
SetWindowPos( wndPtr->hwndSelf, 0, maxPos.x, maxPos.y, maxSize.x, SWP_FRAMECHANGED | (cs->style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
maxSize.y, SWP_FRAMECHANGED |
(style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
} }
else if (style & WS_VISIBLE) ShowWindow( wndPtr->hwndSelf, SW_SHOW ); else if (cs->style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
/* Call WH_SHELL hook */ /* Call WH_SHELL hook */
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWCREATED, wndPtr->hwndSelf, 0 ); HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
return wndPtr->hwndSelf; dprintf_win(stddeb, "CreateWindowEx: returning %04x\n", hwnd);
return hwnd;
} }
/*********************************************************************** /***********************************************************************
* CreateWindow16 (USER.41) * CreateWindow16 (USER.41)
*/ */
HWND16 CreateWindow16( SEGPTR className, SEGPTR windowName, HWND16 CreateWindow16( LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width, DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu, INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, SEGPTR data ) HINSTANCE16 instance, LPVOID data )
{ {
return CreateWindowEx16( 0, className, windowName, style, return CreateWindowEx16( 0, className, windowName, style,
x, y, width, height, parent, menu, instance, data ); x, y, width, height, parent, menu, instance, data );
...@@ -712,113 +743,42 @@ HWND16 CreateWindow16( SEGPTR className, SEGPTR windowName, ...@@ -712,113 +743,42 @@ HWND16 CreateWindow16( SEGPTR className, SEGPTR windowName,
/*********************************************************************** /***********************************************************************
* CreateWindowEx16 (USER.452) * CreateWindowEx16 (USER.452)
*/ */
HWND16 CreateWindowEx16( DWORD exStyle, SEGPTR className, SEGPTR windowName, HWND16 CreateWindowEx16( DWORD exStyle, LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width, DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu, INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, SEGPTR data ) HINSTANCE16 instance, LPVOID data )
{ {
ATOM classAtom; ATOM classAtom;
HWND16 hwnd; CREATESTRUCT32A cs;
WND *wndPtr;
LRESULT wmcreate;
dprintf_win( stddeb, "CreateWindowEx: " );
if (HIWORD(windowName))
dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(windowName) );
else
dprintf_win( stddeb, "%04x ", LOWORD(windowName) );
if (HIWORD(className))
dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(className) );
else
dprintf_win( stddeb, "%04x ", LOWORD(className) );
dprintf_win(stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %08lx\n",
exStyle, style, x, y, width, height,
parent, menu, instance, (DWORD)data);
/* Find the class atom */ /* Find the class atom */
if (!(classAtom = GlobalFindAtom16( className ))) if (!(classAtom = GlobalFindAtom32A( className )))
{ {
fprintf( stderr, "CreateWindowEx16: bad class name " ); fprintf( stderr, "CreateWindowEx16: bad class name " );
if (!HIWORD(className)) fprintf( stderr, "%04x\n", LOWORD(className) ); if (!HIWORD(className)) fprintf( stderr, "%04x\n", LOWORD(className) );
else fprintf( stderr, "'%s'\n", (char *)PTR_SEG_TO_LIN(className) ); else fprintf( stderr, "'%s'\n", className );
return 0; return 0;
} }
hwnd = WIN_CreateWindowEx( exStyle, classAtom, style, x, y, width, height, /* Fix the coordinates */
parent, menu, instance );
if (!hwnd) return 0;
wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd );
/* Send the WM_CREATE message */
#ifndef WINELIB cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT32 : (INT32)x;
if (WINPROC_GetWinProcType( wndPtr->lpfnWndProc ) == WIN_PROC_16) cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT32 : (INT32)y;
{ cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT32 : (INT32)width;
/* Build the CREATESTRUCT on the 16-bit stack. */ cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT32 : (INT32)height;
/* This is really ugly, but some programs (notably the */
/* "Undocumented Windows" examples) want it that way. */
if (!CallWndProcNCCREATE16( wndPtr->lpfnWndProc, wndPtr->hInstance,
wndPtr->dwExStyle, className, windowName, wndPtr->dwStyle,
wndPtr->rectWindow.left, wndPtr->rectWindow.top,
wndPtr->rectWindow.right - wndPtr->rectWindow.left,
wndPtr->rectWindow.bottom - wndPtr->rectWindow.top,
parent, menu, wndPtr->hInstance, data, hwnd, WM_NCCREATE, 0,
MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16),
IF1632_Saved16_ss ) ))
wmcreate = -1;
else
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = CallWndProcNCCREATE16( wndPtr->lpfnWndProc,
wndPtr->hInstance, wndPtr->dwExStyle, className,
windowName, wndPtr->dwStyle,
wndPtr->rectWindow.left, wndPtr->rectWindow.top,
wndPtr->rectWindow.right - wndPtr->rectWindow.left,
wndPtr->rectWindow.bottom - wndPtr->rectWindow.top,
parent, menu, wndPtr->hInstance, data, hwnd, WM_CREATE, 0,
MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16),
IF1632_Saved16_ss ) );
}
}
else /* We have a 32-bit window procedure */
#endif /* WINELIB */
{
CREATESTRUCT32A cs;
cs.lpCreateParams = (LPVOID)data;
cs.hInstance = wndPtr->hInstance;
cs.hMenu = wndPtr->wIDmenu;
cs.hwndParent = parent;
cs.cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
cs.cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
cs.x = wndPtr->rectWindow.left;
cs.y = wndPtr->rectWindow.top;
cs.style = wndPtr->dwStyle | (style & WS_VISIBLE);
cs.lpszName = PTR_SEG_TO_LIN(windowName);
cs.lpszClass = PTR_SEG_TO_LIN(className);
cs.dwExStyle = wndPtr->dwExStyle;
if (!SendMessage32A( hwnd, WM_NCCREATE, 0, (LPARAM)&cs)) wmcreate = -1;
else
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = SendMessage32A( hwnd, WM_CREATE, 0, (LPARAM)&cs );
}
}
if (wmcreate == -1) /* Create the window */
{
/* Abort window creation */
dprintf_win(stddeb,"CreateWindowEx: wmcreate==-1, aborting\n");
WIN_DestroyWindow( hwnd );
return 0;
}
dprintf_win(stddeb, "CreateWindowEx16: return %04x\n", hwnd); cs.lpCreateParams = data;
return WIN_FinalWindowInit( wndPtr, style ); cs.hInstance = (HINSTANCE32)instance;
cs.hMenu = (HMENU32)menu;
cs.hwndParent = (HWND32)parent;
cs.style = style;
cs.lpszName = windowName;
cs.lpszClass = className;
cs.dwExStyle = exStyle;
return WIN_CreateWindowEx( &cs, classAtom, FALSE );
} }
...@@ -831,9 +791,6 @@ HWND32 CreateWindowEx32A( DWORD exStyle, LPCSTR className, LPCSTR windowName, ...@@ -831,9 +791,6 @@ HWND32 CreateWindowEx32A( DWORD exStyle, LPCSTR className, LPCSTR windowName,
HINSTANCE32 instance, LPVOID data ) HINSTANCE32 instance, LPVOID data )
{ {
ATOM classAtom; ATOM classAtom;
HWND16 hwnd;
WND *wndPtr;
LRESULT wmcreate;
CREATESTRUCT32A cs; CREATESTRUCT32A cs;
/* Find the class atom */ /* Find the class atom */
...@@ -846,51 +803,21 @@ HWND32 CreateWindowEx32A( DWORD exStyle, LPCSTR className, LPCSTR windowName, ...@@ -846,51 +803,21 @@ HWND32 CreateWindowEx32A( DWORD exStyle, LPCSTR className, LPCSTR windowName,
return 0; return 0;
} }
/* Fix the coordinates */ /* Create the window */
if (x == CW_USEDEFAULT32) x = y = (UINT32)CW_USEDEFAULT16;
if (width == CW_USEDEFAULT32) width = height = (UINT32)CW_USEDEFAULT16;
/* Create the window structure */
hwnd = WIN_CreateWindowEx( exStyle, classAtom, style, x, y, width, height,
parent, menu, instance );
if (!hwnd) return 0;
wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd );
/* Send the WM_CREATE message */
cs.lpCreateParams = data; cs.lpCreateParams = data;
cs.hInstance = wndPtr->hInstance; cs.hInstance = instance;
cs.hMenu = wndPtr->wIDmenu; cs.hMenu = menu;
cs.hwndParent = parent; cs.hwndParent = parent;
cs.cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left; cs.x = x;
cs.cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; cs.y = y;
cs.x = wndPtr->rectWindow.left; cs.cx = width;
cs.y = wndPtr->rectWindow.top; cs.cy = height;
cs.style = wndPtr->dwStyle | (style & WS_VISIBLE); cs.style = style;
cs.lpszName = windowName; cs.lpszName = windowName;
cs.lpszClass = className; cs.lpszClass = className;
cs.dwExStyle = wndPtr->dwExStyle; cs.dwExStyle = exStyle;
return WIN_CreateWindowEx( &cs, classAtom, FALSE );
if (!SendMessage32A( hwnd, WM_NCCREATE, 0, (LPARAM)&cs )) wmcreate = -1;
else
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = SendMessage32A( hwnd, WM_CREATE, 0, (LPARAM)&cs );
}
if (wmcreate == -1)
{
/* Abort window creation */
dprintf_win(stddeb,"CreateWindowEx32A: wmcreate==-1, aborting\n");
WIN_DestroyWindow( hwnd );
return 0;
}
dprintf_win(stddeb, "CreateWindowEx32A: return %04x\n", hwnd);
return WIN_FinalWindowInit( wndPtr, style );
} }
...@@ -903,9 +830,6 @@ HWND32 CreateWindowEx32W( DWORD exStyle, LPCWSTR className, LPCWSTR windowName, ...@@ -903,9 +830,6 @@ HWND32 CreateWindowEx32W( DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
HINSTANCE32 instance, LPVOID data ) HINSTANCE32 instance, LPVOID data )
{ {
ATOM classAtom; ATOM classAtom;
HWND16 hwnd;
WND *wndPtr;
LRESULT wmcreate;
CREATESTRUCT32W cs; CREATESTRUCT32W cs;
/* Find the class atom */ /* Find the class atom */
...@@ -916,51 +840,23 @@ HWND32 CreateWindowEx32W( DWORD exStyle, LPCWSTR className, LPCWSTR windowName, ...@@ -916,51 +840,23 @@ HWND32 CreateWindowEx32W( DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
return 0; return 0;
} }
/* Fix the coordinates */ /* Create the window */
if (x == CW_USEDEFAULT32) x = y = (UINT32)CW_USEDEFAULT16;
if (width == CW_USEDEFAULT32) width = height = (UINT32)CW_USEDEFAULT16;
/* Create the window structure */
hwnd = WIN_CreateWindowEx( exStyle, classAtom, style, x, y, width, height,
parent, menu, instance );
if (!hwnd) return 0;
wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd );
/* Send the WM_CREATE message */
cs.lpCreateParams = data; cs.lpCreateParams = data;
cs.hInstance = wndPtr->hInstance; cs.hInstance = instance;
cs.hMenu = wndPtr->wIDmenu; cs.hMenu = menu;
cs.hwndParent = parent; cs.hwndParent = parent;
cs.cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left; cs.x = x;
cs.cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; cs.y = y;
cs.x = wndPtr->rectWindow.left; cs.cx = width;
cs.y = wndPtr->rectWindow.top; cs.cy = height;
cs.style = wndPtr->dwStyle | (style & WS_VISIBLE); cs.style = style;
cs.lpszName = windowName; cs.lpszName = windowName;
cs.lpszClass = className; cs.lpszClass = className;
cs.dwExStyle = wndPtr->dwExStyle; cs.dwExStyle = exStyle;
/* Note: we rely on the fact that CREATESTRUCT32A and */
if (!SendMessage32W( hwnd, WM_NCCREATE, 0, (LPARAM)&cs )) wmcreate = -1; /* CREATESTRUCT32W have the same layout. */
else return WIN_CreateWindowEx( (CREATESTRUCT32A *)&cs, classAtom, TRUE );
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
wmcreate = SendMessage32W( hwnd, WM_CREATE, 0, (LPARAM)&cs );
}
if (wmcreate == -1)
{
/* Abort window creation */
dprintf_win(stddeb,"CreateWindowEx32W: wmcreate==-1, aborting\n");
WIN_DestroyWindow( hwnd );
return 0;
}
dprintf_win(stddeb, "CreateWindowEx32W: return %04x\n", hwnd);
return WIN_FinalWindowInit( wndPtr, style );
} }
...@@ -975,8 +871,8 @@ BOOL DestroyWindow( HWND hwnd ) ...@@ -975,8 +871,8 @@ BOOL DestroyWindow( HWND hwnd )
/* Initialization */ /* Initialization */
if (hwnd == pWndDesktop->hwndSelf) return FALSE; /* Can't destroy desktop*/
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
if (wndPtr == pWndDesktop) return FALSE; /* Can't destroy desktop */
/* Top-level window */ /* Top-level window */
...@@ -1010,6 +906,8 @@ BOOL DestroyWindow( HWND hwnd ) ...@@ -1010,6 +906,8 @@ BOOL DestroyWindow( HWND hwnd )
else break; else break;
} }
CLIPBOARD_DisOwn( hwnd );
/* Send destroy messages and destroy children */ /* Send destroy messages and destroy children */
SendMessage16( hwnd, WM_DESTROY, 0, 0 ); SendMessage16( hwnd, WM_DESTROY, 0, 0 );
...@@ -1252,7 +1150,7 @@ BOOL IsWindowUnicode( HWND hwnd ) ...@@ -1252,7 +1150,7 @@ BOOL IsWindowUnicode( HWND hwnd )
WND * wndPtr; WND * wndPtr;
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return FALSE; if (!(wndPtr = WIN_FindWndPtr(hwnd))) return FALSE;
return (WINPROC_GetWinProcType( wndPtr->lpfnWndProc ) == WIN_PROC_32W); return (WINPROC_GetWinProcType( wndPtr->winproc ) == WIN_PROC_32W);
} }
...@@ -1311,44 +1209,64 @@ WORD SetWindowWord( HWND32 hwnd, INT32 offset, WORD newval ) ...@@ -1311,44 +1209,64 @@ WORD SetWindowWord( HWND32 hwnd, INT32 offset, WORD newval )
/********************************************************************** /**********************************************************************
* GetWindowLong (USER.135) * GetWindowLong16 (USER.135)
*/
LONG GetWindowLong16( HWND16 hwnd, INT16 offset )
{
LONG ret = GetWindowLong32A( (HWND32)hwnd, offset );
if (offset == GWL_WNDPROC) return (LONG)WINPROC_GetFunc16( (HANDLE32)ret );
return ret;
}
/**********************************************************************
* GetWindowLong32A (USER32.304)
*/ */
LONG GetWindowLong( HWND32 hwnd, INT32 offset ) LONG GetWindowLong32A( HWND32 hwnd, INT32 offset )
{ {
WND * wndPtr = WIN_FindWndPtr( hwnd ); WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0; if (!wndPtr) return 0;
if (offset >= 0) return *(LONG *)(((char *)wndPtr->wExtra) + offset); if (offset >= 0) return *(LONG *)(((char *)wndPtr->wExtra) + offset);
switch(offset) switch(offset)
{ {
case GWL_USERDATA: return 0; case GWL_USERDATA: return wndPtr->userdata;
case GWL_STYLE: return wndPtr->dwStyle; case GWL_STYLE: return wndPtr->dwStyle;
case GWL_EXSTYLE: return wndPtr->dwExStyle; case GWL_EXSTYLE: return wndPtr->dwExStyle;
case GWL_ID: return wndPtr->wIDmenu; case GWL_ID: return wndPtr->wIDmenu;
case GWL_WNDPROC: return (LONG)wndPtr->lpfnWndProc; case GWL_WNDPROC: return (LONG)WINPROC_GetFunc32( wndPtr->winproc );
case GWL_HWNDPARENT: return wndPtr->parent ? case GWL_HWNDPARENT: return wndPtr->parent ?
(HWND32)wndPtr->parent->hwndSelf : 0; (HWND32)wndPtr->parent->hwndSelf : 0;
case GWL_HINSTANCE: return (HINSTANCE32)wndPtr->hInstance; case GWL_HINSTANCE: return (HINSTANCE32)wndPtr->hInstance;
default: default:
fprintf( stderr, "GetWindowLong: unknown offset %d\n", offset ); fprintf( stderr, "GetWindowLong32A: unknown offset %d\n", offset );
} }
return 0; return 0;
} }
/********************************************************************** /**********************************************************************
* GetWindowLong32W (USER32.305)
*/
LONG GetWindowLong32W( HWND32 hwnd, INT32 offset )
{
return GetWindowLong32A( hwnd, offset );
}
/**********************************************************************
* SetWindowLong16 (USER.136) * SetWindowLong16 (USER.136)
*/ */
LONG SetWindowLong16( HWND16 hwnd, INT16 offset, LONG newval ) LONG SetWindowLong16( HWND16 hwnd, INT16 offset, LONG newval )
{ {
WND *wndPtr; if (offset == GWL_WNDPROC)
switch(offset)
{ {
case GWL_WNDPROC: HANDLE32 ret;
wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
return (LONG)WIN_SetWndProc( wndPtr, (WNDPROC16)newval, WIN_PROC_16 ); if (!wndPtr) return 0;
default: ret = WIN_SetWndProc( wndPtr, (HANDLE32)newval, WIN_PROC_16 );
return SetWindowLong32A( hwnd, offset, newval ); return (LONG)WINPROC_GetFunc16( ret );
} }
return SetWindowLong32A( hwnd, offset, newval );
} }
...@@ -1367,9 +1285,10 @@ LONG SetWindowLong32A( HWND32 hwnd, INT32 offset, LONG newval ) ...@@ -1367,9 +1285,10 @@ LONG SetWindowLong32A( HWND32 hwnd, INT32 offset, LONG newval )
case GWL_HINSTANCE: case GWL_HINSTANCE:
return SetWindowWord( hwnd, offset, (WORD)newval ); return SetWindowWord( hwnd, offset, (WORD)newval );
case GWL_WNDPROC: case GWL_WNDPROC:
return (LONG)WIN_SetWndProc( wndPtr, (WNDPROC16)newval, return (LONG)WINPROC_GetFunc32( WIN_SetWndProc( wndPtr,
WIN_PROC_32A ); (HANDLE32)newval,
case GWL_USERDATA: return 0; WIN_PROC_32A ));
case GWL_USERDATA: ptr = &wndPtr->userdata; break;
case GWL_STYLE: ptr = &wndPtr->dwStyle; break; case GWL_STYLE: ptr = &wndPtr->dwStyle; break;
case GWL_EXSTYLE: ptr = &wndPtr->dwExStyle; break; case GWL_EXSTYLE: ptr = &wndPtr->dwExStyle; break;
default: default:
...@@ -1387,15 +1306,15 @@ LONG SetWindowLong32A( HWND32 hwnd, INT32 offset, LONG newval ) ...@@ -1387,15 +1306,15 @@ LONG SetWindowLong32A( HWND32 hwnd, INT32 offset, LONG newval )
*/ */
LONG SetWindowLong32W( HWND32 hwnd, INT32 offset, LONG newval ) LONG SetWindowLong32W( HWND32 hwnd, INT32 offset, LONG newval )
{ {
WND *wndPtr; if (offset == GCL_WNDPROC)
switch(offset)
{ {
case GWL_WNDPROC: WND *wndPtr = WIN_FindWndPtr( hwnd );
wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return 0;
return (LONG)WIN_SetWndProc( wndPtr, (WNDPROC16)newval, WIN_PROC_32W ); return (LONG)WINPROC_GetFunc32( WIN_SetWndProc( wndPtr,
default: (HANDLE32)newval,
return SetWindowLong32A( hwnd, offset, newval ); WIN_PROC_32W ));
} }
return SetWindowLong32A( hwnd, offset, newval );
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "queue.h" #include "queue.h"
#include "stackframe.h" #include "stackframe.h"
#include "winpos.h" #include "winpos.h"
#include "dce.h"
#include "nonclient.h" #include "nonclient.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_WIN */ /* #define DEBUG_WIN */
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
extern void FOCUS_SwitchFocus( HWND , HWND ); extern void FOCUS_SwitchFocus( HWND , HWND );
extern HRGN DCE_GetVisRgn( HWND, WORD ); extern HRGN DCE_GetVisRgn( HWND, WORD );
extern HWND CARET_GetHwnd(); extern HWND CARET_GetHwnd();
extern BOOL DCE_InvalidateDCE(WND*, RECT16* );
/* ----- internal variables ----- */ /* ----- internal variables ----- */
...@@ -1346,10 +1348,10 @@ static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT16 lpOldWndRect ...@@ -1346,10 +1348,10 @@ static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT16 lpOldWndRect
OffsetRgn( newVisRgn, Wnd->rectClient.left, Wnd->rectClient.top); OffsetRgn( newVisRgn, Wnd->rectClient.left, Wnd->rectClient.top);
CombineRgn( oldVisRgn, oldVisRgn, newVisRgn, RGN_OR ); CombineRgn( oldVisRgn, oldVisRgn, newVisRgn, RGN_OR );
hDC = GetDCEx( Wnd->parent->hwndSelf, oldVisRgn, DCX_INTERSECTRGN | DCX_CACHE | DCX_CLIPSIBLINGS); hDC = GetDCEx( Wnd->parent->hwndSelf, oldVisRgn, DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_CACHE | DCX_CLIPSIBLINGS);
BitBlt(hDC, xto, yto, lpOldClientRect->right - lpOldClientRect->left + 1, BitBlt(hDC, xto, yto, lpOldClientRect->right - lpOldClientRect->left,
lpOldClientRect->bottom - lpOldClientRect->top + 1, lpOldClientRect->bottom - lpOldClientRect->top,
hDC, xfrom, yfrom, SRCCOPY ); hDC, xfrom, yfrom, SRCCOPY );
ReleaseDC( Wnd->parent->hwndSelf, hDC); ReleaseDC( Wnd->parent->hwndSelf, hDC);
...@@ -1563,6 +1565,18 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, ...@@ -1563,6 +1565,18 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
newClientRect.top != wndPtr->rectClient.top) ) newClientRect.top != wndPtr->rectClient.top) )
winpos.flags &= ~SWP_NOCLIENTMOVE; winpos.flags &= ~SWP_NOCLIENTMOVE;
/* Update active DCEs */
if( !(flags & SWP_NOZORDER) || (flags & SWP_HIDEWINDOW) || (flags & SWP_SHOWWINDOW)
|| (memcmp(&newWindowRect,&wndPtr->rectWindow,sizeof(RECT16))
&& wndPtr->dwStyle & WS_VISIBLE ) )
{
RECT16 rect;
UnionRect16(&rect,&newWindowRect,&wndPtr->rectWindow);
DCE_InvalidateDCE(wndPtr->parent, &rect);
}
/* Perform the moving and resizing */ /* Perform the moving and resizing */
if (wndPtr->window) if (wndPtr->window)
...@@ -1628,12 +1642,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, ...@@ -1628,12 +1642,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
(result >= WVR_HREDRAW && result < WVR_VALIDRECTS); (result >= WVR_HREDRAW && result < WVR_VALIDRECTS);
if( (winpos.flags & SWP_NOPOSCHANGE) != SWP_NOPOSCHANGE ) if( (winpos.flags & SWP_NOPOSCHANGE) != SWP_NOPOSCHANGE )
{
/* optimize cleanup by BitBlt'ing where possible */ /* optimize cleanup by BitBlt'ing where possible */
WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect, &oldClientRect, bNoCopy); WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect, &oldClientRect, bNoCopy);
DeleteObject(visRgn);
}
else else
if( winpos.flags & SWP_FRAMECHANGED ) if( winpos.flags & SWP_FRAMECHANGED )
RedrawWindow32( winpos.hwnd, NULL, 0, RDW_NOCHILDREN | RDW_FRAME ); RedrawWindow32( winpos.hwnd, NULL, 0, RDW_NOCHILDREN | RDW_FRAME );
......
...@@ -19,88 +19,96 @@ ...@@ -19,88 +19,96 @@
typedef struct typedef struct
{ {
WNDPROC32 func; /* 32-bit function, or 0 if free */ UINT32 magic; /* Magic number */
unsigned int count : 30; /* Reference count, or next free if func==0 */ WINDOWPROCTYPE type; /* Function type */
WINDOWPROCTYPE type : 2; /* Function type */ UINT32 count; /* Reference count */
UINT32 func; /* 16- or 32-bit function */
} WINDOWPROC; } WINDOWPROC;
#define NB_WINPROCS 1024 /* Must be < 64K; 1024 should be enough for now */ #define WINPROC_MAGIC ('W' | ('P' << 8) | ('R' << 16) | ('C' << 24))
static WINDOWPROC winProcs[NB_WINPROCS];
static int lastWinProc = 0;
static int freeWinProc = NB_WINPROCS;
/* Check if a win proc was created by WINPROC_AllocWinProc */ static HANDLE32 WinProcHeap = 0;
#define IS_ALLOCATED_WINPROC(func) (HIWORD(func) == 0xffff)
/********************************************************************** /**********************************************************************
* WINPROC_AllocWinProc * WINPROC_GetPtr
* *
* Allocate a new window procedure. * Return a pointer to the win proc.
*/ */
WNDPROC16 WINPROC_AllocWinProc( WNDPROC32 func, WINDOWPROCTYPE type ) static WINDOWPROC *WINPROC_GetPtr( HANDLE32 handle )
{ {
WINDOWPROC *proc; WINDOWPROC *proc;
if (!func) return (WNDPROC16)0; /* Null win proc remains null */
if (IS_ALLOCATED_WINPROC(func)) /* Already allocated? */ /* Check for a linear pointer */
{
if (LOWORD(func) >= NB_WINPROCS) return (WNDPROC16)0; if (HEAP_IsInsideHeap( WinProcHeap, 0, (LPVOID)handle ))
proc = &winProcs[LOWORD(func)];
if (!proc->func) return (WNDPROC16)0;
proc->count++;
return (WNDPROC16)func;
}
if (freeWinProc < NB_WINPROCS) /* There is a free entry */
{ {
proc = &winProcs[freeWinProc]; proc = (WINDOWPROC *)handle;
proc->func = func; if (proc->magic == WINPROC_MAGIC) return proc;
func = (WNDPROC32)MAKELONG( freeWinProc, 0xffff );
freeWinProc = proc->count; /* Next free entry */
proc->count = 1;
proc->type = type;
return (WNDPROC16)func;
} }
if (lastWinProc < NB_WINPROCS) /* There's a free entry at the end */
/* Check for a segmented pointer */
if (!IsBadReadPtr( (SEGPTR)handle, sizeof(WINDOWPROC) ))
{ {
proc = &winProcs[lastWinProc]; proc = (WINDOWPROC *)PTR_SEG_TO_LIN(handle);
proc->func = func; if (proc->magic == WINPROC_MAGIC) return proc;
func = (WNDPROC32)MAKELONG( lastWinProc, 0xffff );
lastWinProc++;
proc->count = 1;
proc->type = type;
return (WNDPROC16)func;
} }
fprintf( stderr, "WINPROC_AllocWinProc: out of window procedures.\n"
"Please augment NB_WINPROCS in winproc.c\n" ); return NULL;
return (WNDPROC16)0;
} }
/********************************************************************** /**********************************************************************
* WINPROC_GetWinProcType * WINPROC_AllocWinProc
* *
* Return the type of a window procedure. * Allocate a new window procedure.
*/ */
WINDOWPROCTYPE WINPROC_GetWinProcType( WNDPROC16 func ) HANDLE32 WINPROC_AllocWinProc( UINT32 func, WINDOWPROCTYPE type )
{ {
WORD id = LOWORD(func); WINDOWPROC *proc;
if (!IS_ALLOCATED_WINPROC(func)) return WIN_PROC_16;
if ((id >= NB_WINPROCS) || !winProcs[id].func) return WIN_PROC_INVALID; /* Create the heap if necessary */
return winProcs[id].type;
if (!WinProcHeap)
{
if (!(WinProcHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return 0;
}
/* Check if function is already a win proc */
if ((proc = WINPROC_GetPtr( (HANDLE32)func )))
{
proc->count++;
return (HANDLE32)func;
}
/* Now allocate a new one */
if (!(proc = HeapAlloc( WinProcHeap, 0, sizeof(WINDOWPROC) ))) return 0;
proc->magic = WINPROC_MAGIC;
proc->type = type;
proc->count = 1;
proc->func = func;
return (HANDLE32)proc;
} }
/********************************************************************** /**********************************************************************
* WINPROC_GetWinProcFunc * WINPROC_CopyWinProc
* *
* Return the 32-bit window procedure for a winproc. * Copy a window procedure.
*/ */
WNDPROC32 WINPROC_GetWinProcFunc( WNDPROC16 func ) HANDLE32 WINPROC_CopyWinProc( HANDLE32 handle )
{ {
WORD id = LOWORD(func); WINDOWPROC *proc;
if (!IS_ALLOCATED_WINPROC(func)) return NULL; if ((proc = WINPROC_GetPtr( (HANDLE32)handle )))
if (id >= NB_WINPROCS) return NULL; {
return winProcs[id].func; proc->count++;
return handle;
}
return (HANDLE32)0;
} }
...@@ -109,26 +117,63 @@ WNDPROC32 WINPROC_GetWinProcFunc( WNDPROC16 func ) ...@@ -109,26 +117,63 @@ WNDPROC32 WINPROC_GetWinProcFunc( WNDPROC16 func )
* *
* Free a window procedure. * Free a window procedure.
*/ */
void WINPROC_FreeWinProc( WNDPROC16 func ) void WINPROC_FreeWinProc( HANDLE32 handle )
{ {
WORD id = LOWORD(func); WINDOWPROC *proc;
if (!IS_ALLOCATED_WINPROC(func)) return;
if ((id >= NB_WINPROCS) || !winProcs[id].func) if (!(proc = WINPROC_GetPtr( handle )))
{ {
fprintf( stderr, "WINPROC_FreeWinProc: invalid proc %08x\n", fprintf( stderr, "WINPROC_FreeWinProc: invalid proc %08x\n", handle );
(UINT32)func );
return; return;
} }
if (--winProcs[id].count == 0) if (--proc->count == 0)
{ {
winProcs[id].func = 0; proc->magic = 0; /* Just in case */
winProcs[id].count = freeWinProc; HeapFree( WinProcHeap, 0, proc );
freeWinProc = id;
} }
} }
/********************************************************************** /**********************************************************************
* WINPROC_GetWinProcType
*
* Return the window procedure type.
*/
WINDOWPROCTYPE WINPROC_GetWinProcType( HANDLE32 handle )
{
WINDOWPROC *proc = WINPROC_GetPtr( handle );
if (!proc) return WIN_PROC_INVALID;
return proc->type;
}
/**********************************************************************
* WINPROC_GetFunc16
*
* Return the 16-bit function pointer, or NULL if none.
*/
WNDPROC16 WINPROC_GetFunc16( HANDLE32 handle )
{
WINDOWPROC *proc = WINPROC_GetPtr( handle );
if (!proc) return (WNDPROC16)0;
return (WNDPROC16)HEAP_GetSegptr( WinProcHeap, 0, proc );
}
/**********************************************************************
* WINPROC_GetFunc32
*
* Return the 32-bit function pointer, or NULL if none.
*/
WNDPROC32 WINPROC_GetFunc32( HANDLE32 handle )
{
WINDOWPROC *proc = WINPROC_GetPtr( handle );
if (!proc) return (WNDPROC32)0;
return (WNDPROC32)proc;
}
/**********************************************************************
* WINPROC_CallProc32ATo32W * WINPROC_CallProc32ATo32W
* *
* Call a window procedure, translating args from Ansi to Unicode. * Call a window procedure, translating args from Ansi to Unicode.
...@@ -148,8 +193,8 @@ static LRESULT WINPROC_CallProc32ATo32W( WNDPROC32 func, HWND32 hwnd, ...@@ -148,8 +193,8 @@ static LRESULT WINPROC_CallProc32ATo32W( WNDPROC32 func, HWND32 hwnd,
result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)str ); result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)str );
STRING32_UniToAnsi( (LPSTR)lParam, str ); STRING32_UniToAnsi( (LPSTR)lParam, str );
HeapFree( SystemHeap, 0, str ); HeapFree( SystemHeap, 0, str );
return strlen( (LPSTR)lParam ) + 1;
} }
return result; /* FIXME? */
case WM_SETTEXT: case WM_SETTEXT:
{ {
...@@ -198,8 +243,8 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC32 func, HWND32 hwnd, ...@@ -198,8 +243,8 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC32 func, HWND32 hwnd,
result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)str ); result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)str );
STRING32_AnsiToUni( (LPWSTR)lParam, str ); STRING32_AnsiToUni( (LPWSTR)lParam, str );
HeapFree( SystemHeap, 0, str ); HeapFree( SystemHeap, 0, str );
return STRING32_lstrlenW( (LPWSTR)lParam ) + 1; /* FIXME? */
} }
return result; /* FIXME? */
case WM_SETTEXT: case WM_SETTEXT:
{ {
...@@ -214,11 +259,13 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC32 func, HWND32 hwnd, ...@@ -214,11 +259,13 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC32 func, HWND32 hwnd,
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT32A cs = *(CREATESTRUCT32A *)lParam; CREATESTRUCT32A cs = *(CREATESTRUCT32A *)lParam;
if (HIWORD(cs.lpszName))
cs.lpszName = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName ); cs.lpszName = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName );
if (HIWORD(cs.lpszClass))
cs.lpszClass = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName ); cs.lpszClass = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName );
result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&cs ); result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&cs );
free( (LPVOID)cs.lpszName ); if (HIWORD(cs.lpszName)) free( (LPVOID)cs.lpszName );
free( (LPVOID)cs.lpszClass ); if (HIWORD(cs.lpszClass)) free( (LPVOID)cs.lpszClass );
} }
return result; return result;
...@@ -563,13 +610,21 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, WORD ds, HWND32 hwnd, ...@@ -563,13 +610,21 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, WORD ds, HWND32 hwnd,
cls = SEGPTR_STRDUP( cs32->lpszClass ); cls = SEGPTR_STRDUP( cs32->lpszClass );
cs->lpszName = SEGPTR_GET(name); cs->lpszName = SEGPTR_GET(name);
cs->lpszClass = SEGPTR_GET(cls); cs->lpszClass = SEGPTR_GET(cls);
#ifdef WINELIB
result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam,
(LPARAM)SEGPTR_GET(cs) ); (LPARAM)SEGPTR_GET(cs) );
STRUCT32_CREATESTRUCT16to32A( cs, cs32 ); #else
if (PTR_SEG_TO_LIN(cs->lpszName) != name) /* Build the CREATESTRUCT on the 16-bit stack. */
cs32->lpszName = (LPCSTR)PTR_SEG_TO_LIN( cs->lpszName ); /* This is really ugly, but some programs (notably the */
if (PTR_SEG_TO_LIN(cs->lpszClass) != cls) /* "Undocumented Windows" examples) want it that way. */
cs32->lpszClass = (LPCSTR)PTR_SEG_TO_LIN( cs->lpszClass ); result = CallWndProcNCCREATE16( func, ds, cs->dwExStyle,
cs->lpszClass, cs->lpszName, cs->style, cs->x, cs->y,
cs->cx, cs->cy, cs->hwndParent, cs->hMenu, cs->hInstance,
(LONG)cs->lpCreateParams, hwnd, msg, (WPARAM16)wParam,
MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16),
IF1632_Saved16_ss ) );
#endif /* WINELIB */
/* We don't bother to translate the structure back */
SEGPTR_FREE(name); SEGPTR_FREE(name);
SEGPTR_FREE(cls); SEGPTR_FREE(cls);
SEGPTR_FREE(cs); SEGPTR_FREE(cs);
...@@ -580,6 +635,10 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, WORD ds, HWND32 hwnd, ...@@ -580,6 +635,10 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, WORD ds, HWND32 hwnd,
if ((wParam == WM_CREATE) || (wParam == WM_DESTROY)) if ((wParam == WM_CREATE) || (wParam == WM_DESTROY))
return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam,
MAKELPARAM( (HWND16)lParam, LOWORD(wParam))); MAKELPARAM( (HWND16)lParam, LOWORD(wParam)));
else
return CallWndProc16( func, ds, hwnd, msg,
(WPARAM16)wParam, lParam );
case WM_SETTEXT: case WM_SETTEXT:
{ {
LPSTR str = SEGPTR_STRDUP( (LPSTR)lParam ); LPSTR str = SEGPTR_STRDUP( (LPSTR)lParam );
...@@ -650,12 +709,14 @@ static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, WORD ds, HWND32 hwnd, ...@@ -650,12 +709,14 @@ static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, WORD ds, HWND32 hwnd,
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT32A cs = *(CREATESTRUCT32A *)lParam; CREATESTRUCT32A cs = *(CREATESTRUCT32A *)lParam;
if (HIWORD(cs.lpszName))
cs.lpszName = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName ); cs.lpszName = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName );
if (HIWORD(cs.lpszClass))
cs.lpszClass = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName ); cs.lpszClass = STRING32_DupUniToAnsi( (LPCWSTR)cs.lpszName );
result = WINPROC_CallProc32ATo16( func, ds, hwnd, msg, wParam, result = WINPROC_CallProc32ATo16( func, ds, hwnd, msg, wParam,
(LPARAM)&cs ); (LPARAM)&cs );
free( (LPVOID)cs.lpszName ); if (HIWORD(cs.lpszName)) free( (LPVOID)cs.lpszName );
free( (LPVOID)cs.lpszClass ); if (HIWORD(cs.lpszClass)) free( (LPVOID)cs.lpszClass );
} }
return result; return result;
...@@ -683,22 +744,31 @@ LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg, ...@@ -683,22 +744,31 @@ LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg,
WPARAM16 wParam, LPARAM lParam ) WPARAM16 wParam, LPARAM lParam )
{ {
WND *wndPtr; WND *wndPtr;
WINDOWPROC *proc = WINPROC_GetPtr( (HANDLE32)func );
switch(WINPROC_GetWinProcType(func)) if (!proc)
{ {
case WIN_PROC_16:
wndPtr = WIN_FindWndPtr( hwnd ); wndPtr = WIN_FindWndPtr( hwnd );
return CallWndProc16( (FARPROC)func, return CallWndProc16( (FARPROC)func,
wndPtr ? wndPtr->hInstance : CURRENT_DS, wndPtr ? wndPtr->hInstance : CURRENT_DS,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
}
switch(proc->type)
{
case WIN_PROC_16:
wndPtr = WIN_FindWndPtr( hwnd );
return CallWndProc16( (FARPROC)proc->func,
wndPtr ? wndPtr->hInstance : CURRENT_DS,
hwnd, msg, wParam, lParam );
case WIN_PROC_32A: case WIN_PROC_32A:
return WINPROC_CallProc16To32A( WINPROC_GetWinProcFunc(func), return WINPROC_CallProc16To32A( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
case WIN_PROC_32W: case WIN_PROC_32W:
return WINPROC_CallProc16To32W( WINPROC_GetWinProcFunc(func), return WINPROC_CallProc16To32W( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
default: default:
fprintf(stderr, "CallWindowProc16: invalid func %08x\n", (UINT32)func); fprintf( stderr, "CallWindowProc16: invalid proc %p\n", proc );
return 0; return 0;
} }
} }
...@@ -711,22 +781,25 @@ LRESULT CallWindowProc32A( WNDPROC32 func, HWND32 hwnd, UINT32 msg, ...@@ -711,22 +781,25 @@ LRESULT CallWindowProc32A( WNDPROC32 func, HWND32 hwnd, UINT32 msg,
WPARAM32 wParam, LPARAM lParam ) WPARAM32 wParam, LPARAM lParam )
{ {
WND *wndPtr; WND *wndPtr;
WINDOWPROC *proc = WINPROC_GetPtr( (HANDLE32)func );
switch(WINPROC_GetWinProcType( (WNDPROC16)func )) if (!proc) return CallWndProc32( func, hwnd, msg, wParam, lParam );
switch(proc->type)
{ {
case WIN_PROC_16: case WIN_PROC_16:
wndPtr = WIN_FindWndPtr( hwnd ); wndPtr = WIN_FindWndPtr( hwnd );
return WINPROC_CallProc32ATo16( (FARPROC)func, return WINPROC_CallProc32ATo16( (FARPROC)proc->func,
wndPtr ? wndPtr->hInstance : CURRENT_DS, wndPtr ? wndPtr->hInstance : CURRENT_DS,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
case WIN_PROC_32A: case WIN_PROC_32A:
return CallWndProc32( WINPROC_GetWinProcFunc( (WNDPROC16)func ), return CallWndProc32( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
case WIN_PROC_32W: case WIN_PROC_32W:
return WINPROC_CallProc32ATo32W(WINPROC_GetWinProcFunc((WNDPROC16)func), return WINPROC_CallProc32ATo32W( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
default: default:
fprintf(stderr,"CallWindowProc32A: invalid func %08x\n",(UINT32)func); fprintf( stderr, "CallWindowProc32A: invalid proc %p\n", proc );
return 0; return 0;
} }
} }
...@@ -739,22 +812,25 @@ LRESULT CallWindowProc32W( WNDPROC32 func, HWND32 hwnd, UINT32 msg, ...@@ -739,22 +812,25 @@ LRESULT CallWindowProc32W( WNDPROC32 func, HWND32 hwnd, UINT32 msg,
WPARAM32 wParam, LPARAM lParam ) WPARAM32 wParam, LPARAM lParam )
{ {
WND *wndPtr; WND *wndPtr;
WINDOWPROC *proc = WINPROC_GetPtr( (HANDLE32)func );
if (!proc) return CallWndProc32( func, hwnd, msg, wParam, lParam );
switch(WINPROC_GetWinProcType( (WNDPROC16)func )) switch(proc->type)
{ {
case WIN_PROC_16: case WIN_PROC_16:
wndPtr = WIN_FindWndPtr( hwnd ); wndPtr = WIN_FindWndPtr( hwnd );
return WINPROC_CallProc32WTo16( (FARPROC)func, return WINPROC_CallProc32WTo16( (FARPROC)proc->func,
wndPtr ? wndPtr->hInstance : CURRENT_DS, wndPtr ? wndPtr->hInstance : CURRENT_DS,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
case WIN_PROC_32A: case WIN_PROC_32A:
return WINPROC_CallProc32WTo32A(WINPROC_GetWinProcFunc((WNDPROC16)func), return WINPROC_CallProc32WTo32A( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
case WIN_PROC_32W: case WIN_PROC_32W:
return CallWndProc32( WINPROC_GetWinProcFunc( (WNDPROC16)func ), return CallWndProc32( (WNDPROC32)proc->func,
hwnd, msg, wParam, lParam ); hwnd, msg, wParam, lParam );
default: default:
fprintf(stderr,"CallWindowProc32W: invalid func %08x\n",(UINT32)func); fprintf( stderr, "CallWindowProc32W: invalid proc %p\n", proc );
return 0; return 0;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment