monitor.c
// find the dimensions of the monitor displaying point x,y
find the dimensions of the monitor displaying point x,y
find the dimensions of the monitor displaying point x y
void monitor_dimensions(int x, int y, workarea *mon)
{
	int monitors, i;
	memset(mon, 0, sizeof(workarea));
	mon->w = WidthOfScreen(screen);
	mon->h = HeightOfScreen(screen);
	if (XineramaIsActive(display))
	{
		XineramaScreenInfo *info = XineramaQueryScreens(display, &monitors);
		if (info)
		{
			for (i = 0; i < monitors; i++)
			{
				if (INTERSECT(x, y, 1, 1, info[i].x_org, info[i].y_org, info[i].width, info[i].height))
				{
					mon->x = info[i].x_org; mon->y = info[i].y_org;
					mon->w = info[i].width; mon->h = info[i].height;
					break;
				}
			}
			XFree(info);
		}
	}
}
void monitor_dimensions ( int x , int y , workarea * mon ) { int monitors , i ; memset ( mon , 0 , sizeof ( workarea ) ) ; mon -> w = WidthOfScreen ( screen ) ; mon -> h = HeightOfScreen ( screen ) ; if ( XineramaIsActive ( display ) ) { XineramaScreenInfo * info = XineramaQueryScreens ( display , & monitors ) ; if ( info ) { for ( i = 0 ; i < monitors ; i ++ ) { if ( INTERSECT ( x , y , 1 , 1 , info [ i ] . x_org , info [ i ] . y_org , info [ i ] . width , info [ i ] . height ) ) { mon -> x = info [ i ] . x_org ; mon -> y = info [ i ] . y_org ; mon -> w = info [ i ] . width ; mon -> h = info [ i ] . height ; break ; } } XFree ( info ) ; } } }
find the dimensions of the monitor displaying point x,y
find the dimensions of the monitor displaying point x y
// locate the current monitor