[maemo-commits] [maemo-commits] r13403 - in projects/haf/trunk/hildon-1: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 24 16:00:49 EEST 2007
Author: mdk
Date: 2007-08-24 16:00:44 +0300 (Fri, 24 Aug 2007)
New Revision: 13403

Modified:
   projects/haf/trunk/hildon-1/ChangeLog
   projects/haf/trunk/hildon-1/src/hildon-date-editor.c
   projects/haf/trunk/hildon-1/src/hildon-number-editor.c
   projects/haf/trunk/hildon-1/src/hildon-private.c
   projects/haf/trunk/hildon-1/src/hildon-private.h
   projects/haf/trunk/hildon-1/src/hildon-time-editor.c
   projects/haf/trunk/hildon-1/src/hildon-weekday-picker.c
Log:
A patch by Xan Lopez to fix focus handling in subclassed composite widgets. Fixes: NB#66628.


Modified: projects/haf/trunk/hildon-1/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-1/ChangeLog	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/ChangeLog	2007-08-24 13:00:44 UTC (rev 13403)
@@ -1,5 +1,15 @@
 2007-08-24  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
+	* src/hildon-date-editor.c:
+	* src/hildon-number-editor.c:
+	* src/hildon-private.c:
+	* src/hildon-private.h:
+	* src/hildon-time-editor.c:
+	* src/hildon-weekday-picker.c: A patch by Xan Lopez to fix focus
+	handling in subclassed composite widgets. Fixes: NB#66628.
+
+2007-08-24  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
 	* src/hildon-window.c: Removing extra gtk_main_iteration () processing
 	from destroy_ callback as it introduces problems in async dbus signal
 	handlers. Fixes NB#66673.

Modified: projects/haf/trunk/hildon-1/src/hildon-date-editor.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-date-editor.c	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-date-editor.c	2007-08-24 13:00:44 UTC (rev 13403)
@@ -164,8 +164,10 @@
 static void
 hildon_date_editor_size_request                 (GtkWidget *widget,
                                                  GtkRequisition *requisition);
-
 static gboolean
+hildon_date_editor_focus                        (GtkWidget *widget,
+                                                 GtkDirectionType direction);
+static gboolean
 hildon_date_editor_entry_select_all             (GtkWidget *widget);
 
 /* Property indices */
@@ -234,7 +236,7 @@
     gobject_class->get_property             = hildon_date_editor_get_property;
     widget_class->size_request              = hildon_date_editor_size_request;
     widget_class->size_allocate             = hildon_date_editor_size_allocate;
-    widget_class->focus                     = hildon_private_composite_focus;
+    widget_class->focus                     = hildon_date_editor_focus;
 
     container_class->forall                 = hildon_child_forall;
     GTK_OBJECT_CLASS(editor_class)->destroy = hildon_date_editor_destroy;
@@ -1332,6 +1334,23 @@
     }
 }
 
+static gboolean
+hildon_date_editor_focus                      (GtkWidget *widget,
+                                               GtkDirectionType direction)
+{
+  gboolean retval;
+  GtkDirectionType effective_direction;
+
+  g_assert (HILDON_IS_EDITOR_EDITOR (widget));
+
+  retval = hildon_private_composite_focus (widget, direction, &effective_direction);
+
+  if (retval == TRUE)
+    return GTK_WIDGET_CLASS (parent_class)->focus (widget, effective_direction);
+  else
+    return FALSE;
+}
+
 /**
  * hildon_date_editor_set_year:
  * @editor: the @HildonDateEditor widget

Modified: projects/haf/trunk/hildon-1/src/hildon-number-editor.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-number-editor.c	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-number-editor.c	2007-08-24 13:00:44 UTC (rev 13403)
@@ -96,6 +96,10 @@
                                                  GtkAllocation *allocation);
 
 static gboolean
+hildon_number_editor_focus                      (GtkWidget *widget,
+                                                 GtkDirectionType direction);
+
+static gboolean
 hildon_number_editor_entry_keypress             (GtkWidget *widget, 
                                                  GdkEventKey *event,
                                                  gpointer data);
@@ -220,7 +224,7 @@
 
     widget_class->size_request              = hildon_number_editor_size_request;
     widget_class->size_allocate             = hildon_number_editor_size_allocate;
-    widget_class->focus                     = hildon_private_composite_focus;
+    widget_class->focus                     = hildon_number_editor_focus;
 
     editor_class->range_error = hildon_number_editor_range_error;
 
@@ -761,6 +765,23 @@
 }
 
 static gboolean
+hildon_number_editor_focus                      (GtkWidget *widget,
+                                                 GtkDirectionType direction)
+{
+  gboolean retval;
+  GtkDirectionType effective_direction;
+
+  g_assert (HILDON_IS_EDITOR_EDITOR (widget));
+
+  retval = hildon_private_composite_focus (widget, direction, &effective_direction);
+
+  if (retval == TRUE)
+    return GTK_WIDGET_CLASS (parent_class)->focus (widget, effective_direction);
+  else
+    return FALSE;
+}
+
+static gboolean
 hildon_number_editor_entry_focusout             (GtkWidget *widget, 
                                                  GdkEventFocus *event,
                                                  gpointer data)

Modified: projects/haf/trunk/hildon-1/src/hildon-private.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-private.c	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-private.c	2007-08-24 13:00:44 UTC (rev 13403)
@@ -39,13 +39,13 @@
  * regardless of where the focus is coming from.
  */
 gboolean G_GNUC_INTERNAL
-hildon_private_composite_focus                  (GtkWidget *widget, 
-                                                 GtkDirectionType direction)
+hildon_private_composite_focus                  (GtkWidget *widget,
+                                                 GtkDirectionType direction,
+                                                 GtkDirectionType *effective_direction)
 {
   GtkWidget *toplevel = NULL;
   GtkWidget *focus_widget = NULL;
   gboolean coming_from_outside = FALSE;
-  GtkDirectionType effective_direction;
 
   toplevel = gtk_widget_get_toplevel (widget);
 
@@ -55,11 +55,11 @@
     {
       /* When coming from outside we want to give focus to the first
          item in the widgets */
-      effective_direction = GTK_DIR_TAB_FORWARD;
+      *effective_direction = GTK_DIR_TAB_FORWARD;
       coming_from_outside = TRUE;
     }
   else
-    effective_direction = direction;
+    *effective_direction = direction;
 
   switch (direction) {
       case GTK_DIR_UP:
@@ -68,11 +68,10 @@
       case GTK_DIR_TAB_BACKWARD:
         if ((HILDON_IS_DATE_EDITOR (widget) || HILDON_IS_TIME_EDITOR(widget)) &&
             !coming_from_outside)
-          return FALSE;
+            return FALSE;
         /* fall through */
       default:
-        return GTK_WIDGET_CLASS (g_type_class_peek_parent
-                                 (GTK_WIDGET_GET_CLASS(widget)))->focus (widget, effective_direction);
+        return TRUE;
   }
 
   g_assert_not_reached ();

Modified: projects/haf/trunk/hildon-1/src/hildon-private.h
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-private.h	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-private.h	2007-08-24 13:00:44 UTC (rev 13403)
@@ -31,7 +31,8 @@
 
 gboolean G_GNUC_INTERNAL
 hildon_private_composite_focus                  (GtkWidget *widget, 
-                                                 GtkDirectionType direction);
+                                                 GtkDirectionType direction,
+                                                 GtkDirectionType *effective_direction);
 
 G_END_DECLS
 

Modified: projects/haf/trunk/hildon-1/src/hildon-time-editor.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-time-editor.c	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-time-editor.c	2007-08-24 13:00:44 UTC (rev 13403)
@@ -225,6 +225,10 @@
                                                  GtkAllocation *allocation);
 
 static gboolean
+hildon_time_editor_focus                        (GtkWidget *widget,
+                                                 GtkDirectionType direction);
+
+static gboolean
 hildon_time_editor_entry_keypress (GtkEntry *entry,
                                    GdkEventKey* event,
                                    gpointer user_data);
@@ -365,7 +369,7 @@
 #ifdef MAEMO_GTK 
     widget_class->tap_and_hold_setup            = hildon_time_editor_tap_and_hold_setup;
 #endif
-    widget_class->focus                         = hildon_private_composite_focus;
+    widget_class->focus                         = hildon_time_editor_focus;
 
     container_class->forall                     = hildon_time_editor_forall;
     GTK_OBJECT_CLASS (editor_class)->destroy    = hildon_time_editor_destroy;
@@ -1777,6 +1781,23 @@
 }
 
 static gboolean
+hildon_time_editor_focus                      (GtkWidget *widget,
+                                               GtkDirectionType direction)
+{
+  gboolean retval;
+  GtkDirectionType effective_direction;
+
+  g_assert (HILDON_IS_EDITOR_EDITOR (widget));
+
+  retval = hildon_private_composite_focus (widget, direction, &effective_direction);
+
+  if (retval == TRUE)
+    return GTK_WIDGET_CLASS (parent_class)->focus (widget, effective_direction);
+  else
+    return FALSE;
+}
+
+static gboolean
 hildon_time_editor_entry_keypress (GtkEntry *entry,
                                    GdkEventKey *event,
                                    gpointer data)

Modified: projects/haf/trunk/hildon-1/src/hildon-weekday-picker.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-weekday-picker.c	2007-08-24 11:43:38 UTC (rev 13402)
+++ projects/haf/trunk/hildon-1/src/hildon-weekday-picker.c	2007-08-24 13:00:44 UTC (rev 13403)
@@ -89,6 +89,9 @@
 static void
 hildon_weekday_picker_size_allocate             (GtkWidget *widget,
                                                  GtkAllocation *allocation);
+static gboolean
+hildon_weekday_picker_focus                     (GtkWidget *widget,
+                                                 GtkDirectionType direction);
 static void
 hildon_weekday_picker_size_request              (GtkWidget *widget,
                                                  GtkRequisition *requisition);
@@ -160,7 +163,7 @@
     /* Override virtual methods */
     widget_class->size_request                  = hildon_weekday_picker_size_request;
     widget_class->size_allocate                 = hildon_weekday_picker_size_allocate;
-    widget_class->focus                         = hildon_private_composite_focus;
+    widget_class->focus                         = hildon_weekday_picker_focus;
     container_class->forall                     = hildon_weekday_picker_forall;
     GTK_OBJECT_CLASS (picker_class)->destroy    = hildon_weekday_picker_destroy;
 
@@ -374,6 +377,23 @@
     }
 }
 
+static gboolean
+hildon_weekday_picker_focus                      (GtkWidget *widget,
+                                                  GtkDirectionType direction)
+{
+  gboolean retval;
+  GtkDirectionType effective_direction;
+
+  g_assert (HILDON_IS_EDITOR_EDITOR (widget));
+
+  retval = hildon_private_composite_focus (widget, direction, &effective_direction);
+
+  if (retval == TRUE)
+    return GTK_WIDGET_CLASS (parent_class)->focus (widget, effective_direction);
+  else
+    return FALSE;
+}
+
 static void
 button_toggle                                   (GtkToggleButton *button, 
                                                  gpointer wpicker)


More information about the maemo-commits mailing list