/*ARGSUSED*/
static void
XawScrollbarRedisplay(Widget gw, XEvent *event, Region region)
{
    ScrollbarWidget w = (ScrollbarWidget)gw;
    int x, y;
    unsigned int width, height;

    if (Superclass->core_class.expose)
	(*Superclass->core_class.expose)(gw, event, region);

    if (w->scrollbar.orientation == XtorientHorizontal) {
	x = w->scrollbar.topLoc;
	y = 1;
	width = w->scrollbar.shownLength;
	height = XtHeight(w) - 2;
    }
    else {
	x = 1;
	y = w->scrollbar.topLoc;
	width = XtWidth(w) - 2;
	height = w->scrollbar.shownLength;
    }

    if (region == NULL ||
	XRectInRegion(region, x, y, width, height) != RectangleOut) {
	/* Forces entire thumb to be painted */
	w->scrollbar.topLoc = -(w->scrollbar.length + 1);
	PaintThumb(w);
    }
}
Ejemplo n.º 2
0
bool
CompRegion::intersects (const CompRect &r) const
{
    int result;
    result = XRectInRegion (handle (), r.x (), r.y (), r.width (), r.height ());

    return result != RectangleOut;
}
Ejemplo n.º 3
0
static PyObject *
region_RectInRegion(PaxRegionObject *self, PyObject *args)
{
    int x, y;
    unsigned int width, height;
    if (!PyArg_ParseTuple(args, "iiii", &x, &y, &width, &height))
	return NULL;
    return PyInt_FromLong(XRectInRegion(self->region, x, y, width, height));
}
Ejemplo n.º 4
0
bool
CompRegion::contains (int x, int y, int width, int height) const
{
    int result;

    result = XRectInRegion (handle (), x, y, width, height);

    return result == RectangleIn;
}
Ejemplo n.º 5
0
bool
CompRegion::contains (const CompRect &r) const
{
    int result;

    result = XRectInRegion (handle (), r.x (), r.y (), r.width (), r.height ());

    return result == RectangleIn;
}
Ejemplo n.º 6
0
// Return true if region contains rectangle
// Contributed by Daniel Gehriger <*****@*****.**>.
FXbool FXRegion::contains(FXint x,FXint y,FXint w,FXint h) const {
#ifdef WIN32
  RECT rect;
  rect.left   = x;
  rect.top    = y;
  rect.right  = x + w;
  rect.bottom = y + h;
  return region && RectInRegion((HRGN)region,&rect);
#else
  return XRectInRegion((Region)region,x,y,w,h);
#endif
  }
Ejemplo n.º 7
0
/* lpStruct - Pointer to RECT */
DWORD
DrvRegionsRectInRegion(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct)
{
	LPRECT lpRect;

	if (!(lpRect = (LPRECT)lpStruct))
		return (DWORD)FALSE;
	return (DWORD)XRectInRegion((Region)dwParm1,
			lpRect->left,
			lpRect->top,
			lpRect->right-lpRect->left,
			lpRect->bottom-lpRect->top);
}
Ejemplo n.º 8
0
EAPI Eina_Bool
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
{
   if (!region || !rect)
      return EINA_FALSE;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   return XRectInRegion((Region)region,
                        rect->x,
                        rect->y,
                        rect->width,
                        rect->height) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_rect_contain */
Ejemplo n.º 9
0
wxRegionContain wxRegion::DoContainsRect(const wxRect& r) const
{
    if (!m_refData)
        return wxOutRegion;

    int res = XRectInRegion(M_REGIONDATA->m_region, r.x, r.y, r.width, r.height);
    switch (res)
    {
        case RectangleIn:   return wxInRegion;
        case RectangleOut:  return wxOutRegion;
        case RectanglePart: return wxPartRegion;
    }
    return wxOutRegion;
}
Ejemplo n.º 10
0
int
apc_region_rect_inside( Handle self, Rect r)
{
	int res = XRectInRegion(
		REGION,
		r. left, HEIGHT - r. bottom - 1,
		r. right - r.left + 1, r.top - r.bottom + 1
	);
	switch (res) {
	case RectangleIn:   return rgnInside;
	case RectanglePart: return rgnPartially;
	default:	    return rgnOutside;
	}
}
Ejemplo n.º 11
0
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) const
{
    if (!m_refData)
        return wxOutRegion;

#if 0
    int res = XRectInRegion( M_REGIONDATA->m_region, x, y, w, h );
    switch (res)
    {
        case RectangleIn:   return wxInRegion;
        case RectangleOut:  return wxOutRegion;
        case RectanglePart: return wxPartRegion;
    }
    return wxOutRegion;
#endif
}
Ejemplo n.º 12
0
// does this rectangle intersect current clip?
int Fl_Device::not_clipped(int x, int y, int w, int h)
{
    fl_transform(x,y);
    // first check against the window so we get rid of coordinates
    // outside the 16-bit range the X/Win32 calls take:
    if (x+w <= 0 || y+h <= 0 || x >= Fl_Window::current()->w()
        || y >= Fl_Window::current()->h()) return 0;
    Region r = rstack[rstackptr];
    if (!r) return 1;
#ifndef _WIN32
    return XRectInRegion(r, x, y, w, h);
#else
    //RECT rect;
    //rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
    //return RectInRegion(r,&rect);
    // The win32 API makes no distinction between partial and complete
    // intersection, so we have to check for partial intersection ourselves.
    int ret = 0;
    Region rr = XRectangleRegion(x,y,w,h);
    Region temp = CreateRectRgn(0,0,0,0);
                                 // disjoint
    if (CombineRgn(temp, rr, r, RGN_AND) == NULLREGION)
    {
        ret = 0;
    }                            // complete
    else if (EqualRgn(temp, rr))
    {
        ret = 1;
    }                            // parital intersection
    else
    {
        ret = 2;
    }
    DeleteObject(temp);
    DeleteObject(rr);
    return ret;
#endif
}
Ejemplo n.º 13
0
/************************************************************************
 *
 *  Redisplay
 *     General redisplay function called on exposure events.
 *
 ************************************************************************/
static void 
Redisplay(
        Widget wid,
        XEvent *event,
        Region region )
{
   XmFrameWidget fw = (XmFrameWidget) wid;
   Widget title_area = fw->frame.title_area;

   DrawShadow(fw);

   /* since the shadow may have screw up the gadget title, while this
      one won't get refresh, we have to redraw it manually */

   if (title_area && XmIsGadget(title_area) && XtIsManaged(title_area))
   {
      XClearArea (XtDisplay(fw), XtWindow(fw),
		  title_area->core.x, title_area->core.y,
		  title_area->core.width, title_area->core.height,
		  False);
      if (region && !XRectInRegion (region, title_area->core.x,
	title_area->core.y, title_area->core.width, title_area->core.height))
      {
	 XtExposeProc expose;

	 _XmProcessLock();
	 expose = title_area->core.widget_class->core_class.expose;
	 _XmProcessUnlock();

         if (expose)
	    (*expose)(title_area, event, NULL);
      }
   }

   XmeRedisplayGadgets( (Widget) fw, event, region);
}
Ejemplo n.º 14
0
static void
x_gram_draw(Display *dpy, Window w, x_gram *gram, Region region)
{
   int i;
   GC gc;
   XGCValues gcvals;
   xblock *xb;
#ifdef X_HAVE_UTF8_STRING
   XmbTextItem text;
#else
   XwcTextItem text;
#endif
   int startblock, endblock, startpixel = 0, endpixel = 0;
   
   gc = XCreateGC(dpy, w, 0, &gcvals);
   XSetRegion(dpy, gc, region);
 
   if ((markgram == gram) && (STARTBLOCK != -1) && (ENDBLOCK != -1)) {
      if (xmarkSecond() == XMARK_END_BOUND) {
         startblock = STARTBLOCK;
         endblock = ENDBLOCK;
         startpixel = STARTPIXEL;
         endpixel = ENDPIXEL;
      } else {
         startblock = ENDBLOCK;
         endblock = STARTBLOCK;
         startpixel = ENDPIXEL;
         endpixel = STARTPIXEL;
      }
   } else {
      startblock = -1;
      endblock = -1;
   }

   for (i=0, xb = gram->blocks; i < gram->numblocks; i++, xb++) {
      if (XRectInRegion(region, xb->x1, xb->y1, xb->x2 - xb->x1,
                        xb->y2 - xb->y1) != RectangleOut) {
         if (i == startblock) {
            if (i == endblock) {
                SetFG(dpy, gc, gram->bgcolor);
                XFillRectangle(dpy, w, gc, xb->x1, xb->y1, startpixel,
                               xb->y2 - xb->y1);
                SetFG(dpy, gc, xb->fgcolor);
                XFillRectangle(dpy, w, gc, xb->x1 + startpixel, xb->y1,
                               endpixel - startpixel, xb->y2 - xb->y1);
                SetFG(dpy, gc, gram->bgcolor);
                XFillRectangle(dpy, w, gc, xb->x1 + endpixel, xb->y1,
                               xb->x2 - xb->x1 - endpixel, xb->y2 - xb->y1);
            } else {
                SetFG(dpy, gc, gram->bgcolor);
                XFillRectangle(dpy, w, gc, xb->x1, xb->y1, startpixel,
                              xb->y2 - xb->y1);
                SetFG(dpy, gc, xb->fgcolor);
                XFillRectangle(dpy, w, gc, xb->x1 + startpixel, xb->y1,
                               xb->x2 - xb->x1 - startpixel,xb->y2 - xb->y1);
            }
         } else if (i == endblock) {
             SetFG(dpy, gc, xb->fgcolor);
             XFillRectangle(dpy, w, gc, xb->x1, xb->y1, endpixel,
                            xb->y2 - xb->y1);
             SetFG(dpy, gc, gram->bgcolor);
             XFillRectangle(dpy, w, gc, xb->x1 + endpixel, xb->y1,
                            xb->x2 - xb->x1 - endpixel, xb->y2 - xb->y1);
         } else {
             if (startblock < i && i < endblock) {
                 SetFG(dpy, gc, xb->fgcolor);
             } else {
                 SetFG(dpy, gc, gram->bgcolor);
             }
             XFillRectangle(dpy, w, gc, xb->x1, xb->y1, xb->x2 - xb->x1,
                            xb->y2 - xb->y1);
         }
      }
   }

   gcvals.function = GXxor;
   XChangeGC(dpy, gc, GCFunction, &gcvals);

   for (i=0, xb = gram->blocks; i < gram->numblocks; i++, xb++) {
      if (XRectInRegion(region, xb->x1, xb->y1, xb->x2 - xb->x1,
                        xb->y2 - xb->y1) != RectangleOut) {
          SetFG(dpy, gc, gram->bgcolor ^ xb->fgcolor);
#ifdef X_HAVE_UTF8_STRING
          text.chars = xb->wstr;
#else
          text.chars = (wchar_t *)xb->wstr;
#endif
          text.nchars = xb->wlen;
          text.delta = 0;
          text.font_set = xb->font;
#ifdef X_HAVE_UTF8_STRING
          Xutf8DrawText(dpy, w, gc, xb->x, xb->y, &text, 1);
#else
          XwcDrawText(dpy, w, gc, xb->x, xb->y, &text, 1);
#endif
     }
   }

   XFreeGC(dpy, gc);
}
Ejemplo n.º 15
0
int TkRectInRegion (TkRegion r, int a, int b, unsigned int c, unsigned int d)
{
    return XRectInRegion((Region) r, a, b, c, d);
}
Ejemplo n.º 16
0
// return rectangle surrounding intersection of this rectangle and clip,
int Fl_Device::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H)
{
    Region r = rstack[rstackptr];
    if (!r) {X = x; Y = y; W = w; H = h; return 0;}
    // Test against the window to get 16-bit values (this is only done if
    // a clip region exists as otherwise it breaks fl_push_no_clip()):
    int ret = 1;
    int dx = x; 
	int dy = y; 
	fl_transform(x,y); 
	dx = x-dx; 
	dy = y-dy;
    if (x < 0) { w += x; x = 0; ret = 2; }
    int t = Fl_Window::current()->w(); 
	if (x+w > t) { w = t-x; ret = 2; }
    if (y < 0) { h += y; y = 0; ret = 2; }
    t = Fl_Window::current()->h(); 
	if (y+h > t) { h = t-y; ret = 2; }
    
	// check for total clip (or for empty rectangle):
    if (w <= 0 || h <= 0) { W = H = 0; return 0; }

#ifndef _WIN32
    switch (XRectInRegion(r, x, y, w, h))
    {
        case 0:                  // completely outside
            W = H = 0;
            return 0;
        case 1:                  // completely inside:
            X = x-dx;
            Y = y-dy;
            W = w; H = h;
            return ret;
        default:                 // partial:
        {
            Region rr = XRectangleRegion(x,y,w,h);
            Region temp = XCreateRegion();
            XIntersectRegion(r, rr, temp);
            XRectangle rect;
            XClipBox(temp, &rect);
            X = rect.x-dx; Y = rect.y-dy; W = rect.width; H = rect.height;
            XDestroyRegion(temp);
            XDestroyRegion(rr);
            return 2;
        }
    }
#else
    // The win32 API makes no distinction between partial and complete
    // intersection, so we have to check for partial intersection ourselves.
    // However, given that the regions may be composite, we have to do
    // some voodoo stuff...
    Region rr = XRectangleRegion(x,y,w,h);
    Region temp = CreateRectRgn(0,0,0,0);
	
    if (CombineRgn(temp, rr, r, RGN_AND) == NULLREGION) {
		// disjoint
        W = H = 0;
        ret = 0;
    }
    else if (EqualRgn(temp, rr)) {
		// complete
        X = x-dx;
        Y = y-dy;
        W = w; H = h;
        // ret = ret
    } else {
		// parital intersection
        RECT rect;
        GetRgnBox(temp, &rect);
        X = rect.left-dx; Y = rect.top-dy;
        W = rect.right - rect.left; H = rect.bottom - rect.top;
        ret = 2;
    }
    DeleteObject(temp);
    DeleteObject(rr);
    return ret;
#endif
}