From 358f76f2ad660df770596d037844f770f2d86c75 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 11 Sep 2025 17:28:48 +0200 Subject: [PATCH] treewide: fix misleading `firstScreen` variable naming to `masterScreen` Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen(): also rename the target variables for correct technical terminology. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/panoramiX.c | 33 +++++------ Xext/panoramiXprocs.c | 64 ++++++++++---------- Xext/shm.c | 10 ++-- Xi/xiquerypointer.c | 10 ++-- dix/devices.c | 32 +++++----- dix/dixfonts.c | 7 +-- dix/events.c | 118 ++++++++++++++++++------------------- dix/gestures.c | 8 +-- dix/getevents.c | 6 +- dix/glyphcurs.c | 15 +++-- dix/touch.c | 8 +-- dix/window.c | 18 +++--- hw/xquartz/darwin.c | 12 ++-- hw/xquartz/quartz.c | 39 ++++++------ hw/xquartz/quartzRandR.c | 10 ++-- hw/xwin/winkeybd.c | 4 +- hw/xwin/winmsgwindow.c | 4 +- record/record.c | 6 +- test/xi2/protocol-common.c | 6 +- 19 files changed, 201 insertions(+), 209 deletions(-) diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 9d386534d6..fadc3c58ea 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -396,10 +396,10 @@ XineramaInitData(void) RegionUninit(&ScreenRegion); }); - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - PanoramiXPixWidth = firstScreen->x + firstScreen->width; - PanoramiXPixHeight = firstScreen->y + firstScreen->height; + PanoramiXPixWidth = masterScreen->x + masterScreen->width; + PanoramiXPixHeight = masterScreen->y + masterScreen->height; XINERAMA_FOR_EACH_SCREEN_FORWARD_SKIP0({ int w = walkScreen->x + walkScreen->width; @@ -425,7 +425,7 @@ PanoramiXExtensionInit(void) int i; Bool success = FALSE; ExtensionEntry *extEntry; - ScreenPtr pScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); if (noPanoramiXExtension) return; @@ -470,7 +470,7 @@ PanoramiXExtensionInit(void) dixScreenHookClose(walkScreen, XineramaCloseScreen); - pScreenPriv->CreateGC = pScreen->CreateGC; + pScreenPriv->CreateGC = masterScreen->CreateGC; walkScreen->CreateGC = XineramaCreateGC; }); @@ -591,16 +591,16 @@ PanoramiXCreateConnectionBlock(void) return FALSE; } - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); for (unsigned int walkScreenIdx = 1; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) { ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx]; - if (walkScreen->rootDepth != firstScreen->rootDepth) { + if (walkScreen->rootDepth != masterScreen->rootDepth) { ErrorF("Xinerama error: Root window depths differ\n"); return FALSE; } if (walkScreen->backingStoreSupport != - firstScreen->backingStoreSupport) + masterScreen->backingStoreSupport) disable_backing_store = TRUE; } @@ -778,18 +778,17 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual) extern void PanoramiXConsolidate(void) { - int i; - ScreenPtr pScreen = dixGetMasterScreen(); - DepthPtr pDepth = pScreen->allowedDepths; - VisualPtr pVisual = pScreen->visuals; + ScreenPtr masterScreen = dixGetMasterScreen(); + DepthPtr pDepth = masterScreen->allowedDepths; + VisualPtr pVisual = masterScreen->visuals; PanoramiXNumDepths = 0; PanoramiXNumVisuals = 0; - for (i = 0; i < pScreen->numDepths; i++) + for (int i = 0; i < masterScreen->numDepths; i++) PanoramiXMaybeAddDepth(pDepth++); - for (i = 0; i < pScreen->numVisuals; i++) + for (int i = 0; i < masterScreen->numVisuals; i++) PanoramiXMaybeAddVisual(pVisual++); PanoramiXRes *root = calloc(1, sizeof(PanoramiXRes)); @@ -1240,9 +1239,9 @@ XineramaGetImageData(DrawablePtr *pDrawables, SrcBox.x1 = left; SrcBox.y1 = top; if (!isRoot) { - ScreenPtr firstScreen = dixGetMasterScreen(); - SrcBox.x1 += pDraw->x + firstScreen->x; - SrcBox.y1 += pDraw->y + firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + SrcBox.x1 += pDraw->x + masterScreen->x; + SrcBox.y1 += pDraw->y + masterScreen->y; } SrcBox.x2 = SrcBox.x1 + width; SrcBox.y2 = SrcBox.y1 + height; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index c5daf898ba..ad5b054d7d 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -132,10 +132,10 @@ PanoramiXCreateWindow(ClientPtr client) orig_x = stuff->x; orig_y = stuff->y; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - Bool parentIsRoot = (stuff->parent == firstScreen->root->drawable.id) - || (stuff->parent == firstScreen->screensaver.wid); + Bool parentIsRoot = (stuff->parent == masterScreen->root->drawable.id) + || (stuff->parent == masterScreen->screensaver.wid); XINERAMA_FOR_EACH_SCREEN_BACKWARD({ stuff->wid = newWin->info[walkScreenIdx].id; @@ -344,10 +344,10 @@ PanoramiXReparentWindow(ClientPtr client) x = stuff->x; y = stuff->y; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - Bool parentIsRoot = (stuff->parent == firstScreen->root->drawable.id) - || (stuff->parent == firstScreen->screensaver.wid); + Bool parentIsRoot = (stuff->parent == masterScreen->root->drawable.id) + || (stuff->parent == masterScreen->screensaver.wid); XINERAMA_FOR_EACH_SCREEN_BACKWARD({ stuff->window = win->info[walkScreenIdx].id; @@ -505,10 +505,10 @@ PanoramiXConfigureWindow(ClientPtr client) } } - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - if (pWin->parent && ((pWin->parent == firstScreen->root) || - (pWin->parent->drawable.id == firstScreen->screensaver.wid))) { + if (pWin->parent && ((pWin->parent == masterScreen->root) || + (pWin->parent->drawable.id == masterScreen->screensaver.wid))) { if ((Mask) stuff->mask & CWX) { x_offset = 0; x = *((CARD32 *) &stuff[1]); @@ -575,10 +575,10 @@ PanoramiXGetGeometry(ClientPtr client) if (rc != Success) return rc; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); xGetGeometryReply reply = { - .root = firstScreen->root->drawable.id, + .root = masterScreen->root->drawable.id, .depth = pDraw->depth, .width = pDraw->width, .height = pDraw->height, @@ -599,10 +599,10 @@ PanoramiXGetGeometry(ClientPtr client) reply.x = pWin->origin.x - wBorderWidth(pWin); reply.y = pWin->origin.y - wBorderWidth(pWin); - if ((pWin->parent == firstScreen->root) || - (pWin->parent->drawable.id == firstScreen->screensaver.wid)) { - reply.x += firstScreen->x; - reply.y += firstScreen->y; + if ((pWin->parent == masterScreen->root) || + (pWin->parent->drawable.id == masterScreen->screensaver.wid)) { + reply.x += masterScreen->x; + reply.y += masterScreen->y; } reply.borderWidth = pWin->borderWidth; } @@ -636,12 +636,12 @@ PanoramiXTranslateCoords(ClientPtr client) if (rc != Success) return rc; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - if ((pWin == firstScreen->root) || - (pWin->drawable.id == firstScreen->screensaver.wid)) { - x = stuff->srcX - firstScreen->x; - y = stuff->srcY - firstScreen->y; + if ((pWin == masterScreen->root) || + (pWin->drawable.id == masterScreen->screensaver.wid)) { + x = stuff->srcX - masterScreen->x; + y = stuff->srcY - masterScreen->y; } else { x = pWin->drawable.x + stuff->srcX; @@ -678,10 +678,10 @@ PanoramiXTranslateCoords(ClientPtr client) INT16 dstX = x - pDst->drawable.x; INT16 dstY = y - pDst->drawable.y; - if ((pDst == firstScreen->root) || - (pDst->drawable.id == firstScreen->screensaver.wid)) { - dstX += firstScreen->x; - dstY += firstScreen->y; + if ((pDst == masterScreen->root) || + (pDst->drawable.id == masterScreen->screensaver.wid)) { + dstX += masterScreen->x; + dstY += masterScreen->y; } xTranslateCoordsReply reply = { @@ -1167,9 +1167,9 @@ PanoramiXCopyArea(ClientPtr client) dx = drawables[0]->x; dy = drawables[0]->y; if (srcIsRoot) { - ScreenPtr firstScreen = dixGetMasterScreen(); - dx += firstScreen->x; - dy += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + dx += masterScreen->x; + dy += masterScreen->y; } sourceBox.x1 = min(srcx + dx, 0); @@ -2033,12 +2033,12 @@ PanoramiXGetImage(ClientPtr client) return BadMatch; } else { - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); /* check for being onscreen and inside of border */ - if (firstScreen->x + pDraw->x + x < 0 || - firstScreen->x + pDraw->x + x + w > PanoramiXPixWidth || - firstScreen->y + pDraw->y + y < 0 || - firstScreen->y + pDraw->y + y + h > PanoramiXPixHeight || + if (masterScreen->x + pDraw->x + x < 0 || + masterScreen->x + pDraw->x + x + w > PanoramiXPixWidth || + masterScreen->y + pDraw->y + y < 0 || + masterScreen->y + pDraw->y + y + h > PanoramiXPixHeight || x < -wBorderWidth((WindowPtr) pDraw) || x + w > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width || y < -wBorderWidth((WindowPtr) pDraw) || diff --git a/Xext/shm.c b/Xext/shm.c index 11e84aeece..ccccb0d48b 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -813,12 +813,12 @@ ProcShmGetImage(ClientPtr client) return BadMatch; } else { - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); if ( /* check for being onscreen */ - firstScreen->x + pDraw->x + x < 0 || - firstScreen->x + pDraw->x + x + w > PanoramiXPixWidth || - firstScreen->y + pDraw->y + y < 0 || - firstScreen->y + pDraw->y + y + h > PanoramiXPixHeight || + masterScreen->x + pDraw->x + x < 0 || + masterScreen->x + pDraw->x + x + w > PanoramiXPixWidth || + masterScreen->y + pDraw->y + y < 0 || + masterScreen->y + pDraw->y + y + h > PanoramiXPixHeight || /* check for being inside of border */ x < -wBorderWidth((WindowPtr) pDraw) || x + w > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width || diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index 48067dbc4a..962a24707f 100644 --- a/Xi/xiquerypointer.c +++ b/Xi/xiquerypointer.c @@ -172,12 +172,12 @@ ProcXIQueryPointer(ClientPtr client) #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - rep.root_x += double_to_fp1616(firstScreen->x); - rep.root_y += double_to_fp1616(firstScreen->y); + ScreenPtr masterScreen = dixGetMasterScreen(); + rep.root_x += double_to_fp1616(masterScreen->x); + rep.root_y += double_to_fp1616(masterScreen->y); if (stuff->win == rep.root) { - rep.win_x += double_to_fp1616(firstScreen->x); - rep.win_y += double_to_fp1616(firstScreen->y); + rep.win_x += double_to_fp1616(masterScreen->x); + rep.win_y += double_to_fp1616(masterScreen->y); } } #endif /* XINERAMA */ diff --git a/dix/devices.c b/dix/devices.c index 8ee338dc27..a297527812 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -379,10 +379,10 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) if (InputDevIsMaster(dev)) { /* Sprites appear on first root window, so we can hardcode it */ if (dev->spriteInfo->spriteOwner) { - ScreenPtr firstScreen = dixGetMasterScreen(); - InitializeSprite(dev, firstScreen->root); + ScreenPtr masterScreen = dixGetMasterScreen(); + InitializeSprite(dev, masterScreen->root); /* mode doesn't matter */ - EnterWindow(dev, firstScreen->root, NotifyAncestor); + EnterWindow(dev, masterScreen->root, NotifyAncestor); } else { other = NextFreePointerDevice(); @@ -591,7 +591,7 @@ int ActivateDevice(DeviceIntPtr dev, BOOL sendevent) { int ret = Success; - ScreenPtr pScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); if (!dev || !dev->deviceProc) return BadImplementation; @@ -605,7 +605,7 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent) /* Initialize memory for sprites. */ if (InputDevIsMaster(dev) && dev->spriteInfo->spriteOwner) - if (!pScreen->DeviceCursorInitialize(dev, pScreen)) + if (!masterScreen->DeviceCursorInitialize(dev, masterScreen)) ret = BadAlloc; SendDevicePresenceEvent(dev->id, DeviceAdded); @@ -674,7 +674,7 @@ CorePointerProc(DeviceIntPtr pDev, int what) BYTE map[NBUTTONS + 1]; Atom btn_labels[NBUTTONS] = { 0 }; Atom axes_labels[NAXES] = { 0 }; - ScreenPtr scr = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); switch (what) { case DEVICE_INIT: @@ -702,10 +702,10 @@ CorePointerProc(DeviceIntPtr pDev, int what) return BadAlloc; /* IPDS only fails on allocs */ } /* axisVal is per-screen, last.valuators is desktop-wide */ - pDev->valuator->axisVal[0] = scr->width / 2; - pDev->last.valuators[0] = pDev->valuator->axisVal[0] + scr->x; - pDev->valuator->axisVal[1] = scr->height / 2; - pDev->last.valuators[1] = pDev->valuator->axisVal[1] + scr->y; + pDev->valuator->axisVal[0] = masterScreen->width / 2; + pDev->last.valuators[0] = pDev->valuator->axisVal[0] + masterScreen->x; + pDev->valuator->axisVal[1] = masterScreen->height / 2; + pDev->last.valuators[1] = pDev->valuator->axisVal[1] + masterScreen->y; break; case DEVICE_CLOSE: @@ -989,7 +989,7 @@ FreePendingFrozenDeviceEvents(DeviceIntPtr dev) static void CloseDevice(DeviceIntPtr dev) { - ScreenPtr screen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); ClassesPtr classes; if (!dev) @@ -1003,7 +1003,7 @@ CloseDevice(DeviceIntPtr dev) FreeSprite(dev); if (InputDevIsMaster(dev)) - screen->DeviceCursorCleanup(dev, screen); + masterScreen->DeviceCursorCleanup(dev, masterScreen); /* free acceleration info */ if (dev->valuator && dev->valuator->accelScheme.AccelCleanupProc) @@ -1144,10 +1144,10 @@ AbortDevices(void) void UndisplayDevices(void) { - ScreenPtr screen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); for (DeviceIntPtr dev = inputInfo.devices; dev; dev = dev->next) - screen->DisplayCursor(dev, screen, NullCursor); + masterScreen->DisplayCursor(dev, masterScreen, NullCursor); } static int @@ -1186,7 +1186,7 @@ int RemoveDevice(DeviceIntPtr dev, BOOL sendevent) { int ret = BadMatch; - ScreenPtr screen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); int deviceid; int initialized; int flags[MAXDEVICES] = { 0 }; @@ -1202,7 +1202,7 @@ RemoveDevice(DeviceIntPtr dev, BOOL sendevent) if (initialized) { if (DevHasCursor(dev)) - screen->DisplayCursor(dev, screen, NullCursor); + masterScreen->DisplayCursor(dev, masterScreen, NullCursor); DisableDevice(dev, sendevent); flags[dev->id] = XIDeviceDisabled; diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 309731a077..6c2a15f85a 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1867,10 +1867,9 @@ static FontResolutionPtr get_client_resolutions(int *num) { static struct _FontResolution res; - ScreenPtr pScreen; + ScreenPtr masterScreen = dixGetMasterScreen(); - pScreen = dixGetMasterScreen(); - res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; + res.x_resolution = (masterScreen->width * 25.4) / masterScreen->mmWidth; /* * XXX - we'll want this as long as bitmap instances are prevalent so that we can match them from scalable fonts @@ -1879,7 +1878,7 @@ get_client_resolutions(int *num) res.x_resolution = 75; else res.x_resolution = 100; - res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; + res.y_resolution = (masterScreen->height * 25.4) / masterScreen->mmHeight; if (res.y_resolution < 88) res.y_resolution = 75; else diff --git a/dix/events.c b/dix/events.c index 83a9800d33..c438651e97 100644 --- a/dix/events.c +++ b/dix/events.c @@ -539,9 +539,9 @@ XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) to send the message too and what the coordinates relative to that screen are. */ - ScreenPtr firstScreen = dixGetMasterScreen(); - x += firstScreen->x; - y += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + x += masterScreen->x; + y += masterScreen->y; if (!point_on_screen(pScreen, x, y)) { XINERAMA_FOR_EACH_SCREEN_BACKWARD({ @@ -555,8 +555,8 @@ XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) } pSprite->screen = pScreen; - pSprite->hotPhys.x = x - firstScreen->x; - pSprite->hotPhys.y = y - firstScreen->y; + pSprite->hotPhys.x = x - masterScreen->x; + pSprite->hotPhys.y = y - masterScreen->y; x -= pScreen->x; y -= pScreen->y; @@ -572,14 +572,14 @@ XineramaConstrainCursor(DeviceIntPtr pDev) ScreenPtr pScreen = pSprite->screen; BoxRec newBox = pSprite->physLimits; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); /* Translate the constraining box to the screen the sprite is actually on */ - newBox.x1 += firstScreen->x - pScreen->x; - newBox.x2 += firstScreen->x - pScreen->x; - newBox.y1 += firstScreen->y - pScreen->y; - newBox.y2 += firstScreen->y - pScreen->y; + newBox.x1 += masterScreen->x - pScreen->x; + newBox.x2 += masterScreen->x - pScreen->x; + newBox.y1 += masterScreen->y - pScreen->y; + newBox.y2 += masterScreen->y - pScreen->y; (*pScreen->ConstrainCursor) (pDev, pScreen, &newBox); } @@ -1185,9 +1185,9 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) if (event->type == ET_Motion) { #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - event->root_x += pSprite->screen->x - firstScreen->x; - event->root_y += pSprite->screen->y - firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + event->root_x += pSprite->screen->x - masterScreen->x; + event->root_y += pSprite->screen->y - masterScreen->y; } #endif /* XINERAMA */ pSprite->hotPhys.x = event->root_x; @@ -1238,7 +1238,7 @@ PlayReleasedEvents(void) DeviceIntPtr dev; DeviceIntPtr pDev; #ifdef XINERAMA - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); #endif restart: @@ -1268,9 +1268,9 @@ PlayReleasedEvents(void) case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: - ev->root_x += firstScreen->x - + ev->root_x += masterScreen->x - pDev->spriteInfo->sprite->screen->x; - ev->root_y += firstScreen->y - + ev->root_y += masterScreen->y - pDev->spriteInfo->sprite->screen->y; break; default: @@ -3015,13 +3015,13 @@ PointInBorderSize(WindowPtr pWin, int x, int y) if (!noPanoramiXExtension && XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); XINERAMA_FOR_EACH_SCREEN_FORWARD_SKIP0({ if (RegionContainsPoint(&pSprite->windows[walkScreenIdx]->borderSize, - x + firstScreen->x - + x + masterScreen->x - walkScreen->x, - y + firstScreen->y - + y + masterScreen->y - walkScreen->y, &box)) return TRUE; }); @@ -3171,9 +3171,9 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ - ScreenPtr firstScreen = dixGetMasterScreen(); - ev->root_x += pSprite->screen->x - firstScreen->x; - ev->root_y += pSprite->screen->y - firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + ev->root_x += pSprite->screen->x - masterScreen->x; + ev->root_y += pSprite->screen->y - masterScreen->y; } else #endif /* XINERAMA */ @@ -3365,11 +3365,11 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) } #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - pSprite->hotLimits.x1 = -firstScreen->x; - pSprite->hotLimits.y1 = -firstScreen->y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - firstScreen->x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + pSprite->hotLimits.x1 = -masterScreen->x; + pSprite->hotLimits.y1 = -masterScreen->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - masterScreen->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - masterScreen->y; pSprite->physLimits = pSprite->hotLimits; pSprite->confineWin = NullWindow; pSprite->hotShape = NullRegion; @@ -3446,11 +3446,11 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - pSprite->hotLimits.x1 = -firstScreen->x; - pSprite->hotLimits.y1 = -firstScreen->y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - firstScreen->x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + pSprite->hotLimits.x1 = -masterScreen->x; + pSprite->hotLimits.y1 = -masterScreen->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - masterScreen->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - masterScreen->y; pSprite->physLimits = pSprite->hotLimits; pSprite->screen = pScreen; } @@ -3487,26 +3487,26 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) pSprite->hotPhys.y = y; #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - pSprite->hotPhys.x += newScreen->x - firstScreen->x; - pSprite->hotPhys.y += newScreen->y - firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + pSprite->hotPhys.x += newScreen->x - masterScreen->x; + pSprite->hotPhys.y += newScreen->y - masterScreen->y; if (newScreen != pSprite->screen) { pSprite->screen = newScreen; /* Make sure we tell the DDX to update its copy of the screen */ if (pSprite->confineWin) XineramaConfineCursorToWindow(ptr, pSprite->confineWin, TRUE); else - XineramaConfineCursorToWindow(ptr, firstScreen->root, TRUE); + XineramaConfineCursorToWindow(ptr, masterScreen->root, TRUE); /* if the pointer wasn't confined, the DDX won't get told of the pointer warp so we reposition it here */ if (!syncEvents.playingEvents) (*pSprite->screen->SetCursorPosition) (ptr, pSprite->screen, pSprite->hotPhys.x + - firstScreen-> + masterScreen-> x - pSprite->screen->x, pSprite->hotPhys.y + - firstScreen-> + masterScreen-> y - pSprite->screen->y, FALSE); } @@ -3534,10 +3534,10 @@ XineramaPointInWindowIsVisible(WindowPtr pWin, int x, int y) if (!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - xoff = x + firstScreen->x; - yoff = y + firstScreen->y; + xoff = x + masterScreen->x; + yoff = y + masterScreen->y; XINERAMA_FOR_EACH_SCREEN_FORWARD_SKIP0({ pWin = inputInfo.pointer->spriteInfo->sprite->windows[walkScreenIdx]; @@ -3573,7 +3573,7 @@ XineramaWarpPointer(ClientPtr client) x = pSprite->hotPhys.x; y = pSprite->hotPhys.y; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); if (stuff->srcWid != None) { int winX, winY; @@ -3586,9 +3586,9 @@ XineramaWarpPointer(ClientPtr client) winX = source->drawable.x; winY = source->drawable.y; - if (source == firstScreen->root) { - winX -= firstScreen->x; - winY -= firstScreen->y; + if (source == masterScreen->root) { + winX -= masterScreen->x; + winY -= masterScreen->y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || @@ -3602,9 +3602,9 @@ XineramaWarpPointer(ClientPtr client) if (dest) { x = dest->drawable.x; y = dest->drawable.y; - if (dest == firstScreen->root) { - x -= firstScreen->x; - y -= firstScreen->y; + if (dest == masterScreen->root) { + x -= masterScreen->x; + y -= masterScreen->y; } } @@ -5369,12 +5369,12 @@ ProcQueryPointer(ClientPtr client) #ifdef XINERAMA if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - rep.rootX += firstScreen->x; - rep.rootY += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + rep.rootX += masterScreen->x; + rep.rootY += masterScreen->y; if (stuff->id == rep.root) { - rep.winX += firstScreen->x; - rep.winY += firstScreen->y; + rep.winX += masterScreen->x; + rep.winY += masterScreen->y; } } #endif /* XINERAMA */ @@ -6039,8 +6039,8 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) XkbFilterEvents(pClient, count, events); #ifdef XINERAMA - ScreenPtr firstScreen = dixGetMasterScreen(); - if (!noPanoramiXExtension && (firstScreen->x || firstScreen->y)) { + ScreenPtr masterScreen = dixGetMasterScreen(); + if (!noPanoramiXExtension && (masterScreen->x || masterScreen->y)) { switch (events->u.u.type) { case MotionNotify: case ButtonPress: @@ -6056,12 +6056,12 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); - eventCopy.u.keyButtonPointer.rootX += firstScreen->x; - eventCopy.u.keyButtonPointer.rootY += firstScreen->y; + eventCopy.u.keyButtonPointer.rootX += masterScreen->x; + eventCopy.u.keyButtonPointer.rootY += masterScreen->y; if (eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { - eventCopy.u.keyButtonPointer.eventX += firstScreen->x; - eventCopy.u.keyButtonPointer.eventY += firstScreen->y; + eventCopy.u.keyButtonPointer.eventX += masterScreen->x; + eventCopy.u.keyButtonPointer.eventY += masterScreen->y; } events = &eventCopy; break; diff --git a/dix/gestures.c b/dix/gestures.c index 9f0934d701..3495a4df8c 100644 --- a/dix/gestures.c +++ b/dix/gestures.c @@ -53,12 +53,12 @@ GestureInitGestureInfo(GestureInfoPtr gi) if (!gi->sprite.spriteTrace) { return FALSE; } - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); gi->sprite.spriteTraceSize = 32; - gi->sprite.spriteTrace[0] = firstScreen->root; - gi->sprite.hot.pScreen = firstScreen; - gi->sprite.hotPhys.pScreen = firstScreen; + gi->sprite.spriteTrace[0] = masterScreen->root; + gi->sprite.hot.pScreen = masterScreen; + gi->sprite.hotPhys.pScreen = masterScreen; return TRUE; } diff --git a/dix/getevents.c b/dix/getevents.c index da4ae87d6a..f39f0b9f52 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -2119,9 +2119,9 @@ PostSyntheticMotion(DeviceIntPtr pDev, will translate from sprite screen to screen 0 upon reentry to the DIX layer. */ if (!noPanoramiXExtension) { - ScreenPtr firstScreen = dixGetMasterScreen(); - x += firstScreen->x - screenInfo.screens[screen]->x; - y += firstScreen->y - screenInfo.screens[screen]->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + x += masterScreen->x - screenInfo.screens[screen]->x; + y += masterScreen->y - screenInfo.screens[screen]->y; } #endif /* XINERAMA */ diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c index dea29fd4b5..791983825c 100644 --- a/dix/glyphcurs.c +++ b/dix/glyphcurs.c @@ -77,7 +77,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, { GCPtr pGC; xRectangle rect; - PixmapPtr ppix; char *pbits; ChangeGCVal gcval[3]; unsigned char char2b[2]; @@ -86,15 +85,15 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, char2b[0] = (unsigned char) (ch >> 8); char2b[1] = (unsigned char) (ch & 0xff); - ScreenPtr pScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); pbits = calloc(BitmapBytePad(cm->width), cm->height); if (!pbits) return BadAlloc; - ppix = (PixmapPtr) (*pScreen->CreatePixmap) (pScreen, cm->width, - cm->height, 1, - CREATE_PIXMAP_USAGE_SCRATCH); - pGC = GetScratchGC(1, pScreen); + PixmapPtr ppix = masterScreen->CreatePixmap(masterScreen, cm->width, + cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); + pGC = GetScratchGC(1, masterScreen); if (!ppix || !pGC) { dixDestroyPixmap(ppix, 0); if (pGC) @@ -122,8 +121,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, ValidateGC((DrawablePtr) ppix, pGC); (*pGC->ops->PolyText16) ((DrawablePtr) ppix, pGC, cm->xhot, cm->yhot, 1, (unsigned short *) char2b); - (*pScreen->GetImage) ((DrawablePtr) ppix, 0, 0, cm->width, cm->height, - XYPixmap, 1, pbits); + masterScreen->GetImage((DrawablePtr) ppix, 0, 0, cm->width, cm->height, + XYPixmap, 1, pbits); *ppbits = (unsigned char *) pbits; FreeScratchGC(pGC); dixDestroyPixmap(ppix, 0); diff --git a/dix/touch.c b/dix/touch.c index 8e8f4b28dc..cc444f2a20 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -223,11 +223,11 @@ TouchInitTouchPoint(TouchClassPtr t, ValuatorClassPtr v, int index) } ti->sprite.spriteTraceSize = 32; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); - ti->sprite.spriteTrace[0] = firstScreen->root; - ti->sprite.hot.pScreen = firstScreen; - ti->sprite.hotPhys.pScreen = firstScreen; + ti->sprite.spriteTrace[0] = masterScreen->root; + ti->sprite.hot.pScreen = masterScreen; + ti->sprite.hotPhys.pScreen = masterScreen; ti->client_id = -1; diff --git a/dix/window.c b/dix/window.c index d4c853fbd4..f47771f732 100644 --- a/dix/window.c +++ b/dix/window.c @@ -2269,9 +2269,9 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) event.u.u.detail = (mask & CWStackMode) ? smode : Above; #ifdef XINERAMA if (!noPanoramiXExtension && (!pParent || !pParent->parent)) { - ScreenPtr firstScreen = dixGetMasterScreen(); - event.u.configureRequest.x += firstScreen->x; - event.u.configureRequest.y += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + event.u.configureRequest.x += masterScreen->x; + event.u.configureRequest.y += masterScreen->y; } #endif /* XINERAMA */ if (MaybeDeliverEventToClient(pParent, &event, @@ -2353,9 +2353,9 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) event.u.u.type = ConfigureNotify; #ifdef XINERAMA if (!noPanoramiXExtension && (!pParent || !pParent->parent)) { - ScreenPtr firstScreen = dixGetMasterScreen(); - event.u.configureNotify.x += firstScreen->x; - event.u.configureNotify.y += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + event.u.configureNotify.x += masterScreen->x; + event.u.configureNotify.y += masterScreen->y; } #endif /* XINERAMA */ DeliverEvents(pWin, &event, 1, NullWindow); @@ -2499,9 +2499,9 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent, event.u.u.type = ReparentNotify; #ifdef XINERAMA if (!noPanoramiXExtension && !pParent->parent) { - ScreenPtr firstScreen = dixGetMasterScreen(); - event.u.reparent.x += firstScreen->x; - event.u.reparent.y += firstScreen->y; + ScreenPtr masterScreen = dixGetMasterScreen(); + event.u.reparent.x += masterScreen->x; + event.u.reparent.y += masterScreen->y; } #endif /* XINERAMA */ DeliverEvents(pWin, &event, 1, pParent); diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 3bb3695a36..9cb138b375 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -583,15 +583,13 @@ CloseInput(void) */ void DarwinAdjustScreenOrigins(void) { - int i, left, top; + ScreenPtr masterScreen = dixGetMasterScreen(); - ScreenPtr firstScreen = dixGetMasterScreen(); - - left = firstScreen->x; - top = firstScreen->y; + int left = masterScreen->x; + int top = masterScreen->y; /* Find leftmost screen. If there's a tie, take the topmost of the two. */ - for (i = 1; i < screenInfo.numScreens; i++) { + for (int i = 1; i < screenInfo.numScreens; i++) { if (screenInfo.screens[i]->x < left || (screenInfo.screens[i]->x == left && screenInfo.screens[i]->y < top)) { @@ -611,7 +609,7 @@ void DarwinAdjustScreenOrigins(void) */ if (darwinMainScreenX != 0 || darwinMainScreenY != 0) { - for (i = 0; i < screenInfo.numScreens; i++) { + for (int i = 0; i < screenInfo.numScreens; i++) { screenInfo.screens[i]->x -= darwinMainScreenX; screenInfo.screens[i]->y -= darwinMainScreenY; DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n", diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 53f16f8a94..1e8f58b735 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -237,9 +237,8 @@ QuartzInitInput(int argc, void QuartzUpdateScreens(void) { - ScreenPtr pScreen; WindowPtr pRoot; - int x, y, width, height, sx, sy; + int x, y, width, height; xEvent e; BoxRec bounds; @@ -252,30 +251,30 @@ QuartzUpdateScreens(void) return; } - pScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); PseudoramiXResetScreens(); - quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen); + quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, masterScreen); - pScreen->x = x; - pScreen->y = y; - pScreen->mmWidth = pScreen->mmWidth * ((double)width / pScreen->width); - pScreen->mmHeight = pScreen->mmHeight * ((double)height / pScreen->height); - pScreen->width = width; - pScreen->height = height; + masterScreen->x = x; + masterScreen->y = y; + masterScreen->mmWidth = masterScreen->mmWidth * ((double)width / masterScreen->width); + masterScreen->mmHeight = masterScreen->mmHeight * ((double)height / masterScreen->height); + masterScreen->width = width; + masterScreen->height = height; DarwinAdjustScreenOrigins(); - /* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y, + /* DarwinAdjustScreenOrigins or UpdateScreen may change masterScreen->x/y, * so use it rather than x/y */ - sx = pScreen->x + darwinMainScreenX; - sy = pScreen->y + darwinMainScreenY; + int sx = masterScreen->x + darwinMainScreenX; + int sy = masterScreen->y + darwinMainScreenY; /* Adjust the root window. */ - pRoot = pScreen->root; + pRoot = masterScreen->root; AppleWMSetScreenOrigin(pRoot); - pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); + masterScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); /* pointer events are clipped to old display region after display reconfiguration * http://xquartz.macosforge.org/trac/ticket/346 @@ -284,7 +283,7 @@ QuartzUpdateScreens(void) bounds.x2 = width; bounds.y1 = 0; bounds.y2 = height; - pScreen->ConstrainCursor(inputInfo.pointer, pScreen, &bounds); + masterScreen->ConstrainCursor(inputInfo.pointer, masterScreen, &bounds); inputInfo.pointer->spriteInfo->sprite->physLimits = bounds; inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds; @@ -292,7 +291,7 @@ QuartzUpdateScreens(void) "Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, - pScreen->x, pScreen->y); + masterScreen->x, masterScreen->y); /* Send an event for the root reconfigure */ e.u.u.type = ConfigureNotify; @@ -306,13 +305,13 @@ QuartzUpdateScreens(void) e.u.configureNotify.override = pRoot->overrideRedirect; DeliverEvents(pRoot, &e, 1, NullWindow); - quartzProcs->UpdateScreen(pScreen); + quartzProcs->UpdateScreen(masterScreen); /* PaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */ - pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); + masterScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); /* Tell RandR about the new size, so new connections get the correct info */ - RRScreenSizeNotify(pScreen); + RRScreenSizeNotify(masterScreen); } static void diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c index e0c7ebc61a..731fc158e0 100644 --- a/hw/xquartz/quartzRandR.c +++ b/hw/xquartz/quartzRandR.c @@ -426,7 +426,7 @@ _QuartzRandRUpdateFakeModes(ScreenPtr pScreen) Bool QuartzRandRUpdateFakeModes(BOOL force_update) { - ScreenPtr pScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); if (ignore_next_fake_mode_update) { DEBUG_LOG( @@ -435,11 +435,11 @@ QuartzRandRUpdateFakeModes(BOOL force_update) return TRUE; } - if (!_QuartzRandRUpdateFakeModes(pScreen)) + if (!_QuartzRandRUpdateFakeModes(masterScreen)) return FALSE; if (force_update) - RRGetInfo(pScreen, TRUE); + RRGetInfo(masterScreen, TRUE); return TRUE; } @@ -496,8 +496,8 @@ QuartzRandRSetFakeFullscreen(BOOL state) void QuartzRandRToggleFullscreen(void) { - ScreenPtr pScreen = dixGetMasterScreen(); - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); + ScreenPtr masterScreen = dixGetMasterScreen(); + QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(masterScreen); if (pQuartzScreen->currentMode.ref == NULL) { ErrorF( diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 05964964aa..09ce4e225a 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -257,8 +257,8 @@ winRestoreModeKeyStates(void) /* Only process events if the rootwindow is mapped. The keyboard events * will cause segfaults otherwise */ - ScreenPtr firstScreen = dixGetMasterScreen(); - if (firstScreen->root && firstScreen->root->mapped == FALSE) + ScreenPtr masterScreen = dixGetMasterScreen(); + if (masterScreen->root && masterScreen->root->mapped == FALSE) processEvents = FALSE; /* Force to process all pending events in the mi event queue */ diff --git a/hw/xwin/winmsgwindow.c b/hw/xwin/winmsgwindow.c index 26ce88c2e4..c00640884d 100644 --- a/hw/xwin/winmsgwindow.c +++ b/hw/xwin/winmsgwindow.c @@ -58,9 +58,7 @@ winMsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) has set the DE_TERMINATE flag so exits the msg dispatch loop. */ { - ScreenPtr pScreen = dixGetMasterScreen(); - - winScreenPriv(pScreen); + winScreenPriv(dixGetMasterScreen()); PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); } diff --git a/record/record.c b/record/record.c index 2cc61000dc..723d544880 100644 --- a/record/record.c +++ b/record/record.c @@ -726,13 +726,13 @@ RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP, pev->u.u.type == ButtonRelease || pev->u.u.type == KeyPress || pev->u.u.type == KeyRelease)) { int scr = inputInfo.pointer->spriteInfo->sprite->screen->myNum; - ScreenPtr firstScreen = dixGetMasterScreen(); + ScreenPtr masterScreen = dixGetMasterScreen(); memcpy(&shiftedEvent, pev, sizeof(xEvent)); shiftedEvent.u.keyButtonPointer.rootX += - screenInfo.screens[scr]->x - firstScreen->x; + screenInfo.screens[scr]->x - masterScreen->x; shiftedEvent.u.keyButtonPointer.rootY += - screenInfo.screens[scr]->y - firstScreen->y; + screenInfo.screens[scr]->y - masterScreen->y; pEvToRecord = &shiftedEvent; } #endif /* XINERAMA */ diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c index 68575587eb..ed455232f2 100644 --- a/test/xi2/protocol-common.c +++ b/test/xi2/protocol-common.c @@ -110,10 +110,10 @@ TestPointerProc(DeviceIntPtr pDev, int what) pDev->name); return BadAlloc; } - ScreenPtr firstScreen = dixGetMasterScreen(); - pDev->valuator->axisVal[0] = firstScreen->width / 2; + ScreenPtr masterScreen = dixGetMasterScreen(); + pDev->valuator->axisVal[0] = masterScreen->width / 2; pDev->last.valuators[0] = pDev->valuator->axisVal[0]; - pDev->valuator->axisVal[1] = firstScreen->height / 2; + pDev->valuator->axisVal[1] = masterScreen->height / 2; pDev->last.valuators[1] = pDev->valuator->axisVal[1]; /* protocol-xiquerydevice.c relies on these increment */