From 9ac0a9e44f2b866cc4ec9a2fbac7c09c77ecb2f4 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 19 Nov 2012 14:51:12 +0000 Subject: Hanlde focus properly on each tab SL #4200 The focus is grabbed after loading the 'Home page' and when the session is restored. This patch allow us to show the OSK when it's needed and to be able to start typing with the hardware keyboard. Signed-off-by: Manuel Kaufmann Acked-by: Simon Schampijer --- diff --git a/browser.py b/browser.py index 39a304d..8af7a4a 100644 --- a/browser.py +++ b/browser.py @@ -303,6 +303,7 @@ class TabbedView(BrowserNotebook): default_page = os.path.join(activity.get_bundle_path(), "data/index.html") browser.load_uri('file://' + default_page) + browser.grab_focus() def _get_current_browser(self): if self.get_n_pages(): diff --git a/webactivity.py b/webactivity.py index 6dbd222..780b87f 100644 --- a/webactivity.py +++ b/webactivity.py @@ -409,6 +409,7 @@ class WebActivity(activity.Activity): for number, tab in enumerate(self.model.data['currents']): tab_page = self._tabbed_view.get_nth_page(number) tab_page.browser.set_history_index(tab['history_index']) + tab_page.browser.grab_focus() self._tabbed_view.set_current_page(self.model.data['current_tab']) elif self.metadata['mime_type'] == 'text/uri-list': @@ -422,6 +423,7 @@ class WebActivity(activity.Activity): else: file_uri = 'file://' + file_path self._tabbed_view.props.current_browser.load_uri(file_uri) + self._tabbed_view.props.current_browser.grab_focus() def write_file(self, file_path): if not self.metadata['mime_type']: -- cgit v0.9.1