[dasher] Make button modes receive key presses.



commit 92be6e9a88c4260c9705f0534f4b14b8a8b34b5c
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Aug 14 22:36:21 2009 +0200

    Make button modes receive key presses.
    The odd thing is that there is the following:
    TODO: Make this only work for children of the main window
    yet the fix was to make it work for the main window as well as its children.

 ChangeLog                |    1 +
 Src/Gtk2/dasher_main.cpp |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 92ae7c6..6cdaaab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* Trivial fix so Chinese will compile - ConversionNodes are still
 	  unhappy.
+	* Make button modes receive key presses.
 
 2009-08-11  Alan Lawrence <acl33 inf phy cam ac uk>
 
diff --git a/Src/Gtk2/dasher_main.cpp b/Src/Gtk2/dasher_main.cpp
index 1e8f53e..e7493f4 100644
--- a/Src/Gtk2/dasher_main.cpp
+++ b/Src/Gtk2/dasher_main.cpp
@@ -1437,7 +1437,8 @@ handle_start_event(GtkDasherControl *pDasherControl, gpointer data) {
 
 // TODO: Make this only work for children of the main window
 extern "C" gint 
-dasher_main_key_snooper(GtkWidget *pWidget, GdkEventKey *pEvent, gpointer pUserData) {
+dasher_main_key_snooper(GtkWidget *pWidget, GdkEventKey *pEvent,
+                        gpointer pUserData) {
   DasherMain *pSelf = DASHER_MAIN(pUserData);
 
   gint iButton = dasher_main_lookup_key(pSelf, pEvent->keyval);
@@ -1445,7 +1446,8 @@ dasher_main_key_snooper(GtkWidget *pWidget, GdkEventKey *pEvent, gpointer pUserD
   if(iButton != -1) {
     DasherMainPrivate *pPrivate = DASHER_MAIN_GET_PRIVATE(pSelf);
 
-    if(gtk_widget_is_ancestor(pWidget, GTK_WIDGET(pPrivate->pMainWindow))) {
+    if (pWidget == GTK_WIDGET(pPrivate->pMainWindow) ||
+        gtk_widget_is_ancestor(pWidget, GTK_WIDGET(pPrivate->pMainWindow))) {
       if(pPrivate->pDasherWidget) {
         if(pEvent->type == GDK_KEY_PRESS)
           gtk_dasher_control_external_key_down(GTK_DASHER_CONTROL(pPrivate->pDasherWidget), iButton);



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