Merge branch 'focus-cleanup' into 'master'

Focus cleanup

See merge request GNOME/gtk!788
This commit is contained in:
Matthias Clasen 2019-04-28 23:17:46 +00:00
commit 3643a9fe86
4 changed files with 5 additions and 45 deletions

View File

@ -4647,7 +4647,6 @@ gtk_window_set_resizable
gtk_window_get_resizable
gtk_window_add_accel_group
gtk_window_remove_accel_group
gtk_window_activate_focus
gtk_window_activate_default
gtk_window_set_modal
gtk_window_set_default_size

View File

@ -5478,7 +5478,8 @@ static void
gtk_widget_real_grab_focus (GtkWidget *focus_widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (focus_widget);
gtk_root_set_focus (priv->root, focus_widget);
if (priv->root)
gtk_root_set_focus (priv->root, focus_widget);
}
static gboolean
@ -9590,7 +9591,6 @@ gtk_widget_set_vexpand_set (GtkWidget *widget,
* GtkBuildable implementation
*/
static GQuark quark_builder_has_default = 0;
static GQuark quark_builder_has_focus = 0;
static GQuark quark_builder_atk_relations = 0;
static GQuark quark_builder_set_name = 0;
@ -9623,7 +9623,6 @@ static void
gtk_widget_buildable_interface_init (GtkBuildableIface *iface)
{
quark_builder_has_default = g_quark_from_static_string ("gtk-builder-has-default");
quark_builder_has_focus = g_quark_from_static_string ("gtk-builder-has-focus");
quark_builder_atk_relations = g_quark_from_static_string ("gtk-builder-atk-relations");
quark_builder_set_name = g_quark_from_static_string ("gtk-builder-set-name");
@ -9704,9 +9703,6 @@ gtk_widget_buildable_set_buildable_property (GtkBuildable *buildable,
if (strcmp (name, "has-default") == 0 && g_value_get_boolean (value))
g_object_set_qdata (G_OBJECT (buildable), quark_builder_has_default,
GINT_TO_POINTER (TRUE));
else if (strcmp (name, "has-focus") == 0 && g_value_get_boolean (value))
g_object_set_qdata (G_OBJECT (buildable), quark_builder_has_focus,
GINT_TO_POINTER (TRUE));
else
g_object_set_property (G_OBJECT (buildable), name, value);
}
@ -9755,12 +9751,6 @@ gtk_widget_buildable_parser_finished (GtkBuildable *buildable,
g_object_steal_qdata (G_OBJECT (buildable), quark_builder_has_default);
}
if (g_object_get_qdata (G_OBJECT (buildable), quark_builder_has_focus))
{
gtk_widget_grab_focus (GTK_WIDGET (buildable));
g_object_steal_qdata (G_OBJECT (buildable), quark_builder_has_focus);
}
atk_relations = g_object_get_qdata (G_OBJECT (buildable),
quark_builder_atk_relations);
if (atk_relations)

View File

@ -429,7 +429,6 @@ static void gtk_window_move_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_window_real_activate_default (GtkWindow *window);
static void gtk_window_real_activate_focus (GtkWindow *window);
static void gtk_window_keys_changed (GtkWindow *window);
static gboolean gtk_window_enable_debugging (GtkWindow *window,
gboolean toggle);
@ -801,7 +800,6 @@ gtk_window_class_init (GtkWindowClass *klass)
container_class->forall = gtk_window_forall;
klass->activate_default = gtk_window_real_activate_default;
klass->activate_focus = gtk_window_real_activate_focus;
klass->keys_changed = gtk_window_keys_changed;
klass->enable_debugging = gtk_window_enable_debugging;
klass->close_request = gtk_window_close_request;
@ -2134,8 +2132,10 @@ gtk_window_buildable_set_buildable_property (GtkBuildable *buildable,
if (strcmp (name, "visible") == 0 && g_value_get_boolean (value))
priv->builder_visible = TRUE;
else
else if (parent_buildable_iface->set_buildable_property)
parent_buildable_iface->set_buildable_property (buildable, builder, name, value);
else
g_object_set_property (G_OBJECT (buildable), name, value);
}
typedef struct {
@ -2836,27 +2836,6 @@ gtk_window_set_position (GtkWindow *window,
}
}
/**
* gtk_window_activate_focus:
* @window: a #GtkWindow
*
* Activates the current focused widget within the window.
*
* Returns: %TRUE if a widget got activated.
**/
gboolean
gtk_window_activate_focus (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
if (priv->focus_widget && gtk_widget_is_sensitive (priv->focus_widget))
return gtk_widget_activate (priv->focus_widget);
return FALSE;
}
/**
* gtk_window_get_focus:
* @window: a #GtkWindow
@ -6235,12 +6214,6 @@ gtk_window_real_activate_default (GtkWindow *window)
gtk_window_activate_default (window);
}
static void
gtk_window_real_activate_focus (GtkWindow *window)
{
gtk_window_activate_focus (window);
}
static void
do_focus_change (GtkWidget *widget,
gboolean in)

View File

@ -158,8 +158,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_window_set_position (GtkWindow *window,
GtkWindowPosition position);
GDK_AVAILABLE_IN_ALL
gboolean gtk_window_activate_focus (GtkWindow *window);
GDK_AVAILABLE_IN_ALL
void gtk_window_set_focus (GtkWindow *window,
GtkWidget *focus);
GDK_AVAILABLE_IN_ALL