All pastes #157939 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-01 20:56 UTC
rendered paste body
    	int count = ScreenCount(display);
    	Screen* screen;
    	
    	for (int i = 0; i < count; i++)
    	{
    		screen = ScreenOfDisplay(display, i);
    		
    		if (clipToWorkArea)
    		{
    			Atom hints = XInternAtom (display, "_NET_WORKAREA", True);

	            if (hints != None)
	            {
	                long* workarea = 0;
	                Window root = RootWindow (display, screen);
	                unsigned long nitems, bytesLeft;
	                Atom actualType;
	                int actualFormat;
	
	                if (XGetWindowProperty (display, root, hints, 0, 4, False,
	                                        XA_CARDINAL, &actualType, &actualFormat, &nitems, &bytesLeft,
	                                        (unsigned char**) &workarea) == Success)
	                {
	                	if (actualType == XA_CARDINAL && actualFormat == 32 && nitems == 4) {
	                		monitorCoords.add(Rectangle(workarea[0], workarea[1], workarea[2], workarea[3]);
	
	                    XFree (workarea);
	                }
	            }
    			
    		}
    		else
    			monitorCoords.add(Rectangle(0, 0, WidthOfScreen(screen), HeightOfScreen(screen));
   		}