From 612b9a6048712aba650dc1241757b16206dd0597 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 13 Nov 2012 13:03:19 -0300
Subject: [PATCH Browse] 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, switchwing between tabs and closing them respect the OSK status
(shown / hidden).
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
browser.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/browser.py b/browser.py
index 39a304d..76756f2 100644
a
|
b
|
class TabbedView(BrowserNotebook): |
258 | 258 | self.add_tab() |
259 | 259 | |
260 | 260 | def __tab_close_cb(self, label, tab_page): |
| 261 | if tab_page.props.browser == self.props.current_browser: |
| 262 | # Current browser was just closed. The next tab of it has |
| 263 | # to take the focus. |
| 264 | current_page_num = self.page_num(tab_page) |
| 265 | |
| 266 | if self.get_n_pages() - 1 == current_page_num: |
| 267 | # This tab was the last. Grab the left one. |
| 268 | page_to_focus = current_page_num - 1 |
| 269 | else: |
| 270 | # This tab was in the middle. Grab the right one. |
| 271 | page_to_focus = current_page_num + 1 |
| 272 | nth_page = self.get_nth_page(page_to_focus) |
| 273 | nth_page.props.browser.grab_focus() |
| 274 | |
261 | 275 | self.remove_page(self.page_num(tab_page)) |
262 | 276 | tab_page.destroy() |
263 | 277 | |