chiark / gitweb /
Merge branch 'stable-3.x'
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 19 Aug 2009 20:07:43 +0000 (21:07 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 19 Aug 2009 20:07:43 +0000 (21:07 +0100)
yarrg/Commods.pm
yarrg/pages.c
yarrg/structure.c

index 0f7ebd6..c82fdfd 100644 (file)
@@ -198,7 +198,7 @@ sub parse_pctb_commodmap () {
     undef %pctb_commodmap;
     foreach my $commod (keys %commods) { $commods{$commod} =~ s/b//; }
 
-    my $c= new IO::File '_commodmap.tsv' or die $!;
+    my $c= new IO::File '_commodmap.tsv';
     if (!$c) { $!==&ENOENT or die $!; return 0; }
 
     while (<$c>) {
@@ -217,7 +217,7 @@ sub get_our_version ($$) {
     $aref->{"${prefix}name"}= 'ypp-sc-tools yarrg';
     $aref->{"${prefix}fixes"}= 'lastpage';
 
-    my $version= `git-describe --tags HEAD`; $? and die $?;
+    my $version= `git-describe --tags HEAD || echo 0unknown`; $? and die $?;
     chomp($version);
     $aref->{"${prefix}version"}= $version;
     return $aref;
@@ -303,7 +303,8 @@ sub cgipostform ($$$) {
        return $';
     } else {
        my $resp= $ua->request($req);
-       die $resp->status_line unless $resp->is_success;
+       die $resp->status_line."\n".$resp->content."\n "
+           unless $resp->is_success;
        return $resp->content();
     }
 }
index 2e3edde..8f1332c 100644 (file)
@@ -156,26 +156,26 @@ static void check_not_disturbed(void) {
 
 static void send_key(KeySym sym) {
   check_not_disturbed();
-  XTestFakeKeyEvent(disp, keycode(sym),1, 10);
-  XTestFakeKeyEvent(disp, keycode(sym),0, 10);
+  XTestFakeKeyEvent(disp, keycode(sym),1, 0);
+  XTestFakeKeyEvent(disp, keycode(sym),0, 0);
 }
-static void mouse_1_updown_here(void) {
+static void send_mouse_1_updown_here(void) {
   check_not_disturbed();
-  XTestFakeButtonEvent(disp,1,1, 10);
-  XTestFakeButtonEvent(disp,1,0, 10);
+  XTestFakeButtonEvent(disp,1,1, 0);
+  XTestFakeButtonEvent(disp,1,0, 0);
 }
-static void mouse_1_updown(int x, int y) {
+static void send_mouse_1_updown(int x, int y) {
   check_not_disturbed();
   int screen= XScreenNumberOfScreen(attr.screen);
   int xpos, ypos;
   translate_coords_toroot(x,y, &xpos,&ypos);
   XTestFakeMotionEvent(disp, screen, xpos,ypos, 0);
-  mouse_1_updown_here();
+  send_mouse_1_updown_here();
 }
 static void pgdown_by_mouse(void) {
   check_not_disturbed();
   debugf("PAGING   Mouse\n");
-  mouse_1_updown_here();
+  send_mouse_1_updown_here();
   sync_after_input();
 }
 
@@ -350,12 +350,14 @@ static void wait_for_stability(Snapshot **output,
          "  last_input=%f previously=%p `%s'\n",
          last_input, previously, doing);
 
-  double min_interval= 0.025;
+  double max_interval= 5.000;
+  double min_interval= 0.100;
   for (;;) {
     progress_spinner("%s",doing);
     
     double since_last_input= timestamp() - last_input;
     double this_interval= min_interval - since_last_input;
+    if (this_interval > max_interval) this_interval= max_interval;
 
     if (this_interval >= 0)
       delay(this_interval);
@@ -496,7 +498,7 @@ static void set_focus_commodity(void) {
 
   debugf("PAGING set_focus\n");
 
-  mouse_1_updown(commod_focus_point.x, commod_focus_point.y);
+  send_mouse_1_updown(commod_focus_point.x, commod_focus_point.y);
   sync_after_input();
 
   delay(0.5);
@@ -552,16 +554,17 @@ static void prepare_ypp_client(void) {
   Rect sunshine= find_sunshine_widget();
 
   progress("poking client...");
-  mouse_1_updown((sunshine.tl.x   + sunshine.br.x) / 2,
-                (sunshine.tl.y*9 + sunshine.br.y) / 10);
+  send_mouse_1_updown((sunshine.tl.x   + sunshine.br.x) / 2,
+                     (sunshine.tl.y*9 + sunshine.br.y) / 10);
+  sync_after_input();
 
   free(test);
 
   wait_for_stability(&current,0,0, "checking basic YPP client screen...");
-  mouse_1_updown(250, wheight-10);
-  mouse_1_updown_here();
-  mouse_1_updown_here();
-  XSync(disp,False);
+  send_mouse_1_updown(250, wheight-10);
+  send_mouse_1_updown_here();
+  send_mouse_1_updown_here();
+  sync_after_input();
   check_not_disturbed();
   send_key(XK_slash);
   send_key(XK_w);
@@ -626,7 +629,7 @@ void take_screenshots(void) {
     npages++;
   }
   progress("finishing with the YPP client...");
-  mouse_1_updown(commod_focuslast_point.x, commod_focuslast_point.y);
+  send_mouse_1_updown(commod_focuslast_point.x, commod_focuslast_point.y);
   sync_after_input();
   send_pgdown_torestore();
   sync_after_input();
index f10addc..99042d0 100644 (file)
@@ -313,12 +313,16 @@ void find_structure(const CanonImage *im,
 
 #define CHECK_STRIP_BORDER(tlbr,xy,increm)             \
   do {                                                 \
-    Point csb_p;                                       \
+    Point csb_p, csb_p2;                               \
     Rect csb_r;                                                \
     csb_p= s.mr.tl;                                    \
     csb_p.x++; csb_p.y++;                              \
+    csb_p2= csb_p;                                     \
+    csb_p2.x++; csb_p2.y++;                            \
     csb_p.xy= s.mr.tlbr.xy;                            \
-    if (get_p(csb_p)=='+') {                           \
+    csb_p2.xy= s.mr.tlbr.xy;                           \
+    if (get_p(csb_p)=='+' &&                           \
+       get_p(csb_p2)=='+') {                           \
       csb_r= s.mr;                                     \
       csb_r.tl.xy= csb_p.xy;                           \
       csb_r.br.xy= csb_p.xy;                           \