[oe-commits] org.oe.dev gtk+: Add some patches to improve focus control using keyboard for 2.6.10.

florian commit openembedded-commits at lists.openembedded.org
Thu Feb 8 15:53:01 UTC 2007


gtk+: Add some patches to improve focus control using keyboard for 2.6.10.

Author: florian at openembedded.org
Branch: org.openembedded.dev
Revision: d5039444b5c22adb43780c8597c4071b78d8f486
ViewMTN: http://monotone.openembedded.org/revision.psp?id=d5039444b5c22adb43780c8597c4071b78d8f486
Files:
1
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch
packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch
packages/gtk+/gtk+_2.6.10.bb
mtn:execute
true
Diffs:

#
# mt diff -re0a3a7e810f3581c74360f61d2b52630244f943f -rd5039444b5c22adb43780c8597c4071b78d8f486
#
# 
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch"
#  content [10700ce9db5643796ebb1ff912668021c9275384]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch"
#  content [2fdbfa155eb04d02dc9aad8e327fffafa8a8fa57]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch"
#  content [dc2b20d6feaa991db1027e59f715caac3447462c]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch"
#  content [8bbe051622124bd4277129b57dbee67803552138]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch"
#  content [78ebdf2b536fbfefe2d26d950e0600d425100fa8]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch"
#  content [f6d1b3ebf8b89c55a7cba6abce17b3eb055b5eb1]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch"
#  content [2a50d52c3312941df1ad4f1ca7e6cffd396aecdd]
# 
# add_file "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch"
#  content [2ff9f0b9e489692c1d5f6febdad3ca88de5e64db]
# 
# patch "packages/gtk+/gtk+_2.6.10.bb"
#  from [b7cdce60f0cbd5b4382fb2de0d99946dab93622d]
#    to [d2c6d62e68731f764e010c080c47d7bb3c6f75fc]
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktextview.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtktreeview.patch"
#  attr "mtn:execute"
# value "true"
# 
#   set "packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkwidget.patch"
#  attr "mtn:execute"
# value "true"
# 
============================================================
--- packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch	10700ce9db5643796ebb1ff912668021c9275384
+++ packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkcombobox.patch	10700ce9db5643796ebb1ff912668021c9275384
@@ -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;
+     }
============================================================
--- packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch	2fdbfa155eb04d02dc9aad8e327fffafa8a8fa57
+++ packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkentry.patch	2fdbfa155eb04d02dc9aad8e327fffafa8a8fa57
@@ -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)
============================================================
--- packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch	dc2b20d6feaa991db1027e59f715caac3447462c
+++ packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkiconview.patch	dc2b20d6feaa991db1027e59f715caac3447462c
@@ -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 ||
============================================================
--- packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch	8bbe051622124bd4277129b57dbee67803552138
+++ packages/gtk+/gtk+-2.6.10/gtk.keynav.gtkradiobutton.patch	8bbe051622124bd4277129b57dbee67803552138
@@ -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;
============================================================
--- packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch	78ebdf2b536fbfefe2d26d950e0600d425100fa8
+++ packages/gtk+/gtk+-2.6.10/gtk.keynav.gtksettings.patch	78ebdf2b536fbfefe2d26d950e0600d425100fa8
@@ -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",
++                       %s
>>> DIFF TRUNCATED @ 16K






More information about the Openembedded-commits mailing list