commit 7342ee2757c4ef85336452603300c4ec7fed8658
parent 50e82f34b337d4b9e2d06a9e7dfa8a6cc510c876
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 2 Feb 2016 17:10:10 -0800
give back focus to the current tab widget after the link menu is closed
Diffstat:
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -178,6 +178,8 @@ void About::selectLink(const int ctrl, const std::vector<const Link *> &links)
}
else if(count == 1)
openLink(links.front());
+
+ m_tabs->setFocus();
}
void About::openLink(const Link *link)
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
@@ -71,6 +71,14 @@ void TabBar::removeTab(const int index)
m_pages.erase(m_pages.begin() + index);
}
+void TabBar::setFocus()
+{
+ if(m_lastPage < 0 || (size_t)m_lastPage >= m_pages.size())
+ return;
+
+ SetFocus(m_pages[m_lastPage].front());
+}
+
void TabBar::onNotify(LPNMHDR info, LPARAM)
{
switch(info->code) {
diff --git a/src/tabbar.hpp b/src/tabbar.hpp
@@ -35,6 +35,7 @@ public:
int currentIndex() const;
void setCurrentIndex(const int);
void removeTab(const int);
+ void setFocus();
protected:
void onNotify(LPNMHDR, LPARAM) override;