summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-27 18:25:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-07-27 21:18:10 -0400
commit29cf11fb6e049185720f0717ff596146c3e9e9af (patch)
treebf8d72f7be67b4549c10c592ee3ed6c6ddaa6a15 /gtk/gtkwindow.c
parent6ca245306b287d4ccb675677a2779bfcbce54c5c (diff)
downloadgtk+-29cf11fb6e049185720f0717ff596146c3e9e9af.tar.gz
a11y: Set an accessible role for GtkWindow
Use the window accessible role for GtkWindow, and set the modal accessible property.
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a0fdd39229..067032a07f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -155,6 +155,10 @@
*
* GtkWindow adds the .titlebar and .default-decoration style classes to the
* widget that is added as a titlebar child.
+ *
+ * # Accessibility
+ *
+ * GtkWindow uses the #GTK_ACCESSIBLE_ROLE_WINDOW role.
*/
#define MENU_BAR_ACCEL GDK_KEY_F10
@@ -1114,6 +1118,8 @@ gtk_window_class_init (GtkWindowClass *klass)
add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_set_css_name (widget_class, I_("window"));
+
+ gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_WINDOW);
}
/**
@@ -2208,19 +2214,17 @@ gtk_window_real_activate_default (GtkWindow *window)
* gtk_window_set_modal:
* @window: a #GtkWindow
* @modal: whether the window is modal
- *
+ *
* Sets a window modal or non-modal. Modal windows prevent interaction
* with other windows in the same application. To keep modal dialogs
* on top of main application windows, use
* gtk_window_set_transient_for() to make the dialog transient for the
* parent; most [window managers][gtk-X11-arch]
* will then disallow lowering the dialog below the parent.
- *
- *
**/
void
gtk_window_set_modal (GtkWindow *window,
- gboolean modal)
+ gboolean modal)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *widget;
@@ -2233,20 +2237,24 @@ gtk_window_set_modal (GtkWindow *window,
priv->modal = modal;
widget = GTK_WIDGET (window);
-
+
if (_gtk_widget_get_realized (widget))
gdk_toplevel_set_modal (GDK_TOPLEVEL (priv->surface), modal);
if (gtk_widget_get_visible (widget))
{
if (priv->modal)
- gtk_grab_add (widget);
+ gtk_grab_add (widget);
else
- gtk_grab_remove (widget);
+ gtk_grab_remove (widget);
}
update_window_actions (window);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (window),
+ GTK_ACCESSIBLE_PROPERTY_MODAL, modal,
+ -1);
+
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_MODAL]);
}