[gtk/a11y/atspi] searchentry: Implement GtkAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/atspi] searchentry: Implement GtkAccessible
- Date: Tue, 13 Oct 2020 01:59:57 +0000 (UTC)
commit f796d02fea3ac7ec9435555133eb751d8df5df8f
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 12 21:17:31 2020 -0400
searchentry: Implement GtkAccessible
This copies what was done for GtkEntry: get
the focused state from the GtkText within.
gtk/gtksearchentry.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
---
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index 4960c98941..78268113c8 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -29,6 +29,7 @@
#include "gtksearchentryprivate.h"
+#include "gtkaccessibleprivate.h"
#include "gtkeditable.h"
#include "gtkboxlayout.h"
#include "gtkgestureclick.h"
@@ -135,8 +136,11 @@ struct _GtkSearchEntryClass
};
static void gtk_search_entry_editable_init (GtkEditableInterface *iface);
+static void gtk_search_entry_accessible_init (GtkAccessibleInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkSearchEntry, gtk_search_entry, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE,
+ gtk_search_entry_accessible_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
gtk_search_entry_editable_init))
@@ -438,6 +442,31 @@ gtk_search_entry_editable_init (GtkEditableInterface *iface)
iface->get_delegate = gtk_search_entry_get_delegate;
}
+static gboolean
+gtk_search_entry_accessible_get_platform_state (GtkAccessible *self,
+ GtkAccessiblePlatformState state)
+{
+ GtkSearchEntry *entry = GTK_SEARCH_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_search_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_search_entry_accessible_get_platform_state;
+}
+
static void
gtk_search_entry_icon_release (GtkGestureClick *press,
int n_press,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]