X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=pctb%2Fpages.c;h=ffd0ba6e4c8c9c8a39d4268291f65638030d0f87;hp=fbf33171bd3a90182cc7e650361654767f0181d6;hb=09e8b6a8735c8cd1f7f3ffbabc1a05f0a8f8ca75;hpb=a628ba6e81f90a4ebc632731bc5e39ca5daae7fb diff --git a/pctb/pages.c b/pctb/pages.c index fbf3317..ffd0ba6 100644 --- a/pctb/pages.c +++ b/pctb/pages.c @@ -61,6 +61,58 @@ static void sync_after_input(void) { last_input= timestamp(); } +static void translate_coords_toroot(int wx, int wy, int *rx, int *ry) { + int r; + Window dummy; + r= XTranslateCoordinates(disp, id,attr.root, wx,wy, rx,ry, &dummy); + eassert(r); +} + +static void check_client_window_all_on_screen(void) { + int r; + int rxpos, rypos; + unsigned rwidth, rheight; + Window dummy; + unsigned bd, depth; + + r= XGetGeometry(disp,attr.root, &dummy, &rxpos,&rypos, + &rwidth, &rheight, + &bd,&depth); + + translate_coords_toroot(0,0, &rxpos,&rypos); + eassert(rxpos>=0 && rypos>=0); + + translate_coords_toroot(wwidth-1,wheight-1, &rxpos,&rypos); + eassert(rxposdata, b->data, a->bytes_per_line * a->height); } +static void wait_for_stability(Snapshot **output, + const Snapshot *previously, + void (*with_keypress)(void), + const char *fmt, ...) + FMT(4,5); + static void wait_for_stability(Snapshot **output, const Snapshot *previously, void (*with_keypress)(void), const char *fmt, ...) { + va_list al; + va_start(al,fmt); + Snapshot *last=0; int r; /* waits longer if we're going to return an image identical to previously @@ -119,12 +182,9 @@ static void wait_for_stability(Snapshot **output, last_input, previously); char *doing; - va_list al; - va_start(al,fmt); - r= asprintf(&doing,fmt,al); eassert(r>=0); - va_end(al); + r= vasprintf(&doing,fmt,al); eassert(r>=0); - progress(doing); + progress("%s",doing); for (;;) { double at_snapshot= timestamp(); @@ -144,7 +204,7 @@ static void wait_for_stability(Snapshot **output, break; } - progress_spinner(doing); + progress_spinner("%s",doing); debugf("PAGING wait_for_stability retry\n"); @@ -159,13 +219,7 @@ static void wait_for_stability(Snapshot **output, free_snapshot(&last); free(doing); debugf("PAGING wait_for_stability done.\n"); -} - -static void translate_coords_toroot(int wx, int wy, int *rx, int *ry) { - int r; - Window dummy; - r= XTranslateCoordinates(disp, id,attr.root, wx,wy, rx,ry, &dummy); - eassert(r); + va_end(al); } static void raise_and_get_details(void) { @@ -173,7 +227,6 @@ static void raise_and_get_details(void) { int evbase,errbase,majver,minver; int wxpos, wypos; unsigned bd,depth; - Window dummy; progress("raising and checking YPP client window..."); @@ -202,20 +255,11 @@ static void raise_and_get_details(void) { eassert(wwidth >= 320 && wheight >= 320); - int rxpos, rypos; - unsigned rwidth, rheight; - r= XGetGeometry(disp,attr.root, &dummy, &rxpos,&rypos, - &rwidth, &rheight, - &bd,&depth); - - translate_coords_toroot(0,0, &rxpos,&rypos); - eassert(rxpos>=0 && rypos>=0); - - translate_coords_toroot(wwidth-1,wheight-1, &rxpos,&rypos); - eassert(rxpos