[Xquartz-changes] xserver: Branch 'server-1.10-apple' - 32 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Thu Sep 16 09:49:31 PDT 2010
Rebased ref, commits from common ancestor:
commit c0e979dea5f686ec02e435bdffde5973f9577022
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Feb 12 19:48:52 2010 -0800
fb: Revert fb changes that broke XQuartz
http://bugs.freedesktop.org/show_bug.cgi?id=26124
Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
Revert "fb: Adjust transform or composite coordinates for pixman operations"
http://bugs.freedesktop.org/26124
This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/fb/fb.h b/fb/fb.h
index c290ebf..10a022c 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2079,11 +2079,8 @@ fbFillRegionSolid (DrawablePtr pDrawable,
FbBits xor);
extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff);
-
+image_from_pict (PicturePtr pict,
+ Bool has_clip);
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
#endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index f7f1200..5467ee4 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -156,24 +156,19 @@ fbComposite (CARD8 op,
CARD16 height)
{
pixman_image_t *src, *mask, *dest;
- int src_xoff, src_yoff;
- int msk_xoff, msk_yoff;
- int dst_xoff, dst_yoff;
miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
if (pMask)
miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+ src = image_from_pict (pSrc, TRUE);
+ mask = image_from_pict (pMask, TRUE);
+ dest = image_from_pict (pDst, TRUE);
if (src && dest && !(pMask && !mask))
{
pixman_image_composite (op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height);
}
@@ -271,22 +266,22 @@ create_conical_gradient_image (PictGradient *gradient)
static pixman_image_t *
create_bits_picture (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff)
+ Bool has_clip)
{
- PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
- int bpp;
+ int bpp, xoff, yoff;
pixman_image_t *image;
- fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
- fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+ fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+ bits = (FbBits*)((CARD8*)bits +
+ (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+ (pict->pDrawable->x + xoff) * (bpp / 8));
image = pixman_image_create_bits (
pict->format,
- pixmap->drawable.width, pixmap->drawable.height,
+ pict->pDrawable->width, pict->pDrawable->height,
(uint32_t *)bits, stride * sizeof (FbStride));
@@ -312,55 +307,33 @@ create_bits_picture (PicturePtr pict,
if (pict->clientClipType != CT_NONE)
pixman_image_set_has_client_clip (image, TRUE);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+ pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
pixman_image_set_clip_region (image, pict->pCompositeClip);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+ pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
}
/* Indexed table */
if (pict->pFormat->index.devPrivate)
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
- /* Add in drawable origin to position within the image */
- *xoff += pict->pDrawable->x;
- *yoff += pict->pDrawable->y;
-
return image;
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
{
pixman_repeat_t repeat;
pixman_filter_t filter;
if (pict->transform)
{
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform (image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- } else
- pixman_image_set_transform (image, pict->transform);
+ pixman_image_set_transform (
+ image, (pixman_transform_t *)pict->transform);
}
switch (pict->repeatType)
@@ -390,8 +363,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
*/
if (pict->alphaMap && !is_alpha_map)
{
- int alpha_xoff, alpha_yoff;
- pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+ pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
pixman_image_set_alpha_map (
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -424,7 +396,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+ Bool has_clip, Bool is_alpha_map)
{
pixman_image_t *image = NULL;
@@ -433,7 +406,7 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
if (pict->pDrawable)
{
- image = create_bits_picture (pict, has_clip, xoff, yoff);
+ image = create_bits_picture (pict, has_clip);
}
else if (pict->pSourcePict)
{
@@ -454,19 +427,18 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
else if (sp->type == SourcePictTypeConical)
image = create_conical_gradient_image (gradient);
}
- *xoff = *yoff = 0;
}
if (image)
- set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
+ set_image_properties (image, pict, is_alpha_map);
return image;
}
pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
{
- return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+ return image_from_pict_internal (pict, has_clip, FALSE);
}
void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 9f5c39f..9c55236 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -38,8 +38,7 @@ fbAddTraps (PicturePtr pPicture,
int ntrap,
xTrap *traps)
{
- int image_xoff, image_yoff;
- pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+ pixman_image_t *image = image_from_pict (pPicture, FALSE);
if (!image)
return;
@@ -55,8 +54,7 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
int x_off,
int y_off)
{
- int mask_xoff, mask_yoff;
- pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+ pixman_image_t *image = image_from_pict (pPicture, FALSE);
if (!image)
return;
commit 36551e259676466f0c2ba979018bcce9f698907b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Apr 30 13:08:25 2010 -0700
Workaround the GC clipping problem in miPaintWindow and add some debugging output.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..4f25c23 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
void RootlessStartDrawing(WindowPtr pWin);
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
#endif
void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
Bool solid = TRUE;
DrawablePtr drawable = &pWin->drawable;
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+ ErrorF(" Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+ prgn->extents.x2 - prgn->extents.x1,
+ prgn->extents.y2 - prgn->extents.y1);
+ ErrorF(" Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+ pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+ pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+ pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+ ErrorF(" Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+ pWin->drawable.width, pWin->drawable.height);
+#endif
+
#ifdef ROOTLESS
if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
return;
-
- if(IsFramedWindow(pWin)) {
- RootlessStartDrawing(pWin);
- RootlessDamageRegion(pWin, prgn);
-
- if(pWin->backgroundState == ParentRelative) {
- if((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
- RootlessSetPixmapOfAncestors(pWin);
- }
- }
#endif
if (what == PW_BACKGROUND)
{
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
PixmapPtr pixmap;
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(!pWin->borderIsPixel &&
+ pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
tile_x_off = drawable->x;
tile_y_off = drawable->y;
@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
return;
pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" Draw: %d %d %d %d\n",
+ drawable->x, drawable->y, drawable->width, drawable->height);
+#endif
+
#ifdef COMPOSITE
draw_x_off = pixmap->screen_x;
draw_y_off = pixmap->screen_y;
@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
ChangeGC (NullClient, pGC, gcmask, gcval);
ValidateGC (drawable, pGC);
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
+#ifdef XQUARTZ
+ /* Looks like our clipping isn't set right for some reason:
+ * http://xquartz.macosforge.org/trac/ticket/290
+ */
+ if(what == PW_BORDER) {
+
+#if 0
+ if(solid) {
+#if 1
+ fbFillRegionSolid(&pWin->drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ pWin->drawable.bitsPerPixel));
+#else
+ fbFillRegionSolid(drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ drawable->bitsPerPixel));
+#endif
+ return;
+ }
+#endif
+
+ pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+ pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+
+ if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+ pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+ if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+ pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+ }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
commit 4a112b688491953ff1215181e44a7e6144c86497
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Tue Aug 3 12:51:51 2010 -0700
XQuartz: RandR: Refactor legacy mode-switching to be better integrated with RandR
Adds three new functions
void QuartzRandRSetFakeRootless (void);
void QuartzRandRSetFakeFullscreen (void);
void QuartzRandRToggleFullscreen (void);
The first two are identical to requesting the fake modes from a RandR client
The third responds to cmd-alt-a to leave fullscreen or RandR.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 781dccc..8f4f23f 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -370,7 +370,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
break;
case 18: /* ApplicationDidReactivate */
- if (XQuartzHasRoot) for_appkit = NO;
+ if (XQuartzFullscreenVisible) for_appkit = NO;
break;
case NSApplicationDeactivatedEventType:
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 4332202..74fadf4 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -241,17 +241,17 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
DEBUG_LOG("kXquartzToggleFullscreen\n");
if(XQuartzIsRootless)
ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
- else if (XQuartzHasRoot)
- QuartzHide();
- else
- QuartzShow();
+ else
+ QuartzRandRToggleFullscreen();
break;
case kXquartzSetRootless:
DEBUG_LOG("kXquartzSetRootless\n");
- QuartzSetRootless(e->data[0]);
- if (!XQuartzIsRootless && !XQuartzHasRoot)
- QuartzHide();
+ if(e->data[0]) {
+ QuartzRandRSetFakeRootless();
+ } else {
+ QuartzRandRSetFakeFullscreen(FALSE);
+ }
break;
case kXquartzSetRootClip:
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index cd90457..e21303c 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -74,7 +74,7 @@ const char *quartzOpenGLBundle = NULL;
Bool XQuartzFullscreenDisableHotkeys = TRUE;
Bool XQuartzOptionSendsAlt = FALSE;
Bool XQuartzEnableKeyEquivalents = TRUE;
-Bool XQuartzHasRoot = FALSE;
+Bool XQuartzFullscreenVisible = FALSE;
Bool XQuartzRootlessDefault = TRUE;
Bool XQuartzIsRootless = TRUE;
Bool XQuartzServerVisible = FALSE;
@@ -246,44 +246,58 @@ void QuartzUpdateScreens(void) {
quartzProcs->UpdateScreen(pScreen);
}
-void QuartzSetFullscreen(Bool state) {
+void QuartzShowFullscreen(int state) {
+ int i;
+
+ DEBUG_LOG("QuartzShowFullscreen: state=%d\n", state);
- DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
+ if(XQuartzIsRootless) {
+ ErrorF("QuartzShowFullscreen called while in rootless mode.\n");
+ return;
+ }
- if(XQuartzHasRoot == state)
+ if(XQuartzFullscreenVisible == state)
return;
- XQuartzHasRoot = state;
+ XQuartzFullscreenVisible = state;
xp_disable_update ();
- if (!XQuartzHasRoot && !XQuartzIsRootless)
+ if (!XQuartzFullscreenVisible)
RootlessHideAllWindows();
- RootlessUpdateRooted(XQuartzHasRoot);
+ RootlessUpdateRooted(XQuartzFullscreenVisible);
- if (XQuartzHasRoot && !XQuartzIsRootless)
+ if (XQuartzFullscreenVisible) {
RootlessShowAllWindows ();
-
- if (XQuartzHasRoot || XQuartzIsRootless) {
- RootlessRepositionWindows(screenInfo.screens[0]);
+ for (i=0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ RootlessRepositionWindows(pScreen);
+ // JH: I don't think this is necessary, but keeping it here as a reminder
+ //RootlessUpdateScreenPixmap(pScreen);
+ }
}
/* Somehow the menubar manages to interfere with our event stream
* in fullscreen mode, even though it's not visible.
*/
- X11ApplicationShowHideMenubar(!XQuartzHasRoot);
+ X11ApplicationShowHideMenubar(!XQuartzFullscreenVisible);
xp_reenable_update ();
if (XQuartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(XQuartzHasRoot);
+ xp_disable_hot_keys(XQuartzFullscreenVisible);
}
-void QuartzSetRootless(Bool state) {
+void QuartzSetRootless(Bool state) {
+ DEBUG_LOG("QuartzSetRootless state=%d\n", state);
+
if(XQuartzIsRootless == state)
return;
+ if(state)
+ QuartzShowFullscreen(FALSE);
+
XQuartzIsRootless = state;
xp_disable_update();
@@ -291,20 +305,17 @@ void QuartzSetRootless(Bool state) {
/* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
QuartzUpdateScreens();
- if(!XQuartzHasRoot) {
- if(!XQuartzIsRootless) {
- RootlessHideAllWindows();
- } else {
- RootlessShowAllWindows();
- }
+ if(XQuartzIsRootless) {
+ RootlessShowAllWindows();
+ } else {
+ RootlessHideAllWindows();
}
- X11ApplicationShowHideMenubar(!XQuartzHasRoot);
+ X11ApplicationShowHideMenubar(TRUE);
xp_reenable_update();
- if (!XQuartzIsRootless && XQuartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(XQuartzHasRoot);
+ xp_disable_hot_keys(FALSE);
}
/*
@@ -327,7 +338,7 @@ void QuartzShow(void) {
}
if (!XQuartzIsRootless)
- QuartzSetFullscreen(TRUE);
+ QuartzShowFullscreen(TRUE);
}
@@ -348,8 +359,9 @@ void QuartzHide(void)
}
}
}
-
- QuartzSetFullscreen(FALSE);
+
+ if(!XQuartzIsRootless)
+ QuartzShowFullscreen(FALSE);
XQuartzServerVisible = FALSE;
}
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index a0a17cb..7efb7e0 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -115,12 +115,8 @@ typedef struct _QuartzModeProcs {
extern QuartzModeProcsPtr quartzProcs;
-extern Bool XQuartzHasRoot; /* TODO: These two booleans are very similar and */
-extern Bool XQuartzServerVisible; /* the code that uses them needs to be refactored
- * XQuartzHasRoot is essentially the "saved" XQuartzServerVisible
- * value from when the server was not in rootless mode.
- */
-
+extern Bool XQuartzFullscreenVisible; /* Are the windows visible (predicated on !rootless) */
+extern Bool XQuartzServerVisible; /* Is the server visible ... TODO: Refactor to "active" */
extern Bool XQuartzEnableKeyEquivalents;
extern Bool XQuartzRootlessDefault; /* Is our default mode rootless? */
extern Bool XQuartzIsRootless; /* Is our current mode rootless (or FS)? */
@@ -144,7 +140,7 @@ void QuartzSetRootClip(BOOL enable);
void QuartzSpaceChanged(uint32_t space_id);
void QuartzSetRootless(Bool state);
-void QuartzSetFullscreen(Bool state);
+void QuartzShowFullscreen(Bool state);
int server_main(int argc, char **argv, char **envp);
#endif
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 7534267..586d299 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -62,7 +62,7 @@ static Bool ignore_next_fake_mode_update = FALSE;
#define CALLBACK_ERROR -1
typedef int (*QuartzModeCallback)
- (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+ (ScreenPtr, QuartzModeInfoPtr, void *);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
@@ -98,6 +98,7 @@ static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
if (pMode->refresh == 0)
pMode->refresh = DEFAULT_REFRESH;
pMode->ref = NULL;
+ pMode->pSize = NULL;
}
static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
@@ -112,14 +113,13 @@ static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
return TRUE;
}
-static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode) {
CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
return (CGDisplaySwitchToMode(screenId, modeRef) == kCGErrorSuccess);
}
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
QuartzModeCallback callback,
void *data) {
CFDictionaryRef curModeRef, modeRef;
@@ -129,8 +129,9 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
int i;
BOOL retval = FALSE;
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
- switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
+ switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -140,7 +141,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
break;
}
- switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
+ switch(callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -172,7 +173,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
QuartzRandRGetModeInfo(modeRef, &modeInfo);
modeInfo.ref = modeRef;
- cb = callback(pScreen, screenId, &modeInfo, data);
+ cb = callback(pScreen, &modeInfo, data);
if (cb == CALLBACK_SUCCESS)
break;
if (cb == CALLBACK_ERROR) {
@@ -193,6 +194,7 @@ static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
if (pMode->refresh == 0)
pMode->refresh = DEFAULT_REFRESH;
pMode->ref = NULL;
+ pMode->pSize = NULL;
}
static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
@@ -206,7 +208,7 @@ static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
return TRUE;
}
-static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode) {
CGDisplayModeRef modeRef = (CGDisplayModeRef) pMode->ref;
if (!modeRef)
@@ -216,7 +218,6 @@ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
}
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
QuartzModeCallback callback,
void *data) {
CGDisplayModeRef curModeRef, modeRef;
@@ -228,8 +229,9 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
Bool retval = TRUE;
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
- switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
+ switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -239,7 +241,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
break;
}
- switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
+ switch(callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -277,7 +279,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
QuartzRandRGetModeInfo(modeRef, &modeInfo);
modeInfo.ref = modeRef;
- cb = callback(pScreen, screenId, &modeInfo, data);
+ cb = callback(pScreen, &modeInfo, data);
if (cb == CALLBACK_SUCCESS)
break;
if (cb == CALLBACK_ERROR) {
@@ -306,14 +308,15 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
QuartzModeInfoPtr pMode) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
- RRScreenSizePtr pSize = RRRegisterSize(pScreen,
- pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
- if (pSize) {
+
+ /* TODO: DPI */
+ pMode->pSize = RRRegisterSize(pScreen, pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+ if (pMode->pSize) {
//DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : "");
- RRRegisterRate(pScreen, pSize, pMode->refresh);
+ RRRegisterRate(pScreen, pMode->pSize, pMode->refresh);
if (isCurrentMode)
- RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pMode->pSize);
return TRUE;
}
@@ -321,7 +324,6 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
}
static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode,
void *data __unused) {
if(QuartzRandRRegisterMode(pScreen, pMode)) {
@@ -331,40 +333,53 @@ static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
}
}
+static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL doRegister) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
+
+ if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
+ DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
+ } if (QuartzRandRSetCGMode(screenId, pMode)) {
+ ignore_next_fake_mode_update = TRUE;
+ } else {
+ DEBUG_LOG("Error while requesting CG resolution change.\n");
+ return FALSE;
+ }
+
+ /* If the client requested the fake rootless mode, switch to rootless.
+ * Otherwise, force fullscreen mode.
+ */
+ QuartzSetRootless(pMode->refresh == FAKE_REFRESH_ROOTLESS);
+ if (pMode->refresh != FAKE_REFRESH_ROOTLESS) {
+ QuartzShowFullscreen(TRUE);
+ }
+
+ if(pQuartzScreen->currentMode.ref)
+ CFRelease(pQuartzScreen->currentMode.ref);
+ pQuartzScreen->currentMode = *pMode;
+ CFRetain(pQuartzScreen->currentMode.ref);
+
+ return TRUE;
+}
+
static int QuartzRandRSetModeCallback (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode,
void *data) {
QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
- QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (!QuartzRandRModesEqual(pMode, pReqMode))
return CALLBACK_CONTINUE; /* continue enumeration */
DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh);
- if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
- DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
- return CALLBACK_SUCCESS; /* We don't need to do anything in CG */
- }
-
- if (QuartzRandRSetMode(screenId, pMode)) {
- if(pQuartzScreen->currentMode.ref)
- CFRelease(pQuartzScreen->currentMode.ref);
- pQuartzScreen->currentMode = *pMode;
- CFRetain(pQuartzScreen->currentMode.ref);
-
- ignore_next_fake_mode_update = TRUE;
+ if(QuartzRandRSetMode(pScreen, pMode, FALSE))
return CALLBACK_SUCCESS;
- } else {
- DEBUG_LOG("Error while requesting CG resolution change.\n");
+ else
return CALLBACK_ERROR;
- }
}
static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
- CGDirectDisplayID screenId;
*rotations = RR_Rotate_0; /* TODO: support rotation */
@@ -381,8 +396,7 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
return TRUE;
}
- screenId = pQuartzScreen->displayIDs[0];
- return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
+ return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback, NULL);
}
static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
@@ -390,39 +404,20 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
int rate,
RRScreenSizePtr pSize) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
- CGDirectDisplayID screenId;
QuartzModeInfo reqMode;
reqMode.width = pSize->width;
reqMode.height = pSize->height;
reqMode.refresh = rate;
- /* If the client requested the fake rootless mode, switch to rootless.
- * Otherwise, force fullscreen mode.
- * TODO: Refactor all this fullscreen/rootless crap as it is spaghetti
- * has redundancies.
- */
- QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
- QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
- if(reqMode.refresh != FAKE_REFRESH_ROOTLESS &&
- reqMode.refresh != FAKE_REFRESH_FULLSCREEN)
- QuartzShow();
-
if (pQuartzScreen->displayCount == 0)
return FALSE;
- if (pQuartzScreen->displayCount > 1) {
- /* RandR operations are not well-defined for an X11 screen spanning
- multiple CG displays. Do not accept any configuations that differ
- from the current configuration. */
- return TRUE;
- }
/* Do not switch modes if requested mode is equal to current mode. */
if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
return TRUE;
- screenId = pQuartzScreen->displayIDs[0];
- if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
+ if (QuartzRandREnumerateModes(pScreen, QuartzRandRSetModeCallback, &reqMode)) {
return TRUE;
}
@@ -499,3 +494,57 @@ Bool QuartzRandRInit (ScreenPtr pScreen) {
pScrPriv->rrSetConfig = QuartzRandRSetConfig;
return TRUE;
}
+
+void QuartzRandRSetFakeRootless (void) {
+ int i;
+
+ DEBUG_LOG("QuartzRandRSetFakeRootless called.\n");
+
+ for (i=0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+
+ QuartzRandRSetMode(pScreen, &pQuartzScreen->rootlessMode, TRUE);
+ }
+}
+
+void QuartzRandRSetFakeFullscreen (BOOL state) {
+ int i;
+
+ DEBUG_LOG("QuartzRandRSetFakeFullscreen called.\n");
+
+ for (i=0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+
+ QuartzRandRSetMode(pScreen, &pQuartzScreen->fullscreenMode, TRUE);
+ }
+
+ QuartzShowFullscreen(state);
+}
+
+/* Toggle fullscreen mode. If "fake" fullscreen is the current mode,
+ * this will just show/hide the X11 windows. If we are in a RandR fullscreen
+ * mode, this will toggles us to the default fake mode and hide windows if
+ * it is fullscreen
+ */
+void QuartzRandRToggleFullscreen (void) {
+ ScreenPtr pScreen = screenInfo.screens[0];
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+
+ if (pQuartzScreen->currentMode.ref == NULL) {
+ ErrorF("Ignoring QuartzRandRToggleFullscreen because don't have a current mode set.\n");
+ } else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_ROOTLESS) {
+ ErrorF("Ignoring QuartzRandRToggleFullscreen because we are in rootless mode.\n");
+ } else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_FULLSCREEN) {
+ /* Legacy fullscreen mode. Hide/Show */
+ QuartzShowFullscreen(!XQuartzFullscreenVisible);
+ } else {
+ /* RandR fullscreen mode. Return to default mode and hide if it is fullscreen. */
+ if(XQuartzRootlessDefault) {
+ QuartzRandRSetFakeRootless();
+ } else {
+ QuartzRandRSetFakeFullscreen(FALSE);
+ }
+ }
+}
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index b2d4d09..fb0ce0c 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -31,9 +31,12 @@
#ifndef _QUARTZRANDR_H_
#define _QUARTZRANDR_H_
+#include "randrstr.h"
+
typedef struct {
size_t width, height;
int refresh;
+ RRScreenSizePtr pSize;
void *ref; /* CGDisplayModeRef or CFDictionaryRef */
} QuartzModeInfo, *QuartzModeInfoPtr;
@@ -57,4 +60,21 @@ void QuartzCopyDisplayIDs(ScreenPtr pScreen,
Bool QuartzRandRUpdateFakeModes (BOOL force_update);
Bool QuartzRandRInit (ScreenPtr pScreen);
+/* These two functions provide functionality expected by the legacy
+ * mode switching. They are equivalent to a client requesting one
+ * of the modes corresponding to these "fake" modes.
+ * QuartzRandRSetFakeFullscreen takes an argument which is used to determine
+ * the visibility of the windows after the change.
+ */
+void QuartzRandRSetFakeRootless (void);
+void QuartzRandRSetFakeFullscreen (BOOL state);
+
+
+/* Toggle fullscreen mode. If "fake" fullscreen is the current mode,
+ * this will just show/hide the X11 windows. If we are in a RandR fullscreen
+ * mode, this will toggles us to the default fake mode and hide windows if
+ * it is fullscreen
+ */
+void QuartzRandRToggleFullscreen (void);
+
#endif
commit f5c58a10dd0a83aa1972b42dd90f0c84b286d1f7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Jul 26 23:34:49 2010 -0700
XQuartz: RandR: Don't change the rootless preference when changing RandR mode
Also renames a bunch of other variables for better consistency.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index ce19e03..4621284 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -75,9 +75,6 @@ void X11ApplicationLaunchClient (const char *cmd);
void X11ApplicationMain(int argc, char **argv, char **envp);
-extern int X11EnableKeyEquivalents;
-extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
-
#define PREFS_APPSMENU "apps_menu"
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
#define PREFS_SYSBEEP "enable_system_beep"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 36c39e5..781dccc 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -38,6 +38,7 @@
#import "X11Application.h"
#include "darwin.h"
+#include "quartz.h"
#include "darwinEvents.h"
#include "quartzKeyboard.h"
#include "quartz.h"
@@ -63,9 +64,6 @@ extern int xpbproxy_run (void);
/* Stuck modifier / button state... force release when we context switch */
static NSEventType keyState[NUM_KEYCODES];
-int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
-int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
-
extern Bool noTestExtensions;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
@@ -287,23 +285,23 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
do_swallow = YES;
for_x = NO;
#if XPLUGIN_VERSION >= 1
- } else if(X11EnableKeyEquivalents &&
+ } else if(XQuartzEnableKeyEquivalents &&
xp_is_symbolic_hotkey_event([e eventRef])) {
swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO;
#endif
- } else if(X11EnableKeyEquivalents &&
+ } else if(XQuartzEnableKeyEquivalents &&
[[self mainMenu] performKeyEquivalent:e]) {
swallow_keycode = [e keyCode];
do_swallow = YES;
for_appkit = NO;
for_x = NO;
- } else if(!quartzEnableRootless
+ } else if(!XQuartzIsRootless
&& ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
&& ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
/* We have this here to force processing fullscreen
- * toggle even if X11EnableKeyEquivalents is disabled */
+ * toggle even if XQuartzEnableKeyEquivalents is disabled */
swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO;
@@ -372,7 +370,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
break;
case 18: /* ApplicationDidReactivate */
- if (quartzHasRoot) for_appkit = NO;
+ if (XQuartzHasRoot) for_appkit = NO;
break;
case NSApplicationDeactivatedEventType:
@@ -422,7 +420,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if ([state boolValue])
SetSystemUIMode(kUIModeNormal, 0);
else
- SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
+ SetSystemUIMode(kUIModeAllHidden, XQuartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
}
- (void) launch_client:(NSString *)cmd {
@@ -720,18 +718,18 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
NSString *nsstr;
const char *tem;
- quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
- default:quartzUseSysBeep];
- quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
- default:quartzEnableRootless];
- quartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
- default:quartzFullscreenMenu];
- quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
- default:!quartzFullscreenDisableHotkeys];
+ XQuartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
+ default:XQuartzUseSysBeep];
+ XQuartzRootlessDefault = [self prefs_get_boolean:@PREFS_ROOTLESS
+ default:XQuartzRootlessDefault];
+ XQuartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
+ default:XQuartzFullscreenMenu];
+ XQuartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
+ default:!XQuartzFullscreenDisableHotkeys];
darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
default:darwinFakeButtons];
- quartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
- default:quartzOptionSendsAlt];
+ XQuartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
+ default:XQuartzOptionSendsAlt];
if (darwinFakeButtons) {
const char *fake2, *fake3;
@@ -759,8 +757,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
}
}
- X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
- default:X11EnableKeyEquivalents];
+ XQuartzEnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
+ default:XQuartzEnableKeyEquivalents];
darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
default:darwinSyncKeymap];
@@ -1158,7 +1156,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
pDev = darwinTabletCurrent;
}
- if(!quartzServerVisible && noTestExtensions) {
+ if(!XQuartzServerVisible && noTestExtensions) {
#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
xp_window_id wid = 0;
@@ -1218,7 +1216,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
/* If we're in the background, we need to send a MotionNotify event
* first, since we aren't getting them on background mouse motion
*/
- if(!quartzServerVisible && noTestExtensions) {
+ if(!XQuartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
location.y, pressure, tilt.x, tilt.y);
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index d66d039..13b6366 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -609,13 +609,13 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
}
- (IBAction) enable_fullscreen_changed:sender {
- int value = ![enable_fullscreen intValue];
+ XQuartzRootlessDefault = ![enable_fullscreen intValue];
- [enable_fullscreen_menu setEnabled:!value];
+ [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
- DarwinSendDDXEvent(kXquartzSetRootless, 1, value);
+ DarwinSendDDXEvent(kXquartzSetRootless, 1, XQuartzRootlessDefault);
- [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
+ [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:XQuartzRootlessDefault];
[NSApp prefs_synchronize];
}
@@ -638,24 +638,24 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
darwinFakeButtons = [fake_buttons intValue];
[NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
} else if(sender == use_sysbeep) {
- quartzUseSysBeep = [use_sysbeep intValue];
- [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
+ XQuartzUseSysBeep = [use_sysbeep intValue];
+ [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:XQuartzUseSysBeep];
} else if(sender == enable_keyequivs) {
- X11EnableKeyEquivalents = [enable_keyequivs intValue];
- [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
+ XQuartzEnableKeyEquivalents = [enable_keyequivs intValue];
+ [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:XQuartzEnableKeyEquivalents];
} else if(sender == sync_keymap) {
darwinSyncKeymap = [sync_keymap intValue];
[NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
} else if(sender == enable_fullscreen_menu) {
- quartzFullscreenMenu = [enable_fullscreen_menu intValue];
- [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:quartzFullscreenMenu];
+ XQuartzFullscreenMenu = [enable_fullscreen_menu intValue];
+ [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:XQuartzFullscreenMenu];
} else if(sender == option_sends_alt) {
- BOOL prev_opt_sends_alt = quartzOptionSendsAlt;
+ BOOL prev_opt_sends_alt = XQuartzOptionSendsAlt;
- quartzOptionSendsAlt = [option_sends_alt intValue];
- [NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:quartzOptionSendsAlt];
+ XQuartzOptionSendsAlt = [option_sends_alt intValue];
+ [NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:XQuartzOptionSendsAlt];
- if(prev_opt_sends_alt != quartzOptionSendsAlt)
+ if(prev_opt_sends_alt != XQuartzOptionSendsAlt)
QuartsResyncKeymap(TRUE);
} else if(sender == click_through) {
[NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
@@ -701,10 +701,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
BOOL pbproxy_active = [NSApp prefs_get_boolean:@PREFS_SYNC_PB default:YES];
[fake_buttons setIntValue:darwinFakeButtons];
- [use_sysbeep setIntValue:quartzUseSysBeep];
- [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
+ [use_sysbeep setIntValue:XQuartzUseSysBeep];
+ [enable_keyequivs setIntValue:XQuartzEnableKeyEquivalents];
[sync_keymap setIntValue:darwinSyncKeymap];
- [option_sends_alt setIntValue:quartzOptionSendsAlt];
+ [option_sends_alt setIntValue:XQuartzOptionSendsAlt];
[click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
[focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
[focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];
@@ -729,9 +729,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
[sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
[sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
- [enable_fullscreen setIntValue:!quartzEnableRootless];
- [enable_fullscreen_menu setEnabled:!quartzEnableRootless];
- [enable_fullscreen_menu setIntValue:quartzFullscreenMenu];
+ [enable_fullscreen setIntValue:!XQuartzRootlessDefault];
+ [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
+ [enable_fullscreen_menu setIntValue:XQuartzFullscreenMenu];
[prefs_panel makeKeyAndOrderFront:sender];
}
@@ -752,7 +752,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
NSMenu *menu = [item menu];
if (item == toggle_fullscreen_item)
- return !quartzEnableRootless;
+ return !XQuartzIsRootless;
else if (menu == [X11App windowsMenu] || menu == dock_menu
|| (menu == [x11_about_item menu] && [item tag] == 42))
return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 7367068..4332202 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -239,9 +239,9 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
case kXquartzToggleFullscreen:
DEBUG_LOG("kXquartzToggleFullscreen\n");
- if(quartzEnableRootless)
+ if(XQuartzIsRootless)
ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
- else if (quartzHasRoot)
+ else if (XQuartzHasRoot)
QuartzHide();
else
QuartzShow();
@@ -250,7 +250,7 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
case kXquartzSetRootless:
DEBUG_LOG("kXquartzSetRootless\n");
QuartzSetRootless(e->data[0]);
- if (!quartzEnableRootless && !quartzHasRoot)
+ if (!XQuartzIsRootless && !XQuartzHasRoot)
QuartzHide();
break;
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index a52cac9..cd90457 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -66,15 +66,20 @@
#include <rootlessCommon.h>
#include <Xplugin.h>
-// Shared global variables for Quartz modes
-int quartzUseSysBeep = 0;
-int quartzServerVisible = FALSE;
DevPrivateKeyRec quartzScreenKeyRec;
int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
const char *quartzOpenGLBundle = NULL;
-int quartzFullscreenDisableHotkeys = TRUE;
-int quartzOptionSendsAlt = FALSE;
+
+Bool XQuartzFullscreenDisableHotkeys = TRUE;
+Bool XQuartzOptionSendsAlt = FALSE;
+Bool XQuartzEnableKeyEquivalents = TRUE;
+Bool XQuartzHasRoot = FALSE;
+Bool XQuartzRootlessDefault = TRUE;
+Bool XQuartzIsRootless = TRUE;
+Bool XQuartzServerVisible = FALSE;
+Bool XQuartzFullscreenMenu = FALSE;
+Bool XQuartzUseSysBeep = FALSE;
/*
===========================================================================
@@ -245,61 +250,61 @@ void QuartzSetFullscreen(Bool state) {
DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
- if(quartzHasRoot == state)
+ if(XQuartzHasRoot == state)
return;
- quartzHasRoot = state;
+ XQuartzHasRoot = state;
xp_disable_update ();
- if (!quartzHasRoot && !quartzEnableRootless)
+ if (!XQuartzHasRoot && !XQuartzIsRootless)
RootlessHideAllWindows();
- RootlessUpdateRooted(quartzHasRoot);
+ RootlessUpdateRooted(XQuartzHasRoot);
- if (quartzHasRoot && !quartzEnableRootless)
+ if (XQuartzHasRoot && !XQuartzIsRootless)
RootlessShowAllWindows ();
- if (quartzHasRoot || quartzEnableRootless) {
+ if (XQuartzHasRoot || XQuartzIsRootless) {
RootlessRepositionWindows(screenInfo.screens[0]);
}
/* Somehow the menubar manages to interfere with our event stream
* in fullscreen mode, even though it's not visible.
*/
- X11ApplicationShowHideMenubar(!quartzHasRoot);
+ X11ApplicationShowHideMenubar(!XQuartzHasRoot);
xp_reenable_update ();
- if (quartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(quartzHasRoot);
+ if (XQuartzFullscreenDisableHotkeys)
+ xp_disable_hot_keys(XQuartzHasRoot);
}
void QuartzSetRootless(Bool state) {
- if(quartzEnableRootless == state)
+ if(XQuartzIsRootless == state)
return;
- quartzEnableRootless = state;
+ XQuartzIsRootless = state;
xp_disable_update();
/* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
QuartzUpdateScreens();
- if(!quartzHasRoot) {
- if(!quartzEnableRootless) {
+ if(!XQuartzHasRoot) {
+ if(!XQuartzIsRootless) {
RootlessHideAllWindows();
} else {
RootlessShowAllWindows();
}
}
- X11ApplicationShowHideMenubar(!quartzHasRoot);
+ X11ApplicationShowHideMenubar(!XQuartzHasRoot);
xp_reenable_update();
- if (!quartzEnableRootless && quartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(quartzHasRoot);
+ if (!XQuartzIsRootless && XQuartzFullscreenDisableHotkeys)
+ xp_disable_hot_keys(XQuartzHasRoot);
}
/*
@@ -311,17 +316,17 @@ void QuartzSetRootless(Bool state) {
void QuartzShow(void) {
int i;
- if (quartzServerVisible)
+ if (XQuartzServerVisible)
return;
- quartzServerVisible = TRUE;
+ XQuartzServerVisible = TRUE;
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
quartzProcs->ResumeScreen(screenInfo.screens[i]);
}
}
- if (!quartzEnableRootless)
+ if (!XQuartzIsRootless)
QuartzSetFullscreen(TRUE);
}
@@ -336,7 +341,7 @@ void QuartzHide(void)
{
int i;
- if (quartzServerVisible) {
+ if (XQuartzServerVisible) {
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
quartzProcs->SuspendScreen(screenInfo.screens[i]);
@@ -345,7 +350,7 @@ void QuartzHide(void)
}
QuartzSetFullscreen(FALSE);
- quartzServerVisible = FALSE;
+ XQuartzServerVisible = FALSE;
}
@@ -358,7 +363,7 @@ void QuartzSetRootClip(
{
int i;
- if (!quartzServerVisible)
+ if (!XQuartzServerVisible)
return;
for (i = 0; i < screenInfo.numScreens; i++) {
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index 1b924e7..a0a17cb 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -35,6 +35,7 @@
#include "screenint.h"
#include "window.h"
+#include "pixmap.h"
/*------------------------------------------
Quartz display mode function types
@@ -113,7 +114,20 @@ typedef struct _QuartzModeProcs {
} QuartzModeProcsRec, *QuartzModeProcsPtr;
extern QuartzModeProcsPtr quartzProcs;
-extern int quartzHasRoot, quartzEnableRootless;
+
+extern Bool XQuartzHasRoot; /* TODO: These two booleans are very similar and */
+extern Bool XQuartzServerVisible; /* the code that uses them needs to be refactored
+ * XQuartzHasRoot is essentially the "saved" XQuartzServerVisible
+ * value from when the server was not in rootless mode.
+ */
+
+extern Bool XQuartzEnableKeyEquivalents;
+extern Bool XQuartzRootlessDefault; /* Is our default mode rootless? */
+extern Bool XQuartzIsRootless; /* Is our current mode rootless (or FS)? */
+extern Bool XQuartzFullscreenMenu; /* Show the menu bar (autohide) while in FS */
+extern Bool XQuartzFullscreenDisableHotkeys;
+extern Bool XQuartzOptionSendsAlt; /* Alt or Mode_switch? */
+extern Bool XQuartzUseSysBeep; /* Sys beep or our own? */
Bool QuartzAddScreen(int index, ScreenPtr pScreen);
Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
@@ -129,8 +143,8 @@ void QuartzHide(void);
void QuartzSetRootClip(BOOL enable);
void QuartzSpaceChanged(uint32_t space_id);
-void QuartzSetFullscreen(Bool state);
void QuartzSetRootless(Bool state);
+void QuartzSetFullscreen(Bool state);
int server_main(int argc, char **argv, char **envp);
#endif
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 708202b..d0f7c53 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -42,7 +42,7 @@
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
+#include "quartz.h"
#include "quartzAudio.h"
#include <CoreAudio/CoreAudio.h>
@@ -220,7 +220,7 @@ void DDXRingBell(
int pitch, // pitch is Hz
int duration ) // duration is milliseconds
{
- if (quartzUseSysBeep) {
+ if (XQuartzUseSysBeep) {
if (volume)
NSBeep();
return;
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index 718df4b..fbfe6f8 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -38,13 +38,7 @@
#include <X11/Xdefs.h>
#include "privates.h"
-// User preferences used by Quartz modes
-extern int quartzUseSysBeep;
-extern int quartzFullscreenDisableHotkeys;
-extern int quartzOptionSendsAlt;
-
// Other shared data
-extern int quartzServerVisible;
extern DevPrivateKeyRec quartzScreenKeyRec;
#define quartzScreenKey (&quartzScreenKeyRec)
extern int aquaMenuBarHeight;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 75cf23f..f54c686 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -48,7 +48,7 @@
#include <sys/stat.h>
#include <AvailabilityMacros.h>
-#include "quartzCommon.h"
+#include "quartz.h"
#include "darwin.h"
#include "darwinEvents.h"
@@ -262,7 +262,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
case XK_Alt_L:
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- if(!quartzOptionSendsAlt)
+ if(!XQuartzOptionSendsAlt)
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
break;
@@ -272,7 +272,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
#else
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#endif
- if(!quartzOptionSendsAlt)
+ if(!XQuartzOptionSendsAlt)
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
break;
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 9b84fa1..7534267 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -140,7 +140,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
break;
}
- switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
+ switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -239,7 +239,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
break;
}
- switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
+ switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
case CALLBACK_SUCCESS:
return TRUE;
case CALLBACK_ERROR:
@@ -377,7 +377,7 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
resolution including/excluding the menu bar. */
QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullscreenMode);
return TRUE;
}
@@ -434,37 +434,37 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (pQuartzScreen->displayCount == 1) {
- if(pQuartzScreen->fullScreenMode.ref)
- CFRelease(pQuartzScreen->fullScreenMode.ref);
+ if(pQuartzScreen->fullscreenMode.ref)
+ CFRelease(pQuartzScreen->fullscreenMode.ref);
if(pQuartzScreen->currentMode.ref)
CFRelease(pQuartzScreen->currentMode.ref);
if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0],
- &pQuartzScreen->fullScreenMode))
+ &pQuartzScreen->fullscreenMode))
return FALSE;
- CFRetain(pQuartzScreen->fullScreenMode.ref); /* This extra retain is for currentMode's copy */
+ CFRetain(pQuartzScreen->fullscreenMode.ref); /* This extra retain is for currentMode's copy */
} else {
- pQuartzScreen->fullScreenMode.width = pScreen->width;
- pQuartzScreen->fullScreenMode.height = pScreen->height;
- if(quartzEnableRootless)
- pQuartzScreen->fullScreenMode.height += aquaMenuBarHeight;
+ pQuartzScreen->fullscreenMode.width = pScreen->width;
+ pQuartzScreen->fullscreenMode.height = pScreen->height;
+ if(XQuartzIsRootless)
+ pQuartzScreen->fullscreenMode.height += aquaMenuBarHeight;
}
- pQuartzScreen->fullScreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
+ pQuartzScreen->fullscreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
- pQuartzScreen->rootlessMode = pQuartzScreen->fullScreenMode;
+ pQuartzScreen->rootlessMode = pQuartzScreen->fullscreenMode;
pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
- if(quartzEnableRootless) {
+ if(XQuartzIsRootless) {
pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
} else {
- pQuartzScreen->currentMode = pQuartzScreen->fullScreenMode;
+ pQuartzScreen->currentMode = pQuartzScreen->fullscreenMode;
}
DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
- DEBUG_LOG("fullScreenMode: %d x %d\n", (int)pQuartzScreen->fullScreenMode.width, (int)pQuartzScreen->fullScreenMode.height);
+ DEBUG_LOG("fullscreenMode: %d x %d\n", (int)pQuartzScreen->fullscreenMode.width, (int)pQuartzScreen->fullscreenMode.height);
DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
return TRUE;
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index 4a7990e..b2d4d09 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -45,7 +45,7 @@ typedef struct {
// No CG display will be covered by more than one X11 screen.
int displayCount;
CGDirectDisplayID *displayIDs;
- QuartzModeInfo rootlessMode, fullScreenMode, currentMode;
+ QuartzModeInfo rootlessMode, fullscreenMode, currentMode;
} QuartzScreenRec, *QuartzScreenPtr;
#define QUARTZ_PRIV(pScreen) \
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 4b31e3a..1a3d427 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -67,7 +67,7 @@ static int xprSetWindowLevel(
if(!winRec)
return BadWindow;
- if(quartzEnableRootless)
+ if(XQuartzIsRootless)
wc.window_level = normal_window_levels[level];
else
wc.window_level = rooted_window_levels[level];
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index a106e72..216678e 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -35,7 +35,7 @@
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
+#include "quartz.h"
#include "xpr.h"
#include "darwin.h"
#include "darwinEvents.h"
@@ -226,7 +226,7 @@ QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
{
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
- if (!quartzServerVisible)
+ if (!XQuartzServerVisible)
return;
if (pCursor == NULL)
@@ -295,7 +295,7 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
static void
QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- if (quartzServerVisible)
+ if (XQuartzServerVisible)
{
int sx, sy;
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index c78c5bd..8ee3a28 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -171,7 +171,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
pFrame->level = !IsRoot (pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
- if(quartzEnableRootless)
+ if(XQuartzIsRootless)
wc.window_level = normal_window_levels[pFrame->level];
else
wc.window_level = rooted_window_levels[pFrame->level];
@@ -285,7 +285,7 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);
if(winRec) {
- if(quartzEnableRootless)
+ if(XQuartzIsRootless)
wc.window_level = normal_window_levels[winRec->level];
else
wc.window_level = rooted_window_levels[winRec->level];
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index f7c8642..cba358f 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -158,7 +158,7 @@ displayScreenBounds(CGDirectDisplayID id)
(int)frame.origin.x, (int)frame.origin.y);
/* Remove menubar to help standard X11 window managers. */
- if (quartzEnableRootless &&
+ if (XQuartzIsRootless &&
frame.origin.x == 0 && frame.origin.y == 0) {
frame.origin.y += aquaMenuBarHeight;
frame.size.height -= aquaMenuBarHeight;
@@ -274,7 +274,8 @@ xprDisplayInit(void)
AppleDRIExtensionInit();
xprAppleWMInit();
- if (!quartzEnableRootless)
+ XQuartzIsRootless = XQuartzRootlessDefault;
+ if (!XQuartzIsRootless)
RootlessHideAllWindows();
}
commit 0e48527338d62da798b86e08d12b594937952d17
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Jul 26 11:45:59 2010 -0700
XQuartz: RandR: Better handle switching betwen RandR modes that share CG modes
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 65dce22..9b84fa1 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -57,9 +57,12 @@ static Bool ignore_next_fake_mode_update = FALSE;
#define DEFAULT_REFRESH 60
#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
-typedef Bool (*QuartzModeCallback)
- (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+#define CALLBACK_SUCCESS 0
+#define CALLBACK_CONTINUE 1
+#define CALLBACK_ERROR -1
+typedef int (*QuartzModeCallback)
+ (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
@@ -97,20 +100,22 @@ static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
pMode->ref = NULL;
}
-static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
+static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode) {
CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
if (!curModeRef)
return FALSE;
QuartzRandRGetModeInfo(curModeRef, pMode);
+ pMode->ref = curModeRef;
+ CFRetain(pMode->ref);
return TRUE;
}
static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode) {
CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
- return (CGDisplaySwitchToMode(screenId, modeRef) != kCGErrorSuccess);
+ return (CGDisplaySwitchToMode(screenId, modeRef) == kCGErrorSuccess);
}
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
@@ -122,6 +127,28 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
CFArrayRef modes;
QuartzModeInfo modeInfo;
int i;
+ BOOL retval = FALSE;
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+
+ switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ default:
+ break;
+ }
+
+ switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ default:
+ break;
+ }
curModeRef = CGDisplayCurrentMode(screenId);
if (!curModeRef)
@@ -132,6 +159,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
if (!modes)
return FALSE;
for (i = 0; i < CFArrayGetCount(modes); i++) {
+ int cb;
modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
/* Skip modes that are not usable on the current display or have a
@@ -144,10 +172,15 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
QuartzRandRGetModeInfo(modeRef, &modeInfo);
modeInfo.ref = modeRef;
- if (!callback(pScreen, screenId, &modeInfo, data))
+ cb = callback(pScreen, screenId, &modeInfo, data);
+ if (cb == CALLBACK_SUCCESS)
+ break;
+ if (cb == CALLBACK_ERROR) {
+ retval = FALSE;
break;
+ }
}
- return TRUE;
+ return retval;
}
#else /* we have the new CG APIs from Snow Leopard */
@@ -162,14 +195,14 @@ static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
pMode->ref = NULL;
}
-static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode) {
+static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode) {
CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
if (!curModeRef)
return FALSE;
QuartzRandRGetModeInfo(curModeRef, pMode);
- CGDisplayModeRelease(curModeRef);
+ pMode->ref = curModeRef;
return TRUE;
}
@@ -179,7 +212,7 @@ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
if (!modeRef)
return FALSE;
- return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) != kCGErrorSuccess);
+ return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) == kCGErrorSuccess);
}
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
@@ -192,6 +225,29 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
CFArrayRef modes;
QuartzModeInfo modeInfo;
int i;
+ Bool retval = TRUE;
+
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+
+ switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ default:
+ break;
+ }
+
+ switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ default:
+ break;
+ }
curModeRef = CGDisplayCopyDisplayMode(screenId);
if (!curModeRef)
@@ -205,6 +261,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
return FALSE;
}
for (i = 0; i < CFArrayGetCount(modes); i++) {
+ int cb;
modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
/* Skip modes that are not usable on the current display or have a
@@ -220,13 +277,19 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
QuartzRandRGetModeInfo(modeRef, &modeInfo);
modeInfo.ref = modeRef;
- if (!callback(pScreen, screenId, &modeInfo, data))
+ cb = callback(pScreen, screenId, &modeInfo, data);
+ if (cb == CALLBACK_SUCCESS)
+ break;
+ if (cb == CALLBACK_ERROR) {
+ retval = FALSE;
break;
+ }
}
+
CFRelease(modes);
CFRelease(curPixelEnc);
- return TRUE;
+ return retval;
}
#endif /* Snow Leopard CoreGraphics APIs */
@@ -246,6 +309,7 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
RRScreenSizePtr pSize = RRRegisterSize(pScreen,
pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
if (pSize) {
+ //DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : "");
RRRegisterRate(pScreen, pSize, pMode->refresh);
if (isCurrentMode)
@@ -256,34 +320,46 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
return FALSE;
}
-static Bool QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
+static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode,
void *data __unused) {
- return QuartzRandRRegisterMode(pScreen, pMode);
+ if(QuartzRandRRegisterMode(pScreen, pMode)) {
+ return CALLBACK_CONTINUE;
+ } else {
+ return CALLBACK_ERROR;
+ }
}
-static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode,
- void *data) {
+static int QuartzRandRSetModeCallback (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode,
+ void *data) {
QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-
+
if (!QuartzRandRModesEqual(pMode, pReqMode))
- return TRUE; /* continue enumeration */
+ return CALLBACK_CONTINUE; /* continue enumeration */
+
+ DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh);
- if (pReqMode->ref == pQuartzScreen->currentMode.ref) {
+ if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
- return FALSE; /* We don't need to do anything in CG */
+ return CALLBACK_SUCCESS; /* We don't need to do anything in CG */
}
- if (QuartzRandRSetMode(screenId, pMode) == FALSE) {
+ if (QuartzRandRSetMode(screenId, pMode)) {
+ if(pQuartzScreen->currentMode.ref)
+ CFRelease(pQuartzScreen->currentMode.ref);
+ pQuartzScreen->currentMode = *pMode;
+ CFRetain(pQuartzScreen->currentMode.ref);
+
ignore_next_fake_mode_update = TRUE;
- return FALSE;
+ return CALLBACK_SUCCESS;
} else {
- return TRUE;
- };
+ DEBUG_LOG("Error while requesting CG resolution change.\n");
+ return CALLBACK_ERROR;
+ }
}
static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
@@ -295,17 +371,17 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
if (pQuartzScreen->displayCount == 0)
return FALSE;
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
-
if (pQuartzScreen->displayCount > 1) {
/* RandR operations are not well-defined for an X11 screen spanning
multiple CG displays. Create two entries for the current virtual
resolution including/excluding the menu bar. */
+
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
return TRUE;
}
- screenId = pQuartzScreen->displayIDs[0];
+ screenId = pQuartzScreen->displayIDs[0];
return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
}
@@ -323,9 +399,14 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
/* If the client requested the fake rootless mode, switch to rootless.
* Otherwise, force fullscreen mode.
+ * TODO: Refactor all this fullscreen/rootless crap as it is spaghetti
+ * has redundancies.
*/
- QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
+ QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
+ if(reqMode.refresh != FAKE_REFRESH_ROOTLESS &&
+ reqMode.refresh != FAKE_REFRESH_FULLSCREEN)
+ QuartzShow();
if (pQuartzScreen->displayCount == 0)
return FALSE;
@@ -342,12 +423,10 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
screenId = pQuartzScreen->displayIDs[0];
if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
- pQuartzScreen->currentMode = reqMode;
return TRUE;
}
DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
-
return FALSE;
}
@@ -355,9 +434,16 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (pQuartzScreen->displayCount == 1) {
- if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
- &pQuartzScreen->fullScreenMode))
+ if(pQuartzScreen->fullScreenMode.ref)
+ CFRelease(pQuartzScreen->fullScreenMode.ref);
+ if(pQuartzScreen->currentMode.ref)
+ CFRelease(pQuartzScreen->currentMode.ref);
+
+ if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0],
+ &pQuartzScreen->fullScreenMode))
return FALSE;
+
+ CFRetain(pQuartzScreen->fullScreenMode.ref); /* This extra retain is for currentMode's copy */
} else {
pQuartzScreen->fullScreenMode.width = pScreen->width;
pQuartzScreen->fullScreenMode.height = pScreen->height;
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index 8ee2818..4a7990e 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -34,7 +34,7 @@
typedef struct {
size_t width, height;
int refresh;
- const void *ref;
+ void *ref; /* CGDisplayModeRef or CFDictionaryRef */
} QuartzModeInfo, *QuartzModeInfoPtr;
// Quartz specific per screen storage structure
commit 7dcfeecf82969e73942594a4d54685c417f3f07f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Jul 26 01:17:12 2010 -0700
XQuartz: RandR: Respond better to resolution changes made outside X
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 7b34b8a..7367068 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -52,6 +52,7 @@ in this Software without prior written authorization from The Open Group.
#include "darwin.h"
#include "quartz.h"
#include "quartzKeyboard.h"
+#include "quartzRandR.h"
#include "darwinEvents.h"
#include <sys/types.h>
@@ -276,7 +277,12 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
break;
case kXquartzDisplayChanged:
+ DEBUG_LOG("kXquartzDisplayChanged\n");
QuartzUpdateScreens();
+#ifdef RANDR
+ /* Update our RandR info */
+ QuartzRandRUpdateFakeModes(TRUE);
+#endif
break;
default:
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index 851e74c..718df4b 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -38,29 +38,6 @@
#include <X11/Xdefs.h>
#include "privates.h"
-typedef struct {
- size_t width, height;
- int refresh;
- const void *ref;
-} QuartzModeInfo, *QuartzModeInfoPtr;
-
-// Quartz specific per screen storage structure
-typedef struct {
- // List of CoreGraphics displays that this X11 screen covers.
- // This is more than one CG display for video mirroring and
- // rootless PseudoramiX mode.
- // No CG display will be covered by more than one X11 screen.
- int displayCount;
- CGDirectDisplayID *displayIDs;
- QuartzModeInfo originalMode, fakeMode;
-} QuartzScreenRec, *QuartzScreenPtr;
-
-#define QUARTZ_PRIV(pScreen) \
- ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
-
-void QuartzCopyDisplayIDs(ScreenPtr pScreen,
- int displayCount, CGDirectDisplayID *displayIDs);
-
// User preferences used by Quartz modes
extern int quartzUseSysBeep;
extern int quartzFullscreenDisableHotkeys;
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index e46e904..65dce22 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -38,6 +38,7 @@
#include "quartzCommon.h"
#include "quartzRandR.h"
#include "quartz.h"
+#include "darwin.h"
#include <AvailabilityMacros.h>
@@ -45,6 +46,13 @@
#include <randrstr.h>
#include <IOKit/graphics/IOGraphicsTypes.h>
+/* TODO: UGLY, find a better way!
+ * We want to ignore kXquartzDisplayChanged which are generated by us
+ */
+static Bool ignore_next_fake_mode_update = FALSE;
+
+#define FAKE_REFRESH_ROOTLESS 1
+#define FAKE_REFRESH_FULLSCREEN 2
#define DEFAULT_REFRESH 60
#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
@@ -171,8 +179,7 @@ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
if (!modeRef)
return FALSE;
- return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) !=
- kCGErrorSuccess);
+ return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) != kCGErrorSuccess);
}
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
@@ -227,18 +234,15 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
QuartzModeInfoPtr pMode2) {
- if (pMode1->width != pMode2->width)
- return FALSE;
- if (pMode1->height != pMode2->height)
- return FALSE;
- if (pMode1->refresh != pMode2->refresh)
- return FALSE;
- return TRUE;
+ return (pMode1->width == pMode2->width) &&
+ (pMode1->height == pMode2->height) &&
+ (pMode1->refresh == pMode2->refresh);
}
static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
- QuartzModeInfoPtr pMode,
- Bool isCurrentMode) {
+ QuartzModeInfoPtr pMode) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
RRScreenSizePtr pSize = RRRegisterSize(pScreen,
pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
if (pSize) {
@@ -252,14 +256,11 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
return FALSE;
}
-static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
+static Bool QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
CGDirectDisplayID screenId,
QuartzModeInfoPtr pMode,
- void *data) {
- QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
-
- return QuartzRandRRegisterMode(pScreen, pMode,
- QuartzRandRModesEqual(pMode, pCurMode));
+ void *data __unused) {
+ return QuartzRandRRegisterMode(pScreen, pMode);
}
static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
@@ -267,73 +268,64 @@ static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
QuartzModeInfoPtr pMode,
void *data) {
QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (!QuartzRandRModesEqual(pMode, pReqMode))
return TRUE; /* continue enumeration */
- return QuartzRandRSetMode(screenId, pMode);
+ if (pReqMode->ref == pQuartzScreen->currentMode.ref) {
+ DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
+ return FALSE; /* We don't need to do anything in CG */
+ }
+
+ if (QuartzRandRSetMode(screenId, pMode) == FALSE) {
+ ignore_next_fake_mode_update = TRUE;
+ return FALSE;
+ } else {
+ return TRUE;
+ };
}
static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
CGDirectDisplayID screenId;
- QuartzModeInfo curMode;
*rotations = RR_Rotate_0; /* TODO: support rotation */
if (pQuartzScreen->displayCount == 0)
return FALSE;
+
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
+
if (pQuartzScreen->displayCount > 1) {
/* RandR operations are not well-defined for an X11 screen spanning
multiple CG displays. Create two entries for the current virtual
resolution including/excluding the menu bar. */
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode,
- !quartzHasRoot);
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->originalMode,
- quartzHasRoot);
return TRUE;
}
screenId = pQuartzScreen->displayIDs[0];
- if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
- return FALSE;
-
- /* Add a fake mode corresponding to the original resolution excluding the
- height of the menu bar. */
- if (!quartzHasRoot &&
- QuartzRandRModesEqual(&pQuartzScreen->originalMode, &curMode)) {
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, TRUE);
- curMode = pQuartzScreen->fakeMode;
- }
- else
- QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, FALSE);
-
- return QuartzRandREnumerateModes(pScreen, screenId,
- QuartzRandRGetModeCallback, &curMode);
+ return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
}
static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize) {
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
CGDirectDisplayID screenId;
- QuartzModeInfo reqMode, curMode;
- Bool rootless = FALSE;
+ QuartzModeInfo reqMode;
reqMode.width = pSize->width;
reqMode.height = pSize->height;
reqMode.refresh = rate;
- /* If the client requested the fake screen mode, switch to rootless mode.
- Switch to fullscreen mode (root window visible) if a real screen mode was
- requested. */
- if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->fakeMode)) {
- rootless = TRUE;
- reqMode = pQuartzScreen->originalMode;
- }
- QuartzSetFullscreen(!rootless);
- QuartzSetRootless(rootless);
+ /* If the client requested the fake rootless mode, switch to rootless.
+ * Otherwise, force fullscreen mode.
+ */
+ QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
+ QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
if (pQuartzScreen->displayCount == 0)
return FALSE;
@@ -341,38 +333,80 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
/* RandR operations are not well-defined for an X11 screen spanning
multiple CG displays. Do not accept any configuations that differ
from the current configuration. */
- return QuartzRandRModesEqual(&reqMode, &pQuartzScreen->originalMode);
+ return TRUE;
}
- screenId = pQuartzScreen->displayIDs[0];
/* Do not switch modes if requested mode is equal to current mode. */
- if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
- return FALSE;
- if (QuartzRandRModesEqual(&reqMode, &curMode))
+ if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
return TRUE;
+
+ screenId = pQuartzScreen->displayIDs[0];
+ if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
+ pQuartzScreen->currentMode = reqMode;
+ return TRUE;
+ }
+
+ DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
- return QuartzRandREnumerateModes(pScreen, screenId,
- QuartzRandRSetModeCallback, &reqMode);
+ return FALSE;
}
-Bool QuartzRandRInit (ScreenPtr pScreen) {
- rrScrPrivPtr pScrPriv;
+static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-
- if (!RRScreenInit (pScreen)) return FALSE;
if (pQuartzScreen->displayCount == 1) {
if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
- &pQuartzScreen->originalMode))
+ &pQuartzScreen->fullScreenMode))
return FALSE;
+ } else {
+ pQuartzScreen->fullScreenMode.width = pScreen->width;
+ pQuartzScreen->fullScreenMode.height = pScreen->height;
+ if(quartzEnableRootless)
+ pQuartzScreen->fullScreenMode.height += aquaMenuBarHeight;
}
- else {
- pQuartzScreen->originalMode.width = pScreen->width;
- pQuartzScreen->originalMode.height = pScreen->height;
- pQuartzScreen->originalMode.refresh = DEFAULT_REFRESH;
+
+ pQuartzScreen->fullScreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
+
+ pQuartzScreen->rootlessMode = pQuartzScreen->fullScreenMode;
+ pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
+ pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
+
+ if(quartzEnableRootless) {
+ pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
+ } else {
+ pQuartzScreen->currentMode = pQuartzScreen->fullScreenMode;
}
- pQuartzScreen->fakeMode = pQuartzScreen->originalMode;
- pQuartzScreen->fakeMode.height -= aquaMenuBarHeight;
+
+ DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
+ DEBUG_LOG("fullScreenMode: %d x %d\n", (int)pQuartzScreen->fullScreenMode.width, (int)pQuartzScreen->fullScreenMode.height);
+ DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
+
+ return TRUE;
+}
+
+Bool QuartzRandRUpdateFakeModes (BOOL force_update) {
+ ScreenPtr pScreen = screenInfo.screens[0];
+
+ if(ignore_next_fake_mode_update) {
+ DEBUG_LOG("Ignoring update request caused by RandR resolution change.\n");
+ ignore_next_fake_mode_update = FALSE;
+ return TRUE;
+ }
+
+ if(!_QuartzRandRUpdateFakeModes(pScreen))
+ return FALSE;
+
+ if(force_update)
+ RRGetInfo(pScreen, TRUE);
+
+ return TRUE;
+}
+
+Bool QuartzRandRInit (ScreenPtr pScreen) {
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen)) return FALSE;
+ if (!_QuartzRandRUpdateFakeModes (pScreen)) return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = QuartzRandRGetInfo;
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index d57dc3b..8ee2818 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -31,6 +31,30 @@
#ifndef _QUARTZRANDR_H_
#define _QUARTZRANDR_H_
+typedef struct {
+ size_t width, height;
+ int refresh;
+ const void *ref;
+} QuartzModeInfo, *QuartzModeInfoPtr;
+
+// Quartz specific per screen storage structure
+typedef struct {
+ // List of CoreGraphics displays that this X11 screen covers.
+ // This is more than one CG display for video mirroring and
+ // rootless PseudoramiX mode.
+ // No CG display will be covered by more than one X11 screen.
+ int displayCount;
+ CGDirectDisplayID *displayIDs;
+ QuartzModeInfo rootlessMode, fullScreenMode, currentMode;
+} QuartzScreenRec, *QuartzScreenPtr;
+
+#define QUARTZ_PRIV(pScreen) \
+ ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
+
+void QuartzCopyDisplayIDs(ScreenPtr pScreen,
+ int displayCount, CGDirectDisplayID *displayIDs);
+
+Bool QuartzRandRUpdateFakeModes (BOOL force_update);
Bool QuartzRandRInit (ScreenPtr pScreen);
#endif
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 4df0373..f7c8642 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -36,6 +36,7 @@
#include "quartzCommon.h"
#include "inputstr.h"
#include "quartz.h"
+#include "quartzRandR.h"
#include "xpr.h"
#include "xprEvent.h"
#include "pseudoramiX.h"
commit 4a29292f7f352807fdad6b2c40e83342c281c88a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Jul 25 22:25:49 2010 -0700
XQuartz: RandR: Use deprecated CG APIs only on Leopard and earlier
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index b3b315c..e46e904 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -1,9 +1,9 @@
/*
- *
* Quartz-specific support for the XRandR extension
*
* Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
* 2010 Jan Hauffa.
+ * 2010 Apple Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -39,6 +39,8 @@
#include "quartzRandR.h"
#include "quartz.h"
+#include <AvailabilityMacros.h>
+
#include <X11/extensions/randr.h>
#include <randrstr.h>
#include <IOKit/graphics/IOGraphicsTypes.h>
@@ -51,7 +53,7 @@ typedef Bool (*QuartzModeCallback)
(ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
-#if defined(USE_DEPRECATED_CG_API)
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
long value;
@@ -140,7 +142,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
return TRUE;
}
-#else /* defined(USE_DEPRECATED_CG_API) */
+#else /* we have the new CG APIs from Snow Leopard */
static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
QuartzModeInfoPtr pMode) {
@@ -220,7 +222,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
return TRUE;
}
-#endif /* defined(USE_DEPRECATED_CG_API) */
+#endif /* Snow Leopard CoreGraphics APIs */
static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index 711c3f3..d57dc3b 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -2,6 +2,7 @@
* quartzRandR.h
*
* Copyright (c) 2010 Jan Hauffa.
+ * 2010 Apple Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -27,6 +28,9 @@
* use or other dealings in this Software without prior written authorization.
*/
-#define USE_DEPRECATED_CG_API 1
+#ifndef _QUARTZRANDR_H_
+#define _QUARTZRANDR_H_
Bool QuartzRandRInit (ScreenPtr pScreen);
+
+#endif
commit 08d37f5bbc5dc6a7847b9c7a652b4872399d176a
Author: Jan Hauffa <hauffa at in.tum.de>
Date: Fri Jul 16 17:56:44 2010 +0200
XQuartz: RandR: Remove FAKE_RANDR code.
Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index a4d7474..a52cac9 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -119,7 +119,7 @@ Bool QuartzSetupScreen(
if (! quartzProcs->InitCursor(pScreen))
return FALSE;
-#if defined(RANDR) && !defined(FAKE_RANDR)
+#if defined(RANDR)
if(!QuartzRandRInit(pScreen)) {
DEBUG_LOG("Failed to init RandR extension.\n");
return FALSE;
@@ -239,10 +239,6 @@ void QuartzUpdateScreens(void) {
DeliverEvents(pRoot, &e, 1, NullWindow);
quartzProcs->UpdateScreen(pScreen);
-
-#ifdef FAKE_RANDR
- RREditConnectionInfo(pScreen);
-#endif
}
void QuartzSetFullscreen(Bool state) {
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index f61ff93..b3b315c 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -39,60 +39,10 @@
#include "quartzRandR.h"
#include "quartz.h"
-#if defined(FAKE_RANDR)
-#include "scrnintstr.h"
-#include "windowstr.h"
-#else
#include <X11/extensions/randr.h>
#include <randrstr.h>
#include <IOKit/graphics/IOGraphicsTypes.h>
-#endif
-
-
-#if defined(FAKE_RANDR)
-
-static const int padlength[4] = {0, 3, 2, 1};
-
-void
-RREditConnectionInfo (ScreenPtr pScreen)
-{
- xConnSetup *connSetup;
- char *vendor;
- xPixmapFormat *formats;
- xWindowRoot *root;
- xDepth *depth;
- xVisualType *visual;
- int screen = 0;
- int d;
-
- connSetup = (xConnSetup *) ConnectionInfo;
- vendor = (char *) connSetup + sizeof (xConnSetup);
- formats = (xPixmapFormat *) ((char *) vendor +
- connSetup->nbytesVendor +
- padlength[connSetup->nbytesVendor & 3]);
- root = (xWindowRoot *) ((char *) formats +
- sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
- while (screen != pScreen->myNum)
- {
- depth = (xDepth *) ((char *) root +
- sizeof (xWindowRoot));
- for (d = 0; d < root->nDepths; d++)
- {
- visual = (xVisualType *) ((char *) depth +
- sizeof (xDepth));
- depth = (xDepth *) ((char *) visual +
- depth->nVisuals * sizeof (xVisualType));
- }
- root = (xWindowRoot *) ((char *) depth);
- screen++;
- }
- root->pixWidth = pScreen->width;
- root->pixHeight = pScreen->height;
- root->mmWidth = pScreen->mmWidth;
- root->mmHeight = pScreen->mmHeight;
-}
-#else /* defined(FAKE_RANDR) */
#define DEFAULT_REFRESH 60
#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
@@ -427,5 +377,3 @@ Bool QuartzRandRInit (ScreenPtr pScreen) {
pScrPriv->rrSetConfig = QuartzRandRSetConfig;
return TRUE;
}
-
-#endif /* defined(FAKE_RANDR) */
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
index a190205..711c3f3 100644
--- a/hw/xquartz/quartzRandR.h
+++ b/hw/xquartz/quartzRandR.h
@@ -27,11 +27,6 @@
* use or other dealings in this Software without prior written authorization.
*/
-/*define FAKE_RANDR 1*/
#define USE_DEPRECATED_CG_API 1
-#if defined(FAKE_RANDR)
-void RREditConnectionInfo (ScreenPtr pScreen);
-#else
Bool QuartzRandRInit (ScreenPtr pScreen);
-#endif
commit f2060e1de94b7bc8a5702fbcd3307324fe2518a2
Author: Jan Hauffa <hauffa at in.tum.de>
Date: Fri Jul 16 17:54:55 2010 +0200
XQuartz: RandR: Toggle rootless mode on XRandR mode switch.
Report a fake screen mode that corresponds to the screen mode at startup of the
server excluding the height of the menu bar. If a client requests this mode,
rootless mode is enabled. In all other modes, the root window is shown.
Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index d0d358b..851e74c 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -38,6 +38,12 @@
#include <X11/Xdefs.h>
#include "privates.h"
+typedef struct {
+ size_t width, height;
+ int refresh;
+ const void *ref;
+} QuartzModeInfo, *QuartzModeInfoPtr;
+
// Quartz specific per screen storage structure
typedef struct {
// List of CoreGraphics displays that this X11 screen covers.
@@ -46,6 +52,7 @@ typedef struct {
// No CG display will be covered by more than one X11 screen.
int displayCount;
CGDirectDisplayID *displayIDs;
+ QuartzModeInfo originalMode, fakeMode;
} QuartzScreenRec, *QuartzScreenPtr;
#define QUARTZ_PRIV(pScreen) \
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 6747752..f61ff93 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -37,6 +37,7 @@
#include "quartzCommon.h"
#include "quartzRandR.h"
+#include "quartz.h"
#if defined(FAKE_RANDR)
#include "scrnintstr.h"
@@ -96,12 +97,6 @@ RREditConnectionInfo (ScreenPtr pScreen)
#define DEFAULT_REFRESH 60
#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
-typedef struct {
- size_t width, height;
- int refresh;
- const void *ref;
-} QuartzModeInfo, *QuartzModeInfoPtr;
-
typedef Bool (*QuartzModeCallback)
(ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
@@ -289,21 +284,30 @@ static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
return TRUE;
}
-static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
- CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode,
- void *data) {
- QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
-
+static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
+ QuartzModeInfoPtr pMode,
+ Bool isCurrentMode) {
RRScreenSizePtr pSize = RRRegisterSize(pScreen,
pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
if (pSize) {
RRRegisterRate(pScreen, pSize, pMode->refresh);
- if (QuartzRandRModesEqual(pMode, pCurMode))
+ if (isCurrentMode)
RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
+
+ return TRUE;
}
- return TRUE;
+ return FALSE;
+}
+
+static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode,
+ void *data) {
+ QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
+
+ return QuartzRandRRegisterMode(pScreen, pMode,
+ QuartzRandRModesEqual(pMode, pCurMode));
}
static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
@@ -329,20 +333,29 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
return FALSE;
if (pQuartzScreen->displayCount > 1) {
/* RandR operations are not well-defined for an X11 screen spanning
- multiple CG displays. Create a single entry for the current virtual
- resolution. */
- RRScreenSizePtr pSize = RRRegisterSize(pScreen, pScreen->width,
- pScreen->height, pScreen->mmWidth, pScreen->mmHeight);
- if (pSize) {
- RRRegisterRate(pScreen, pSize, DEFAULT_REFRESH);
- RRSetCurrentConfig(pScreen, RR_Rotate_0, DEFAULT_REFRESH, pSize);
- }
+ multiple CG displays. Create two entries for the current virtual
+ resolution including/excluding the menu bar. */
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode,
+ !quartzHasRoot);
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->originalMode,
+ quartzHasRoot);
return TRUE;
}
screenId = pQuartzScreen->displayIDs[0];
if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
return FALSE;
+
+ /* Add a fake mode corresponding to the original resolution excluding the
+ height of the menu bar. */
+ if (!quartzHasRoot &&
+ QuartzRandRModesEqual(&pQuartzScreen->originalMode, &curMode)) {
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, TRUE);
+ curMode = pQuartzScreen->fakeMode;
+ }
+ else
+ QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, FALSE);
+
return QuartzRandREnumerateModes(pScreen, screenId,
QuartzRandRGetModeCallback, &curMode);
}
@@ -354,6 +367,21 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
CGDirectDisplayID screenId;
QuartzModeInfo reqMode, curMode;
+ Bool rootless = FALSE;
+
+ reqMode.width = pSize->width;
+ reqMode.height = pSize->height;
+ reqMode.refresh = rate;
+
+ /* If the client requested the fake screen mode, switch to rootless mode.
+ Switch to fullscreen mode (root window visible) if a real screen mode was
+ requested. */
+ if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->fakeMode)) {
+ rootless = TRUE;
+ reqMode = pQuartzScreen->originalMode;
+ }
+ QuartzSetFullscreen(!rootless);
+ QuartzSetRootless(rootless);
if (pQuartzScreen->displayCount == 0)
return FALSE;
@@ -361,15 +389,10 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
/* RandR operations are not well-defined for an X11 screen spanning
multiple CG displays. Do not accept any configuations that differ
from the current configuration. */
- return ((pSize->width == pScreen->width) &&
- (pSize->height == pScreen->height));
+ return QuartzRandRModesEqual(&reqMode, &pQuartzScreen->originalMode);
}
screenId = pQuartzScreen->displayIDs[0];
- reqMode.width = pSize->width;
- reqMode.height = pSize->height;
- reqMode.refresh = rate;
-
/* Do not switch modes if requested mode is equal to current mode. */
if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
return FALSE;
@@ -382,9 +405,23 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
Bool QuartzRandRInit (ScreenPtr pScreen) {
rrScrPrivPtr pScrPriv;
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (!RRScreenInit (pScreen)) return FALSE;
+ if (pQuartzScreen->displayCount == 1) {
+ if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
+ &pQuartzScreen->originalMode))
+ return FALSE;
+ }
+ else {
+ pQuartzScreen->originalMode.width = pScreen->width;
+ pQuartzScreen->originalMode.height = pScreen->height;
+ pQuartzScreen->originalMode.refresh = DEFAULT_REFRESH;
+ }
+ pQuartzScreen->fakeMode = pQuartzScreen->originalMode;
+ pQuartzScreen->fakeMode.height -= aquaMenuBarHeight;
+
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = QuartzRandRGetInfo;
pScrPriv->rrSetConfig = QuartzRandRSetConfig;
commit 715c463fa728d5a37f32b7aee895c5391245eefa
Author: Jan Hauffa <hauffa at in.tum.de>
Date: Fri Jul 16 17:18:03 2010 +0200
XQuartz: RandR: Implement basic RandR functionality.
Querying and changing of resolution and refresh rate is supported,
rotation is not implemented yet.
Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 96b139f..721d272 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -34,6 +34,7 @@ libXquartz_la_SOURCES = \
quartzCocoa.m \
quartzKeyboard.c \
quartzStartup.c \
+ quartzRandR.c \
threadSafety.c
EXTRA_DIST = \
@@ -49,6 +50,7 @@ EXTRA_DIST = \
quartzAudio.h \
quartzCommon.h \
quartzKeyboard.h \
+ quartzRandR.h \
sanitizedCarbon.h \
sanitizedCocoa.h \
threadSafety.h
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index eee6151..a4d7474 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -35,6 +35,7 @@
#endif
#include "quartzCommon.h"
+#include "quartzRandR.h"
#include "inputstr.h"
#include "quartz.h"
#include "darwin.h"
@@ -46,7 +47,6 @@
#include "X11Application.h"
#include <X11/extensions/applewmconst.h>
-#include <X11/extensions/randr.h>
// X headers
#include "scrnintstr.h"
@@ -56,6 +56,8 @@
#include "mi.h"
// System headers
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -64,8 +66,6 @@
#include <rootlessCommon.h>
#include <Xplugin.h>
-#define FAKE_RANDR 1
-
// Shared global variables for Quartz modes
int quartzUseSysBeep = 0;
int quartzServerVisible = FALSE;
@@ -76,30 +76,6 @@ const char *quartzOpenGLBundle = NULL;
int quartzFullscreenDisableHotkeys = TRUE;
int quartzOptionSendsAlt = FALSE;
-#if defined(RANDR) && !defined(FAKE_RANDR)
-Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
- return FALSE;
-}
-
-Bool QuartzRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize) {
- return FALSE;
-}
-
-Bool QuartzRandRInit (ScreenPtr pScreen) {
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen)) return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = QuartzRandRGetInfo;
- pScrPriv->rrSetConfig = QuartzRandRSetConfig;
- return TRUE;
-}
-#endif
-
/*
===========================================================================
@@ -143,6 +119,13 @@ Bool QuartzSetupScreen(
if (! quartzProcs->InitCursor(pScreen))
return FALSE;
+#if defined(RANDR) && !defined(FAKE_RANDR)
+ if(!QuartzRandRInit(pScreen)) {
+ DEBUG_LOG("Failed to init RandR extension.\n");
+ return FALSE;
+ }
+#endif
+
return TRUE;
}
@@ -165,11 +148,6 @@ void QuartzInitOutput(
if (!dixRegisterPrivateKey(&quartzScreenKeyRec, PRIVATE_SCREEN, 0))
FatalError("Failed to alloc quartz screen private.\n");
-#if defined(RANDR) && !defined(FAKE_RANDR)
- if(!QuartzRandRInit(pScreen))
- FatalError("Failed to init RandR extension.\n");
-#endif
-
// Do display mode specific initialization
quartzProcs->DisplayInit();
}
@@ -191,50 +169,6 @@ void QuartzInitInput(
}
-#ifdef FAKE_RANDR
-
-static const int padlength[4] = {0, 3, 2, 1};
-
-static void
-RREditConnectionInfo (ScreenPtr pScreen)
-{
- xConnSetup *connSetup;
- char *vendor;
- xPixmapFormat *formats;
- xWindowRoot *root;
- xDepth *depth;
- xVisualType *visual;
- int screen = 0;
- int d;
-
- connSetup = (xConnSetup *) ConnectionInfo;
- vendor = (char *) connSetup + sizeof (xConnSetup);
- formats = (xPixmapFormat *) ((char *) vendor +
- connSetup->nbytesVendor +
- padlength[connSetup->nbytesVendor & 3]);
- root = (xWindowRoot *) ((char *) formats +
- sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
- while (screen != pScreen->myNum)
- {
- depth = (xDepth *) ((char *) root +
- sizeof (xWindowRoot));
- for (d = 0; d < root->nDepths; d++)
- {
- visual = (xVisualType *) ((char *) depth +
- sizeof (xDepth));
- depth = (xDepth *) ((char *) visual +
- depth->nVisuals * sizeof (xVisualType));
- }
- root = (xWindowRoot *) ((char *) depth);
- screen++;
- }
- root->pixWidth = pScreen->width;
- root->pixHeight = pScreen->height;
- root->mmWidth = pScreen->mmWidth;
- root->mmHeight = pScreen->mmHeight;
-}
-#endif
-
void QuartzUpdateScreens(void) {
ScreenPtr pScreen;
WindowPtr pRoot;
@@ -255,7 +189,7 @@ void QuartzUpdateScreens(void) {
pScreen = screenInfo.screens[0];
PseudoramiXResetScreens();
- quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height);
+ quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen);
pScreen->x = x;
pScreen->y = y;
@@ -446,3 +380,19 @@ void QuartzSpaceChanged(uint32_t space_id) {
/* Do something special here, so we don't depend on quartz-wm for spaces to work... */
DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
}
+
+/*
+ * QuartzCopyDisplayIDs
+ * Associate an X11 screen with one or more CoreGraphics display IDs by copying
+ * the list into a private array. Free the previously copied array, if present.
+ */
+void QuartzCopyDisplayIDs(ScreenPtr pScreen,
+ int displayCount, CGDirectDisplayID *displayIDs) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ int size = displayCount * sizeof(CGDirectDisplayID);
+
+ free(pQuartzScreen->displayIDs);
+ pQuartzScreen->displayIDs = malloc(size);
+ memcpy(pQuartzScreen->displayIDs, displayIDs, size);
+ pQuartzScreen->displayCount = displayCount;
+}
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index b1a3f31..1b924e7 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -62,7 +62,8 @@ typedef void (*ResumeScreenProc)(ScreenPtr pScreen);
/*
* Screen state change support
*/
-typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
+typedef void (*AddPseudoramiXScreensProc)
+ (int *x, int *y, int *width, int *height, ScreenPtr pScreen);
typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
/*
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index eb761ed..d0d358b 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -51,6 +51,9 @@ typedef struct {
#define QUARTZ_PRIV(pScreen) \
((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
+void QuartzCopyDisplayIDs(ScreenPtr pScreen,
+ int displayCount, CGDirectDisplayID *displayIDs);
+
// User preferences used by Quartz modes
extern int quartzUseSysBeep;
extern int quartzFullscreenDisableHotkeys;
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
new file mode 100644
index 0000000..6747752
--- /dev/null
+++ b/hw/xquartz/quartzRandR.c
@@ -0,0 +1,394 @@
+/*
+ *
+ * Quartz-specific support for the XRandR extension
+ *
+ * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
+ * 2010 Jan Hauffa.
+ * 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#include "sanitizedCarbon.h"
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartzRandR.h"
+
+#if defined(FAKE_RANDR)
+#include "scrnintstr.h"
+#include "windowstr.h"
+#else
+#include <X11/extensions/randr.h>
+#include <randrstr.h>
+#include <IOKit/graphics/IOGraphicsTypes.h>
+#endif
+
+
+#if defined(FAKE_RANDR)
+
+static const int padlength[4] = {0, 3, 2, 1};
+
+void
+RREditConnectionInfo (ScreenPtr pScreen)
+{
+ xConnSetup *connSetup;
+ char *vendor;
+ xPixmapFormat *formats;
+ xWindowRoot *root;
+ xDepth *depth;
+ xVisualType *visual;
+ int screen = 0;
+ int d;
+
+ connSetup = (xConnSetup *) ConnectionInfo;
+ vendor = (char *) connSetup + sizeof (xConnSetup);
+ formats = (xPixmapFormat *) ((char *) vendor +
+ connSetup->nbytesVendor +
+ padlength[connSetup->nbytesVendor & 3]);
+ root = (xWindowRoot *) ((char *) formats +
+ sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
+ while (screen != pScreen->myNum)
+ {
+ depth = (xDepth *) ((char *) root +
+ sizeof (xWindowRoot));
+ for (d = 0; d < root->nDepths; d++)
+ {
+ visual = (xVisualType *) ((char *) depth +
+ sizeof (xDepth));
+ depth = (xDepth *) ((char *) visual +
+ depth->nVisuals * sizeof (xVisualType));
+ }
+ root = (xWindowRoot *) ((char *) depth);
+ screen++;
+ }
+ root->pixWidth = pScreen->width;
+ root->pixHeight = pScreen->height;
+ root->mmWidth = pScreen->mmWidth;
+ root->mmHeight = pScreen->mmHeight;
+}
+
+#else /* defined(FAKE_RANDR) */
+
+#define DEFAULT_REFRESH 60
+#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
+
+typedef struct {
+ size_t width, height;
+ int refresh;
+ const void *ref;
+} QuartzModeInfo, *QuartzModeInfoPtr;
+
+typedef Bool (*QuartzModeCallback)
+ (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+
+
+#if defined(USE_DEPRECATED_CG_API)
+
+static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
+ long value;
+
+ CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
+ if (!numRef)
+ return 0;
+
+ if (!CFNumberGetValue(numRef, kCFNumberLongType, &value))
+ return 0;
+ return value;
+}
+
+static double getDictDouble (CFDictionaryRef dictRef, CFStringRef key) {
+ double value;
+
+ CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
+ if (!numRef)
+ return 0.0;
+
+ if (!CFNumberGetValue(numRef, kCFNumberDoubleType, &value))
+ return 0.0;
+ return value;
+}
+
+static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
+ QuartzModeInfoPtr pMode) {
+ pMode->width = (size_t) getDictLong(modeRef, kCGDisplayWidth);
+ pMode->height = (size_t) getDictLong(modeRef, kCGDisplayHeight);
+ pMode->refresh = (int)(getDictDouble(modeRef, kCGDisplayRefreshRate) + 0.5);
+ if (pMode->refresh == 0)
+ pMode->refresh = DEFAULT_REFRESH;
+ pMode->ref = NULL;
+}
+
+static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode) {
+ CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
+ if (!curModeRef)
+ return FALSE;
+
+ QuartzRandRGetModeInfo(curModeRef, pMode);
+ return TRUE;
+}
+
+static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode) {
+ CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
+ return (CGDisplaySwitchToMode(screenId, modeRef) != kCGErrorSuccess);
+}
+
+static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeCallback callback,
+ void *data) {
+ CFDictionaryRef curModeRef, modeRef;
+ long curBpp;
+ CFArrayRef modes;
+ QuartzModeInfo modeInfo;
+ int i;
+
+ curModeRef = CGDisplayCurrentMode(screenId);
+ if (!curModeRef)
+ return FALSE;
+ curBpp = getDictLong(curModeRef, kCGDisplayBitsPerPixel);
+
+ modes = CGDisplayAvailableModes(screenId);
+ if (!modes)
+ return FALSE;
+ for (i = 0; i < CFArrayGetCount(modes); i++) {
+ modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
+
+ /* Skip modes that are not usable on the current display or have a
+ different pixel encoding than the current mode. */
+ if (((unsigned long) getDictLong(modeRef, kCGDisplayIOFlags) &
+ kDisplayModeUsableFlags) != kDisplayModeUsableFlags)
+ continue;
+ if (getDictLong(modeRef, kCGDisplayBitsPerPixel) != curBpp)
+ continue;
+
+ QuartzRandRGetModeInfo(modeRef, &modeInfo);
+ modeInfo.ref = modeRef;
+ if (!callback(pScreen, screenId, &modeInfo, data))
+ break;
+ }
+ return TRUE;
+}
+
+#else /* defined(USE_DEPRECATED_CG_API) */
+
+static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
+ QuartzModeInfoPtr pMode) {
+ pMode->width = CGDisplayModeGetWidth(modeRef);
+ pMode->height = CGDisplayModeGetHeight(modeRef);
+ pMode->refresh = (int) (CGDisplayModeGetRefreshRate(modeRef) + 0.5);
+ if (pMode->refresh == 0)
+ pMode->refresh = DEFAULT_REFRESH;
+ pMode->ref = NULL;
+}
+
+static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode) {
+ CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
+ if (!curModeRef)
+ return FALSE;
+
+ QuartzRandRGetModeInfo(curModeRef, pMode);
+ CGDisplayModeRelease(curModeRef);
+ return TRUE;
+}
+
+static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode) {
+ CGDisplayModeRef modeRef = (CGDisplayModeRef) pMode->ref;
+ if (!modeRef)
+ return FALSE;
+
+ return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) !=
+ kCGErrorSuccess);
+}
+
+static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeCallback callback,
+ void *data) {
+ CGDisplayModeRef curModeRef, modeRef;
+ CFStringRef curPixelEnc, pixelEnc;
+ CFComparisonResult pixelEncEqual;
+ CFArrayRef modes;
+ QuartzModeInfo modeInfo;
+ int i;
+
+ curModeRef = CGDisplayCopyDisplayMode(screenId);
+ if (!curModeRef)
+ return FALSE;
+ curPixelEnc = CGDisplayModeCopyPixelEncoding(curModeRef);
+ CGDisplayModeRelease(curModeRef);
+
+ modes = CGDisplayCopyAllDisplayModes(screenId, NULL);
+ if (!modes) {
+ CFRelease(curPixelEnc);
+ return FALSE;
+ }
+ for (i = 0; i < CFArrayGetCount(modes); i++) {
+ modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
+
+ /* Skip modes that are not usable on the current display or have a
+ different pixel encoding than the current mode. */
+ if ((CGDisplayModeGetIOFlags(modeRef) & kDisplayModeUsableFlags) !=
+ kDisplayModeUsableFlags)
+ continue;
+ pixelEnc = CGDisplayModeCopyPixelEncoding(modeRef);
+ pixelEncEqual = CFStringCompare(pixelEnc, curPixelEnc, 0);
+ CFRelease(pixelEnc);
+ if (pixelEncEqual != kCFCompareEqualTo)
+ continue;
+
+ QuartzRandRGetModeInfo(modeRef, &modeInfo);
+ modeInfo.ref = modeRef;
+ if (!callback(pScreen, screenId, &modeInfo, data))
+ break;
+ }
+ CFRelease(modes);
+
+ CFRelease(curPixelEnc);
+ return TRUE;
+}
+
+#endif /* defined(USE_DEPRECATED_CG_API) */
+
+
+static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
+ QuartzModeInfoPtr pMode2) {
+ if (pMode1->width != pMode2->width)
+ return FALSE;
+ if (pMode1->height != pMode2->height)
+ return FALSE;
+ if (pMode1->refresh != pMode2->refresh)
+ return FALSE;
+ return TRUE;
+}
+
+static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode,
+ void *data) {
+ QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
+
+ RRScreenSizePtr pSize = RRRegisterSize(pScreen,
+ pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+ if (pSize) {
+ RRRegisterRate(pScreen, pSize, pMode->refresh);
+
+ if (QuartzRandRModesEqual(pMode, pCurMode))
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
+ }
+ return TRUE;
+}
+
+static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
+ CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode,
+ void *data) {
+ QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
+
+ if (!QuartzRandRModesEqual(pMode, pReqMode))
+ return TRUE; /* continue enumeration */
+
+ return QuartzRandRSetMode(screenId, pMode);
+}
+
+static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ CGDirectDisplayID screenId;
+ QuartzModeInfo curMode;
+
+ *rotations = RR_Rotate_0; /* TODO: support rotation */
+
+ if (pQuartzScreen->displayCount == 0)
+ return FALSE;
+ if (pQuartzScreen->displayCount > 1) {
+ /* RandR operations are not well-defined for an X11 screen spanning
+ multiple CG displays. Create a single entry for the current virtual
+ resolution. */
+ RRScreenSizePtr pSize = RRRegisterSize(pScreen, pScreen->width,
+ pScreen->height, pScreen->mmWidth, pScreen->mmHeight);
+ if (pSize) {
+ RRRegisterRate(pScreen, pSize, DEFAULT_REFRESH);
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, DEFAULT_REFRESH, pSize);
+ }
+ return TRUE;
+ }
+ screenId = pQuartzScreen->displayIDs[0];
+
+ if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+ return FALSE;
+ return QuartzRandREnumerateModes(pScreen, screenId,
+ QuartzRandRGetModeCallback, &curMode);
+}
+
+static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ CGDirectDisplayID screenId;
+ QuartzModeInfo reqMode, curMode;
+
+ if (pQuartzScreen->displayCount == 0)
+ return FALSE;
+ if (pQuartzScreen->displayCount > 1) {
+ /* RandR operations are not well-defined for an X11 screen spanning
+ multiple CG displays. Do not accept any configuations that differ
+ from the current configuration. */
+ return ((pSize->width == pScreen->width) &&
+ (pSize->height == pScreen->height));
+ }
+ screenId = pQuartzScreen->displayIDs[0];
+
+ reqMode.width = pSize->width;
+ reqMode.height = pSize->height;
+ reqMode.refresh = rate;
+
+ /* Do not switch modes if requested mode is equal to current mode. */
+ if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+ return FALSE;
+ if (QuartzRandRModesEqual(&reqMode, &curMode))
+ return TRUE;
+
+ return QuartzRandREnumerateModes(pScreen, screenId,
+ QuartzRandRSetModeCallback, &reqMode);
+}
+
+Bool QuartzRandRInit (ScreenPtr pScreen) {
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen)) return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = QuartzRandRGetInfo;
+ pScrPriv->rrSetConfig = QuartzRandRSetConfig;
+ return TRUE;
+}
+
+#endif /* defined(FAKE_RANDR) */
diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h
new file mode 100644
index 0000000..a190205
--- /dev/null
+++ b/hw/xquartz/quartzRandR.h
@@ -0,0 +1,37 @@
+/*
+ * quartzRandR.h
+ *
+ * Copyright (c) 2010 Jan Hauffa.
+ * 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+/*define FAKE_RANDR 1*/
+#define USE_DEPRECATED_CG_API 1
+
+#if defined(FAKE_RANDR)
+void RREditConnectionInfo (ScreenPtr pScreen);
+#else
+Bool QuartzRandRInit (ScreenPtr pScreen);
+#endif
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index c03a82d..4df0373 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -176,7 +176,7 @@ displayScreenBounds(CGDirectDisplayID id)
* with PseudoramiX.
*/
static void
-xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
+xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScreen)
{
CGDisplayCount i, displayCount;
CGDirectDisplayID *displayList = NULL;
@@ -199,6 +199,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
if(!displayList)
FatalError("Unable to allocate memory for list of displays.\n");
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
+ QuartzCopyDisplayIDs(pScreen, displayCount, displayList);
/* Get the union of all screens */
for (i = 0; i < displayCount; i++) {
@@ -336,6 +337,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
ErrorF("Warning: noPseudoramiXExtension!\n");
dpy = displayAtIndex(index);
+ QuartzCopyDisplayIDs(pScreen, 1, &dpy);
frame = displayScreenBounds(dpy);
@@ -346,7 +348,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
}
else
{
- xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height);
+ xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height, pScreen);
}
/* Passing zero width (pitch) makes miCreateScreenResources set the
commit c768cdda92696b636c10bb2df64167d5274b4b99
Merge: 5a72538... 2079853...
Author: Keith Packard <keithp at keithp.com>
Date: Mon Sep 13 16:48:33 2010 -0700
Merge remote branch 'jamey/reviewed'
commit 20798536326f94ac9c97b4ec7a51329f7c912991
Author: Jamey Sharp <jamey at minilop.net>
Date: Wed Jul 14 13:14:28 2010 -0700
rootless: Delete dead remnants of rootless acceleration.
Jeremy deleted rootlessAccelInit's implementation in 2008 in commit
587c010a1cd733fded4d49dc339df0634bda8be6. Delete its prototype and the
remaining commented-out call to it.
It still makes sense for the rootless GC ops to relax the planemask, but
that's independent of the size of the operation, so quit checking the
thresholds there.
FillBytes and CompositePixels are not called anywhere, so delete
everything related to both.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Cc: Jeremy Huddleston <jeremyhu at apple.com>
Cc: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 42f06ef..c78c5bd 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -463,8 +463,6 @@ static RootlessFrameProcsRec xprRootlessProcs = {
xprHideWindow,
xprUpdateColormap,
xp_copy_bytes,
- xp_fill_bytes,
- xp_composite_pixels,
xprCopyWindow
};
@@ -480,8 +478,6 @@ xprInit(ScreenPtr pScreen)
TA_SERVER();
rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
- rootless_FillBytes_threshold = xp_fill_bytes_threshold;
- rootless_CompositePixels_threshold = xp_composite_area_threshold;
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
return TRUE;
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 87e97d4..c03a82d 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -367,12 +367,6 @@ xprAddScreen(int index, ScreenPtr pScreen)
static Bool
xprSetupScreen(int index, ScreenPtr pScreen)
{
- // Initialize accelerated rootless drawing
- // Note that this must be done before DamageSetup().
-
- // These are crashing ugly... better to be stable and not crash for now.
- //RootlessAccelInit(pScreen);
-
#ifdef DAMAGE
// The Damage extension needs to wrap underneath the
// generic rootless layer, so do it now.
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 8c4b67f..1b1358c 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1377,16 +1377,6 @@ winMWExtWMCopyBytes (unsigned int width, unsigned int height,
void *dst, unsigned int dstRowBytes);
void
-winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
- void *dst, unsigned int dstRowBytes);
-
-int
-winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
- void *src[2], unsigned int srcRowBytes[2],
- void *mask, unsigned int maskRowBytes,
- void *dst[2], unsigned int dstRowBytes[2]);
-
-void
winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
int dx, int dy);
#endif
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index d732410..cf65881 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -61,8 +61,6 @@ winMWExtWMProcs = {
NULL,//winMWExtWMUpdateColorMap,
NULL,//winMWExtWMCopyBytes,
- NULL,//winMWExtWMFillBytes,
- NULL,//winMWExtWMCompositePixels,
winMWExtWMCopyWindow
};
#endif
@@ -463,8 +461,6 @@ winFinishScreenInitFB (int index,
winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
rootless_CopyBytes_threshold = 0;
- rootless_FillBytes_threshold = 0;
- rootless_CompositePixels_threshold = 0;
/* FIXME: How many? Profiling needed? */
rootless_CopyWindow_threshold = 1;
diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index 9749861..fbe4191 100755
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -1007,28 +1007,6 @@ winMWExtWMCopyBytes (unsigned int width, unsigned int height,
}
void
-winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
- void *dst, unsigned int dstRowBytes)
-{
-#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMFillBytes - Not implemented\n");
-#endif
-}
-
-int
-winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
- void *src[2], unsigned int srcRowBytes[2],
- void *mask, unsigned int maskRowBytes,
- void *dst[2], unsigned int dstRowBytes[2])
-{
-#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMCompositePixels - Not implemented\n");
-#endif
- return 0;
-}
-
-
-void
winMWExtWMCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pDstRects,
int nDx, int nDy)
{
diff --git a/miext/rootless/README.txt b/miext/rootless/README.txt
index 7ec5c41..754715d 100644
--- a/miext/rootless/README.txt
+++ b/miext/rootless/README.txt
@@ -102,8 +102,7 @@ rootlessConfig.h:
offset that is applied to all screens when converting from
screen-local to global coordinates.
- o rootless_CopyBytes_threshold, rootless_FillBytes_threshold,
- rootless_CompositePixels_threshold, rootless_CopyWindow_threshold:
+ o rootless_CopyBytes_threshold, rootless_CopyWindow_threshold:
The minimum number of bytes or pixels for which to use the rootless
implementation's respective acceleration function. The rootless
acceleration functions are all optional so these will only be used
@@ -322,44 +321,6 @@ typedef void (*RootlessCopyBytesProc)
void *dst, unsigned int dstRowBytes);
/*
- * Fill memory with 32-bit pattern. (Optional)
- *
- * width Bytes to fill per row
- * height Number of rows
- * value 32-bit pattern to fill with
- * dst Destination data
- * dstRowBytes Width of destination in bytes
- */
-typedef void (*RootlessFillBytesProc)
- (unsigned int width, unsigned int height, unsigned int value,
- void *dst, unsigned int dstRowBytes);
-
-/*
- * Composite pixels from source and mask to destination. (Optional)
- *
- * width, height Size of area to composite to in pizels
- * function Composite function built with RL_COMPOSITE_FUNCTION
- * src Source data
- * srcRowBytes Width of source in bytes (Passing NULL means source
- * is a single pixel.
- * mask Mask data
- * maskRowBytes Width of mask in bytes
- * dst Destination data
- * dstRowBytes Width of destination in bytes
- *
- * For src and dst, the first element of the array is the color data. If
- * the second element is non-null it implies there is alpha data (which
- * may be meshed or planar). Data without alpha is assumed to be opaque.
- *
- * An X11 error code is returned.
- */
-typedef int (*RootlessCompositePixelsProc)
- (unsigned int width, unsigned int height, unsigned int function,
- void *src[2], unsigned int srcRowBytes[2],
- void *mask, unsigned int maskRowBytes,
- void *dst[2], unsigned int dstRowBytes[2]);
-
-/*
* Copy area in frame to another part of frame. (Optional)
*
* wid Frame id
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index b2d8d0f..3d4a1b0 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -82,30 +82,8 @@ extern int rootlessGlobalOffsetY;
/* The minimum number of bytes or pixels for which to use the
implementation's accelerated functions. */
extern unsigned int rootless_CopyBytes_threshold;
-extern unsigned int rootless_FillBytes_threshold;
-extern unsigned int rootless_CompositePixels_threshold;
extern unsigned int rootless_CopyWindow_threshold;
-/* Operations used by CompositePixels */
-enum rl_composite_op_enum {
- RL_COMPOSITE_SRC = 0,
- RL_COMPOSITE_OVER,
-};
-
-/* Data formats for depth field and composite functions */
-enum rl_depth_enum {
- RL_DEPTH_NIL = 0, /* null source when compositing */
- RL_DEPTH_ARGB8888,
- RL_DEPTH_RGB555,
- RL_DEPTH_A8, /* for masks when compositing */
- RL_DEPTH_INDEX8,
-};
-
-/* Macro to form the composite function for CompositePixels */
-#define RL_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \
- (((op) << 24) | ((src_depth) << 16) \
- | ((mask_depth) << 8) | ((dest_depth) << 0))
-
/* Gravity for window contents during resizing */
enum rl_gravity_enum {
RL_GRAVITY_NONE = 0, /* no gravity, fill everything */
@@ -292,44 +270,6 @@ typedef void (*RootlessCopyBytesProc)
void *dst, unsigned int dstRowBytes);
/*
- * Fill memory with 32-bit pattern. (Optional)
- *
- * width Bytes to fill per row
- * height Number of rows
- * value 32-bit pattern to fill with
- * dst Destination data
- * dstRowBytes Width of destination in bytes
- */
-typedef void (*RootlessFillBytesProc)
- (unsigned int width, unsigned int height, unsigned int value,
- void *dst, unsigned int dstRowBytes);
-
-/*
- * Composite pixels from source and mask to destination. (Optional)
- *
- * width, height Size of area to composite to in pizels
- * function Composite function built with RL_COMPOSITE_FUNCTION
- * src Source data
- * srcRowBytes Width of source in bytes (Passing NULL means source
- * is a single pixel.
- * mask Mask data
- * maskRowBytes Width of mask in bytes
- * dst Destination data
- * dstRowBytes Width of destination in bytes
- *
- * For src and dst, the first element of the array is the color data. If
- * the second element is non-null it implies there is alpha data (which
- * may be meshed or planar). Data without alpha is assumed to be opaque.
- *
- * An X11 error code is returned.
- */
-typedef int (*RootlessCompositePixelsProc)
- (unsigned int width, unsigned int height, unsigned int function,
- void *src[2], unsigned int srcRowBytes[2],
- void *mask, unsigned int maskRowBytes,
- void *dst[2], unsigned int dstRowBytes[2]);
-
-/*
* Copy area in frame to another part of frame. (Optional)
*
* wid Frame id
@@ -374,8 +314,6 @@ typedef struct _RootlessFrameProcs {
/* Optional acceleration functions */
RootlessCopyBytesProc CopyBytes;
- RootlessFillBytesProc FillBytes;
- RootlessCompositePixelsProc CompositePixels;
RootlessCopyWindowProc CopyWindow;
} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
@@ -386,13 +324,6 @@ typedef struct _RootlessFrameProcs {
Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
/*
- * Initialize acceleration for rootless mode on a given screen.
- * Note: RootlessAccelInit() must be called before DamageSetup()
- * and RootlessInit() must be called afterwards.
- */
-Bool RootlessAccelInit(ScreenPtr pScreen);
-
-/*
* Return the frame ID for the physical window displaying the given window.
*
* create If true and the window has no frame, attempt to create one
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index a9cd72a..861e8e8 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -40,8 +40,6 @@
#include "colormapst.h"
unsigned int rootless_CopyBytes_threshold = 0;
-unsigned int rootless_FillBytes_threshold = 0;
-unsigned int rootless_CompositePixels_threshold = 0;
unsigned int rootless_CopyWindow_threshold = 0;
int rootlessGlobalOffsetX = 0;
int rootlessGlobalOffsetY = 0;
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 6af8d85..68a9dc7 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -148,9 +148,6 @@ static GCOps rootlessGCOps = {
};
/*
- There are two issues we must contend with when drawing. These are
- controlled with ROOTLESS_PROTECT_ALPHA and RootlessAccelInit().
-
If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha
channel of the on screen windows is always opaque. fb makes this harder
than it would otherwise be by noticing that a planemask of 0x00ffffff
@@ -171,21 +168,8 @@ static GCOps rootlessGCOps = {
can do this when drawing op is GXcopy. We can also do this when copying
from another window since its alpha channel must also be opaque.
- The other issue to consider is that the rootless implementation may
- provide accelerated drawing functions if RootlessAccelInit() is called.For
- some drawing primitives we swap in rootless acceleration functions, which
- use the accelerated drawing functions where possible.
-
- Where both alpha protection and acceleration is used, it is even a bigger
- win to relax the planemask to all ones because most accelerated drawing
- functions can only be used in this case. However, even if we can't set
- the planemask to all ones, we can still use the accelerated
- CompositePixels function for GXcopy if it is a forward copy. This is
- mainly intended for copying from pixmaps to windows. The CompositePixels
- operation used sets alpha to 0xFF during the copy.
-
- The three macros below are used to implement this, potentially accelerated
- drawing ops look something like this:
+ The three macros below are used to implement this. Drawing ops that can
+ potentially have their planemask relaxed look like:
OP {
GC_SAVE(gc);
@@ -285,16 +269,6 @@ canAccelFill(DrawablePtr pDraw, GCPtr pGC)
return canAccelBlit(pDraw, pGC);
}
-static unsigned int
-boxBytes(DrawablePtr pDraw, BoxRec *box)
-{
- unsigned int pixels;
-
- pixels = (box->x2 - box->x1) * (box->y2 - box->y1);
-
- return pixels * (pDraw->bitsPerPixel >> 3);
-}
-
/*
* Screen function to create a graphics context
@@ -477,8 +451,7 @@ RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -584,15 +557,11 @@ RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr)pSrc)) {
- unsigned int bytes;
-
/* If both source and dest are windows, and we're doing
a simple copy operation, we can remove the alpha-protecting
planemask (since source has opaque alpha as well) */
- bytes = w * h * (pSrc->depth >> 3);
-
- if (bytes >= rootless_CopyBytes_threshold && canAccelBlit(pSrc, pGC))
+ if (canAccelBlit(pSrc, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1064,8 +1033,7 @@ static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1117,8 +1085,7 @@ static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1170,8 +1137,7 @@ static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1221,8 +1187,7 @@ static void RootlessImageText8(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1309,8 +1274,7 @@ static void RootlessImageText16(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
@@ -1408,8 +1372,7 @@ static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
RootlessStartDrawing((WindowPtr) dst);
- if (canAccelFill(dst, pGC) &&
- boxBytes(dst, &box) >= rootless_FillBytes_threshold)
+ if (canAccelFill(dst, pGC))
{
GC_UNSET_PM(pGC, dst);
}
commit 58d1ec0fe84412c66f1ea1de15e3901c0b120164
Author: Jamey Sharp <jamey at minilop.net>
Date: Wed Jul 14 11:30:17 2010 -0700
rootless: ROOTLESS_GLOBAL_COORDS is always set, so unifdef it.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Cc: Jeremy Huddleston <jeremyhu at apple.com>
Cc: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/miext/rootless/README.txt b/miext/rootless/README.txt
index 8a6df74..7ec5c41 100644
--- a/miext/rootless/README.txt
+++ b/miext/rootless/README.txt
@@ -76,15 +76,6 @@ rootlessConfig.h to specify compile time options for its platform.
The following compile-time options are defined in
rootlessConfig.h:
- o ROOTLESS_GLOBAL_COORDS: This option controls the way that frame
- coordinates are passed to the rootless implementation. If false,
- the coordinates are passed per screen relative to the origin of
- the screen the frame is currently on. Some implementations may
- prefer to work in a single global coordinate space that spans all
- screens. If this option is true, the coordinates are passed after
- adding the coordinates of the screen origin and an overall offset of
- (rootlessGlobalOffsetX, rootlessGlobalOffsetY).
-
o ROOTLESS_PROTECT_ALPHA: By default for a color bit depth of 24 and
32 bits per pixel, fb will overwrite the "unused" 8 bits to optimize
drawing speed. If this is true, the alpha channel of frames is
@@ -107,8 +98,7 @@ rootlessConfig.h:
The following runtime options are defined in rootless.h:
- o rootlessGlobalOffsetX, rootlessGlobalOffsetY: These are only
- used if ROOTLESS_GLOBAL_COORDS is true. They specify the global
+ o rootlessGlobalOffsetX, rootlessGlobalOffsetY: These specify the global
offset that is applied to all screens when converting from
screen-local to global coordinates.
@@ -182,8 +172,7 @@ implementation to indicate the frame to operate on.
* initialized before calling except for pFrame->wid, which
* is set by this function.
* pScreen Screen on which to place the new frame
- * newX, newY Position of the frame. These will be identical to pFrame-x,
- * pFrame->y unless ROOTLESS_GLOBAL_COORDS is set.
+ * newX, newY Position of the frame.
* pNewShape Shape for the frame (in frame-local coordinates). NULL for
* unshaped frames.
*/
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index f400695..b2d8d0f 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -76,10 +76,8 @@ typedef struct _RootlessWindowRec {
/* Offset for screen-local to global coordinate transforms */
-#ifdef ROOTLESS_GLOBAL_COORDS
extern int rootlessGlobalOffsetX;
extern int rootlessGlobalOffsetY;
-#endif
/* The minimum number of bytes or pixels for which to use the
implementation's accelerated functions. */
@@ -130,8 +128,7 @@ enum rl_gravity_enum {
* initialized before calling except for pFrame->wid, which
* is set by this function.
* pScreen Screen on which to place the new frame
- * newX, newY Position of the frame. These will be identical to pFrame-x,
- * pFrame->y unless ROOTLESS_GLOBAL_COORDS is set.
+ * newX, newY Position of the frame.
* pNewShape Shape for the frame (in frame-local coordinates). NULL for
* unshaped frames.
*/
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index b0476d7..a9cd72a 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -43,10 +43,8 @@ unsigned int rootless_CopyBytes_threshold = 0;
unsigned int rootless_FillBytes_threshold = 0;
unsigned int rootless_CompositePixels_threshold = 0;
unsigned int rootless_CopyWindow_threshold = 0;
-#ifdef ROOTLESS_GLOBAL_COORDS
int rootlessGlobalOffsetX = 0;
int rootlessGlobalOffsetY = 0;
-#endif
RegionRec rootlessHugeRoot = {{-32767, -32767, 32767, 32767}, NULL};
diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index 9082ac2..a6c0d25 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -36,7 +36,6 @@
#ifdef __APPLE__
-# define ROOTLESS_GLOBAL_COORDS TRUE
# define ROOTLESS_PROTECT_ALPHA TRUE
# define ROOTLESS_REDISPLAY_DELAY 10
# define ROOTLESS_RESIZE_GRAVITY TRUE
@@ -51,7 +50,6 @@
#if defined(__CYGWIN__) || defined(WIN32)
-# define ROOTLESS_GLOBAL_COORDS TRUE
# define ROOTLESS_PROTECT_ALPHA NO
# define ROOTLESS_REDISPLAY_DELAY 10
# undef ROOTLESS_RESIZE_GRAVITY
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 410f729..42ab8da 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -51,15 +51,10 @@ extern Bool no_configure_window;
#include "rootlessCommon.h"
#include "rootlessWindow.h"
-#ifdef ROOTLESS_GLOBAL_COORDS
#define SCREEN_TO_GLOBAL_X \
(pScreen->x + rootlessGlobalOffsetX)
#define SCREEN_TO_GLOBAL_Y \
(pScreen->y + rootlessGlobalOffsetY)
-#else
-#define SCREEN_TO_GLOBAL_X 0
-#define SCREEN_TO_GLOBAL_Y 0
-#endif
#define DEFINE_ATOM_HELPER(func,atom_name) \
static Atom func (void) { \
commit 35ce892a705f9377a36f19414e5a25dcbe44a354
Author: Jamey Sharp <jamey at minilop.net>
Date: Wed Jul 14 11:19:41 2010 -0700
rootless: ROOTLESS_TRACK_DAMAGE is never set, so unifdef it.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Cc: Jeremy Huddleston <jeremyhu at apple.com>
Cc: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 7add0e3..d732410 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -54,9 +54,7 @@ winMWExtWMProcs = {
winMWExtWMStartDrawing,
winMWExtWMStopDrawing,
winMWExtWMUpdateRegion,
-#ifndef ROOTLESS_TRACK_DAMAGE
winMWExtWMDamageRects,
-#endif
winMWExtWMRootlessSwitchWindow,
NULL,//winMWExtWMDoReorderWindow,
NULL,//winMWExtWMHideWindow,
diff --git a/miext/rootless/README.txt b/miext/rootless/README.txt
index 2c3fbb0..8a6df74 100644
--- a/miext/rootless/README.txt
+++ b/miext/rootless/README.txt
@@ -105,18 +105,6 @@ rootlessConfig.h:
during resizing and rely on the frame contents being preserved
accordingly.
- o ROOTLESS_TRACK_DAMAGE: The generic rootless layer draws to the
- frames' backing buffers and periodically flushes the modified
- regions to the underlying window server. If this option is true,
- the generic rootless layer will track these damaged regions.
- Currently it uses the miRegion code and will not simplify damaged
- regions even when updating a bounding region would be more
- efficient. Some window systems provide a more efficient way to
- track damaged regions. If this option is false, the rootless
- implementation function DamageRects() is called whenever a
- backing buffer is modified and the rootless implementation is
- expected to track the damaged regions itself.
-
The following runtime options are defined in rootless.h:
o rootlessGlobalOffsetX, rootlessGlobalOffsetY: These are only
@@ -287,8 +275,7 @@ typedef void (*RootlessStartDrawingProc)
* is started again.
*
* wid Frame id
- * flush Flush drawing updates for this frame to the screen. This
- * will always be FALSE if ROOTLESS_TRACK_DAMAGE is set.
+ * flush Flush drawing updates for this frame to the screen.
*/
typedef void (*RootlessStopDrawingProc)
(RootlessFrameID wid, Bool flush);
@@ -299,15 +286,13 @@ typedef void (*RootlessStopDrawingProc)
*
* wid Frame id
* pDamage Region containing all the changed pixels in frame-local
- * coordinates. This is clipped to the window's clip. This
- * will be NULL if ROOTLESS_TRACK_DAMAGE is not set.
+ * coordinates. This is clipped to the window's clip.
*/
typedef void (*RootlessUpdateRegionProc)
(RootlessFrameID wid, RegionPtr pDamage);
/*
* Mark damaged rectangles as requiring redisplay to screen.
- * This will only be called if ROOTLESS_TRACK_DAMAGE is not set.
*
* wid Frame id
* nrects Number of damaged rectangles
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index dc4213f..f400695 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -68,10 +68,6 @@ typedef struct _RootlessWindowRec {
PixmapPtr pixmap;
-#ifdef ROOTLESS_TRACK_DAMAGE
- RegionRec damage;
-#endif
-
unsigned int is_drawing :1; // Currently drawing?
unsigned int is_reorder_pending :1;
unsigned int is_offscreen :1;
@@ -227,8 +223,7 @@ typedef void (*RootlessStartDrawingProc)
* is started again.
*
* wid Frame id
- * flush Flush drawing updates for this frame to the screen. This
- * will always be FALSE if ROOTLESS_TRACK_DAMAGE is set.
+ * flush Flush drawing updates for this frame to the screen.
*/
typedef void (*RootlessStopDrawingProc)
(RootlessFrameID wid, Bool flush);
@@ -239,15 +234,13 @@ typedef void (*RootlessStopDrawingProc)
*
* wid Frame id
* pDamage Region containing all the changed pixels in frame-lcoal
- * coordinates. This is clipped to the window's clip. This
- * will be NULL if ROOTLESS_TRACK_DAMAGE is not set.
+ * coordinates. This is clipped to the window's clip.
*/
typedef void (*RootlessUpdateRegionProc)
(RootlessFrameID wid, RegionPtr pDamage);
/*
* Mark damaged rectangles as requiring redisplay to screen.
- * This will only be called if ROOTLESS_TRACK_DAMAGE is not set.
*
* wid Frame id
* nrects Number of damaged rectangles
@@ -374,9 +367,7 @@ typedef struct _RootlessFrameProcs {
RootlessStartDrawingProc StartDrawing;
RootlessStopDrawingProc StopDrawing;
RootlessUpdateRegionProc UpdateRegion;
-#ifndef ROOTLESS_TRACK_DAMAGE
RootlessDamageRectsProc DamageRects;
-#endif
/* Optional frame functions */
RootlessSwitchWindowProc SwitchWindow;
@@ -426,8 +417,7 @@ void RootlessStartDrawing(WindowPtr pWindow);
/*
* Finish drawing to a window's backing buffer.
*
- * flush If true and ROOTLESS_TRACK_DAMAGE is set, damaged areas
- * are flushed to the screen.
+ * flush If true, damaged areas are flushed to the screen.
*/
void RootlessStopDrawing(WindowPtr pWindow, Bool flush);
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index f91cfb4..b0476d7 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -305,16 +305,11 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion)
if (in == rgnIN) {
/* clip totally contains pRegion */
-#ifdef ROOTLESS_TRACK_DAMAGE
- RegionUnion(&winRec->damage,
- &winRec->damage, (pRegion));
-#else
SCREENREC(pWindow->drawable.pScreen)->imp->
DamageRects(winRec->wid,
RegionNumRects(pRegion),
RegionRects(pRegion),
-winRec->x, -winRec->y);
-#endif
RootlessQueueRedisplay(pTop->drawable.pScreen);
goto out;
@@ -331,16 +326,11 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion)
RegionNull(&clipped);
RegionIntersect(&clipped, &pWindow->borderClip, pRegion);
-#ifdef ROOTLESS_TRACK_DAMAGE
- RegionUnion(&winRec->damage,
- &winRec->damage, (pRegion));
-#else
SCREENREC(pWindow->drawable.pScreen)->imp->
DamageRects(winRec->wid,
RegionNumRects(&clipped),
RegionRects(&clipped),
-winRec->x, -winRec->y);
-#endif
RegionUninit(&clipped);
@@ -415,32 +405,7 @@ RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h)
void
RootlessRedisplay(WindowPtr pWindow)
{
-#ifdef ROOTLESS_TRACK_DAMAGE
-
- RootlessWindowRec *winRec = WINREC(pWindow);
- ScreenPtr pScreen = pWindow->drawable.pScreen;
-
- RootlessStopDrawing(pWindow, FALSE);
-
- if (RegionNotEmpty(&winRec->damage)) {
- RL_DEBUG_MSG("Redisplay Win 0x%x, %i x %i @ (%i, %i)\n",
- pWindow, winRec->width, winRec->height,
- winRec->x, winRec->y);
-
- // move region to window local coords
- RegionTranslate(&winRec->damage,
- -winRec->x, -winRec->y);
-
- SCREENREC(pScreen)->imp->UpdateRegion(winRec->wid, &winRec->damage);
-
- RegionEmpty(&winRec->damage);
- }
-
-#else /* !ROOTLESS_TRACK_DAMAGE */
-
RootlessStopDrawing(pWindow, TRUE);
-
-#endif
}
diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index 50bac3f..9082ac2 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -40,7 +40,6 @@
# define ROOTLESS_PROTECT_ALPHA TRUE
# define ROOTLESS_REDISPLAY_DELAY 10
# define ROOTLESS_RESIZE_GRAVITY TRUE
-# undef ROOTLESS_TRACK_DAMAGE
/*# define ROOTLESSDEBUG*/
/* Bit mask for alpha channel with a particular number of bits per
@@ -56,7 +55,6 @@
# define ROOTLESS_PROTECT_ALPHA NO
# define ROOTLESS_REDISPLAY_DELAY 10
# undef ROOTLESS_RESIZE_GRAVITY
-# undef ROOTLESS_TRACK_DAMAGE
/*# define ROOTLESSDEBUG*/
# define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0)
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index c1c6bdb..410f729 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -180,11 +180,6 @@ static void
RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
{
SCREENREC(pWin->drawable.pScreen)->imp->DestroyFrame(winRec->wid);
-
-#ifdef ROOTLESS_TRACK_DAMAGE
- RegionUninit(&winRec->damage);
-#endif
-
free(winRec);
SETWINREC(pWin, NULL);
}
@@ -341,15 +336,6 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y)
winRec->pixmap->devPrivate.ptr = winRec->pixelData;
SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw);
-
-#ifdef ROOTLESS_TRACK_DAMAGE
- // Move damaged region to correspond to new window position
- if (RegionNotEmpty(&winRec->damage)) {
- RegionTranslate(&winRec->damage,
- x - bw - winRec->x,
- y - bw - winRec->y);
- }
-#endif
}
}
@@ -381,10 +367,6 @@ RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec *winRec)
winRec->width = d->width + 2*bw;
winRec->height = d->height + 2*bw;
winRec->borderWidth = bw;
-
-#ifdef ROOTLESS_TRACK_DAMAGE
- RegionNull(&winRec->damage);
-#endif
}
/*
commit ccdf15689050a0f988721c91fab75861ec4d339c
Author: Jamey Sharp <jamey at minilop.net>
Date: Mon May 31 16:01:18 2010 -0700
miPolyGlyphBlt: Delete redundant ValidateGC.
The caller is required to have validated the GC for the drawable before
calling any ops, including PolyGlyphBlt.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/mi/miglblt.c b/mi/miglblt.c
index 13efb0c..9edb500 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -182,8 +182,6 @@ miPolyGlyphBlt(
0, 0, gWidth, gHeight,
0, XYBitmap, (char *)pb);
- if ((pGC->serialNumber) != (pDrawable->serialNumber))
- ValidateGC(pDrawable, pGC);
(*pGC->ops->PushPixels)(pGC, pPixmap, pDrawable,
gWidth, gHeight,
x + pci->metrics.leftSideBearing,
commit 3fd963de27f3c4452c320e617ad33b91b0967737
Author: Jamey Sharp <jamey at minilop.net>
Date: Wed May 19 14:16:20 2010 -0700
Un-export CreateScratchGC now that nothing external uses it.
The server and drivers sometimes use GetScratchGC, but never
CreateScratchGC.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/gc.c b/dix/gc.c
index 83bb524..fc251dd 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -799,7 +799,7 @@ is what fills the default tile. (maybe this comment should
go with CreateGC() or ChangeGC().)
*/
-GCPtr
+static GCPtr
CreateScratchGC(ScreenPtr pScreen, unsigned depth)
{
GCPtr pGC;
diff --git a/include/gc.h b/include/gc.h
index 63eecbd..2079cfa 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -122,10 +122,6 @@ extern _X_EXPORT int FreeGC(
pointer /*pGC*/,
XID /*gid*/);
-extern _X_EXPORT GCPtr CreateScratchGC(
- ScreenPtr /*pScreen*/,
- unsigned /*depth*/);
-
extern _X_EXPORT void FreeGCperDepth(
int /*screenNum*/);
commit 0f48e362c5baee2bc281a4b88cfb68de24172d15
Author: Jamey Sharp <jamey at minilop.net>
Date: Wed May 19 14:03:19 2010 -0700
glxdriswrast: Use CreateGC, not CreateScratchGC.
Since this code was using CreateScratchGC and not GetScratchGC,
FreeScratchGC would always call FreeGC, so just call it directly.
As long as the drawable provided to CreateGC has the same screen and
depth as were passed to CreateScratchGC, these functions are basically
identical. There are two differences:
- CreateGC gives you a non-null stipple. You probably don't care.
- CreateGC passes the gcid and client to XACE. There are several
internal GCs allocated in the server, and they all pass 0 and
serverClient. I expect XACE will never reject that combination.
The callers of createDrawable all verify that pDraw has the same screen
that driScreen does. In short, this should have no behavioral change.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Cc: Kristian Høgsberg <krh at bitplanet.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 54f4440..dc12f57 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -99,8 +99,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
(*core->destroyDrawable)(private->driDrawable);
- FreeScratchGC(private->gc);
- FreeScratchGC(private->swapgc);
+ FreeGC(private->gc, (GContext)0);
+ FreeGC(private->swapgc, (GContext)0);
__glXDrawableRelease(drawable);
@@ -301,13 +301,12 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
XID glxDrawId,
__GLXconfig *glxConfig)
{
- ChangeGCVal gcvals[2];
+ XID gcvals[2];
+ int status;
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
- ScreenPtr pScreen = driScreen->base.pScreen;
-
private = calloc(1, sizeof *private);
if (private == NULL)
return NULL;
@@ -323,13 +322,10 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
- private->gc = CreateScratchGC(pScreen, pDraw->depth);
- private->swapgc = CreateScratchGC(pScreen, pDraw->depth);
-
- gcvals[0].val = GXcopy;
- ChangeGC(NullClient, private->gc, GCFunction, gcvals);
- gcvals[1].val = FALSE;
- ChangeGC(NullClient, private->swapgc, GCFunction | GCGraphicsExposures, gcvals);
+ gcvals[0] = GXcopy;
+ private->gc = CreateGC(pDraw, GCFunction, gcvals, &status, (XID)0, serverClient);
+ gcvals[1] = FALSE;
+ private->swapgc = CreateGC(pDraw, GCFunction | GCGraphicsExposures, gcvals, &status, (XID)0, serverClient);
private->driDrawable =
(*driScreen->swrast->createNewDrawable)(driScreen->driScreen,
commit af2a94e12fe4e426dfca461a0d14526193c01cef
Author: Jamey Sharp <jamey at minilop.net>
Date: Tue Jul 13 13:33:59 2010 -0700
VGA arbiter: No need for arbitration around CreateGC.
None of XAA, EXA, or UXA do any hardware access during CreateGC, so they
don't need VGA arbitration. I haven't found any open source drivers that
hook CreateGC, so they're safe. I'd be surprised if any driver directly
hooks CreateGC and does hardware access from it and needs VGA
arbitration.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index becf4a9..fa313f1 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -573,9 +573,7 @@ VGAarbiterCreateGC(GCPtr pGC)
Bool ret;
SCREEN_PROLOG(CreateGC);
- VGAGet(pScreen);
ret = (*pScreen->CreateGC)(pGC);
- VGAPut();
GC_WRAP(pGC);
SCREEN_EPILOG(CreateGC,VGAarbiterCreateGC);
commit 7a63b2db636f01694cb54726bbb04287718e286a
Author: Jamey Sharp <jamey at minilop.net>
Date: Sun Jul 11 20:36:34 2010 -0700
Delete Colormap->devPriv. It isn't used any more.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
diff --git a/include/colormapst.h b/include/colormapst.h
index f1fc8eb..0ba5bd0 100644
--- a/include/colormapst.h
+++ b/include/colormapst.h
@@ -126,9 +126,7 @@ typedef struct _ColormapRec
Entry *red;
Entry *green;
Entry *blue;
- pointer devPriv;
- PrivateRec *devPrivates; /* dynamic devPrivates added after devPriv
- already existed - must keep devPriv */
+ PrivateRec *devPrivates;
} ColormapRec;
#endif /* COLORMAP_H */
commit 2e8069dd36c2f5caf868937405fc03328004a85d
Author: Jamey Sharp <jamey at minilop.net>
Date: Sun Jul 11 20:35:43 2010 -0700
xnest: Replace use of Colormap->devPriv with standard devPrivates.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 883b77c..0aae8e9 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -34,6 +34,8 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Args.h"
+DevPrivateKeyRec xnestColormapPrivateKeyRec;
+
static DevPrivateKeyRec cmapScrPrivateKeyRec;
#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
@@ -52,8 +54,6 @@ xnestCreateColormap(ColormapPtr pCmap)
pVisual = pCmap->pVisual;
ncolors = pVisual->ColormapEntries;
- pCmap->devPriv = (pointer)malloc(sizeof(xnestPrivColormap));
-
xnestColormapPriv(pCmap)->colormap =
XCreateColormap(xnestDisplay,
xnestDefaultWindows[pCmap->pScreen->myNum],
@@ -130,7 +130,6 @@ void
xnestDestroyColormap(ColormapPtr pCmap)
{
XFreeColormap(xnestDisplay, xnestColormap(pCmap));
- free(pCmap->devPriv);
}
#define SEARCH_PREDICATE \
diff --git a/hw/xnest/Color.h b/hw/xnest/Color.h
index f00bde4..d39c638 100644
--- a/hw/xnest/Color.h
+++ b/hw/xnest/Color.h
@@ -32,8 +32,9 @@ typedef struct {
int index;
} xnestInstalledColormapWindows;
+extern DevPrivateKeyRec xnestColormapPrivateKeyRec;
#define xnestColormapPriv(pCmap) \
- ((xnestPrivColormap *)((pCmap)->devPriv))
+ ((xnestPrivColormap *) dixLookupPrivate(&(pCmap)->devPrivates, &xnestColormapPrivateKeyRec))
#define xnestColormap(pCmap) (xnestColormapPriv(pCmap)->colormap)
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 957fe4c..0a6cab6 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -151,6 +151,8 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
return FALSE;
if (!dixRegisterPrivateKey(&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof (xnestPrivPixmap)))
return FALSE;
+ if (!dixRegisterPrivateKey(&xnestColormapPrivateKeyRec, PRIVATE_COLORMAP, sizeof (xnestPrivColormap)))
+ return FALSE;
if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
commit 34d6492436c0f4a81822769b24d8c7816d0226ad
Author: Jamey Sharp <jamey at minilop.net>
Date: Sat Jul 10 06:55:58 2010 -0700
xquartz: Delete compile-time-constant DRIGCRec.driOps field.
The driOps field of this structure is never set to anything but
&driGCOps, and this structure is not visible outside this source file.
Just use the constant in the one place the field was used.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Cc: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index 65843b8..de5c4a2 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -41,7 +41,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef struct {
GCOps *originalOps;
- GCOps *driOps;
} DRIGCRec;
typedef struct {
@@ -86,9 +85,7 @@ DRIUnwrapGC(GCPtr pGC) {
static void
DRIWrapGC(GCPtr pGC) {
- DRIGCRec *pGCPriv = DRIGetGCPriv(pGC);
-
- pGC->ops = pGCPriv->driOps;
+ pGC->ops = &driGCOps;
}
static void
@@ -513,7 +510,6 @@ DRICreateGC(GCPtr pGC) {
if(ret) {
pGCPriv->originalOps = pGC->ops;
pGC->ops = &driGCOps;
- pGCPriv->driOps = &driGCOps;
}
wrap(pScreenPriv, pScreen, CreateGC, DRICreateGC);
commit 2051e0f371de892b2e598b30c18dae96b58d68de
Author: Jamey Sharp <jamey at minilop.net>
Date: Thu Jul 8 02:38:13 2010 -0700
dixfonts: Deobfuscate GC ops calls.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index e22eabe..ccb4627 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1170,6 +1170,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
FontPathElementPtr fpe;
GC *origGC = NULL;
+ int itemSize = c->reqType == X_PolyText8 ? 1 : 2;
if (client->clientGone)
{
@@ -1255,10 +1256,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
val.ptr = pFont;
ChangeGC(NullClient, c->pGC, GCFont, &val);
ValidateGC(c->pDraw, c->pGC);
- if (c->reqType == X_PolyText8)
- c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
- else
- c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
}
/* Undo the refcnt++ we performed when going to sleep */
@@ -1270,7 +1267,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
else /* print a string */
{
unsigned char *pNextElt;
- pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize;
+ pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
if ( pNextElt > c->endReq)
{
err = BadLength;
@@ -1283,7 +1280,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
}
if (c->pDraw)
{
- lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize,
+ lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize,
c->pElt + TextEltHeader);
}
else lgerr = Successful;
@@ -1381,8 +1378,12 @@ doPolyText(ClientPtr client, PTclosurePtr c)
if (c->pDraw)
{
c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
- c->xorg = (* c->polyText)(c->pDraw, c->pGC, c->xorg, c->yorg,
- *c->pElt, c->pElt + TextEltHeader);
+ if (c->reqType == X_PolyText8)
+ c->xorg = (* c->pGC->ops->PolyText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ *c->pElt, (char *) (c->pElt + TextEltHeader));
+ else
+ c->xorg = (* c->pGC->ops->PolyText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ *c->pElt, (unsigned short *) (c->pElt + TextEltHeader));
}
c->pElt = pNextElt;
}
@@ -1442,16 +1443,7 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
local_closure.pDraw = pDraw;
local_closure.xorg = xorg;
local_closure.yorg = yorg;
- if ((local_closure.reqType = reqType) == X_PolyText8)
- {
- local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
- local_closure.itemSize = 1;
- }
- else
- {
- local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
- local_closure.itemSize = 2;
- }
+ local_closure.reqType = reqType;
local_closure.pGC = pGC;
local_closure.did = did;
local_closure.err = Success;
@@ -1469,6 +1461,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
{
int err = Success, lgerr; /* err is in X error, not font error, space */
FontPathElementPtr fpe;
+ int itemSize = c->reqType == X_ImageText8 ? 1 : 2;
if (client->clientGone)
{
@@ -1493,7 +1486,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
}
}
- lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
+ lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data);
if (lgerr == Suspended)
{
if (!ClientIsAsleep(client)) {
@@ -1515,14 +1508,14 @@ doImageText(ClientPtr client, ITclosurePtr c)
*new_closure = *c;
c = new_closure;
- data = malloc(c->nChars * c->itemSize);
+ data = malloc(c->nChars * itemSize);
if (!data)
{
free(c);
err = BadAlloc;
goto bail;
}
- memmove(data, c->data, c->nChars * c->itemSize);
+ memmove(data, c->data, c->nChars * itemSize);
c->data = data;
pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
@@ -1562,8 +1555,12 @@ doImageText(ClientPtr client, ITclosurePtr c)
}
if (c->pDraw)
{
- (* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg,
- c->nChars, c->data);
+ if (c->reqType == X_ImageText8)
+ (* c->pGC->ops->ImageText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, (char *) c->data);
+ else
+ (* c->pGC->ops->ImageText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, (unsigned short *) c->data);
}
bail:
@@ -1601,16 +1598,7 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
local_closure.data = data;
local_closure.xorg = xorg;
local_closure.yorg = yorg;
- if ((local_closure.reqType = reqType) == X_ImageText8)
- {
- local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
- local_closure.itemSize = 1;
- }
- else
- {
- local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
- local_closure.itemSize = 2;
- }
+ local_closure.reqType = reqType;
local_closure.did = did;
(void) doImageText(client, &local_closure);
diff --git a/include/closestr.h b/include/closestr.h
index 7ca2613..ab18ef9 100644
--- a/include/closestr.h
+++ b/include/closestr.h
@@ -97,16 +97,6 @@ typedef struct _LFclosure {
/* PolyText */
-typedef
- int (* PolyTextPtr)(
- DrawablePtr /* pDraw */,
- GCPtr /* pGC */,
- int /* x */,
- int /* y */,
- int /* count */,
- void * /* chars or shorts */
- );
-
typedef struct _PTclosure {
ClientPtr client;
DrawablePtr pDraw;
@@ -117,24 +107,12 @@ typedef struct _PTclosure {
int xorg;
int yorg;
CARD8 reqType;
- PolyTextPtr polyText;
- int itemSize;
XID did;
int err;
} PTclosureRec;
/* ImageText */
-typedef
- void (* ImageTextPtr)(
- DrawablePtr /* pDraw */,
- GCPtr /* pGC */,
- int /* x */,
- int /* y */,
- int /* count */,
- void * /* chars or shorts */
- );
-
typedef struct _ITclosure {
ClientPtr client;
DrawablePtr pDraw;
@@ -144,8 +122,6 @@ typedef struct _ITclosure {
int xorg;
int yorg;
CARD8 reqType;
- ImageTextPtr imageText;
- int itemSize;
XID did;
} ITclosureRec;
#endif /* CLOSESTR_H */
commit bbbf795e6b1ac048ea17164ba1089055cfe4306d
Author: Jamey Sharp <jamey at minilop.net>
Date: Sun May 23 17:15:43 2010 -0700
Delete redundant GC initializations.
When a GC is allocated, it is zeroed, including all storage requested
with dixRegisterPrivateKey. So CreateGC hooks don't need to initialize
anything to zero.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 45e981b..b27a030 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -64,19 +64,13 @@ const GCOps fbGCOps = {
Bool
fbCreateGC(GCPtr pGC)
{
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
-
pGC->ops = (GCOps *) &fbGCOps;
pGC->funcs = (GCFuncs *) &fbGCFuncs;
/* fb wants to translate before scan conversion */
pGC->miTranslate = 1;
+ pGC->fExpose = 1;
- fbGetRotatedPixmap(pGC) = 0;
- fbGetExpose(pGC) = 1;
- fbGetFreeCompClip(pGC) = 0;
- fbGetCompositeClip(pGC) = 0;
fbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth);
return TRUE;
}
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index fb24387..44d50e6 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -48,11 +48,6 @@ XAACreateGC(GCPtr pGC)
pGCPriv->wrapOps = NULL;
pGCPriv->wrapFuncs = pGC->funcs;
pGCPriv->XAAOps = &XAAFallbackOps;
- pGCPriv->flags = 0;
- pGCPriv->DashLength = 0;
- pGCPriv->DashPattern = NULL;
- pGCPriv->changes = 0;
- /* initialize any other private fields here */
pGC->funcs = &XAAGCFuncs;
}
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 407cc77..7968b4f 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -73,9 +73,6 @@ static GCOps xnestOps = {
Bool
xnestCreateGC(GCPtr pGC)
{
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = NULL;
-
pGC->funcs = &xnestFuncs;
pGC->ops = &xnestOps;
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index 196b5b5..e351c50 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -137,11 +137,6 @@ winCreateGCNativeGDI (GCPtr pGC)
pGC->depth);
#endif
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
- pGC->freeCompClip = FALSE;
- pGC->pCompositeClip = 0;
-
pGC->ops = (GCOps *) &winGCOps;
pGC->funcs = (GCFuncs *) &winGCFuncs;
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 58816c9..3da3bc3 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -325,7 +325,6 @@ cwCreateGC(GCPtr pGC)
ScreenPtr pScreen = pGC->pScreen;
Bool ret;
- memset(pPriv, 0, sizeof(cwGCRec));
SCREEN_PROLOGUE(pScreen, CreateGC);
if ( (ret = (*pScreen->CreateGC)(pGC)) )
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 2b7e5f2..21cbb78 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -446,7 +446,6 @@ damageCreateGC(GCPtr pGC)
damageGCPriv(pGC);
Bool ret;
- pGC->pCompositeClip = 0;
unwrap (pScrPriv, pScreen, CreateGC);
if((ret = (*pScreen->CreateGC) (pGC))) {
pGCPriv->ops = NULL;
commit 3288232f3d2a0239944bd856101c2d16c713ef40
Author: Jamey Sharp <jamey at minilop.net>
Date: Sun Jun 13 18:10:38 2010 -0700
Delete xaaWrapper.
This was part of "An experimental pseudocolor emulation layer. Not fully
completed, currently only works for 16bpp." Only neomagic tried to use
it, and that was neutered by the removal of the fbpseudocolor portion of
that emulation layer; the rest is easily removed.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index 700879c..6ca368e 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -178,7 +178,6 @@ cat > sdksyms.c << EOF
#include "xaa.h"
#include "xaalocal.h"
#include "xaarop.h"
-#include "xaaWrapper.h"
*/
diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am
index e9f5e68..4ba1f78 100644
--- a/hw/xfree86/xaa/Makefile.am
+++ b/hw/xfree86/xaa/Makefile.am
@@ -17,7 +17,7 @@ module_LTLIBRARIES = libxaa.la
libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \
xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \
- xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c xaaWrapper.c \
+ xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c \
xaaRect.c xaaLineMisc.c xaaBitOrder.c \
xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \
xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \
@@ -64,7 +64,7 @@ DISTCLEANFILES = $(POLYSEG) \
$(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \
$(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED)
-sdk_HEADERS = xaa.h xaalocal.h xaarop.h xaaWrapper.h
+sdk_HEADERS = xaa.h xaalocal.h xaarop.h
EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \
xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \
XAA.HOWTO
diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c
deleted file mode 100644
index e91bac0..0000000
--- a/hw/xfree86/xaa/xaaWrapper.c
+++ /dev/null
@@ -1,477 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "glyphstr.h"
-#include "window.h"
-#include "windowstr.h"
-#include "picture.h"
-#include "picturestr.h"
-#include "colormapst.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaaWrapper.h"
-
-void XAASync(ScreenPtr pScreen);
-
-/* #include "render.h" */
-
-#if 1
-#define COND(pDraw) \
- ((pDraw)->depth \
- != (xaaWrapperGetScrPriv(((DrawablePtr)(pDraw))->pScreen))->depth)
-#else
-#define COND(pDraw) 1
-#endif
-
-static Bool xaaWrapperCreateGC(GCPtr pGC);
-static void xaaWrapperValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
-static void xaaWrapperDestroyGC(GCPtr pGC);
-static void xaaWrapperChangeGC (GCPtr pGC, unsigned long mask);
-static void xaaWrapperCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void xaaWrapperChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects);
-
-static void xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-static void xaaWrapperDestroyClip(GCPtr pGC);
-
-
-static void
-xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
-static void
-xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs);
-
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateScreenResourcesProcPtr CreateScreenResources;
- CreateWindowProcPtr CreateWindow;
- CopyWindowProcPtr CopyWindow;
- WindowExposuresProcPtr WindowExposures;
- CreateGCProcPtr CreateGC;
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- UninstallColormapProcPtr UninstallColormap;
- ListInstalledColormapsProcPtr ListInstalledColormaps;
- StoreColorsProcPtr StoreColors;
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
-
- CloseScreenProcPtr wrapCloseScreen;
- CreateScreenResourcesProcPtr wrapCreateScreenResources;
- CreateWindowProcPtr wrapCreateWindow;
- CopyWindowProcPtr wrapCopyWindow;
- WindowExposuresProcPtr wrapWindowExposures;
- CreateGCProcPtr wrapCreateGC;
- CreateColormapProcPtr wrapCreateColormap;
- DestroyColormapProcPtr wrapDestroyColormap;
- InstallColormapProcPtr wrapInstallColormap;
- UninstallColormapProcPtr wrapUninstallColormap;
- ListInstalledColormapsProcPtr wrapListInstalledColormaps;
- StoreColorsProcPtr wrapStoreColors;
- CompositeProcPtr wrapComposite;
- GlyphsProcPtr wrapGlyphs;
- int depth;
-} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
-
-#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
- dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
-#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
-
-#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
-}
-
-#define cond_wrap(priv,cond,real,mem,wrapmem,func) {\
- if (COND(cond)) \
- priv->wrapmem = real->mem; \
- else \
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define cond_unwrap(priv,cond,real,mem,wrapmem) {\
- if (COND(cond)) \
- real->mem = priv->wrapmem; \
- else \
- real->mem = priv->mem; \
-}
-
-#define get(priv,real,func,wrap) \
- priv->wrap = real->func;
-
-typedef struct _xaaWrapperGCPriv {
- GCOps *ops;
- Bool wrap;
- GCFuncs *funcs;
- GCOps *wrapops;
-} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
-
-#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
-#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
-
-
-static DevPrivateKeyRec xaaWrapperScrPrivateKeyRec;
-#define xaaWrapperScrPrivateKey (&xaaWrapperScrPrivateKeyRec)
-static DevPrivateKeyRec xaaWrapperGCPrivateKeyRec;
-#define xaaWrapperGCPrivateKey (&xaaWrapperGCPrivateKeyRec)
-
-static Bool
-xaaWrapperCreateScreenResources(ScreenPtr pScreen)
-{
- xaaWrapperScrPriv(pScreen);
- Bool ret;
-
- unwrap (pScrPriv,pScreen, CreateScreenResources);
- ret = pScreen->CreateScreenResources(pScreen);
- wrap(pScrPriv,pScreen,CreateScreenResources,xaaWrapperCreateScreenResources);
- return ret;
-}
-
-static Bool
-xaaWrapperCloseScreen (int iScreen, ScreenPtr pScreen)
-{
- xaaWrapperScrPriv(pScreen);
- Bool ret;
-
- unwrap (pScrPriv,pScreen, CloseScreen);
- ret = pScreen->CloseScreen(iScreen,pScreen);
- return TRUE;
-}
-
-static Bool
-xaaWrapperCreateWindow(WindowPtr pWin)
-{
- xaaWrapperScrPriv(pWin->drawable.pScreen);
- Bool ret;
-
- cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- CreateWindow, wrapCreateWindow);
- ret = pWin->drawable.pScreen->CreateWindow(pWin);
- cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen, CreateWindow,
- wrapCreateWindow, xaaWrapperCreateWindow);
-
- return ret;
-}
-
-static void
-xaaWrapperCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, pScreen, CopyWindow);
-#if 0
- if (COND(&pWin->drawable))
- pWin->drawable.pScreen->CopyWindow = pScrPriv->wrapCopyWindow;
-#endif
- pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
- wrap(pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
-}
-
-static void
-xaaWrapperWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed)
-{
- xaaWrapperScrPriv(pWin->drawable.pScreen);
-
- cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- WindowExposures, wrapWindowExposures);
- pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed);
- cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- WindowExposures, wrapWindowExposures, xaaWrapperWindowExposures);
-}
-
-static Bool
-xaaWrapperCreateColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- Bool ret;
- unwrap(pScrPriv,pmap->pScreen, CreateColormap);
- ret = pmap->pScreen->CreateColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,CreateColormap,xaaWrapperCreateColormap);
-
- return ret;
-}
-
-static void
-xaaWrapperDestroyColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- unwrap(pScrPriv,pmap->pScreen, DestroyColormap);
- pmap->pScreen->DestroyColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,DestroyColormap,xaaWrapperDestroyColormap);
-}
-
-static void
-xaaWrapperStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- unwrap(pScrPriv,pmap->pScreen, StoreColors);
- pmap->pScreen->StoreColors(pmap,nColors,pColors);
- wrap(pScrPriv,pmap->pScreen,StoreColors,xaaWrapperStoreColors);
-}
-
-static void
-xaaWrapperInstallColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
-
- unwrap(pScrPriv,pmap->pScreen, InstallColormap);
- pmap->pScreen->InstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,InstallColormap,xaaWrapperInstallColormap);
-}
-
-static void
-xaaWrapperUninstallColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
-
- unwrap(pScrPriv,pmap->pScreen, UninstallColormap);
- pmap->pScreen->UninstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,UninstallColormap,xaaWrapperUninstallColormap);
-}
-
-static int
-xaaWrapperListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
-{
- int n;
- xaaWrapperScrPriv(pScreen);
-
- unwrap(pScrPriv,pScreen, ListInstalledColormaps);
- n = pScreen->ListInstalledColormaps(pScreen, pCmapIds);
- wrap (pScrPriv,pScreen,ListInstalledColormaps,xaaWrapperListInstalledColormaps);
- return n;
-}
-
-Bool
-xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *func)
-{
- Bool ret;
- xaaWrapperScrPrivPtr pScrPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- if (!dixRegisterPrivateKey(&xaaWrapperGCPrivateKeyRec, PRIVATE_GC, sizeof(xaaWrapperGCPrivRec)))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&xaaWrapperScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- pScrPriv = (xaaWrapperScrPrivPtr) malloc(sizeof (xaaWrapperScrPrivRec));
- if (!pScrPriv)
- return FALSE;
-
- get (pScrPriv, pScreen, CloseScreen, wrapCloseScreen);
- get (pScrPriv, pScreen, CreateScreenResources, wrapCreateScreenResources);
- get (pScrPriv, pScreen, CreateWindow, wrapCreateWindow);
- get (pScrPriv, pScreen, CopyWindow, wrapCopyWindow);
- get (pScrPriv, pScreen, WindowExposures, wrapWindowExposures);
- get (pScrPriv, pScreen, CreateGC, wrapCreateGC);
- get (pScrPriv, pScreen, CreateColormap, wrapCreateColormap);
- get (pScrPriv, pScreen, DestroyColormap, wrapDestroyColormap);
- get (pScrPriv, pScreen, InstallColormap, wrapInstallColormap);
- get (pScrPriv, pScreen, UninstallColormap, wrapUninstallColormap);
- get (pScrPriv, pScreen, ListInstalledColormaps, wrapListInstalledColormaps);
- get (pScrPriv, pScreen, StoreColors, wrapStoreColors);
- if (ps) {
- get (pScrPriv, ps, Glyphs, wrapGlyphs);
- get (pScrPriv, ps, Composite, wrapComposite);
- }
- if (!(ret = XAAInit(pScreen,infoPtr)))
- return FALSE;
-
- wrap (pScrPriv, pScreen, CloseScreen, xaaWrapperCloseScreen);
- wrap (pScrPriv, pScreen, CreateScreenResources,
- xaaWrapperCreateScreenResources);
- wrap (pScrPriv, pScreen, CreateWindow, xaaWrapperCreateWindow);
- wrap (pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
- wrap (pScrPriv, pScreen, WindowExposures, xaaWrapperWindowExposures);
- wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
- wrap (pScrPriv, pScreen, CreateColormap, xaaWrapperCreateColormap);
- wrap (pScrPriv, pScreen, DestroyColormap, xaaWrapperDestroyColormap);
- wrap (pScrPriv, pScreen, InstallColormap, xaaWrapperInstallColormap);
- wrap (pScrPriv, pScreen, UninstallColormap, xaaWrapperUninstallColormap);
- wrap (pScrPriv, pScreen, ListInstalledColormaps,
- xaaWrapperListInstalledColormaps);
- wrap (pScrPriv, pScreen, StoreColors, xaaWrapperStoreColors);
-
- if (ps) {
- wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
- wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
- }
- pScrPriv->depth = depth;
- dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
-
- *func = XAASync;
-
- return ret;
-}
-
-GCFuncs xaaWrapperGCFuncs = {
- xaaWrapperValidateGC, xaaWrapperChangeGC, xaaWrapperCopyGC,
- xaaWrapperDestroyGC, xaaWrapperChangeClip, xaaWrapperDestroyClip,
- xaaWrapperCopyClip
-};
-
-#define XAAWRAPPER_GC_FUNC_PROLOGUE(pGC) \
- xaaWrapperGCPriv(pGC); \
- unwrap(pGCPriv, pGC, funcs); \
- if (pGCPriv->wrap) unwrap(pGCPriv, pGC, ops)
-
-#define XAAWRAPPER_GC_FUNC_EPILOGUE(pGC) \
- wrap(pGCPriv, pGC, funcs, &xaaWrapperGCFuncs); \
- if (pGCPriv->wrap) wrap(pGCPriv, pGC, ops, pGCPriv->wrapops)
-
-static Bool
-xaaWrapperCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- xaaWrapperScrPriv(pScreen);
- xaaWrapperGCPriv(pGC);
- Bool ret;
-
- unwrap (pScrPriv, pScreen, CreateGC);
- if((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->wrap = FALSE;
- pGCPriv->funcs = pGC->funcs;
- pGCPriv->wrapops = pGC->ops;
- pGC->funcs = &xaaWrapperGCFuncs;
- }
- wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
-
- return ret;
-}
-
-static void
-xaaWrapperValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-
- if(COND(pDraw))
- pGCPriv->wrap = TRUE;
-
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperDestroyGC(GCPtr pGC)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGCDst);
-}
-
-static void
-xaaWrapperChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-xaaWrapperDestroyClip(GCPtr pGC)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, ps, Composite);
- (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
- wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
-}
-
-
-static void
-xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, ps, Glyphs);
- (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
- nlist, list, glyphs);
- wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
-
-}
-
-void
-XAASync(ScreenPtr pScreen)
-{
- XAAScreenPtr pScreenPriv = (XAAScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
- XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
-
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
-}
diff --git a/hw/xfree86/xaa/xaaWrapper.h b/hw/xfree86/xaa/xaaWrapper.h
deleted file mode 100644
index f554741..0000000
--- a/hw/xfree86/xaa/xaaWrapper.h
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#ifndef _XAA_WRAPPER_H
-# define _XAA_WRAPPER_H
-
-typedef void (*SyncFunc)(ScreenPtr);
-
-extern _X_EXPORT Bool xaaSetupWrapper(ScreenPtr pScreen,
- XAAInfoRecPtr infoPtr, int depth, SyncFunc *func);
-
-#endif
commit f856dcdc3a7b635dd94d3dac387ddec952e4880b
Author: Jamey Sharp <jamey at minilop.net>
Date: Sat Jun 12 08:42:31 2010 -0700
Delete unused lastWinOrg field from GCs.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
diff --git a/dix/gc.c b/dix/gc.c
index 6da243e..83bb524 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -527,8 +527,6 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
pGC->numInDashList = 2;
pGC->dash = DefaultDash;
pGC->dashOffset = 0;
- pGC->lastWinOrg.x = 0;
- pGC->lastWinOrg.y = 0;
/* use the default font and stipple */
pGC->font = defaultFont;
@@ -841,8 +839,6 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
pGC->dashOffset = 0;
pGC->numInDashList = 2;
pGC->dash = DefaultDash;
- pGC->lastWinOrg.x = 0;
- pGC->lastWinOrg.y = 0;
/* scratch GCs in the GCperDepth pool start off unused */
pGC->scratch_inuse = FALSE;
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 2568698..45e981b 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -199,9 +199,6 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
FbBits mask;
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
-
/*
* if the client clip is different or moved OR the subwindowMode has
* changed OR the window's clip has changed since the last validation
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 2761583..407cc77 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -92,8 +92,6 @@ xnestCreateGC(GCPtr pGC)
void
xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
}
void
diff --git a/include/gcstruct.h b/include/gcstruct.h
index b6d71a9..4fea02c 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -303,7 +303,6 @@ typedef struct _GC {
DDXPointRec patOrg; /* origin for (tile, stipple) */
struct _Font *font;
DDXPointRec clipOrg;
- DDXPointRec lastWinOrg; /* position of window last validated */
pointer clientClip;
unsigned long stateChanges; /* masked with GC_<kind> */
unsigned long serialNumber;
commit b2184024361717358e35a56b084c4a71cbc29234
Author: Jamey Sharp <jamey at minilop.net>
Date: Sat Jun 12 16:20:00 2010 -0700
Delete unused devPrivate field from GCFuncs and GCOps.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 4f46059..becf4a9 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -53,7 +53,6 @@ static GCOps VGAarbiterGCOps = {
VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16,
VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt,
VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels,
- {NULL} /* devPrivate */
};
static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = {
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 344f1ab..0af53d1 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -1730,6 +1730,5 @@ GCOps ShadowGCOps = {
ShadowPolyText16, ShadowImageText8,
ShadowImageText16, ShadowImageGlyphBlt,
ShadowPolyGlyphBlt, ShadowPushPixels,
- {NULL} /* devPrivate */
};
diff --git a/hw/xfree86/xaa/xaaFallback.c b/hw/xfree86/xaa/xaaFallback.c
index 7ab4031..deeadbf 100644
--- a/hw/xfree86/xaa/xaaFallback.c
+++ b/hw/xfree86/xaa/xaaFallback.c
@@ -343,7 +343,6 @@ GCOps XAAFallbackOps = {
XAAPolyText16Fallback, XAAImageText8Fallback,
XAAImageText16Fallback, XAAImageGlyphBltFallback,
XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
- {NULL} /* devPrivate */
};
GCOps *XAAGetFallbackOps(void)
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index fbef88d..fb24387 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -651,5 +651,4 @@ GCOps XAAPixmapOps = {
XAAPolyText16Pixmap, XAAImageText8Pixmap,
XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
- {NULL} /* devPrivate */
};
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 3f70ead..b6d71a9 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -95,7 +95,6 @@ typedef struct _GCFuncs {
void (* CopyClip)(
GCPtr /*pgcDst*/,
GCPtr /*pgcSrc*/);
- DevUnion devPrivate;
} GCFuncs;
/*
@@ -264,8 +263,6 @@ typedef struct _GCOps {
int /*h*/,
int /*x*/,
int /*y*/);
-
- DevUnion devPrivate;
} GCOps;
/* there is padding in the bit fields because the Sun compiler doesn't
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index b809cca..2b7e5f2 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1757,7 +1757,6 @@ static GCOps damageGCOps = {
damagePolyText16, damageImageText8,
damageImageText16, damageImageGlyphBlt,
damagePolyGlyphBlt, damagePushPixels,
- {NULL} /* devPrivate */
};
static void
commit 139aa6e74227f0fe52cd8dccf1d563664103aaba
Author: Jamey Sharp <jamey at minilop.net>
Date: Sun Jun 13 18:57:08 2010 -0700
damage: Delete NOTUSED block--it was never not NOTUSED.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index e0e96f2..b809cca 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -458,28 +458,6 @@ damageCreateGC(GCPtr pGC)
return ret;
}
-#ifdef NOTUSED
-static void
-damageWrapGC (GCPtr pGC)
-{
- damageGCPriv(pGC);
-
- pGCPriv->ops = NULL;
- pGCPriv->funcs = pGC->funcs;
- pGC->funcs = &damageGCFuncs;
-}
-
-static void
-damageUnwrapGC (GCPtr pGC)
-{
- damageGCPriv(pGC);
-
- pGC->funcs = pGCPriv->funcs;
- if (pGCPriv->ops)
- pGC->ops = pGCPriv->ops;
-}
-#endif
-
#define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \
damageGCPriv(pGC); \
GCFuncs *oldFuncs = pGC->funcs; \
commit 5ff9e58bef668c1279c5e253795711a1e118aaa1
Author: Jamey Sharp <jamey at minilop.net>
Date: Sat Jun 12 08:51:04 2010 -0700
fb: Delete unused oneRect private field.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
diff --git a/fb/fb.h b/fb/fb.h
index a06f98b..c290ebf 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -666,7 +666,6 @@ typedef struct {
FbBits bgand, bgxor; /* for stipples */
FbBits fg, bg, pm; /* expanded and filled */
unsigned int dashLength; /* total of all dash elements */
- unsigned char oneRect; /* clip list is single rectangle */
unsigned char evenStipple; /* stipple is even */
unsigned char bpp; /* current drawable bpp */
} FbGCPrivRec, *FbGCPrivPtr;
diff --git a/fb/fbgc.c b/fb/fbgc.c
index e3e9236..2568698 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -213,7 +213,6 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
)
{
miComputeCompositeClip (pGC, pDrawable);
- pPriv->oneRect = RegionNumRects(fbGetCompositeClip(pGC)) == 1;
}
#ifdef FB_24_32BIT
commit e99bbfa0a24ec038b88e81881133a676bf63580e
Author: Jamey Sharp <jamey at minilop.net>
Date: Tue May 25 13:50:11 2010 -0700
dmx: Delete '#undef Xmalloc' and friends.
Nothing in dmx uses these names any more, and it builds cleanly without
trying to undef them.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index b0652df..a9744e1 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -38,11 +38,6 @@
#include "dmxfont.h"
#include "dmxsync.h"
-#undef Xmalloc
-#undef Xcalloc
-#undef Xrealloc
-#undef Xfree
-
#include "glxserver.h"
#include <GL/glxtokens.h>
#include "g_disptab.h"
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index a0e8bea..4cbac66 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -35,11 +35,6 @@
#include "dmx.h"
#include "dmxlog.h"
-#undef Xmalloc
-#undef Xcalloc
-#undef Xrealloc
-#undef Xfree
-
#include "glxserver.h"
#include <windowstr.h>
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index a7ed574..4c473ff 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -39,11 +39,6 @@
#include "dmxfont.h"
#include "dmxcb.h"
-#undef Xmalloc
-#undef Xcalloc
-#undef Xrealloc
-#undef Xfree
-
#include "glxserver.h"
#include "glxext.h"
#include "g_disptab.h"
diff --git a/hw/dmx/glxProxy/glxvendor.c b/hw/dmx/glxProxy/glxvendor.c
index 5e0fb88..7ba727d 100644
--- a/hw/dmx/glxProxy/glxvendor.c
+++ b/hw/dmx/glxProxy/glxvendor.c
@@ -38,11 +38,6 @@
#include "dmxpixmap.h"
#include "dmxfont.h"
-#undef Xmalloc
-#undef Xcalloc
-#undef Xrealloc
-#undef Xfree
-
#include "glxserver.h"
#include "glxext.h"
#include "g_disptab.h"
commit b5217bfdca67ef2c5323838afcfcd89eba8899d5
Author: Jamey Sharp <jamey at minilop.net>
Date: Tue May 25 13:28:32 2010 -0700
dmx: __glXMalloc -> malloc, etc.
Kristian made equivalent edits to the reference GLX implementation in
2006, with commit 2d2d38d17cc2558f8a41166a4a1578bc4c663c37.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 88cf901..b0652df 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -144,7 +144,7 @@ static int CreateContext(__GLXclientState *cl,
/*
** Allocate memory for the new context
*/
- glxc = __glXCalloc(1, sizeof(__GLXcontext));
+ glxc = calloc(1, sizeof(__GLXcontext));
if (!glxc) {
return BadAlloc;
}
@@ -156,7 +156,7 @@ static int CreateContext(__GLXclientState *cl,
glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
if (!glxc->pFBConfig) {
client->errorValue = fbconfigId;
- __glXFree( glxc );
+ free( glxc );
return BadValue;
}
visual = glxc->pFBConfig->associatedVisualId;
@@ -177,7 +177,7 @@ static int CreateContext(__GLXclientState *cl,
}
if (i == pScreen->numVisuals) {
client->errorValue = visual;
- __glXFree( glxc );
+ free( glxc );
return BadValue;
}
@@ -192,7 +192,7 @@ static int CreateContext(__GLXclientState *cl,
** Visual not support on this screen by this OpenGL implementation.
*/
client->errorValue = visual;
- __glXFree( glxc );
+ free( glxc );
return BadValue;
}
@@ -203,7 +203,7 @@ static int CreateContext(__GLXclientState *cl,
/*
* visual does not have an FBConfig ???
client->errorValue = visual;
- __glXFree( glxc );
+ free( glxc );
return BadValue;
*/
}
@@ -223,11 +223,11 @@ static int CreateContext(__GLXclientState *cl,
* allocate memory for back-end servers info
*/
num_be_screens = to_screen - from_screen + 1;
- glxc->real_ids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens);
+ glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_ids) {
return BadAlloc;
}
- glxc->real_vids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens);
+ glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_vids) {
return BadAlloc;
}
@@ -252,9 +252,9 @@ static int CreateContext(__GLXclientState *cl,
if (!be_vid) {
/* visual is not supported on the back-end server */
- __glXFree( glxc->real_ids );
- __glXFree( glxc->real_vids );
- __glXFree( glxc );
+ free( glxc->real_ids );
+ free( glxc->real_vids );
+ free( glxc );
return BadValue;
}
}
@@ -346,9 +346,9 @@ static int CreateContext(__GLXclientState *cl,
** Register this context as a resource.
*/
if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
- __glXFree( glxc->real_ids );
- __glXFree( glxc->real_vids );
- __glXFree( glxc );
+ free( glxc->real_ids );
+ free( glxc->real_vids );
+ free( glxc );
client->errorValue = gcId;
return BadAlloc;
}
@@ -585,16 +585,16 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawableP
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
- table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) __glXMalloc(sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) __glXMalloc(screenInfo.numScreens *sizeof(GLXContextTag));
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
+ cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag));
} else {
- table = (__GLXcontext **) __glXRealloc(table,
+ table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) __glXRealloc(
+ cl->currentDrawables = (DrawablePtr *) realloc(
cl->currentDrawables ,
(num+1)*sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) __glXRealloc(cl->be_currentCTag,
+ cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag,
(num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
}
table[num] = glxc;
@@ -1721,13 +1721,13 @@ static int CreateGLXPixmap(__GLXclientState *cl,
pGlxVisual = NULL;
}
- pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap));
+ pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
if (!pGlxPixmap) {
return BadAlloc;
}
- pGlxPixmap->be_xids = (XID *) __glXMalloc(sizeof(XID) * screenInfo.numScreens);
+ pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
if (!pGlxPixmap->be_xids) {
- __glXFree( pGlxPixmap );
+ free( pGlxPixmap );
return BadAlloc;
}
@@ -1832,7 +1832,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
}
else {
client->errorValue = ( visual ? visual : fbconfigId );
- __glXFree( pGlxPixmap );
+ free( pGlxPixmap );
return BadValue;
}
@@ -1840,7 +1840,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
}
if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
- __glXFree( pGlxPixmap );
+ free( pGlxPixmap );
return BadAlloc;
}
@@ -2570,7 +2570,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions) free(cl->GLClientextensions);
buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf);
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 960c60d..44f1c15 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -702,9 +702,9 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < hdr->length) {
if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) __glXMalloc(hdr->length);
+ cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
} else {
- cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, hdr->length);
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
}
if (!cl->largeCmdBuf) {
cl->largeCmdRequestsTotal = 0;
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index 36a79ef..a8fc0a8 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex)
Display **keep_be_displays;
int i;
- if (cl->returnBuf) __glXFree(cl->returnBuf);
- if (cl->currentContexts) __glXFree(cl->currentContexts);
- if (cl->currentDrawables) __glXFree(cl->currentDrawables);
- if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
+ if (cl->returnBuf) free(cl->returnBuf);
+ if (cl->currentContexts) free(cl->currentContexts);
+ if (cl->currentDrawables) free(cl->currentDrawables);
+ if (cl->largeCmdBuf) free(cl->largeCmdBuf);
for (i=0; i< screenInfo.numScreens; i++) {
if (cl->be_displays[i])
@@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex)
*/
cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions) free(cl->GLClientextensions);
memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
}
@@ -167,8 +167,8 @@ void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap )
** only if it's zero.
*/
(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(pGlxPixmap->be_xids);
- __glXFree(pGlxPixmap);
+ free(pGlxPixmap->be_xids);
+ free(pGlxPixmap);
}
}
@@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{
if (cx->idExists || cx->isCurrent) return GL_FALSE;
- if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
- if (cx->selectBuf) __glXFree(cx->selectBuf);
- if (cx->real_ids) __glXFree(cx->real_ids);
- if (cx->real_vids) __glXFree(cx->real_vids);
+ if (cx->feedbackBuf) free(cx->feedbackBuf);
+ if (cx->selectBuf) free(cx->selectBuf);
+ if (cx->real_ids) free(cx->real_ids);
+ if (cx->real_vids) free(cx->real_vids);
if (cx->pGlxPixmap) {
/*
@@ -263,7 +263,7 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
cx->pGlxReadWindow = 0;
}
- __glXFree(cx);
+ free(cx);
if (cx == __glXLastContext) {
__glXFlushContextCache();
@@ -387,15 +387,15 @@ static int __glXDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = __glXCalloc(1, sizeof(__GLXclientState));
+ cl = calloc(1, sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *));
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
if (!cl->be_displays) {
- __glXFree( cl );
+ free( cl );
return BadAlloc;
}
}
@@ -439,15 +439,15 @@ static int __glXSwapDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = __glXCalloc(1, sizeof(__GLXclientState));
+ cl = calloc(1, sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *));
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
if (!cl->be_displays) {
- __glXFree( cl );
+ free( cl );
return BadAlloc;
}
}
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
index 18fd43a..c519d14 100644
--- a/hw/dmx/glxProxy/glxutil.c
+++ b/hw/dmx/glxProxy/glxutil.c
@@ -29,81 +29,6 @@
*/
#include "glxserver.h"
-#include <GL/glxtokens.h>
-#include <pixmapstr.h>
-#include <windowstr.h>
#include "glxutil.h"
-#include <stdlib.h>
-
-/************************************************************************/
void __glXNop(void) {}
-
-/************************************************************************/
-
-/* Memory Allocation for GLX */
-
-void *
-__glXMalloc(size_t size)
-{
- void *addr;
-
- if (size == 0) {
- return NULL;
- }
- addr = malloc(size);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- return addr;
-}
-
-void *
-__glXCalloc(size_t numElements, size_t elementSize)
-{
- void *addr;
- size_t size;
-
- if ((numElements == 0) || (elementSize == 0)) {
- return NULL;
- }
- addr = calloc(numElements, elementSize);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- return addr;
-}
-
-void *
-__glXRealloc(void *addr, size_t newSize)
-{
- void *newAddr;
-
- if (addr) {
- if (newSize == 0) {
- free(addr);
- return NULL;
- } else {
- newAddr = realloc(addr, newSize);
- }
- } else {
- if (newSize == 0) {
- return NULL;
- } else {
- newAddr = malloc(newSize);
- }
- }
- if (newAddr == NULL) {
- return NULL; /* XXX: out of memory */
- }
-
- return newAddr;
-}
-
-void
-__glXFree(void *addr)
-{
- free(addr);
-}
diff --git a/hw/dmx/glxProxy/glxutil.h b/hw/dmx/glxProxy/glxutil.h
index 6487ca7..5458212 100644
--- a/hw/dmx/glxProxy/glxutil.h
+++ b/hw/dmx/glxProxy/glxutil.h
@@ -33,12 +33,6 @@
extern void __glXNop(void);
-/* memory management */
-extern void *__glXMalloc(size_t size);
-extern void *__glXCalloc(size_t numElements, size_t elementSize);
-extern void *__glXRealloc(void *addr, size_t newSize);
-extern void __glXFree(void *ptr);
-
/* context helper routines */
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag);
commit a715de7f11afeda7798f0882148a94d4db2291e6
Author: Jamey Sharp <jamey at minilop.net>
Date: Tue May 25 13:10:05 2010 -0700
dmx: Delete unused GLX visual matching code.
Kristian deleted this API from the rest of the server in 2007, in commit
7d74690536b64f7b8e8036507ab7790807349c50.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 0755532..74b3582 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -69,12 +69,6 @@
#include "dmx_glxvisuals.h"
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
-
-extern void GlxSetVisualConfigs(
- int nconfigs,
- __GLXvisualConfig *configs,
- void **configprivs
-);
#endif /* GLXEXT */
/* Global variables available to all Xserver/hw/dmx routines. */
@@ -768,9 +762,6 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
}
}
- /* Hand out the glx configs to glx extension */
- GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs);
-
XFlush(dmxScreen->beDisplay);
}
}
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index 4adfbff..36a79ef 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -367,46 +367,6 @@ Bool __glXCoreType(void)
/************************************************************************/
-void GlxSetVisualConfigs(int nconfigs,
- __GLXvisualConfig *configs, void **privates)
-{
- glxSetVisualConfigs(nconfigs, configs, privates);
-}
-
-static miInitVisualsProcPtr saveInitVisualsProc;
-
-Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
- int *nvisualp, int *ndepthp,
- int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB,
- int preferredVis)
-{
- Bool ret;
-
- if (saveInitVisualsProc) {
- ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
- rootDepthp, defaultVisp, sizes, bitsPerRGB,
- preferredVis);
- if (!ret)
- return False;
- }
-
- glxInitVisuals(nvisualp, visualp, defaultVisp, *ndepthp, *depthp,*rootDepthp);
-
- return True;
-}
-
-void
-GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
-{
- if (dmxGLXProxy) {
- saveInitVisualsProc = *initVisProc;
- *initVisProc = GlxInitVisuals;
- }
-}
-
-/************************************************************************/
-
void __glXFlushContextCache(void)
{
__glXLastContext = 0;
diff --git a/hw/dmx/glxProxy/glxext.h b/hw/dmx/glxProxy/glxext.h
index b9f75b4..361bcac 100644
--- a/hw/dmx/glxProxy/glxext.h
+++ b/hw/dmx/glxProxy/glxext.h
@@ -74,19 +74,5 @@ extern void GlxExtensionInit(void);
extern Bool __glXCoreType(void);
-extern int GlxInitVisuals(
-#if NeedFunctionPrototypes
- VisualPtr * visualp,
- DepthPtr * depthp,
- int * nvisualp,
- int * ndepthp,
- int * rootDepthp,
- VisualID * defaultVisp,
- unsigned long sizes,
- int bitsPerRGB,
- int preferredVis
-#endif
-);
-
#endif /* _glxext_h_ */
diff --git a/hw/dmx/glxProxy/glxvisuals.c b/hw/dmx/glxProxy/glxvisuals.c
index d738ec2..8a2e557 100644
--- a/hw/dmx/glxProxy/glxvisuals.c
+++ b/hw/dmx/glxProxy/glxvisuals.c
@@ -32,16 +32,8 @@
#include <dmx-config.h>
#endif
-#include <assert.h>
-#include "dmx.h"
#include "glxserver.h"
-#include "glxutil.h"
-#include "dmx_glxvisuals.h"
-#include <stdlib.h>
-
-static int numConfigs = 0;
-static __GLXvisualConfig *visualConfigs = NULL;
-static void **visualPrivates = NULL;
+#include "glxvisuals.h"
int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 )
{
@@ -158,381 +150,3 @@ VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatch
return 0;
}
-
-void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **privates)
-{
- numConfigs = nconfigs;
- visualConfigs = configs;
- visualPrivates = privates;
-}
-
-static int count_bits(unsigned int n)
-{
- int bits = 0;
-
- while (n > 0) {
- if (n & 1) bits++;
- n >>= 1;
- }
- return bits;
-}
-
-static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth,
- DepthPtr pdepth, int ndepths,
- VisualPtr pNewVisual, int numNewVisuals)
-{
- int d, v;
- VisualPtr vis;
-
- /*
- * find the first visual with the same or deeper depth
- * of the same class.
- */
- for (d=0; d<ndepths; d++) {
- if (pdepth[d].depth >= rootDepth) {
- for (v=0; v<pdepth[d].numVids; v++) {
-
- /* find the new visual structure */
- vis = pNewVisual;
- while( pdepth[d].vids[v] != vis->vid ) vis++;
-
- if (vis->class == pVisual->class) {
- return pdepth[d].vids[v];
- }
- }
- }
- }
-
- /*
- * did not find any.
- * try to look for the same class only.
- */
- for (d=0; d<ndepths; d++) {
- for (v=0; v<pdepth[d].numVids; v++) {
-
- /* find the new visual structure */
- vis = pNewVisual;
- while( pdepth[d].vids[v] != vis->vid ) vis++;
-
- if (vis->class == pVisual->class) {
- return pdepth[d].vids[v];
- }
- }
- }
-
- /*
- * if not found - just take the first visual
- */
- return pdepth[0].vids[0];
-}
-
-Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
- VisualID *defaultVisp,
- int ndepth, DepthPtr pdepth,
- int rootDepth)
-{
- int numRGBconfigs;
- int numCIconfigs;
- int numVisuals = *nvisualp;
- int numNewVisuals;
- int numNewConfigs;
- VisualPtr pVisual = *visualp;
- VisualPtr pVisualNew = NULL;
- VisualID *orig_vid = NULL;
- __GLXvisualConfig *glXVisualPtr = NULL;
- __GLXvisualConfig *pNewVisualConfigs = NULL;
- void **glXVisualPriv;
- dmxGlxVisualPrivate **pNewVisualPriv;
- int found_default;
- int i, j, k;
- int numGLXvis = 0;
- GLint *isGLXvis;
-
- if (numConfigs > 0)
- numNewConfigs = numConfigs;
- else
- return False;
-
- MAXSCREENSALLOC(__glXActiveScreens);
- if (!__glXActiveScreens)
- return False;
-
- /* Alloc space for the list of new GLX visuals */
- pNewVisualConfigs = (__GLXvisualConfig *)
- __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
- if (!pNewVisualConfigs) {
- return FALSE;
- }
-
- /* Alloc space for the list of new GLX visual privates */
- pNewVisualPriv = (dmxGlxVisualPrivate **) __glXMalloc(numNewConfigs * sizeof(dmxGlxVisualPrivate *));
- if (!pNewVisualPriv) {
- __glXFree(pNewVisualConfigs);
- return FALSE;
- }
-
- /* copy driver's visual config info */
- for (i = 0; i < numConfigs; i++) {
- pNewVisualConfigs[i] = visualConfigs[i];
- pNewVisualPriv[i] = (dmxGlxVisualPrivate *)visualPrivates[i];
- }
-
-#if 1
- /* FIXME: This is a hack to workaround a hang in xtest caused by a
- * mismatch between what the front end (i.e., DMX) server calculates
- * for the visual configs and what the back-end servers have.
- */
- {
- int numTCRGBconfigs = 0;
- int numDCRGBconfigs = 0;
-
- numRGBconfigs = 0;
- numCIconfigs = 0;
-
- for (i = 0; i < numNewConfigs; i++) {
- if (pNewVisualConfigs[i].rgba) {
- if (pNewVisualConfigs[i].class == TrueColor)
- numTCRGBconfigs++;
- else
- numDCRGBconfigs++;
- numRGBconfigs++;
- } else
- numCIconfigs++;
- }
-
- /* Count the total number of visuals to compute */
- numNewVisuals = 0;
- for (i = 0; i < numVisuals; i++) {
- numNewVisuals +=
- (pVisual[i].class == TrueColor) ? numTCRGBconfigs :
- (pVisual[i].class == DirectColor) ? numDCRGBconfigs :
- numCIconfigs;
- }
- }
-#else
- /* Count the number of RGB and CI visual configs */
- numRGBconfigs = 0;
- numCIconfigs = 0;
- for (i = 0; i < numNewConfigs; i++) {
- if (pNewVisualConfigs[i].rgba)
- numRGBconfigs++;
- else
- numCIconfigs++;
- }
-
- /* Count the total number of visuals to compute */
- numNewVisuals = 0;
- for (i = 0; i < numVisuals; i++) {
- numNewVisuals +=
- (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor)
- ? numRGBconfigs : numCIconfigs;
- }
-#endif
-
- /* Reset variables for use with the next screen/driver's visual configs */
- visualConfigs = NULL;
- numConfigs = 0;
-
- /* Alloc temp space for the list of orig VisualIDs for each new visual */
- orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
- if (!orig_vid) {
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the list of glXVisuals */
- glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals *
- sizeof(__GLXvisualConfig));
- if (!glXVisualPtr) {
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the list of glXVisualPrivates */
- glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
- if (!glXVisualPriv) {
- __glXFree(glXVisualPtr);
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the new list of the X server's visuals */
- pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
- if (!pVisualNew) {
- __glXFree(glXVisualPriv);
- __glXFree(glXVisualPtr);
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
- return FALSE;
- }
-
- isGLXvis = (GLint *) __glXMalloc(numNewVisuals * sizeof(GLint));
- if (!isGLXvis) {
- __glXFree(glXVisualPriv);
- __glXFree(glXVisualPtr);
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
- __glXFree(pVisualNew);
- return FALSE;
- }
-
- /* Initialize the new visuals */
- found_default = FALSE;
- for (i = j = 0; i < numVisuals; i++) {
-
- for (k = 0; k < numNewConfigs; k++) {
-
- int new_depth;
- int depth;
- int d,v;
-
- /* find the depth of the new visual config */
- new_depth = pNewVisualPriv[k]->x_visual_depth;
-
- /* find the depth of the original visual */
- depth = 0;
- d = 0;
- while( (depth==0) && (d < ndepth) ) {
- v = 0;
- while( (depth==0) && (v < pdepth[d].numVids) ) {
- if (pdepth[d].vids[v] == pVisual[i].vid) {
- depth = pdepth[d].depth;
- }
- v++;
- }
- d++;
- }
-
- /* check that the visual has the same class and depth
- * as the new config
- */
- if ( pVisual[i].class != pNewVisualPriv[k]->x_visual_class ||
- (depth != new_depth) )
- continue;
-
- /* Initialize the new visual */
- pVisualNew[j] = pVisual[i];
- pVisualNew[j].vid = FakeClientID(0);
-
- /* Check for the default visual */
- if (!found_default && pVisual[i].vid == *defaultVisp) {
- *defaultVisp = pVisualNew[j].vid;
- found_default = TRUE;
- }
-
- /* Save the old VisualID */
- orig_vid[j] = pVisual[i].vid;
-
- /* Initialize the glXVisual */
- glXVisualPtr[j] = pNewVisualConfigs[k];
- glXVisualPtr[j].vid = pVisualNew[j].vid;
-
- /*
- * If the class is -1, then assume the X visual information
- * is identical to what GLX needs, and take them from the X
- * visual. NOTE: if class != -1, then all other fields MUST
- * be initialized.
- */
- if (glXVisualPtr[j].class == -1) {
- glXVisualPtr[j].class = pVisual[i].class;
- glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask);
- glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask);
- glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask);
- glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize;
- glXVisualPtr[j].redMask = pVisual[i].redMask;
- glXVisualPtr[j].greenMask = pVisual[i].greenMask;
- glXVisualPtr[j].blueMask = pVisual[i].blueMask;
- glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask;
- glXVisualPtr[j].bufferSize = rootDepth;
- }
-
- /* Save the device-dependent private for this visual */
- glXVisualPriv[j] = pNewVisualPriv[k];
-
- isGLXvis[j] = glxMatchGLXVisualInConfigList( &glXVisualPtr[j],
- dmxScreens[screenInfo.numScreens-1].glxVisuals,
- dmxScreens[screenInfo.numScreens-1].numGlxVisuals );
- if (isGLXvis[j]) numGLXvis++;
-
- j++;
- }
- }
-
- assert(j <= numNewVisuals);
- numNewVisuals = j; /* correct number of new visuals */
-
- /* Save the GLX visuals in the screen structure */
- __glXActiveScreens[screenInfo.numScreens-1].numVisuals = numNewVisuals;
- __glXActiveScreens[screenInfo.numScreens-1].numGLXVisuals = numGLXvis;
- __glXActiveScreens[screenInfo.numScreens-1].isGLXvis = isGLXvis;
- __glXActiveScreens[screenInfo.numScreens-1].pGlxVisual = glXVisualPtr;
-
-
- /* Set up depth's VisualIDs */
- for (i = 0; i < ndepth; i++) {
- int numVids = 0;
- VisualID *pVids = NULL;
- int k, n = 0;
-
- /* Count the new number of VisualIDs at this depth */
- for (j = 0; j < pdepth[i].numVids; j++)
- for (k = 0; k < numNewVisuals; k++)
- if (pdepth[i].vids[j] == orig_vid[k])
- numVids++;
-
- /* Allocate a new list of VisualIDs for this depth */
- pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
-
- /* Initialize the new list of VisualIDs for this depth */
- for (j = 0; j < pdepth[i].numVids; j++)
- for (k = 0; k < numNewVisuals; k++)
- if (pdepth[i].vids[j] == orig_vid[k])
- pVids[n++] = pVisualNew[k].vid;
-
- /* Update this depth's list of VisualIDs */
- __glXFree(pdepth[i].vids);
- pdepth[i].vids = pVids;
- pdepth[i].numVids = numVids;
- }
-
- /*
- * if the default visual was rejected - need to choose new
- * default visual !
- */
- if ( !found_default ) {
-
- for (i=0; i<numVisuals; i++)
- if (pVisual[i].vid == *defaultVisp)
- break;
-
- if (i < numVisuals) {
- *defaultVisp = FindClosestVisual( &pVisual[i], rootDepth, pdepth, ndepth, pVisualNew, numNewVisuals );
- }
- }
-
- /* Update the X server's visuals */
- *nvisualp = numNewVisuals;
- *visualp = pVisualNew;
-
- /* Free the old list of the X server's visuals */
- __glXFree(pVisual);
-
- /* Clean up temporary allocations */
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
-
- /* Free the private list created by DDX HW driver */
- free(visualPrivates);
- visualPrivates = NULL;
-
- return TRUE;
-}
diff --git a/hw/dmx/glxProxy/glxvisuals.h b/hw/dmx/glxProxy/glxvisuals.h
index b00e407..0529d94 100644
--- a/hw/dmx/glxProxy/glxvisuals.h
+++ b/hw/dmx/glxProxy/glxvisuals.h
@@ -39,12 +39,4 @@ VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLX
VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen );
-void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **privates);
-
-Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
- VisualID *defaultVisp,
- int ndepth, DepthPtr pdepth,
- int rootDepth);
-
#endif
commit 5a725385fbb93553931ca0217e79271ab2a2c613
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date: Mon Sep 13 12:33:53 2010 +0300
xfree86: vgaarb: fix decoding stub API
This fix a problem introduced in commit 65466652. It closes also:
https://bugs.freedesktop.org/show_bug.cgi?id=30160
Reported-by: <xunx.fang at intel.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 4f46059..951a585 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -1123,7 +1123,7 @@ void xf86VGAarbiterLock(ScrnInfoPtr pScrn) {}
void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {}
Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; }
void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {}
-void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc) {}
Bool xf86VGAarbiterWrapFunctions(void) { return FALSE; }
#endif
More information about the Xquartz-changes
mailing list