1996-08-24 18:26:35 +00:00
|
|
|
/*
|
|
|
|
* X11 graphics driver initialisation functions
|
|
|
|
*
|
|
|
|
* Copyright 1996 Alexandre Julliard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "x11drv.h"
|
|
|
|
#include "bitmap.h"
|
|
|
|
#include "gdi.h"
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
Release 961215
Sun Dec 15 16:18:15 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/x11drv/bitblt.c]
Fixed BITBLT_StretchImage for partially covered or inverted
bitmaps.
* [objects/dib.c]
Fixed the upside-down bitmap problem.
Sat Dec 14 02:49:57 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/user32.spec]
IsMenu and RemoveMenu added (use existing Win16 functions).
* [include/windows.h]
Corrections to BITMAPINFOHEADER structure.
* [loader/module.c] [if1632/kernel32.spec]
New function GetModuleFileName32A (heavily based on original
Win16 version).
* [loader/pe_image.c]
Hack to allow files with short PE header to be loaded (e.g.
COMDLG32.DLL from Win32s).
* [misc/winsock_async.c]
#if out EIDRM case (not present in FreeBSD).
* [tools/build.c]
Remove trailing comments from .s files generated by build
as these break assembly when not run through pre-processor.
* [windows/graphics.c] [if1632/gdi32.spec]
New function Polyline32 - based on original Polyline. Needs
metafile support adding still.
Fri Dec 13 13:04:06 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [win32/findfile.c] [if1632/kernel.spec]
FindFirstFile32A(): Use dos current directory for drive prefixes.
FindNextFile32A(): Fill in file attribute information.
Implement FindFirstFile16, FindNextFile16, FindClose16.
* [files/drive.c]
GetCurrentDirectory32A - Fix problem with null 3rd character in
string.
Tue Dec 10 14:49:07 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [windows/painting.c][windows/message.c]
Don't use linked lists to call SendMessage(), for it might destroy
the current listentry.
* [misc/registry.c]
Fixed temporary file saving (rename doesn't work across
partitions).
* [files/*.c]
GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*,
GetVolumeInformation32W fixed.
* [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec]
LoadLibrary* updated to new naming std., *32W added.
* [win32/console.c] [include/wincon.h]
Additions for NT commandline executables.
* [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c]
GetUserName32W added, GetComputerName32W added,
GetStartupInfo32W added, GetSystemInfo updated to NT standard.
* [windows/msgbox.c][misc/shell.c][windows/graphics.c]
MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added.
* [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c]
[if1632/ntdll.spec]
Lot of new unicode functions added (needed for NT).
* [loader/pe_image.c]
NtCurrentTeb added.
Tue Dec 10 22:39:33 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/keyboard.c]
Rewrote function TranslateAccelerator().
Mon Dec 9 14:52:13 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [windows/defwnd.c]
DEFWND_SetText(): Set icon name.
Sun Dec 8 23:30:00 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c]
[if1632/winsock.spec]
IPC resource cleanup, bugfixes.
* [windows/dialog.c] [windows/defdlg.c]
More DefDlgProc() fixes.
Sun Dec 8 14:01:42 1996 Vadim Strizhevsky <striv@ms.com>
* [misc/clipboard.c] [objects/font.c] [win32/init.c]
[win32/newfns.c] [windows/graphics.c]
Added a few WIN32 functions which needed to run some win32
accessories. Clock should now work almost as well as 16 bit version.
Add: RegisterClipboardFormat32W GetTextExtentExPoint32*
GetModuleHandleW, DisableThreadLibraryCalls (empty stub),
Polygon32
Fix: Polygon16 possible memory leak on error return.
1996-12-15 19:45:59 +00:00
|
|
|
LPCSTR output, const DEVMODE16* initData );
|
1996-08-24 18:26:35 +00:00
|
|
|
static BOOL32 X11DRV_DeleteDC( DC *dc );
|
|
|
|
|
|
|
|
static const DC_FUNCTIONS X11DRV_Funcs =
|
|
|
|
{
|
|
|
|
NULL, /* pArc */
|
1996-11-17 18:59:11 +00:00
|
|
|
X11DRV_BitBlt, /* pBitBlt */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pChord */
|
|
|
|
X11DRV_CreateDC, /* pCreateDC */
|
|
|
|
X11DRV_DeleteDC, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
|
|
|
NULL, /* pEllipse */
|
|
|
|
NULL, /* pEscape */
|
|
|
|
NULL, /* pExcludeClipRect */
|
|
|
|
NULL, /* pExcludeVisRect */
|
|
|
|
NULL, /* pExtFloodFill */
|
|
|
|
NULL, /* pExtTextOut */
|
|
|
|
NULL, /* pFillRgn */
|
|
|
|
NULL, /* pFloodFill */
|
|
|
|
NULL, /* pFrameRgn */
|
|
|
|
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
|
|
|
|
NULL, /* pGetTextMetrics */
|
|
|
|
NULL, /* pIntersectClipRect */
|
|
|
|
NULL, /* pIntersectVisRect */
|
|
|
|
NULL, /* pInvertRgn */
|
|
|
|
NULL, /* pLineTo */
|
|
|
|
NULL, /* pMoveToEx */
|
|
|
|
NULL, /* pOffsetClipRgn */
|
1996-12-22 18:27:48 +00:00
|
|
|
NULL, /* pOffsetViewportOrg (optional) */
|
|
|
|
NULL, /* pOffsetWindowOrg (optional) */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pPaintRgn */
|
1996-11-17 18:59:11 +00:00
|
|
|
X11DRV_PatBlt, /* pPatBlt */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pPie */
|
|
|
|
NULL, /* pPolyPolygon */
|
|
|
|
NULL, /* pPolygon */
|
|
|
|
NULL, /* pPolyline */
|
|
|
|
NULL, /* pRealizePalette */
|
|
|
|
NULL, /* pRectangle */
|
|
|
|
NULL, /* pRestoreDC */
|
|
|
|
NULL, /* pRoundRect */
|
|
|
|
NULL, /* pSaveDC */
|
1996-12-22 18:27:48 +00:00
|
|
|
NULL, /* pScaleViewportExt (optional) */
|
|
|
|
NULL, /* pScaleWindowExt (optional) */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pSelectClipRgn */
|
|
|
|
NULL, /* pSelectObject */
|
|
|
|
NULL, /* pSelectPalette */
|
|
|
|
NULL, /* pSetBkColor */
|
|
|
|
NULL, /* pSetBkMode */
|
1996-10-23 16:59:13 +00:00
|
|
|
X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pSetDIBitsToDevice */
|
1996-12-22 18:27:48 +00:00
|
|
|
NULL, /* pSetMapMode (optional) */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pSetMapperFlags */
|
|
|
|
NULL, /* pSetPixel */
|
|
|
|
NULL, /* pSetPolyFillMode */
|
|
|
|
NULL, /* pSetROP2 */
|
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
|
|
|
NULL, /* pSetTextColor */
|
|
|
|
NULL, /* pSetTextJustification */
|
1996-12-22 18:27:48 +00:00
|
|
|
NULL, /* pSetViewportExt (optional) */
|
|
|
|
NULL, /* pSetViewportOrg (optional) */
|
|
|
|
NULL, /* pSetWindowExt (optional) */
|
|
|
|
NULL, /* pSetWindowOrg (optional) */
|
1996-11-17 18:59:11 +00:00
|
|
|
X11DRV_StretchBlt, /* pStretchBlt */
|
1996-08-24 18:26:35 +00:00
|
|
|
NULL, /* pStretchDIBits */
|
|
|
|
NULL /* pTextOut */
|
|
|
|
};
|
|
|
|
|
|
|
|
static DeviceCaps X11DRV_DevCaps;
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_Init
|
|
|
|
*/
|
|
|
|
BOOL32 X11DRV_Init(void)
|
|
|
|
{
|
|
|
|
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_CreateDC
|
|
|
|
*/
|
|
|
|
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
Release 961215
Sun Dec 15 16:18:15 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/x11drv/bitblt.c]
Fixed BITBLT_StretchImage for partially covered or inverted
bitmaps.
* [objects/dib.c]
Fixed the upside-down bitmap problem.
Sat Dec 14 02:49:57 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/user32.spec]
IsMenu and RemoveMenu added (use existing Win16 functions).
* [include/windows.h]
Corrections to BITMAPINFOHEADER structure.
* [loader/module.c] [if1632/kernel32.spec]
New function GetModuleFileName32A (heavily based on original
Win16 version).
* [loader/pe_image.c]
Hack to allow files with short PE header to be loaded (e.g.
COMDLG32.DLL from Win32s).
* [misc/winsock_async.c]
#if out EIDRM case (not present in FreeBSD).
* [tools/build.c]
Remove trailing comments from .s files generated by build
as these break assembly when not run through pre-processor.
* [windows/graphics.c] [if1632/gdi32.spec]
New function Polyline32 - based on original Polyline. Needs
metafile support adding still.
Fri Dec 13 13:04:06 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [win32/findfile.c] [if1632/kernel.spec]
FindFirstFile32A(): Use dos current directory for drive prefixes.
FindNextFile32A(): Fill in file attribute information.
Implement FindFirstFile16, FindNextFile16, FindClose16.
* [files/drive.c]
GetCurrentDirectory32A - Fix problem with null 3rd character in
string.
Tue Dec 10 14:49:07 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [windows/painting.c][windows/message.c]
Don't use linked lists to call SendMessage(), for it might destroy
the current listentry.
* [misc/registry.c]
Fixed temporary file saving (rename doesn't work across
partitions).
* [files/*.c]
GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*,
GetVolumeInformation32W fixed.
* [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec]
LoadLibrary* updated to new naming std., *32W added.
* [win32/console.c] [include/wincon.h]
Additions for NT commandline executables.
* [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c]
GetUserName32W added, GetComputerName32W added,
GetStartupInfo32W added, GetSystemInfo updated to NT standard.
* [windows/msgbox.c][misc/shell.c][windows/graphics.c]
MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added.
* [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c]
[if1632/ntdll.spec]
Lot of new unicode functions added (needed for NT).
* [loader/pe_image.c]
NtCurrentTeb added.
Tue Dec 10 22:39:33 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/keyboard.c]
Rewrote function TranslateAccelerator().
Mon Dec 9 14:52:13 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [windows/defwnd.c]
DEFWND_SetText(): Set icon name.
Sun Dec 8 23:30:00 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c]
[if1632/winsock.spec]
IPC resource cleanup, bugfixes.
* [windows/dialog.c] [windows/defdlg.c]
More DefDlgProc() fixes.
Sun Dec 8 14:01:42 1996 Vadim Strizhevsky <striv@ms.com>
* [misc/clipboard.c] [objects/font.c] [win32/init.c]
[win32/newfns.c] [windows/graphics.c]
Added a few WIN32 functions which needed to run some win32
accessories. Clock should now work almost as well as 16 bit version.
Add: RegisterClipboardFormat32W GetTextExtentExPoint32*
GetModuleHandleW, DisableThreadLibraryCalls (empty stub),
Polygon32
Fix: Polygon16 possible memory leak on error return.
1996-12-15 19:45:59 +00:00
|
|
|
LPCSTR output, const DEVMODE16* initData )
|
1996-08-24 18:26:35 +00:00
|
|
|
{
|
|
|
|
X11DRV_PDEVICE *physDev;
|
|
|
|
|
|
|
|
if (!X11DRV_DevCaps.version) DC_FillDevCaps( &X11DRV_DevCaps );
|
|
|
|
|
|
|
|
physDev = &dc->u.x; /* for now */
|
|
|
|
|
|
|
|
memset( physDev, 0, sizeof(*physDev) );
|
|
|
|
dc->physDev = physDev;
|
|
|
|
dc->w.devCaps = &X11DRV_DevCaps;
|
|
|
|
if (dc->w.flags & DC_MEMORY)
|
|
|
|
{
|
|
|
|
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( dc->w.hBitmap,
|
|
|
|
BITMAP_MAGIC );
|
|
|
|
physDev->drawable = bmp->pixmap;
|
|
|
|
physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
|
|
|
|
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
|
1996-11-02 14:24:07 +00:00
|
|
|
dc->w.hVisRgn = CreateRectRgn32( 0, 0, bmp->bitmap.bmWidth,
|
|
|
|
bmp->bitmap.bmHeight );
|
1996-08-24 18:26:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
physDev->drawable = rootWindow;
|
|
|
|
physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
|
|
|
|
dc->w.bitsPerPixel = screenDepth;
|
1996-11-02 14:24:07 +00:00
|
|
|
dc->w.hVisRgn = CreateRectRgn32( 0, 0, screenWidth, screenHeight);
|
1996-08-24 18:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!dc->w.hVisRgn)
|
|
|
|
{
|
|
|
|
XFreeGC( display, physDev->gc );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
XSetGraphicsExposures( display, physDev->gc, False );
|
|
|
|
XSetSubwindowMode( display, physDev->gc, IncludeInferiors );
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_DeleteDC
|
|
|
|
*/
|
|
|
|
static BOOL32 X11DRV_DeleteDC( DC *dc )
|
|
|
|
{
|
|
|
|
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
|
|
|
XFreeGC( display, physDev->gc );
|
|
|
|
return TRUE;
|
|
|
|
}
|