diff options
Diffstat (limited to 'miext/rootless')
-rw-r--r-- | miext/rootless/rootless.h | 13 | ||||
-rw-r--r-- | miext/rootless/rootlessCommon.c | 87 | ||||
-rw-r--r-- | miext/rootless/rootlessCommon.h | 45 | ||||
-rw-r--r-- | miext/rootless/rootlessValTree.c | 1 | ||||
-rw-r--r-- | miext/rootless/rootlessWindow.c | 57 | ||||
-rw-r--r-- | miext/rootless/safeAlpha/safeAlphaWindow.c | 2 |
6 files changed, 132 insertions, 73 deletions
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h index aefefcab2..1bada3865 100644 --- a/miext/rootless/rootless.h +++ b/miext/rootless/rootless.h @@ -27,7 +27,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/miext/rootless/rootless.h,v 1.5 2003/10/18 00:00:34 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/miext/rootless/rootless.h,v 1.7 2004/07/02 01:30:33 torrey Exp $ */ #ifndef _ROOTLESS_H #define _ROOTLESS_H @@ -395,5 +395,16 @@ void RootlessStartDrawing(WindowPtr pWindow); */ void RootlessStopDrawing(WindowPtr pWindow, Bool flush); +/* + * Alocate a new screen pixmap. + * miCreateScreenResources does not do this properly with a null + * framebuffer pointer. + */ +void RootlessUpdateScreenPixmap(ScreenPtr pScreen); + +/* + * Reposition all windows on a screen to their correct positions. + */ +void RootlessRepositionWindows(ScreenPtr pScreen); #endif /* _ROOTLESS_H */ diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c index 85655a9e1..b24d2a226 100644 --- a/miext/rootless/rootlessCommon.c +++ b/miext/rootless/rootlessCommon.c @@ -28,7 +28,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessCommon.c,v 1.4tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessCommon.c,v 1.6 2004/07/02 01:30:33 torrey Exp $ */ #include "rootlessCommon.h" @@ -166,8 +166,8 @@ void RootlessStopDrawing(WindowPtr pWindow, Bool flush) } if (flush && winRec->is_reorder_pending) { - winRec->is_reorder_pending = FALSE; - RootlessReorderWindow(pWindow); + winRec->is_reorder_pending = FALSE; + RootlessReorderWindow(pWindow); } } @@ -190,11 +190,11 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion) pTop = TopLevelParent(pWindow); if (pTop == NULL) - return; + return; winRec = WINREC(pTop); if (winRec == NULL) - return; + return; /* We need to intersect the drawn region with the clip of the window to avoid marking places we didn't actually draw (which can cause @@ -208,43 +208,43 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion) b2 = REGION_EXTENTS(pScreen, pRegion); if (EXTENTCHECK(b1, b2)) { - /* Regions may overlap. */ + /* Regions may overlap. */ - if (REGION_NUM_RECTS(pRegion) == 1) { - int in; + if (REGION_NUM_RECTS(pRegion) == 1) { + int in; - /* Damaged region only has a single rect, so we can - just compare that against the region */ + /* Damaged region only has a single rect, so we can + just compare that against the region */ - in = RECT_IN_REGION(pScreen, &pWindow->borderClip, + in = RECT_IN_REGION(pScreen, &pWindow->borderClip, REGION_RECTS (pRegion)); - if (in == rgnIN) { - /* clip totally contains pRegion */ + if (in == rgnIN) { + /* clip totally contains pRegion */ #ifdef ROOTLESS_TRACK_DAMAGE REGION_UNION(pScreen, &winRec->damage, - &winRec->damage, (pRegion)); + &winRec->damage, (pRegion)); #else - SCREENREC(pScreen)->imp->DamageRects(winRec->wid, + SCREENREC(pScreen)->imp->DamageRects(winRec->wid, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - -winRec->x, -winRec->y); + REGION_RECTS(pRegion), + -winRec->x, -winRec->y); #endif - RootlessQueueRedisplay(pTop->drawable.pScreen); - goto out; - } - else if (in == rgnOUT) { - /* clip doesn't contain pRegion */ + RootlessQueueRedisplay(pTop->drawable.pScreen); + goto out; + } + else if (in == rgnOUT) { + /* clip doesn't contain pRegion */ - goto out; - } - } + goto out; + } + } - /* clip overlaps pRegion, need to intersect */ + /* clip overlaps pRegion, need to intersect */ - REGION_NULL(pScreen, &clipped); - REGION_INTERSECT(pScreen, &clipped, &pWindow->borderClip, pRegion); + REGION_NULL(pScreen, &clipped); + REGION_INTERSECT(pScreen, &clipped, &pWindow->borderClip, pRegion); #ifdef ROOTLESS_TRACK_DAMAGE REGION_UNION(pScreen, &winRec->damage, @@ -256,9 +256,9 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion) -winRec->x, -winRec->y); #endif - REGION_UNINIT(pScreen, &clipped); + REGION_UNINIT(pScreen, &clipped); - RootlessQueueRedisplay(pTop->drawable.pScreen); + RootlessQueueRedisplay(pTop->drawable.pScreen); } out: @@ -291,7 +291,7 @@ RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox) RootlessDamageRegion(pWindow, ®ion); - REGION_UNINIT(pWindow->drawable.pScreen, ®ion); /* no-op */ + REGION_UNINIT(pWindow->drawable.pScreen, ®ion); /* no-op */ } @@ -318,7 +318,7 @@ RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h) RootlessDamageRegion(pWindow, ®ion); - REGION_UNINIT(pWindow->drawable.pScreen, ®ion); /* no-op */ + REGION_UNINIT(pWindow->drawable.pScreen, ®ion); /* no-op */ } @@ -350,7 +350,7 @@ RootlessRedisplay(WindowPtr pWindow) REGION_EMPTY(pScreen, &winRec->damage); } -#else /* !ROOTLESS_TRACK_DAMAGE */ +#else /* !ROOTLESS_TRACK_DAMAGE */ RootlessStopDrawing(pWindow, TRUE); @@ -359,6 +359,27 @@ RootlessRedisplay(WindowPtr pWindow) /* + * RootlessRepositionWindows + * Reposition all windows on a screen to their correct positions. + */ +void +RootlessRepositionWindows(ScreenPtr pScreen) +{ + WindowPtr root = WindowTable[pScreen->myNum]; + WindowPtr win; + + if (root != NULL) { + RootlessRepositionWindow(root); + + for (win = root->firstChild; win; win = win->nextSib) { + if (WINREC(win) != NULL) + RootlessRepositionWindow(win); + } + } +} + + +/* * RootlessRedisplayScreen * Walk every window on a screen and redisplay the damaged regions. */ diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index c75c45a2e..b5fcae7f9 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -3,7 +3,7 @@ */ /* * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002-2004 Torrey T. Lyons. 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"), @@ -27,7 +27,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessCommon.h,v 1.3 2003/06/30 01:45:13 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessCommon.h,v 1.5 2004/07/02 01:30:33 torrey Exp $ */ #ifndef _ROOTLESSCOMMON_H #define _ROOTLESSCOMMON_H @@ -139,10 +139,10 @@ typedef struct _RootlessScreenRec { // Call a rootless implementation function. // Many rootless implementation functions are allowed to be NULL. -#define CallFrameProc(pScreen, proc, params) \ - if (SCREENREC(pScreen)->frameProcs.proc) { \ - RL_DEBUG_MSG("calling frame proc " #proc " "); \ - SCREENREC(pScreen)->frameProcs.proc params; \ +#define CallFrameProc(pScreen, proc, params) \ + if (SCREENREC(pScreen)->frameProcs.proc) { \ + RL_DEBUG_MSG("calling frame proc " #proc " "); \ + SCREENREC(pScreen)->frameProcs.proc params; \ } @@ -217,19 +217,19 @@ extern RegionRec rootlessHugeRoot; * Can't access the bits before the first word of the drawable's data in * rootless mode, so make sure our base address is always 32-bit aligned. */ -#define SetPixmapBaseToScreen(pix, _x, _y) { \ - PixmapPtr _pPix = (PixmapPtr) (pix); \ - _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \ - ((int)(_x) * _pPix->drawable.bitsPerPixel/8 + \ - (int)(_y) * _pPix->devKind); \ - if (_pPix->drawable.bitsPerPixel != FB_UNIT) { \ - unsigned _diff = ((unsigned) _pPix->devPrivate.ptr) & \ - (FB_UNIT / CHAR_BIT - 1); \ - _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \ - _diff; \ - _pPix->drawable.x = _diff / \ - (_pPix->drawable.bitsPerPixel / CHAR_BIT); \ - } \ +#define SetPixmapBaseToScreen(pix, _x, _y) { \ + PixmapPtr _pPix = (PixmapPtr) (pix); \ + _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \ + ((int)(_x) * _pPix->drawable.bitsPerPixel/8 + \ + (int)(_y) * _pPix->devKind); \ + if (_pPix->drawable.bitsPerPixel != FB_UNIT) { \ + unsigned _diff = ((unsigned) _pPix->devPrivate.ptr) & \ + (FB_UNIT / CHAR_BIT - 1); \ + _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \ + _diff; \ + _pPix->drawable.x = _diff / \ + (_pPix->drawable.bitsPerPixel / CHAR_BIT); \ + } \ } @@ -246,9 +246,12 @@ void RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox); void RootlessRedisplay(WindowPtr pWindow); void RootlessRedisplayScreen(ScreenPtr pScreen); -void RootlessQueueRedisplay (ScreenPtr pScreen); +void RootlessQueueRedisplay(ScreenPtr pScreen); + +// Move a window to its proper location on the screen. +void RootlessRepositionWindow(WindowPtr pWin); // Move the window to it's correct place in the physical stacking order. -void RootlessReorderWindow (WindowPtr pWin); +void RootlessReorderWindow(WindowPtr pWin); #endif /* _ROOTLESSCOMMON_H */ diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c index 7b0337bce..9e61603b5 100644 --- a/miext/rootless/rootlessValTree.c +++ b/miext/rootless/rootlessValTree.c @@ -81,7 +81,6 @@ dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ - /* * Aug '86: Susan Angebranndt -- original code * July '87: Adam de Boor -- substantially modified and commented diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index ddd0d1891..9f1cfa1e6 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -1,10 +1,10 @@ -/* $XdotOrg: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.1.4.1.4.1 2004/03/04 17:48:29 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.3 2004/07/30 19:12:17 torrey Exp $ */ /* * Rootless window management */ /* * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -29,7 +29,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.10 2003/11/13 20:26:31 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.12 2004/07/02 01:30:33 torrey Exp $ */ #include "rootlessCommon.h" #include "rootlessWindow.h" @@ -1219,6 +1219,31 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y, /* + * RootlessRepositionWindow + * Called by the implementation when a window needs to be repositioned to + * its correct location on the screen. This routine is typically needed + * due to changes in the underlying window system, such as a screen layout + * change. + */ +void +RootlessRepositionWindow(WindowPtr pWin) +{ + RootlessWindowRec *winRec = WINREC(pWin); + ScreenPtr pScreen = pWin->drawable.pScreen; + + if (winRec == NULL) + return; + + RootlessStopDrawing(pWin, FALSE); + SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen, + winRec->x + SCREEN_TO_GLOBAL_X, + winRec->y + SCREEN_TO_GLOBAL_Y); + + RootlessReorderWindow(pWin); +} + + +/* * RootlessReparentWindow * Called after a window has been reparented. Generally windows are not * framed until they are mapped. However, a window may be framed early by the @@ -1236,9 +1261,9 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) /* Check that window is not top-level now, but used to be. */ if (IsRoot(pWin) || IsRoot(pWin->parent) - || IsTopLevel(pWin) || winRec == NULL) + || IsTopLevel(pWin) || winRec == NULL) { - goto out; + goto out; } /* If the formerly top-level window has a frame, we want to give the @@ -1249,20 +1274,20 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) assert(pTopWin != pWin); if (WINREC(pTopWin) != NULL) { - /* We're screwed. */ - RootlessDestroyFrame(pWin, winRec); + /* We're screwed. */ + RootlessDestroyFrame(pWin, winRec); } else { - if (!pTopWin->realized && pWin->realized) { + if (!pTopWin->realized && pWin->realized) { SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid); - } + } - /* Switch the frame record from one to the other. */ + /* Switch the frame record from one to the other. */ - WINREC(pWin) = NULL; - WINREC(pTopWin) = winRec; + WINREC(pWin) = NULL; + WINREC(pTopWin) = winRec; - RootlessInitializeFrame(pTopWin, winRec); - RootlessReshapeFrame(pTopWin); + RootlessInitializeFrame(pTopWin, winRec); + RootlessReshapeFrame(pTopWin); SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen, winRec->x + SCREEN_TO_GLOBAL_X, @@ -1274,8 +1299,8 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) SCREENREC(pScreen)->imp->SwitchWindow(winRec, pWin); } - if (pTopWin->realized && !pWin->realized) - winRec->is_reorder_pending = TRUE; + if (pTopWin->realized && !pWin->realized) + winRec->is_reorder_pending = TRUE; } out: diff --git a/miext/rootless/safeAlpha/safeAlphaWindow.c b/miext/rootless/safeAlpha/safeAlphaWindow.c index 1c6a8a747..4e70a73e1 100644 --- a/miext/rootless/safeAlpha/safeAlphaWindow.c +++ b/miext/rootless/safeAlpha/safeAlphaWindow.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/miext/rootless/safeAlpha/safeAlphaWindow.c,v 1.1.4.2.2.2 2004/03/04 17:48:30 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/miext/rootless/safeAlpha/safeAlphaWindow.c,v 1.2 2004/04/23 19:54:28 eich Exp $ */ /* * Specialized window functions to protect the alpha channel */ |