X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2Fpages.c;h=28364a07381d0035b21b5907af7486bc7aaab53f;hp=8f1332cd41750978fe0c2fe2d6b40067145009de;hb=6a4d494e0e31f95bdd6dd54b814e8b2381ad95b2;hpb=fceed60843f6a7c037b908eb529b542ad263c500 diff --git a/yarrg/pages.c b/yarrg/pages.c index 8f1332c..28364a0 100644 --- a/yarrg/pages.c +++ b/yarrg/pages.c @@ -154,6 +154,28 @@ static void check_not_disturbed(void) { } } +static void check_pointer_not_disturbed(void) { + Window got_root, got_child; + int got_root_x, got_root_y; + int got_win_x, got_win_y; + unsigned got_mask; + + int r= XQueryPointer(disp,id, &got_root,&got_child, + &got_root_x, &got_root_y, + &got_win_x, &got_win_y, + &got_mask); + if (!r || + got_win_x!=commod_page_point.x || + got_win_y!=commod_page_point.y) { + progress(""); + fprintf(stderr,"\nunexpected mouse position:" + " samescreen=%d got=%dx%d want=%dx%d", + r, got_win_x,got_win_y, + commod_page_point.x,commod_page_point.y); + fatal("Mouse pointer moved."); + } +} + static void send_key(KeySym sym) { check_not_disturbed(); XTestFakeKeyEvent(disp, keycode(sym),1, 0); @@ -174,6 +196,7 @@ static void send_mouse_1_updown(int x, int y) { } static void pgdown_by_mouse(void) { check_not_disturbed(); + check_pointer_not_disturbed(); debugf("PAGING Mouse\n"); send_mouse_1_updown_here(); sync_after_input(); @@ -350,7 +373,7 @@ static void wait_for_stability(Snapshot **output, " last_input=%f previously=%p `%s'\n", last_input, previously, doing); - double max_interval= 5.000; + double max_interval= 1.000; double min_interval= 0.100; for (;;) { progress_spinner("%s",doing); @@ -605,28 +628,24 @@ void take_screenshots(void) { for (;;) { debugf("page %d paging\n",npages); + pgdown_by_mouse(); + if (!(npages < MAX_PAGES)) fatal("Paging down seems to generate too many pages - max is %d.", MAX_PAGES); convert_store_page(current); free_snapshot(&last); last=current; current=0; - debugf("PAGING page %d converted\n",npages); + npages++; wait_for_stability(¤t,last, 0, "page %d collecting ...", - npages+1); - - if (npages && /* first pagedown doesn't do much */ - identical(current,last)) { - npages++; + npages); + if (identical(current,last)) { free_snapshot(¤t); break; } - - pgdown_by_mouse(); - npages++; } progress("finishing with the YPP client..."); send_mouse_1_updown(commod_focuslast_point.x, commod_focuslast_point.y); @@ -636,6 +655,7 @@ void take_screenshots(void) { debugf("PAGING all done.\n"); progress_log("collected %d screenshots.",npages); + check_pager_motion(0,npages); } void take_one_screenshot(void) {