Commit 632524f6 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Reinstate expected focus behavior

After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
parent 22e1827f
......@@ -128,6 +128,9 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class)
gobject_class->set_property = gtk_accel_label_set_property;
gobject_class->get_property = gtk_accel_label_get_property;
widget_class->focus = gtk_widget_focus_none;
widget_class->grab_focus = gtk_widget_grab_focus_none;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_ACCEL_LABEL);
props[PROP_LABEL] =
......
......@@ -57,6 +57,7 @@
#include "gtkcellrendererpixbuf.h"
#include "gtkcellrenderertext.h"
#include "gtkcombobox.h"
#include "gtkwidgetprivate.h"
#include "gtkdialog.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
......@@ -667,6 +668,8 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
widget_class->measure = gtk_app_chooser_button_measure;
widget_class->size_allocate = gtk_app_chooser_button_size_allocate;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
g_object_class_override_property (oclass, PROP_CONTENT_TYPE, "content-type");
......
......@@ -38,6 +38,7 @@
#include "gtkscrolledwindow.h"
#include "gtklabel.h"
#include "gtkgestureclick.h"
#include "gtkwidgetprivate.h"
#include <string.h>
#include <glib/gi18n-lib.h>
......@@ -913,7 +914,8 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
widget_class->measure = gtk_app_chooser_widget_measure;
widget_class->size_allocate = gtk_app_chooser_widget_size_allocate;
widget_class->snapshot = gtk_app_chooser_widget_snapshot;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
g_object_class_override_property (gobject_class, PROP_CONTENT_TYPE, "content-type");
......
......@@ -95,6 +95,8 @@ gtk_builtin_icon_class_init (GtkBuiltinIconClass *klass)
wclass->snapshot = gtk_builtin_icon_snapshot;
wclass->measure = gtk_builtin_icon_measure;
wclass->css_changed = gtk_builtin_icon_css_changed;
wclass->grab_focus = gtk_widget_grab_focus_none;
wclass->focus = gtk_widget_focus_none;
}
static void
......
......@@ -68,6 +68,7 @@
#include "gtkprivate.h"
#include "gtkstylecontext.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "a11y/gtkbuttonaccessible.h"
......@@ -204,6 +205,8 @@ gtk_button_class_init (GtkButtonClass *klass)
widget_class->state_flags_changed = gtk_button_state_flags_changed;
widget_class->grab_notify = gtk_button_grab_notify;
widget_class->unmap = gtk_button_unmap;
widget_class->grab_focus = gtk_widget_grab_focus_self;
widget_class->focus = gtk_widget_focus_self;
container_class->add = gtk_button_add;
container_class->remove = gtk_button_remove;
......
......@@ -365,6 +365,9 @@ gtk_calendar_class_init (GtkCalendarClass *class)
gobject_class->set_property = gtk_calendar_set_property;
gobject_class->get_property = gtk_calendar_get_property;
widget_class->focus = gtk_widget_focus_all;
widget_class->grab_focus = gtk_widget_grab_focus_self;
/**
* GtkCalendar:year:
*
......
......@@ -199,6 +199,9 @@ gtk_center_box_class_init (GtkCenterBoxClass *klass)
object_class->get_property = gtk_center_box_get_property;
object_class->dispose = gtk_center_box_dispose;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
g_object_class_install_property (object_class, PROP_BASELINE_POSITION,
......
......@@ -44,6 +44,7 @@
#include "gtkprivate.h"
#include "gtksnapshot.h"
#include "gtkstylecontext.h"
#include "gtkwidgetprivate.h"
/**
......@@ -143,6 +144,9 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
gobject_class->set_property = gtk_color_button_set_property;
gobject_class->finalize = gtk_color_button_finalize;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
klass->color_set = NULL;
/**
......
......@@ -30,6 +30,7 @@
#include "gtksizegroup.h"
#include "gtkstylecontext.h"
#include "gtkboxlayout.h"
#include "gtkwidgetprivate.h"
#include "a11y/gtkcompositeaccessible.h"
......@@ -709,6 +710,9 @@ gtk_color_chooser_widget_class_init (GtkColorChooserWidgetClass *class)
object_class->set_property = gtk_color_chooser_widget_set_property;
object_class->finalize = gtk_color_chooser_widget_finalize;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
g_object_class_override_property (object_class, PROP_RGBA, "rgba");
g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");
......
......@@ -481,6 +481,8 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
widget_class->snapshot = swatch_snapshot;
widget_class->size_allocate = swatch_size_allocate;
widget_class->state_flags_changed = swatch_state_flags_changed;
widget_class->grab_focus = gtk_widget_grab_focus_self;
widget_class->focus = gtk_widget_focus_self;
g_object_class_install_property (object_class, PROP_RGBA,
g_param_spec_boxed ("rgba", P_("RGBA Color"), P_("Color as RGBA"),
......
......@@ -420,6 +420,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
widget_class->size_allocate = gtk_combo_box_size_allocate;
widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
widget_class->grab_focus = gtk_combo_box_grab_focus;
widget_class->focus = gtk_widget_focus_child;
widget_class->measure = gtk_combo_box_measure;
widget_class->unmap = gtk_combo_box_unmap;
widget_class->destroy = gtk_combo_box_destroy;
......
......@@ -140,6 +140,8 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->destroy = gtk_container_destroy;
widget_class->compute_expand = gtk_container_compute_expand;
widget_class->get_request_mode = gtk_container_get_request_mode;
widget_class->grab_focus = gtk_widget_grab_focus_none;
widget_class->focus = gtk_widget_focus_child;
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
......
......@@ -361,6 +361,8 @@ gtk_drag_icon_class_init (GtkDragIconClass *klass)
widget_class->size_allocate = gtk_drag_icon_size_allocate;
widget_class->show = gtk_drag_icon_show;
widget_class->hide = gtk_drag_icon_hide;
widget_class->focus = gtk_widget_focus_none;
widget_class->grab_focus = gtk_widget_grab_focus_none;
/**
* GtkDragIcon:child:
......
......@@ -262,6 +262,8 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class)
widget_class->measure = gtk_drawing_area_measure;
widget_class->snapshot = gtk_drawing_area_snapshot;
widget_class->focus = gtk_widget_focus_none;
widget_class->grab_focus = gtk_widget_grab_focus_none;
/**
* GtkDrawingArea:content-width
......
......@@ -437,6 +437,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->query_tooltip = gtk_entry_query_tooltip;
widget_class->direction_changed = gtk_entry_direction_changed;
widget_class->grab_focus = gtk_entry_grab_focus;
widget_class->focus = gtk_widget_focus_child;
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
quark_entry_completion = g_quark_from_static_string ("gtk-entry-completion-key");
......
......@@ -300,12 +300,13 @@ gtk_expander_class_init (GtkExpanderClass *klass)
gobject_class->set_property = gtk_expander_set_property;
gobject_class->get_property = gtk_expander_get_property;
widget_class->destroy = gtk_expander_destroy;
widget_class->size_allocate = gtk_expander_size_allocate;
widget_class->focus = gtk_expander_focus;
widget_class->measure = gtk_expander_measure;
widget_class->destroy = gtk_expander_destroy;
widget_class->size_allocate = gtk_expander_size_allocate;
widget_class->focus = gtk_expander_focus;
widget_class->grab_focus = gtk_widget_grab_focus_self;
widget_class->measure = gtk_expander_measure;
container_class->add = gtk_expander_add;
container_class->add = gtk_expander_add;
container_class->remove = gtk_expander_remove;
container_class->forall = gtk_expander_forall;
......
......@@ -61,6 +61,7 @@
#include "gtkstylecontextprivate.h"
#include "gtkbitmaskprivate.h"
#include "gtkeventcontroller.h"
#include "gtkwidgetprivate.h"
/**
* SECTION:gtkfilechooserbutton
......@@ -476,6 +477,8 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
widget_class->root = gtk_file_chooser_button_root;
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
/**
* GtkFileChooserButton::file-set:
......
......@@ -7222,6 +7222,8 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
widget_class->unroot = gtk_file_chooser_widget_unroot;
widget_class->css_changed = gtk_file_chooser_widget_css_changed;
widget_class->size_allocate = gtk_file_chooser_widget_size_allocate;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
/*
* Signals
......
......@@ -41,6 +41,7 @@
#include "gtkprivate.h"
#include "gtkseparator.h"
#include "gtkstylecontext.h"
#include "gtkwidgetprivate.h"
#include <string.h>
#include <stdio.h>
......@@ -483,6 +484,9 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
gobject_class->set_property = gtk_font_button_set_property;
gobject_class->get_property = gtk_font_button_get_property;
widget_class->grab_focus = gtk_widget_grab_focus_child;
widget_class->focus = gtk_widget_focus_child;
klass->font_set = NULL;
_gtk_font_chooser_install_properties (gobject_class);
......
......@@ -49,7 +49,7 @@
#include "gtktextview.h"
#include "gtktreeselection.h"
#include "gtktreeview.h"
#include "gtkwidget.h"
#include "gtkwidgetprivate.h"
#include "gtksettings.h"
#include "gtkdialog.h"
#include "gtkradiobutton.h"
......@@ -737,6 +737,8 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
widget_class->unroot = gtk_font_chooser_widget_unroot;
widget_class->map = gtk_font_chooser_widget_map;
widget_class->unmap = gtk_font_chooser_widget_unmap;
widget_class->focus = gtk_widget_focus_child;
widget_class->grab_focus = gtk_widget_grab_focus_child;
gobject_class->finalize = gtk_font_chooser_widget_finalize;
gobject_class->dispose = gtk_font_chooser_widget_dispose;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment