Shuffle code around to make going to named destination work in throttled case
authormalc <av1474@comtv.ru>
Mon, 14 Jan 2013 22:56:55 +0000 (15 02:56 +0400)
committermalc <av1474@comtv.ru>
Mon, 14 Jan 2013 23:10:56 +0000 (15 03:10 +0400)
link.c
main.ml

diff --git a/link.c b/link.c
index 7ce213a..d16365e 100644 (file)
--- a/link.c
+++ b/link.c
@@ -1732,8 +1732,25 @@ static void * mainloop (void *unused)
             unlock ("geometry");
             printd ("continue %d", state.pagecount);
         }
-        else if (!strncmp ("anchor", p, 6)) {
-            char *nameddest = p + 7;
+        else if (!strncmp ("reqlayout", p, 9)) {
+            char *nameddest;
+            int rotate, proportional, off;
+
+            printd ("clear");
+            ret = sscanf (p + 9, " %d %d %n", &rotate, &proportional, &off);
+            if (ret != 2) {
+                errx (1, "bad reqlayout line `%.*s' ret=%d", len, p, ret);
+            }
+            lock ("reqlayout");
+            if (state.rotate != rotate || state.proportional != proportional) {
+                state.gen += 1;
+            }
+            state.rotate = rotate;
+            state.proportional = proportional;
+            layout ();
+            process_outline ();
+
+            nameddest = p + 9 + off;
             if (state.type == DPDF && nameddest && *nameddest) {
                 struct anchor a;
                 fz_link_dest dest;
@@ -1760,23 +1777,7 @@ static void * mainloop (void *unused)
                 }
                 pdf_drop_obj (needle);
             }
-        }
-        else if (!strncmp ("reqlayout", p, 9)) {
-            int rotate, proportional;
 
-            printd ("clear");
-            ret = sscanf (p + 9, " %d %d", &rotate, &proportional);
-            if (ret != 2) {
-                errx (1, "bad reqlayout line `%.*s' ret=%d", len, p, ret);
-            }
-            lock ("reqlayout");
-            if (state.rotate != rotate || state.proportional != proportional) {
-                state.gen += 1;
-            }
-            state.rotate = rotate;
-            state.proportional = proportional;
-            layout ();
-            process_outline ();
             state.gen++;
             unlock ("reqlayout");
             printd ("continue %d", state.pagecount);
diff --git a/main.ml b/main.ml
index 1a71a65..e10df16 100644 (file)
--- a/main.ml
+++ b/main.ml
@@ -1878,9 +1878,9 @@ let opendoc path password =
   wcmd "open %d %s\000%s\000" (btod state.wthack) path password;
   invalidate "reqlayout"
     (fun () ->
-      wcmd "reqlayout %d %d" conf.angle (btod conf.proportional);
-      if String.length state.nameddest > 0
-      then wcmd "anchor %s\000" state.nameddest);
+      wcmd "reqlayout %d %d %s\000"
+        conf.angle (btod conf.proportional) state.nameddest;
+    )
 ;;
 
 let reload () =
@@ -2518,7 +2518,7 @@ let act cmds =
             cmds (Printexc.to_string exn);
           exit 1;
       in
-      gotoanchor (n, float t /. float h, 0.0)
+      state.anchor <- (n, float t /. float h, 0.0)
 
   | "info" ->
       state.docinfo <- (1, args) :: state.docinfo