[gtk+/native-layout] Deprecate widget flag: GTK_WIDGET_CAN_FOCUS



commit f8d1cf58af53c8f11e7103346c25fb2372f42619
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Jan 4 04:56:11 2010 +0100

    Deprecate widget flag: GTK_WIDGET_CAN_FOCUS
    
    https://bugzilla.gnome.org/show_bug.cgi?id=69872

 gtk/gtkbutton.c                        |    2 +-
 gtk/gtkcontainer.c                     |    2 +-
 gtk/gtklabel.c                         |    2 +-
 gtk/gtkrange.c                         |    4 ++--
 gtk/gtkscrolledwindow.c                |    2 +-
 gtk/gtktogglebutton.c                  |    2 +-
 gtk/gtktreeview.c                      |   16 ++++++++--------
 gtk/gtktreeviewcolumn.c                |    2 +-
 gtk/gtkwidget.c                        |   14 +++++++-------
 gtk/gtkwidget.h                        |    5 +++++
 gtk/gtkwindow.c                        |    2 +-
 modules/engines/ms-windows/msw_style.c |    2 +-
 modules/other/gail/gailbutton.c        |    2 +-
 modules/other/gail/gaillabel.c         |    2 +-
 modules/other/gail/gailwidget.c        |    4 ++--
 15 files changed, 34 insertions(+), 29 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 37370c6..d776b6b 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1429,7 +1429,7 @@ gtk_button_size_allocate (GtkWidget     *widget,
 	  child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
 	}
 
-      if (GTK_WIDGET_CAN_FOCUS (button))
+      if (gtk_widget_get_can_focus (GTK_WIDGET (button)))
 	{
 	  child_allocation.x += focus_width + focus_pad;
 	  child_allocation.y += focus_width + focus_pad;
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 12737fd..d2b4bac 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1811,7 +1811,7 @@ gtk_container_focus (GtkWidget        *widget,
 
   return_val = FALSE;
 
-  if (GTK_WIDGET_CAN_FOCUS (container))
+  if (gtk_widget_get_can_focus (GTK_WIDGET (container)))
     {
       if (!GTK_WIDGET_HAS_FOCUS (container))
 	{
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index eb380fa..aebd8c6 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1500,7 +1500,7 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
   
   while (parent)
     {
-      if (GTK_WIDGET_CAN_FOCUS (parent) ||
+      if (gtk_widget_get_can_focus (parent) ||
 	  (!group_cycling && GTK_WIDGET_GET_CLASS (parent)->activate_signal) ||
           GTK_IS_NOTEBOOK (parent->parent) ||
 	  GTK_IS_MENU_ITEM (parent))
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 17c0d6f..18224e0 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1574,7 +1574,7 @@ gtk_range_expose (GtkWidget      *widget,
   g_object_get (gtk_widget_get_settings (widget),
                 "gtk-touchscreen-mode", &touchscreen,
                 NULL);
-  if (GTK_WIDGET_CAN_FOCUS (range))
+  if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
     gtk_widget_style_get (GTK_WIDGET (range),
                           "focus-line-width", &focus_line_width,
                           "focus-padding", &focus_padding,
@@ -2766,7 +2766,7 @@ gtk_range_get_props (GtkRange  *range,
   if (tmp_stepper_spacing > 0)
     tmp_trough_under_steppers = FALSE;
 
-  if (GTK_WIDGET_CAN_FOCUS (range))
+  if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
     {
       gint focus_line_width;
       gint focus_padding;
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 43d2045..b950939 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1660,7 +1660,7 @@ gtk_scrolled_window_focus (GtkWidget        *widget,
 	return TRUE;
     }
 
-  if (!had_focus_child && GTK_WIDGET_CAN_FOCUS (widget))
+  if (!had_focus_child && gtk_widget_get_can_focus (widget))
     {
       gtk_widget_grab_focus (widget);
       return TRUE;
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index ddc6678..3a07cfd 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -456,7 +456,7 @@ gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
    * gtk_widget_real_mnemonic_activate() in order to focus the widget even
    * if there is no mnemonic conflict.
    */
-  if (GTK_WIDGET_CAN_FOCUS (widget))
+  if (gtk_widget_get_can_focus (widget))
     gtk_widget_grab_focus (widget);
 
   if (!group_cycling)
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 977062b..96e860c 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -1330,8 +1330,7 @@ gtk_tree_view_init (GtkTreeView *tree_view)
 {
   tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_view, GTK_TYPE_TREE_VIEW, GtkTreeViewPrivate);
 
-  GTK_WIDGET_SET_FLAGS (tree_view, GTK_CAN_FOCUS);
-
+  gtk_widget_set_can_focus (GTK_WIDGET (tree_view), TRUE);
   gtk_widget_set_redraw_on_allocate (GTK_WIDGET (tree_view), FALSE);
 
   tree_view->priv->flags =  GTK_TREE_VIEW_SHOW_EXPANDERS
@@ -2532,7 +2531,7 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
 static void
 grab_focus_and_unset_draw_keyfocus (GtkTreeView *tree_view)
 {
-  if (GTK_WIDGET_CAN_FOCUS (tree_view) && !GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (gtk_widget_get_can_focus (GTK_WIDGET (tree_view)) && !GTK_WIDGET_HAS_FOCUS (tree_view))
     gtk_widget_grab_focus (GTK_WIDGET (tree_view));
   GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
 }
@@ -7813,7 +7812,7 @@ gtk_tree_view_header_focus (GtkTreeView      *tree_view,
   first_column = tree_view->priv->columns;
   while (first_column)
     {
-      if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
+      if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
 	  GTK_TREE_VIEW_COLUMN (first_column->data)->visible &&
 	  (GTK_TREE_VIEW_COLUMN (first_column->data)->clickable ||
 	   GTK_TREE_VIEW_COLUMN (first_column->data)->reorderable))
@@ -7829,7 +7828,7 @@ gtk_tree_view_header_focus (GtkTreeView      *tree_view,
   last_column = g_list_last (tree_view->priv->columns);
   while (last_column)
     {
-      if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
+      if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
 	  GTK_TREE_VIEW_COLUMN (last_column->data)->visible &&
 	  (GTK_TREE_VIEW_COLUMN (last_column->data)->clickable ||
 	   GTK_TREE_VIEW_COLUMN (last_column->data)->reorderable))
@@ -7848,7 +7847,8 @@ gtk_tree_view_header_focus (GtkTreeView      *tree_view,
     case GTK_DIR_DOWN:
       if (focus_child == NULL)
 	{
-	  if (tree_view->priv->focus_column != NULL && GTK_WIDGET_CAN_FOCUS (tree_view->priv->focus_column->button))
+	  if (tree_view->priv->focus_column != NULL &&
+              gtk_widget_get_can_focus (tree_view->priv->focus_column->button))
 	    focus_child = tree_view->priv->focus_column->button;
 	  else
 	    focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
@@ -7907,7 +7907,7 @@ gtk_tree_view_header_focus (GtkTreeView      *tree_view,
 	  column = tmp_list->data;
 	  if (column->button &&
 	      column->visible &&
-	      GTK_WIDGET_CAN_FOCUS (column->button))
+	      gtk_widget_get_can_focus (column->button))
 	    {
 	      focus_child = column->button;
 	      gtk_widget_grab_focus (column->button);
@@ -7996,7 +7996,7 @@ gtk_tree_view_focus (GtkWidget        *widget,
   GtkContainer *container = GTK_CONTAINER (widget);
   GtkWidget *focus_child;
 
-  if (!GTK_WIDGET_IS_SENSITIVE (container) || !GTK_WIDGET_CAN_FOCUS (widget))
+  if (!GTK_WIDGET_IS_SENSITIVE (container) || !gtk_widget_get_can_focus (widget))
     return FALSE;
 
   focus_child = container->focus_child;
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index d20d706..3713edc 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -1146,7 +1146,7 @@ gtk_tree_view_column_mnemonic_activate (GtkWidget *widget,
   GTK_TREE_VIEW (column->tree_view)->priv->focus_column = column;
   if (column->clickable)
     gtk_button_clicked (GTK_BUTTON (column->button));
-  else if (GTK_WIDGET_CAN_FOCUS (column->button))
+  else if (gtk_widget_get_can_focus (column->button))
     gtk_widget_grab_focus (column->button);
   else
     gtk_widget_grab_focus (column->tree_view);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 70437f5..bc1c561 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2760,7 +2760,7 @@ gtk_widget_get_property (GObject         *object,
       g_value_set_boolean (value, (gtk_widget_get_app_paintable (widget) != FALSE));
       break;
     case PROP_CAN_FOCUS:
-      g_value_set_boolean (value, (GTK_WIDGET_CAN_FOCUS (widget) != FALSE));
+      g_value_set_boolean (value, (gtk_widget_get_can_focus (widget) != FALSE));
       break;
     case PROP_HAS_FOCUS:
       g_value_set_boolean (value, (GTK_WIDGET_HAS_FOCUS (widget) != FALSE));
@@ -4669,7 +4669,7 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
 {
   if (!group_cycling && GTK_WIDGET_GET_CLASS (widget)->activate_signal)
     gtk_widget_activate (widget);
-  else if (GTK_WIDGET_CAN_FOCUS (widget))
+  else if (gtk_widget_get_can_focus (widget))
     gtk_widget_grab_focus (widget);
   else
     {
@@ -5294,7 +5294,7 @@ reset_focus_recurse (GtkWidget *widget,
 static void
 gtk_widget_real_grab_focus (GtkWidget *focus_widget)
 {
-  if (GTK_WIDGET_CAN_FOCUS (focus_widget))
+  if (gtk_widget_get_can_focus (focus_widget))
     {
       GtkWidget *toplevel;
       GtkWidget *widget;
@@ -5394,7 +5394,7 @@ static gboolean
 gtk_widget_real_focus (GtkWidget         *widget,
                        GtkDirectionType   direction)
 {
-  if (!GTK_WIDGET_CAN_FOCUS (widget))
+  if (!gtk_widget_get_can_focus (widget))
     return FALSE;
   
   if (!gtk_widget_is_focus (widget))
@@ -5466,7 +5466,7 @@ gtk_widget_set_can_focus (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (can_focus != GTK_WIDGET_CAN_FOCUS (widget))
+  if (can_focus != gtk_widget_get_can_focus (widget))
     {
       if (can_focus)
         GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
@@ -5494,7 +5494,7 @@ gtk_widget_get_can_focus (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return GTK_WIDGET_CAN_FOCUS (widget);
+  return (GTK_WIDGET_FLAGS (widget) & GTK_CAN_FOCUS) != 0;
 }
 
 /**
@@ -7533,7 +7533,7 @@ gtk_widget_child_focus (GtkWidget       *widget,
    * don't have to though.
    */
   if (!GTK_IS_CONTAINER (widget) &&
-      !GTK_WIDGET_CAN_FOCUS (widget))
+      !gtk_widget_get_can_focus (widget))
     return FALSE;
   
   g_signal_emit (widget,
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index b001489..3c7de58 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -272,13 +272,18 @@ typedef enum
  */
 #define GTK_WIDGET_IS_SENSITIVE(wid)	  (GTK_WIDGET_SENSITIVE (wid) && \
 					   GTK_WIDGET_PARENT_SENSITIVE (wid))
+
+#ifndef GTK_DISABLE_DEPRECATED
 /**
  * GTK_WIDGET_CAN_FOCUS:
  * @wid: a #GtkWidget.
  *
  * Evaluates to %TRUE if the widget is able to handle focus grabs.
+ *
+ * Deprecated: 2.20: Use gtk_widget_get_can_focus() instead.
  */
 #define GTK_WIDGET_CAN_FOCUS(wid)	  ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
+#endif
 
 /**
  * GTK_WIDGET_HAS_FOCUS:
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index efb29b8..11913cd 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1590,7 +1590,7 @@ gtk_window_set_focus (GtkWindow *window,
   if (focus)
     {
       g_return_if_fail (GTK_IS_WIDGET (focus));
-      g_return_if_fail (GTK_WIDGET_CAN_FOCUS (focus));
+      g_return_if_fail (gtk_widget_get_can_focus (focus));
     }
 
   if (focus)
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c
index b561a1d..c430204 100755
--- a/modules/engines/ms-windows/msw_style.c
+++ b/modules/engines/ms-windows/msw_style.c
@@ -3479,7 +3479,7 @@ draw_focus (GtkStyle *style,
   HDC dc;
   RECT rect;
 
-  if (!GTK_WIDGET_CAN_FOCUS (widget))
+  if (!gtk_widget_get_can_focus (widget))
     {
       return;
     }
diff --git a/modules/other/gail/gailbutton.c b/modules/other/gail/gailbutton.c
index ace897c..2c72d2f 100644
--- a/modules/other/gail/gailbutton.c
+++ b/modules/other/gail/gailbutton.c
@@ -884,7 +884,7 @@ gail_button_ref_state_set (AtkObject *obj)
   if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
     atk_state_set_add_state (state_set, ATK_STATE_ARMED);
 
-  if (!GTK_WIDGET_CAN_FOCUS(widget))
+  if (!gtk_widget_get_can_focus (widget))
     atk_state_set_remove_state (state_set, ATK_STATE_SELECTABLE);
 
 
diff --git a/modules/other/gail/gaillabel.c b/modules/other/gail/gaillabel.c
index 7f217e0..903e395 100644
--- a/modules/other/gail/gaillabel.c
+++ b/modules/other/gail/gaillabel.c
@@ -464,7 +464,7 @@ gail_label_ref_relation_set (AtkObject *obj)
           AtkObject *accessible_array[1];
           AtkRelation* relation;
 
-          if (!GTK_WIDGET_CAN_FOCUS (mnemonic_widget))
+          if (!gtk_widget_get_can_focus (mnemonic_widget))
             {
             /*
              * Handle the case where a GtkFileChooserButton is specified as the 
diff --git a/modules/other/gail/gailwidget.c b/modules/other/gail/gailwidget.c
index 892e452..0545459 100644
--- a/modules/other/gail/gailwidget.c
+++ b/modules/other/gail/gailwidget.c
@@ -488,7 +488,7 @@ gail_widget_ref_state_set (AtkObject *accessible)
           atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
         }
   
-      if (GTK_WIDGET_CAN_FOCUS (widget))
+      if (gtk_widget_get_can_focus (widget))
         {
           atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
         }
@@ -735,7 +735,7 @@ gail_widget_grab_focus (AtkComponent   *component)
   GtkWidget *toplevel;
 
   gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-  if (GTK_WIDGET_CAN_FOCUS (widget))
+  if (gtk_widget_get_can_focus (widget))
     {
       gtk_widget_grab_focus (widget);
       toplevel = gtk_widget_get_toplevel (widget);



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