diff options
Diffstat (limited to 'xorg-server')
43 files changed, 159 insertions, 3849 deletions
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c index aa3859fdb..0122ff3a8 100644 --- a/xorg-server/Xext/panoramiXprocs.c +++ b/xorg-server/Xext/panoramiXprocs.c @@ -1908,7 +1908,7 @@ PanoramiXGetImage(ClientPtr client) } rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); + XRC_DRAWABLE, client, DixReadAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index c6971889c..ac68f17b6 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -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_CLIPBOARD, [test "x$XWIN" = 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_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes]) diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c index 21baf8950..f9c991774 100644 --- a/xorg-server/fb/fbpict.c +++ b/xorg-server/fb/fbpict.c @@ -326,7 +326,7 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff) * only set the clip region for pictures with drawables */ if (has_clip) { - if (pict->clientClipType != CT_NONE) + if (pict->clientClip) pixman_image_set_has_client_clip(image, TRUE); if (*xoff || *yoff) diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c index c756bf570..5a8966f74 100644 --- a/xorg-server/glx/glxdri2.c +++ b/xorg-server/glx/glxdri2.c @@ -475,7 +475,7 @@ create_driver_context(__GLXDRIcontext * context, context->driContext = NULL; if (screen->dri2->base.version >= 3) { - uint32_t ctx_attribs[3 * 2]; + uint32_t ctx_attribs[4 * 2]; unsigned num_ctx_attribs = 0; unsigned dri_err = 0; unsigned major_ver; @@ -510,6 +510,8 @@ create_driver_context(__GLXDRIcontext * context, __DRI_CTX_ATTRIB_RESET_STRATEGY; ctx_attribs[num_ctx_attribs++] = reset; } + + assert(num_ctx_attribs <= ARRAY_SIZE(ctx_attribs)); } context->driContext = diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 8b88f3e6d..57617107d 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -68,6 +68,7 @@ typedef struct _EphyrInputPrivate { Bool EphyrWantGrayScale = 0; Bool EphyrWantResize = 0; +Bool EphyrWantNoHostGrab = 0; Bool host_has_extension(xcb_extension_t *extension) @@ -649,7 +650,11 @@ ephyrInitScreen(ScreenPtr pScreen) EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum); hostx_set_screen_number(screen, pScreen->myNum); - hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)"); + if (EphyrWantNoHostGrab) { + hostx_set_win_title(screen, "xephyr"); + } else { + hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)"); + } pScreen->CreateColormap = ephyrCreateColormap; #ifdef XV @@ -1092,12 +1097,13 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev) if (!keysyms) keysyms = xcb_key_symbols_alloc(conn); - if (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L + if (!EphyrWantNoHostGrab && + (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R) && (key->state & XCB_MOD_MASK_CONTROL)) || ((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R) - && (key->state & XCB_MOD_MASK_SHIFT))) { + && (key->state & XCB_MOD_MASK_SHIFT)))) { KdScreenInfo *screen = screen_from_window(key->event); EphyrScrPriv *scrpriv = screen->driver; diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c index 36935318a..bcfb7506d 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c @@ -33,6 +33,7 @@ extern Window EphyrPreExistingHostWin; extern Bool EphyrWantGrayScale; extern Bool EphyrWantResize; +extern Bool EphyrWantNoHostGrab; extern Bool kdHasPointer; extern Bool kdHasKbd; extern Bool ephyr_glamor, ephyr_glamor_gles2; @@ -153,6 +154,7 @@ ddxUseMsg(void) ErrorF("-name [name] define the name in the WM_CLASS property\n"); ErrorF ("-title [title] set the window title in the WM_NAME property\n"); + ErrorF("-no-host-grab Disable grabbing the keyboard and mouse.\n"); ErrorF("\n"); } @@ -360,6 +362,10 @@ ddxProcessArgument(int argc, char **argv, int i) return 2; } /* end Xnest compat */ + else if (!strcmp(argv[i], "-no-host-grab")) { + EphyrWantNoHostGrab = 1; + return 2; + } return KdProcessArgument(argc, argv, i); } diff --git a/xorg-server/hw/kdrive/ephyr/man/Xephyr.man b/xorg-server/hw/kdrive/ephyr/man/Xephyr.man index f14f6c864..c04379035 100644 --- a/xorg-server/hw/kdrive/ephyr/man/Xephyr.man +++ b/xorg-server/hw/kdrive/ephyr/man/Xephyr.man @@ -63,6 +63,9 @@ improvement is negligible. .B -resizeable Allow the Xephyr window to be resized, even if not embedded into a parent window. By default, the Xephyr window has a fixed size. +.TP 8 +.B -no-host-grab +Disable grabbing the keyboard and mouse. .SH "SIGNALS" Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to toggle the debugging mode. diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 88bc85a44..e86711962 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -735,12 +735,6 @@ winUseMsg(void) "\t\t1 - Shadow GDI\n" "\t\t2 - Shadow DirectDraw\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"); diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index 2c7fde313..0ea8ba769 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -37,27 +37,6 @@ DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la 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 SRCS_RANDR = \ winrandr.c diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man index c71f6a154..a043ac281 100644 --- a/xorg-server/hw/xwin/man/XWin.man +++ b/xorg-server/hw/xwin/man/XWin.man @@ -261,10 +261,6 @@ Shadow GDI Shadow DirectDraw .IP 4 4 Shadow DirectDraw Non-Locking -.IP 8 4 -Primary DirectDraw (unsupported, obsolete) -.IP 16 4 -Native GDI (unsupported, experimental and barely functional) .RE .SH FULLSCREEN OPTIONS diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 7af35e71b..ed1ad01dc 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -103,12 +103,6 @@ #define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ #define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ #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 NumLockMapIndex Mod2MapIndex @@ -304,12 +298,6 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin); 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 */ @@ -582,12 +570,6 @@ typedef struct _winPrivScreenRec { SetShapeProcPtr SetShape; winCursorRec cursor; - -#ifdef XWIN_NATIVEGDI - RealizeFontPtr RealizeFont; - UnrealizeFontPtr UnrealizeFont; -#endif - } winPrivScreenRec; #ifdef XWIN_MULTIWINDOWEXTWM @@ -775,15 +757,6 @@ void winBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadMask); -#ifdef XWIN_NATIVEGDI -/* - * winclip.c - */ - -RegionPtr - winPixmapToRegionNativeGDI(PixmapPtr pPix); -#endif - #ifdef XWIN_CLIPBOARD /* * winclipboardinit.c @@ -859,52 +832,6 @@ void winMessageBoxF(const char *pszError, UINT uType, ...) _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 */ @@ -956,23 +883,12 @@ void * winmisc.c */ -#ifdef XWIN_NATIVEGDI -void - -winQueryBestSizeNativeGDI(int class, unsigned short *pWidth, - unsigned short *pHeight, ScreenPtr pScreen); -#endif - CARD8 winCountBits(DWORD dw); Bool winUpdateFBPointer(ScreenPtr pScreen, void *pbits); -#ifdef XWIN_NATIVEGDI -BOOL winPaintBackground(HWND hwnd, COLORREF colorref); -#endif - /* * winmouse.c */ @@ -994,60 +910,6 @@ winMouseButtonsHandle(ScreenPtr pScreen, void 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 */ @@ -1058,26 +920,6 @@ Bool Bool 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 */ @@ -1112,30 +954,6 @@ winWakeupHandler(ScreenPtr pScreen, * 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 winCreateWindowRootless(WindowPtr pWindow); diff --git a/xorg-server/hw/xwin/winclip.c b/xorg-server/hw/xwin/winclip.c deleted file mode 100644 index 941e9483a..000000000 --- a/xorg-server/hw/xwin/winclip.c +++ /dev/null @@ -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; -} diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 6732dcb58..9f7201620 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -110,20 +110,8 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen) GetModuleHandle(NULL), /* Instance handle */ pScreenPriv); /* ScreenPrivates */ - /* Branch on the server engine */ - switch (pScreenInfo->dwEngine) { -#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; - } + /* Hide the window */ + ShowWindow(*phwnd, SW_SHOWNORMAL); /* Send first paint message */ 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"); return TRUE; diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c index 1f55ada58..b473b3ac0 100644 --- a/xorg-server/hw/xwin/winengine.c +++ b/xorg-server/hw/xwin/winengine.c @@ -59,10 +59,6 @@ winDetectSupportedEngines(void) /* Initialize the engine support flags */ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI; -#ifdef XWIN_NATIVEGDI - g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI; -#endif - /* Get operating system version information */ ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(osvi); @@ -94,15 +90,6 @@ winDetectSupportedEngines(void) winErrorFVerb(2, "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n"); 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 */ @@ -206,16 +193,6 @@ winSetEngine(ScreenPtr pScreen) case WIN_SERVER_SHADOW_DDNL: winSetEngineFunctionsShadowDDNL(pScreen); 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: FatalError("winSetEngine - Invalid engine type\n"); } diff --git a/xorg-server/hw/xwin/winfillsp.c b/xorg-server/hw/xwin/winfillsp.c deleted file mode 100644 index bd0a15e8a..000000000 --- a/xorg-server/hw/xwin/winfillsp.c +++ /dev/null @@ -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; - } -} diff --git a/xorg-server/hw/xwin/winfont.c b/xorg-server/hw/xwin/winfont.c deleted file mode 100644 index 7bcbce1c7..000000000 --- a/xorg-server/hw/xwin/winfont.c +++ /dev/null @@ -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 diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c deleted file mode 100644 index 5986e0a47..000000000 --- a/xorg-server/hw/xwin/wingc.c +++ /dev/null @@ -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 diff --git a/xorg-server/hw/xwin/wingetsp.c b/xorg-server/hw/xwin/wingetsp.c deleted file mode 100644 index 049e2c939..000000000 --- a/xorg-server/hw/xwin/wingetsp.c +++ /dev/null @@ -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; - } -} diff --git a/xorg-server/hw/xwin/winmisc.c b/xorg-server/hw/xwin/winmisc.c index 10f97322f..bea6290c6 100644 --- a/xorg-server/hw/xwin/winmisc.c +++ b/xorg-server/hw/xwin/winmisc.c @@ -33,21 +33,6 @@ #endif #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. */ @@ -93,51 +78,3 @@ winUpdateFBPointer(ScreenPtr pScreen, void *pbits) 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 diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c deleted file mode 100644 index 1859698a0..000000000 --- a/xorg-server/hw/xwin/winnativegdi.c +++ /dev/null @@ -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; -} diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c deleted file mode 100644 index 010616101..000000000 --- a/xorg-server/hw/xwin/winpfbdd.c +++ /dev/null @@ -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; -} diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c deleted file mode 100644 index ef158c854..000000000 --- a/xorg-server/hw/xwin/winpixmap.c +++ /dev/null @@ -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 diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c deleted file mode 100644 index 8b7e10645..000000000 --- a/xorg-server/hw/xwin/winpolyline.c +++ /dev/null @@ -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; - } -} diff --git a/xorg-server/hw/xwin/winrop.c b/xorg-server/hw/xwin/winrop.c deleted file mode 100644 index 1f9ff7320..000000000 --- a/xorg-server/hw/xwin/winrop.c +++ /dev/null @@ -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; - } -} diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index 23152cbd2..ed1773c11 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -570,145 +570,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) 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 */ static Bool winSaveScreen(ScreenPtr pScreen, int on) diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c deleted file mode 100644 index 11108cb53..000000000 --- a/xorg-server/hw/xwin/winsetsp.c +++ /dev/null @@ -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); -} diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index 8c1c28f2a..934f6d845 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -49,225 +49,6 @@ static void 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 mfb/mfbwindow.c - mfbCreateWindow() */ diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index e3adb5605..1b0992186 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -163,11 +163,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) */ if (s_pScreenInfo->fFullScreen && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL -#ifdef XWIN_PRIMARYFB - || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD -#endif - )) { + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) { break; } @@ -191,11 +187,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (s_pScreenInfo->dwBPP != GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) { if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD || - s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL -#ifdef XWIN_PRIMARYFB - || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD -#endif - )) { + s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) { /* Cannot display the visual until the depth is restored */ ErrorF("winWindowProc - Disruptive change in depth\n"); diff --git a/xorg-server/mi/mibitblt.c b/xorg-server/mi/mibitblt.c index 08bd1c5b2..114f72d5b 100644 --- a/xorg-server/mi/mibitblt.c +++ b/xorg-server/mi/mibitblt.c @@ -72,7 +72,7 @@ extern int ffs(int); * set them in the destination with SetSpans * We let SetSpans worry about clipping to the destination. */ -RegionPtr +_X_COLD RegionPtr miCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, @@ -261,8 +261,7 @@ miCopyArea(DrawablePtr pSrcDrawable, * This should be replaced with something more general. mi shouldn't have to * care about such things as scanline padding et alia. */ -static -MiBits * +_X_COLD static MiBits * miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */ int sx, int sy, int w, int h, MiBits * result) { @@ -368,7 +367,7 @@ miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */ * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ -static void +_X_COLD static void miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, MiBits * pbits, int srcx, int w, int h, int dstx, int dsty) { @@ -510,7 +509,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, * build a source clip * Use the bitmap we've built up as a Stipple for the destination */ -RegionPtr +_X_COLD RegionPtr miCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, @@ -599,7 +598,7 @@ miCopyPlane(DrawablePtr pSrcDrawable, * XY format: * get the single plane specified in planemask */ -void +_X_COLD void miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char *pDst) { @@ -689,7 +688,7 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, * ZPixmap format: * This part is simple, just call SetSpans */ -void +_X_COLD void miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { diff --git a/xorg-server/mi/mifillrct.c b/xorg-server/mi/mifillrct.c index 79c4057d7..faf60498b 100644 --- a/xorg-server/mi/mifillrct.c +++ b/xorg-server/mi/mifillrct.c @@ -65,7 +65,7 @@ SOFTWARE. * then call FillSpans to fill each rectangle. We let FillSpans worry about * clipping to the destination */ -void +_X_COLD void miPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, /* number of rectangles to fill */ xRectangle *prectInit /* Pointer to first rectangle to fill */ ) diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 80415c4b0..75769f17c 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -1373,6 +1373,7 @@ System(const char *command) switch (pid = fork()) { case -1: /* error */ p = -1; + break; case 0: /* child */ if (setgid(getgid()) == -1) _exit(127); diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c index 3959fc415..a72510480 100644 --- a/xorg-server/render/mipict.c +++ b/xorg-server/render/mipict.c @@ -49,23 +49,9 @@ miDestroyPicture(PicturePtr pPicture) void miDestroyPictureClip(PicturePtr pPicture) { - switch (pPicture->clientClipType) { - case CT_NONE: - return; - case CT_PIXMAP: - (*pPicture->pDrawable->pScreen-> - DestroyPixmap) ((PixmapPtr) (pPicture->clientClip)); - break; - default: - /* - * we know we'll never have a list of rectangles, since ChangeClip - * immediately turns them into a region - */ + if (pPicture->clientClip) RegionDestroy(pPicture->clientClip); - break; - } pPicture->clientClip = NULL; - pPicture->clientClipType = CT_NONE; } int @@ -73,37 +59,31 @@ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); - void *clientClip; - int clientClipType; + RegionPtr clientClip; switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ - clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value); + clientClip = BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; - clientClipType = CT_REGION; (*pScreen->DestroyPixmap) ((PixmapPtr) value); break; case CT_REGION: clientClip = value; - clientClipType = CT_REGION; break; case CT_NONE: clientClip = 0; - clientClipType = CT_NONE; break; default: - clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type); + clientClip = RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) return BadAlloc; - clientClipType = CT_REGION; free(value); break; } (*ps->DestroyPictureClip) (pPicture); pPicture->clientClip = clientClip; - pPicture->clientClipType = clientClipType; pPicture->stateChanges |= CPClipMask; return Success; } @@ -144,7 +124,7 @@ miValidatePicture(PicturePtr pPicture, Mask mask) * copying of regions. (this wins especially if many clients clip * by children and have no client clip.) */ - if (pPicture->clientClipType == CT_NONE) { + if (!pPicture->clientClip) { if (freeCompClip) RegionDestroy(pPicture->pCompositeClip); pPicture->pCompositeClip = pregWin; @@ -203,7 +183,7 @@ miValidatePicture(PicturePtr pPicture, Mask mask) pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); } - if (pPicture->clientClipType == CT_REGION) { + if (pPicture->clientClip) { if (pDrawable->x || pDrawable->y) { RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, @@ -284,7 +264,7 @@ miClipPictureReg(pixman_region16_t * pRegion, static inline Bool miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy) { - if (pPicture->clientClipType != CT_NONE) { + if (pPicture->clientClip) { Bool result; pixman_region_translate(pPicture->clientClip, diff --git a/xorg-server/render/mirect.c b/xorg-server/render/mirect.c index 4e76972d1..a36d1d6e3 100644 --- a/xorg-server/render/mirect.c +++ b/xorg-server/render/mirect.c @@ -54,7 +54,7 @@ miColorRects(PicturePtr pDst, tmpval[1].val = pixel; tmpval[2].val = pDst->subWindowMode; mask = GCFunction | GCForeground | GCSubwindowMode; - if (pClipPict->clientClipType == CT_REGION) { + if (pClipPict->clientClip) { tmpval[3].val = pDst->clipOrigin.x - xoff; tmpval[4].val = pDst->clipOrigin.y - yoff; mask |= GCClipXOrigin | GCClipYOrigin; diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c index 58535d475..cd9bc7485 100644 --- a/xorg-server/render/picture.c +++ b/xorg-server/render/picture.c @@ -731,7 +731,6 @@ SetPictureToDefaults(PicturePtr pPicture) pPicture->polyEdge = PolyEdgeSharp; pPicture->polyMode = PolyModePrecise; pPicture->freeCompClip = FALSE; - pPicture->clientClipType = CT_NONE; pPicture->componentAlpha = FALSE; pPicture->repeatType = RepeatNone; diff --git a/xorg-server/render/picturestr.h b/xorg-server/render/picturestr.h index 1278f620a..177f87b80 100644 --- a/xorg-server/render/picturestr.h +++ b/xorg-server/render/picturestr.h @@ -132,7 +132,6 @@ typedef struct _Picture { unsigned int polyEdge:1; unsigned int polyMode:1; unsigned int freeCompClip:1; - unsigned int clientClipType:2; unsigned int componentAlpha:1; unsigned int repeatType:2; unsigned int filter:3; @@ -145,7 +144,7 @@ typedef struct _Picture { DDXPointRec alphaOrigin; DDXPointRec clipOrigin; - void *clientClip; + RegionPtr clientClip; unsigned long serialNumber; diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c index f9de52542..4cfeee1a1 100644 --- a/xorg-server/xfixes/region.c +++ b/xorg-server/xfixes/region.c @@ -272,20 +272,12 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client) if (!pPicture->pDrawable) return RenderErrBase + BadPicture; - switch (pPicture->clientClipType) { - case CT_PIXMAP: - pRegion = BitmapToRegion(pPicture->pDrawable->pScreen, - (PixmapPtr) pPicture->clientClip); - if (!pRegion) - return BadAlloc; - break; - case CT_REGION: + if (pPicture->clientClip) { pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip); if (!pRegion) return BadAlloc; - break; - default: - return BadImplementation; /* assume sane server bits */ + } else { + return BadMatch; } if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 3fd0ce427..682f8c9f9 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -4448,6 +4448,18 @@ </languageList> </configItem> </variant> + <variant> + <configItem> + <name>phonetic_azerty</name> + <_description>Russian (phonetic azerty)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>phonetic_fr</name> + <_description>Russian (phonetic French)</_description> + </configItem> + </variant> </variantList> </layout> <layout> diff --git a/xorg-server/xkeyboard-config/symbols/keypad b/xorg-server/xkeyboard-config/symbols/keypad index 1efc02b48..a26602435 100644 --- a/xorg-server/xkeyboard-config/symbols/keypad +++ b/xorg-server/xkeyboard-config/symbols/keypad @@ -1,3 +1,27 @@ +default hidden partial keypad_keys +xkb_symbols "x11" { + + include "keypad(operators)" + + key <KP7> { [ KP_Home, KP_7 ] }; + key <KP8> { [ KP_Up, KP_8 ] }; + key <KP9> { [ KP_Prior, KP_9 ] }; + + key <KP4> { [ KP_Left, KP_4 ] }; + key <KP5> { [ KP_Begin, KP_5 ] }; + key <KP6> { [ KP_Right, KP_6 ] }; + + key <KP1> { [ KP_End, KP_1 ] }; + key <KP2> { [ KP_Down, KP_2 ] }; + key <KP3> { [ KP_Next, KP_3 ] }; + key <KPEN> { [ KP_Enter ] }; + key <KPEQ> { [ KP_Equal ] }; + + key <KP0> { [ KP_Insert, KP_0 ] }; + key <KPDL> { [ KP_Delete, KP_Decimal ] }; + key <KPPT> { [ KP_Decimal, KP_Decimal ] }; +}; + hidden partial keypad_keys xkb_symbols "overlay" { include "keypad(overlay1)" @@ -93,31 +117,6 @@ xkb_symbols "operators" { }; }; -default hidden partial keypad_keys -xkb_symbols "x11" { - - include "keypad(operators)" - - key <KP7> { [ KP_Home, KP_7 ] }; - key <KP8> { [ KP_Up, KP_8 ] }; - key <KP9> { [ KP_Prior, KP_9 ] }; - - key <KP4> { [ KP_Left, KP_4 ] }; - key <KP5> { [ KP_Begin, KP_5 ] }; - key <KP6> { [ KP_Right, KP_6 ] }; - - key <KP1> { [ KP_End, KP_1 ] }; - key <KP2> { [ KP_Down, KP_2 ] }; - key <KP3> { [ KP_Next, KP_3 ] }; - key <KPEN> { [ KP_Enter ] }; - key <KPEQ> { [ KP_Equal ] }; - - key <KP0> { [ KP_Insert, KP_0 ] }; - key <KPDL> { [ KP_Delete, KP_Decimal ] }; - key <KPPT> { [ KP_Decimal, KP_Decimal ] }; -}; - - // Legacy PC keypad definition // Copyright © 2006-2007 Nicolas Mailhot <nicolas.mailhot @ laposte.net> keypad_keys diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch index 7948ab19d..2f0b4cf03 100644 --- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch +++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch @@ -3,6 +3,7 @@ // Andreas Tobler <a.tobler@schweiz.ch> // modified for Swiss German Apple Extended Keyboard II +default partial alphanumeric_keys xkb_symbols "extended" { diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk index e464519e0..d3ba80dcd 100644 --- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk +++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk @@ -1,4 +1,4 @@ -partial alphanumeric_keys +default partial alphanumeric_keys xkb_symbols "basic" { // Describes the differences between a very simple en_US diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it index 3784b0e05..17f78e948 100644 --- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it +++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it @@ -1,3 +1,4 @@ +default xkb_symbols "extended" { name[Group1]= "Italy - Mac"; diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us index 81e4b77b9..58bfee509 100644 --- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us +++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us @@ -1,6 +1,6 @@ // symbols definition for a Macintosh "Extended" keyboard -xkb_symbols "extended" { +default xkb_symbols "extended" { name[Group1]= "USA"; key <ESC> { [ Escape ] }; @@ -59,7 +59,7 @@ xkb_symbols "extended" { key <SPCE> { [ space ] }; include "eurosign(e)" - include "keypad" + include "keypad(overlay)" key <KPEQ> { [ equal ] }; }; diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru index c4f48186f..37b61a7dc 100644 --- a/xorg-server/xkeyboard-config/symbols/ru +++ b/xorg-server/xkeyboard-config/symbols/ru @@ -498,6 +498,77 @@ xkb_symbols "chm" { include "level3(ralt_switch)" }; +partial alphanumeric_keys +xkb_symbols "phonetic_azerty" { + + include "level3(ralt_switch)" + + name[Group1]= "Russian (phonetic azerty)"; + + key <AE01> { [ ampersand, 1, onesuperior, exclamdown ] }; + key <AE02> { [ eacute, 2, asciitilde, oneeighth ] }; + key <AE03> { [ quotedbl, 3, numbersign, sterling ] }; + key <AE04> { [apostrophe, 4, braceleft, dollar ] }; + key <AE05> { [ parenleft, 5, bracketleft, threeeighths ] }; + key <AE06> { [ minus, 6, bar, fiveeighths ] }; + key <AE07> { [ egrave, 7, grave, seveneighths ] }; + key <AE08> { [underscore, 8, backslash, trademark ] }; + key <AE09> { [ ccedilla, 9, asciicircum, plusminus ] }; + key <AE10> { [ agrave, 0, at, degree ] }; + key <AE11> { [parenright, degree, bracketright, questiondown ] }; + key <AE12> { [ equal, plus, braceright, dead_ogonek ] }; + + key <AB07> { [ comma, question, acute, doubleacute ] }; + key <AB08> { [ semicolon, period, horizconnector, multiply ] }; + key <AB09> { [ colon, slash, periodcentered, division ] }; + key <AB10> { [ exclam, section, dead_belowdot, dead_abovedot ] }; + + key <AC11> { [ ugrave, percent, asciicircum, caron ] }; + key <LSGT> { [ bar, brokenbar ] }; + + key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AC01> { [ Cyrillic_ya, Cyrillic_YA ] }; // Q + key <AD02> { [ Cyrillic_ze, Cyrillic_ZE ] }; // Z + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AD01> { [ Cyrillic_a, Cyrillic_A ] }; + key <AB01> { [ Cyrillic_ve, Cyrillic_VE ] }; // W + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatX> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC10> { [ Cyrillic_em, Cyrillic_EM ] }; // M + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AE12> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <BKSL> { [ Cyrillic_e, Cyrillic_E ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic_fr" { + + include "fr" + include "ru(phonetic_azerty)" + + name[Group1]= "Russian (phonetic French)"; +}; + // EXTRAS: // Church Slavonic language layout |