[gtk/a11y/atspi] passwordentry: Implement GtkAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/atspi] passwordentry: Implement GtkAccessible
- Date: Tue, 13 Oct 2020 01:59:57 +0000 (UTC)
commit 852c72fa28bb3802657aa3579207733342b355f6
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 12 21:33:55 2020 -0400
passwordentry: Implement GtkAccessible
This copies what was done for GtkEntry: get
the focused state from the GtkText within.
gtk/gtkpasswordentry.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
---
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index ec8d08b119..e6658ecf2e 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"
@@ -105,8 +106,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
@@ -487,6 +490,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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]