PhWindowQueryVisible()

Query a visible extent

Synopsis:

int PhWindowQueryVisible( unsigned flag,
                          PhRid_t rid,
                          unsigned input_group,
                          PhRect_t *rect );

Library:

ph

Description:

If rid is zero, this function calculates the visible extent based on the region type specified in flag.

If rid is nonzero, PhWindowQueryVisible() calculates the visible extent by finding every region intersecting with rid that matches the region type specified in flag.

The input_group argument indicates with which input group the visible extent must intersect. To determine the current input group, call PhInputGroup(), passing to it the current event, if any.

You must set at most one of the following bits in flags:

Ph_QUERY_GRAPHICS
Return a graphics driver rectangle.
Ph_QUERY_INPUT_GROUP
Return input_group's rectangle.
Ph_QUERY_CONSOLE
Return a console's rectangle. A console is defined as either an input group or a graphics driver, depending on the window manager's Multi-monitor placement option. In other words, this option is equivalent to either Ph_QUERY_GRAPHICS or Ph_QUERY_INPUT_GROUP, depending on your configuration.
Ph_QUERY_WORKSPACE
Return a console's rectangle minus any reserved space around the edges.

Ph_QUERY_CONSOLE is the default value.

You can OR the following into flags:

Ph_QUERY_EXACT
The visible extent that the function finds must match both input_group and rid; otherwise, rid is a hint.
Ph_QUERY_IG_POINTER
Use the current location of input_group's pointer (rid is ignored).
Ph_QUERY_IG_REGION
Use input_group's rectangle.

PhWindowQueryVisible() places the visible extent in the PhRect_t structure pointed to by rect.

Returns:

0
The rect argument is valid.
-1
The rect argument is invalid.

Examples:

Determine the absolute coordinates of the current console:

PhRect_t extent;

if( PhWindowQueryVisible( Ph_QUERY_CONSOLE, 0,
        input_group, &extent ) == 0 ) {
     printf( "Upper left: (%d,%d) Lower right: (%d,%d)\n",
             extent.ul.x, extent.ul.y,
             extent.lr.x, extent.lr.y );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhRect_t

Window Management chapter of the Photon Programmer's Guide