gnome-mud r811 - in trunk: . src



Author: lharris
Date: Thu Mar 19 06:36:30 2009
New Revision: 811
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=811&view=rev

Log:
Added focus-in-event to MudSubwindow terminal to select the entry.

Modified:
   trunk/ChangeLog
   trunk/src/mud-subwindow.c

Modified: trunk/src/mud-subwindow.c
==============================================================================
--- trunk/src/mud-subwindow.c	(original)
+++ trunk/src/mud-subwindow.c	Thu Mar 19 06:36:30 2009
@@ -137,8 +137,9 @@
                                            GtkAllocation *allocation,
                                            MudSubwindow *self);
 
-static void mud_subwindow_mapped_cb(GtkWidget *widget, MudSubwindow *self);
-                                           
+static gboolean mud_subwindow_focus_in_cb(GtkWidget *widget,
+                                          GdkEventFocus *event,
+                                          gpointer user_data);
 
 /* Private Methods */
 static void mud_subwindow_set_size_force_grid (MudSubwindow *window,
@@ -250,7 +251,6 @@
                 TRUE,
                 G_PARAM_READWRITE));
 
-
     g_object_class_install_property(object_class,
             PROP_VIEW_HIDDEN,
             g_param_spec_boolean("view-hidden",
@@ -474,11 +474,6 @@
                                       self->priv->initial_height);
 
     g_signal_connect(self->priv->window,
-                     "map",
-                     G_CALLBACK(mud_subwindow_mapped_cb),
-                     self);
-
-    g_signal_connect(self->priv->window,
                      "delete-event",
                      G_CALLBACK(mud_subwindow_delete_event_cb),
                      self);
@@ -497,6 +492,11 @@
                      "key_press_event",
                      G_CALLBACK(mud_subwindow_entry_keypress_cb),
                      self);
+
+    g_signal_connect(self->priv->terminal,
+                     "focus-in-event",
+                     G_CALLBACK(mud_subwindow_focus_in_cb),
+                     self);
 }
 
 static void
@@ -878,11 +878,6 @@
     return TRUE;
 }
 
-static void
-mud_subwindow_mapped_cb(GtkWidget *widget, MudSubwindow *self)
-{
-}
-
 static gboolean
 mud_subwindow_configure_event_cb(GtkWidget *widget,
                                  GdkEventConfigure *event,
@@ -890,7 +885,8 @@
 {
     MudSubwindow *self = MUD_SUBWINDOW(user_data);
 
-    gtk_widget_grab_focus(self->priv->entry);
+    if(GTK_WIDGET_MAPPED(self->priv->entry))
+        gtk_widget_grab_focus(self->priv->entry);
 
     return FALSE;
 }
@@ -918,6 +914,19 @@
 }
 
 static gboolean
+mud_subwindow_focus_in_cb(GtkWidget *widget,
+                          GdkEventFocus *event,
+                          gpointer user_data)
+{
+    MudSubwindow *self = MUD_SUBWINDOW(user_data);
+
+    if(GTK_WIDGET_MAPPED(self->priv->entry))
+        gtk_widget_grab_focus(self->priv->entry);
+
+    return TRUE;
+}
+
+static gboolean
 mud_subwindow_entry_keypress_cb(GtkWidget *widget,
                                 GdkEventKey *event,
                                 MudSubwindow *self)



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