summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 70201d7b..eae5d713 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -2266,11 +2266,15 @@ static iWidget *swipeParent_DocumentWidget_(iDocumentWidget *d) {
2266 2266
2267static iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) { 2267static iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
2268 iWidget *w = as_Widget(d); 2268 iWidget *w = as_Widget(d);
2269 /* Swipe animations are rather complex and utilize both cached GmDocument content
2270 and temporary DocumentWidgets. Depending on the swipe direction, this DocumentWidget
2271 may wait until the finger is released to actually perform the navigation action. */
2269 if (equal_Command(cmd, "edgeswipe.moved")) { 2272 if (equal_Command(cmd, "edgeswipe.moved")) {
2273 //printf("[%p] responds to edgeswipe.moved\n", d);
2270 as_Widget(d)->offsetRef = NULL; 2274 as_Widget(d)->offsetRef = NULL;
2271 const int side = argLabel_Command(cmd, "side"); 2275 const int side = argLabel_Command(cmd, "side");
2272 const int offset = arg_Command(cmd); 2276 const int offset = arg_Command(cmd);
2273 if (side == 1) { 2277 if (side == 1) { /* left edge */
2274 if (atOldest_History(d->mod.history)) { 2278 if (atOldest_History(d->mod.history)) {
2275 return iTrue; 2279 return iTrue;
2276 } 2280 }
@@ -2285,7 +2289,7 @@ static iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
2285 fixedPosition_WidgetFlag | fixedSize_WidgetFlag, iTrue); 2289 fixedPosition_WidgetFlag | fixedSize_WidgetFlag, iTrue);
2286 swipeIn->widget.rect.pos = windowToInner_Widget(swipeParent, localToWindow_Widget(w, w->rect.pos)); 2290 swipeIn->widget.rect.pos = windowToInner_Widget(swipeParent, localToWindow_Widget(w, w->rect.pos));
2287 swipeIn->widget.rect.size = d->widget.rect.size; 2291 swipeIn->widget.rect.size = d->widget.rect.size;
2288 swipeIn->widget.offsetRef = w; 2292 swipeIn->widget.offsetRef = parent_Widget(w);
2289 iRecentUrl *recent = new_RecentUrl(); 2293 iRecentUrl *recent = new_RecentUrl();
2290 preceding_History(d->mod.history, recent); 2294 preceding_History(d->mod.history, recent);
2291 if (recent->cachedDoc) { 2295 if (recent->cachedDoc) {
@@ -2293,15 +2297,18 @@ static iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
2293 updateScrollMax_DocumentWidget_(d); 2297 updateScrollMax_DocumentWidget_(d);
2294 setValue_Anim(&swipeIn->scrollY.pos, size_GmDocument(swipeIn->doc).y * recent->normScrollY, 0); 2298 setValue_Anim(&swipeIn->scrollY.pos, size_GmDocument(swipeIn->doc).y * recent->normScrollY, 0);
2295 updateVisible_DocumentWidget_(swipeIn); 2299 updateVisible_DocumentWidget_(swipeIn);
2300 swipeIn->drawBufs->flags |= updateTimestampBuf_DrawBufsFlag | updateSideBuf_DrawBufsFlag;
2296 } 2301 }
2297 delete_RecentUrl(recent); 2302 delete_RecentUrl(recent);
2298 addChildPos_Widget(swipeParent, iClob(swipeIn), front_WidgetAddPos); 2303 addChildPos_Widget(swipeParent, iClob(swipeIn), front_WidgetAddPos);
2299 } 2304 }
2300 } 2305 }
2301 if (side == 2) { 2306 if (side == 2) { /* right edge */
2302 if (offset < -get_Window()->pixelRatio * 10) { 2307 if (offset < -get_Window()->pixelRatio * 10) {
2308 int animSpan = 10;
2303 if (!atLatest_History(d->mod.history) && 2309 if (!atLatest_History(d->mod.history) &&
2304 ~flags_Widget(w) & dragged_WidgetFlag) { 2310 ~flags_Widget(w) & dragged_WidgetFlag) {
2311 animSpan = 0;
2305 postCommand_Widget(d, "navigate.forward"); 2312 postCommand_Widget(d, "navigate.forward");
2306 setFlags_Widget(w, dragged_WidgetFlag, iTrue); 2313 setFlags_Widget(w, dragged_WidgetFlag, iTrue);
2307 /* Set up the swipe dummy. */ 2314 /* Set up the swipe dummy. */
@@ -2319,10 +2326,10 @@ static iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
2319 destroy_Widget(as_Widget(target)); /* will be actually deleted after animation finishes */ 2326 destroy_Widget(as_Widget(target)); /* will be actually deleted after animation finishes */
2320 } 2327 }
2321 if (flags_Widget(w) & dragged_WidgetFlag) { 2328 if (flags_Widget(w) & dragged_WidgetFlag) {
2322 setVisualOffset_Widget(w, width_Widget(w) + offset, 10, 0); 2329 setVisualOffset_Widget(w, width_Widget(w) + offset, animSpan, 0);
2323 } 2330 }
2324 else { 2331 else {
2325 setVisualOffset_Widget(w, offset / 4, 10, 0); 2332 setVisualOffset_Widget(w, offset / 4, animSpan, 0);
2326 } 2333 }
2327 } 2334 }
2328 return iTrue; 2335 return iTrue;