QRect QxtWindowSystem::windowGeometry(WId window)
{
    CGRect rect;
    static CGSConnection connection = _CGSDefaultConnection();

    CGError err = CGSGetWindowBounds(connection, window, &rect);
    if (err != noErr) return QRect();

    return QRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
}
Пример #2
0
void
stubGetWindowGeometry( const WindowInfo *window, int *x, int *y, unsigned int *w, unsigned int *h )
{
	float rect[4];

	if( !window ||
	    !window->connection ||
	    !window->drawable ||
	    CGSGetWindowBounds( window->connection, window->drawable, rect ) != noErr )
	{
		*x = *y = 0;
		*w = *h = 0;
	} else {
		*x = (int) rect[0];
		*y = (int) rect[1];
		*w = (int) rect[2];
		*h = (int) rect[3];
	}
}