Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-11-13 16:03:19 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-11-22 21:30:27 (GMT)
commit0f656938d30f6697095d940618f77173d8f9cb33 (patch)
tree261ba4b9ef2b38a134399fca0cd2ad7d648b2ceb /browser.py
parent6578834bee9e8737f9ee0eb006455cd5cf4c3e0b (diff)
Grab the WebKit.WebView focus on tab closing #4187
When the current tab is closed the next tab is shown (left one if the current tab was the last, othercase right one). After this the WebKit.WebView of the tab displayed grabs the focus to show the OSK if this tab was showing it. So, switching between tabs and closing them respect the OSK status (shown / hidden). Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'browser.py')
-rw-r--r--browser.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/browser.py b/browser.py
index 8af7a4a..a97e736 100644
--- a/browser.py
+++ b/browser.py
@@ -258,6 +258,20 @@ class TabbedView(BrowserNotebook):
self.add_tab()
def __tab_close_cb(self, label, tab_page):
+ if tab_page.props.browser == self.props.current_browser:
+ # Current browser was just closed. The next tab of it has
+ # to take the focus.
+ current_page_num = self.page_num(tab_page)
+
+ if self.get_n_pages() - 1 == current_page_num:
+ # This tab was the last. Grab the left one.
+ page_to_focus = current_page_num - 1
+ else:
+ # This tab was in the middle. Grab the right one.
+ page_to_focus = current_page_num + 1
+ nth_page = self.get_nth_page(page_to_focus)
+ nth_page.props.browser.grab_focus()
+
self.remove_page(self.page_num(tab_page))
tab_page.destroy()