From 23c6875a205a79525d228125449327af52ff3d8c Mon Sep 17 00:00:00 2001 From: Florian Boor Date: Thu, 8 Feb 2007 15:40:50 +0000 Subject: gtk+: Add some patches to improve focus control using keyboard for 2.6.10. --- .../gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch | 238 +++++++++++++++++++++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch | 16 ++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch | 91 ++++++++ .../gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch | 32 +++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch | 38 ++++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch | 25 +++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch | 121 +++++++++++ .../gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch | 127 +++++++++++ packages/gtk+/gtk+_2.6.10.bb | 13 +- 9 files changed, 698 insertions(+), 3 deletions(-) create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch create mode 100755 packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch new file mode 100755 index 0000000000..6363ecd23a --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch @@ -0,0 +1,238 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtkcombobox.c 2005-08-18 22:10:57.000000000 +0800 ++++ gtk/gtkcombobox.c 2006-06-22 11:24:32.000000000 +0800 +@@ -54,6 +54,11 @@ + + /* WELCOME, to THE house of evil code */ + ++#define HILDON_MENU_COMBO_MAX_WIDTH 406 ++#define HILDON_MENU_COMBO_MIN_WIDTH 66 ++#define HILDON_MENU_COMBO_MAX_HEIGHT 305 ++#define HILDON_MENU_COMBO_MIN_HEIGHT 70 ++ + typedef struct _ComboCellInfo ComboCellInfo; + struct _ComboCellInfo + { +@@ -1199,6 +1204,8 @@ gtk_combo_box_menu_position_below (GtkMe + gint monitor_num; + GdkRectangle monitor; + ++ g_message ("%s", __FUNCTION__); ++ + /* FIXME: is using the size request here broken? */ + child = GTK_BIN (combo_box)->child; + +@@ -1240,6 +1247,7 @@ gtk_combo_box_menu_position_below (GtkMe + *push_in = FALSE; + } + ++ + static void + gtk_combo_box_menu_position_over (GtkMenu *menu, + gint *x, +@@ -1247,69 +1255,119 @@ gtk_combo_box_menu_position_over (GtkMen + gboolean *push_in, + gpointer user_data) + { +- GtkComboBox *combo_box; +- GtkWidget *active; + GtkWidget *child; + GtkWidget *widget; ++ GtkWidget *active; + GtkRequisition requisition; +- GList *children; +- gint screen_width; ++ gint screen_width, screen_height; + gint menu_xpos; + gint menu_ypos; +- gint menu_width; ++ gint menu_width, menu_height; ++ gint menu_ypad; ++ gint full_menu_height; ++ gint total_y_padding; + + g_return_if_fail (GTK_IS_COMBO_BOX (user_data)); +- +- combo_box = GTK_COMBO_BOX (user_data); +- widget = GTK_WIDGET (combo_box); + +- gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition); ++ widget = GTK_WIDGET (user_data); ++ child = GTK_BIN (user_data)->child; ++ ++ /* We need to realize the menu, as we are playing with menu item coordinates ++ * inside. */ ++ gtk_widget_realize (GTK_WIDGET (menu)); ++ ++ gtk_widget_get_child_requisition (menu->toplevel, &requisition); + menu_width = requisition.width; ++ menu_height = requisition.height; ++ ++ gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition); ++ full_menu_height = requisition.height; ++ ++ screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget)); ++ screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget)); ++ ++ active = gtk_menu_get_active (menu); + +- active = gtk_menu_get_active (GTK_MENU (combo_box->priv->popup_widget)); + gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos); + + menu_xpos += widget->allocation.x; +- menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2; ++ menu_ypos += widget->allocation.y; + +- if (active != NULL) +- { +- gtk_widget_get_child_requisition (active, &requisition); +- menu_ypos -= requisition.height / 2; +- } ++ /* RTL */ ++ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ++ menu_xpos = menu_xpos + widget->allocation.width - menu_width; ++ ++ /* Substract borders */ ++ gtk_widget_style_get (GTK_WIDGET (menu), ++ "vertical-padding", &menu_ypad, ++ NULL); + +- children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->children; +- while (children) ++ total_y_padding = menu_ypad + GTK_CONTAINER (menu)->border_width + ++ GTK_WIDGET (menu)->style->ythickness; ++ ++ /* Substract scroll arrow height if needed, and calculate ++ * scroll_offset. */ ++ if (full_menu_height > HILDON_MENU_COMBO_MAX_HEIGHT) + { +- child = children->data; ++ GList *child; ++ int pos; + +- if (active == child) +- break; ++ child = GTK_MENU_SHELL (menu)->children; ++ pos = 0; + +- if (GTK_WIDGET_VISIBLE (child)) +- { +- gtk_widget_get_child_requisition (child, &requisition); +- menu_ypos -= requisition.height; +- } ++ while (child) ++ { ++ GtkWidget *child_widget = GTK_WIDGET (child->data); ++ ++ if (active == child_widget) ++ break; + +- children = children->next; ++ if (GTK_WIDGET_VISIBLE (child)) ++ { ++ pos += child_widget->allocation.height; ++ ++ if (pos > HILDON_MENU_COMBO_MAX_HEIGHT) ++ menu->scroll_offset += child_widget->allocation.height; ++ } ++ ++ child = child->next; ++ } + } + +- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) +- menu_xpos = menu_xpos + widget->allocation.width - menu_width; ++ /* Try to get active item and widget lined up */ ++ if (active != NULL) ++ { ++ gint new_menu_ypos; ++ ++ new_menu_ypos = menu_ypos - active->allocation.y - total_y_padding + ++ menu->scroll_offset; ++ if (new_menu_ypos < 0 || (new_menu_ypos + menu_height) > screen_height) ++ { ++ /* Menu doesn't fit - try to get the last item lined up. */ ++ new_menu_ypos = menu_ypos - menu_height + total_y_padding + ++ active->allocation.height; ++ } ++ ++ menu_ypos = new_menu_ypos; ++ } ++ else ++ menu_ypos -= total_y_padding; /* Line up with first item */ + + /* Clamp the position on screen */ +- screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget)); +- + if (menu_xpos < 0) + menu_xpos = 0; + else if ((menu_xpos + menu_width) > screen_width) + menu_xpos -= ((menu_xpos + menu_width) - screen_width); + ++ if (menu_ypos < 0) ++ menu_ypos = 0; ++ else if ((menu_ypos + menu_height) > screen_height) ++ menu_ypos -= ((menu_ypos + menu_height) - screen_height); ++ + *x = menu_xpos; + *y = menu_ypos; + +- *push_in = TRUE; ++ *push_in = FALSE; + } + + static void +@@ -3481,14 +3539,18 @@ gtk_combo_box_key_press (GtkWidget *wi + + switch (event->keyval) + { ++ case GDK_Return: ++ case GDK_KP_Enter: ++ gtk_combo_box_popup (combo_box); ++ return TRUE; + case GDK_Down: + case GDK_KP_Down: +- if (gtk_combo_box_get_active_iter (combo_box, &iter)) +- { +- found = tree_next (combo_box, combo_box->priv->model, +- &iter, &new_iter, FALSE); +- break; +- } ++ if (!gtk_widget_keynav_failed (GTK_WIDGET(combo_box), GTK_DIR_RIGHT)) ++ { ++ found = FALSE; ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(combo_box)), GTK_DIR_TAB_FORWARD); ++ } ++ break; + /* else fall through */ + case GDK_Page_Up: + case GDK_KP_Page_Up: +@@ -3496,22 +3558,21 @@ gtk_combo_box_key_press (GtkWidget *wi + case GDK_KP_Home: + found = tree_first (combo_box, combo_box->priv->model, &new_iter, FALSE); + break; +- + case GDK_Up: + case GDK_KP_Up: +- if (gtk_combo_box_get_active_iter (combo_box, &iter)) +- { +- found = tree_prev (combo_box, combo_box->priv->model, +- &iter, &new_iter, FALSE); +- break; +- } ++ if (!gtk_widget_keynav_failed (GTK_WIDGET(combo_box), GTK_DIR_LEFT)) ++ { ++ found = FALSE; ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(combo_box)), GTK_DIR_TAB_BACKWARD); ++ } ++ break; + /* else fall through */ + case GDK_Page_Down: + case GDK_KP_Page_Down: + case GDK_End: + case GDK_KP_End: + found = tree_last (combo_box, combo_box->priv->model, &new_iter, FALSE); +- break; ++ break; + default: + return FALSE; + } diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch new file mode 100755 index 0000000000..def741af5d --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch @@ -0,0 +1,16 @@ +--- gtk/gtkentry.c 2005-08-18 22:10:57.000000000 +0800 ++++ gtk/gtkentry.c 2006-05-29 14:42:55.980731414 +0800 +@@ -2386,6 +2386,13 @@ gtk_entry_move_cursor (GtkEntry *e + break; + case GTK_MOVEMENT_VISUAL_POSITIONS: + new_pos = gtk_entry_move_visually (entry, new_pos, count); ++ if (entry->current_pos == new_pos && !extend_selection) ++ { ++ if (!gtk_widget_keynav_failed (GTK_WIDGET(entry), count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT)) ++ { ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(entry)), count > 0 ? GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD); ++ } ++ } + break; + case GTK_MOVEMENT_WORDS: + while (count > 0) diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch new file mode 100755 index 0000000000..6ac9629767 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch @@ -0,0 +1,91 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtkiconview.c 2005-08-18 22:10:58.000000000 +0800 ++++ gtk/gtkiconview.c 2006-05-31 18:12:34.423427466 +0800 +@@ -2678,10 +2678,73 @@ find_item (GtkIconView *icon_view, + + /* FIXME: this could be more efficient + */ +- row = current->row + row_ofs; +- col = current->col + col_ofs; ++ int columns = (icon_view->priv->width - icon_view->priv->margin * 2 + icon_view->priv->column_spacing) / (icon_view->priv->column_spacing + current->width); ++ int rows = g_list_length (icon_view->priv->items) / columns; ++ if (g_list_length (icon_view->priv->items) % columns > 0) ++ rows++; + +- for (items = icon_view->priv->items; items; items = items->next) ++ items = g_list_last(icon_view->priv->items); ++ item = items->data; ++ if (col_ofs == 1) //right is pressed ++ { ++ if (current->col == item->col && current->row == (rows - 1)) //the current item is the last one, wrap to the first item ++ { ++ row = 0; ++ col = 0; ++ } ++ else if (current->col == (columns - 1)) //the current item is the rightmost one ++ { ++ row = current->row + row_ofs + 1; ++ col = 0; ++ } ++ else ++ { ++ row = current->row + row_ofs; ++ col = current->col + col_ofs; ++ } ++ } ++ else if (col_ofs == -1) //left is pressed ++ { ++ if (current->col == 0) //the current item is the leftmost one ++ { ++ if (current->row == 0) //the current item is the first one, wrap to the last item ++ { ++ row = rows - 1; ++ col = item->col; ++ } ++ else ++ { ++ row = current->row + row_ofs - 1; ++ col = columns - 1; ++ } ++ } ++ else ++ { ++ row = current->row + row_ofs; ++ col = current->col + col_ofs; ++ } ++ } ++ else if (row_ofs == 1) //down is pressed ++ { ++ if (current->row == (rows - 2) && item->col < current->col)// at the second last row ++ { ++ row = current->row + row_ofs; ++ col = 0; ++ } ++ else ++ { ++ row = current->row + row_ofs; ++ col = current->col + col_ofs; ++ } ++ } ++ else //up is pressed ++ { ++ row = current->row + row_ofs; ++ col = current->col + col_ofs; ++ } ++ ++ g_message ("row:%d, col:%d", row, col); ++ for (items = icon_view->priv->items; items; items = items->next) + { + item = items->data; + if (item->row == row && item->col == col) +@@ -2819,8 +2882,10 @@ gtk_icon_view_move_cursor_up_down (GtkIc + count, 0); + + if (!item) ++ { ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(icon_view)), count > 0 ? GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD); + return; +- ++ } + if (icon_view->priv->ctrl_pressed || + !icon_view->priv->shift_pressed || + !icon_view->priv->anchor_item || diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch new file mode 100755 index 0000000000..4497261ec6 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch @@ -0,0 +1,32 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtkradiobutton.c 2005-08-18 22:10:58.000000000 +0800 ++++ gtk/gtkradiobutton.c 2006-05-26 17:12:35.000000000 +0800 +@@ -522,6 +522,12 @@ gtk_radio_button_focus (GtkWidget + + if (!new_focus) + { ++ if (!gtk_widget_keynav_failed (widget, direction)) ++ { ++ g_slist_free (focus_list); ++ return FALSE; ++ } ++ + tmp_list = focus_list; + + while (tmp_list) +@@ -542,8 +548,15 @@ gtk_radio_button_focus (GtkWidget + + if (new_focus) + { ++ GtkSettings *settings = gtk_widget_get_settings (widget); ++ gboolean cursor_only_focus; ++ ++ g_object_get (settings, ++ "gtk-cursor-only-focus", &cursor_only_focus, ++ NULL); + gtk_widget_grab_focus (new_focus); +- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE); ++ if (!cursor_only_focus) ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE); + } + + return TRUE; diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch new file mode 100755 index 0000000000..0c3beeec49 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch @@ -0,0 +1,38 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtksettings.c 2005-08-18 22:10:59.000000000 +0800 ++++ gtk/gtksettings.c 2006-05-29 10:29:35.000000000 +0800 +@@ -72,7 +72,8 @@ enum { + PROP_XFT_RGBA, + PROP_XFT_DPI, + #endif +- PROP_ALTERNATIVE_BUTTON_ORDER ++ PROP_ALTERNATIVE_BUTTON_ORDER, ++ PROP_CURSOR_ONLY_FOCUS + }; + + +@@ -435,6 +436,25 @@ gtk_settings_class_init (GtkSettingsClas + G_PARAM_READWRITE), + NULL); + g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER); ++ ++ /** ++ * GtkSettings:gtk-cursor-only-focus: ++ * ++ * When TRUE, keyboard navigation should be able to reach all widgets ++ * by using the cursor keys only. Tab, Shift etc. keys can't be expected ++ * to be present on the used input device. ++ * ++ * Since: 2.10 ++ */ ++ result = settings_install_property_parser (class, ++ g_param_spec_boolean ("gtk-cursor-only-focus", ++ P_("Cursor Only Focus"), ++ P_("When TRUE, there are only cursor keys available to navigate widgets"), ++ FALSE, ++ G_PARAM_READWRITE), ++ NULL); ++ ++ g_assert (result == PROP_CURSOR_ONLY_FOCUS); + } + + static void diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch new file mode 100755 index 0000000000..e3231b38d0 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch @@ -0,0 +1,25 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtktextview.c 2005-08-18 22:10:59.000000000 +0800 ++++ gtk/gtktextview.c 2006-07-03 15:34:19.880257250 +0800 +@@ -3855,6 +3855,22 @@ gtk_text_view_key_press_event (GtkWidget + + insert = gtk_text_buffer_get_insert (get_buffer (text_view)); + gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert); ++ ++ int lineCount = gtk_text_buffer_get_line_count (get_buffer (text_view)); ++ int curLine = gtk_text_iter_get_line (&iter); ++ if (curLine == 0 && (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) ++ && (!gtk_widget_keynav_failed (GTK_WIDGET(text_view), GTK_DIR_UP))) ++ { ++ gtk_text_view_move_focus (text_view,GTK_DIR_TAB_BACKWARD); ++ return TRUE; ++ } ++ else if (curLine == (lineCount - 1) && (event->keyval == GDK_Down || event->keyval == GDK_KP_Down) ++ && (!gtk_widget_keynav_failed (GTK_WIDGET(text_view), GTK_DIR_DOWN))) ++ { ++ gtk_text_view_move_focus (text_view,GTK_DIR_TAB_FORWARD); ++ return TRUE; ++ } ++ + can_insert = gtk_text_iter_can_insert (&iter, text_view->editable); + if (can_insert && + gtk_im_context_filter_keypress (text_view->im_context, event)) diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch new file mode 100755 index 0000000000..f83558d879 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch @@ -0,0 +1,121 @@ +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/gtktreeview.c 2006-06-29 14:06:27.099142881 +0800 ++++ gtk/gtktreeview.c 2006-06-29 14:06:53.746305635 +0800 +@@ -4198,6 +4198,118 @@ gtk_tree_view_key_press (GtkWidget *wi + return TRUE; + } + ++ GtkTreeViewColumn *focus_column; ++ GtkTreePath *tree_path; ++ gtk_tree_view_get_cursor (tree_view, &tree_path, &focus_column); ++ GtkTreeModel *tree_model = gtk_tree_view_get_model (tree_view); ++ ++ if (tree_model && tree_path ++ && (event->keyval == GDK_Up || event->keyval == GDK_KP_Up ++ || event->keyval == GDK_Down || event->keyval == GDK_KP_Down)) ++ { ++ GtkTreeIter cur_iter; ++ if (gtk_tree_model_get_iter (tree_model, &cur_iter, tree_path)) ++ { ++ GtkTreeIter iter; ++ GtkTreePath *path; ++ if ((event->keyval == GDK_Up || event->keyval == GDK_KP_Up) ++ && !gtk_widget_keynav_failed (GTK_WIDGET(tree_view), GTK_DIR_UP)) ++ { ++ gtk_tree_model_get_iter_first (tree_model, &iter); ++ path = gtk_tree_model_get_path (tree_model, &iter); ++ if (gtk_tree_path_compare (tree_path, path) == 0) ++ { ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(tree_view)), GTK_DIR_TAB_BACKWARD); ++ gtk_tree_path_free (tree_path); ++ gtk_tree_path_free (path); ++ return TRUE; ++ } ++ gtk_tree_path_free (path); ++ } ++ if ((event->keyval == GDK_Down || event->keyval == GDK_KP_Down) ++ && !gtk_widget_keynav_failed (GTK_WIDGET(tree_view), GTK_DIR_DOWN)) ++ { ++ if (!gtk_tree_model_iter_next (tree_model, &cur_iter))//cur_iter is the last one at its level ++ { ++ gtk_tree_model_get_iter (tree_model, &cur_iter, tree_path); ++ ++ if (!gtk_tree_model_iter_parent (tree_model, &iter, &cur_iter))//cur_iter is at toplevel ++ { ++ if (!gtk_tree_model_iter_has_child (tree_model, &cur_iter) || !gtk_tree_view_row_expanded (tree_view, tree_path)) ++ { ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(tree_view)), GTK_DIR_TAB_FORWARD); ++ gtk_tree_path_free (tree_path); ++ return TRUE; ++ } ++ } ++ else//check if every ancestor of cur_iter is the last one at its level ++ { ++ path = gtk_tree_model_get_path (tree_model, &iter); ++ int depth = gtk_tree_path_get_depth (path); ++ int i; ++ for (i = 0; i < depth; i++) ++ { ++ if (!gtk_tree_model_iter_next (tree_model, &iter)) ++ { ++ gtk_tree_path_up (path); ++ if (gtk_tree_path_to_string (path)) ++ gtk_tree_model_get_iter (tree_model, &iter, path); ++ } ++ else ++ break; ++ } ++ if (i == depth) ++ { ++ if (!gtk_tree_model_iter_has_child (tree_model, &cur_iter) || !gtk_tree_view_row_expanded (tree_view, tree_path)) ++ { ++ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET(tree_view)), GTK_DIR_TAB_FORWARD); ++ gtk_tree_path_free (path); ++ gtk_tree_path_free (tree_path); ++ return TRUE; ++ } ++ } ++ gtk_tree_path_free (path); ++ } ++ } ++ } ++ } ++ } ++ ++ if (tree_view->priv->columns && tree_path ++ && (event->keyval == GDK_Left || event->keyval == GDK_KP_Left ++ || event->keyval == GDK_Right || event->keyval == GDK_KP_Right)) ++ { ++ list = tree_view->priv->columns; ++ guint length = g_list_length (list); ++ guint i = 0; ++ while (list) ++ { ++ GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data); ++ ++ if (column == focus_column) ++ { ++ if (i == 0 && (event->keyval == GDK_Left || event->keyval == GDK_KP_Left)) ++ { ++ list = g_list_last (list); ++ gtk_tree_view_set_cursor (tree_view, tree_path, GTK_TREE_VIEW_COLUMN (list->data), FALSE); ++ gtk_tree_path_free (tree_path); ++ return TRUE; ++ } ++ if (i == length - 1 && (event->keyval == GDK_Right || event->keyval == GDK_KP_Right)) ++ { ++ list = g_list_first (list); ++ gtk_tree_view_set_cursor (tree_view, tree_path, GTK_TREE_VIEW_COLUMN (list->data), FALSE); ++ gtk_tree_path_free (tree_path); ++ return TRUE; ++ } ++ } ++ list = list->next; ++ i++; ++ } ++ } ++ ++ gtk_tree_path_free (tree_path); ++ + if (tree_view->priv->columns && (event->state & GDK_SHIFT_MASK) + && (event->keyval == GDK_Left || event->keyval == GDK_KP_Left + || event->keyval == GDK_Right || event->keyval == GDK_KP_Right)) diff --git a/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch new file mode 100755 index 0000000000..7cf4e13cf6 --- /dev/null +++ b/packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch @@ -0,0 +1,127 @@ +diff -r -u -p /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.c gtk/widget/gtkwidget.c +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.c 2006-05-30 13:57:49.732943065 +0800 ++++ gtk/gtkwidget.c 2006-05-30 13:57:24.716589268 +0800 +@@ -120,6 +120,7 @@ enum { + ACCEL_CLOSURES_CHANGED, + SCREEN_CHANGED, + CAN_ACTIVATE_ACCEL, ++ KEYNAV_FAILED, + LAST_SIGNAL + }; + +@@ -202,6 +203,8 @@ static gboolean gtk_widget_real_focus_o + GdkEventFocus *event); + static gboolean gtk_widget_real_focus (GtkWidget *widget, + GtkDirectionType direction); ++static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget, ++ GtkDirectionType direction); + static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget); + static void gtk_widget_propagate_state (GtkWidget *widget, + GtkStateData *data); +@@ -363,6 +366,7 @@ gtk_widget_class_init (GtkWidgetClass *k + klass->mnemonic_activate = gtk_widget_real_mnemonic_activate; + klass->grab_focus = gtk_widget_real_grab_focus; + klass->focus = gtk_widget_real_focus; ++ klass->keynav_failed = gtk_widget_real_keynav_failed; + klass->event = NULL; + klass->button_press_event = NULL; + klass->button_release_event = NULL; +@@ -1368,6 +1372,16 @@ gtk_widget_class_init (GtkWidgetClass *k + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GDK_TYPE_SCREEN); ++ ++ widget_signals[KEYNAV_FAILED] = ++ g_signal_new (("keynav_failed"), ++ G_TYPE_FROM_CLASS (object_class), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET (GtkWidgetClass, keynav_failed), ++ _gtk_boolean_handled_accumulator, NULL, ++ _gtk_marshal_BOOLEAN__ENUM, ++ G_TYPE_BOOLEAN, 1, ++ GTK_TYPE_DIRECTION_TYPE); + /** + * GtkWidget::can-activate-accel: + * @widget: the object which received the signal +@@ -4044,6 +4058,34 @@ gtk_widget_real_focus (GtkWidget + return FALSE; + } + ++static gboolean ++gtk_widget_real_keynav_failed (GtkWidget *widget, ++ GtkDirectionType direction) ++{ ++ GtkSettings *settings = gtk_widget_get_settings (widget); ++ gboolean cursor_only_focus; ++ ++ g_object_get (settings, "gtk-cursor-only-focus", &cursor_only_focus, NULL); ++ ++ switch (direction) ++ { ++ case GTK_DIR_TAB_FORWARD: ++ case GTK_DIR_TAB_BACKWARD: ++ return FALSE; ++ ++ case GTK_DIR_UP: ++ case GTK_DIR_DOWN: ++ case GTK_DIR_LEFT: ++ case GTK_DIR_RIGHT: ++ if (cursor_only_focus) ++ return FALSE; ++ } ++ ++ gdk_beep (); ++ ++ return TRUE; ++} ++ + /** + * gtk_widget_is_focus: + * @widget: a #GtkWidget +@@ -5500,6 +5542,20 @@ gtk_widget_child_focus (GtkWidget + return return_val; + } + ++gboolean ++gtk_widget_keynav_failed (GtkWidget *widget, ++ GtkDirectionType direction) ++{ ++ gboolean return_val; ++ ++ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); ++ ++ g_signal_emit (widget, widget_signals[KEYNAV_FAILED], 0, ++ direction, &return_val); ++ ++ return return_val; ++} ++ + /** + * gtk_widget_set_uposition: + * @widget: a #GtkWidget +diff -r -u -p /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.h gtk/widget/gtkwidget.h +--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.h 2006-05-30 13:57:49.736942642 +0800 ++++ gtk/gtkwidget.h 2006-05-30 13:57:24.716589268 +0800 +@@ -406,8 +406,9 @@ struct _GtkWidgetClass + gboolean (*can_activate_accel) (GtkWidget *widget, + guint signal_id); + ++ gboolean (* keynav_failed) (GtkWidget *widget, ++ GtkDirectionType direction); + /* Padding for future expansion */ +- void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); + void (*_gtk_reserved4) (void); + void (*_gtk_reserved5) (void); +@@ -562,7 +563,8 @@ GdkWindow *gtk_widget_get_parent_window + + gboolean gtk_widget_child_focus (GtkWidget *widget, + GtkDirectionType direction); +- ++gboolean gtk_widget_keynav_failed (GtkWidget *widget, ++ GtkDirectionType direction); + void gtk_widget_set_size_request (GtkWidget *widget, + gint width, + gint height); +Only in gtk/widget: gtkwidget.h.bak +Only in gtk/widget: gtkwidget.lo diff --git a/packages/gtk+/gtk+_2.6.10.bb b/packages/gtk+/gtk+_2.6.10.bb index b0eb0dbcdb..f3d36bcb52 100644 --- a/packages/gtk+/gtk+_2.6.10.bb +++ b/packages/gtk+/gtk+_2.6.10.bb @@ -5,7 +5,7 @@ SECTION = "libs" LICENSE = "LGPL" PRIORITY = "optional" DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt" -PR = "r7" +PR = "r8" SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ file://help.patch;patch=1 \ @@ -24,7 +24,15 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ file://migration.patch;patch=1;pnum=0 \ file://single-click.patch;patch=1 \ file://menu-styling.patch;patch=1 \ - file://compile-against-newer-glib.patch;patch=1" + file://compile-against-newer-glib.patch;patch=1 \ + file://gtk.keynav.gtkcombobox.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtkentry.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtkiconview.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtkradiobutton.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtksettings.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtktextview.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtktreeview.patch;patch=1;pnum=0 \ + file://gtk.keynav.gtkwidget.patch;patch=1;pnum=0" inherit autotools pkgconfig @@ -53,7 +61,6 @@ EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest --enable-disp # --disable-cruft LIBV = "2.4.0" - do_configure_prepend() { for i in `find . -name "Makefile.am"` do -- cgit v1.2.3