Merge many XDarwin improvements:

- Fix launch of X clients by double clicking in the Finder when there is a
    space in the path (Torrey T. Lyons).
- Interpret scroll wheel mouse events correctly when shift is held down
    (Benjamin Burke).
- Add option to always use Mac command key equivalents (John Harper and
    Torrey T. Lyons).
- Add support for dynamic screen configuration changes in rootless mode
    (John Harper and Torrey T. Lyons).
- Add documentation on generic rootless layer (Torrey T. Lyons).
This commit is contained in:
Torrey Lyons 2004-07-30 19:12:18 +00:00
commit 784e4d1cc0
17 changed files with 541 additions and 256 deletions

View file

@ -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 */

View file

@ -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, &region);
REGION_UNINIT(pWindow->drawable.pScreen, &region); /* no-op */
REGION_UNINIT(pWindow->drawable.pScreen, &region); /* no-op */
}
@ -318,7 +318,7 @@ RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h)
RootlessDamageRegion(pWindow, &region);
REGION_UNINIT(pWindow->drawable.pScreen, &region); /* no-op */
REGION_UNINIT(pWindow->drawable.pScreen, &region); /* 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);
@ -358,6 +358,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.

View file

@ -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 */

View file

@ -1,10 +1,10 @@
/* $XdotOrg$ */
/* $XdotOrg: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.2 2004/04/23 19:54:27 eich 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"
@ -1218,6 +1218,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
@ -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: