Fix sessions scroll position

master
Dorian 7 years ago
parent 9052d13578
commit e54a53a453
  1. 12
      k-meleon/app/Plugins.cpp
  2. 17
      k-meleon/kplugins/sessions/sessions.cpp
  3. 12
      k-meleon/kplugins/sessions/sessions.h

@ -390,9 +390,15 @@ kmeleonDocInfo * GetDocInfoUTF8(HWND mainWnd)
}
#endif
POINT scroll = browser->GetScrollPosition();
kDocInfo.scrollX = scroll.x;
kDocInfo.scrollY = scroll.y;
if (view->GetBrowserGlue()->mHIndex >= 0) {
kDocInfo.scrollX = view->GetBrowserGlue()->mScroll.x;
kDocInfo.scrollY = view->GetBrowserGlue()->mScroll.y;
}
else {
POINT scroll = browser->GetScrollPosition();
kDocInfo.scrollX = scroll.x;
kDocInfo.scrollY = scroll.y;
}
return &kDocInfo;
}

@ -321,15 +321,16 @@ void DestroyTab(HWND parent, HWND tab)
if (destroying != parent) {
Window* w = currentSession.getWindow(parent);
if (w) {
Tab t = w->getTab(tab);
t.saveScrollState();
Window ww = Window(NULL);
ww.addTab(t);
undo.addWindow(ww);
Tab* t = w->getTab(tab);
if (t) {
t->saveScrollState();
Window ww = Window(NULL);
ww.addTab(*t);
undo.addWindow(ww);
}
}
}
currentSession.removeTab(parent, tab);
}
currentSession.removeTab(parent, tab);
}
void RestoreSession(BOOL afterCrash = FALSE)

@ -65,6 +65,7 @@ public:
void wasclosed() {
todelete = true;
saveScrollState();
hWnd = NULL;
}
@ -339,14 +340,14 @@ public:
return w;
}
Tab getTab(HWND hWnd) {
Tab* getTab(HWND hWnd) {
TABLIST::iterator iter;
for (iter = tabsList.begin(); iter != tabsList.end(); iter++) {
if ((*iter).hWnd == hWnd) break;
}
//assert(iter != tabsList.end());
if (iter == tabsList.end()) return Tab(NULL, NULL);
return *iter;
if (iter == tabsList.end()) return nullptr;
return &*iter;
}
friend class SessionStore;
@ -415,9 +416,8 @@ public:
Window* findWindowWithTab(HWND hTab) {
WINLIST::iterator iter;
for (iter = windowsList.begin(); iter != windowsList.end(); iter++) {
Tab tab = (*iter).getTab(hTab);
if (tab.hWnd)
return (&*iter);
Tab* tab = (*iter).getTab(hTab);
if (tab) return (&*iter);
}
return NULL;
}

Loading…
Cancel
Save