예제 #1
0
파일: Command.c 프로젝트: aosm/X11
static Region 
HighlightRegion(CommandWidget cbw)
{
    static Region outerRegion = NULL, innerRegion, emptyRegion;
    XRectangle rect;

    if (cbw->command.highlight_thickness == 0 ||
        cbw->command.highlight_thickness > Min(XtWidth(cbw), XtHeight(cbw)) / 2)
	return (NULL);

    if (outerRegion == NULL) {
	/* save time by allocating scratch regions only once. */
	outerRegion = XCreateRegion();
	innerRegion = XCreateRegion();
	emptyRegion = XCreateRegion();
    }

    rect.x = rect.y = 0;
    rect.width = XtWidth(cbw);
    rect.height = XtHeight(cbw);
    XUnionRectWithRegion(&rect, emptyRegion, outerRegion);
    rect.x = rect.y = cbw->command.highlight_thickness;
    rect.width -= cbw->command.highlight_thickness * 2;
    rect.height -= cbw->command.highlight_thickness * 2;
    XUnionRectWithRegion(&rect, emptyRegion, innerRegion);
    XSubtractRegion(outerRegion, innerRegion, outerRegion);

    return (outerRegion);
}
예제 #2
0
bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
#if 0
    // work around for XUnionRectWithRegion() bug: taking a union with an empty
    // rect results in an empty region (at least XFree 3.3.6 and 4.0 have this
    // problem)
    if ( !width || !height )
        return TRUE;

    XRectangle rect;
    rect.x = x;
    rect.y = y;
    rect.width = width;
    rect.height = height;
    
    if (!m_refData)
    {
        m_refData = new wxRegionRefData();
        M_REGIONDATA->m_region = XCreateRegion();
        XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
    }
    else
    {
        AllocExclusive();

        XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
    }
#endif
    return TRUE;
}
/* Generates a region containing free space (here the
 * active window counts as free space). The region argument
 * is the start-region (ie: the output dev).
 */
static Region
smartputEmptyRegion (CompWindow *window,
		     Region     region)
{
    CompScreen *s = window->screen;
    CompWindow *w;
    Region     newRegion, tmpRegion;
    XRectangle tmpRect;

    newRegion = XCreateRegion ();
    if (!newRegion)
	return NULL;

    tmpRegion = XCreateRegion ();
    if (!tmpRegion)
    {
	XDestroyRegion (newRegion);
	return NULL;
    }

    XUnionRegion (region, newRegion, newRegion);

    for (w = s->windows; w; w = w->next)
    {
	EMPTY_REGION (tmpRegion);
        if (w->id == window->id)
            continue;

        if (w->invisible || w->hidden || w->minimized)
            continue;

	if (w->wmType & CompWindowTypeDesktopMask)
	    continue;

	if (w->wmType & CompWindowTypeDockMask)
	{
	    if (w->struts)
	    {
		XUnionRectWithRegion (&w->struts->left, tmpRegion, tmpRegion);
		XUnionRectWithRegion (&w->struts->right, tmpRegion, tmpRegion);
		XUnionRectWithRegion (&w->struts->top, tmpRegion, tmpRegion);
		XUnionRectWithRegion (&w->struts->bottom, tmpRegion, tmpRegion);
		XSubtractRegion (newRegion, tmpRegion, newRegion);
	    }
	    continue;
	}

	tmpRect.x = w->serverX - w->input.left;
	tmpRect.y = w->serverY - w->input.top;
	tmpRect.width  = w->serverWidth + w->input.right + w->input.left;
	tmpRect.height = w->serverHeight + w->input.top +
	                 w->input.bottom;
	XUnionRectWithRegion (&tmpRect, tmpRegion, tmpRegion);
	XSubtractRegion (newRegion, tmpRegion, newRegion);
    }

    XDestroyRegion (tmpRegion);

    return newRegion;
}
예제 #4
0
void X11Factory::getMonitorInfo( const GenericWindow &rWindow,
                                 int* p_x, int* p_y,
                                 int* p_width, int* p_height ) const
{
    // initialize to default geometry
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();

    // Use Xinerama to determine the monitor where the video
    // mostly resides (biggest surface)
    Display *pDisplay = m_pDisplay->getDisplay();
    Window wnd = (Window)rWindow.getOSHandle();
    Window root = DefaultRootWindow( pDisplay );
    Window child_wnd;

    int x, y;
    unsigned int w, h, border, depth;
    XGetGeometry( pDisplay, wnd, &root, &x, &y, &w, &h, &border, &depth );
    XTranslateCoordinates( pDisplay, wnd, root, 0, 0, &x, &y, &child_wnd );

    int num;
    XineramaScreenInfo* info = XineramaQueryScreens( pDisplay, &num );
    if( info )
    {
        Region reg1 = XCreateRegion();
        XRectangle rect1 = { (short)x, (short)y, (unsigned short)w, (unsigned short)h };
        XUnionRectWithRegion( &rect1, reg1, reg1 );

        unsigned int surface = 0;
        for( int i = 0; i < num; i++ )
        {
            Region reg2 = XCreateRegion();
            XRectangle rect2 = { info[i].x_org, info[i].y_org,
                                 (unsigned short)info[i].width, (unsigned short)info[i].height };
            XUnionRectWithRegion( &rect2, reg2, reg2 );

            Region reg = XCreateRegion();
            XIntersectRegion( reg1, reg2, reg );
            XRectangle rect;
            XClipBox( reg, &rect );
            unsigned int surf = rect.width * rect.height;
            if( surf > surface )
            {
               surface = surf;
               *p_x = info[i].x_org;
               *p_y = info[i].y_org;
               *p_width = info[i].width;
               *p_height = info[i].height;
            }
            XDestroyRegion( reg );
            XDestroyRegion( reg2 );
        }
        XDestroyRegion( reg1 );
        XFree( info );
    }
}
static Tk_RestrictAction
ScrollRestrictProc(
    ClientData arg,
    XEvent *eventPtr)
{
    ScrollInfo *info = (ScrollInfo *) arg;
    XRectangle rect;

    /*
     * Defer events which aren't for the specified window.
     */

    if (info->done || (eventPtr->xany.display != info->display)
	    || (eventPtr->xany.window != info->window)) {
	return TK_DEFER_EVENT;
    }

    if (eventPtr->type == NoExpose) {
	info->done = 1;
    } else if (eventPtr->type == GraphicsExpose) {
	rect.x = eventPtr->xgraphicsexpose.x;
	rect.y = eventPtr->xgraphicsexpose.y;
	rect.width = eventPtr->xgraphicsexpose.width;
	rect.height = eventPtr->xgraphicsexpose.height;
	XUnionRectWithRegion(&rect, (Region) info->region,
		(Region) info->region);

	if (eventPtr->xgraphicsexpose.count == 0) {
	    info->done = 1;
	}
    } else if (eventPtr->type == Expose) {
	/*
	 * This case is tricky. This event was already queued before the
	 * XCopyArea was issued. If this area overlaps the area being copied,
	 * then some of the copied area may be invalid. The easiest way to
	 * handle this case is to mark both the original area and the shifted
	 * area as damaged.
	 */

	rect.x = eventPtr->xexpose.x;
	rect.y = eventPtr->xexpose.y;
	rect.width = eventPtr->xexpose.width;
	rect.height = eventPtr->xexpose.height;
	XUnionRectWithRegion(&rect, (Region) info->region,
		(Region) info->region);
	rect.x += info->dx;
	rect.y += info->dy;
	XUnionRectWithRegion(&rect, (Region) info->region,
		(Region) info->region);
    } else {
	return TK_DEFER_EVENT;
    }
    return TK_DISCARD_EVENT;
}
예제 #6
0
static void
update_wireframe_window (MetaDisplay         *display,
                         Window               xwindow,
                         const MetaRectangle *rect)
{
  XMoveResizeWindow (display->xdisplay,
                     xwindow,
                     rect->x, rect->y,
                     rect->width, rect->height);

#define OUTLINE_WIDTH 3

  if (rect->width > OUTLINE_WIDTH * 2 &&
      rect->height > OUTLINE_WIDTH * 2)
    {
      XRectangle xrect;
      Region inner_xregion;
      Region outer_xregion;

      inner_xregion = XCreateRegion ();
      outer_xregion = XCreateRegion ();

      xrect.x = 0;
      xrect.y = 0;
      xrect.width = rect->width;
      xrect.height = rect->height;

      XUnionRectWithRegion (&xrect, outer_xregion, outer_xregion);

      xrect.x += OUTLINE_WIDTH;
      xrect.y += OUTLINE_WIDTH;
      xrect.width -= OUTLINE_WIDTH * 2;
      xrect.height -= OUTLINE_WIDTH * 2;

      XUnionRectWithRegion (&xrect, inner_xregion, inner_xregion);

      XSubtractRegion (outer_xregion, inner_xregion, outer_xregion);

      XShapeCombineRegion (display->xdisplay, xwindow,
                           ShapeBounding, 0, 0, outer_xregion, ShapeSet);

      XDestroyRegion (outer_xregion);
      XDestroyRegion (inner_xregion);
    }
  else
    {
      /* Unset the shape */
      XShapeCombineMask (display->xdisplay, xwindow,
                         ShapeBounding, 0, 0, None, ShapeSet);
    }
}
예제 #7
0
bool wxRegion::DoUnionWithRect(const wxRect& r)
{
    // work around for XUnionRectWithRegion() bug: taking a union with an empty
    // rect results in an empty region (at least XFree 3.3.6 and 4.0 have this
    // problem)
    if ( r.IsEmpty() )
        return true;

    XRectangle rect;
    rect.x = (short)r.x;
    rect.y = (short)r.y;
    rect.width = (unsigned short)r.width;
    rect.height = (unsigned short)r.height;

    if (!m_refData)
    {
        m_refData = new wxRegionRefData();
        M_REGIONDATA->m_region = XCreateRegion();
    }
    else
    {
        AllocExclusive();
    }

    XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );

    return true;
}
예제 #8
0
파일: X_gram.c 프로젝트: andersk/zephyr
void
x_gram_expose(Display *dpy,
              Window w,
              x_gram *gram,
              XExposeEvent *event)
{
   static Region region;
   static int partregion;
   XRectangle rect;

   rect.x = (short) event->x;
   rect.y = (short) event->y;
   rect.width = (unsigned short) event->width;
   rect.height = (unsigned short) event->height;

#ifdef MARK_DEBUG
   printf("----- xeventExpose:\nx=%d y=%d w=%d h=%d\n-----",
          event->x,event->y,event->width,event->height);
#endif

   if (! partregion) {
      region=XCreateRegion();
      partregion = 1;
   }

   if (rect.width && rect.height) XUnionRectWithRegion(&rect,region,region);

   if (event->count == 0) {
      x_gram_draw(dpy,w,gram,region);
      partregion = 0;
      XDestroyRegion(region);
   }
}
static void
fxDodgeProcessSubject (CompWindow *wCur,
		       Region wRegion,
		       Region dodgeRegion,
		       Bool alwaysInclude)
{
    XRectangle rect;
    rect.x = WIN_X(wCur);
    rect.y = WIN_Y(wCur);
    rect.width = WIN_W(wCur);
    rect.height = WIN_H(wCur);
    Region wCurRegion = XCreateRegion();
    if (!wCurRegion)
	return;

    XUnionRectWithRegion(&rect, &emptyRegion, wCurRegion);
    if (!alwaysInclude)
    {
	Region intersectionRegion = XCreateRegion();
	if (intersectionRegion)
	{
	    XIntersectRegion(wRegion, wCurRegion,
			     intersectionRegion);
	    if (!XEmptyRegion(intersectionRegion))
		XUnionRegion(dodgeRegion, wCurRegion, dodgeRegion);
	    XDestroyRegion (intersectionRegion);
	}
    }
    else
	XUnionRegion(dodgeRegion, wCurRegion, dodgeRegion);

    XDestroyRegion (wCurRegion);
}
예제 #10
0
// Construct new region from rectangle rect
FXRegion::FXRegion(const FXRectangle& rect){
#ifdef WIN32
  region=(void*)CreateRectRgn(rect.x,rect.y,rect.x+rect.w,rect.y+rect.h);
#else
  region=XCreateRegion();
  XUnionRectWithRegion((XRectangle*)&rect,(Region)region,(Region)region);
#endif
  }
예제 #11
0
// Missing X call: (is this the fastest way to init a 1-rectangle region?)
// MSWindows equivalent exists, implemented inline in win32.h
Region XRectangleRegion(int x, int y, int w, int h)
{
    XRectangle R;
    R.x = x; R.y = y; R.width = w; R.height = h;
    Region r = XCreateRegion();
    XUnionRectWithRegion(&R, r, r);
    return r;
}
예제 #12
0
// Construct rectangle region
FXRegion::FXRegion(FXint x,FXint y,FXint w,FXint h){
#ifdef WIN32
  region=(void*)CreateRectRgn(x,y,x+w,y+h);
#else
  XRectangle r;
  r.x=x; r.y=y; r.width=w; r.height=h;
  region=XCreateRegion();
  XUnionRectWithRegion(&r,(Region)region,(Region)region);
#endif
  }
예제 #13
0
파일: viewer-x.c 프로젝트: nihed/magnetism
gpointer
x_view_display (gpointer instance,
		gpointer surface,
		gpointer win,
		int      width,
		int      height,
		gpointer state)
{
  XViewer *x = (XViewer *) instance;
  Pixmap pixmap = (Pixmap) surface;
  Window window = (Window) win;
  XEvent xev;
  XRectangle  r;
  Region update_region;
  unsigned int quit_keycode;
  unsigned int borders_keycode;
  gboolean show_borders = FALSE;

  if (state)
    show_borders = GPOINTER_TO_UINT (state) == 0xdeadbeef;

  /* force a full redraw */
  update_region = XCreateRegion ();
  r.x = 0;
  r.y = 0;
  r.width = width;
  r.height = height;
  XUnionRectWithRegion (&r, update_region, update_region);

  borders_keycode = XKeysymToKeycode(x->display, 'B');
  quit_keycode = XKeysymToKeycode(x->display, 'Q');

  while (1)
    {
      if (!XPending (x->display) && update_region)
	update (x->display, pixmap, window, &update_region);
	
      XNextEvent (x->display, &xev);
      switch (xev.xany.type) {
      case KeyPress:
	if (xev.xkey.keycode == quit_keycode)
	  return NULL;
	else if (xev.xkey.keycode == borders_keycode)
	  {
	    show_borders = !show_borders;
	    return GUINT_TO_POINTER (show_borders ? 0xdeadbeef : 0xbe);
	  }
	break;
      case Expose:
	expose (&xev.xexpose, &update_region);
	break;
      }
    }
}
예제 #14
0
void sUpdateWindow(const sRect &r)
{
  if(r.x1 > r.x0 && r.y1 > r.y0)
  {
    XRectangle rect;
    rect.x = r.x0;
    rect.y = r.y0;
    rect.width = r.x1-r.x0;
    rect.height = r.y1-r.y0;
    XUnionRectWithRegion(&rect,UpdateRegion,UpdateRegion);
  }
}
예제 #15
0
void X11Graphics::drawGraphics( const OSGraphics &rGraphics, int xSrc,
                                int ySrc, int xDest, int yDest, int width,
                                int height )
{
    const X11Graphics& rGraph = (X11Graphics&)rGraphics;

    // check and adapt to source if needed
    if( !checkBoundaries( 0, 0, rGraph.getWidth(), rGraph.getHeight(),
                          xSrc, ySrc, width, height ) )
    {
        msg_Err( getIntf(), "nothing to draw from graphics source" );
        return;
    }

    // check destination
    if( !checkBoundaries( 0, 0, m_width, m_height,
                          xDest, yDest, width, height ) )
    {
        msg_Err( getIntf(), "out of reach destination! pls, debug your skin" );
        return;
    }

    // Source drawable
    Drawable src = rGraph.getDrawable();

    // Create the mask for transparency
    Region voidMask = XCreateRegion();
    XRectangle rect;
    rect.x = xSrc;
    rect.y = ySrc;
    rect.width = width;
    rect.height = height;
    Region clipMask = XCreateRegion();
    XUnionRectWithRegion( &rect, voidMask, clipMask );
    Region mask = XCreateRegion();
    XIntersectRegion( rGraph.getMask(), clipMask, mask );
    XDestroyRegion( clipMask );
    XDestroyRegion( voidMask );
    XOffsetRegion( mask, xDest - xSrc, yDest - ySrc );

    // Copy the pixmap
    XSetRegion( XDISPLAY, m_gc, mask );
    XCopyArea( XDISPLAY, src, m_pixmap, m_gc, xSrc, ySrc, width, height,
               xDest, yDest );

    // Add the source mask to the mask of the graphics
    Region newMask = XCreateRegion();
    XUnionRegion( m_mask, mask, newMask );
    XDestroyRegion( mask );
    XDestroyRegion( m_mask );
    m_mask = newMask;
}
예제 #16
0
파일: apc_region.c 프로젝트: dk/Prima
static Bool
rgn_rect(Handle self, Box r)
{
	XRectangle xr;
	REGION = XCreateRegion();
	xr. x = r. x;
	xr. y = 0;
	xr. width  = r. width;
	xr. height = r. height;
	XUnionRectWithRegion( &xr, REGION, REGION);
	HEIGHT = r.y + r.height;
	return true;
}
예제 #17
0
void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
    XRectangle rect;
    rect.x = (short)x;
    rect.y = (short)y;
    rect.width = (unsigned short)w;
    rect.height = (unsigned short)h;

    m_refData = new wxRegionRefData();

    M_REGIONDATA->m_region = XCreateRegion();
    XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
}
예제 #18
0
파일: clipping.c 프로젝트: tomby42/prg-xws
/*
 * Kreslení
 */
static void expose(XExposeEvent *event)
{
    Region region, region1, region2;
    XRectangle rect;
    
    if(event->count > 0)
	return; /* Kreslit jen po poslední události v øadì */
  
    XDrawArc(display, topwin, my_gc, 20, 20, topwin_w - 40, topwin_h - 40,
	     0, 360 * 64);
    
    region = XCreateRegion();
    region1 = XCreateRegion();
    region2 = XCreateRegion();
    rect.x = rect.y = 0;
    rect.width = 100;
    rect.height = topwin_w - 60;
    XUnionRectWithRegion(&rect, region, region1);
    rect.width = 20;
    rect.height = 10;
    XUnionRectWithRegion(&rect, region2, region);
    XOffsetRegion(region, 50, 100);
    XSubtractRegion(region1, region, region2);
    XDestroyRegion(region);
    region = XCreateRegion();
    rect.width = 100;
    rect.height = 30;
    XUnionRectWithRegion(&rect, region, region1);
    XOffsetRegion(region1, (int)topwin_w - 120, -30 + ((int)topwin_h - 40) / 2);
    XUnionRegion(region1, region2, region);
    XSetRegion(display, my_gc, region);
    XDestroyRegion(region);
    XDestroyRegion(region1);
    XDestroyRegion(region2);
    XSetClipOrigin(display, my_gc, 20, 20);
    XFillArc(display, topwin, my_gc, 20, 20, topwin_w - 40, topwin_h - 40,
	     0, 360 * 64);
    XSetClipMask(display, my_gc, None); /* Zru¹it oøezávání */
}
예제 #19
0
static Region sRectToRegion(const sRect &r)
{
  Region newRegion = XCreateRegion();
  
  XRectangle rect;
  rect.x = r.x0;
  rect.y = r.y0;
  rect.width = r.x1-r.x0;
  rect.height = r.y1-r.y0;
  XUnionRectWithRegion(&rect,EmptyRegion,newRegion);
  
  return newRegion;
}
예제 #20
0
inline void X11Graphics::addVSegmentInRegion( Region &rMask, int yStart,
                                              int yEnd, int x )
{
    XRectangle rect;
    rect.x = x;
    rect.y = yStart;
    rect.width = 1;
    rect.height = yEnd - yStart;
    Region newMask = XCreateRegion();
    XUnionRectWithRegion( &rect, rMask, newMask );
    XDestroyRegion( rMask );
    rMask = newMask;
}
예제 #21
0
파일: apc_region.c 프로젝트: dk/Prima
static Bool
rgn_empty(Handle self)
{
	XRectangle xr;
	REGION = XCreateRegion();
	xr. x = 0;
	xr. y = 0;
	xr. width  = 1;
	xr. height = 1;
	XUnionRectWithRegion( &xr, REGION, REGION);
	XXorRegion( REGION, REGION, REGION);
	HEIGHT = 0;
	return true;
}
예제 #22
0
static void
handle_expose_event(PaxWidget * paxwidget, XEvent * event)
{
    XRectangle rect;
    if (paxwidget->exposed_region == None)
	paxwidget->exposed_region = XCreateRegion();
    rect.x = event->xexpose.x;
    rect.y = event->xexpose.y;
    rect.width = event->xexpose.width;
    rect.height = event->xexpose.height;
    XUnionRectWithRegion(&rect, paxwidget->exposed_region,
			 paxwidget->exposed_region);
    PaxWidget_RegisterUpdate(paxwidget);
}
예제 #23
0
EAPI Eina_Bool
ecore_x_xregion_union_rect(Ecore_X_XRegion   *dst,
                           Ecore_X_XRegion   *src,
                           Ecore_X_Rectangle *rect)
{
   XRectangle xr;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   xr.x = rect->x;
   xr.y = rect->y;
   xr.width = rect->width;
   xr.height = rect->height;

   return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_union_rect */
예제 #24
0
파일: viewer-x.c 프로젝트: nihed/magnetism
static void
expose (XExposeEvent *xev,
	Region       *update_region)
{
  XRectangle  r;

  if (!*update_region)
    *update_region = XCreateRegion ();

  r.x = xev->x;
  r.y = xev->y;
  r.width = xev->width;
  r.height = xev->height;

  XUnionRectWithRegion (&r, *update_region, *update_region);
}
예제 #25
0
파일: x.c 프로젝트: 0359xiaodong/OpenAtlas
int _zbar_window_expose (zbar_window_t *w,
                         int x,
                         int y,
                         int width,
                         int height)
{
    window_state_t *xs = w->state;
    if(!xs->exposed)
        xs->exposed = XCreateRegion();
    XRectangle r;
    r.x = x;
    r.y = y;
    r.width = width;
    r.height = height;
    XUnionRectWithRegion(&r, xs->exposed, xs->exposed);
    return(0);
}
예제 #26
0
void
x_drawable_rep::set_clipping (SI x1, SI y1, SI x2, SI y2, bool restore) {
  (void) restore;
  outer_round (x1, y1, x2, y2);
  renderer_rep::set_clipping (x1, y1, x2, y2);
  Region region= XCreateRegion ();
  decode (x1, y1);
  decode (x2, y2);
  XRectangle r;
  r.x     = x1;
  r.y     = y2;
  r.width = x2-x1;
  r.height= y1-y2;
  XUnionRectWithRegion (&r, region, region);
  XSetRegion (dpy, gc, region);
  XDestroyRegion (region);
}
예제 #27
0
파일: x.c 프로젝트: 0359xiaodong/OpenAtlas
int _zbar_window_resize (zbar_window_t *w)
{
    window_state_t *x = w->state;
    if(!x)
        return(0);

    int lbw;
    if(w->height * 8 / 10 <= w->width)
        lbw = w->height / 36;
    else
        lbw = w->width * 5 / 144;
    if(lbw < 1)
        lbw = 1;
    x->logo_scale = lbw;
    if(x->logo_zbars)
        XDestroyRegion(x->logo_zbars);
    x->logo_zbars = XCreateRegion();

    int x0 = w->width / 2;
    int y0 = w->height / 2;
    int by0 = y0 - 54 * lbw / 5;
    int bh = 108 * lbw / 5;

    static const int bx[5] = { -6, -3, -1,  2,  5 };
    static const int bw[5] = {  1,  1,  2,  2,  1 };

    int i;
    for(i = 0; i < 5; i++) {
        XRectangle *bar = &x->logo_bars[i];
        bar->x = x0 + lbw * bx[i];
        bar->y = by0;
        bar->width = lbw * bw[i];
        bar->height = bh;
        XUnionRectWithRegion(bar, x->logo_zbars, x->logo_zbars);
    }

    static const int zx[4] = { -7,  7, -7,  7 };
    static const int zy[4] = { -8, -8,  8,  8 };

    for(i = 0; i < 4; i++) {
        x->logo_z[i].x = x0 + lbw * zx[i];
        x->logo_z[i].y = y0 + lbw * zy[i];
    }
    return(0);
}
예제 #28
0
void QRegion::updateX11Region() const
{
    d->rgn = XCreateRegion();
    if (!d->qt_rgn)
        return;

    int n = d->qt_rgn->numRects;
    const QRect *rect = (n == 1 ? &d->qt_rgn->extents : d->qt_rgn->rects.constData());
    while (n--) {
        XRectangle r;
        r.x = qMax(SHRT_MIN, rect->x());
        r.y = qMax(SHRT_MIN, rect->y());
        r.width = qMin((int)USHRT_MAX, rect->width());
        r.height = qMin((int)USHRT_MAX, rect->height());
        XUnionRectWithRegion(&r, d->rgn, d->rgn);
        ++rect;
    }
}
예제 #29
0
/* lpStruct - Pointer to RECT */
DWORD
DrvRegionsUnionRectWithRegion(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct)
{
	LPRECT lpRect;
	XRectangle xRect;

	if (!(lpRect = (LPRECT)lpStruct))
		return (DWORD)ERROR;
	xRect.x = lpRect->left;
	xRect.y = lpRect->top;
	xRect.width = lpRect->right - lpRect->left;
	xRect.height = lpRect->bottom - lpRect->top;

	XUnionRectWithRegion(&xRect, (Region)dwParm1, (Region)dwParm1);

	return (DWORD)(XEmptyRegion((Region)dwParm1)?
			NULLREGION:COMPLEXREGION);
}
예제 #30
0
파일: metacity.c 프로젝트: micove/compiz
static Region
meta_get_right_border_region (const MetaFrameGeometry *fgeom,
			      int		      height)
{
    Region     border_xregion;
    XRectangle xrect;

    border_xregion = XCreateRegion ();

    xrect.x	 = 0;
    xrect.y	 = 0;
    xrect.width  = fgeom->right_width;
    xrect.height = height - fgeom->top_height - fgeom->bottom_height;

    XUnionRectWithRegion (&xrect, border_xregion, border_xregion);

    return border_xregion;
}