diff options
Diffstat (limited to 'src/history.c')
-rw-r--r-- | src/history.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/history.c b/src/history.c index 9779795a..24912d81 100644 --- a/src/history.c +++ b/src/history.c | |||
@@ -8,7 +8,7 @@ static const size_t maxStack_History_ = 50; /* back/forward navigable items */ | |||
8 | 8 | ||
9 | void init_RecentUrl(iRecentUrl *d) { | 9 | void init_RecentUrl(iRecentUrl *d) { |
10 | init_String(&d->url); | 10 | init_String(&d->url); |
11 | d->scrollY = 0; | 11 | d->normScrollY = 0; |
12 | d->cachedResponse = NULL; | 12 | d->cachedResponse = NULL; |
13 | } | 13 | } |
14 | 14 | ||
@@ -22,7 +22,7 @@ iDefineTypeConstruction(RecentUrl) | |||
22 | iRecentUrl *copy_RecentUrl(const iRecentUrl *d) { | 22 | iRecentUrl *copy_RecentUrl(const iRecentUrl *d) { |
23 | iRecentUrl *copy = new_RecentUrl(); | 23 | iRecentUrl *copy = new_RecentUrl(); |
24 | set_String(©->url, &d->url); | 24 | set_String(©->url, &d->url); |
25 | copy->scrollY = d->scrollY; | 25 | copy->normScrollY = d->normScrollY; |
26 | copy->cachedResponse = d->cachedResponse ? copy_GmResponse(d->cachedResponse) : NULL; | 26 | copy->cachedResponse = d->cachedResponse ? copy_GmResponse(d->cachedResponse) : NULL; |
27 | return copy; | 27 | return copy; |
28 | } | 28 | } |
@@ -61,7 +61,7 @@ void serialize_History(const iHistory *d, iStream *outs) { | |||
61 | iConstForEach(Array, i, &d->recent) { | 61 | iConstForEach(Array, i, &d->recent) { |
62 | const iRecentUrl *item = i.value; | 62 | const iRecentUrl *item = i.value; |
63 | serialize_String(&item->url, outs); | 63 | serialize_String(&item->url, outs); |
64 | write32_Stream(outs, item->scrollY); | 64 | write32_Stream(outs, item->normScrollY * 1.0e6f); |
65 | if (item->cachedResponse) { | 65 | if (item->cachedResponse) { |
66 | write8_Stream(outs, 1); | 66 | write8_Stream(outs, 1); |
67 | serialize_GmResponse(item->cachedResponse, outs); | 67 | serialize_GmResponse(item->cachedResponse, outs); |
@@ -80,7 +80,7 @@ void deserialize_History(iHistory *d, iStream *ins) { | |||
80 | iRecentUrl item; | 80 | iRecentUrl item; |
81 | init_RecentUrl(&item); | 81 | init_RecentUrl(&item); |
82 | deserialize_String(&item.url, ins); | 82 | deserialize_String(&item.url, ins); |
83 | item.scrollY = read32_Stream(ins); | 83 | item.normScrollY = (float) read32_Stream(ins) / 1.0e6f; |
84 | if (read8_Stream(ins)) { | 84 | if (read8_Stream(ins)) { |
85 | item.cachedResponse = new_GmResponse(); | 85 | item.cachedResponse = new_GmResponse(); |
86 | deserialize_GmResponse(item.cachedResponse, ins); | 86 | deserialize_GmResponse(item.cachedResponse, ins); |
@@ -166,8 +166,8 @@ void add_History(iHistory *d, const iString *url ){ | |||
166 | iBool goBack_History(iHistory *d) { | 166 | iBool goBack_History(iHistory *d) { |
167 | if (d->recentPos < size_Array(&d->recent) - 1) { | 167 | if (d->recentPos < size_Array(&d->recent) - 1) { |
168 | d->recentPos++; | 168 | d->recentPos++; |
169 | postCommandf_App("open history:1 scroll:%d url:%s", | 169 | postCommandf_App("open history:1 scroll:%f url:%s", |
170 | mostRecentUrl_History(d)->scrollY, | 170 | mostRecentUrl_History(d)->normScrollY, |
171 | cstr_String(url_History(d, d->recentPos))); | 171 | cstr_String(url_History(d, d->recentPos))); |
172 | return iTrue; | 172 | return iTrue; |
173 | } | 173 | } |
@@ -177,7 +177,9 @@ iBool goBack_History(iHistory *d) { | |||
177 | iBool goForward_History(iHistory *d) { | 177 | iBool goForward_History(iHistory *d) { |
178 | if (d->recentPos > 0) { | 178 | if (d->recentPos > 0) { |
179 | d->recentPos--; | 179 | d->recentPos--; |
180 | postCommandf_App("open history:1 url:%s", cstr_String(url_History(d, d->recentPos))); | 180 | postCommandf_App("open history:1 scroll:%f url:%s", |
181 | mostRecentUrl_History(d)->normScrollY, | ||
182 | cstr_String(url_History(d, d->recentPos))); | ||
181 | return iTrue; | 183 | return iTrue; |
182 | } | 184 | } |
183 | return iFalse; | 185 | return iFalse; |