Esempio n. 1
0
File: debugger.c Progetto: adsr/agar
static void
FindWindows(AG_Tlist *tl, AG_Window *win, int depth)
{
	char text[AG_TLIST_LABEL_MAX];
	AG_Window *wSub;
	AG_Widget *wChild;
	AG_TlistItem *it;

	if (strncmp(OBJECT(win)->name, "_Popup-", sizeof("_Popup-")) == 0)
		return;

	Strlcpy(text, win->caption, sizeof(text));
	if (strcmp(OBJECT(win)->name, "generic") == 0) {
		it = AG_TlistAddS(tl, NULL,
		    win->caption[0] != '\0' ? win->caption : _("Untitled"));
	} else {
		it = AG_TlistAdd(tl, NULL, "%s (<%s>)",
		    win->caption[0] != '\0' ? win->caption : _("Untitled"),
		    OBJECT(win)->name);
	}
	it->p1 = win;
	it->depth = depth;
	it->cat = "window";
	if (!TAILQ_EMPTY(&OBJECT(win)->children) ||
	    !TAILQ_EMPTY(&win->subwins)) {
		it->flags |= AG_TLIST_HAS_CHILDREN;
	}
	if ((it->flags & AG_TLIST_HAS_CHILDREN) &&
	    AG_TlistVisibleChildren(tl, it)) {
		TAILQ_FOREACH(wSub, &win->subwins, swins)
			FindWindows(tl, wSub, depth+1);
		OBJECT_FOREACH_CHILD(wChild, win, ag_widget)
			FindWidgets(wChild, tl, depth+1);
	}
}
Esempio n. 2
0
File: debugger.c Progetto: adsr/agar
static void
PollWidgets(AG_Event *event)
{
	AG_Tlist *tl = AG_SELF();
	AG_Driver *drv = WIDGET(tl)->drv;
	AG_Window *win;

	AG_TlistClear(tl);
	AG_LockVFS(drv);
	AG_FOREACH_WINDOW_REVERSE(win, drv) {
		FindWindows(tl, win, 0);
	}
Esempio n. 3
0
BOOL CScreenCapture::TakeDesktopScreenshot(	
			LPCTSTR szSaveToDir,
			ScreenshotInfo& ssi, 
			SCREENSHOT_TYPE type, 
			DWORD dwProcessId,
			SCREENSHOT_IMAGE_FORMAT fmt, 
			int nJpegQuality,
			BOOL bGrayscale,
			int nIdStartFrom)
{   
	// This method takes the desktop screenshot (screenshot of entire virtual screen
	// or screenshot of the main window, or screenshot of all process windows). 

	// First, we need to calculate the area rectangle to capture
    std::vector<CRect> wnd_list; // List of window rectangles

    if(type==SCREENSHOT_TYPE_MAIN_WINDOW) // We need to capture the main window
    {     
        // Take screenshot of the main window
        std::vector<WindowInfo> aWindows; 
        FindWindows(dwProcessId, FALSE, &aWindows);           
        
		if(aWindows.size()>0)
        {
            wnd_list.push_back(aWindows[0].m_rcWnd);
            ssi.m_aWindows.push_back(aWindows[0]);
        }
    }
    else if(type==SCREENSHOT_TYPE_ALL_PROCESS_WINDOWS) // Capture all process windows
    {          
        std::vector<WindowInfo> aWindows; 
        FindWindows(dwProcessId, TRUE, &aWindows);
            
        int i;
        for(i=0; i<(int)aWindows.size(); i++)
            wnd_list.push_back(aWindows[i].m_rcWnd);
        ssi.m_aWindows = aWindows;
    }
    else // (dwFlags&CR_AS_VIRTUAL_SCREEN)!=0 // Capture the virtual screen
    {
        // Take screenshot of the entire desktop
        CRect rcScreen;
        GetScreenRect(&rcScreen);    
        wnd_list.push_back(rcScreen);
    }

	// Mark screenshot information as valid
    ssi.m_bValid = TRUE;
	// Save virtual screen rect
    GetScreenRect(&ssi.m_rcVirtualScreen);  

	// Save current timestamp
	time(&ssi.m_CreateTime);

	// Capture screen rectangle	
    BOOL bTakeScreenshot = CaptureScreenRect(
		wnd_list, 
        szSaveToDir, 
        nIdStartFrom, 
		fmt, 
		nJpegQuality, 
		bGrayscale, 
        ssi.m_aMonitors);
    if(bTakeScreenshot==FALSE)
    {
        return FALSE;
    }
	    
    // Done
    return TRUE;
}