Changed input method for keyboard
authorHarishankar <v.harishankar@gmail.com>
Wed, 8 Dec 2010 14:56:14 +0000 (20:26 +0530)
committerHarishankar <v.harishankar@gmail.com>
Wed, 8 Dec 2010 14:56:14 +0000 (20:26 +0530)
Changed the input method for keyboard such that even when the
puzzle grid is out of focus, the grid will be responsive to input

player_mainwindow.py
playerwindow.glade

index 8ffdb16..e167f03 100644 (file)
@@ -199,9 +199,6 @@ along with GetAClue.  If not, see <http://www.gnu.org/licenses/>."""
                # update the puzzle grid
                puzgrid = self.ui.get_object ("puzzlegrid")
 
-               # set focus to the puzzle grid
-               self.window.set_focus (puzgrid)
-
                puzgrid.queue_draw ()
 
        # callback for tree view "across" being activated
@@ -324,9 +321,10 @@ along with GetAClue.  If not, see <http://www.gnu.org/licenses/>."""
 
                return False
 
-       # callback for puzzle grid key release event
-       def on_puzzlegrid_key_press_event (self, drawarea, event):
+       # callback for main window key release event
+       def on_mainwindow_key_press_event (self, window, event):
                if self.puzzle:
+                       drawarea = self.ui.get_object ("puzzlegrid")
                        key = gtk.gdk.keyval_name (event.keyval).lower ()
 
                        if event.state == gtk.gdk.SHIFT_MASK and key == "up":
index 2727527..90e4750 100644 (file)
@@ -27,6 +27,7 @@
     <property name="default_height">480</property>
     <property name="icon">resources/getaclue.svg</property>
     <signal name="destroy" handler="on_mainwindow_destroy"/>
+    <signal name="key_press_event" handler="on_mainwindow_key_press_event"/>
     <signal name="delete_event" handler="on_mainwindow_delete_event"/>
     <child>
       <object class="GtkVBox" id="vbox1">
                         <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
                         <signal name="expose_event" handler="on_puzzlegrid_expose_event"/>
                         <signal name="button_press_event" handler="on_puzzlegrid_button_press_event"/>
-                        <signal name="key_press_event" handler="on_puzzlegrid_key_press_event"/>
                         <signal name="focus_in_event" handler="on_puzzlegrid_focus_in_event"/>
                         <signal name="focus_out_event" handler="on_puzzlegrid_focus_out_event"/>
                       </object>