Fri Dec 19 10:50:46 1997 Douglas Ridgway <ridgway@winehq.com> * [Make.rules.in] [Makefile.in] [documentation/Makefile.in] [documentation/README.documentation] First cut at Wine API documentation. No longer install reference manual by default. Wed Dec 17 21:32:23 1997 Andreas Mohr <100.30936@germany.net> * [files/file.c] Fixed GetTempFileName16() to use current path of requested drive as needed. * [if1632/Makefile.in] [if1632/builtin.c] [if1632/dciman32.spec] [if1632/msvfw32.spec] [if1632/tapi32.spec] [if1632/wow32.spec] Added misc DLLs needed by various apps. Wed Dec 17 12:01:50 1997 Morten Eriksen <mortene@sim.no> * [if1632/gdi32.spec] [include/windows.h] [objects/palette.c] Inserted empty stub for CreateHalftonePalette. Tue Dec 16 22:08:06 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk> * [windows/mdi.c] Use VK_TAB instead of VK_SEPARATOR in TranslateMDISysAccel(). * [graphics/metafiledrv/init.c] DeleteDC() on a MetaDC doesn't do anything - it shouldn't. Therefore fix cleanup of MetaDCs in CloseMetaFile(); they now actually get removed from the GDI heap! * [graphics/x11drv/xfont.c] Preserve FO_MATCH_XYINDEP flag in XFONT_MatchFIList(). Should reduce the number of bold-italic matches. Tue Dec 16 20:11:43 1997 Bertho Stultiens <bertho@panter.soci.aau.dk> * [graphics/painting.c] Included an implementation of DrawState * [if1632/thunk.c] Changed many fprintfs into dprintf_thunk * [include/cache.h] [graphics/cache.c] New files to hold cached handles to regulary used GDI object. * [include/windows.h] Added DRAWSTATExx typedefs Added DSS_DEFAULT define for DrawState * [objects/text.c] New implementation of GrayString() * [controls/uitools.c] Implemented DrawFrameControl() functions Changed DrawEdge() behaviour to win95 implementation Mon Dec 15 23:43:01 1997 Martin Boehme <boehme@informatik.mu-luebeck.de> * [graphics/path.c] [include/path.h] [graphics/painting.c] [if1632/gdi32.spec] [include/gdi.h] [include/windows.h] [objects/dc.c] Added preliminary support for GDI paths. * [objects/dc.c] Added DC_Init_DC_INFO function for initializing WIN_DC_INFO structure. * [include/windows.h] [include/gdi.h] [objects/gdiobj.c] Added DEFAULT_GUI_FONT. * [include/winerror.h] Added a few error codes. * [memory/heap.c] Changed HeapAlloc to make the correct calls to SetLastError (now conforms to NT's behaviour). * [windows/win.c] Changed WIN_CreateWindowEx to allow child windows with zero width / height. Sun Dec 14 12:01:07 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/*] [relay32/*] Moved all 32-bit relay stuff to relay32/ * [fi1632/thunk.c] [win32/kernel32.c] Moved all KERNEL32 ordinal functions to kernel32.c * [memory/selector.c] Initialize selectors in AllocSelectorArray. * [tools/build.c] Generate C instead of assembly for Win32 relays. Fixed stack corruption in CallTo16 functions, found by Bertho Stultiens. Sun Dec 14 10:55:00 1997 Andreas Mohr <100.30936@germany.net> * [if1632/Makefile.in] [if1632/builtin.c] [if1632/ole2thk.spec] Added built-in OLE2THK.DLL. * [if1632/toolhelp.spec] [include/toolhelp.h] [memory/selector.c] [misc/toolhelp.c] Added stubs for StackTraceFirst(), StackTraceCSIPFirst(), StackTraceNext(), UTSelectorOffsetToLinear() and UTLinearToSelectorOffset(). Sat Dec 13 17:26:41 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [misc/winsock.c] 32-bit API fixes for reported problems (thanks to Marcus and David). * [graphics/x11drv/xfont.c] Little tweak in point size calculation. * [windows/defwnd.c] [windows/dce.c] [windows/winhelp.c] [windows/winproc.c] [windows/win.c] Bug fixes. Sat Dec 13 16:35:14 1997 Kai Morich <kai.morich@rhein-neckar.netsurf.de> * [files/dos_fs.c] OpenFile with empty filename and OF_PARSE returns current dir. * [misc/commdlg.c] Ignore initial dir if bogus. * [files/file.c] Locking an identic region in a file must not be an error. * [misc/lstr.c] Use wide char ctype functions. Fri Dec 12 23:46:22 1997 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [file/drive.c] First attempt for GetDiskFreeSpaceEx. Fri Dec 12 23:18:41 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [loader/pe_resource.c] Fixed wrongly appearing menus problem (only use default lookups in last resource subtree). * [multimedia/*.c] Added win32 support for time* and joy* lowlevel drivers, (not excessively tested), some misc fixes and cleanups. * [misc/shellord.c][misc/shell.c][ole/folders.c][ole/ifs.c] [include/interfaces.h][include/shlobj.h] Added some more undocumented SHELL32 functions, some shell folder interface stubs added, SHGetMalloc, SHGetDesktopFolder, SHGetSpecialFolderLocation, SHGetPathFromIDList stubs added, IMalloc, IUnknown implemented. * [windows/msgbox.c] Implemented MessageBoxIndirect*, some internal changes. * [if1632/thunk.c] KERNEL_431 implemented. * [objects/gdiobj.c] GetCurrentObject implemented. Wed Dec 3 01:09:17 1997 Gordon Chaffee <chaffee@apu.cs.berkeley.edu> * [objects/dib.c] Fix a couple small DIB problems. * [controls/edit.c] Fix a typo. * [files/dos_fs.c] Try normal readdir in case fs is specified as vfat but isn't. * [files/profile.c] Implementation of WritePrivateProfileSection32A from Uwe Bonnes. * [misc/printdrv.c] OpenPrinter32A stub, helps Word97 start. * [objects/text.c] Fixup implementation of GetTextCharsetInfo. * [scheduler/process.c] Fix environment variable expansion. * [win32/code_page.c] Make MultiByteToWideChar and WideCharToMultiByte conform in return values and error conditions to those in Windows NT 4.0. * [windows/message.c] Fix broadcasting problems in Win32. The Win32 docs say to use HWND_TOPMOST to broadcast to all Win32 Windows. * [memory/virtual.c] [loader/pe_image.c] Do not map in VirtualAlloc if address is specified and space is not available. This is required by Win32. * [include/pen.h] [include/x11drv.h] [objects/dc.c] [objects/pen.c] [graphics/x11drv/pen.c] Support for ExtCreatePen. Tue Dec 2 20:22:06 1997 Morten Welinder <terra@diku.dk> * [*/*.c] [*/*.h] Add lots of prototypes. * [if1632/kernel32.spec][include/windows.h][include/winnt.h] [misc/cpu.c] Define IsProcessorFeaturePresent. * [misc/crtdll.c] (CRTDLL__getcwd): Allocate enough memory for the terminating zero. * [misc/ver.c] Improve check for null component in _find_data[AW]. Plug leaks in VerQueryValue*. * [win32/console.c][if1632/kernel32.spec] Add stubs for GetConsoleCursorInfo32, SetConsoleCursorInfo32. * [windows/message.c][if1632/user32.spec][include/windows.h] Define SendMessageTimeout*. * [graphics/x11drv/xfont.c] Change algorithm of __genericCheckSum to be alignment safe. * [misc/main.c] [misc/winsock.c] [misc/winsock_dns.c] Include winsock.h early to avoid Solaris problem. * [include/windows.h] Undef FSHIFT before we define it. * [rc/winerc.c] Include <fcntl.h> instead of <sys/fcntl.h>. * [files/file.c] Use strerror in FILE_SetDosError if available. * [include/config.h.in] [configure.in] Check for strerror. * [objects/gdiobj.c] Make static font structures aligned. Mon Dec 1 10:10:21 1997 Karl Garrison <karlos@eznet.net> * [win32/console.c] [if1632/kernel32.spec] [include/windows.h] Added stub for GetNumberOfConsoleMouseButtons. Added stub for PeekConsoleInput(A,W). Fixed parameter list for WriteConsole(A,W). GetNumberOfConsoleInputEvents now returns 0 events instead of 1 (since low-level console functions are not yet supported). GetConsoleMode no longer returns ENABLE_WINDOW_INPUT and ENABLE_MOUSE_INPUT since these are not currently implemented.
287 lines
8.4 KiB
C
287 lines
8.4 KiB
C
/*
|
|
* WingG support
|
|
*
|
|
* Started by Robert Pouliot <krynos@clic.net>
|
|
*/
|
|
|
|
#include <X11/Xlib.h>
|
|
#include <X11/extensions/XShm.h>
|
|
#include <sys/types.h>
|
|
#include <sys/ipc.h>
|
|
#ifndef __EMX__
|
|
#include <sys/shm.h>
|
|
#endif
|
|
|
|
#include "windows.h"
|
|
#include "bitmap.h"
|
|
#include "dc.h"
|
|
#include "gdi.h"
|
|
#include "xmalloc.h"
|
|
#include "stddebug.h"
|
|
#include "debug.h"
|
|
|
|
extern void CLIPPING_UpdateGCRegion(DC* );
|
|
|
|
typedef enum WING_DITHER_TYPE
|
|
{
|
|
WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4
|
|
} WING_DITHER_TYPE;
|
|
|
|
static int __WinGOK = -1;
|
|
|
|
/*
|
|
* WinG DIB bitmaps can be selected into DC and then scribbled upon
|
|
* by GDI functions. They can also be changed directly. This gives us
|
|
* three choices
|
|
* - use original WinG 16-bit DLL
|
|
* requires working 16-bit driver interface
|
|
* - implement DIB graphics driver from scratch
|
|
* see wing.zip size
|
|
* - use shared pixmaps
|
|
* won't work with some videocards and/or videomodes
|
|
* 961208 - AK
|
|
*/
|
|
|
|
static BITMAPINFOHEADER __bmpiWinG = { 0, 1, -1, 1, 8, BI_RGB, 1, 0, 0, 0, 0 };
|
|
|
|
static void __initWinG(void)
|
|
{
|
|
if( __WinGOK < 0 )
|
|
{
|
|
Status s = XShmQueryExtension(display);
|
|
if( s )
|
|
{
|
|
int i = XShmPixmapFormat(display);
|
|
if( i == ZPixmap && screenDepth == 8 )
|
|
{
|
|
__WinGOK = True;
|
|
return;
|
|
}
|
|
}
|
|
fprintf(stdnimp,"WinG: no joy.\n");
|
|
__WinGOK = False;
|
|
}
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGCreateDC16 (WING.1001)
|
|
*/
|
|
HDC16 WINAPI WinGCreateDC16(void)
|
|
{
|
|
__initWinG();
|
|
|
|
if( __WinGOK > 0 )
|
|
return CreateCompatibleDC16(NULL);
|
|
return (HDC16)NULL;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGRecommendDIBFormat16 (WING.1002)
|
|
*/
|
|
BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *fmt)
|
|
{
|
|
fprintf(stdnimp,"WinGRecommendDIBFormat()\n");
|
|
|
|
if( __WinGOK > 0 && fmt )
|
|
{
|
|
memcpy(&fmt->bmiHeader, &__bmpiWinG, sizeof(BITMAPINFOHEADER));
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGCreateBitmap16 (WING.1003)
|
|
*/
|
|
HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header,
|
|
void **bits)
|
|
{
|
|
fprintf(stdnimp,"WinGCreateBitmap: empty stub! (expect failure)\n");
|
|
if( __WinGOK > 0 && header )
|
|
{
|
|
BITMAPINFOHEADER* bmpi = &header->bmiHeader;
|
|
|
|
fprintf(stdnimp,"bytes\t=%i\nplanes\t=%i\nbpp\t=%i\nx\t=%i\ny\t=%i\nrle\t=0x%08x\nsize\t=%i\n",
|
|
(int)bmpi->biSize, bmpi->biPlanes, bmpi->biBitCount,
|
|
(int)bmpi->biWidth, (int)bmpi->biHeight, (unsigned)bmpi->biCompression, (int)bmpi->biSizeImage);
|
|
|
|
#ifdef PRELIMINARY_WING16_SUPPORT
|
|
if( bmpi->biPlanes == __bmpiWinG.biPlanes && bmpi->biBitCount == __bmpiWinG.biBitCount &&
|
|
bmpi->biCompression == __bmpiWinG.biCompression && (int)bmpi->biHeight < 0 &&
|
|
bmpi->biWidth )
|
|
{
|
|
unsigned bytes = (bmpi->biWidth + bmpi->biWidth % 2)*(-bmpi->biHeight) * bmpi->biBitCount/8;
|
|
int key = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0x01FF);
|
|
|
|
if( key )
|
|
{
|
|
/* Create the BITMAPOBJ
|
|
*
|
|
* FIXME: A facility to manage shared memory structures
|
|
* which would clean up when Wine crashes. Perhaps a part of
|
|
* IPC code can be adapted. Otherwise this code leaves a lot
|
|
* of junk in shared memory.
|
|
*/
|
|
|
|
HBITMAP16 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
|
|
if (hbitmap)
|
|
{
|
|
__ShmBitmapCtl* p = (__ShmBitmapCtl*)xmalloc(sizeof(__ShmBitmapCtl));
|
|
BITMAPOBJ* bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
|
|
|
|
bmpObjPtr->size.cx = 0;
|
|
bmpObjPtr->size.cy = 0;
|
|
bmpObjPtr->bitmap.bmType = 0;
|
|
bmpObjPtr->bitmap.bmWidth = (INT16)abs(bmpi->biWidth);
|
|
bmpObjPtr->bitmap.bmHeight = -(INT16)bmpi->biHeight;
|
|
bmpObjPtr->bitmap.bmPlanes = (BYTE)bmpi->biPlanes;
|
|
bmpObjPtr->bitmap.bmBitsPixel = (BYTE)bmpi->biBitCount;
|
|
bmpObjPtr->bitmap.bmWidthBytes =
|
|
(INT16)BITMAP_WIDTH_BYTES( bmpObjPtr->bitmap.bmWidth, bmpi->biBitCount );
|
|
bmpObjPtr->bitmap.bmBits = (SEGPTR)p;
|
|
|
|
p->si.shmid = key;
|
|
p->si.shmaddr = shmat(key, NULL, 0);
|
|
p->si.readOnly = False;
|
|
|
|
if( p->si.shmaddr )
|
|
{
|
|
WORD sel = 0;
|
|
|
|
XShmAttach(display, &p->si);
|
|
bmpObjPtr->pixmap = XShmCreatePixmap(display, rootWindow,
|
|
p->si.shmaddr, &p->si, bmpObjPtr->bitmap.bmWidth,
|
|
bmpObjPtr->bitmap.bmHeight, bmpi->biBitCount );
|
|
if( bmpObjPtr->pixmap )
|
|
{
|
|
sel = SELECTOR_AllocBlock( p->si.shmaddr, bytes,
|
|
SEGMENT_DATA, FALSE, FALSE);
|
|
if (sel) p->bits = PTR_SEG_OFF_TO_SEGPTR(sel,0);
|
|
else XFreePixmap( display, bmpObjPtr->pixmap );
|
|
}
|
|
if( !sel )
|
|
{
|
|
shmdt( p->si.shmaddr );
|
|
p->si.shmaddr = NULL;
|
|
}
|
|
}
|
|
if( !p->si.shmaddr )
|
|
{
|
|
GDI_FreeObject( hbitmap );
|
|
hbitmap = 0;
|
|
}
|
|
}
|
|
GDI_HEAP_UNLOCK( hbitmap );
|
|
return hbitmap;
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGGetDIBPointer (WING.1004)
|
|
*/
|
|
SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
|
|
{
|
|
#ifdef PRELIMINARY_WING16_SUPPORT
|
|
BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC );
|
|
|
|
if( bmp )
|
|
{
|
|
__ShmBitmapCtl* p = (__ShmBitmapCtl*)bmp->bitmap.bmBits;
|
|
if( p )
|
|
{
|
|
if( bmpi ) memcpy( bmpi, &__bmpiWinG, sizeof(BITMAPINFOHEADER));
|
|
GDI_HEAP_UNLOCK( hWinGBitmap );
|
|
return p->bits;
|
|
}
|
|
}
|
|
#endif
|
|
return (SEGPTR)NULL;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGSetDIBColorTable (WING.1004)
|
|
*/
|
|
UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hWinGDC, UINT16 start, UINT16 num,
|
|
RGBQUAD* pColor)
|
|
{
|
|
fprintf(stdnimp,"WinGSetDIBColorTable: empty stub!\n");
|
|
return num;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGGetDIBColorTable16 (WING.1005)
|
|
*/
|
|
UINT16 WINAPI WinGGetDIBColorTable16(HDC16 winDC, UINT16 start,
|
|
UINT16 numentry, RGBQUAD* colors)
|
|
{
|
|
fprintf(stdnimp,"WinGGetDIBColorTable: empty stub!\n");
|
|
return 0;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGCreateHalfTonePalette16 (WING.1007)
|
|
*/
|
|
HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void)
|
|
{
|
|
fprintf(stdnimp,"WinGCreateHalfTonePalette: empty stub!\n");
|
|
return 0;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGCreateHalfToneBrush16 (WING.1008)
|
|
*/
|
|
HPALETTE16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col,
|
|
WING_DITHER_TYPE type)
|
|
{
|
|
fprintf(stdnimp,"WinGCreateHalfToneBrush: empty stub!\n");
|
|
return 0;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGStretchBlt16 (WING.1009)
|
|
*/
|
|
BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
|
|
INT16 widDest, INT16 heiDest,
|
|
HDC16 srcDC, INT16 xSrc, INT16 ySrc,
|
|
INT16 widSrc, INT16 heiSrc)
|
|
{
|
|
|
|
return StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, xSrc, ySrc, widSrc, heiSrc, SRCCOPY);
|
|
/* fprintf(stdnimp,"WinGStretchBlt16: empty stub!\n");*/
|
|
/* return 0; */
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WinGBitBlt16 (WING.1010)
|
|
*/
|
|
BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
|
|
INT16 widDest, INT16 heiDest, HDC16 srcDC,
|
|
INT16 xSrc, INT16 ySrc)
|
|
{
|
|
/* destDC is a display DC, srcDC is a memory DC */
|
|
|
|
DC *dcDst, *dcSrc;
|
|
|
|
if (!(dcDst = (DC *)GDI_GetObjPtr( destDC, DC_MAGIC ))) return FALSE;
|
|
if (!(dcSrc = (DC *) GDI_GetObjPtr( srcDC, DC_MAGIC ))) return FALSE;
|
|
|
|
if (dcDst->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion( dcDst );
|
|
|
|
xSrc = dcSrc->w.DCOrgX + XLPTODP( dcSrc, xSrc );
|
|
ySrc = dcSrc->w.DCOrgY + YLPTODP( dcSrc, ySrc );
|
|
xDest = dcDst->w.DCOrgX + XLPTODP( dcDst, xDest );
|
|
yDest = dcDst->w.DCOrgY + YLPTODP( dcDst, yDest );
|
|
widDest = widDest * dcDst->vportExtX / dcDst->wndExtX;
|
|
heiDest = heiDest * dcDst->vportExtY / dcDst->wndExtY;
|
|
|
|
XSetFunction( display, dcDst->u.x.gc, GXcopy );
|
|
XCopyArea( display, dcSrc->u.x.drawable,
|
|
dcDst->u.x.drawable, dcDst->u.x.gc,
|
|
xSrc, ySrc, widDest, heiDest, xDest, yDest );
|
|
return TRUE;
|
|
}
|
|
|