diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-12-13 18:38:25 -0500 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-12-13 18:38:25 -0500 |
commit | c8feb73f5841e7812d8dfdb91f1064e2033d028c (patch) | |
tree | 4f176f28ec27a4e5bfb9c671e569838741b6bfbd /miext | |
parent | 9a7ce573636e349ee2967991c7cc1407e80ae524 (diff) | |
parent | a125ce4a84f5fb5934fefebd7cfb22a83180874d (diff) |
Merge branch 'master' into XACE-SELINUX
Conflicts:
Xext/EVI.c
Xext/bigreq.c
Xext/cup.c
Xext/dpms.c
Xext/fontcache.c
Xext/mitmisc.c
Xext/xcmisc.c
Xext/xf86bigfont.c
Xext/xtest.c
configure.ac
dbe/dbe.c
hw/darwin/darwin.h
hw/darwin/darwinEvents.c
hw/darwin/iokit/xfIOKit.h
hw/darwin/iokit/xfIOKitCursor.c
hw/darwin/quartz/fullscreen/fullscreen.c
hw/darwin/quartz/fullscreen/quartzCursor.c
hw/darwin/quartz/quartz.c
hw/darwin/quartz/quartzCommon.h
hw/darwin/quartz/quartzCursor.c
hw/darwin/quartz/xpr/dri.c
hw/darwin/quartz/xpr/dristruct.h
hw/darwin/quartz/xpr/xprCursor.c
hw/darwin/quartz/xpr/xprFrame.c
hw/xfree86/modes/xf86RandR12.c
include/cursor.h
miext/rootless/rootlessCommon.h
miext/rootless/rootlessScreen.c
miext/rootless/rootlessWindow.c
render/picturestr.h
Trying to pick up the pieces from the darwin churn here...
Diffstat (limited to 'miext')
-rwxr-xr-x | miext/damage/damage.c | 3 | ||||
-rw-r--r-- | miext/rootless/Makefile.am | 19 | ||||
-rw-r--r-- | miext/rootless/accel/Makefile.am | 25 | ||||
-rw-r--r-- | miext/rootless/accel/rlBlt.c | 44 | ||||
-rw-r--r-- | miext/rootless/accel/rlFill.c | 6 | ||||
-rw-r--r-- | miext/rootless/rootless.h | 1 | ||||
-rw-r--r-- | miext/rootless/rootlessCommon.c | 81 | ||||
-rw-r--r-- | miext/rootless/rootlessCommon.h | 23 | ||||
-rw-r--r-- | miext/rootless/rootlessConfig.h | 4 | ||||
-rw-r--r-- | miext/rootless/rootlessScreen.c | 68 | ||||
-rw-r--r-- | miext/rootless/rootlessValTree.c | 12 | ||||
-rw-r--r-- | miext/rootless/rootlessWindow.c | 58 | ||||
-rw-r--r-- | miext/rootless/rootlessWindow.h | 3 | ||||
-rw-r--r-- | miext/rootless/safeAlpha/Makefile.am | 8 | ||||
-rw-r--r-- | miext/rootless/safeAlpha/safeAlphaPicture.c | 109 |
15 files changed, 355 insertions, 109 deletions
diff --git a/miext/damage/damage.c b/miext/damage/damage.c index bd626b390..56864c56d 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -242,9 +242,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, if (pDamage->pDrawable->type == DRAWABLE_WINDOW && !((WindowPtr) (pDamage->pDrawable))->realized) { -#if 0 - DAMAGE_DEBUG (("damage while window unrealized\n")); -#endif continue; } diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am index 8dae6d237..aa8528e6a 100644 --- a/miext/rootless/Makefile.am +++ b/miext/rootless/Makefile.am @@ -1,22 +1,19 @@ -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - $(XORG_CFLAGS) - -INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support +AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support SUBDIRS = safeAlpha accel noinst_LTLIBRARIES = librootless.la librootless_la_SOURCES = \ rootlessCommon.c \ - rootlessCommon.h \ - rootlessConfig.h \ rootlessGC.c \ - rootless.h \ rootlessScreen.c \ rootlessValTree.c \ - rootlessWindow.c \ - rootlessWindow.h + rootlessWindow.c EXTRA_DIST = \ - README.txt + README.txt \ + rootless.h \ + rootlessCommon.h \ + rootlessConfig.h \ + rootlessWindow.h diff --git a/miext/rootless/accel/Makefile.am b/miext/rootless/accel/Makefile.am index c49d5fb47..ca41653b7 100644 --- a/miext/rootless/accel/Makefile.am +++ b/miext/rootless/accel/Makefile.am @@ -1,18 +1,15 @@ -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - $(XORG_CFLAGS) - -INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support - +AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) +AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support noinst_LTLIBRARIES = librlAccel.la -librlAccel_la_SOURCES = rlAccel.c \ - rlBlt.c \ - rlCopy.c \ - rlFill.c \ - rlFillRect.c \ - rlFillSpans.c \ - rlGlyph.c \ - rlSolid.c +librlAccel_la_SOURCES = \ + rlAccel.c \ + rlBlt.c \ + rlCopy.c \ + rlFill.c \ + rlFillRect.c \ + rlFillSpans.c \ + rlGlyph.c \ + rlSolid.c EXTRA_DIST = rlAccel.h diff --git a/miext/rootless/accel/rlBlt.c b/miext/rootless/accel/rlBlt.c index 2cf72eb22..b5fe74085 100644 --- a/miext/rootless/accel/rlBlt.c +++ b/miext/rootless/accel/rlBlt.c @@ -32,10 +32,22 @@ #endif #include <stddef.h> /* For NULL */ +#include <string.h> #include "fb.h" #include "rootlessCommon.h" #include "rlAccel.h" +#define InitializeShifts(sx,dx,ls,rs) { \ + if (sx != dx) { \ + if (sx > dx) { \ + ls = sx - dx; \ + rs = FB_UNIT - ls; \ + } else { \ + rs = dx - sx; \ + ls = FB_UNIT - rs; \ + } \ + } \ +} void rlBlt (FbBits *srcLine, @@ -74,6 +86,29 @@ rlBlt (FbBits *srcLine, return; } #endif + + if (alu == GXcopy && pm == FB_ALLONES && !reverse && + !(srcX & 7) && !(dstX & 7) && !(width & 7)) { + int i; + CARD8 *src = (CARD8 *) srcLine; + CARD8 *dst = (CARD8 *) dstLine; + + srcStride *= sizeof(FbBits); + dstStride *= sizeof(FbBits); + width >>= 3; + src += (srcX >> 3); + dst += (dstX >> 3); + + if (!upsidedown) + for (i = 0; i < height; i++) + memcpy(dst + i * dstStride, src + i * srcStride, width); + else + for (i = height - 1; i >= 0; i--) + memcpy(dst + i * dstStride, src + i * srcStride, width); + + return; + } + FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); if (upsidedown) @@ -325,9 +360,12 @@ rlBlt (FbBits *srcLine, bits1 = *src++; if (startmask) { - bits = FbScrLeft(bits1, leftShift); - bits1 = *src++; - bits |= FbScrRight(bits1, rightShift); + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(startmask, rightShift)) + { + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + } FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); dst++; } diff --git a/miext/rootless/accel/rlFill.c b/miext/rootless/accel/rlFill.c index 0d0d01251..a80c7769f 100644 --- a/miext/rootless/accel/rlFill.c +++ b/miext/rootless/accel/rlFill.c @@ -89,7 +89,7 @@ rlFill (DrawablePtr pDrawable, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff), - pGC->patOrg.y + pDrawable->y + dstYoff - y); + pGC->patOrg.y + pDrawable->y - y); } else { @@ -126,7 +126,7 @@ rlFill (DrawablePtr pDrawable, fgand, fgxor, bgand, bgxor, pGC->patOrg.x + pDrawable->x + dstXoff, - pGC->patOrg.y + pDrawable->y + dstYoff - y); + pGC->patOrg.y + pDrawable->y - y); } break; } @@ -154,7 +154,7 @@ rlFill (DrawablePtr pDrawable, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, - pGC->patOrg.y + pDrawable->y + dstYoff - y); + pGC->patOrg.y + pDrawable->y - y); break; } } diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h index b4a5b2a3d..5224dca2b 100644 --- a/miext/rootless/rootless.h +++ b/miext/rootless/rootless.h @@ -66,7 +66,6 @@ typedef struct _RootlessWindowRec { int bytesPerRow; PixmapPtr pixmap; - PixmapPtr oldPixmap; #ifdef ROOTLESS_TRACK_DAMAGE RegionRec damage; diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c index 9cbb7fa1b..97c92d309 100644 --- a/miext/rootless/rootlessCommon.c +++ b/miext/rootless/rootlessCommon.c @@ -37,6 +37,7 @@ #include <limits.h> /* For CHAR_BIT */ #include "rootlessCommon.h" +#include "colormapst.h" unsigned int rootless_CopyBytes_threshold = 0; unsigned int rootless_FillBytes_threshold = 0; @@ -98,6 +99,41 @@ IsFramedWindow(WindowPtr pWin) return (top && WINREC(top)); } +Bool +RootlessResolveColormap (ScreenPtr pScreen, int first_color, + int n_colors, uint32_t *colors) +{ + int last, i; + ColormapPtr map; + + map = RootlessGetColormap (pScreen); + if (map == NULL || map->class != PseudoColor) return FALSE; + + last = MIN (map->pVisual->ColormapEntries, first_color + n_colors); + for (i = MAX (0, first_color); i < last; i++) { + Entry *ent = map->red + i; + uint16_t red, green, blue; + + if (!ent->refcnt) continue; + if (ent->fShared) { + red = ent->co.shco.red->color; + green = ent->co.shco.green->color; + blue = ent->co.shco.blue->color; + } else { + red = ent->co.local.red; + green = ent->co.local.green; + blue = ent->co.local.blue; + } + + colors[i - first_color] = (0xFF000000UL + | ((uint32_t) red & 0xff00) << 8 + | (green & 0xff00) + | (blue >> 8)); + } + + return TRUE; +} + /* * RootlessStartDrawing @@ -136,8 +172,24 @@ void RootlessStartDrawing(WindowPtr pWindow) winRec->is_drawing = TRUE; } - winRec->oldPixmap = pScreen->GetWindowPixmap(pWindow); - pScreen->SetWindowPixmap(pWindow, winRec->pixmap); + PixmapPtr curPixmap = pScreen->GetWindowPixmap(pWindow); + if (curPixmap == winRec->pixmap) + { + RL_DEBUG_MSG("Window %p already has winRec->pixmap %p; not pushing\n", pWindow, winRec->pixmap); + } + else + { + PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey); + if (oldPixmap != NULL) + { + if (oldPixmap == curPixmap) + RL_DEBUG_MSG("Window %p's curPixmap %p is the same as its oldPixmap; strange\n", pWindow, curPixmap); + else + RL_DEBUG_MSG("Window %p's existing oldPixmap %p being lost!\n", pWindow, oldPixmap); + } + dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, curPixmap); + pScreen->SetWindowPixmap(pWindow, winRec->pixmap); + } } @@ -146,6 +198,29 @@ void RootlessStartDrawing(WindowPtr pWindow) * Stop drawing to a window's backing buffer. If flush is true, * damaged regions are flushed to the screen. */ +static int RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data) +{ + RootlessWindowRec *winRec = (RootlessWindowRec*)data; + ScreenPtr pScreen = pWindow->drawable.pScreen; + PixmapPtr exPixmap = pScreen->GetWindowPixmap(pWindow); + PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey); + if (oldPixmap == NULL) + { + if (exPixmap == winRec->pixmap) + RL_DEBUG_MSG("Window %p appears to be in drawing mode (ex-pixmap %p equals winRec->pixmap, which is being freed) but has no oldPixmap!\n", pWindow, exPixmap); + } + else + { + if (exPixmap != winRec->pixmap) + RL_DEBUG_MSG("Window %p appears to be in drawing mode (oldPixmap %p) but ex-pixmap %p not winRec->pixmap %p!\n", pWindow, oldPixmap, exPixmap, winRec->pixmap); + if (oldPixmap == winRec->pixmap) + RL_DEBUG_MSG("Window %p's oldPixmap %p is winRec->pixmap, which has just been freed!\n", pWindow, oldPixmap); + pScreen->SetWindowPixmap(pWindow, oldPixmap); + dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL); + } + return WT_WALKCHILDREN; +} + void RootlessStopDrawing(WindowPtr pWindow, Bool flush) { ScreenPtr pScreen = pWindow->drawable.pScreen; @@ -162,7 +237,7 @@ void RootlessStopDrawing(WindowPtr pWindow, Bool flush) SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush); FreeScratchPixmapHeader(winRec->pixmap); - pScreen->SetWindowPixmap(pWindow, winRec->oldPixmap); + TraverseTree(top, RestorePreDrawingPixmapVisitor, (pointer)winRec); winRec->pixmap = NULL; winRec->is_drawing = FALSE; diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index 537ffdae4..9e4a14a04 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -32,12 +32,17 @@ #include <dix-config.h> #endif +#include <stdint.h> #ifndef _ROOTLESSCOMMON_H #define _ROOTLESSCOMMON_H #include "rootless.h" #include "fb.h" +#ifdef SHAPE +#include "scrnintstr.h" +#endif /* SHAPE */ + #ifdef RENDER #include "picturestr.h" #endif @@ -55,6 +60,7 @@ extern DevPrivateKey rootlessGCPrivateKey; extern DevPrivateKey rootlessScreenPrivateKey; extern DevPrivateKey rootlessWindowPrivateKey; +extern DevPrivateKey rootlessWindowOldPixmapPrivateKey; // RootlessGCRec: private per-gc data @@ -102,13 +108,20 @@ typedef struct _RootlessScreenRec { GlyphsProcPtr Glyphs; #endif + InstallColormapProcPtr InstallColormap; + UninstallColormapProcPtr UninstallColormap; + StoreColorsProcPtr StoreColors; + void *pixmap_data; unsigned int pixmap_data_size; + ColormapPtr colormap; + void *redisplay_timer; unsigned int redisplay_timer_set :1; unsigned int redisplay_queued :1; unsigned int redisplay_expired :1; + unsigned int colormap_changed :1; } RootlessScreenRec, *RootlessScreenPtr; @@ -254,6 +267,16 @@ void RootlessRedisplayScreen(ScreenPtr pScreen); void RootlessQueueRedisplay(ScreenPtr pScreen); +/* Return the colormap currently installed on the given screen. */ +ColormapPtr RootlessGetColormap (ScreenPtr pScreen); + +/* Convert colormap to ARGB. */ +Bool RootlessResolveColormap (ScreenPtr pScreen, int first_color, + int n_colors, uint32_t *colors); + +void RootlessFlushWindowColormap (WindowPtr pWin); +void RootlessFlushScreenColormaps (ScreenPtr pScreen); + // Move a window to its proper location on the screen. void RootlessRepositionWindow(WindowPtr pWin); diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h index 3e326bf06..ab0187e83 100644 --- a/miext/rootless/rootlessConfig.h +++ b/miext/rootless/rootlessConfig.h @@ -34,7 +34,7 @@ #ifndef _ROOTLESSCONFIG_H #define _ROOTLESSCONFIG_H -#ifdef __DARWIN__ +#ifdef __APPLE__ # define ROOTLESS_ACCEL TRUE # define ROOTLESS_GLOBAL_COORDS TRUE @@ -48,7 +48,7 @@ alpha for 16bpp. */ # define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0) -#endif /* __DARWIN__ */ +#endif /* __APPLE__ */ #if defined(__CYGWIN__) || defined(WIN32) diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 18673a8b6..5031858dd 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -42,6 +42,7 @@ #include "propertyst.h" #include "mivalidate.h" #include "picturestr.h" +#include "colormapst.h" #include <sys/types.h> #include <sys/stat.h> @@ -64,6 +65,7 @@ extern Bool RootlessCreateGC(GCPtr pGC); DevPrivateKey rootlessGCPrivateKey = &rootlessGCPrivateKey; DevPrivateKey rootlessScreenPrivateKey = &rootlessScreenPrivateKey; DevPrivateKey rootlessWindowPrivateKey = &rootlessWindowPrivateKey; +DevPrivateKey rootlessWindowOldPixmapPrivateKey = &rootlessWindowOldPixmapPrivateKey; /* @@ -469,6 +471,67 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, return result; } +ColormapPtr +RootlessGetColormap (ScreenPtr pScreen) +{ + RootlessScreenRec *s = SCREENREC (pScreen); + + return s->colormap; +} + +static void +RootlessInstallColormap (ColormapPtr pMap) +{ + ScreenPtr pScreen = pMap->pScreen; + RootlessScreenRec *s = SCREENREC (pScreen); + + SCREEN_UNWRAP(pScreen, InstallColormap); + + if (s->colormap != pMap) { + s->colormap = pMap; + s->colormap_changed = TRUE; + RootlessQueueRedisplay (pScreen); + } + + pScreen->InstallColormap (pMap); + + SCREEN_WRAP (pScreen, InstallColormap); +} + +static void +RootlessUninstallColormap (ColormapPtr pMap) +{ + ScreenPtr pScreen = pMap->pScreen; + RootlessScreenRec *s = SCREENREC (pScreen); + + SCREEN_UNWRAP(pScreen, UninstallColormap); + + if (s->colormap == pMap) + s->colormap = NULL; + + pScreen->UninstallColormap (pMap); + + SCREEN_WRAP(pScreen, UninstallColormap); +} + +static void +RootlessStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef) +{ + ScreenPtr pScreen = pMap->pScreen; + RootlessScreenRec *s = SCREENREC (pScreen); + + SCREEN_UNWRAP(pScreen, StoreColors); + + if (s->colormap == pMap && ndef > 0) { + s->colormap_changed = TRUE; + RootlessQueueRedisplay (pScreen); + } + + pScreen->StoreColors (pMap, ndef, pdef); + + SCREEN_WRAP(pScreen, StoreColors); +} + static CARD32 RootlessRedisplayCallback(OsTimerPtr timer, CARD32 time, void *arg) @@ -599,6 +662,9 @@ RootlessWrap(ScreenPtr pScreen) WRAP(MarkOverlappedWindows); WRAP(ValidateTree); WRAP(ChangeWindowAttributes); + WRAP(InstallColormap); + WRAP(UninstallColormap); + WRAP(StoreColors); #ifdef SHAPE WRAP(SetShape); @@ -636,6 +702,8 @@ Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs) s = SCREENREC(pScreen); s->imp = procs; + s->colormap = NULL; + s->redisplay_expired = FALSE; RootlessWrap(pScreen); diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c index 9fab7866b..4f16530cc 100644 --- a/miext/rootless/rootlessValTree.c +++ b/miext/rootless/rootlessValTree.c @@ -482,6 +482,18 @@ RootlessComputeClips (pParent, pScreen, universe, kind, exposed) universe, &pParent->clipList); } + /* + * One last thing: backing storage. We have to try to save what parts of + * the window are about to be obscured. We can just subtract the universe + * from the old clipList and get the areas that were in the old but aren't + * in the new and, hence, are about to be obscured. + */ + if (pParent->backStorage && !resized) + { + REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe); + (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); + } + /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index 16cbb18af..b95339888 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -198,6 +198,7 @@ RootlessCreateWindow(WindowPtr pWin) RegionRec saveRoot; SETWINREC(pWin, NULL); + dixSetPrivate(&pWin->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL); SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow); @@ -445,6 +446,12 @@ RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec *winRec) } +Bool +RootlessColormapCallback (void *data, int first_color, int n_colors, uint32_t *colors) +{ + return RootlessResolveColormap (data, first_color, n_colors, colors); +} + /* * RootlessEnsureFrame * Make sure the given window is framed. If the window doesn't have a @@ -503,6 +510,9 @@ RootlessEnsureFrame(WindowPtr pWin) return NULL; } + if (pWin->drawable.depth == 8) + RootlessFlushWindowColormap(pWin); + #ifdef SHAPE if (pShape != NULL) REGION_UNINIT(pScreen, &shape); @@ -1455,6 +1465,26 @@ out: } } + +void +RootlessFlushWindowColormap (WindowPtr pWin) +{ + RootlessWindowRec *winRec = WINREC (pWin); + xp_window_changes wc; + + if (winRec == NULL) + return; + + RootlessStopDrawing (pWin, FALSE); + + /* This is how we tell xp that the colormap may have changed. */ + + wc.colormap = RootlessColormapCallback; + wc.colormap_data = pWin->drawable.pScreen; + + configure_window (winRec->wid, XP_COLORMAP, &wc); +} + /* * RootlessChangeBorderWidth * FIXME: untested! @@ -1516,20 +1546,20 @@ RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width) void RootlessOrderAllWindows (void) { - int i; - WindowPtr pWin; - - RL_DEBUG_MSG("RootlessOrderAllWindows() "); - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i] == NULL) continue; - pWin = WindowTable[i]; - if (pWin == NULL) continue; + int i; + WindowPtr pWin; + + RL_DEBUG_MSG("RootlessOrderAllWindows() "); + for (i = 0; i < screenInfo.numScreens; i++) { + if (screenInfo.screens[i] == NULL) continue; + pWin = WindowTable[i]; + if (pWin == NULL) continue; - for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { - if (!pWin->realized) continue; - if (RootlessEnsureFrame(pWin) == NULL) continue; - RootlessReorderWindow (pWin); + for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { + if (!pWin->realized) continue; + if (RootlessEnsureFrame(pWin) == NULL) continue; + RootlessReorderWindow (pWin); + } } - } - RL_DEBUG_MSG("RootlessOrderAllWindows() done"); + RL_DEBUG_MSG("RootlessOrderAllWindows() done"); } diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h index 9573068b4..055589e79 100644 --- a/miext/rootless/rootlessWindow.h +++ b/miext/rootless/rootlessWindow.h @@ -36,6 +36,7 @@ #include "rootlessCommon.h" +#include <Xplugin.h> Bool RootlessCreateWindow(WindowPtr pWin); Bool RootlessDestroyWindow(WindowPtr pWin); @@ -55,5 +56,7 @@ void RootlessResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib); void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent); void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width); +void RootlessNativeWindowMoved (WindowPtr pWin); +void RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state); #endif diff --git a/miext/rootless/safeAlpha/Makefile.am b/miext/rootless/safeAlpha/Makefile.am index 823fb777d..a22afb6a2 100644 --- a/miext/rootless/safeAlpha/Makefile.am +++ b/miext/rootless/safeAlpha/Makefile.am @@ -1,9 +1,5 @@ -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - $(XORG_CFLAGS) - -INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support - +AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) +AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support noinst_LTLIBRARIES = libsafeAlpha.la libsafeAlpha_la_SOURCES = safeAlphaPicture.c diff --git a/miext/rootless/safeAlpha/safeAlphaPicture.c b/miext/rootless/safeAlpha/safeAlphaPicture.c index 57f1ae187..8f6631531 100644 --- a/miext/rootless/safeAlpha/safeAlphaPicture.c +++ b/miext/rootless/safeAlpha/safeAlphaPicture.c @@ -46,6 +46,7 @@ #include "fbpict.h" #include "safeAlpha.h" #include "rootlessCommon.h" +# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) /* Optimized version of fbCompositeSolidMask_nx8x8888 */ void @@ -133,68 +134,78 @@ SafeAlphaCompositeSolidMask_nx8x8888( void SafeAlphaComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - int oldDepth = pDst->pDrawable->depth; - int oldFormat = pDst->format; + if (!pSrc) { + ErrorF("SafeAlphaComposite: pSrc must not be null!\n"); + return; + } + + if (!pDst) { + ErrorF("SafeAlphaComposite: pDst must not be null!\n"); + return; + } + + int oldDepth = pDst->pDrawable->depth; + int oldFormat = pDst->format; - /* - * We can use the more optimized fbpict code, but it sets bits above - * the depth to zero. Temporarily adjust destination depth if needed. - */ - if (pDst->pDrawable->type == DRAWABLE_WINDOW - && pDst->pDrawable->depth == 24 - && pDst->pDrawable->bitsPerPixel == 32) + /* + * We can use the more optimized fbpict code, but it sets bits above + * the depth to zero. Temporarily adjust destination depth if needed. + */ + if (pDst->pDrawable->type == DRAWABLE_WINDOW + && pDst->pDrawable->depth == 24 + && pDst->pDrawable->bitsPerPixel == 32) { - pDst->pDrawable->depth = 32; + pDst->pDrawable->depth = 32; } - /* For rootless preserve the alpha in x8r8g8b8 which really is - * a8r8g8b8 - */ - if (oldFormat == PICT_x8r8g8b8) + /* For rootless preserve the alpha in x8r8g8b8 which really is + * a8r8g8b8 + */ + if (oldFormat == PICT_x8r8g8b8) { - pDst->format = PICT_a8r8g8b8; + pDst->format = PICT_a8r8g8b8; } - if (pSrc && pMask && pSrc->pDrawable && pMask->pDrawable && - !pSrc->transform && !pMask->transform && - !pSrc->alphaMap && !pMask->alphaMap && - !pMask->repeat && !pMask->componentAlpha && !pDst->alphaMap && - pMask->format == PICT_a8 && - pSrc->repeatType == RepeatNormal && - pSrc->pDrawable->width == 1 && - pSrc->pDrawable->height == 1 && - (pDst->format == PICT_a8r8g8b8 || - pDst->format == PICT_x8r8g8b8 || - pDst->format == PICT_a8b8g8r8 || - pDst->format == PICT_x8b8g8r8)) + if (pSrc->pDrawable && pMask && pMask->pDrawable && + !pSrc->transform && !pMask->transform && + !pSrc->alphaMap && !pMask->alphaMap && + !pMask->repeat && !pMask->componentAlpha && !pDst->alphaMap && + pMask->format == PICT_a8 && + pSrc->repeatType == RepeatNormal && + pSrc->pDrawable->width == 1 && + pSrc->pDrawable->height == 1 && + (pDst->format == PICT_a8r8g8b8 || + pDst->format == PICT_x8r8g8b8 || + pDst->format == PICT_a8b8g8r8 || + pDst->format == PICT_x8b8g8r8)) { - fbWalkCompositeRegion (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height, - TRUE /* srcRepeat */, - FALSE /* maskRepeat */, - SafeAlphaCompositeSolidMask_nx8x8888); + fbWalkCompositeRegion (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height, + TRUE /* srcRepeat */, + FALSE /* maskRepeat */, + SafeAlphaCompositeSolidMask_nx8x8888); } - else + else { - fbComposite (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); + fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); } - pDst->pDrawable->depth = oldDepth; - pDst->format = oldFormat; + pDst->pDrawable->depth = oldDepth; + pDst->format = oldFormat; } #endif /* RENDER */ |