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. - MDI does not send WM_GETMINMAX message.
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0) - InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors - 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> Sun, 3 Jul 1994 20:15:56 +0100 (BST) David Metcalfe <david@prism.demon.co.uk>

View File

@ -47,11 +47,25 @@ else
NEWBUILD='' NEWBUILD=''
fi 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 '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h
echo $WINELIB >> autoconf.h echo $WINELIB >> autoconf.h
echo $SHORTNAMES >> autoconf.h echo $SHORTNAMES >> autoconf.h
echo $NEWBUILD >> autoconf.h echo $NEWBUILD >> autoconf.h
echo $WINE_INI_GLOBAL >> autoconf.h echo $WINE_INI_GLOBAL >> autoconf.h
echo $NEWLINUXLDT >> autoconf.h
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h echo "#define AutoDefines $ALLDEFINES" >> autoconf.h
xmkmf -a xmkmf -a

View File

@ -6,10 +6,56 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1994"; static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "win.h" #include "win.h"
#include "desktop.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 ) static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
{ {
RECT rect; 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 ); 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; return 1;
} }
@ -50,6 +133,7 @@ LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam )
infoPtr->hbrushPattern = 0; infoPtr->hbrushPattern = 0;
infoPtr->hbitmapWallPaper = 0; infoPtr->hbitmapWallPaper = 0;
SetDeskPattern(); SetDeskPattern();
SetDeskWallPaper( (LPSTR)-1 );
break; break;
case WM_ERASEBKGND: case WM_ERASEBKGND:
@ -77,6 +161,30 @@ BOOL SetDeskPattern()
*/ */
BOOL SetDeskWallPaper( LPSTR filename ) 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; 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); hwnd, lppop->Width, lppop->Height);
#endif #endif
SetWindowPos(hwnd, 0, 0, 0, lppop->Width + 2, lppop->Height, SetWindowPos(hwnd, 0, 0, 0, lppop->Width + 2, lppop->Height,
SWP_NOZORDER | SWP_NOMOVE); SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE );
#ifdef DEBUG_MENU #ifdef DEBUG_MENU
printf("PopupMenuWndProc // End of WM_SHOWWINDOW !\n"); printf("PopupMenuWndProc // End of WM_SHOWWINDOW !\n");
#endif #endif
@ -1135,7 +1135,7 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop)
#endif #endif
hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT)); hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT));
lppop->CheckWidth = 0; lppop->CheckWidth = 0;
LineHeight = OldHeight = SYSMETRICS_CYMENU + 2; LineHeight = OldHeight = SYSMETRICS_CYMENU + 1;
SetRect(&rect, lprect->left, lprect->top, 0, lprect->top + LineHeight); SetRect(&rect, lprect->left, lprect->top, 0, lprect->top + LineHeight);
lpitem2 = lppop->firstItem; lpitem2 = lppop->firstItem;
while (lpitem != NULL) { 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 * FindMenuItem
*/ */
@ -1844,7 +1867,7 @@ BOOL TrackPopupMenu(HMENU hMenu, WORD wFlags, short x, short y,
} }
} }
else { else {
ShowWindow(lppop->hWnd, SW_SHOW); ShowWindow(lppop->hWnd, SW_SHOWNOACTIVATE);
} }
if (!lppop->BarFlag) { if (!lppop->BarFlag) {
PopupMenuCalcSize(lppop->hWnd); PopupMenuCalcSize(lppop->hWnd);
@ -1853,7 +1876,7 @@ BOOL TrackPopupMenu(HMENU hMenu, WORD wFlags, short x, short y,
x, y, lppop->Width, lppop->Height); x, y, lppop->Width, lppop->Height);
#endif #endif
SetWindowPos(lppop->hWnd, 0, x, y, lppop->Width + 2, lppop->Height, SetWindowPos(lppop->hWnd, 0, x, y, lppop->Width + 2, lppop->Height,
SWP_NOZORDER); SWP_NOACTIVATE | SWP_NOZORDER);
} }
SetFocus(lppop->hWnd); SetFocus(lppop->hWnd);
if (!MenuHasFocus) { if (!MenuHasFocus) {
@ -2208,7 +2231,7 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
#endif #endif
if (GetCapture() == hWnd) ReleaseCapture(); if (GetCapture() == hWnd) ReleaseCapture();
if (wndPtr->window != 0) { 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; */ /* if (!IsWindowVisible(hWnd)) flags |= SWP_NOREDRAW; */
flags |= SWP_NOREDRAW; flags |= SWP_NOREDRAW;
if (hMenu == 0) { if (hMenu == 0) {

View File

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

View File

@ -3,10 +3,16 @@
MODULE = if1632 MODULE = if1632
#ifdef WINELIB
SRCS = \
callback.c \
relay.c
#else
SRCS = \ SRCS = \
call.S \ call.S \
callback.c \ callback.c \
relay.c relay.c
#endif
DLLOBJS = \ DLLOBJS = \
dll_gdi.o \ dll_gdi.o \
@ -23,6 +29,10 @@ DLLOBJS = \
dll_win87em.o \ dll_win87em.o \
dll_winsock.o dll_winsock.o
#ifdef WINELIB
DLLOBJS=
#endif
OBJS1= $(SRCS:.S=.o) OBJS1= $(SRCS:.S=.o)
#ifndef NewBuild #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 RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
@ -324,3 +325,4 @@ void Throw (LPCATCHBUF cbuf, int val)
#endif #endif
longjmp (sb -> buffer, val); longjmp (sb -> buffer, val);
} }
#endif /* !WINELIB */

View File

@ -273,7 +273,7 @@ length 490
CreateRoundRectRgn(1 2 3 4 5 6) CreateRoundRectRgn(1 2 3 4 5 6)
445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2) 445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
#449 pascal DEVICECOLORMATCH #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) 451 pascal CreatePolyPolygonRgn(ptr ptr word word)
CreatePolyPolygonRgn(1 2 3 4) CreatePolyPolygonRgn(1 2 3 4)
#452 pascal GDISEEGDIDO #452 pascal GDISEEGDIDO

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,8 @@ typedef struct
{ {
HBRUSH hbrushPattern; HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper; HBITMAP hbitmapWallPaper;
SIZE bitmapSize;
BOOL fTileWallPaper;
} DESKTOPINFO; } DESKTOPINFO;
extern BOOL DESKTOP_SetPattern(char *pattern ); 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 rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
typedef struct { BYTE rgbtBlue, rgbtGreen, rgbtRed; } RGBTRIPLE; 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 typedef struct tagBITMAPINFOHEADER
{ {
DWORD biSize; 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,GetCharWidth,HDC,a,WORD,b,WORD,c,LPINT,d)
Fd(BOOL,HiliteMenuItem,HWND,a,HMENU,b,WORD,c,WORD,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,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,PostAppMessage,HANDLE,a,WORD,b,WORD,c,LONG,d)
Fd(BOOL,RedrawWindow,HWND,a,LPRECT,b,HRGN,c,UINT,d) Fd(BOOL,RedrawWindow,HWND,a,LPRECT,b,HRGN,c,UINT,d)
Fd(BOOL,SetBitmapDimensionEx,HBITMAP,a,short,b,short,c,LPSIZE,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) 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) 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 */ #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.contents = contents;
ldt_info.read_exec_only = read_only_flag; ldt_info.read_exec_only = read_only_flag;
ldt_info.limit_in_pages = limit_in_pages_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)); return modify_ldt(1, &ldt_info, sizeof(ldt_info));
#endif #endif

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
* *
* Copyright 1994 Martin Ayotte * Copyright 1994 Martin Ayotte
*/ */
#ifndef WINELIB
#define DEBUG_MCIWAVE #define DEBUG_MCIWAVE
static char Copyright[] = "Copyright Martin Ayotte, 1994"; 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; StructureNotifyMask;
win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow ); 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), rootWindow = XCreateWindow( display, DefaultRootWindow(display),
desktopX, desktopY, width, height, 0, desktopX, desktopY, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent, CopyFromParent, InputOutput, CopyFromParent,
CWEventMask | CWCursor | CWEventMask | CWCursor, &win_attr );
CWBackingStore, &win_attr );
/* Set window manager properties */ /* Set window manager properties */

View File

@ -3,7 +3,7 @@
* *
* Copyright 1994 Martin Ayotte * Copyright 1994 Martin Ayotte
*/ */
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994"; 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 * Copyright 1994 Martin Ayotte
*/ */
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "stdio.h" #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 * Copyright 1993 Martin Ayotte
*/ */
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "stdio.h" #include "stdio.h"
@ -614,9 +614,14 @@ DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS lpParms)
printf("MCI_OPEN // wDeviceID=%04X !\n", lpParms->wDeviceID); printf("MCI_OPEN // wDeviceID=%04X !\n", lpParms->wDeviceID);
switch(dwDevTyp) { switch(dwDevTyp) {
case MCI_DEVTYPE_CD_AUDIO: 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); dwParam, (DWORD)lpParms);
case MCI_DEVTYPE_WAVEFORM_AUDIO: #endif
case MCI_DEVTYPE_WAVEFORM_AUDIO:
return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER, return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER,
dwParam, (DWORD)lpParms); dwParam, (DWORD)lpParms);
case MCI_DEVTYPE_SEQUENCER: 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); printf("mciClose(%u, %08X, %08X)\n", wDevID, dwParam, lpParms);
switch(mciDrv[wDevID].wType) { switch(mciDrv[wDevID].wType) {
case MCI_DEVTYPE_CD_AUDIO: case MCI_DEVTYPE_CD_AUDIO:
#ifndef WINELIB
dwRet = CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, 0, dwRet = CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, 0,
MCI_CLOSE, dwParam, (DWORD)lpParms); MCI_CLOSE, dwParam, (DWORD)lpParms);
#endif
break; break;
case MCI_DEVTYPE_WAVEFORM_AUDIO: case MCI_DEVTYPE_WAVEFORM_AUDIO:
dwRet = WAVE_DriverProc(mciDrv[wDevID].wDeviceID, 0, dwRet = WAVE_DriverProc(mciDrv[wDevID].wDeviceID, 0,
@ -692,8 +699,11 @@ DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
default: default:
switch(mciDrv[wDevID].wType) { switch(mciDrv[wDevID].wType) {
case MCI_DEVTYPE_CD_AUDIO: case MCI_DEVTYPE_CD_AUDIO:
#ifndef WINELIB
return CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, hDrv, return CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
wMsg, dwParam1, dwParam2); wMsg, dwParam1, dwParam2);
#endif
case MCI_DEVTYPE_WAVEFORM_AUDIO: case MCI_DEVTYPE_WAVEFORM_AUDIO:
return WAVE_DriverProc(mciDrv[wDevID].wDeviceID, hDrv, return WAVE_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
wMsg, dwParam1, dwParam2); wMsg, dwParam1, dwParam2);
@ -1984,7 +1994,9 @@ LRESULT WINAPI DrvSendMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lP
DWORD dwDevID = 0; DWORD dwDevID = 0;
printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n", printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n",
hDriver, msg, lParam1, lParam2); hDriver, msg, lParam1, lParam2);
#ifndef WINELIB
return CDAUDIO_DriverProc(dwDevID, hDriver, msg, lParam1, lParam2); 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; return retval;
} }
/***********************************************************************
* GetSysColorBrush (USER.281)
*/
WORD GetSysColorBrush(WORD x)
{
return GetStockObject(GRAY_BRUSH);
}
/*********************************************************************** /***********************************************************************
* BRUSH_DeleteObject * BRUSH_DeleteObject

View File

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

View File

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

View File

@ -8,6 +8,7 @@ _WinMain (int argc, char *argv [])
{ {
int ret_val; int ret_val;
char filename [4096]; char filename [4096];
HANDLE hTaskMain;
GetPrivateProfileString("wine", "SystemResources", "sysres.dll", GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename), WINE_INI); filename, sizeof(filename), WINE_INI);
@ -18,6 +19,7 @@ _WinMain (int argc, char *argv [])
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes); printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
USER_InitApp (hSysRes); USER_InitApp (hSysRes);
hTaskMain = CreateNewTask (1); /* This is not correct */
ret_val = WinMain (1, /* hInstance */ ret_val = WinMain (1, /* hInstance */
0, /* hPrevInstance */ 0, /* hPrevInstance */
"", /* lpszCmdParam */ "", /* 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_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt ); extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam ); 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 void NC_TrackSysMenu( HWND hwnd ); /* menu.c */
extern BOOL ActivateMenuBarFocus(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 ); if (wParam) SetFocus( hwnd );
break; break;
case WM_WINDOWPOSCHANGING:
return WINPOS_HandleWindowPosChanging( (WINDOWPOS *)lParam );
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
{ {
WINDOWPOS * winPos = (WINDOWPOS *)lParam; 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, BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
int xstart, int ystart, int xend, int yend, int lines ) int xstart, int ystart, int xend, int yend, int lines )
{ {
int xcenter, ycenter; int xcenter, ycenter, istart_angle, idiff_angle;
double start_angle, end_angle, diff_angle; double start_angle, end_angle;
XPoint points[3]; XPoint points[3];
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) if (!dc)
@ -151,16 +151,15 @@ BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
(double)(xstart-xcenter)*(bottom-top) ); (double)(xstart-xcenter)*(bottom-top) );
end_angle = atan2( (double)(ycenter-yend)*(right-left), end_angle = atan2( (double)(ycenter-yend)*(right-left),
(double)(xend-xcenter)*(bottom-top) ); (double)(xend-xcenter)*(bottom-top) );
diff_angle = end_angle - start_angle; istart_angle = (int)(start_angle * 180 * 64 / PI);
if (diff_angle < 0.0) diff_angle += 2*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 (left > right) swap_int( &left, &right );
if (top > bottom) swap_int( &top, &bottom ); if (top > bottom) swap_int( &top, &bottom );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc, XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top, dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, right-left-1, bottom-top-1, istart_angle, idiff_angle );
(int)(start_angle * 180 * 64 / PI),
(int)(diff_angle * 180 * 64 / PI) );
if (!lines) return TRUE; if (!lines) return TRUE;
points[0].x = dc->w.DCOrgX + xcenter + (int)(cos(start_angle) * (right-left) / 2); 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; register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); 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) if (!dc)
{ {
@ -666,29 +665,78 @@ BOOL Polygon (HDC hdc, LPPOINT pt, int count)
return TRUE; return TRUE;
} }
if (DC_SetupGCForBrush( dc )) for (i = 0; i < count; i++)
{ {
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
for (i = 0; i < count; i++) points[i].y = dc->w.DCOrgY + YLPTODP( dc, pt[i].y );
{
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 );
}
} }
free ((void *) points); points[count] = points[0];
return (TRUE);
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 * FloodFill_rec -- FloodFill helper function
* *

View File

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

View File

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

View File

@ -24,6 +24,11 @@ extern Colormap COLOR_WinColormap;
extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */ extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */
extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */ extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */
extern void WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); /*winpos.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 HMENU CopySysMenu(); /* menu.c */
extern LONG MDIClientWndProc(HWND hwnd, WORD message, extern LONG MDIClientWndProc(HWND hwnd, WORD message,
WORD wParam, LONG lParam); /* mdi.c */ WORD wParam, LONG lParam); /* mdi.c */
@ -453,19 +458,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
if (!wmcreate) wmcreate = -1; if (!wmcreate) wmcreate = -1;
else else
{ {
/* Send WM_NCCALCSIZE message */ WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NCCALCSIZE_PARAMS *params; NULL, NULL, NULL, &wndPtr->rectClient );
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 );
}
wmcreate = SendMessage( hwnd, WM_CREATE, 0, (LONG)createStruct ); 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) * SetWindowPos (USER.232)
*/ */
@ -449,23 +677,13 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
{ {
WINDOWPOS *winPos; WINDOWPOS *winPos;
HANDLE hmem = 0; HANDLE hmem = 0;
RECT newWindowRect, newClientRect; BOOL res;
WND *wndPtr;
int calcsize_result = 0;
XWindowChanges winChanges;
int changeMask = 0;
#ifdef DEBUG_WIN #ifdef DEBUG_WIN
printf( "SetWindowPos: %04X %d %d,%d %dx%d 0x%x\n", printf( "SetWindowPos: %04X %d %d,%d %dx%d 0x%x\n",
hwnd, hwndInsertAfter, x, y, cx, cy, flags ); hwnd, hwndInsertAfter, x, y, cx, cy, flags );
#endif #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) ))) if (!(hmem = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(WINDOWPOS) )))
return FALSE; return FALSE;
winPos = (WINDOWPOS *)USER_HEAP_ADDR( hmem ); winPos = (WINDOWPOS *)USER_HEAP_ADDR( hmem );
@ -476,183 +694,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
winPos->cx = cx; winPos->cx = cx;
winPos->cy = cy; winPos->cy = cy;
winPos->flags = flags; 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 ); USER_HEAP_FREE( hmem );
return res;
return TRUE;
Abort: /* Fatal error encountered */
if (hmem) USER_HEAP_FREE( hmem );
return FALSE;
} }