Merge remote-tracking branch 'ajax/xwin'
This commit is contained in:
commit
de55aafa8f
|
@ -2208,8 +2208,6 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
|
||||||
AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
|
AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
|
||||||
AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
|
AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
|
||||||
AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$AIGLX" = xyes])
|
AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$AIGLX" = xyes])
|
||||||
AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
|
|
||||||
AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
|
|
||||||
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
|
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
|
||||||
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
|
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
|
||||||
|
|
||||||
|
|
|
@ -735,12 +735,6 @@ winUseMsg(void)
|
||||||
"\t\t1 - Shadow GDI\n"
|
"\t\t1 - Shadow GDI\n"
|
||||||
"\t\t2 - Shadow DirectDraw\n"
|
"\t\t2 - Shadow DirectDraw\n"
|
||||||
"\t\t4 - Shadow DirectDraw4 Non-Locking\n"
|
"\t\t4 - Shadow DirectDraw4 Non-Locking\n"
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
"\t\t8 - Primary DirectDraw - obsolete\n"
|
|
||||||
#endif
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
"\t\t16 - Native GDI - experimental\n"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
|
ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
|
||||||
|
|
|
@ -37,27 +37,6 @@ DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM
|
||||||
MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la
|
MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if XWIN_NATIVEGDI
|
|
||||||
SRCS_NATIVEGDI = \
|
|
||||||
winclip.c \
|
|
||||||
winfillsp.c \
|
|
||||||
winfont.c \
|
|
||||||
wingc.c \
|
|
||||||
wingetsp.c \
|
|
||||||
winnativegdi.c \
|
|
||||||
winpixmap.c \
|
|
||||||
winpolyline.c \
|
|
||||||
winrop.c \
|
|
||||||
winsetsp.c
|
|
||||||
DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
|
|
||||||
endif
|
|
||||||
|
|
||||||
if XWIN_PRIMARYFB
|
|
||||||
SRCS_PRIMARYFB = \
|
|
||||||
winpfbdd.c
|
|
||||||
DEFS_PRIMARYFB = -DXWIN_PRIMARYFB
|
|
||||||
endif
|
|
||||||
|
|
||||||
if XWIN_RANDR
|
if XWIN_RANDR
|
||||||
SRCS_RANDR = \
|
SRCS_RANDR = \
|
||||||
winrandr.c
|
winrandr.c
|
||||||
|
|
|
@ -261,10 +261,6 @@ Shadow GDI
|
||||||
Shadow DirectDraw
|
Shadow DirectDraw
|
||||||
.IP 4 4
|
.IP 4 4
|
||||||
Shadow DirectDraw Non-Locking
|
Shadow DirectDraw Non-Locking
|
||||||
.IP 8 4
|
|
||||||
Primary DirectDraw (unsupported, obsolete)
|
|
||||||
.IP 16 4
|
|
||||||
Native GDI (unsupported, experimental and barely functional)
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SH FULLSCREEN OPTIONS
|
.SH FULLSCREEN OPTIONS
|
||||||
|
|
182
hw/xwin/win.h
182
hw/xwin/win.h
|
@ -103,12 +103,6 @@
|
||||||
#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
|
#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
|
||||||
#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
|
#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
|
||||||
#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
|
#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
|
|
||||||
#endif
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
#define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define AltMapIndex Mod1MapIndex
|
#define AltMapIndex Mod1MapIndex
|
||||||
#define NumLockMapIndex Mod2MapIndex
|
#define NumLockMapIndex Mod2MapIndex
|
||||||
|
@ -304,12 +298,6 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin);
|
||||||
|
|
||||||
typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
|
typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* Typedefs for native GDI wrappers */
|
|
||||||
typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
|
|
||||||
typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GC (graphics context) privates
|
* GC (graphics context) privates
|
||||||
*/
|
*/
|
||||||
|
@ -582,12 +570,6 @@ typedef struct _winPrivScreenRec {
|
||||||
SetShapeProcPtr SetShape;
|
SetShapeProcPtr SetShape;
|
||||||
|
|
||||||
winCursorRec cursor;
|
winCursorRec cursor;
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
RealizeFontPtr RealizeFont;
|
|
||||||
UnrealizeFontPtr UnrealizeFont;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} winPrivScreenRec;
|
} winPrivScreenRec;
|
||||||
|
|
||||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||||
|
@ -775,15 +757,6 @@ void
|
||||||
winBlockHandler(ScreenPtr pScreen,
|
winBlockHandler(ScreenPtr pScreen,
|
||||||
void *pTimeout, void *pReadMask);
|
void *pTimeout, void *pReadMask);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winclip.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
winPixmapToRegionNativeGDI(PixmapPtr pPix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_CLIPBOARD
|
#ifdef XWIN_CLIPBOARD
|
||||||
/*
|
/*
|
||||||
* winclipboardinit.c
|
* winclipboardinit.c
|
||||||
|
@ -859,52 +832,6 @@ void
|
||||||
winMessageBoxF(const char *pszError, UINT uType, ...)
|
winMessageBoxF(const char *pszError, UINT uType, ...)
|
||||||
_X_ATTRIBUTE_PRINTF(1, 3);
|
_X_ATTRIBUTE_PRINTF(1, 3);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winfillsp.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
||||||
winFillSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC,
|
|
||||||
int nSpans,
|
|
||||||
DDXPointPtr pPoints, int *pWidths, int fSorted);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winfont.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* wingc.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winCreateGCNativeGDI(GCPtr pGC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* wingetsp.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
||||||
winGetSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
int wMax,
|
|
||||||
DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* winglobals.c
|
* winglobals.c
|
||||||
*/
|
*/
|
||||||
|
@ -956,23 +883,12 @@ void
|
||||||
* winmisc.c
|
* winmisc.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
void
|
|
||||||
|
|
||||||
winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
|
|
||||||
unsigned short *pHeight, ScreenPtr pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CARD8
|
CARD8
|
||||||
winCountBits(DWORD dw);
|
winCountBits(DWORD dw);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
|
winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
BOOL winPaintBackground(HWND hwnd, COLORREF colorref);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* winmouse.c
|
* winmouse.c
|
||||||
*/
|
*/
|
||||||
|
@ -994,60 +910,6 @@ winMouseButtonsHandle(ScreenPtr pScreen,
|
||||||
void
|
void
|
||||||
winEnqueueMotion(int x, int y);
|
winEnqueueMotion(int x, int y);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winnativegdi.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
HBITMAP
|
|
||||||
winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
|
|
||||||
BYTE ** ppbBits, BITMAPINFO ** ppbmi);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winSetEngineFunctionsNativeGDI(ScreenPtr pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
/*
|
|
||||||
* winpfbddd.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winpixmap.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
|
|
||||||
winCreatePixmapNativeGDI(ScreenPtr pScreen, int width, int height, int depth,
|
|
||||||
unsigned usage_hint);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winDestroyPixmapNativeGDI(PixmapPtr pPixmap);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
|
|
||||||
winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
|
|
||||||
int iWidth, int iHeight,
|
|
||||||
int iDepth,
|
|
||||||
int iBitsPerPixel,
|
|
||||||
int devKind, void *pPixData);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winpolyline.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
||||||
winPolyLineNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* winscrinit.c
|
* winscrinit.c
|
||||||
*/
|
*/
|
||||||
|
@ -1058,26 +920,6 @@ Bool
|
||||||
Bool
|
Bool
|
||||||
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
|
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
|
||||||
|
|
||||||
#if defined(XWIN_NATIVEGDI)
|
|
||||||
Bool
|
|
||||||
|
|
||||||
winFinishScreenInitNativeGDI(int i,
|
|
||||||
ScreenPtr pScreen, int argc, char **argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* winsetsp.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
||||||
winSetSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC,
|
|
||||||
char *pSrc,
|
|
||||||
DDXPointPtr pPoints, int *pWidth, int nSpans, int fSorted);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* winshaddd.c
|
* winshaddd.c
|
||||||
*/
|
*/
|
||||||
|
@ -1112,30 +954,6 @@ winWakeupHandler(ScreenPtr pScreen,
|
||||||
* winwindow.c
|
* winwindow.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
Bool
|
|
||||||
winCreateWindowNativeGDI(WindowPtr pWin);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winDestroyWindowNativeGDI(WindowPtr pWin);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winPositionWindowNativeGDI(WindowPtr pWin, int x, int y);
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
||||||
winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winUnmapWindowNativeGDI(WindowPtr pWindow);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winMapWindowNativeGDI(WindowPtr pWindow);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
winCreateWindowRootless(WindowPtr pWindow);
|
winCreateWindowRootless(WindowPtr pWindow);
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of Harold L Hunt II
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from Harold L Hunt II.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/* Look at mfb/mfbclip.c for sample implementation */
|
|
||||||
RegionPtr
|
|
||||||
winPixmapToRegionNativeGDI(PixmapPtr pPix)
|
|
||||||
{
|
|
||||||
ErrorF("winPixmapToRegion()\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
|
@ -110,20 +110,8 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
|
||||||
GetModuleHandle(NULL), /* Instance handle */
|
GetModuleHandle(NULL), /* Instance handle */
|
||||||
pScreenPriv); /* ScreenPrivates */
|
pScreenPriv); /* ScreenPrivates */
|
||||||
|
|
||||||
/* Branch on the server engine */
|
/* Hide the window */
|
||||||
switch (pScreenInfo->dwEngine) {
|
ShowWindow(*phwnd, SW_SHOWNORMAL);
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
case WIN_SERVER_SHADOW_GDI:
|
|
||||||
/* Show the window */
|
|
||||||
ShowWindow(*phwnd, SW_SHOWMAXIMIZED);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
|
||||||
/* Hide the window */
|
|
||||||
ShowWindow(*phwnd, SW_SHOWNORMAL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send first paint message */
|
/* Send first paint message */
|
||||||
UpdateWindow(*phwnd);
|
UpdateWindow(*phwnd);
|
||||||
|
@ -474,12 +462,6 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* Paint window background blue */
|
|
||||||
if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
|
|
||||||
winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
winDebug("winCreateBoundingWindowWindowed - Returning\n");
|
winDebug("winCreateBoundingWindowWindowed - Returning\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -59,10 +59,6 @@ winDetectSupportedEngines(void)
|
||||||
/* Initialize the engine support flags */
|
/* Initialize the engine support flags */
|
||||||
g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
|
g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get operating system version information */
|
/* Get operating system version information */
|
||||||
ZeroMemory(&osvi, sizeof(osvi));
|
ZeroMemory(&osvi, sizeof(osvi));
|
||||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||||
|
@ -94,15 +90,6 @@ winDetectSupportedEngines(void)
|
||||||
winErrorFVerb(2,
|
winErrorFVerb(2,
|
||||||
"winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
|
"winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
|
||||||
g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
|
g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
|
||||||
|
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
/* Allow PrimaryDD engine if NT */
|
|
||||||
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
|
||||||
g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
|
|
||||||
winErrorFVerb(2,
|
|
||||||
"winDetectSupportedEngines - Windows NT, allowing PrimaryDD\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to query for DirectDraw4 interface */
|
/* Try to query for DirectDraw4 interface */
|
||||||
|
@ -206,16 +193,6 @@ winSetEngine(ScreenPtr pScreen)
|
||||||
case WIN_SERVER_SHADOW_DDNL:
|
case WIN_SERVER_SHADOW_DDNL:
|
||||||
winSetEngineFunctionsShadowDDNL(pScreen);
|
winSetEngineFunctionsShadowDDNL(pScreen);
|
||||||
break;
|
break;
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
case WIN_SERVER_PRIMARY_DD:
|
|
||||||
winSetEngineFunctionsPrimaryDD(pScreen);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
case WIN_SERVER_NATIVE_GDI:
|
|
||||||
winSetEngineFunctionsNativeGDI(pScreen);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
FatalError("winSetEngine - Invalid engine type\n");
|
FatalError("winSetEngine - Invalid engine type\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,842 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
* Alan Hourihane <alanh@fairlite.demon.co.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
extern void ROP16(HDC hdc, int rop);
|
|
||||||
|
|
||||||
#define TRANSLATE_COLOR(color) \
|
|
||||||
{ \
|
|
||||||
if (pDrawable->depth == 15) \
|
|
||||||
color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) | \
|
|
||||||
((color & 0xF800) >> 8); \
|
|
||||||
else if (pDrawable->depth == 16) \
|
|
||||||
color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) | \
|
|
||||||
((color & 0xF800) >> 8); \
|
|
||||||
else if (pDrawable->depth == 24 || pDrawable->depth == 32) \
|
|
||||||
color = ((color & 0xFF) << 16) | (color & 0xFF00) | \
|
|
||||||
((color & 0xFF0000) >> 16); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 54 */
|
|
||||||
void
|
|
||||||
winFillSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC,
|
|
||||||
int iSpans,
|
|
||||||
DDXPointPtr pPoints, int *piWidths, int fSorted)
|
|
||||||
{
|
|
||||||
winGCPriv(pGC);
|
|
||||||
HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL;
|
|
||||||
HBITMAP hPenOrig = NULL;
|
|
||||||
HBITMAP hBitmap = NULL;
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
winPrivPixmapPtr pPixmapPriv = NULL;
|
|
||||||
PixmapPtr pStipple = NULL;
|
|
||||||
winPrivPixmapPtr pStipplePriv = NULL;
|
|
||||||
PixmapPtr pTile = NULL;
|
|
||||||
winPrivPixmapPtr pTilePriv = NULL;
|
|
||||||
HDC hdcStipple = NULL, hdcTile = NULL;
|
|
||||||
HPEN hPen = NULL;
|
|
||||||
int iX;
|
|
||||||
int fg, bg;
|
|
||||||
RegionPtr pClip = pGC->pCompositeClip;
|
|
||||||
BoxPtr pextent, pbox;
|
|
||||||
int nbox;
|
|
||||||
int extentX1, extentX2, extentY1, extentY2;
|
|
||||||
int fullX1, fullX2, fullY1;
|
|
||||||
HRGN hrgn = NULL, combined = NULL;
|
|
||||||
|
|
||||||
nbox = RegionNumRects(pClip);
|
|
||||||
pbox = RegionRects(pClip);
|
|
||||||
|
|
||||||
if (!nbox)
|
|
||||||
return;
|
|
||||||
|
|
||||||
combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
|
|
||||||
nbox--;
|
|
||||||
pbox++;
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
|
|
||||||
CombineRgn(combined, combined, hrgn, RGN_OR);
|
|
||||||
DeleteObject(hrgn);
|
|
||||||
hrgn = NULL;
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
pextent = RegionExtents(pClip);
|
|
||||||
extentX1 = pextent->x1;
|
|
||||||
extentY1 = pextent->y1;
|
|
||||||
extentX2 = pextent->x2;
|
|
||||||
extentY2 = pextent->y2;
|
|
||||||
|
|
||||||
/* Branch on the type of drawable we have */
|
|
||||||
switch (pDrawable->type) {
|
|
||||||
case DRAWABLE_PIXMAP:
|
|
||||||
|
|
||||||
SelectClipRgn(pGCPriv->hdcMem, combined);
|
|
||||||
DeleteObject(combined);
|
|
||||||
combined = NULL;
|
|
||||||
|
|
||||||
/* Get a pixmap pointer from the drawable pointer, and fetch privates */
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
pPixmapPriv = winGetPixmapPriv(pPixmap);
|
|
||||||
|
|
||||||
/* Select the drawable pixmap into memory hdc */
|
|
||||||
hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
|
|
||||||
if (hbmpOrig == NULL)
|
|
||||||
FatalError("winFillSpans - DRAWABLE_PIXMAP - "
|
|
||||||
"SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
|
|
||||||
"%p\n", pPixmapPriv->hBitmap);
|
|
||||||
|
|
||||||
/* Branch on the fill type */
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillSolid:
|
|
||||||
|
|
||||||
ROP16(pGCPriv->hdcMem, pGC->alu);
|
|
||||||
|
|
||||||
if (pDrawable->depth == 1) {
|
|
||||||
if (pGC->fgPixel == 0)
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdcMem,
|
|
||||||
GetStockObject(BLACK_PEN));
|
|
||||||
else
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdcMem,
|
|
||||||
GetStockObject(WHITE_PEN));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
hPen = CreatePen(PS_SOLID, 0, fg);
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdcMem, hPen);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MoveToEx(pGCPriv->hdcMem, fullX1, fullY1, NULL);
|
|
||||||
LineTo(pGCPriv->hdcMem, fullX2, fullY1);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetROP2(pGCPriv->hdcMem, R2_COPYPEN);
|
|
||||||
|
|
||||||
/* Give back the Pen */
|
|
||||||
SelectObject(pGCPriv->hdcMem, hPenOrig);
|
|
||||||
|
|
||||||
if (pDrawable->depth != 1)
|
|
||||||
DeleteObject(hPen);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
|
|
||||||
pStipple = pGC->stipple;
|
|
||||||
pStipplePriv = winGetPixmapPriv(pStipple);
|
|
||||||
|
|
||||||
/* Create a device-dependent bitmap for the stipple */
|
|
||||||
hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
|
|
||||||
(BITMAPINFOHEADER *) pStipplePriv->pbmih,
|
|
||||||
CBM_INIT,
|
|
||||||
pStipplePriv->pbBits,
|
|
||||||
(BITMAPINFO *) pStipplePriv->pbmih,
|
|
||||||
DIB_RGB_COLORS);
|
|
||||||
|
|
||||||
/* Create a memory DC to hold the stipple */
|
|
||||||
hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
|
|
||||||
|
|
||||||
/* Select the stipple bitmap into the stipple DC */
|
|
||||||
hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
|
|
||||||
if (hbmpOrigStipple == NULL)
|
|
||||||
FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
|
|
||||||
"SelectObject () failed on hbmpOrigStipple\n");
|
|
||||||
|
|
||||||
/* Make a temporary copy of the foreground and background colors */
|
|
||||||
bg = pGC->bgPixel;
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
|
|
||||||
/* Translate the depth-dependent colors to Win32 COLORREFs */
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
TRANSLATE_COLOR(bg);
|
|
||||||
SetTextColor(pGCPriv->hdcMem, fg);
|
|
||||||
SetBkColor(pGCPriv->hdcMem, bg);
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pStipple->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pStipple->drawable.width) -
|
|
||||||
pStipple->drawable.width)) %
|
|
||||||
pStipple->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pStipple->drawable.width)
|
|
||||||
width = pStipple->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdcMem,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
hdcStipple,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pStipple->drawable.height) -
|
|
||||||
pStipple->drawable.height)) %
|
|
||||||
pStipple->drawable.height, g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the stipple HDC */
|
|
||||||
SelectObject(hdcStipple, hbmpOrigStipple);
|
|
||||||
DeleteDC(hdcStipple);
|
|
||||||
|
|
||||||
/* Delete the device dependent stipple bitmap */
|
|
||||||
DeleteObject(hBitmap);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case FillStippled:
|
|
||||||
|
|
||||||
pStipple = pGC->stipple;
|
|
||||||
pStipplePriv = winGetPixmapPriv(pStipple);
|
|
||||||
|
|
||||||
/* Create a device-dependent bitmap for the stipple */
|
|
||||||
hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
|
|
||||||
(BITMAPINFOHEADER *) pStipplePriv->pbmih,
|
|
||||||
CBM_INIT,
|
|
||||||
pStipplePriv->pbBits,
|
|
||||||
(BITMAPINFO *) pStipplePriv->pbmih,
|
|
||||||
DIB_RGB_COLORS);
|
|
||||||
|
|
||||||
/* Create a memory DC to hold the stipple */
|
|
||||||
hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
|
|
||||||
|
|
||||||
/* Select the stipple bitmap into the stipple DC */
|
|
||||||
hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
|
|
||||||
if (hbmpOrigStipple == NULL)
|
|
||||||
FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
|
|
||||||
"SelectObject () failed on hbmpOrigStipple\n");
|
|
||||||
|
|
||||||
/* Make a temporary copy of the foreground and background colors */
|
|
||||||
bg = pGC->bgPixel;
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
|
|
||||||
/* Translate the depth-dependent colors to Win32 COLORREFs */
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
TRANSLATE_COLOR(bg);
|
|
||||||
|
|
||||||
/* this is fudgy, we should only invert on the last one
|
|
||||||
* We need to get the black/white pixels right in the
|
|
||||||
* colormap. But yeah ! it's working..
|
|
||||||
*/
|
|
||||||
if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
|
|
||||||
SetTextColor(pGCPriv->hdcMem, fg);
|
|
||||||
SetBkColor(pGCPriv->hdcMem, bg);
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
}
|
|
||||||
else if (pGC->bgPixel == -1) {
|
|
||||||
SetTextColor(pGCPriv->hdcMem, fg);
|
|
||||||
SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
}
|
|
||||||
else if (pGC->fgPixel == -1) {
|
|
||||||
SetTextColor(pGCPriv->hdcMem, bg);
|
|
||||||
SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
|
|
||||||
#if 0
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pStipple->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pStipple->drawable.width) -
|
|
||||||
pStipple->drawable.width)) %
|
|
||||||
pStipple->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pStipple->drawable.width)
|
|
||||||
width = pStipple->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdcMem,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
hdcStipple,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pStipple->drawable.height) -
|
|
||||||
pStipple->drawable.height)) %
|
|
||||||
pStipple->drawable.height, g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the stipple HDC */
|
|
||||||
SelectObject(hdcStipple, hbmpOrigStipple);
|
|
||||||
DeleteDC(hdcStipple);
|
|
||||||
|
|
||||||
/* Delete the device dependent stipple bitmap */
|
|
||||||
DeleteObject(hBitmap);
|
|
||||||
|
|
||||||
/* Restore the background mode */
|
|
||||||
SetBkMode(pGCPriv->hdcMem, OPAQUE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillTiled:
|
|
||||||
|
|
||||||
/* Get a pixmap pointer from the tile pointer, and fetch privates */
|
|
||||||
pTile = (PixmapPtr) pGC->tile.pixmap;
|
|
||||||
pTilePriv = winGetPixmapPriv(pTile);
|
|
||||||
|
|
||||||
/* Create a memory DC to hold the tile */
|
|
||||||
hdcTile = CreateCompatibleDC(pGCPriv->hdcMem);
|
|
||||||
|
|
||||||
/* Select the tile into a DC */
|
|
||||||
hbmpOrig = SelectObject(hdcTile, pTilePriv->hBitmap);
|
|
||||||
if (hbmpOrig == NULL)
|
|
||||||
FatalError("winFillSpans - DRAWABLE_PIXMAP - FillTiled - "
|
|
||||||
"SelectObject () failed on pTilePriv->hBitmap\n");
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pTile->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pTile->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pTile->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pTile->drawable.width) -
|
|
||||||
pTile->drawable.width)) % pTile->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pTile->drawable.width)
|
|
||||||
width = pTile->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdcMem,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
hdcTile,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pTile->drawable.height) -
|
|
||||||
pTile->drawable.height)) % pTile->drawable.height,
|
|
||||||
g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Push the tile pixmap out of the memory HDC */
|
|
||||||
SelectObject(hdcTile, hbmpOrig);
|
|
||||||
|
|
||||||
/* Delete the tile */
|
|
||||||
DeleteDC(hdcTile);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset clip region */
|
|
||||||
SelectClipRgn(pGCPriv->hdcMem, NULL);
|
|
||||||
|
|
||||||
/* Push the drawable pixmap out of the GC HDC */
|
|
||||||
SelectObject(pGCPriv->hdcMem, hbmpOrig);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DRAWABLE_WINDOW:
|
|
||||||
|
|
||||||
SelectClipRgn(pGCPriv->hdc, combined);
|
|
||||||
DeleteObject(combined);
|
|
||||||
combined = NULL;
|
|
||||||
|
|
||||||
/* Branch on fill style */
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillSolid:
|
|
||||||
|
|
||||||
ROP16(pGCPriv->hdc, pGC->alu);
|
|
||||||
|
|
||||||
if (pDrawable->depth == 1) {
|
|
||||||
if (pGC->fgPixel == 0)
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdc,
|
|
||||||
GetStockObject(BLACK_PEN));
|
|
||||||
else
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdc,
|
|
||||||
GetStockObject(WHITE_PEN));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
hPen = CreatePen(PS_SOLID, 0, fg);
|
|
||||||
hPenOrig = SelectObject(pGCPriv->hdc, hPen);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MoveToEx(pGCPriv->hdc, fullX1, fullY1, NULL);
|
|
||||||
LineTo(pGCPriv->hdc, fullX2, fullY1);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetROP2(pGCPriv->hdc, R2_COPYPEN);
|
|
||||||
|
|
||||||
/* Give back the Brush */
|
|
||||||
SelectObject(pGCPriv->hdc, hPenOrig);
|
|
||||||
|
|
||||||
if (pDrawable->depth != 1)
|
|
||||||
DeleteObject(hPen);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
|
|
||||||
pStipple = pGC->stipple;
|
|
||||||
pStipplePriv = winGetPixmapPriv(pStipple);
|
|
||||||
|
|
||||||
/* Create a device-dependent bitmap for the stipple */
|
|
||||||
hBitmap = CreateDIBitmap(pGCPriv->hdc,
|
|
||||||
(BITMAPINFOHEADER *) pStipplePriv->pbmih,
|
|
||||||
CBM_INIT,
|
|
||||||
pStipplePriv->pbBits,
|
|
||||||
(BITMAPINFO *) pStipplePriv->pbmih,
|
|
||||||
DIB_RGB_COLORS);
|
|
||||||
|
|
||||||
/* Create a memory DC to hold the stipple */
|
|
||||||
hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
|
|
||||||
|
|
||||||
/* Select the stipple bitmap into the stipple DC */
|
|
||||||
hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
|
|
||||||
if (hbmpOrigStipple == NULL)
|
|
||||||
FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
|
|
||||||
"SelectObject () failed on hbmpOrigStipple\n");
|
|
||||||
|
|
||||||
/* Make a temporary copy of the foreground and background colors */
|
|
||||||
bg = pGC->bgPixel;
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
|
|
||||||
/* Translate the depth-dependent colors to Win32 COLORREFs */
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
TRANSLATE_COLOR(bg);
|
|
||||||
SetTextColor(pGCPriv->hdc, fg);
|
|
||||||
SetBkColor(pGCPriv->hdc, bg);
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pStipple->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pStipple->drawable.width) -
|
|
||||||
pStipple->drawable.width)) %
|
|
||||||
pStipple->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pStipple->drawable.width)
|
|
||||||
width = pStipple->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdc,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
hdcStipple,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pStipple->drawable.height) -
|
|
||||||
pStipple->drawable.height)) %
|
|
||||||
pStipple->drawable.height, g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the stipple HDC */
|
|
||||||
SelectObject(hdcStipple, hbmpOrigStipple);
|
|
||||||
DeleteDC(hdcStipple);
|
|
||||||
|
|
||||||
/* Delete the device dependent stipple bitmap */
|
|
||||||
DeleteObject(hBitmap);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillStippled:
|
|
||||||
pStipple = pGC->stipple;
|
|
||||||
pStipplePriv = winGetPixmapPriv(pStipple);
|
|
||||||
|
|
||||||
/* Create a device-dependent bitmap for the stipple */
|
|
||||||
hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
|
|
||||||
(BITMAPINFOHEADER *) pStipplePriv->pbmih,
|
|
||||||
CBM_INIT,
|
|
||||||
pStipplePriv->pbBits,
|
|
||||||
(BITMAPINFO *) pStipplePriv->pbmih,
|
|
||||||
DIB_RGB_COLORS);
|
|
||||||
|
|
||||||
/* Create a memory DC to hold the stipple */
|
|
||||||
hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
|
|
||||||
|
|
||||||
/* Select the stipple bitmap into the stipple DC */
|
|
||||||
hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
|
|
||||||
if (hbmpOrigStipple == NULL)
|
|
||||||
FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
|
|
||||||
"SelectObject () failed on hbmpOrigStipple\n");
|
|
||||||
|
|
||||||
/* Make a temporary copy of the foreground and background colors */
|
|
||||||
bg = pGC->bgPixel;
|
|
||||||
fg = pGC->fgPixel;
|
|
||||||
|
|
||||||
/* Translate the depth-dependent colors to Win32 COLORREFs */
|
|
||||||
TRANSLATE_COLOR(fg);
|
|
||||||
TRANSLATE_COLOR(bg);
|
|
||||||
|
|
||||||
/* this is fudgy, we should only invert on the last one
|
|
||||||
* We need to get the black/white pixels right in the
|
|
||||||
* colormap. But yeah ! it's working..
|
|
||||||
*/
|
|
||||||
if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
|
|
||||||
SetTextColor(pGCPriv->hdc, fg);
|
|
||||||
SetBkColor(pGCPriv->hdc, bg);
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
}
|
|
||||||
else if (pGC->bgPixel == -1) {
|
|
||||||
SetTextColor(pGCPriv->hdc, fg);
|
|
||||||
SetBkMode(pGCPriv->hdc, TRANSPARENT);
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
}
|
|
||||||
else if (pGC->fgPixel == -1) {
|
|
||||||
SetTextColor(pGCPriv->hdc, bg);
|
|
||||||
SetBkMode(pGCPriv->hdc, TRANSPARENT);
|
|
||||||
#if 0
|
|
||||||
BitBlt(hdcStipple,
|
|
||||||
0, 0,
|
|
||||||
pStipple->drawable.width, pStipple->drawable.height,
|
|
||||||
hdcStipple, 0, 0, 0x330008);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pStipple->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pStipple->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pStipple->drawable.width) -
|
|
||||||
pStipple->drawable.width)) %
|
|
||||||
pStipple->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pStipple->drawable.width)
|
|
||||||
width = pStipple->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdc,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
hdcStipple,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pStipple->drawable.height) -
|
|
||||||
pStipple->drawable.height)) %
|
|
||||||
pStipple->drawable.height, g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the stipple HDC */
|
|
||||||
SelectObject(hdcStipple, hbmpOrigStipple);
|
|
||||||
DeleteDC(hdcStipple);
|
|
||||||
|
|
||||||
/* Delete the device dependent stipple bitmap */
|
|
||||||
DeleteObject(hBitmap);
|
|
||||||
|
|
||||||
/* Restore the background mode */
|
|
||||||
SetBkMode(pGCPriv->hdc, OPAQUE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillTiled:
|
|
||||||
|
|
||||||
/* Get a pixmap pointer from the tile pointer, and fetch privates */
|
|
||||||
pTile = (PixmapPtr) pGC->tile.pixmap;
|
|
||||||
pTilePriv = winGetPixmapPriv(pTile);
|
|
||||||
|
|
||||||
/* Select the tile into a DC */
|
|
||||||
hbmpOrig = SelectObject(pGCPriv->hdcMem, pTilePriv->hBitmap);
|
|
||||||
if (hbmpOrig == NULL)
|
|
||||||
FatalError("winFillSpans - DRAWABLE_WINDOW - FillTiled - "
|
|
||||||
"SelectObject () failed on pTilePriv->hBitmap\n");
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
int width = pTile->drawable.width;
|
|
||||||
|
|
||||||
fullX1 = pPoints->x;
|
|
||||||
fullY1 = pPoints->y;
|
|
||||||
fullX2 = fullX1 + (int) *piWidths;
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
|
|
||||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fullX1 < extentX1)
|
|
||||||
fullX1 = extentX1;
|
|
||||||
if (fullX2 > extentX2)
|
|
||||||
fullX2 = extentX2;
|
|
||||||
|
|
||||||
if (fullX1 >= fullX2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (iX = fullX1; iX < fullX2; iX += width) {
|
|
||||||
int xoffset;
|
|
||||||
|
|
||||||
if ((iX + pTile->drawable.width) > fullX2)
|
|
||||||
width = fullX2 - iX;
|
|
||||||
else
|
|
||||||
width = pTile->drawable.width;
|
|
||||||
|
|
||||||
if (iX == fullX1)
|
|
||||||
xoffset =
|
|
||||||
(fullX1 -
|
|
||||||
(pDrawable->x +
|
|
||||||
(pGC->patOrg.x % pTile->drawable.width) -
|
|
||||||
pTile->drawable.width)) % pTile->drawable.width;
|
|
||||||
else
|
|
||||||
xoffset = 0;
|
|
||||||
|
|
||||||
if (xoffset + width > pTile->drawable.width)
|
|
||||||
width = pTile->drawable.width - xoffset;
|
|
||||||
|
|
||||||
BitBlt(pGCPriv->hdc,
|
|
||||||
iX, fullY1,
|
|
||||||
width, 1,
|
|
||||||
pGCPriv->hdcMem,
|
|
||||||
xoffset,
|
|
||||||
(fullY1 -
|
|
||||||
(pDrawable->y +
|
|
||||||
(pGC->patOrg.y % pTile->drawable.height) -
|
|
||||||
pTile->drawable.height)) % pTile->drawable.height,
|
|
||||||
g_copyROP[pGC->alu]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Push the tile pixmap out of the memory HDC */
|
|
||||||
SelectObject(pGCPriv->hdcMem, hbmpOrig);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset clip region */
|
|
||||||
SelectClipRgn(pGCPriv->hdc, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winFillSpans - Unknown drawable type\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of Harold L Hunt II
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from Harold L Hunt II.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* See Porting Layer Definition - p. 32 */
|
|
||||||
/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */
|
|
||||||
Bool
|
|
||||||
winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont)
|
|
||||||
{
|
|
||||||
BOOL fResult = TRUE;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winRealizeFont (%p, %p)\n", pScreen, pFont);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(RealizeFont);
|
|
||||||
if (pScreen->RealizeFont)
|
|
||||||
fResult = (*pScreen->RealizeFont) (pScreen, pFont);
|
|
||||||
WIN_WRAP(RealizeFont, winRealizeFontNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 32 */
|
|
||||||
/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */
|
|
||||||
Bool
|
|
||||||
winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont)
|
|
||||||
{
|
|
||||||
BOOL fResult = TRUE;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winUnrealizeFont (%p, %p)\n", pScreen, pFont);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(UnrealizeFont);
|
|
||||||
if (pScreen->UnrealizeFont)
|
|
||||||
fResult = (*pScreen->UnrealizeFont) (pScreen, pFont);
|
|
||||||
WIN_WRAP(UnrealizeFont, winUnrealizeFontNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winUnrealizeFont()\n");
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
235
hw/xwin/wingc.c
235
hw/xwin/wingc.c
|
@ -1,235 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of Harold L Hunt II
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from Harold L Hunt II.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local prototypes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
|
|
||||||
winValidateGCNativeGDI(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
winDestroyGCNativeGDI(GCPtr pGC);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects);
|
|
||||||
|
|
||||||
static void
|
|
||||||
winDestroyClipNativeGDI(GCPtr pGC);
|
|
||||||
|
|
||||||
static void
|
|
||||||
winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* GC Handling Routines */
|
|
||||||
const GCFuncs winGCFuncs = {
|
|
||||||
winValidateGCNativeGDI,
|
|
||||||
winChangeGCNativeGDI,
|
|
||||||
winCopyGCNativeGDI,
|
|
||||||
winDestroyGCNativeGDI,
|
|
||||||
winChangeClipNativeGDI,
|
|
||||||
winDestroyClipNativeGDI,
|
|
||||||
winCopyClipNativeGDI,
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
const GCFuncs winGCFuncs = {
|
|
||||||
winValidateGCNativeGDI,
|
|
||||||
miChangeGC,
|
|
||||||
miCopyGC,
|
|
||||||
winDestroyGCNativeGDI,
|
|
||||||
miChangeClip,
|
|
||||||
miDestroyClip,
|
|
||||||
miCopyClip,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Drawing Primitives */
|
|
||||||
const GCOps winGCOps = {
|
|
||||||
winFillSpansNativeGDI,
|
|
||||||
winSetSpansNativeGDI,
|
|
||||||
miPutImage,
|
|
||||||
miCopyArea,
|
|
||||||
miCopyPlane,
|
|
||||||
miPolyPoint,
|
|
||||||
winPolyLineNativeGDI,
|
|
||||||
miPolySegment,
|
|
||||||
miPolyRectangle,
|
|
||||||
miPolyArc,
|
|
||||||
miFillPolygon,
|
|
||||||
miPolyFillRect,
|
|
||||||
miPolyFillArc,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
#if 0
|
|
||||||
winImageGlyphBltNativeGDI,
|
|
||||||
winPolyGlyphBltNativeGDI,
|
|
||||||
#else
|
|
||||||
miImageGlyphBlt,
|
|
||||||
miPolyGlyphBlt,
|
|
||||||
#endif
|
|
||||||
miPushPixels,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 45 */
|
|
||||||
/* See mfb/mfbgc.c - mfbCreateGC() */
|
|
||||||
/* See Strategies for Porting - pp. 15, 16 */
|
|
||||||
Bool
|
|
||||||
winCreateGCNativeGDI(GCPtr pGC)
|
|
||||||
{
|
|
||||||
winPrivGCPtr pGCPriv = NULL;
|
|
||||||
winPrivScreenPtr pScreenPriv = NULL;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
ErrorF("winCreateGCNativeGDI - depth: %d\n", pGC->depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pGC->ops = (GCOps *) &winGCOps;
|
|
||||||
pGC->funcs = (GCFuncs *) &winGCFuncs;
|
|
||||||
|
|
||||||
/* We want all coordinates passed to spans functions to be screen relative */
|
|
||||||
pGC->miTranslate = TRUE;
|
|
||||||
|
|
||||||
/* Allocate privates for this GC */
|
|
||||||
pGCPriv = winGetGCPriv(pGC);
|
|
||||||
if (pGCPriv == NULL) {
|
|
||||||
ErrorF("winCreateGCNativeGDI () - Privates pointer was NULL\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new screen DC for the display window */
|
|
||||||
pScreenPriv = winGetScreenPriv(pGC->pScreen);
|
|
||||||
pGCPriv->hdc = GetDC(pScreenPriv->hwndScreen);
|
|
||||||
|
|
||||||
/* Allocate a memory DC for the GC */
|
|
||||||
pGCPriv->hdcMem = CreateCompatibleDC(pGCPriv->hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* See Porting Layer Definition - p. 45 */
|
|
||||||
static void
|
|
||||||
winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
ErrorF("winChangeGCNativeGDI () - Doing nothing\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
winValidateGCNativeGDI(GCPtr pGC,
|
|
||||||
unsigned long ulChanges, DrawablePtr pDrawable)
|
|
||||||
{
|
|
||||||
if ((ulChanges &
|
|
||||||
(GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
|
|
||||||
|| (pDrawable->serialNumber !=
|
|
||||||
(pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
|
|
||||||
miComputeCompositeClip(pGC, pDrawable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* See Porting Layer Definition - p. 46 */
|
|
||||||
static void
|
|
||||||
winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 46 */
|
|
||||||
static void
|
|
||||||
winDestroyGCNativeGDI(GCPtr pGC)
|
|
||||||
{
|
|
||||||
winGCPriv(pGC);
|
|
||||||
winScreenPriv(pGC->pScreen);
|
|
||||||
|
|
||||||
if (pGC->freeCompClip)
|
|
||||||
RegionDestroy(pGC->pCompositeClip);
|
|
||||||
|
|
||||||
/* Free the memory DC */
|
|
||||||
if (pGCPriv->hdcMem != NULL) {
|
|
||||||
DeleteDC(pGCPriv->hdcMem);
|
|
||||||
pGCPriv->hdcMem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release the screen DC for the display window */
|
|
||||||
if (pGCPriv->hdc != NULL) {
|
|
||||||
ReleaseDC(pScreenPriv->hwndScreen, pGCPriv->hdc);
|
|
||||||
pGCPriv->hdc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Invalidate the GC privates pointer */
|
|
||||||
winSetGCPriv(pGC, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* See Porting Layer Definition - p. 46 */
|
|
||||||
static void
|
|
||||||
winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 47 */
|
|
||||||
static void
|
|
||||||
winDestroyClipNativeGDI(GCPtr pGC)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 47 */
|
|
||||||
static void
|
|
||||||
winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,171 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
* Alan Hourihane <alanh@fairlite.demon.co.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 55 */
|
|
||||||
void
|
|
||||||
winGetSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
int nMax,
|
|
||||||
DDXPointPtr pPoints,
|
|
||||||
int *piWidths, int iSpans, char *pDsts)
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
winPrivPixmapPtr pPixmapPriv = NULL;
|
|
||||||
int iSpan;
|
|
||||||
DDXPointPtr pPoint = NULL;
|
|
||||||
int *piWidth = NULL;
|
|
||||||
char *pDst = pDsts;
|
|
||||||
HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
|
|
||||||
BYTE *pbWindow = NULL;
|
|
||||||
HDC hdcMem, hdcMem1;
|
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
/* Branch on the drawable type */
|
|
||||||
switch (pDrawable->type) {
|
|
||||||
case DRAWABLE_PIXMAP:
|
|
||||||
#if 0
|
|
||||||
ErrorF("winGetSpans - DRAWABLE_PIXMAP %08x\n", pDrawable);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
pPixmapPriv = winGetPixmapPriv(pPixmap);
|
|
||||||
|
|
||||||
/* Open a memory HDC */
|
|
||||||
hdcMem1 = CreateCompatibleDC(NULL);
|
|
||||||
hdcMem = CreateCompatibleDC(NULL);
|
|
||||||
|
|
||||||
/* Select the drawable pixmap into a DC */
|
|
||||||
hbmpOrig1 = SelectObject(hdcMem1, pPixmapPriv->hBitmap);
|
|
||||||
|
|
||||||
if (hbmpOrig1 == NULL)
|
|
||||||
FatalError("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
|
|
||||||
"failed on pPixmapPriv->hBitmap\n");
|
|
||||||
|
|
||||||
/* Loop through spans */
|
|
||||||
for (iSpan = 0; iSpan < iSpans; ++iSpan) {
|
|
||||||
pPoint = pPoints + iSpan;
|
|
||||||
piWidth = piWidths + iSpan;
|
|
||||||
|
|
||||||
hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
|
|
||||||
pDrawable->depth,
|
|
||||||
&pbWindow, NULL);
|
|
||||||
|
|
||||||
hbmpOrig = SelectObject(hdcMem, hbmpWindow);
|
|
||||||
|
|
||||||
/* Transfer the window bits to the window bitmap */
|
|
||||||
BitBlt(hdcMem,
|
|
||||||
0, 0, *piWidth, 1, hdcMem1, pPoint->x, pPoint->y, SRCCOPY);
|
|
||||||
|
|
||||||
memcpy(pDst,
|
|
||||||
(char *) pbWindow,
|
|
||||||
PixmapBytePad(*piWidth, pDrawable->depth));
|
|
||||||
|
|
||||||
/* Pop the window bitmap out of the HDC and delete the bitmap */
|
|
||||||
SelectObject(hdcMem, hbmpOrig);
|
|
||||||
DeleteObject(hbmpWindow);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
ErrorF("(%dx%dx%d) (%d,%d) w: %d\n",
|
|
||||||
pDrawable->width, pDrawable->height, pDrawable->depth,
|
|
||||||
pPoint->x, pPoint->y, *piWidth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Calculate offset of next bit destination */
|
|
||||||
pDst += PixmapBytePad(*piWidth, pDrawable->depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pop the pixmap's bitmap out of the HDC */
|
|
||||||
SelectObject(hdcMem1, hbmpOrig1);
|
|
||||||
|
|
||||||
/* Delete the HDCs */
|
|
||||||
DeleteDC(hdcMem1);
|
|
||||||
DeleteDC(hdcMem);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DRAWABLE_WINDOW:
|
|
||||||
#if 0
|
|
||||||
ErrorF("winGetSpans - DRAWABLE_WINDOW\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Open a memory HDC */
|
|
||||||
hdcMem = CreateCompatibleDC(NULL);
|
|
||||||
|
|
||||||
/* Loop through spans */
|
|
||||||
for (iSpan = 0; iSpan < iSpans; ++iSpan) {
|
|
||||||
pPoint = pPoints + iSpan;
|
|
||||||
piWidth = piWidths + iSpan;
|
|
||||||
|
|
||||||
hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
|
|
||||||
pDrawable->depth,
|
|
||||||
&pbWindow, NULL);
|
|
||||||
|
|
||||||
hbmpOrig = SelectObject(hdcMem, hbmpWindow);
|
|
||||||
|
|
||||||
/* Transfer the window bits to the window bitmap */
|
|
||||||
BitBlt(hdcMem,
|
|
||||||
0, 0,
|
|
||||||
*piWidth, 1,
|
|
||||||
pScreenPriv->hdcScreen, pPoint->x, pPoint->y, SRCCOPY);
|
|
||||||
|
|
||||||
memcpy(pDst,
|
|
||||||
(char *) pbWindow,
|
|
||||||
PixmapBytePad(*piWidth, pDrawable->depth));
|
|
||||||
|
|
||||||
/* Pop the window bitmap out of the HDC */
|
|
||||||
SelectObject(hdcMem, hbmpOrig);
|
|
||||||
|
|
||||||
DeleteObject(hbmpWindow);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
ErrorF("(%dx%dx%d) (%d,%d) w: %d\n",
|
|
||||||
pDrawable->width, pDrawable->height, pDrawable->depth,
|
|
||||||
pPoint->x, pPoint->y, *piWidth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Calculate offset of next bit destination */
|
|
||||||
pDst += PixmapBytePad(*piWidth, pDrawable->depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete the window bitmap */
|
|
||||||
DeleteDC(hdcMem);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
FatalError("winGetSpans - Unknown drawable type\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -33,21 +33,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* See Porting Layer Definition - p. 33 */
|
|
||||||
/*
|
|
||||||
* Called by clients, returns the best size for a cursor, tile, or
|
|
||||||
* stipple, specified by class (sometimes called kind)
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
|
|
||||||
unsigned short *pHeight, ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
ErrorF("winQueryBestSizeNativeGDI\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count the number of one bits in a color mask.
|
* Count the number of one bits in a color mask.
|
||||||
*/
|
*/
|
||||||
|
@ -93,51 +78,3 @@ winUpdateFBPointer(ScreenPtr pScreen, void *pbits)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/*
|
|
||||||
* Paint the window background with the specified color
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
winPaintBackground(HWND hwnd, COLORREF colorref)
|
|
||||||
{
|
|
||||||
HDC hdc;
|
|
||||||
HBRUSH hbrush;
|
|
||||||
RECT rect;
|
|
||||||
|
|
||||||
/* Create an hdc */
|
|
||||||
hdc = GetDC(hwnd);
|
|
||||||
if (hdc == NULL) {
|
|
||||||
printf("gdiWindowProc - GetDC failed\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create and select blue brush */
|
|
||||||
hbrush = CreateSolidBrush(colorref);
|
|
||||||
if (hbrush == NULL) {
|
|
||||||
printf("gdiWindowProc - CreateSolidBrush failed\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get window extents */
|
|
||||||
if (GetClientRect(hwnd, &rect) == FALSE) {
|
|
||||||
printf("gdiWindowProc - GetClientRect failed\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill window with blue brush */
|
|
||||||
if (FillRect(hdc, &rect, hbrush) == 0) {
|
|
||||||
printf("gdiWindowProc - FillRect failed\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete blue brush */
|
|
||||||
DeleteObject(hbrush);
|
|
||||||
|
|
||||||
/* Release the hdc */
|
|
||||||
ReleaseDC(hwnd, hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,491 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local function prototypes
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAllocateFBNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static void
|
|
||||||
winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCloseScreenNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitVisualsNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAdjustVideoModeNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static Bool
|
|
||||||
winBltExposedRegionsNativeGDI(ScreenPtr pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winActivateAppNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winRedrawScreenNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInstallColormapNativeGDI(ColormapPtr pColormap);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCreateColormapNativeGDI(ColormapPtr pColormap);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winDestroyColormapNativeGDI(ColormapPtr pColormap);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAllocateFBNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
FatalError("winAllocateFBNativeGDI\n");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
winFreeFBNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
FatalError("winFreeFBNativeGDI\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitScreenNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
FatalError("winInitScreenNativeGDI\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We wrap whatever CloseScreen procedure was specified by fb;
|
|
||||||
* a pointer to said procedure is stored in our privates.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCloseScreenNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
|
|
||||||
ErrorF("winCloseScreenNativeGDI - Freeing screen resources\n");
|
|
||||||
|
|
||||||
/* Flag that the screen is closed */
|
|
||||||
pScreenPriv->fClosed = TRUE;
|
|
||||||
pScreenPriv->fActive = FALSE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: mi doesn't use a CloseScreen procedure, so we do not
|
|
||||||
* need to call a wrapped procedure here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Delete the window property */
|
|
||||||
RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
|
|
||||||
|
|
||||||
ErrorF("winCloseScreenNativeGDI - Destroying window\n");
|
|
||||||
|
|
||||||
/* Delete tray icon, if we have one */
|
|
||||||
if (!pScreenInfo->fNoTrayIcon)
|
|
||||||
winDeleteNotifyIcon(pScreenPriv);
|
|
||||||
|
|
||||||
/* Free the exit confirmation dialog box, if it exists */
|
|
||||||
if (g_hDlgExit != NULL) {
|
|
||||||
DestroyWindow(g_hDlgExit);
|
|
||||||
g_hDlgExit = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kill our window */
|
|
||||||
if (pScreenPriv->hwndScreen) {
|
|
||||||
DestroyWindow(pScreenPriv->hwndScreen);
|
|
||||||
pScreenPriv->hwndScreen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Invalidate our screeninfo's pointer to the screen */
|
|
||||||
pScreenInfo->pScreen = NULL;
|
|
||||||
|
|
||||||
/* Free the screen privates for this screen */
|
|
||||||
free(pScreenPriv);
|
|
||||||
|
|
||||||
ErrorF("winCloseScreenNativeGDI - Returning\n");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
|
|
||||||
{
|
|
||||||
FatalError("winShadowUpdateNativeGDI\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitVisualsNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
|
|
||||||
/* Set the bitsPerRGB and bit masks */
|
|
||||||
switch (pScreenInfo->dwDepth) {
|
|
||||||
case 24:
|
|
||||||
pScreenPriv->dwBitsPerRGB = 8;
|
|
||||||
pScreenPriv->dwRedMask = 0x00FF0000;
|
|
||||||
pScreenPriv->dwGreenMask = 0x0000FF00;
|
|
||||||
pScreenPriv->dwBlueMask = 0x000000FF;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
pScreenPriv->dwBitsPerRGB = 6;
|
|
||||||
pScreenPriv->dwRedMask = 0xF800;
|
|
||||||
pScreenPriv->dwGreenMask = 0x07E0;
|
|
||||||
pScreenPriv->dwBlueMask = 0x001F;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
pScreenPriv->dwBitsPerRGB = 5;
|
|
||||||
pScreenPriv->dwRedMask = 0x7C00;
|
|
||||||
pScreenPriv->dwGreenMask = 0x03E0;
|
|
||||||
pScreenPriv->dwBlueMask = 0x001F;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
pScreenPriv->dwBitsPerRGB = 8;
|
|
||||||
pScreenPriv->dwRedMask = 0;
|
|
||||||
pScreenPriv->dwGreenMask = 0;
|
|
||||||
pScreenPriv->dwBlueMask = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell the user how many bits per RGB we are using */
|
|
||||||
ErrorF("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
|
|
||||||
(int) pScreenPriv->dwBitsPerRGB);
|
|
||||||
|
|
||||||
/* Create a single visual according to the Windows screen depth */
|
|
||||||
switch (pScreenInfo->dwDepth) {
|
|
||||||
case 24:
|
|
||||||
case 16:
|
|
||||||
case 15:
|
|
||||||
if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
|
|
||||||
TrueColorMask,
|
|
||||||
pScreenPriv->dwBitsPerRGB,
|
|
||||||
TrueColor,
|
|
||||||
pScreenPriv->dwRedMask,
|
|
||||||
pScreenPriv->dwGreenMask,
|
|
||||||
pScreenPriv->dwBlueMask)) {
|
|
||||||
ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
ErrorF("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
|
|
||||||
if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
|
|
||||||
StaticColorMask,
|
|
||||||
pScreenPriv->dwBitsPerRGB,
|
|
||||||
StaticColor,
|
|
||||||
pScreenPriv->dwRedMask,
|
|
||||||
pScreenPriv->dwGreenMask,
|
|
||||||
pScreenPriv->dwBlueMask)) {
|
|
||||||
ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
ErrorF("winInitVisualsNativeGDI - Returning\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust the video mode */
|
|
||||||
static Bool
|
|
||||||
winAdjustVideoModeNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
HDC hdc = NULL;
|
|
||||||
DWORD dwBPP;
|
|
||||||
|
|
||||||
hdc = GetDC(NULL);
|
|
||||||
|
|
||||||
/* We're in serious trouble if we can't get a DC */
|
|
||||||
if (hdc == NULL) {
|
|
||||||
ErrorF("winAdjustVideoModeNativeGDI - GetDC () failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Query GDI for current display depth */
|
|
||||||
dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
|
|
||||||
pScreenInfo->dwDepth = GetDeviceCaps(hdc, PLANES);
|
|
||||||
|
|
||||||
switch (pScreenInfo->dwDepth) {
|
|
||||||
case 24:
|
|
||||||
case 16:
|
|
||||||
case 15:
|
|
||||||
case 8:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (dwBPP == 32)
|
|
||||||
pScreenInfo->dwDepth = 24;
|
|
||||||
else
|
|
||||||
pScreenInfo->dwDepth = dwBPP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GDI cannot change the screen depth, so we'll use GDI's depth */
|
|
||||||
pScreenInfo->dwBPP = dwBPP;
|
|
||||||
|
|
||||||
/* Release our DC */
|
|
||||||
ReleaseDC(NULL, hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winActivateAppNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Are we active?
|
|
||||||
* Are we fullscreen?
|
|
||||||
*/
|
|
||||||
if (pScreenPriv != NULL
|
|
||||||
&& pScreenPriv->fActive
|
|
||||||
&& pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
|
|
||||||
/*
|
|
||||||
* Activating, attempt to bring our window
|
|
||||||
* to the top of the display
|
|
||||||
*/
|
|
||||||
ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Are we inactive?
|
|
||||||
* Are we fullscreen?
|
|
||||||
*/
|
|
||||||
if (pScreenPriv != NULL
|
|
||||||
&& !pScreenPriv->fActive
|
|
||||||
&& pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
|
|
||||||
/*
|
|
||||||
* Deactivating, stuff our window onto the
|
|
||||||
* task bar.
|
|
||||||
*/
|
|
||||||
ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
HBITMAP
|
|
||||||
winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
|
|
||||||
BYTE ** ppbBits, BITMAPINFO ** ppbmi)
|
|
||||||
{
|
|
||||||
BITMAPINFOHEADER *pbmih = NULL;
|
|
||||||
HBITMAP hBitmap = NULL;
|
|
||||||
BITMAPINFO *pbmi = NULL;
|
|
||||||
|
|
||||||
/* Don't create an invalid bitmap */
|
|
||||||
if (iWidth == 0 || iHeight == 0 || iDepth == 0) {
|
|
||||||
ErrorF("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n",
|
|
||||||
iWidth, iHeight, iDepth);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate bitmap info header */
|
|
||||||
pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
|
||||||
if (pbmih == NULL) {
|
|
||||||
ErrorF("winCreateDIBNativeGDI - malloc () failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
|
||||||
|
|
||||||
/* Describe bitmap to be created */
|
|
||||||
pbmih->biSize = sizeof(BITMAPINFOHEADER);
|
|
||||||
pbmih->biWidth = iWidth;
|
|
||||||
pbmih->biHeight = -iHeight;
|
|
||||||
pbmih->biPlanes = 1;
|
|
||||||
pbmih->biBitCount = iDepth;
|
|
||||||
pbmih->biCompression = BI_RGB;
|
|
||||||
pbmih->biSizeImage = 0;
|
|
||||||
pbmih->biXPelsPerMeter = 0;
|
|
||||||
pbmih->biYPelsPerMeter = 0;
|
|
||||||
pbmih->biClrUsed = 0;
|
|
||||||
pbmih->biClrImportant = 0;
|
|
||||||
|
|
||||||
/* Setup color table for mono DIBs */
|
|
||||||
if (iDepth == 1) {
|
|
||||||
pbmi = (BITMAPINFO *) pbmih;
|
|
||||||
pbmi->bmiColors[1].rgbBlue = 255;
|
|
||||||
pbmi->bmiColors[1].rgbGreen = 255;
|
|
||||||
pbmi->bmiColors[1].rgbRed = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a DIB with a bit pointer */
|
|
||||||
hBitmap = CreateDIBSection(NULL,
|
|
||||||
(BITMAPINFO *) pbmih,
|
|
||||||
DIB_RGB_COLORS, (void **) ppbBits, NULL, 0);
|
|
||||||
if (hBitmap == NULL) {
|
|
||||||
ErrorF("winCreateDIBNativeGDI - CreateDIBSection () failed\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free the bitmap info header memory */
|
|
||||||
if (ppbmi != NULL) {
|
|
||||||
/* Store the address of the BMIH in the ppbmih parameter */
|
|
||||||
*ppbmi = (BITMAPINFO *) pbmih;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
free(pbmih);
|
|
||||||
pbmih = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hBitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static Bool
|
|
||||||
winBltExposedRegionsNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winRedrawScreenNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
FatalError("winRedrawScreenNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
FatalError("winRealizeInstalledPaletteNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInstallColormapNativeGDI(ColormapPtr pColormap)
|
|
||||||
{
|
|
||||||
FatalError("winInstallColormapNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs)
|
|
||||||
{
|
|
||||||
FatalError("winStoreColorsNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCreateColormapNativeGDI(ColormapPtr pColormap)
|
|
||||||
{
|
|
||||||
FatalError("winCreateColormapNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winDestroyColormapNativeGDI(ColormapPtr pColormap)
|
|
||||||
{
|
|
||||||
FatalError("winDestroyColormapNativeGDI\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set engine specific funtions */
|
|
||||||
Bool
|
|
||||||
winSetEngineFunctionsNativeGDI(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
|
|
||||||
/* Set our pointers */
|
|
||||||
pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
|
|
||||||
pScreenPriv->pwinFreeFB = winFreeFBNativeGDI;
|
|
||||||
pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
|
|
||||||
pScreenPriv->pwinInitScreen = winInitScreenNativeGDI;
|
|
||||||
pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
|
|
||||||
pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
|
|
||||||
pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
|
|
||||||
if (pScreenInfo->fFullScreen)
|
|
||||||
pScreenPriv->pwinCreateBoundingWindow =
|
|
||||||
winCreateBoundingWindowFullScreen;
|
|
||||||
else
|
|
||||||
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
|
|
||||||
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI;
|
|
||||||
/*
|
|
||||||
* WARNING: Do not set the BltExposedRegions procedure pointer to anything
|
|
||||||
* other than NULL until a working painting procedure is in place.
|
|
||||||
* Else, winWindowProc will get stuck in an infinite loop because
|
|
||||||
* Windows expects the BeginPaint and EndPaint functions to be called
|
|
||||||
* before a WM_PAINT message can be removed from the queue. We are
|
|
||||||
* using NULL here as a signal for winWindowProc that it should
|
|
||||||
* not signal that the WM_PAINT message has been processed.
|
|
||||||
*/
|
|
||||||
pScreenPriv->pwinBltExposedRegions = NULL;
|
|
||||||
pScreenPriv->pwinActivateApp = winActivateAppNativeGDI;
|
|
||||||
pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI;
|
|
||||||
pScreenPriv->pwinRealizeInstalledPalette =
|
|
||||||
winRealizeInstalledPaletteNativeGDI;
|
|
||||||
pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI;
|
|
||||||
pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
|
|
||||||
pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
|
|
||||||
pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
|
|
||||||
pScreenPriv->pwinHotKeyAltTab =
|
|
||||||
(winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
|
@ -1,620 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Dakshinamurthy Karra
|
|
||||||
* Suhaib M Siddiqi
|
|
||||||
* Peter Busch
|
|
||||||
* Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local function prototypes
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAllocateFBPrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCloseScreenPrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitVisualsPrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAdjustVideoModePrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winActivateAppPrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winHotKeyAltTabPrimaryDD(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a DirectDraw primary surface
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAllocateFBPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
HRESULT ddrval = DD_OK;
|
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
DDSURFACEDESC *pddsdPrimary = NULL;
|
|
||||||
DDSURFACEDESC *pddsdOffscreen = NULL;
|
|
||||||
RECT rcClient;
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD\n");
|
|
||||||
|
|
||||||
/* Get client area location in screen coords */
|
|
||||||
GetClientRect(pScreenPriv->hwndScreen, &rcClient);
|
|
||||||
MapWindowPoints(pScreenPriv->hwndScreen,
|
|
||||||
HWND_DESKTOP, (LPPOINT) &rcClient, 2);
|
|
||||||
|
|
||||||
/* Create a DirectDraw object, store the address at lpdd */
|
|
||||||
ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
|
|
||||||
if (ddrval != DD_OK)
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
|
|
||||||
|
|
||||||
/* Get a DirectDraw2 interface pointer */
|
|
||||||
ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
|
|
||||||
&IID_IDirectDraw2,
|
|
||||||
(LPVOID *) &pScreenPriv->pdd2);
|
|
||||||
if (FAILED(ddrval)) {
|
|
||||||
ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
|
|
||||||
(unsigned int) ddrval);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Created and initialized DD\n");
|
|
||||||
|
|
||||||
/* Are we windowed or fullscreen? */
|
|
||||||
if (pScreenInfo->fFullScreen) {
|
|
||||||
/* Full screen mode */
|
|
||||||
ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
|
|
||||||
pScreenPriv->hwndScreen,
|
|
||||||
DDSCL_FULLSCREEN
|
|
||||||
| DDSCL_EXCLUSIVE);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not set "
|
|
||||||
"cooperative level\n");
|
|
||||||
|
|
||||||
/* Change the video mode to the mode requested */
|
|
||||||
ddrval = IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
|
|
||||||
pScreenInfo->dwWidth,
|
|
||||||
pScreenInfo->dwHeight,
|
|
||||||
pScreenInfo->dwBPP,
|
|
||||||
pScreenInfo->dwRefreshRate, 0);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not set "
|
|
||||||
"full screen display mode\n");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Windowed mode */
|
|
||||||
ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
|
|
||||||
pScreenPriv->hwndScreen,
|
|
||||||
DDSCL_NORMAL);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not set "
|
|
||||||
"cooperative level\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Describe the primary surface */
|
|
||||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
|
||||||
|
|
||||||
/* Create the primary surface */
|
|
||||||
ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
|
|
||||||
&ddsd, &pScreenPriv->pddsPrimary, NULL);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not create primary "
|
|
||||||
"surface %08x\n", (unsigned int) ddrval);
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Created primary\n");
|
|
||||||
|
|
||||||
/* Allocate a DD surface description for our screen privates */
|
|
||||||
pddsdPrimary = pScreenPriv->pddsdPrimary = malloc(sizeof(DDSURFACEDESC));
|
|
||||||
if (pddsdPrimary == NULL)
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
|
|
||||||
"description memory\n");
|
|
||||||
ZeroMemory(pddsdPrimary, sizeof(*pddsdPrimary));
|
|
||||||
pddsdPrimary->dwSize = sizeof(*pddsdPrimary);
|
|
||||||
|
|
||||||
/* Describe the offscreen surface to be created */
|
|
||||||
/*
|
|
||||||
* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
|
|
||||||
* as drawing, locking, and unlocking take forever
|
|
||||||
* with video memory surfaces. In addition,
|
|
||||||
* video memory is a somewhat scarce resource,
|
|
||||||
* so you shouldn't be allocating video memory when
|
|
||||||
* you have the option of using system memory instead.
|
|
||||||
*/
|
|
||||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
|
|
||||||
ddsd.dwHeight = pScreenInfo->dwHeight;
|
|
||||||
ddsd.dwWidth = pScreenInfo->dwWidth;
|
|
||||||
|
|
||||||
/* Create the shadow surface */
|
|
||||||
ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
|
|
||||||
&ddsd,
|
|
||||||
&pScreenPriv->pddsOffscreen, NULL);
|
|
||||||
if (ddrval != DD_OK)
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not create shadow "
|
|
||||||
"surface\n");
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Created offscreen\n");
|
|
||||||
|
|
||||||
/* Allocate a DD surface description for our screen privates */
|
|
||||||
pddsdOffscreen = pScreenPriv->pddsdOffscreen
|
|
||||||
= malloc(sizeof(DDSURFACEDESC));
|
|
||||||
if (pddsdOffscreen == NULL)
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
|
|
||||||
"description memory\n");
|
|
||||||
ZeroMemory(pddsdOffscreen, sizeof(*pddsdOffscreen));
|
|
||||||
pddsdOffscreen->dwSize = sizeof(*pddsdOffscreen);
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Locking primary\n");
|
|
||||||
|
|
||||||
/* Lock the primary surface */
|
|
||||||
ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
|
|
||||||
pScreenInfo->
|
|
||||||
fFullScreen ? NULL : &rcClient,
|
|
||||||
pddsdPrimary, DDLOCK_WAIT, NULL);
|
|
||||||
if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Could not lock "
|
|
||||||
"primary surface\n");
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Locked primary\n");
|
|
||||||
|
|
||||||
/* We don't know how to deal with anything other than RGB */
|
|
||||||
if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
|
|
||||||
FatalError("winAllocateFBPrimaryDD - Color format other than RGB\n");
|
|
||||||
|
|
||||||
/* Grab the pitch from the surface desc */
|
|
||||||
pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
|
|
||||||
/ pScreenInfo->dwBPP;
|
|
||||||
|
|
||||||
/* Save the pointer to our surface memory */
|
|
||||||
pScreenInfo->pfb = pddsdPrimary->lpSurface;
|
|
||||||
|
|
||||||
/* Grab the color depth and masks from the surface description */
|
|
||||||
pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
|
|
||||||
pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
|
|
||||||
pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
|
|
||||||
|
|
||||||
ErrorF("winAllocateFBPrimaryDD - Returning\n");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
winFreeFBPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
|
|
||||||
/* Free the offscreen surface, if there is one */
|
|
||||||
if (pScreenPriv->pddsOffscreen) {
|
|
||||||
IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
|
|
||||||
IDirectDrawSurface2_Release(pScreenPriv->pddsOffscreen);
|
|
||||||
pScreenPriv->pddsOffscreen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release the primary surface, if there is one */
|
|
||||||
if (pScreenPriv->pddsPrimary) {
|
|
||||||
IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
|
|
||||||
IDirectDrawSurface2_Release(pScreenPriv->pddsPrimary);
|
|
||||||
pScreenPriv->pddsPrimary = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free the DirectDraw object, if there is one */
|
|
||||||
if (pScreenPriv->pdd) {
|
|
||||||
IDirectDraw2_RestoreDisplayMode(pScreenPriv->pdd);
|
|
||||||
IDirectDraw2_Release(pScreenPriv->pdd);
|
|
||||||
pScreenPriv->pdd = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Invalidate the ScreenInfo's fb pointer */
|
|
||||||
pScreenInfo->pfb = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitScreenPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
return winAllocateFBPrimaryDD(pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Call the wrapped CloseScreen function.
|
|
||||||
*
|
|
||||||
* Free our resources and private structures.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winCloseScreenPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
Bool fReturn;
|
|
||||||
|
|
||||||
ErrorF("winCloseScreenPrimaryDD - Freeing screen resources\n");
|
|
||||||
|
|
||||||
/* Flag that the screen is closed */
|
|
||||||
pScreenPriv->fClosed = TRUE;
|
|
||||||
pScreenPriv->fActive = FALSE;
|
|
||||||
|
|
||||||
/* Call the wrapped CloseScreen procedure */
|
|
||||||
WIN_UNWRAP(CloseScreen);
|
|
||||||
if (pScreen->CloseScreen)
|
|
||||||
fReturn = (*pScreen->CloseScreen) (pScreen);
|
|
||||||
|
|
||||||
/* Delete the window property */
|
|
||||||
RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
|
|
||||||
|
|
||||||
winFreeFBPrimaryDD(pScreen);
|
|
||||||
|
|
||||||
/* Delete tray icon, if we have one */
|
|
||||||
if (!pScreenInfo->fNoTrayIcon)
|
|
||||||
winDeleteNotifyIcon(pScreenPriv);
|
|
||||||
|
|
||||||
/* Free the exit confirmation dialog box, if it exists */
|
|
||||||
if (g_hDlgExit != NULL) {
|
|
||||||
DestroyWindow(g_hDlgExit);
|
|
||||||
g_hDlgExit = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kill our window */
|
|
||||||
if (pScreenPriv->hwndScreen) {
|
|
||||||
DestroyWindow(pScreenPriv->hwndScreen);
|
|
||||||
pScreenPriv->hwndScreen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kill our screeninfo's pointer to the screen */
|
|
||||||
pScreenInfo->pScreen = NULL;
|
|
||||||
|
|
||||||
/* Free the screen privates for this screen */
|
|
||||||
free((void *) pScreenPriv);
|
|
||||||
|
|
||||||
return fReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell mi what sort of visuals we need.
|
|
||||||
*
|
|
||||||
* Generally we only need one visual, as our screen can only
|
|
||||||
* handle one format at a time, I believe. You may want
|
|
||||||
* to verify that last sentence.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winInitVisualsPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
DWORD dwRedBits, dwGreenBits, dwBlueBits;
|
|
||||||
|
|
||||||
/* Count the number of ones in each color mask */
|
|
||||||
dwRedBits = winCountBits(pScreenPriv->dwRedMask);
|
|
||||||
dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
|
|
||||||
dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
|
|
||||||
|
|
||||||
/* Store the maximum number of ones in a color mask as the bitsPerRGB */
|
|
||||||
if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
|
|
||||||
pScreenPriv->dwBitsPerRGB = dwRedBits;
|
|
||||||
else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
|
|
||||||
pScreenPriv->dwBitsPerRGB = dwGreenBits;
|
|
||||||
else
|
|
||||||
pScreenPriv->dwBitsPerRGB = dwBlueBits;
|
|
||||||
|
|
||||||
ErrorF("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
|
|
||||||
(unsigned int) pScreenPriv->dwRedMask,
|
|
||||||
(unsigned int) pScreenPriv->dwGreenMask,
|
|
||||||
(unsigned int) pScreenPriv->dwBlueMask,
|
|
||||||
(int) pScreenPriv->dwBitsPerRGB);
|
|
||||||
|
|
||||||
/* Create a single visual according to the Windows screen depth */
|
|
||||||
switch (pScreenInfo->dwDepth) {
|
|
||||||
case 24:
|
|
||||||
case 16:
|
|
||||||
case 15:
|
|
||||||
if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
|
|
||||||
TrueColorMask,
|
|
||||||
pScreenPriv->dwBitsPerRGB,
|
|
||||||
TrueColor,
|
|
||||||
pScreenPriv->dwRedMask,
|
|
||||||
pScreenPriv->dwGreenMask,
|
|
||||||
pScreenPriv->dwBlueMask)) {
|
|
||||||
ErrorF("winInitVisualsPrimaryDD - "
|
|
||||||
"miSetVisualTypesAndMasks failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
|
|
||||||
#endif /* CYGDEBUG */
|
|
||||||
if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
|
|
||||||
PseudoColorMask,
|
|
||||||
pScreenPriv->dwBitsPerRGB,
|
|
||||||
PseudoColor,
|
|
||||||
pScreenPriv->dwRedMask,
|
|
||||||
pScreenPriv->dwGreenMask,
|
|
||||||
pScreenPriv->dwBlueMask)) {
|
|
||||||
ErrorF("winInitVisualsPrimaryDD - "
|
|
||||||
"miSetVisualTypesAndMasks failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winInitVisualsPrimaryDD - Returned from "
|
|
||||||
"miSetVisualTypesAndMasks\n");
|
|
||||||
#endif /* CYGDEBUG */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("winInitVisualsPrimaryDD - Unknown screen depth\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorF("winInitVisualsPrimaryDD - Returning\n");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winAdjustVideoModePrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
HDC hdc = NULL;
|
|
||||||
DWORD dwBPP;
|
|
||||||
|
|
||||||
/* We're in serious trouble if we can't get a DC */
|
|
||||||
hdc = GetDC(NULL);
|
|
||||||
if (hdc == NULL) {
|
|
||||||
ErrorF("winAdjustVideoModePrimaryDD - GetDC failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Query GDI for current display depth */
|
|
||||||
dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
|
|
||||||
|
|
||||||
/* DirectDraw can only change the depth in fullscreen mode */
|
|
||||||
if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
|
|
||||||
/* Otherwise, We'll use GDI's depth */
|
|
||||||
pScreenInfo->dwBPP = dwBPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release our DC */
|
|
||||||
ReleaseDC(NULL, hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We need to blit our offscreen fb to
|
|
||||||
* the screen when we are activated, and we need to point
|
|
||||||
* the fb code back to the primary surface memory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winActivateAppPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
RECT rcSrc, rcClient;
|
|
||||||
HRESULT ddrval = DD_OK;
|
|
||||||
|
|
||||||
/* Check for errors */
|
|
||||||
if (pScreenPriv == NULL
|
|
||||||
|| pScreenPriv->pScreenInfo == NULL
|
|
||||||
|| pScreenPriv->pddsPrimary == NULL
|
|
||||||
|| pScreenPriv->pddsOffscreen == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Check for do-nothing */
|
|
||||||
if (!pScreenPriv->fActive)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* We are activating */
|
|
||||||
ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsOffscreen);
|
|
||||||
if (ddrval == DD_OK) {
|
|
||||||
IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
|
|
||||||
/*
|
|
||||||
* We don't check for an error from Unlock, because it
|
|
||||||
* doesn't matter if the Unlock failed.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restore both surfaces, just cause I like it that way */
|
|
||||||
IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
|
|
||||||
IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
|
|
||||||
|
|
||||||
/* Get client area in screen coords */
|
|
||||||
GetClientRect(pScreenPriv->hwndScreen, &rcClient);
|
|
||||||
MapWindowPoints(pScreenPriv->hwndScreen,
|
|
||||||
HWND_DESKTOP, (LPPOINT) &rcClient, 2);
|
|
||||||
|
|
||||||
/* Setup a source rectangle */
|
|
||||||
rcSrc.left = 0;
|
|
||||||
rcSrc.top = 0;
|
|
||||||
rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
|
|
||||||
rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
|
|
||||||
|
|
||||||
ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
|
|
||||||
&rcClient,
|
|
||||||
pScreenPriv->pddsOffscreen,
|
|
||||||
&rcSrc, DDBLT_WAIT, NULL);
|
|
||||||
if (ddrval != DD_OK)
|
|
||||||
FatalError("winActivateAppPrimaryDD () - Failed blitting offscreen "
|
|
||||||
"surface to primary surface %08x\n", (unsigned int) ddrval);
|
|
||||||
|
|
||||||
/* Lock the primary surface */
|
|
||||||
ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
|
|
||||||
&rcClient,
|
|
||||||
pScreenPriv->pddsdPrimary,
|
|
||||||
DDLOCK_WAIT, NULL);
|
|
||||||
if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
|
|
||||||
FatalError("winActivateAppPrimaryDD () - Could not lock "
|
|
||||||
"primary surface\n");
|
|
||||||
|
|
||||||
/* Notify FB of the new memory pointer */
|
|
||||||
winUpdateFBPointer(pScreen, pScreenPriv->pddsdPrimary->lpSurface);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register the Alt-Tab combo as a hotkey so we can copy
|
|
||||||
* the primary framebuffer before the display mode changes
|
|
||||||
*/
|
|
||||||
RegisterHotKey(pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle the Alt+Tab hotkey.
|
|
||||||
*
|
|
||||||
* We need to save the primary fb to an offscreen fb when
|
|
||||||
* we get deactivated, and point the fb code at the offscreen
|
|
||||||
* fb for the duration of the deactivation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
HRESULT ddrval = DD_OK;
|
|
||||||
|
|
||||||
ErrorF("\nwinHotKeyAltTabPrimaryDD\n\n");
|
|
||||||
|
|
||||||
/* Alt+Tab was pressed, we will lose focus very soon */
|
|
||||||
pScreenPriv->fActive = FALSE;
|
|
||||||
|
|
||||||
/* Check for error conditions */
|
|
||||||
if (pScreenPriv->pddsPrimary == NULL || pScreenPriv->pddsOffscreen == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Did we loose the primary surface? */
|
|
||||||
ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsPrimary);
|
|
||||||
if (ddrval == DD_OK) {
|
|
||||||
ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
|
|
||||||
"surface\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Blit the primary surface to the offscreen surface */
|
|
||||||
ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen, NULL, /* should be rcDest */
|
|
||||||
pScreenPriv->pddsPrimary,
|
|
||||||
NULL, DDBLT_WAIT, NULL);
|
|
||||||
if (ddrval == DDERR_SURFACELOST) {
|
|
||||||
IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
|
|
||||||
IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
|
|
||||||
|
|
||||||
/* Blit the primary surface to the offscreen surface */
|
|
||||||
ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen,
|
|
||||||
NULL,
|
|
||||||
pScreenPriv->pddsPrimary,
|
|
||||||
NULL, DDBLT_WAIT, NULL);
|
|
||||||
if (FAILED(ddrval))
|
|
||||||
FatalError("winHotKeyAltTabPrimaryDD - Failed blitting primary "
|
|
||||||
"surface to offscreen surface: %08x\n",
|
|
||||||
(unsigned int) ddrval);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
FatalError("winHotKeyAltTabPrimaryDD - Unknown error from "
|
|
||||||
"Blt: %08dx\n", (unsigned int) ddrval);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lock the offscreen surface */
|
|
||||||
ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsOffscreen,
|
|
||||||
NULL,
|
|
||||||
pScreenPriv->pddsdOffscreen,
|
|
||||||
DDLOCK_WAIT, NULL);
|
|
||||||
if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
|
|
||||||
FatalError("winHotKeyAltTabPrimaryDD - Could not lock "
|
|
||||||
"offscreen surface\n");
|
|
||||||
|
|
||||||
/* Notify FB of the new memory pointer */
|
|
||||||
winUpdateFBPointer(pScreen, pScreenPriv->pddsdOffscreen->lpSurface);
|
|
||||||
|
|
||||||
/* Unregister our hotkey */
|
|
||||||
UnregisterHotKey(pScreenPriv->hwndScreen, 1);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set engine specific functions */
|
|
||||||
Bool
|
|
||||||
winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
|
||||||
|
|
||||||
/* Set our pointers */
|
|
||||||
pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
|
|
||||||
pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD;
|
|
||||||
pScreenPriv->pwinShadowUpdate =
|
|
||||||
(winShadowUpdateProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD;
|
|
||||||
pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
|
|
||||||
pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
|
|
||||||
pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
|
|
||||||
if (pScreenInfo->fFullScreen)
|
|
||||||
pScreenPriv->pwinCreateBoundingWindow =
|
|
||||||
winCreateBoundingWindowFullScreen;
|
|
||||||
else
|
|
||||||
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
|
|
||||||
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
|
|
||||||
pScreenPriv->pwinBltExposedRegions =
|
|
||||||
(winBltExposedRegionsProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
|
|
||||||
pScreenPriv->pwinRedrawScreen = NULL;
|
|
||||||
pScreenPriv->pwinRealizeInstalledPalette = NULL;
|
|
||||||
pScreenPriv->pwinInstallColormap = NULL;
|
|
||||||
pScreenPriv->pwinStoreColors = NULL;
|
|
||||||
pScreenPriv->pwinCreateColormap = NULL;
|
|
||||||
pScreenPriv->pwinDestroyColormap = NULL;
|
|
||||||
pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
|
|
||||||
pScreenPriv->pwinCreatePrimarySurface =
|
|
||||||
(winCreatePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
pScreenPriv->pwinReleasePrimarySurface =
|
|
||||||
(winReleasePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
#ifdef XWIN_MULTIWINDOW
|
|
||||||
pScreenPriv->pwinFinishCreateWindowsWindow =
|
|
||||||
(winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
|
@ -1,223 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: drewry, september 1986
|
|
||||||
* Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local prototypes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw);
|
|
||||||
|
|
||||||
static void
|
|
||||||
winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh);
|
|
||||||
|
|
||||||
static void
|
|
||||||
|
|
||||||
winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix,
|
|
||||||
int xrot, int yrot);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 34 */
|
|
||||||
/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
|
|
||||||
PixmapPtr
|
|
||||||
winCreatePixmapNativeGDI(ScreenPtr pScreen,
|
|
||||||
int iWidth, int iHeight,
|
|
||||||
int iDepth, unsigned usage_hint)
|
|
||||||
{
|
|
||||||
winPrivPixmapPtr pPixmapPriv = NULL;
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
|
|
||||||
/* Allocate pixmap memory */
|
|
||||||
pPixmap = AllocatePixmap(pScreen, 0);
|
|
||||||
if (!pPixmap) {
|
|
||||||
ErrorF("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
|
|
||||||
return NullPixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
|
|
||||||
iWidth, iHeight, iDepth, usage_hint,
|
|
||||||
PixmapBytePad(iWidth, iDepth));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Setup pixmap values */
|
|
||||||
pPixmap->drawable.type = DRAWABLE_PIXMAP;
|
|
||||||
pPixmap->drawable.class = 0;
|
|
||||||
pPixmap->drawable.pScreen = pScreen;
|
|
||||||
pPixmap->drawable.depth = iDepth;
|
|
||||||
pPixmap->drawable.bitsPerPixel = BitsPerPixel(iDepth);
|
|
||||||
pPixmap->drawable.id = 0;
|
|
||||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
|
||||||
pPixmap->drawable.x = 0;
|
|
||||||
pPixmap->drawable.y = 0;
|
|
||||||
pPixmap->drawable.width = iWidth;
|
|
||||||
pPixmap->drawable.height = iHeight;
|
|
||||||
pPixmap->devKind = 0;
|
|
||||||
pPixmap->refcnt = 1;
|
|
||||||
pPixmap->devPrivate.ptr = NULL;
|
|
||||||
pPixmap->usage_hint = usage_hint;
|
|
||||||
|
|
||||||
/* Pixmap privates are allocated by AllocatePixmap */
|
|
||||||
pPixmapPriv = winGetPixmapPriv(pPixmap);
|
|
||||||
|
|
||||||
/* Initialize pixmap privates */
|
|
||||||
pPixmapPriv->hBitmap = NULL;
|
|
||||||
pPixmapPriv->hdcSelected = NULL;
|
|
||||||
pPixmapPriv->pbBits = NULL;
|
|
||||||
pPixmapPriv->dwScanlineBytes = PixmapBytePad(iWidth, iDepth);
|
|
||||||
|
|
||||||
/* Check for zero width or height pixmaps */
|
|
||||||
if (iWidth == 0 || iHeight == 0) {
|
|
||||||
/* Don't allocate a real pixmap, just set fields and return */
|
|
||||||
return pPixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a DIB for the pixmap */
|
|
||||||
pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth,
|
|
||||||
&pPixmapPriv->pbBits,
|
|
||||||
(BITMAPINFO **) &pPixmapPriv->
|
|
||||||
pbmih);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for "
|
|
||||||
"screen: %08x\n",
|
|
||||||
pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return pPixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* See Porting Layer Definition - p. 35
|
|
||||||
*
|
|
||||||
* See mfb/mfbpixmap.c - mfbDestroyPixmap()
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winDestroyPixmapNativeGDI(PixmapPtr pPixmap)
|
|
||||||
{
|
|
||||||
winPrivPixmapPtr pPixmapPriv = NULL;
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winDestroyPixmapNativeGDI ()\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Bail early if there is not a pixmap to destroy */
|
|
||||||
if (pPixmap == NULL) {
|
|
||||||
ErrorF("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get a handle to the pixmap privates */
|
|
||||||
pPixmapPriv = winGetPixmapPriv(pPixmap);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
|
|
||||||
pPixmapPriv->hBitmap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Decrement reference count, return if nonzero */
|
|
||||||
--pPixmap->refcnt;
|
|
||||||
if (pPixmap->refcnt != 0)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* Free GDI bitmap */
|
|
||||||
if (pPixmapPriv->hBitmap)
|
|
||||||
DeleteObject(pPixmapPriv->hBitmap);
|
|
||||||
|
|
||||||
/* Free the bitmap info header memory */
|
|
||||||
free(pPixmapPriv->pbmih);
|
|
||||||
pPixmapPriv->pbmih = NULL;
|
|
||||||
|
|
||||||
/* Free the pixmap memory */
|
|
||||||
free(pPixmap);
|
|
||||||
pPixmap = NULL;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not used yet
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
|
|
||||||
int iWidth, int iHeight,
|
|
||||||
int iDepth,
|
|
||||||
int iBitsPerPixel, int devKind, void *pPixData)
|
|
||||||
{
|
|
||||||
FatalError("winModifyPixmapHeaderNativeGDI ()\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
|
||||||
* Not used yet.
|
|
||||||
* See cfb/cfbpixmap.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw)
|
|
||||||
{
|
|
||||||
ErrorF("winXRotatePixmap()\n");
|
|
||||||
/* fill in this function, look at CFB */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not used yet.
|
|
||||||
* See cfb/cfbpixmap.c
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh)
|
|
||||||
{
|
|
||||||
ErrorF("winYRotatePixmap()\n");
|
|
||||||
/* fill in this function, look at CFB */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not used yet.
|
|
||||||
* See cfb/cfbpixmap.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix,
|
|
||||||
int xrot, int yrot)
|
|
||||||
{
|
|
||||||
ErrorF("winCopyRotatePixmap()\n");
|
|
||||||
/* fill in this function, look at CFB */
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of Harold L Hunt II
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from Harold L Hunt II.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 50 */
|
|
||||||
void
|
|
||||||
winPolyLineNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
|
|
||||||
{
|
|
||||||
switch (pGC->lineStyle) {
|
|
||||||
case LineSolid:
|
|
||||||
if (pGC->lineWidth == 0)
|
|
||||||
return miZeroLine(pDrawable, pGC, mode, npt, ppt);
|
|
||||||
else
|
|
||||||
miWideLine(pDrawable, pGC, mode, npt, ppt);
|
|
||||||
break;
|
|
||||||
case LineOnOffDash:
|
|
||||||
case LineDoubleDash:
|
|
||||||
miWideDash(pDrawable, pGC, mode, npt, ppt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
142
hw/xwin/winrop.c
142
hw/xwin/winrop.c
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Raster operations used by Windows translated to X's 16 rop codes...
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
ROP16(HDC hdc, int rop);
|
|
||||||
|
|
||||||
int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */
|
|
||||||
0x8800C6, /* GXand - S & D */
|
|
||||||
0x440328, /* GXandReverse - S & !D */
|
|
||||||
0xCC0020, /* GXcopy - S */
|
|
||||||
0x220326, /* GXandInverted - !S & D */
|
|
||||||
0xAA0029, /* GXnoop - D */
|
|
||||||
0x660046, /* GXxor - S ^ D */
|
|
||||||
0xEE0086, /* GXor - S | D */
|
|
||||||
0x1100A6, /* GXnor - !S & !D */
|
|
||||||
0x990126, /* GXequiv - !S ^ D */
|
|
||||||
0x550009, /* GXinvert - !D */
|
|
||||||
0xDD0228, /* GXorReverse - S | !D */
|
|
||||||
0x330008, /* GXcopyInverted - !S */
|
|
||||||
0xBB0226, /* GXorInverted - !S | D */
|
|
||||||
0x7700C6, /* GXnand - !S | !D */
|
|
||||||
0x000042 /* GXset - 1 */
|
|
||||||
};
|
|
||||||
|
|
||||||
int g_patternROP[16] = { 0xFF0062, /* GXclear - 0 */
|
|
||||||
0xA000C9, /* GXand - P & D */
|
|
||||||
0xF50225, /* GXandReverse - P & !D */
|
|
||||||
0xF00021, /* GXcopy - P */
|
|
||||||
0x5F00E9, /* GXandInverted - !P & D */
|
|
||||||
0xAA0029, /* GXnoop - D */
|
|
||||||
0xA50065, /* GXxor - P ^ D */
|
|
||||||
0xA000C9, /* GXor - P | D */
|
|
||||||
0x5F00E9, /* GXnor - !P & !D */
|
|
||||||
0x5A0049, /* GXequiv - !P ^ D */
|
|
||||||
0x550009, /* GXinvert - !D */
|
|
||||||
0x500325, /* GXorReverse - P | !D */
|
|
||||||
0x0F0001, /* GXcopyInverted - !P */
|
|
||||||
0x0A0329, /* GXorInverted - !P | D */
|
|
||||||
0x0500A9, /* GXnand - !P | !D */
|
|
||||||
0x000042 /* GXset - 1 */
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
ROP16(HDC hdc, int rop)
|
|
||||||
{
|
|
||||||
switch (rop) {
|
|
||||||
case GXclear:
|
|
||||||
SetROP2(hdc, R2_BLACK);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXand:
|
|
||||||
SetROP2(hdc, R2_MASKPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXandReverse:
|
|
||||||
SetROP2(hdc, R2_MASKPENNOT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXcopy:
|
|
||||||
SetROP2(hdc, R2_COPYPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXnoop:
|
|
||||||
SetROP2(hdc, R2_NOP);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXxor:
|
|
||||||
SetROP2(hdc, R2_XORPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXor:
|
|
||||||
SetROP2(hdc, R2_MERGEPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXnor:
|
|
||||||
SetROP2(hdc, R2_NOTMERGEPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXequiv:
|
|
||||||
SetROP2(hdc, R2_NOTXORPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXinvert:
|
|
||||||
SetROP2(hdc, R2_NOT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXorReverse:
|
|
||||||
SetROP2(hdc, R2_MERGEPENNOT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXcopyInverted:
|
|
||||||
SetROP2(hdc, R2_NOTCOPYPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXorInverted:
|
|
||||||
SetROP2(hdc, R2_MERGENOTPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXnand:
|
|
||||||
SetROP2(hdc, R2_NOTMASKPEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXset:
|
|
||||||
SetROP2(hdc, R2_WHITE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -570,145 +570,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* See Porting Layer Definition - p. 20 */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winFinishScreenInitNativeGDI(int i,
|
|
||||||
ScreenPtr pScreen, int argc, char **argv)
|
|
||||||
{
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
|
|
||||||
VisualPtr pVisuals = NULL;
|
|
||||||
DepthPtr pDepths = NULL;
|
|
||||||
VisualID rootVisual = 0;
|
|
||||||
int nVisuals = 0, nDepths = 0, nRootDepth = 0;
|
|
||||||
|
|
||||||
/* Ignore user input (mouse, keyboard) */
|
|
||||||
pScreenInfo->fIgnoreInput = FALSE;
|
|
||||||
|
|
||||||
/* Get device contexts for the screen and shadow bitmap */
|
|
||||||
pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
|
|
||||||
if (pScreenPriv->hdcScreen == NULL)
|
|
||||||
FatalError("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
|
|
||||||
|
|
||||||
/* Init visuals */
|
|
||||||
if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the mi visuals */
|
|
||||||
if (!miInitVisuals(&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
|
|
||||||
&rootVisual,
|
|
||||||
((unsigned long) 1 << (pScreenInfo->dwDepth - 1)), 8,
|
|
||||||
TrueColor)) {
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the CloseScreen procedure pointer */
|
|
||||||
pScreen->CloseScreen = NULL;
|
|
||||||
|
|
||||||
/* Initialize the mi code */
|
|
||||||
if (!miScreenInit(pScreen, NULL, /* No framebuffer */
|
|
||||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight,
|
|
||||||
monitorResolution, monitorResolution,
|
|
||||||
pScreenInfo->dwStride,
|
|
||||||
nRootDepth, nDepths, pDepths, rootVisual,
|
|
||||||
nVisuals, pVisuals)) {
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - miScreenInit failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pScreen->defColormap = FakeClientID(0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register our block and wakeup handlers; these procedures
|
|
||||||
* process messages in our Windows message queue; specifically,
|
|
||||||
* they process mouse and keyboard input.
|
|
||||||
*/
|
|
||||||
pScreen->BlockHandler = winBlockHandler;
|
|
||||||
pScreen->WakeupHandler = winWakeupHandler;
|
|
||||||
|
|
||||||
/* Place our save screen function */
|
|
||||||
pScreen->SaveScreen = winSaveScreen;
|
|
||||||
|
|
||||||
/* Pixmaps */
|
|
||||||
pScreen->CreatePixmap = winCreatePixmapNativeGDI;
|
|
||||||
pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
|
|
||||||
|
|
||||||
/* Other Screen Routines */
|
|
||||||
pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
|
|
||||||
pScreen->SaveScreen = winSaveScreen;
|
|
||||||
pScreen->GetImage = miGetImage;
|
|
||||||
pScreen->GetSpans = winGetSpansNativeGDI;
|
|
||||||
|
|
||||||
/* Window Procedures */
|
|
||||||
pScreen->CreateWindow = winCreateWindowNativeGDI;
|
|
||||||
pScreen->DestroyWindow = winDestroyWindowNativeGDI;
|
|
||||||
pScreen->PositionWindow = winPositionWindowNativeGDI;
|
|
||||||
/*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; */
|
|
||||||
pScreen->RealizeWindow = winMapWindowNativeGDI;
|
|
||||||
pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
|
|
||||||
|
|
||||||
/* Paint window */
|
|
||||||
pScreen->CopyWindow = winCopyWindowNativeGDI;
|
|
||||||
|
|
||||||
/* Fonts */
|
|
||||||
pScreen->RealizeFont = winRealizeFontNativeGDI;
|
|
||||||
pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
|
|
||||||
|
|
||||||
/* GC */
|
|
||||||
pScreen->CreateGC = winCreateGCNativeGDI;
|
|
||||||
|
|
||||||
/* Colormap Routines */
|
|
||||||
pScreen->CreateColormap = miInitializeColormap;
|
|
||||||
pScreen->DestroyColormap =
|
|
||||||
(DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
pScreen->InstallColormap = miInstallColormap;
|
|
||||||
pScreen->UninstallColormap = miUninstallColormap;
|
|
||||||
pScreen->ListInstalledColormaps = miListInstalledColormaps;
|
|
||||||
pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
|
|
||||||
pScreen->ResolveColor = miResolveColor;
|
|
||||||
|
|
||||||
/* Bitmap */
|
|
||||||
pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
|
|
||||||
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
|
|
||||||
|
|
||||||
/* Set the default white and black pixel positions */
|
|
||||||
pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
|
|
||||||
|
|
||||||
/* Initialize the cursor */
|
|
||||||
if (!miDCInitialize(pScreen, &g_winPointerCursorFuncs)) {
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a default colormap */
|
|
||||||
if (!miCreateDefColormap(pScreen)) {
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
|
|
||||||
"failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
|
|
||||||
"returned\n");
|
|
||||||
|
|
||||||
/* mi doesn't use a CloseScreen procedure, so no need to wrap */
|
|
||||||
pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
|
|
||||||
|
|
||||||
/* Tell the server that we are enabled */
|
|
||||||
pScreenPriv->fEnabled = TRUE;
|
|
||||||
|
|
||||||
ErrorF("winFinishScreenInitNativeGDI - Successful addition of "
|
|
||||||
"screen %p\n", pScreen);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 33 */
|
/* See Porting Layer Definition - p. 33 */
|
||||||
static Bool
|
static Bool
|
||||||
winSaveScreen(ScreenPtr pScreen, int on)
|
winSaveScreen(ScreenPtr pScreen, int on)
|
||||||
|
|
|
@ -1,175 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of the XFree86 Project
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from the XFree86 Project.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
* Alan Hourihane <alanh@fairlite.demon.co.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 55 */
|
|
||||||
void
|
|
||||||
winSetSpansNativeGDI(DrawablePtr pDrawable,
|
|
||||||
GCPtr pGC,
|
|
||||||
char *pSrcs,
|
|
||||||
DDXPointPtr pPoints,
|
|
||||||
int *piWidths, int iSpans, int fSorted)
|
|
||||||
{
|
|
||||||
winGCPriv(pGC);
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
winPrivPixmapPtr pPixmapPriv = NULL;
|
|
||||||
HBITMAP hbmpOrig = NULL;
|
|
||||||
BITMAPINFO *pbmi;
|
|
||||||
HRGN hrgn = NULL, combined = NULL;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
|
|
||||||
nbox = RegionNumRects(pGC->pCompositeClip);
|
|
||||||
pbox = RegionRects(pGC->pCompositeClip);
|
|
||||||
|
|
||||||
if (!nbox)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pbmi = malloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD));
|
|
||||||
|
|
||||||
combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
|
|
||||||
nbox--;
|
|
||||||
pbox++;
|
|
||||||
while (nbox--) {
|
|
||||||
hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
|
|
||||||
CombineRgn(combined, combined, hrgn, RGN_OR);
|
|
||||||
DeleteObject(hrgn);
|
|
||||||
hrgn = NULL;
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Branch on the drawable type */
|
|
||||||
switch (pDrawable->type) {
|
|
||||||
case DRAWABLE_PIXMAP:
|
|
||||||
|
|
||||||
SelectClipRgn(pGCPriv->hdcMem, combined);
|
|
||||||
DeleteObject(combined);
|
|
||||||
combined = NULL;
|
|
||||||
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
pPixmapPriv = winGetPixmapPriv(pPixmap);
|
|
||||||
|
|
||||||
/* Select the drawable pixmap into a DC */
|
|
||||||
hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
|
|
||||||
if (hbmpOrig == NULL)
|
|
||||||
FatalError("winSetSpans - DRAWABLE_PIXMAP - SelectObject () "
|
|
||||||
"failed on pPixmapPriv->hBitmap\n");
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
ZeroMemory(pbmi, sizeof(BITMAPINFO));
|
|
||||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
||||||
pbmi->bmiHeader.biWidth = *piWidths;
|
|
||||||
pbmi->bmiHeader.biHeight = 1;
|
|
||||||
pbmi->bmiHeader.biPlanes = 1;
|
|
||||||
pbmi->bmiHeader.biBitCount = pDrawable->depth;
|
|
||||||
pbmi->bmiHeader.biCompression = BI_RGB;
|
|
||||||
|
|
||||||
/* Setup color table for mono DIBs */
|
|
||||||
if (pDrawable->depth == 1) {
|
|
||||||
RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
|
|
||||||
bmiColors[1].rgbBlue = 255;
|
|
||||||
bmiColors[1].rgbGreen = 255;
|
|
||||||
bmiColors[1].rgbRed = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
StretchDIBits(pGCPriv->hdcMem,
|
|
||||||
pPoints->x, pPoints->y,
|
|
||||||
*piWidths, 1,
|
|
||||||
0, 0,
|
|
||||||
*piWidths, 1,
|
|
||||||
pSrcs,
|
|
||||||
(BITMAPINFO *) pbmi,
|
|
||||||
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
|
|
||||||
|
|
||||||
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the clip region */
|
|
||||||
SelectClipRgn(pGCPriv->hdcMem, NULL);
|
|
||||||
|
|
||||||
/* Push the drawable pixmap out of the GC HDC */
|
|
||||||
SelectObject(pGCPriv->hdcMem, hbmpOrig);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DRAWABLE_WINDOW:
|
|
||||||
|
|
||||||
SelectClipRgn(pGCPriv->hdc, combined);
|
|
||||||
DeleteObject(combined);
|
|
||||||
combined = NULL;
|
|
||||||
|
|
||||||
while (iSpans--) {
|
|
||||||
ZeroMemory(pbmi, sizeof(BITMAPINFO));
|
|
||||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
||||||
pbmi->bmiHeader.biWidth = *piWidths;
|
|
||||||
pbmi->bmiHeader.biHeight = 1;
|
|
||||||
pbmi->bmiHeader.biPlanes = 1;
|
|
||||||
pbmi->bmiHeader.biBitCount = pDrawable->depth;
|
|
||||||
pbmi->bmiHeader.biCompression = BI_RGB;
|
|
||||||
|
|
||||||
/* Setup color table for mono DIBs */
|
|
||||||
if (pDrawable->depth == 1) {
|
|
||||||
RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
|
|
||||||
bmiColors[1].rgbBlue = 255;
|
|
||||||
bmiColors[1].rgbGreen = 255;
|
|
||||||
bmiColors[1].rgbRed = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
StretchDIBits(pGCPriv->hdc,
|
|
||||||
pPoints->x, pPoints->y,
|
|
||||||
*piWidths, 1,
|
|
||||||
0, 0,
|
|
||||||
*piWidths, 1,
|
|
||||||
pSrcs,
|
|
||||||
(BITMAPINFO *) pbmi,
|
|
||||||
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
|
|
||||||
|
|
||||||
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
|
|
||||||
pPoints++;
|
|
||||||
piWidths++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the clip region */
|
|
||||||
SelectClipRgn(pGCPriv->hdc, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(pbmi);
|
|
||||||
}
|
|
|
@ -49,225 +49,6 @@ static
|
||||||
void
|
void
|
||||||
winReshapeRootless(WindowPtr pWin);
|
winReshapeRootless(WindowPtr pWin);
|
||||||
|
|
||||||
#ifdef XWIN_NATIVEGDI
|
|
||||||
/* See Porting Layer Definition - p. 37 */
|
|
||||||
/* See mfb/mfbwindow.c - mfbCreateWindow() */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winCreateWindowNativeGDI(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winCreateWindowNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(CreateWindow);
|
|
||||||
fResult = (*pScreen->CreateWindow) (pWin);
|
|
||||||
WIN_WRAP(CreateWindow, winCreateWindowNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37 */
|
|
||||||
/* See mfb/mfbwindow.c - mfbDestroyWindow() */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winDestroyWindowNativeGDI(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winDestroyWindowNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(DestroyWindow);
|
|
||||||
fResult = (*pScreen->DestroyWindow) (pWin);
|
|
||||||
WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37 */
|
|
||||||
/* See mfb/mfbwindow.c - mfbPositionWindow() */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winPositionWindowNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(PositionWindow);
|
|
||||||
fResult = (*pScreen->PositionWindow) (pWin, x, y);
|
|
||||||
WIN_WRAP(PositionWindow, winPositionWindowNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 39 */
|
|
||||||
/* See mfb/mfbwindow.c - mfbCopyWindow() */
|
|
||||||
|
|
||||||
void
|
|
||||||
winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|
||||||
{
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
DDXPointPtr ppt;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
BoxPtr pBox;
|
|
||||||
int dx, dy;
|
|
||||||
int i, nbox;
|
|
||||||
BoxPtr pBoxDst;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
ErrorF("winCopyWindow\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create a region for the destination */
|
|
||||||
prgnDst = RegionCreate(NULL, 1);
|
|
||||||
|
|
||||||
/* Calculate the shift from the source to the destination */
|
|
||||||
dx = ptOldOrg.x - pWin->drawable.x;
|
|
||||||
dy = ptOldOrg.y - pWin->drawable.y;
|
|
||||||
|
|
||||||
/* Translate the region from the destination to the source? */
|
|
||||||
RegionTranslate(prgnSrc, -dx, -dy);
|
|
||||||
RegionIntersect(prgnDst, &pWin->borderClip, prgnSrc);
|
|
||||||
|
|
||||||
/* Get a pointer to the first box in the region to be copied */
|
|
||||||
pBox = RegionRects(prgnDst);
|
|
||||||
|
|
||||||
/* Get the number of boxes in the region */
|
|
||||||
nbox = RegionNumRects(prgnDst);
|
|
||||||
|
|
||||||
/* Allocate source points for each box */
|
|
||||||
if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec))))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Set an iterator pointer */
|
|
||||||
ppt = pptSrc;
|
|
||||||
|
|
||||||
/* Calculate the source point of each box? */
|
|
||||||
for (i = nbox; --i >= 0; ppt++, pBox++) {
|
|
||||||
ppt->x = pBox->x1 + dx;
|
|
||||||
ppt->y = pBox->y1 + dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup loop pointers again */
|
|
||||||
pBoxDst = RegionRects(prgnDst);
|
|
||||||
ppt = pptSrc;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
ErrorF("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* BitBlt each source to the destination point */
|
|
||||||
for (i = nbox; --i >= 0; pBoxDst++, ppt++) {
|
|
||||||
#if 0
|
|
||||||
ErrorF("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n",
|
|
||||||
pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2,
|
|
||||||
ppt->x, ppt->y);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BitBlt(pScreenPriv->hdcScreen,
|
|
||||||
pBoxDst->x1, pBoxDst->y1,
|
|
||||||
pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1,
|
|
||||||
pScreenPriv->hdcScreen, ppt->x, ppt->y, SRCCOPY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cleanup the regions, etc. */
|
|
||||||
free(pptSrc);
|
|
||||||
RegionDestroy(prgnDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37 */
|
|
||||||
/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winChangeWindowAttributesNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(ChangeWindowAttributes);
|
|
||||||
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
|
|
||||||
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: We do not currently need to do anything here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37
|
|
||||||
* Also referred to as UnrealizeWindow
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winUnmapWindowNativeGDI(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winUnmapWindowNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(UnrealizeWindow);
|
|
||||||
fResult = (*pScreen->UnrealizeWindow) (pWin);
|
|
||||||
WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37
|
|
||||||
* Also referred to as RealizeWindow
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winMapWindowNativeGDI(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
Bool fResult = TRUE;
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
winScreenPriv(pScreen);
|
|
||||||
|
|
||||||
#if CYGDEBUG
|
|
||||||
winTrace("winMapWindowNativeGDI (%p)\n", pWin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WIN_UNWRAP(RealizeWindow);
|
|
||||||
fResult = (*pScreen->RealizeWindow) (pWin);
|
|
||||||
WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
|
|
||||||
|
|
||||||
return fResult;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* See Porting Layer Definition - p. 37 */
|
/* See Porting Layer Definition - p. 37 */
|
||||||
/* See mfb/mfbwindow.c - mfbCreateWindow() */
|
/* See mfb/mfbwindow.c - mfbCreateWindow() */
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
*/
|
*/
|
||||||
if (s_pScreenInfo->fFullScreen
|
if (s_pScreenInfo->fFullScreen
|
||||||
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
|
|
||||||
#endif
|
|
||||||
)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +187,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if (s_pScreenInfo->dwBPP !=
|
if (s_pScreenInfo->dwBPP !=
|
||||||
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
|
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
|
||||||
if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
|
if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
|
||||||
s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
|
||||||
#ifdef XWIN_PRIMARYFB
|
|
||||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
|
|
||||||
#endif
|
|
||||||
)) {
|
|
||||||
/* Cannot display the visual until the depth is restored */
|
/* Cannot display the visual until the depth is restored */
|
||||||
ErrorF("winWindowProc - Disruptive change in depth\n");
|
ErrorF("winWindowProc - Disruptive change in depth\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue