Release 940714

Thu Jul 14 17:50:45 1994  Bob Amstadt  (bob@pooh)

	* [Configure]
	Autodetects Linux version (if running Linux).

	* [loader/signal.c]
	New signals for Linux.

	* [loader/ldtlib.c]
	New structure field in sys call.

Sun Jul 10 19:31:34 1994  Olaf Flebbe  (olaf@dragon)

        * [load/resource.c] 
          fixed Memory (Resource) Leak.

        * [load/main.c] 
          fixed a printf.

Tue Jul 12 18:50:34 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [controls/desktop.c]
	Implemented desktop wallpaper (only 16 colors for now).

	* [controls/menu.c] [windows/nonclient.c]
	Preliminary work to allow multi-line menus.

	* [misc/main.c]
	No backing store on desktop window (not useful).

	* [objects/text.c]
	A few fixes to DrawText() to make underlines under mnemonic
	letters to look better.

	* [windows/graphics.c]
	More fixes to GRAPH_DrawArc(), and some fixes to Polygon().
	Implemented PolyPolygon() (partially working).

	* [windows/winpos.c]
	New function WINPOS_SendNCCalcSize().
	Cleaned up SetWindowPos() and added preliminary support for
	multi-line menus.

Mon Jul 11 19:15:51 1994  Miguel de Icaza  (miguel@sphinx)

	* [controls/edit.c]
	Changes to work as a library.

	* [if1632/callback.c] 
	Ifdefed module.

	* [if1632/relay.c]
	Changes to allow linking with WineLib.

	* [include/windows.h]
	Added macro WINELIB_UNIMP

	* [loader/library.c]
	When compiling WineLib, GetProcAddress is not implemented yet.

	* [loader/main.c]
	Added empty InitDLL when using WineLib.

	* [loader/ne_image.c]
	Some parts of the loader are needed for WineLib, ifdefed correctly

	* [misc/{audio.c,mcicda.c,mmaux.c,mmsystem.c]
	Disable compilation of module when compiling WineLib.

	* [toolkit/heap.c]
	Fixed small bug.  When passed an invalid handle WineLib would
	crash, now return NULL.

	* [toolkit/winmain.c]
	Call CreateNewTask in _WinMain.

Sun Jul 10 09:08:02 1994  David Metcalfe <david@prism.demon.co.uk>

	* [controls/edit.c] [controls/widget.c]
	More changes to improve compatibility with Windows' edit
	control.  Finished off tab stop support.

Mon Jul 11 21:05:02 MET DST 1994  Erik Bos <erik@hacktic.nl>

	* [if1632/relay.c]
	# of ordinals in shell.dll changed to 103.

	* [loader/signal.c]
	sti, cli will now be ignored.

	* [objects/brush.c]
	Added stub for GetSysColorBrush().
This commit is contained in:
Alexandre Julliard 1994-07-15 16:04:31 +00:00
parent 6b81b398f5
commit 2d159fb707
37 changed files with 1165 additions and 515 deletions

2
BUGS
View File

@ -4,3 +4,5 @@
- MDI does not send WM_GETMINMAX message.
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors
- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times.
- Dialogs don't support resources which are referred to as integers.

View File

@ -1,3 +1,97 @@
----------------------------------------------------------------------
Thu Jul 14 17:50:45 1994 Bob Amstadt (bob@pooh)
* [Configure]
Autodetects Linux version (if running Linux).
* [loader/signal.c]
New signals for Linux.
* [loader/ldtlib.c]
New structure field in sys call.
Sun Jul 10 19:31:34 1994 Olaf Flebbe (olaf@dragon)
* [load/resource.c]
fixed Memory (Resource) Leak.
* [load/main.c]
fixed a printf.
Tue Jul 12 18:50:34 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/desktop.c]
Implemented desktop wallpaper (only 16 colors for now).
* [controls/menu.c] [windows/nonclient.c]
Preliminary work to allow multi-line menus.
* [misc/main.c]
No backing store on desktop window (not useful).
* [objects/text.c]
A few fixes to DrawText() to make underlines under mnemonic
letters to look better.
* [windows/graphics.c]
More fixes to GRAPH_DrawArc(), and some fixes to Polygon().
Implemented PolyPolygon() (partially working).
* [windows/winpos.c]
New function WINPOS_SendNCCalcSize().
Cleaned up SetWindowPos() and added preliminary support for
multi-line menus.
Mon Jul 11 19:15:51 1994 Miguel de Icaza (miguel@sphinx)
* [controls/edit.c]
Changes to work as a library.
* [if1632/callback.c]
Ifdefed module.
* [if1632/relay.c]
Changes to allow linking with WineLib.
* [include/windows.h]
Added macro WINELIB_UNIMP
* [loader/library.c]
When compiling WineLib, GetProcAddress is not implemented yet.
* [loader/main.c]
Added empty InitDLL when using WineLib.
* [loader/ne_image.c]
Some parts of the loader are needed for WineLib, ifdefed correctly
* [misc/{audio.c,mcicda.c,mmaux.c,mmsystem.c]
Disable compilation of module when compiling WineLib.
* [toolkit/heap.c]
Fixed small bug. When passed an invalid handle WineLib would
crash, now return NULL.
* [toolkit/winmain.c]
Call CreateNewTask in _WinMain.
Sun Jul 10 09:08:02 1994 David Metcalfe <david@prism.demon.co.uk>
* [controls/edit.c] [controls/widget.c]
More changes to improve compatibility with Windows' edit
control. Finished off tab stop support.
Mon Jul 11 21:05:02 MET DST 1994 Erik Bos <erik@hacktic.nl>
* [if1632/relay.c]
# of ordinals in shell.dll changed to 103.
* [loader/signal.c]
sti, cli will now be ignored.
* [objects/brush.c]
Added stub for GetSysColorBrush().
----------------------------------------------------------------------
Sun, 3 Jul 1994 20:15:56 +0100 (BST) David Metcalfe <david@prism.demon.co.uk>

View File

@ -47,11 +47,25 @@ else
NEWBUILD=''
fi
if [ -f /usr/include/linux/ldt.h ]
then
if grep -q seg_not_present /usr/include/linux/ldt.h
then
NEWLINUXLDT='#define NewLinuxLdt -DNEW_LDT_STRUCT'
ALLDEFINES="$ALLDEFINES -DNEW_LDT_STRUCT"
else
NEWLINUXLDT=''
fi
else
NEWLINUXLDT=''
fi
echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h
echo $WINELIB >> autoconf.h
echo $SHORTNAMES >> autoconf.h
echo $NEWBUILD >> autoconf.h
echo $WINE_INI_GLOBAL >> autoconf.h
echo $NEWLINUXLDT >> autoconf.h
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h
xmkmf -a

View File

@ -6,10 +6,56 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include "win.h"
#include "desktop.h"
#include "prototypes.h"
/***********************************************************************
* DESKTOP_LoadBitmap
*
* Load a bitmap from a file. Used by SetDeskWallPaper().
*/
static HBITMAP DESKTOP_LoadBitmap( HDC hdc, char *filename )
{
BITMAPFILEHEADER *fileHeader;
BITMAPINFO *bitmapInfo;
HBITMAP hbitmap;
char *unixFileName, *buffer;
int file;
long size;
/* Read all the file into memory */
if (!(unixFileName = GetUnixFileName( filename ))) return 0;
if ((file = open( unixFileName, O_RDONLY )) == -1) return 0;
size = lseek( file, 0, SEEK_END );
if (!(buffer = (char *)malloc( size )))
{
close( file );
return 0;
}
lseek( file, 0, SEEK_SET );
size = read( file, buffer, size );
close( file );
fileHeader = (BITMAPFILEHEADER *)buffer;
bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER));
/* Check header content */
if ((fileHeader->bfType != 0x4d42) || (size < fileHeader->bfSize))
{
free( buffer );
return 0;
}
hbitmap = CreateDIBitmap( hdc, &bitmapInfo->bmiHeader, CBM_INIT,
buffer + fileHeader->bfOffBits,
bitmapInfo, DIB_RGB_COLORS );
free( buffer );
return hbitmap;
}
/***********************************************************************
@ -20,12 +66,49 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
{
RECT rect;
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
GetClientRect( hwnd, &rect );
FillRect( hdc, &rect, infoPtr->hbrushPattern );
/* Paint desktop pattern (only if wall paper does not cover everything) */
if (!infoPtr->hbitmapWallPaper ||
(!infoPtr->fTileWallPaper && (infoPtr->bitmapSize.cx < rect.right) &&
(infoPtr->bitmapSize.cy < rect.bottom)))
{
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
FillRect( hdc, &rect, infoPtr->hbrushPattern );
}
/* Paint wall paper */
if (infoPtr->hbitmapWallPaper)
{
int x, y;
HDC hdcmem;
hdcmem = CreateCompatibleDC( hdc );
SelectObject( hdcmem, infoPtr->hbitmapWallPaper );
if (infoPtr->fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += infoPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += infoPtr->bitmapSize.cx)
BitBlt( hdc, x, y,
infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy,
hdcmem, 0, 0, SRCCOPY );
}
else
{
x = (rect.left + rect.right - infoPtr->bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - infoPtr->bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
BitBlt( hdc, x, y, infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy,
hdcmem, 0, 0, SRCCOPY );
}
DeleteDC( hdcmem );
}
return 1;
}
@ -50,6 +133,7 @@ LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam )
infoPtr->hbrushPattern = 0;
infoPtr->hbitmapWallPaper = 0;
SetDeskPattern();
SetDeskWallPaper( (LPSTR)-1 );
break;
case WM_ERASEBKGND:
@ -77,6 +161,30 @@ BOOL SetDeskPattern()
*/
BOOL SetDeskWallPaper( LPSTR filename )
{
HBITMAP hbitmap;
HDC hdc;
char buffer[256];
WND *wndPtr = WIN_FindWndPtr( GetDesktopWindow() );
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
if (filename == (LPSTR)-1)
{
GetProfileString( "desktop", "WallPaper", "(None)", buffer, 256 );
filename = buffer;
}
hdc = GetDC( 0 );
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
ReleaseDC( 0, hdc );
if (infoPtr->hbitmapWallPaper) DeleteObject( infoPtr->hbitmapWallPaper );
infoPtr->hbitmapWallPaper = hbitmap;
infoPtr->fTileWallPaper = GetProfileInt( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
BITMAP bmp;
GetObject( hbitmap, sizeof(bmp), (LPSTR)&bmp );
infoPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
infoPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
}
return TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@ -156,7 +156,7 @@ LONG PopupMenuWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
hwnd, lppop->Width, lppop->Height);
#endif
SetWindowPos(hwnd, 0, 0, 0, lppop->Width + 2, lppop->Height,
SWP_NOZORDER | SWP_NOMOVE);
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE );
#ifdef DEBUG_MENU
printf("PopupMenuWndProc // End of WM_SHOWWINDOW !\n");
#endif
@ -1135,7 +1135,7 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop)
#endif
hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT));
lppop->CheckWidth = 0;
LineHeight = OldHeight = SYSMETRICS_CYMENU + 2;
LineHeight = OldHeight = SYSMETRICS_CYMENU + 1;
SetRect(&rect, lprect->left, lprect->top, 0, lprect->top + LineHeight);
lpitem2 = lppop->firstItem;
while (lpitem != NULL) {
@ -1201,6 +1201,29 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop)
/***********************************************************************
* MENU_GetMenuBarHeight
*
* Compute the size of the menu bar height. Used by NC_HandleNCCalcSize().
*/
WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth )
{
HDC hdc;
RECT rectBar;
WND *wndPtr;
LPPOPUPMENU lppop;
if (!(lppop = PopupMenuGetWindowAndStorage( hwnd, &wndPtr ))) return 0;
if (!wndPtr) return 0;
hdc = GetDC( hwnd );
SetRect( &rectBar, 0, 0, menubarWidth, SYSMETRICS_CYMENU );
MenuBarCalcSize( hdc, &rectBar, lppop );
ReleaseDC( hwnd, hdc );
printf( "MENU_GetMenuBarHeight: returning %d\n", lppop->Height );
return lppop->Height;
}
/***********************************************************************
* FindMenuItem
*/
@ -1844,7 +1867,7 @@ BOOL TrackPopupMenu(HMENU hMenu, WORD wFlags, short x, short y,
}
}
else {
ShowWindow(lppop->hWnd, SW_SHOW);
ShowWindow(lppop->hWnd, SW_SHOWNOACTIVATE);
}
if (!lppop->BarFlag) {
PopupMenuCalcSize(lppop->hWnd);
@ -1853,7 +1876,7 @@ BOOL TrackPopupMenu(HMENU hMenu, WORD wFlags, short x, short y,
x, y, lppop->Width, lppop->Height);
#endif
SetWindowPos(lppop->hWnd, 0, x, y, lppop->Width + 2, lppop->Height,
SWP_NOZORDER);
SWP_NOACTIVATE | SWP_NOZORDER);
}
SetFocus(lppop->hWnd);
if (!MenuHasFocus) {
@ -2208,7 +2231,7 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
#endif
if (GetCapture() == hWnd) ReleaseCapture();
if (wndPtr->window != 0) {
flags = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;
flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;
/* if (!IsWindowVisible(hWnd)) flags |= SWP_NOREDRAW; */
flags |= SWP_NOREDRAW;
if (hMenu == 0) {

View File

@ -34,9 +34,9 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "LISTBOX" },
{ CS_GLOBALCLASS, (LONG(*)())ComboBoxWndProc, 0, 8,
0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())EditWndProc, 0, 2,
{ CS_GLOBALCLASS, (LONG(*)())EditWndProc, 0, 4,
0, 0, 0, 0, NULL, "EDIT" },
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
{ CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },

View File

@ -3,10 +3,16 @@
MODULE = if1632
#ifdef WINELIB
SRCS = \
callback.c \
relay.c
#else
SRCS = \
call.S \
callback.c \
relay.c
#endif
DLLOBJS = \
dll_gdi.o \
@ -23,6 +29,10 @@ DLLOBJS = \
dll_win87em.o \
dll_winsock.o
#ifdef WINELIB
DLLOBJS=
#endif
OBJS1= $(SRCS:.S=.o)
#ifndef NewBuild

View File

@ -1,3 +1,4 @@
#ifndef WINELIB
static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
@ -324,3 +325,4 @@ void Throw (LPCATCHBUF cbuf, int val)
#endif
longjmp (sb -> buffer, val);
}
#endif /* !WINELIB */

View File

@ -273,7 +273,7 @@ length 490
CreateRoundRectRgn(1 2 3 4 5 6)
445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
#449 pascal DEVICECOLORMATCH
#450 pascal POLYPOLYGON
450 pascal PolyPolygon(word ptr ptr word) PolyPolygon(1 2 3 4)
451 pascal CreatePolyPolygonRgn(ptr ptr word word)
CreatePolyPolygonRgn(1 2 3 4)
#452 pascal GDISEEGDIDO

View File

@ -24,24 +24,31 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define DEBUG_RELAY /* */
#ifdef WINELIB
#define WineLibSkip(x) 0
#else
#define WineLibSkip(x) x
#endif
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{
{ "KERNEL", KERNEL_table, 410, 1 },
{ "USER", USER_table, 540, 2 },
{ "GDI", GDI_table, 490, 3 },
{ "UNIXLIB", UNIXLIB_table, 10, 4 },
{ "WIN87EM", WIN87EM_table, 10, 5 },
{ "SHELL", SHELL_table, 256, 6 },
{ "SOUND", SOUND_table, 20, 7 },
{ "KEYBOARD",KEYBOARD_table,137, 8 },
{ "WINSOCK", WINSOCK_table, 155, 9 },
{ "STRESS", STRESS_table, 15, 10},
{ "MMSYSTEM",MMSYSTEM_table,1226,11},
{ "SYSTEM", SYSTEM_table, 20 ,12},
{ "TOOLHELP",TOOLHELP_table, 83, 13},
{ "KERNEL", WineLibSkip(KERNEL_table), 410, 1 },
{ "USER", WineLibSkip(USER_table), 540, 2 },
{ "GDI", WineLibSkip(GDI_table), 490, 3 },
{ "UNIXLIB", WineLibSkip(UNIXLIB_table), 10, 4 },
{ "WIN87EM", WineLibSkip(WIN87EM_table), 10, 5 },
{ "SHELL", WineLibSkip(SHELL_table), 103, 6 },
{ "SOUND", WineLibSkip(SOUND_table), 20, 7 },
{ "KEYBOARD",WineLibSkip(KEYBOARD_table),137, 8 },
{ "WINSOCK", WineLibSkip(WINSOCK_table), 155, 9 },
{ "STRESS", WineLibSkip(STRESS_table), 15, 10},
{ "MMSYSTEM",WineLibSkip(MMSYSTEM_table),1226,11},
{ "SYSTEM", WineLibSkip(SYSTEM_table), 20 ,12},
{ "TOOLHELP",WineLibSkip(TOOLHELP_table), 83, 13},
};
/* don't forget to increase N_BUILTINS in dll.h if you add a dll */
#ifndef WINELIB
unsigned short *Stack16Frame;
extern unsigned long IF1632_Saved16_esp;
@ -211,6 +218,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
Stack16Frame = saved_Stack16Frame;
return ret_val;
}
#endif
/**********************************************************************
* FindDLLTable
@ -222,8 +230,11 @@ FindDLLTable(char *dll_name)
for (i = 0; i < N_BUILTINS; i++)
if (strcasecmp(dll_builtin_table[i].dll_name, dll_name) == 0)
#ifdef WINELIB
return dll_builtin_table[i].dll_number;
#else
return dll_builtin_table[i].dll_table;
#endif
return NULL;
}
@ -258,6 +269,7 @@ ReturnArg(int arg)
return arg;
}
#ifndef WINELIB
#ifdef WINESTAT
void winestat(){
int i, j;
@ -294,3 +306,4 @@ void winestat(){
printf("TOTAL: %d of %d implemented (%3.1f %%)\n",timplemented, tused, perc);
}
#endif /* WINESTAT */
#endif /* !WINELIB */

View File

@ -1,3 +1,5 @@
name system
id 12
length 20
6 pascal GetSystemmsecCount() GetTickCount()

View File

@ -11,10 +11,10 @@ length 83
# 56 1 090e LOCALINFO exported, shared data
# 57 1 095e LOCALFIRST exported, shared data
# 58 1 09e9 LOCALNEXT exported, shared data
#59 pascal ModuleFirst(ptr) ModuleFirst(1)
#60 pascal ModuleNext(ptr) ModuleNext(1)
#61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2)
#62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2)
59 pascal ModuleFirst(ptr) ModuleFirst(1)
60 pascal ModuleNext(ptr) ModuleNext(1)
61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2)
62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2)
# 63 1 0caa TASKFIRST exported, shared data
# 64 1 0ced TASKNEXT exported, shared data
# 65 1 0d2e TASKFINDHANDLE exported, shared data

View File

@ -291,6 +291,7 @@ length 540
278 pascal GetDeskTopHwnd() GetDesktopWindow()
#279 OLDSETDESKPATTERN
#280 SETSYSTEMMENU
281 pascal GetSysColorBrush(word) GetSysColorBrush(1)
282 pascal SelectPalette(word word word) SelectPalette(1 2 3)
283 pascal RealizePalette(word) RealizePalette(1)
284 pascal GetFreeSystemResources(word) GetFreeSystemResources(1)

View File

@ -13,6 +13,8 @@ typedef struct
{
HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper;
SIZE bitmapSize;
BOOL fTileWallPaper;
} DESKTOPINFO;
extern BOOL DESKTOP_SetPattern(char *pattern );

View File

@ -1038,6 +1038,15 @@ typedef struct tagLOGPEN
typedef struct { BYTE rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
typedef struct { BYTE rgbtBlue, rgbtGreen, rgbtRed; } RGBTRIPLE;
typedef struct
{
UINT bfType;
DWORD bfSize WINE_PACKED;
UINT bfReserved1 WINE_PACKED;
UINT bfReserved2 WINE_PACKED;
DWORD bfOffBits WINE_PACKED;
} BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER
{
DWORD biSize;
@ -2899,7 +2908,7 @@ Fd(BOOL,FloodFill,HDC,a,short,b,short,c,DWORD,d)
Fd(BOOL,GetCharWidth,HDC,a,WORD,b,WORD,c,LPINT,d)
Fd(BOOL,HiliteMenuItem,HWND,a,HMENU,b,WORD,c,WORD,d)
Fd(BOOL,MoveToEx,HDC,a,short,b,short,c,LPPOINT,d)
Fd(BOOL,PolyPolygon,HDC,a,LPPOINT,b,LPINT,c,int,d)
Fd(BOOL,PolyPolygon,HDC,a,LPPOINT,b,LPINT,c,WORD,d)
Fd(BOOL,PostAppMessage,HANDLE,a,WORD,b,WORD,c,LONG,d)
Fd(BOOL,RedrawWindow,HWND,a,LPRECT,b,HRGN,c,UINT,d)
Fd(BOOL,SetBitmapDimensionEx,HBITMAP,a,short,b,short,c,LPSIZE,d)
@ -3022,4 +3031,7 @@ Fl(int,SetDIBitsToDevice,HDC,a,short,b,short,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,
Fm(int,StretchDIBits,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l,DWORD,m)
Fn(HFONT,CreateFont,int,a,int,b,int,c,int,d,int,e,BYTE,f,BYTE,g,BYTE,h,BYTE,i,BYTE,j,BYTE,k,BYTE,l,BYTE,m,LPSTR,n)
#ifdef WINELIB
#define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x)
#endif
#endif /* WINDOWS_H */

View File

@ -64,6 +64,9 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
ldt_info.contents = contents;
ldt_info.read_exec_only = read_only_flag;
ldt_info.limit_in_pages = limit_in_pages_flag;
#ifdef NEW_LDT_STRUCT
ldt_info.seg_not_present = 0;
#endif
return modify_ldt(1, &ldt_info, sizeof(ldt_info));
#endif

View File

@ -212,6 +212,9 @@ void FreeLibrary(HANDLE hLib)
*/
FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
{
#ifdef WINELIB
WINELIB_UNIMP ("GetProcAddress");
#else
int i, sel, addr, ret;
register struct w_files *w = wine_files;
int ordinal, len;
@ -312,6 +315,7 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
sel = (ret >> 16);
printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n", ret, sel, addr);
return (FARPROC) ret;
#endif /* WINELIB */
}
/* internal dlls */

View File

@ -358,7 +358,7 @@ void InitDLL(struct w_files *wpnt)
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv);
} else
printf("%s skipped\n");
printf("%s skipped\n", wpnt->name);
}
}
@ -399,4 +399,9 @@ void InitializeLoadedDLLs(struct w_files *wpnt)
for( ; wpnt != final_wpnt; wpnt = wpnt->next)
InitDLL(wpnt);
}
#else /* #ifndef WINELIB */
void InitDLL(struct w_files *wpnt)
{
}
#endif /* #ifndef WINELIB */

View File

@ -51,6 +51,7 @@ void load_ne_header (int fd, struct ne_header_s *ne_header)
myerror("Unable to read NE header from file");
}
}
#endif
/**********************************************************************
* LoadNEImage
@ -68,6 +69,7 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
load_ne_header (wpnt->fd, wpnt->ne_header);
#ifndef WINELIB
/*
* Create segment selectors.
*/
@ -83,7 +85,7 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
wpnt->hinstance = (wpnt->
selector_table[wpnt->ne_header->auto_data_seg-1].
selector);
#endif
/* Get the lookup table. This is used for looking up the addresses
of functions that are exported */
@ -131,6 +133,7 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
if (strcasecmp(buff, wpnt->name) != 0 )
LoadImage(buff, DLL, 0);
}
#ifndef WINELIB
/* fixup references */
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++)
@ -139,7 +142,7 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
FixupFunctionPrologs(wpnt);
InitializeLoadedDLLs(wpnt);
#endif
return(wpnt->hinstance);
}
@ -197,6 +200,7 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
}
#ifndef WINELIB
/**********************************************************************
* FixupSegment
*/
@ -458,4 +462,4 @@ FixupSegment(struct w_files * wpnt, int segment_num)
return 0;
}
#endif
#endif /* !WINELIB */

View File

@ -948,6 +948,7 @@ HANDLE FreeResource(HANDLE hResData)
GlobalFree(r->info_mem);
return 0;
}
rp = r;
}
return hResData;

View File

@ -90,8 +90,15 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
/* First take care of a few preliminaries */
#ifdef linux
if(signal != SIGSEGV && signal != SIGTRAP)
if(signal != SIGSEGV
&& signal != SIGILL
#ifdef SIGBUS
&& signal != SIGBUS
#endif
&& signal != SIGTRAP)
{
exit(1);
}
/* And back up over the int3 instruction. */
if(signal == SIGTRAP) {
@ -151,6 +158,14 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
scp->sc_eip++;
break;
case 0xfa: /* cli, ignored */
scp->sc_eip++;
break;
case 0xfb: /* sti, ignored */
scp->sc_eip++;
break;
default:
fprintf(stderr, "Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
@ -191,6 +206,10 @@ int init_wine_signals(void)
segv_act.sa_restorer =
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL);
wine_sigaction(SIGILL, &segv_act, NULL);
#ifdef SIGBUS
wine_sigaction(SIGBUS, &segv_act, NULL);
#endif
wine_sigaction(SIGTRAP, &segv_act, NULL); /* For breakpoints */
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)

View File

@ -3,7 +3,7 @@
*
* Copyright 1994 Martin Ayotte
*/
#ifndef WINELIB
#define DEBUG_MCIWAVE
static char Copyright[] = "Copyright Martin Ayotte, 1994";
@ -1507,3 +1507,4 @@ DWORD modMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
}
#endif /* !WINELIB */

View File

@ -287,16 +287,10 @@ static void MAIN_CreateDesktop( int argc, char *argv[] )
StructureNotifyMask;
win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow );
if (Options.nobackingstore)
win_attr.backing_store = NotUseful;
else
win_attr.backing_store = Always;
rootWindow = XCreateWindow( display, DefaultRootWindow(display),
desktopX, desktopY, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWEventMask | CWCursor |
CWBackingStore, &win_attr );
CWEventMask | CWCursor, &win_attr );
/* Set window manager properties */

View File

@ -3,7 +3,7 @@
*
* Copyright 1994 Martin Ayotte
*/
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
@ -857,3 +857,4 @@ LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
/*-----------------------------------------------------------------------*/
#endif

View File

@ -3,7 +3,7 @@
*
* Copyright 1994 Martin Ayotte
*/
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "stdio.h"
@ -114,3 +114,4 @@ DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
}
#endif /* !WINELIB */

View File

@ -3,7 +3,7 @@
*
* Copyright 1993 Martin Ayotte
*/
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "stdio.h"
@ -614,9 +614,14 @@ DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS lpParms)
printf("MCI_OPEN // wDeviceID=%04X !\n", lpParms->wDeviceID);
switch(dwDevTyp) {
case MCI_DEVTYPE_CD_AUDIO:
return CDAUDIO_DriverProc(0, 0, MCI_OPEN_DRIVER,
#ifdef WINELIB
WINELIB_UNIMP ("CDAUDIO_DriverProc");
#else
return CDAUDIO_DriverProc(0, 0, MCI_OPEN_DRIVER,
dwParam, (DWORD)lpParms);
case MCI_DEVTYPE_WAVEFORM_AUDIO:
#endif
case MCI_DEVTYPE_WAVEFORM_AUDIO:
return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER,
dwParam, (DWORD)lpParms);
case MCI_DEVTYPE_SEQUENCER:
@ -646,8 +651,10 @@ DWORD mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
printf("mciClose(%u, %08X, %08X)\n", wDevID, dwParam, lpParms);
switch(mciDrv[wDevID].wType) {
case MCI_DEVTYPE_CD_AUDIO:
#ifndef WINELIB
dwRet = CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, 0,
MCI_CLOSE, dwParam, (DWORD)lpParms);
#endif
break;
case MCI_DEVTYPE_WAVEFORM_AUDIO:
dwRet = WAVE_DriverProc(mciDrv[wDevID].wDeviceID, 0,
@ -692,8 +699,11 @@ DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
default:
switch(mciDrv[wDevID].wType) {
case MCI_DEVTYPE_CD_AUDIO:
#ifndef WINELIB
return CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
wMsg, dwParam1, dwParam2);
#endif
case MCI_DEVTYPE_WAVEFORM_AUDIO:
return WAVE_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
wMsg, dwParam1, dwParam2);
@ -1984,7 +1994,9 @@ LRESULT WINAPI DrvSendMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lP
DWORD dwDevID = 0;
printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n",
hDriver, msg, lParam1, lParam2);
#ifndef WINELIB
return CDAUDIO_DriverProc(dwDevID, hDriver, msg, lParam1, lParam2);
#endif
}
/**************************************************************************
@ -2007,3 +2019,4 @@ LRESULT DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
#endif

View File

@ -143,6 +143,13 @@ DWORD SetBrushOrg( HDC hdc, short x, short y )
return retval;
}
/***********************************************************************
* GetSysColorBrush (USER.281)
*/
WORD GetSysColorBrush(WORD x)
{
return GetStockObject(GRAY_BRUSH);
}
/***********************************************************************
* BRUSH_DeleteObject

View File

@ -74,7 +74,7 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
case PREFIX:
if (!(format & DT_NOPREFIX))
{
prefix_offset = j + 1;
prefix_offset = j;
i++;
}
else
@ -177,7 +177,7 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
SIZE size;
char *strPtr;
static char line[1024];
int len, lh, prefix_x, prefix_len;
int len, lh, prefix_x, prefix_end;
TEXTMETRIC tm;
int x = rect->left, y = rect->top;
int width = rect->right - rect->left;
@ -214,10 +214,10 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
if (prefix_offset != -1)
{
GetTextExtentPoint(hdc, line, prefix_offset - 1, &size);
GetTextExtentPoint(hdc, line, prefix_offset, &size);
prefix_x = size.cx;
GetTextExtentPoint(hdc, line + prefix_offset, 1, &size);
prefix_len = size.cx;
GetTextExtentPoint(hdc, line, prefix_offset + 1, &size);
prefix_end = size.cx - 1;
}
if (!GetTextExtentPoint(hdc, line, len, &size)) return 0;
@ -235,8 +235,8 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
if (!TextOut(hdc, x, y, line, len)) return 0;
if (prefix_offset != -1)
{
MoveTo(hdc, x + prefix_x, y + size.cy);
LineTo(hdc, x + prefix_x + prefix_len, y + size.cy);
MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 );
LineTo(hdc, x + prefix_end, y + tm.tmAscent + 1 );
}
if (strPtr)

View File

@ -121,7 +121,7 @@ char *LocalLock (HANDLE hMem)
#ifdef DEBUG_HEAP
printf (">%d->%p\n", hMem, *m);
#endif
return *m;
return m ? *m : 0;
}
HANDLE LocalReAlloc (HANDLE hMem, WORD flags, WORD bytes)
@ -196,6 +196,16 @@ HANDLE GlobalLinearUnlock (HANDLE hMem)
return GlobalUnlock (hMem);
}
int HEAP_LocalSize ()
{
return 0;
}
int HEAP_LocalFindHeap ()
{
return 0;
}
#ifdef UNIMPLEMENTED
void *GlobalQuickAlloc(int size)
{

View File

@ -8,6 +8,7 @@ _WinMain (int argc, char *argv [])
{
int ret_val;
char filename [4096];
HANDLE hTaskMain;
GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename), WINE_INI);
@ -18,6 +19,7 @@ _WinMain (int argc, char *argv [])
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
USER_InitApp (hSysRes);
hTaskMain = CreateNewTask (1); /* This is not correct */
ret_val = WinMain (1, /* hInstance */
0, /* hPrevInstance */
"", /* lpszCmdParam */

View File

@ -22,6 +22,7 @@ extern LONG NC_HandleNCLButtonDown( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam );
extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ); /* winpos.c */
extern void NC_TrackSysMenu( HWND hwnd ); /* menu.c */
extern BOOL ActivateMenuBarFocus(HWND hWnd); /* menu.c */
@ -126,6 +127,9 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
if (wParam) SetFocus( hwnd );
break;
case WM_WINDOWPOSCHANGING:
return WINPOS_HandleWindowPosChanging( (WINDOWPOS *)lParam );
case WM_WINDOWPOSCHANGED:
{
WINDOWPOS * winPos = (WINDOWPOS *)lParam;

View File

@ -105,8 +105,8 @@ BOOL MoveToEx( HDC hdc, short x, short y, LPPOINT pt )
BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
int xstart, int ystart, int xend, int yend, int lines )
{
int xcenter, ycenter;
double start_angle, end_angle, diff_angle;
int xcenter, ycenter, istart_angle, idiff_angle;
double start_angle, end_angle;
XPoint points[3];
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
@ -151,16 +151,15 @@ BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
(double)(xstart-xcenter)*(bottom-top) );
end_angle = atan2( (double)(ycenter-yend)*(right-left),
(double)(xend-xcenter)*(bottom-top) );
diff_angle = end_angle - start_angle;
if (diff_angle < 0.0) diff_angle += 2*PI;
istart_angle = (int)(start_angle * 180 * 64 / PI);
idiff_angle = (int)((end_angle - start_angle) * 180 * 64 / PI );
if (idiff_angle <= 0) idiff_angle += 360 * 64;
if (left > right) swap_int( &left, &right );
if (top > bottom) swap_int( &top, &bottom );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1,
(int)(start_angle * 180 * 64 / PI),
(int)(diff_angle * 180 * 64 / PI) );
right-left-1, bottom-top-1, istart_angle, idiff_angle );
if (!lines) return TRUE;
points[0].x = dc->w.DCOrgX + xcenter + (int)(cos(start_angle) * (right-left) / 2);
@ -656,7 +655,7 @@ BOOL Polygon (HDC hdc, LPPOINT pt, int count)
{
register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
XPoint *points = (XPoint *) malloc (sizeof (XPoint) * count+1);
XPoint *points = (XPoint *) malloc (sizeof (XPoint) * (count+1));
if (!dc)
{
@ -666,29 +665,78 @@ BOOL Polygon (HDC hdc, LPPOINT pt, int count)
return TRUE;
}
if (DC_SetupGCForBrush( dc ))
for (i = 0; i < count; i++)
{
for (i = 0; i < count; i++)
{
points [i].x = dc->w.DCOrgX + XLPTODP(dc, pt [i].x);
points [i].y = dc->w.DCOrgY + YLPTODP(dc, pt [i].y);
}
points [count] = points [0];
XFillPolygon( display, dc->u.x.drawable, dc->u.x.gc,
points, count, Complex, CoordModeOrigin);
if (DC_SetupGCForPen ( dc ))
{
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, count, CoordModeOrigin );
}
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
points[i].y = dc->w.DCOrgY + YLPTODP( dc, pt[i].y );
}
free ((void *) points);
return (TRUE);
points[count] = points[0];
if (DC_SetupGCForBrush( dc ))
XFillPolygon( display, dc->u.x.drawable, dc->u.x.gc,
points, count+1, Complex, CoordModeOrigin);
if (DC_SetupGCForPen ( dc ))
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, count+1, CoordModeOrigin );
free( points );
return TRUE;
}
/**********************************************************************
* PolyPolygon (GDI.450)
*/
BOOL PolyPolygon( HDC hdc, LPPOINT pt, LPINT counts, WORD polygons )
{
int i;
HRGN hrgn;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
/* MF_MetaPoly(dc, META_POLYGON, pt, count); */
return TRUE;
}
/* The points should be converted to device coords before */
/* creating the region. But as CreatePolyPolygonRgn is not */
/* really correct either, it doesn't matter much... */
/* At least the outline will be correct :-) */
hrgn = CreatePolyPolygonRgn( pt, counts, polygons, dc->w.polyFillMode );
PaintRgn( hdc, hrgn );
DeleteObject( hrgn );
/* Draw the outline of the polygons */
if (DC_SetupGCForPen ( dc ))
{
int i, j, max = 0;
XPoint *points;
for (i = 0; i < polygons; i++) if (counts[i] > max) max = counts[i];
points = (XPoint *) malloc( sizeof(XPoint) * (max+1) );
for (i = 0; i < polygons; i++)
{
for (j = 0; j < counts[i]; j++)
{
points[j].x = dc->w.DCOrgX + XLPTODP( dc, pt->x );
points[j].y = dc->w.DCOrgY + YLPTODP( dc, pt->y );
pt++;
}
points[j] = points[0];
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, j + 1, CoordModeOrigin );
}
free( points );
}
return TRUE;
}
/**********************************************************************
* FloodFill_rec -- FloodFill helper function
*

View File

@ -26,8 +26,8 @@ ICON_Iconify(HWND hwnd)
WND *parwPtr;
#ifdef DEBUG_ICON
#endif
printf("ICON_Iconify %d\n", hwnd);
#endif
parwPtr = WIN_FindWndPtr(wndPtr->hwndParent);
if (parwPtr == NULL) {
@ -40,8 +40,10 @@ ICON_Iconify(HWND hwnd)
printf("argh, couldn't find icon\n");
exit(1);
}
#ifdef DEBUG_ICON
printf("parent edge values are %d, %d\n", parwPtr->rectWindow.left,
parwPtr->rectWindow.bottom);
#endif
wndPtr->ptIconPos.x = parwPtr->rectWindow.left + 10;
wndPtr->ptIconPos.y = parwPtr->rectWindow.bottom - 80;
@ -68,7 +70,9 @@ ICON_Iconify(HWND hwnd)
XMapWindow(display, wndPtr->icon);
SendMessage(hwnd, WM_PAINTICON, 0, 0);
#ifdef DEBUG_ICON
printf("done with iconify\n");
#endif
}
@ -94,7 +98,7 @@ BOOL ICON_isAtPoint(HWND hwnd, POINT pt)
iconWidth = 64;
iconHeight = 64;
}
#define DEBUG_ICON 1
#ifdef DEBUG_ICON
printf("icon x,y is %d,%d\n",
wndPtr->ptIconPos.x, wndPtr->ptIconPos.y);
@ -124,7 +128,9 @@ BOOL ICON_isAtPoint(HWND hwnd, POINT pt)
(wndPtr->dwStyle & WS_VISIBLE) &&
!(wndPtr->dwExStyle & WS_EX_TRANSPARENT))
{
#ifdef DEBUG_ICON
printf("got a winner!\n");
#endif
return 1;
}
@ -142,10 +148,14 @@ HWND ICON_findIconFromPoint(POINT pt)
if ( !(wndPtr=WIN_FindWndPtr(hwnd))) return 0;
if (ICON_isAtPoint(hwnd, pt)) {
#ifdef DEBUG_ICON
printf("returning\n");
#endif
return hwndRet = hwnd;
} else {
#ifdef DEBUG_ICON
printf("checking child\n");
#endif
hwnd = wndPtr->hwndChild;
}
}
@ -157,7 +167,9 @@ ICON_Deiconify(HWND hwnd)
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
#ifdef DEBUG_ICON
printf("deiconifying\n");
#endif
XUnmapWindow(display, wndPtr->icon);
wndPtr->dwStyle &= ~WS_MINIMIZE;
/* wndPtr->rectNormal = myrect;

View File

@ -27,6 +27,7 @@ static HBITMAP hbitmapRestoreD = 0;
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack ); /* winpos.c */
extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */
extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth ); /* menu.c */
/* Some useful macros */
@ -117,13 +118,17 @@ LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params )
if (!wndPtr) return 0;
NC_AdjustRect( &tmpRect, wndPtr->dwStyle,
HAS_MENU(wndPtr), wndPtr->dwExStyle );
NC_AdjustRect( &tmpRect, wndPtr->dwStyle, FALSE, wndPtr->dwExStyle );
params->rgrc[0].left -= tmpRect.left;
params->rgrc[0].top -= tmpRect.top;
params->rgrc[0].right -= tmpRect.right;
params->rgrc[0].bottom -= tmpRect.bottom;
if (HAS_MENU(wndPtr))
{
params->rgrc[0].top += MENU_GetMenuBarHeight( hwnd,
params->rgrc[0].right - params->rgrc[0].left );
}
return 0;
}

View File

@ -24,6 +24,11 @@ extern Colormap COLOR_WinColormap;
extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */
extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */
extern void WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); /*winpos.c*/
extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect,
RECT *oldClientRect, WINDOWPOS *winpos,
RECT *newClientRect ); /* winpos.c */
extern HMENU CopySysMenu(); /* menu.c */
extern LONG MDIClientWndProc(HWND hwnd, WORD message,
WORD wParam, LONG lParam); /* mdi.c */
@ -453,19 +458,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
if (!wmcreate) wmcreate = -1;
else
{
/* Send WM_NCCALCSIZE message */
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) );
if (hparams)
{
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
params->rgrc[0] = wndPtr->rectWindow;
params->lppos = NULL;
SendMessage( hwnd, WM_NCCALCSIZE, FALSE, (LONG)params );
wndPtr->rectClient = params->rgrc[0];
USER_HEAP_FREE( hparams );
}
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, NULL, &wndPtr->rectClient );
wmcreate = SendMessage( hwnd, WM_CREATE, 0, (LONG)createStruct );
}

View File

@ -437,6 +437,234 @@ HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg )
}
/***********************************************************************
* WINPOS_SendNCCalcSize
*
* Send a WM_NCCALCSIZE message to a window.
* All parameters are read-only except newClientRect.
* oldWindowRect, oldClientRect and winpos must be non-NULL only
* when calcValidRect is TRUE.
*/
LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, RECT *newWindowRect,
RECT *oldWindowRect, RECT *oldClientRect,
WINDOWPOS *winpos, RECT *newClientRect )
{
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
LONG result;
if (!(hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) )))
return 0;
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
params->rgrc[0] = *newWindowRect;
if (calcValidRect)
{
params->rgrc[1] = *oldWindowRect;
params->rgrc[2] = *oldClientRect;
params->lppos = winpos;
}
result = SendMessage( hwnd, WM_NCCALCSIZE, calcValidRect, (LONG)params);
*newClientRect = params->rgrc[0];
USER_HEAP_FREE( hparams );
return result;
}
/***********************************************************************
* WINPOS_HandleWindowPosChanging
*
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
*/
LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos )
{
POINT maxSize;
WND *wndPtr = WIN_FindWndPtr( winpos->hwnd );
if (!wndPtr || (winpos->flags & SWP_NOSIZE)) return 0;
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
(wndPtr->dwStyle & (WS_POPUP | WS_CHILD) == 0))
{
WINPOS_GetMinMaxInfo( winpos->hwnd, &maxSize, NULL, NULL, NULL );
winpos->cx = min( winpos->cx, maxSize.x );
winpos->cy = min( winpos->cy, maxSize.y );
}
return 0;
}
/***********************************************************************
* WINPOS_InternalSetWindowPos
*
* Helper function for SetWindowPos.
*/
static BOOL WINPOS_InternalSetWindowPos( WINDOWPOS *winpos )
{
HWND hwndAfter;
WND *wndPtr;
RECT newWindowRect, newClientRect;
int flags, result;
int changeMask = 0;
XWindowChanges winChanges;
/* Send WM_WINDOWPOSCHANGING message */
if (!(winpos->flags & SWP_NOSENDCHANGING))
SendMessage( winpos->hwnd, WM_WINDOWPOSCHANGING, 0, (LONG)winpos );
/* Check window handle */
if (winpos->hwnd == GetDesktopWindow()) return FALSE;
if (!(wndPtr = WIN_FindWndPtr( winpos->hwnd ))) return FALSE;
/* Check dimensions */
if (winpos->cx <= 0) winpos->cx = 1;
if (winpos->cy <= 0) winpos->cy = 1;
/* Check flags */
flags = winpos->flags;
if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW))
flags |= SWP_NOMOVE | SWP_NOSIZE;
if (winpos->hwnd == hwndActive) flags |= SWP_NOACTIVATE; /*Already active*/
/* Check hwndAfter */
hwndAfter = winpos->hwndInsertAfter;
if (!(flags & (SWP_NOZORDER | SWP_NOACTIVATE)))
{
/* Ignore TOPMOST flags when activating a window */
/* _and_ moving it in Z order. */
if ((hwndAfter == HWND_TOPMOST) || (hwndAfter == HWND_NOTOPMOST))
hwndAfter = HWND_TOP;
}
/* TOPMOST not supported yet */
if ((hwndAfter == HWND_TOPMOST) || (hwndAfter == HWND_NOTOPMOST))
hwndAfter = HWND_TOP;
/* hwndAfter must be a sibling of the window */
if ((hwndAfter != HWND_TOP) && (hwndAfter != HWND_BOTTOM) &&
(GetParent(winpos->hwnd) != GetParent(hwndAfter))) return FALSE;
/* Calculate new position and size */
newWindowRect = wndPtr->rectWindow;
newClientRect = wndPtr->rectClient;
if (!(flags & SWP_NOSIZE))
{
newWindowRect.right = newWindowRect.left + winpos->cx;
newWindowRect.bottom = newWindowRect.top + winpos->cy;
winChanges.width = winpos->cx;
winChanges.height = winpos->cy;
changeMask |= CWWidth | CWHeight;
}
if (!(flags & SWP_NOMOVE))
{
newWindowRect.left = winpos->x;
newWindowRect.top = winpos->y;
newWindowRect.right += winpos->x - wndPtr->rectWindow.left;
newWindowRect.bottom += winpos->y - wndPtr->rectWindow.top;
if (wndPtr->dwStyle & WS_CHILD)
{
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
winChanges.x = winpos->x + parentPtr->rectClient.left
- parentPtr->rectWindow.left;
winChanges.y = winpos->y + parentPtr->rectClient.top
- parentPtr->rectWindow.top;
}
else
{
winChanges.x = winpos->x;
winChanges.y = winpos->y;
}
changeMask |= CWX | CWY;
}
/* Reposition window in Z order */
if (!(flags & SWP_NOZORDER))
{
WIN_UnlinkWindow( winpos->hwnd );
WIN_LinkWindow( winpos->hwnd, hwndAfter );
if (hwndAfter == HWND_TOP) winChanges.stack_mode = Above;
else winChanges.stack_mode = Below;
if ((hwndAfter != HWND_TOP) && (hwndAfter != HWND_BOTTOM))
{
WND * insertPtr = WIN_FindWndPtr( hwndAfter );
winChanges.sibling = insertPtr->window;
changeMask |= CWSibling;
}
changeMask |= CWStackMode;
}
/* Send WM_NCCALCSIZE message to get new client area */
result = WINPOS_SendNCCalcSize( winpos->hwnd, TRUE, &newWindowRect,
&wndPtr->rectWindow, &wndPtr->rectClient,
winpos, &newClientRect );
/* .... Should handle result here */
/* Perform the moving and resizing */
if (changeMask) XConfigureWindow( display, wndPtr->window,
changeMask, &winChanges );
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
if (flags & SWP_SHOWWINDOW)
{
wndPtr->dwStyle |= WS_VISIBLE;
XMapWindow( display, wndPtr->window );
MSG_Synchronize();
if (flags & SWP_NOREDRAW) /* Validate the whole window */
RedrawWindow( winpos->hwnd, NULL, 0, RDW_VALIDATE );
}
else if (flags & SWP_HIDEWINDOW)
{
wndPtr->dwStyle &= ~WS_VISIBLE;
XUnmapWindow( display, wndPtr->window );
if ((winpos->hwnd == GetFocus()) || IsChild(winpos->hwnd, GetFocus()))
SetFocus( GetParent(winpos->hwnd) ); /* Revert focus to parent */
if (winpos->hwnd == hwndActive)
{
/* Activate previously active window if possible */
HWND newActive = wndPtr->hwndPrevActive;
if (!IsWindow(newActive) || (newActive == winpos->hwnd))
{
newActive = GetTopWindow(GetDesktopWindow());
if (newActive == winpos->hwnd) newActive = wndPtr->hwndNext;
}
WINPOS_ChangeActiveWindow( newActive, FALSE );
}
}
/* Activate the window */
if (!(flags & SWP_NOACTIVATE))
{
if (!(wndPtr->dwStyle & WS_CHILD))
WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
}
/* Send WM_NCPAINT message if needed */
if ((flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) ||
(!(flags & SWP_NOSIZE)) || (!(flags & SWP_NOMOVE)) ||
(!(flags & SWP_NOACTIVATE)) || (!(flags & SWP_NOZORDER)))
SendMessage( winpos->hwnd, WM_NCPAINT, 1, 0L );
#if 0
if ((flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) &&
(!(flags & SWP_NOREDRAW)) &&
(wndPtr->dwStyle & WS_VISIBLE))
InvalidateRect(winpos->hwnd, NULL, TRUE);
#endif
/* And last, send the WM_WINDOWPOSCHANGED message */
SendMessage( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LONG)winpos );
return TRUE;
}
/***********************************************************************
* SetWindowPos (USER.232)
*/
@ -449,23 +677,13 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
{
WINDOWPOS *winPos;
HANDLE hmem = 0;
RECT newWindowRect, newClientRect;
WND *wndPtr;
int calcsize_result = 0;
XWindowChanges winChanges;
int changeMask = 0;
BOOL res;
#ifdef DEBUG_WIN
printf( "SetWindowPos: %04X %d %d,%d %dx%d 0x%x\n",
hwnd, hwndInsertAfter, x, y, cx, cy, flags );
#endif
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW))
flags |= SWP_NOMOVE | SWP_NOSIZE;
/* Send WM_WINDOWPOSCHANGING message */
if (!(hmem = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(WINDOWPOS) )))
return FALSE;
winPos = (WINDOWPOS *)USER_HEAP_ADDR( hmem );
@ -476,183 +694,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
winPos->cx = cx;
winPos->cy = cy;
winPos->flags = flags;
SendMessage( hwnd, WM_WINDOWPOSCHANGING, 0, (LONG)winPos );
hwndInsertAfter = winPos->hwndInsertAfter;
/* Some sanity checks */
res = WINPOS_InternalSetWindowPos( winPos );
if (!IsWindow( hwnd ) || (hwnd == GetDesktopWindow())) goto Abort;
if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW))
flags |= SWP_NOMOVE | SWP_NOSIZE;
if (!(flags & (SWP_NOZORDER | SWP_NOACTIVATE)))
{
if (hwnd != hwndActive) hwndInsertAfter = HWND_TOP;
else if ((hwndInsertAfter == HWND_TOPMOST) ||
(hwndInsertAfter == HWND_NOTOPMOST))
hwndInsertAfter = HWND_TOP;
}
/* Calculate new position and size */
newWindowRect = wndPtr->rectWindow;
newClientRect = wndPtr->rectClient;
if (!(winPos->flags & SWP_NOSIZE))
{
newWindowRect.right = newWindowRect.left + winPos->cx;
newWindowRect.bottom = newWindowRect.top + winPos->cy;
}
if (!(winPos->flags & SWP_NOMOVE))
{
newWindowRect.left = winPos->x;
newWindowRect.top = winPos->y;
newWindowRect.right += winPos->x - wndPtr->rectWindow.left;
newWindowRect.bottom += winPos->y - wndPtr->rectWindow.top;
}
/* Reposition window in Z order */
if (!(winPos->flags & SWP_NOZORDER))
{
/* TOPMOST not supported yet */
if ((hwndInsertAfter == HWND_TOPMOST) ||
(hwndInsertAfter == HWND_NOTOPMOST)) hwndInsertAfter = HWND_TOP;
/* Make sure hwndInsertAfter is a sibling of hwnd */
if ((hwndInsertAfter != HWND_TOP) && (hwndInsertAfter != HWND_BOTTOM))
if (GetParent(hwnd) != GetParent(hwndInsertAfter)) goto Abort;
WIN_UnlinkWindow( hwnd );
WIN_LinkWindow( hwnd, hwndInsertAfter );
}
/* Recalculate client area position */
if (winPos->flags & SWP_FRAMECHANGED)
{
/* Send WM_NCCALCSIZE message */
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
if (!(hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) )))
goto Abort;
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
params->rgrc[0] = newWindowRect;
params->rgrc[1] = wndPtr->rectWindow;
params->rgrc[2] = wndPtr->rectClient;
params->lppos = winPos;
calcsize_result = SendMessage(hwnd, WM_NCCALCSIZE, TRUE, (LONG)params);
USER_HEAP_FREE( hparams );
newClientRect = params->rgrc[0];
/* Handle result here */
}
else
{
newClientRect.left = newWindowRect.left + wndPtr->rectClient.left
- wndPtr->rectWindow.left;
newClientRect.top = newWindowRect.top + wndPtr->rectClient.top
- wndPtr->rectWindow.top;
newClientRect.right = newWindowRect.right + wndPtr->rectClient.right
- wndPtr->rectWindow.right;
newClientRect.bottom = newWindowRect.bottom + wndPtr->rectClient.bottom
- wndPtr->rectWindow.bottom;
}
/* Perform the moving and resizing */
if (!(winPos->flags & SWP_NOMOVE))
{
WND * parentPtr;
winChanges.x = newWindowRect.left;
winChanges.y = newWindowRect.top;
if (wndPtr->dwStyle & WS_CHILD)
{
parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
winChanges.x += parentPtr->rectClient.left-parentPtr->rectWindow.left;
winChanges.y += parentPtr->rectClient.top-parentPtr->rectWindow.top;
}
changeMask |= CWX | CWY;
}
if (!(winPos->flags & SWP_NOSIZE))
{
winChanges.width = newWindowRect.right - newWindowRect.left;
winChanges.height = newWindowRect.bottom - newWindowRect.top;
changeMask |= CWWidth | CWHeight;
}
if (!(winPos->flags & SWP_NOZORDER))
{
if (hwndInsertAfter == HWND_TOP) winChanges.stack_mode = Above;
else winChanges.stack_mode = Below;
if ((hwndInsertAfter != HWND_TOP) && (hwndInsertAfter != HWND_BOTTOM))
{
WND * insertPtr = WIN_FindWndPtr( hwndInsertAfter );
winChanges.sibling = insertPtr->window;
changeMask |= CWSibling;
}
changeMask |= CWStackMode;
}
if ((newWindowRect.right - newWindowRect.left) != 0 &&
(newWindowRect.bottom - newWindowRect.top) != 0)
if (changeMask) XConfigureWindow( display, wndPtr->window,
changeMask, &winChanges );
if ((newWindowRect.right - newWindowRect.left) != 0 &&
(newWindowRect.bottom - newWindowRect.top) != 0 &&
(winPos->flags & SWP_SHOWWINDOW))
{
wndPtr->dwStyle |= WS_VISIBLE;
XMapWindow( display, wndPtr->window );
MSG_Synchronize();
/* if (winPos->flags & SWP_NOREDRAW)
RedrawWindow( hwnd, NULL, 0, RDW_VALIDATE ); */
}
else if (winPos->flags & SWP_HIDEWINDOW)
{
wndPtr->dwStyle &= ~WS_VISIBLE;
XUnmapWindow( display, wndPtr->window );
if ((hwnd == GetFocus()) || IsChild( hwnd, GetFocus() ))
SetFocus( GetParent(hwnd) ); /* Revert focus to parent (if any) */
if (hwnd == hwndActive)
{
/* Activate previously active window if possible */
HWND newActive = wndPtr->hwndPrevActive;
if (!IsWindow(newActive) || (newActive == hwnd))
{
newActive = GetTopWindow(GetDesktopWindow());
if (newActive == hwnd) newActive = wndPtr->hwndNext;
}
WINPOS_ChangeActiveWindow( newActive, FALSE );
}
}
if (!(winPos->flags & SWP_NOACTIVATE))
{
if (!(wndPtr->dwStyle & WS_CHILD))
WINPOS_ChangeActiveWindow( hwnd, FALSE );
}
/* Send WM_NCPAINT message if needed */
if ((winPos->flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) ||
(!(winPos->flags & SWP_NOSIZE)) ||
(!(winPos->flags & SWP_NOMOVE)) ||
(!(winPos->flags & SWP_NOACTIVATE)) ||
(!(winPos->flags & SWP_NOZORDER)))
SendMessage( hwnd, WM_NCPAINT, 1, 0L );
if ((winPos->flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) &&
(!(winPos->flags & SWP_NOREDRAW)) &&
(wndPtr->dwStyle & WS_VISIBLE) && IsWindowVisible(hwnd))
InvalidateRect(hwnd, NULL, TRUE);
/* Finally send the WM_WINDOWPOSCHANGED message */
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
SendMessage( hwnd, WM_WINDOWPOSCHANGED, 0, (LONG)winPos );
USER_HEAP_FREE( hmem );
return TRUE;
Abort: /* Fatal error encountered */
if (hmem) USER_HEAP_FREE( hmem );
return FALSE;
return res;
}