2007-08-24 Michael Dominic Kostrzewa <michael.kostrzewa@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@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.
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);
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;
}
}
+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
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);
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;
}
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)
* 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);
{
/* 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:
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 ();
gboolean G_GNUC_INTERNAL
hildon_private_composite_focus (GtkWidget *widget,
- GtkDirectionType direction);
+ GtkDirectionType direction,
+ GtkDirectionType *effective_direction);
G_END_DECLS
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);
#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;
}
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)
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);
/* 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;
}
}
+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)