X11workbench Toolkit  1.0
Points, Rectangles, and Geometries

Macros

#define WBPointInRect(X, Y, R)   ((X) >= (R).left && (X) < (R).right && (Y) >= (R).top && (Y) < (R).bottom)
 Returns logical TRUE if the point (X,Y) is within the borders of the rectangle 'R'. More...
 
#define WBPointInGeom(X, Y, G)   ((X) >= (G).x && (X) < ((G).x + (G).width) && (Y) >= (G).y && (Y) < ((G).y + (G).height))
 Returns logical TRUE if the point (X,Y) is within the borders of the geometry 'G'. More...
 
#define WBRectOverlapped(R1, R2)
 Returns logical TRUE if the rectangle R1 overlaps/intersects R2. More...
 
#define WBGeomOverlapped(G1, G2)
 Returns logical TRUE if the geometry G1 overlaps/intersects G2. More...
 

Functions

void WBGetWindowGeom (Window wID, WB_GEOM *pGeom)
 Returns the RAW geometry of the window as reported by the window manager. More...
 
void WBGetWindowGeom2 (Window wID, WB_GEOM *pGeom)
 Returns the geometry of the window relative to the root window. More...
 
void WBGetWindowGeom0 (Window wID, WB_GEOM *pGeom)
 Returns the ABSOLUTE window geometry relative to the screen. More...
 
void WBGetWindowRect (Window wID, WB_RECT *pRect)
 Returns the WB_RECT (rectangle) defined by the window's geometry, including the border area. More...
 
void WBGetClientRect (Window wID, WB_RECT *pRect)
 Returns the WB_RECT (rectangle) defined by the window's geometry, excluding the border area. More...
 
void WBXlatCoordPoint (Window wIDSrc, int iXSrc, int iYSrc, Window wIDDest, int *piXDest, int *piYDest)
 Translate X,Y point coordinates relative to a window. More...
 
void WBXlatCoordGeom (Window wIDSrc, const WB_GEOM *pGeomSrc, Window wIDDest, WB_GEOM *pGeomDest)
 Translate geometry coordinates relative to a window. More...
 
void WBXlatCoordRect (Window wIDSrc, const WB_RECT *pRectSrc, Window wIDDest, WB_RECT *pRectDest)
 Translate rectangle coordinates relative to a window. More...
 
int WBPointInWindow (Window wIDRef, int iX, int iY, Window wIDQuery)
 Returna a non-zero value if X,Y coordinates relative to the reference window are within the query window. More...
 

Detailed Description

The following functions, data types, and macro definitions are related to window geometries, querying, translating coordinate mapping, and comparing points, rectangles, and geometries to one another.

See Also: WB_RECT, WB_GEOM

Macro Definition Documentation

◆ WBGeomOverlapped

#define WBGeomOverlapped (   G1,
  G2 
)
Value:
((((G1).x >= (G2).x && (G1).x < (G2).x + (G2).width) || \
((G2).x >= (G1).x && (G2).x < (G1).x + (G1).width)) && \
(((G1).y >= (G2).y && (G1).y < (G2).y + (G2).height) || \
((G2).y >= (G1).y && (G2).y < (G1).y + (G1).height)))

Returns logical TRUE if the geometry G1 overlaps/intersects G2.

Parameters
G1A WB_GEOM structure bounding the first area to check
G2A second WB_GEOM structure bounding the second area to check
Returns
logical TRUE if the two WB_GEOMs intersect, FALSE otherwise

Definition at line 1758 of file window_helper.h.

◆ WBPointInGeom

#define WBPointInGeom (   X,
  Y,
 
)    ((X) >= (G).x && (X) < ((G).x + (G).width) && (Y) >= (G).y && (Y) < ((G).y + (G).height))

Returns logical TRUE if the point (X,Y) is within the borders of the geometry 'G'.

Parameters
XThe X value to check for
YThe Y value to check for
GA WB_GEOM structure bounding the area to check
Returns
logical TRUE if (X,Y) lies within 'G', FALSE otherwise

Definition at line 1738 of file window_helper.h.

◆ WBPointInRect

#define WBPointInRect (   X,
  Y,
 
)    ((X) >= (R).left && (X) < (R).right && (Y) >= (R).top && (Y) < (R).bottom)

Returns logical TRUE if the point (X,Y) is within the borders of the rectangle 'R'.

Parameters
XThe X value to check for
YThe Y value to check for
RA WB_RECT structure bounding the area to check
Returns
logical TRUE if (X,Y) lies within 'R', FALSE otherwise

Definition at line 1729 of file window_helper.h.

◆ WBRectOverlapped

#define WBRectOverlapped (   R1,
  R2 
)
Value:
((((R1).left >= (R2).left && (R1).left < (R2).right) || \
((R2).left >= (R1).left && (R2).left < (R1).right)) && \
(((R1).top >= (R2).top && (R1).top < (R2).bottom) || \
((R2).top >= (R1).top && (R2).top < (R1).bottom)))

Returns logical TRUE if the rectangle R1 overlaps/intersects R2.

Parameters
R1A WB_RECT structure bounding the first area to check
R2A second WB_RECT structure bounding the second area to check
Returns
logical TRUE if the two WB_RECTs intersect, FALSE otherwise

Definition at line 1746 of file window_helper.h.

Function Documentation

◆ WBGetClientRect()

void WBGetClientRect ( Window  wID,
WB_RECT pRect 
)

Returns the WB_RECT (rectangle) defined by the window's geometry, excluding the border area.

Parameters
wIDThe Window ID to obtain the WB_RECT data for
pRectA pointer to the WB_RECT structure to receive the data

Header File: window_helper.h

Definition at line 6708 of file window_helper.c.

◆ WBGetWindowGeom()

void WBGetWindowGeom ( Window  wID,
WB_GEOM pGeom 
)

Returns the RAW geometry of the window as reported by the window manager.

Parameters
wIDThe Window ID to obtain the WB_GEOM data for
pGeomA pointer to the WB_GEOM structure to receive the data

Header File: window_helper.h

Definition at line 6522 of file window_helper.c.

◆ WBGetWindowGeom0()

void WBGetWindowGeom0 ( Window  wID,
WB_GEOM pGeom 
)

Returns the ABSOLUTE window geometry relative to the screen.

Parameters
wIDThe Window ID to obtain the WB_GEOM data for
pGeomA pointer to the WB_GEOM structure to receive the data

The 'ABSOLUTE' window geometry is the position of the window relative to the origin point (the upper left corner of the screen). Window managers typically cook all of the XEvent and API data that relates to window positioning, such that a top level frame window's upper left corner is nearly always reported as 0,0 (or similar). Not all window managers behave the same in this regard. To ensure that an ABSOLUTE window position is known (helpful for centering on screen, etc.), the absolute coordinates are frequently cached within the internal data structure associated with the window. Those cached values are returned by this function.

Header File: window_helper.h

Definition at line 6473 of file window_helper.c.

◆ WBGetWindowGeom2()

void WBGetWindowGeom2 ( Window  wID,
WB_GEOM pGeom 
)

Returns the geometry of the window relative to the root window.

Parameters
wIDThe Window ID to obtain the WB_GEOM data for
pGeomA pointer to the WB_GEOM structure to receive the data

Header File: window_helper.h

Definition at line 6607 of file window_helper.c.

◆ WBGetWindowRect()

void WBGetWindowRect ( Window  wID,
WB_RECT pRect 
)

Returns the WB_RECT (rectangle) defined by the window's geometry, including the border area.

Parameters
wIDThe Window ID to obtain the WB_RECT data for
pRectA pointer to the WB_RECT structure to receive the data

Header File: window_helper.h

Definition at line 6693 of file window_helper.c.

◆ WBPointInWindow()

int WBPointInWindow ( Window  wIDRef,
int  iX,
int  iY,
Window  wIDQuery 
)

Returna a non-zero value if X,Y coordinates relative to the reference window are within the query window.

Parameters
wIDRefThe reference Window ID
iXThe X coordinates relative to wIDRef
iYThe Y coordinates relative to wIDRef
wIDQueryThe Window ID of the window to test the translated X and Y values against
Returns
Non-zero if the (X,Y) coordinates are within wIDQuery, zero otherwise.

Use this function to see if coordinates relative to one window also fall within another window. Typical use includes 'hover' detection, drag/drop operations, and child window activation To specify X,Y screen coordinates, pass 'None' for 'wIDRef'
Header File: window_helper.h

Definition at line 6819 of file window_helper.c.

◆ WBXlatCoordGeom()

void WBXlatCoordGeom ( Window  wIDSrc,
const WB_GEOM pGeomSrc,
Window  wIDDest,
WB_GEOM pGeomDest 
)

Translate geometry coordinates relative to a window.

Parameters
wIDSrcThe source Window ID
pGeomSrcA const pointer to a WB_GEOM structure containing the coordinates to translate
wIDDestThe destination Window ID
pGeomDestA pointer to a WB_GEOM structure that receives the translated coordinates

For many operations, coordinates relative to one window must be translated into coordinates relative to a different window so that they can be used for the new window's processing.
To translate from screen coordinates, pass 'None' for 'wIDSrc'
Header File: window_helper.h

Definition at line 6762 of file window_helper.c.

◆ WBXlatCoordPoint()

void WBXlatCoordPoint ( Window  wIDSrc,
int  iXSrc,
int  iYSrc,
Window  wIDDest,
int *  piXDest,
int *  piYDest 
)

Translate X,Y point coordinates relative to a window.

Parameters
wIDSrcThe source Window ID
iXSrcThe X coordinate within wIDSrc
iYSrcThe Y coordinate within wIDSrc
wIDDestThe destination Window ID
piXDestA pointer to an integer to receive the translated X coordinate
piYDestA pointer to an integer to receive the translated Y coordinate

For many operations, coordinates relative to one window must be translated into coordinates relative to a different window so that they can be used for the new window's processing.
To translate from screen coordinates, pass 'None' for 'wIDSrc'
Header File: window_helper.h

Definition at line 6727 of file window_helper.c.

◆ WBXlatCoordRect()

void WBXlatCoordRect ( Window  wIDSrc,
const WB_RECT pRectSrc,
Window  wIDDest,
WB_RECT pRectDest 
)

Translate rectangle coordinates relative to a window.

Parameters
wIDSrcThe source Window ID
pRectSrcA const pointer to a WB_RECT structure containing the coordinates to translate
wIDDestThe destination Window ID
pRectDestA pointer to a WB_RECT structure that receives the translated coordinates

For many operations, coordinates relative to one window must be translated into coordinates relative to a different window so that they can be used for the new window's processing.
To translate from screen coordinates, pass 'None' for 'wIDSrc'
Header File: window_helper.h

Definition at line 6792 of file window_helper.c.