Ticket #4200: 0001-Hanlde-focus-properly-on-each-tab-SL-4200.patch

File 0001-Hanlde-focus-properly-on-each-tab-SL-4200.patch, 2.0 KB (added by humitos, 11 years ago)
  • browser.py

    From 1940fa9256365d839afa9820af7a8c3b48240984 Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Mon, 19 Nov 2012 11:51:12 -0300
    Subject: [PATCH Browse] Hanlde focus properly on each tab SL #4200
    
    The focus is grabbed after loading the 'Home page' and when the
    session is restored from a previous one by the current browser that
    it's being shown to the user.
    
    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 <humitos@gmail.com>
    ---
     browser.py     | 1 +
     webactivity.py | 2 ++
     2 files changed, 3 insertions(+)
    
    diff --git a/browser.py b/browser.py
    index 76756f2..a97e736 100644
    a b class TabbedView(BrowserNotebook): 
    317317            default_page = os.path.join(activity.get_bundle_path(),
    318318                                        "data/index.html")
    319319            browser.load_uri('file://' + default_page)
     320        browser.grab_focus()
    320321
    321322    def _get_current_browser(self):
    322323        if self.get_n_pages():
  • webactivity.py

    diff --git a/webactivity.py b/webactivity.py
    index 6dbd222..780b87f 100644
    a b class WebActivity(activity.Activity): 
    409409            for number, tab in enumerate(self.model.data['currents']):
    410410                tab_page = self._tabbed_view.get_nth_page(number)
    411411                tab_page.browser.set_history_index(tab['history_index'])
     412                tab_page.browser.grab_focus()
    412413
    413414            self._tabbed_view.set_current_page(self.model.data['current_tab'])
    414415        elif self.metadata['mime_type'] == 'text/uri-list':
    class WebActivity(activity.Activity): 
    422423        else:
    423424            file_uri = 'file://' + file_path
    424425            self._tabbed_view.props.current_browser.load_uri(file_uri)
     426            self._tabbed_view.props.current_browser.grab_focus()
    425427
    426428    def write_file(self, file_path):
    427429        if not self.metadata['mime_type']: