1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00
wine/graphics/wing.c
Alexandre Julliard 829fe323e4 Release 980726
Sat Jul 25 19:45:45 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [include/shlobj.h][misc/shell.c][misc/shellord.c][ole/folders.c]
	[shell32.spec]
	Added SHFILEOPSTRUCT32[A|W] and constants, prototypes.
	Implemented SHGetSpecialFolderLocation, SHGetPathFromIDList32[A].
	Many IShellFolder, pidl, shell -related changes.

	SHChangeNotifyRegister, SHChangeNotifyDeregister,
	SHShellFolderView_Message, SHMapPIDLToSystemImageListIndex,
	SHAddToRecentDocs32, SHFileOperation, SHChangeNotify, 
	SHCreateShellFolderViewEx stubs.

Sat Jul 25 17:16:25 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [files/profile.c]
	Fix return value of PROFILE_GetSection().

Fri Jul 24 22:45:19 1998  Ove Kaaven <ovek@isflak.arcticnet.no>

	* [controls/edit.c]
	Killed the modified flag on WM_SETTEXT. Eudora should no longer
	bother asking whether you want to save an unchanged message.

Fri Jul 24 21:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [controls/menu.c]
	Fixed bug in GetMenuState32.
	Doesn't fix Free Agent 32 :((

	* [documentation/debugging]
	Hints added.

	* [files/dos_fs.c] [include/msdos.h] [msdos/int21.c]
	Enhanced DOS device support.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/rasapi16.spec]
	  [relay32/Makefile.in] [relay32/builtin32.c] [relay32/rasapi32.spec]
	Added RASAPI16/32.DLL.

	* [misc/aspi.c] [relay32/wnaspi32.spec]
	Implemented GetASPI32SupportInfo.

	* [multimedia/mmsystem.c]
	Implemented mmTaskCreate.

Fri Jul 24 20:55:31 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/toolbar.c]
	Fixed some bugs and added new features.

	* [controls/tooltips.c][include/tooltips.h]
	Added more messages and started display code.

	* [misc/shell.c][misc/shellord.c][relay32/shell.spec]
	Fixed StrToOleStrN (SHELL32_79) and added OleStrToStrN (SHELL32_78).
	Added some new stubs.

	* [objects/cursoricon.c][misc/imagelist.c][include/windows.h]
	Fixed GetIconInfo and removed the GetIconInfo hack from the
	image list code.

	* [controls/pager.c][include/pager.h][controls/treeview.c]
	  [include/treeview.h]
	Added some messages.

	* [misc/tweak.c][winows/nonclient.c][documentation/win95look]
	Removed unused tweak variables.

	* [documentation/common_controls]
	Updated.

Fri Jul 24 18:36:32 1998  James Moody <013263m@dragon.acadiau.ca>

	* [objects/font.c]
	Fixed a bug in GetTextFace.

Fri Jul 24 17:09:33 1998  Marcus Meissner <marcus@jet.franken.de>

	* [misc/commdlg.c]
	Fixed stacksmashing bug due to invalid specified function
	pointers.

	* [files/dos_fs.c]
	Small change in case handling... be able to create files with
	uppercase in them (like Program Files/).

	* [graphics/ddraw.c]
	XF86DGA support made threadsafe, added more Xlib dependent stuff
	(create Window using CreateWindow(), draw into it). xlib support
	is not satisfying.

	* [scheduler/critsection.c]
	Don't recurse on HeapLock with semaphore id 0.

	* [win32/user32.c][windows/message.c][windows/event.c]
	Moved win32 *Message functions where they belong.
	Removed some potential races between XPending and XNextEvent by
	a bit more locking.

Fri Jul 24 13:58:19 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/pe_image.c] [loader/ne/segment.c]
	Use bogus pointer value instead of NULL for unresolved externals.

	* [memory/selector.c]
	Clear saved_fs on selector free.

	* [msdos/cdrom.c] [configure.in]
	Added check for linux/ucdrom.h.

	* [scheduler/client.c] [server/socket.c]
	Fix for missing struct cmsghdr.
	Attempt to support msg_accrights fd passing (completely untested).

	* [windows/event.c]
	Do not grab the pointer in SetCapture (Win32 behavior).

Tue Jul 21 22:28:13 1998  James Juran  <jrj120@psu.edu>

	* [Make.rules.in]
	Changed $(MKDIR) macro to use -p option (make parent directories
	if they don't already exist.  This fixes an error in 'make install'
	if /usr/local/include doesn't already exist.

Tue Jul 21 13:37:04 Rein Klazes <rklazes@casema.net>

	* [include/heap.h]
	Replaced macro SEGPTR_GET by inline function to avoid *lots*
	of wrong use of this macro.

	* [relay32/comdlg32.spec]
	Corrected GetSaveFileNameW entry.

	* [relay32/advapi32.spec] [win32/advapi.c]
	  [relay32/ole32.spec] [ ole/moniker.c]
	Added stubs for SetFileSecurity[AW] and CreateFileMoniker32

	* [graphics/x11drv/graphics.c]
	Finished implementation of bezier drawing code.

Tue Jul 21 11:00:51 1998  Claus Fischer <cfischer@td2cad.intel.com>

	* [files/drive.c]
	Remove label trailing blanks in GetVolumeInformation32A.

	* [documentation/cdrom-labels]
	Added documentation on how to find out a CD-ROM label.

Sun Jul 19 23:16:41 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [include/windows.h]
	Added some DM_* and DISP_CHANGE_* flags.

	* [relay32/user32.spec] [windows/user.c]
	Added stub for ChangeDisplaySettingA.

	* [ole/ole2nls.c]
	is_punctuation: reuse information from another table.

Sun Jul 19 22:04:46 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in]
	Updated automatic documentation rules.

	* [graphics/path.c] [misc/aspi.c] [misc/ntdll.c] [misc/winsock_dns.c]
	[ole/ole2dsp.c] [relay32/user32.spec]
	Comment format futzing to keep c2man happy.

	* [documentation/README.documentation]
	Updated description of automatic documentation.

Wed Jul 15 19:10:09 1998   Andrew M. Bishop <amb@gedanken.demon.co.uk>

	* [files/profile.c]
	Cache the 10 most recently used .ini files.

Tue May 20 19:20:23 1997  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [misc/commdlg.c]
	Makes PrintDlg32A() return TRUE even if it is an empty
	stub, so most programs are happy and run anyway instead of
	aborting at startup.

	* [graphics/x11drv/xfont.c]
	Increased the maximum font families as (X11) font aliases
	eated up a lot of families causing wine to stop reading fonts.
1998-07-26 14:27:39 +00:00

284 lines
8.2 KiB
C

/*
* WingG support
*
* Started by Robert Pouliot <krynos@clic.net>
*/
#include "ts_xlib.h"
#include "ts_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 "debug.h"
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 = TSXShmQueryExtension(display);
if( s )
{
int i = TSXShmPixmapFormat(display);
if( i == ZPixmap && screenDepth == 8 )
{
__WinGOK = True;
return;
}
}
FIXME(wing,"WinG: no joy.\n");
__WinGOK = False;
}
}
/***********************************************************************
* WinGCreateDC16 (WING.1001)
*/
HDC16 WINAPI WinGCreateDC16(void)
{
__initWinG();
if( __WinGOK > 0 )
return CreateCompatibleDC16(0);
return (HDC16)NULL;
}
/***********************************************************************
* WinGRecommendDIBFormat16 (WING.1002)
*/
BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *fmt)
{
FIXME(wing,"(%p): stub\n", fmt);
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)
{
FIXME(wing,"(%x,%p,%p): empty stub! (expect failure)\n",
winDC, header, bits);
if( __WinGOK > 0 && header )
{
BITMAPINFOHEADER* bmpi = &header->bmiHeader;
FIXME(wing,"bytes=%i,planes=%i,bpp=%i,x=%i,y=%i,rle=0x%08x,size=%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;
TSXShmAttach(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 TSXFreePixmap( 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)
{
FIXME(wing,"(%x,%d,%d,%p): empty stub!\n",hWinGDC,start,num,pColor);
return num;
}
/***********************************************************************
* WinGGetDIBColorTable16 (WING.1005)
*/
UINT16 WINAPI WinGGetDIBColorTable16(HDC16 winDC, UINT16 start,
UINT16 num, RGBQUAD* colors)
{
FIXME(wing,"(%x,%d,%d,%p): empty stub!\n",winDC,start,num,colors);
return 0;
}
/***********************************************************************
* WinGCreateHalfTonePalette16 (WING.1007)
*/
HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void)
{
FIXME(wing,"(void): empty stub!\n");
return 0;
}
/***********************************************************************
* WinGCreateHalfToneBrush16 (WING.1008)
*/
HPALETTE16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col,
WING_DITHER_TYPE type)
{
FIXME(wing,"(...): 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);
}
/***********************************************************************
* 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;
TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
TSXCopyArea( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
xSrc, ySrc, widDest, heiDest, xDest, yDest );
return TRUE;
}