PDFCore.cc (xpdf-4.03) | : | PDFCore.cc (xpdf-4.04) | ||
---|---|---|---|---|
skipping to change at line 424 | skipping to change at line 424 | |||
if (scrollY < 0) { | if (scrollY < 0) { | |||
scrollY = 0; | scrollY = 0; | |||
} | } | |||
if (scrollPage != state->getScrollPage() || | if (scrollPage != state->getScrollPage() || | |||
scrollX != state->getScrollX() || | scrollX != state->getScrollX() || | |||
scrollY != state->getScrollY()) { | scrollY != state->getScrollY()) { | |||
state->setScrollPosition(scrollPage, scrollX, scrollY); | state->setScrollPosition(scrollPage, scrollX, scrollY); | |||
} | } | |||
// redraw | // redraw | |||
invalidateWholeWindow(); | // - if the bitmap is available (e.g., we just scrolled), we want to | |||
// redraw immediately; if not, postpone the redraw until a | ||||
// tileDone or tick (incremental update) to avoid "flashing" the | ||||
// screen (drawing a blank background, followed by the actual | ||||
// content slightly later) | ||||
getWindowBitmap(gTrue); | ||||
if (bitmapFinished) { | ||||
invalidateWholeWindow(); | ||||
} | ||||
updateScrollbars(); | updateScrollbars(); | |||
// add to history | // add to history | |||
if (addToHist) { | if (addToHist) { | |||
addToHistory(); | addToHistory(); | |||
} | } | |||
} | } | |||
void PDFCore::addToHistory() { | void PDFCore::addToHistory() { | |||
PDFHistory h; | PDFHistory h; | |||
PDFHistory *cur; | PDFHistory *cur; | |||
cur = &history[historyCur]; | cur = &history[historyCur]; | |||
h.page = tileMap->getMidPage(); | h.page = tileMap->getMidPage(); | |||
h.fileName = NULL; | ||||
#ifdef _WIN32 | #ifdef _WIN32 | |||
if (doc->getFileNameU()) { | if (doc->getFileNameU()) { | |||
h.fileName = (wchar_t *)gmallocn(MAX_PATH + 1, sizeof(wchar_t)); | wchar_t dummy; | |||
if (GetFullPathNameW(doc->getFileNameU(), MAX_PATH + 1, | // NB: if the buffer is too small, GetFullPathNameW returns a | |||
h.fileName, NULL) == 0) { | // *maximum* required buffer size, which may be larger than the | |||
h.fileName = NULL; | // size actually used by the second call (it looks like it just | |||
// adds the size of the current directory and the sizef of the | ||||
// input path) | ||||
DWORD nChars = GetFullPathNameW(doc->getFileNameU(), 1, &dummy, NULL); | ||||
if (nChars > 0) { | ||||
h.fileName = (wchar_t *)gmallocn(nChars, sizeof(wchar_t)); | ||||
if (GetFullPathNameW(doc->getFileNameU(), nChars, | ||||
h.fileName, NULL) == 0) { | ||||
gfree(h.fileName); | ||||
h.fileName = NULL; | ||||
} | ||||
} | } | |||
} else { | ||||
h.fileName = NULL; | ||||
} | } | |||
#else | #else | |||
if (doc->getFileName()) { | if (doc->getFileName()) { | |||
h.fileName = doc->getFileName()->copy(); | h.fileName = doc->getFileName()->copy(); | |||
} else { | ||||
h.fileName = NULL; | ||||
} | } | |||
#endif | #endif | |||
if (historyBLen > 0 && h.page == cur->page) { | if (historyBLen > 0 && h.page == cur->page) { | |||
if (!h.fileName && !cur->fileName) { | if (!h.fileName && !cur->fileName) { | |||
return; | return; | |||
} | } | |||
#ifdef _WIN32 | #ifdef _WIN32 | |||
if (h.fileName && cur->fileName && !wcscmp(h.fileName, cur->fileName)) { | if (h.fileName && cur->fileName && !wcscmp(h.fileName, cur->fileName)) { | |||
gfree(h.fileName); | gfree(h.fileName); | |||
return; | return; | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 24 lines changed or added |