[gnome-maps] MainWindow: Make clicking the map grab focus



commit 57e2e3fc466245307cc457becd1c961958a9a462
Author: Dario Di Nucci <linkin88mail gmail com>
Date:   Tue Mar 4 23:25:14 2014 +0100

    MainWindow: Make clicking the map grab focus
    
    If the map does not grab focus on click it will be impossible to
    dismiss the on-screen keyboard it you are using a touch/tablet device.
    
    Set can-focus to true for the GtkOverlay where the map is contained.
    Have the map grab focus after clicking on it or after selecting an
    item in the SearchPopup.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709604

 src/main-window.ui |    1 +
 src/mainWindow.js  |    9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/main-window.ui b/src/main-window.ui
index 5d6afc4..9247031 100644
--- a/src/main-window.ui
+++ b/src/main-window.ui
@@ -103,6 +103,7 @@
     <child>
       <object class="GtkOverlay" id="window-content">
         <property name="visible">True</property>
+        <property name="can-focus">True</property>
         <child>
         </child>
       </object>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7ca6970..dffd00e 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -57,6 +57,7 @@ const MainWindow = new Lang.Class({
         this._searchCompletion = ui.searchCompletion;
         this.window = ui.appWindow;
         this.window.application = app;
+        this._windowContent = ui.windowContent;
 
         this.mapView = new MapView.MapView();
         ui.windowContent.add(this.mapView);
@@ -71,9 +72,9 @@ const MainWindow = new Lang.Class({
         this._initSignals();
         this._restoreWindowGeometry();
 
-        ui.windowContent.add_overlay(new ZoomControl.ZoomControl(this.mapView));
+        this._windowContent.add_overlay(new ZoomControl.ZoomControl(this.mapView));
 
-        ui.windowContent.show_all();
+        this._windowContent.show_all();
     },
 
     _initPlaces: function() {
@@ -91,8 +92,12 @@ const MainWindow = new Lang.Class({
 
         this._searchPopup.connect('selected',
                                   this._onSearchPopupSelected.bind(this));
+        this._searchPopup.connect('selected',
+                                  this._windowContent.grab_focus.bind(this._windowContent));
         this.mapView.view.connect('button-press-event',
                                   this._searchPopup.hide.bind(this._searchPopup));
+        this.mapView.view.connect('button-press-event',
+                                  this._windowContent.grab_focus.bind(this._windowContent));
         this._searchEntry.connect('changed',
                                   this._searchPopup.hide.bind(this._searchPopup));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]