// Return TRUE if region equal to this one bool FXRegion::operator==(const FXRegion& r) const { #ifndef WIN32 return XEqualRegion((Region)region,(Region)r.region); #else return EqualRgn((HRGN)region,(HRGN)r.region)!=0; #endif }
// Return true if region not equal to this one FXbool FXRegion::operator!=(const FXRegion& r) const { #ifdef WIN32 return EqualRgn((HRGN)region,(HRGN)r.region)==0; #else return !XEqualRegion((Region)region,(Region)r.region); #endif }
static PyObject * region_EqualRegion(PaxRegionObject *self, PyObject *args) { PaxRegionObject *r; if (!PyArg_ParseTuple(args, "O!", &PaxRegionType, &r)) return NULL; return PyInt_FromLong(XEqualRegion(self->region, r->region)); }
EAPI Eina_Bool ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2) { if (!r1 || !r2) return EINA_FALSE; LOGFN(__FILE__, __LINE__, __FUNCTION__); return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE; } /* ecore_x_xregion_is_equal */
bool wxRegion::operator==( const wxRegion& region ) { #if 0 if (m_refData == region.m_refData) return TRUE; if (!m_refData || !region.m_refData) return FALSE; // compare the regions themselves, not the pointers to ref data! return XEqualRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region ); #endif }
/* dwParm2 - Second Region to compare */ DWORD DrvRegionsEqualRegion(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct) { return (DWORD)XEqualRegion((Region)dwParm1, (Region)dwParm2); }
bool wxRegion::DoIsEqual(const wxRegion& region) const { return XEqualRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region ) == True; }
/* This function currently always performs occlusion detection to minimize paint regions. OpenGL precision requirements are no good enough to guarantee that the results from using occlusion detection is the same as without. It's likely not possible to see any difference with most hardware but occlusion detection in the transformed screen case should be made optional for those who do see a difference. */ static void paintOutputRegion (CompScreen *screen, const CompTransform *transform, Region region, CompOutput *output, unsigned int mask) { static Region tmpRegion = NULL; CompWindow *w; CompCursor *c; int count, windowMask, odMask, i; CompWindow *fullscreenWindow = NULL; CompWalker walk; Bool status; Bool withOffset = FALSE; CompTransform vTransform; int offX, offY; Region clip = region; int dontcare; if (!tmpRegion) { tmpRegion = XCreateRegion (); if (!tmpRegion) return; } if (mask & PAINT_SCREEN_TRANSFORMED_MASK) { windowMask = PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK; count = 1; } else { windowMask = 0; count = 0; } XSubtractRegion (region, &emptyRegion, tmpRegion); (*screen->initWindowWalker) (screen, &walk); if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) { /* detect occlusions */ for (w = (*walk.last) (screen); w; w = (*walk.prev) (w)) { if (w->destroyed) continue; if (!w->shaded) { if (w->attrib.map_state != IsViewable || !w->damaged) continue; } /* copy region */ XSubtractRegion (tmpRegion, &emptyRegion, w->clip); odMask = PAINT_WINDOW_OCCLUSION_DETECTION_MASK; if ((screen->windowOffsetX != 0 || screen->windowOffsetY != 0) && !windowOnAllViewports (w)) { withOffset = TRUE; getWindowMovementForOffset (w, screen->windowOffsetX, screen->windowOffsetY, &offX, &offY); vTransform = *transform; matrixTranslate (&vTransform, offX, offY, 0); XOffsetRegion (w->clip, -offX, -offY); odMask |= PAINT_WINDOW_WITH_OFFSET_MASK; status = (*screen->paintWindow) (w, &w->paint, &vTransform, tmpRegion, odMask); } else { withOffset = FALSE; status = (*screen->paintWindow) (w, &w->paint, transform, tmpRegion, odMask); } if (status) { if (withOffset) { XOffsetRegion (w->region, offX, offY); XSubtractRegion (tmpRegion, w->region, tmpRegion); XOffsetRegion (w->region, -offX, -offY); } else XSubtractRegion (tmpRegion, w->region, tmpRegion); /* unredirect top most fullscreen windows. */ /* if the fullscreen window is mate-screensaver and we're on nvidia we want to always unredirect even if this option is disabled to work around LP #160264 */ if (count == 0 && (screen->opt[COMP_SCREEN_OPTION_UNREDIRECT_FS].value.b || (w->resName && !strcmp(w->resName, "mate-screensaver") && XQueryExtension (screen->display->display, "NV-GLX", &dontcare, &dontcare, &dontcare)))) { if (XEqualRegion (w->region, &screen->region) && !REGION_NOT_EMPTY (tmpRegion)) { fullscreenWindow = w; } else { for (i = 0; i < screen->nOutputDev; i++) if (XEqualRegion (w->region, &screen->outputDev[i].region)) fullscreenWindow = w; } } } if (!w->invisible) count++; } } if (fullscreenWindow) unredirectWindow (fullscreenWindow); if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK)) paintBackground (screen, tmpRegion, (mask & PAINT_SCREEN_TRANSFORMED_MASK)); /* paint all windows from bottom to top */ for (w = (*walk.first) (screen); w; w = (*walk.next) (w)) { if (w->destroyed) continue; if (w == fullscreenWindow) continue; if (!w->shaded) { if (w->attrib.map_state != IsViewable || !w->damaged) continue; } if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) clip = w->clip; if ((screen->windowOffsetX != 0 || screen->windowOffsetY != 0) && !windowOnAllViewports (w)) { getWindowMovementForOffset (w, screen->windowOffsetX, screen->windowOffsetY, &offX, &offY); vTransform = *transform; matrixTranslate (&vTransform, offX, offY, 0); (*screen->paintWindow) (w, &w->paint, &vTransform, clip, windowMask | PAINT_WINDOW_WITH_OFFSET_MASK); } else { (*screen->paintWindow) (w, &w->paint, transform, clip, windowMask); } } if (walk.fini) (*walk.fini) (screen, &walk); /* paint cursors */ for (c = screen->cursors; c; c = c->next) (*screen->paintCursor) (c, transform, tmpRegion, 0); }
bool CompRegion::operator== (const CompRegion &c) const { return XEqualRegion (handle (), c.handle ()); }
Bool apc_region_equals( Handle self, Handle other_region) { return XEqualRegion( REGION, GET_REGION(other_region)->region); }
/* * Loop on outputDevs and add the extents as edges * Note that left side is a right edge, right side a left edge, * top side a bottom edge and bottom side a top edge, * since they will be snapped as the right/left/bottom/top edge of a window */ static void snapUpdateScreenEdges(CompWindow * w) { CompWindow *c = NULL; Edge *e = NULL, *next = NULL; SNAP_WINDOW(w); Region edgeRegion, resultRegion; XRectangle rect; Bool remove = FALSE; XRectangle area; int i; for (i = 0; i < w->screen->nOutputDev; i++) { snapScreenGetOutputDevRect(w->screen, i, &area); snapAddEdge(&sw->edges, &sw->reverseEdges, 0, area.y, area.x, area.x + area.width - 1, BottomEdge, TRUE); snapAddEdge(&sw->edges, &sw->reverseEdges, 0, area.y + area.height, area.x, area.x + area.width - 1, TopEdge, TRUE); snapAddEdge(&sw->edges, &sw->reverseEdges, 0, area.x, area.y, area.y + area.height - 1, RightEdge, TRUE); snapAddEdge(&sw->edges, &sw->reverseEdges, 0, area.x + area.width, area.y, area.y + area.height - 1, LeftEdge, TRUE); } // Drop screen edges parts that are under struts, basically apply the // same strategy than for windows edges visibility for (c = w->screen->windows; c; c = c->next) { if (c == w || !c->struts) continue; for (e = sw->edges; e; e = next) { if (!e->screenEdge) { next = e->next; continue; } switch (e->type) { case LeftEdge: case RightEdge: rect.x = e->position; rect.y = e->start; rect.width = 1; rect.height = e->end - e->start; break; case TopEdge: case BottomEdge: default: rect.x = e->start; rect.y = e->position; rect.width = e->end - e->start; rect.height = 1; } edgeRegion = XCreateRegion(); resultRegion = XCreateRegion(); XUnionRectWithRegion(&rect, edgeRegion, edgeRegion); XSubtractRegion(edgeRegion, c->region, resultRegion); if (XEmptyRegion(resultRegion)) remove = TRUE; else if (!XEqualRegion(edgeRegion, resultRegion)) { snapAddRegionEdges(sw, e, resultRegion); remove = TRUE; } next = e->next; if (remove) { if (e->prev == NULL) sw->edges = e->next; if (e->next == NULL) sw->reverseEdges = e->prev; snapRemoveEdge(e); remove = FALSE; } XDestroyRegion(resultRegion); XDestroyRegion(edgeRegion); } } }
/* * Detect visible windows edges */ static void snapUpdateWindowsEdges(CompWindow * w) { CompWindow *c = NULL; Edge *e = NULL, *next = NULL; SNAP_WINDOW(w); Region edgeRegion, resultRegion; XRectangle rect; Bool remove = FALSE; // First add all the windows c = w->screen->windows; while (c) { // Just check that we're not trying to snap to current window, // that the window is not invisible and of a valid type if (c == w || !isSnapWindow(c)) { c = c->next; continue; } snapAddEdge(&sw->edges, &sw->reverseEdges, c->id, WIN_Y(c), WIN_X(c), WIN_X(c) + WIN_W(c), TopEdge, FALSE); snapAddEdge(&sw->edges, &sw->reverseEdges, c->id, WIN_Y(c) + WIN_H(c), WIN_X(c), WIN_X(c) + WIN_W(c), BottomEdge, FALSE); snapAddEdge(&sw->edges, &sw->reverseEdges, c->id, WIN_X(c), WIN_Y(c), WIN_Y(c) + WIN_H(c), LeftEdge, FALSE); snapAddEdge(&sw->edges, &sw->reverseEdges, c->id, WIN_X(c) + WIN_W(c), WIN_Y(c), WIN_Y(c) + WIN_H(c), RightEdge, FALSE); c = c->next; } // Now strip invisible edges // Loop through all the windows stack, and through all the edges // If an edge has been passed, check if it's in the region window, // if the edge is fully under the window, drop it, or if it's only // partly covered, cut it/split it in one/two smaller visible edges for (c = w->screen->windows; c; c = c->next) { if (c == w || !isSnapWindow(c)) continue; for (e = sw->edges; e; e = next) { if (!e->passed) { if (e->id == c->id) e->passed = TRUE; next = e->next; continue; } switch (e->type) { case LeftEdge: case RightEdge: rect.x = e->position; rect.y = e->start; rect.width = 1; rect.height = e->end - e->start; break; case TopEdge: case BottomEdge: default: rect.x = e->start; rect.y = e->position; rect.width = e->end - e->start; rect.height = 1; } // If the edge is in the window region, remove it, // if it's partly in the region, split it edgeRegion = XCreateRegion(); resultRegion = XCreateRegion(); XUnionRectWithRegion(&rect, edgeRegion, edgeRegion); XSubtractRegion(edgeRegion, c->region, resultRegion); if (XEmptyRegion(resultRegion)) remove = TRUE; else if (!XEqualRegion(edgeRegion, resultRegion)) { snapAddRegionEdges(sw, e, resultRegion); remove = TRUE; } next = e->next; if (remove) { if (e->prev == NULL) sw->edges = e->next; if (e->next == NULL) sw->reverseEdges = e->prev; snapRemoveEdge(e); remove = FALSE; } XDestroyRegion(resultRegion); XDestroyRegion(edgeRegion); } } }