diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-10-15 14:59:24 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-10-15 14:59:24 +0000 |
commit | 9c28ecb0da9920e173cb99dc141a4321280c8ffb (patch) | |
tree | 788841b245e2dfd3f94134133f8e16e27be1bb38 /gtk/gtkpasswordentry.c | |
parent | 2488d71a0abf223f52e27927c161a9840f48fd3a (diff) | |
parent | 8737692b2b30854f7d68387a74fd4f7551677dcc (diff) | |
download | gtk+-9c28ecb0da9920e173cb99dc141a4321280c8ffb.tar.gz |
Merge branch 'a11y/atspi' into 'master'
A11y/atspi
See merge request GNOME/gtk!2698
Diffstat (limited to 'gtk/gtkpasswordentry.c')
-rw-r--r-- | gtk/gtkpasswordentry.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c index d8da5b4e56..8d5de422b2 100644 --- a/gtk/gtkpasswordentry.c +++ b/gtk/gtkpasswordentry.c @@ -22,6 +22,7 @@ #include "gtkpasswordentryprivate.h" +#include "gtkaccessibleprivate.h" #include "gtktextprivate.h" #include "gtkeditable.h" #include "gtkeventcontrollerkey.h" @@ -104,8 +105,10 @@ enum { static GParamSpec *props[NUM_PROPERTIES] = { NULL, }; static void gtk_password_entry_editable_init (GtkEditableInterface *iface); +static void gtk_password_entry_accessible_init (GtkAccessibleInterface *iface); G_DEFINE_TYPE_WITH_CODE (GtkPasswordEntry, gtk_password_entry, GTK_TYPE_WIDGET, + G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE, gtk_password_entry_accessible_init) G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, gtk_password_entry_editable_init)) static void @@ -486,6 +489,31 @@ gtk_password_entry_editable_init (GtkEditableInterface *iface) iface->get_delegate = gtk_password_entry_get_delegate; } +static gboolean +gtk_password_entry_accessible_get_platform_state (GtkAccessible *self, + GtkAccessiblePlatformState state) +{ + GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (self); + + switch (state) + { + case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE: + return gtk_widget_get_focusable (GTK_WIDGET (entry->entry)); + case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED: + return gtk_widget_has_focus (GTK_WIDGET (entry->entry)); + default: + g_assert_not_reached (); + } +} + +static void +gtk_password_entry_accessible_init (GtkAccessibleInterface *iface) +{ + GtkAccessibleInterface *parent_iface = g_type_interface_peek_parent (iface); + iface->get_at_context = parent_iface->get_at_context; + iface->get_platform_state = gtk_password_entry_accessible_get_platform_state; +} + GtkText * gtk_password_entry_get_text_widget (GtkPasswordEntry *entry) { |