[gtk/wip/matthiasc/focus2: 17/21] window: Make focus wrap again
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/focus2: 17/21] window: Make focus wrap again
- Date: Sun, 3 Mar 2019 05:08:00 +0000 (UTC)
commit 407a78d6e7743dc44469fbdbc0fd6b09ee24bf1e
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 2 20:18:33 2019 -0500
window: Make focus wrap again
This is the traditional GTK behavior: wrap around when
the focus reaches the end of the toplevel's focus chain.
gtk/gtkwindow.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 36ac49ff95..0083802361 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -767,6 +767,27 @@ gtk_window_pick (GtkWidget *widget,
return GTK_WIDGET_CLASS (gtk_window_parent_class)->pick (widget, x, y);
}
+static GtkWidget *
+gtk_window_next_focus_child (GtkWidget *widget,
+ GtkWidget *child,
+ GtkDirectionType direction)
+{
+ GtkWidget *next;
+
+ next = GTK_WIDGET_CLASS (gtk_window_parent_class)->next_focus_child (widget, child, direction);
+ if (next)
+ return next;
+
+ switch ((int)direction)
+ {
+ case GTK_DIR_TAB_FORWARD:
+ case GTK_DIR_TAB_BACKWARD:
+ return GTK_WIDGET_CLASS (gtk_window_parent_class)->next_focus_child (widget, NULL, direction);
+ default:
+ return NULL;
+ }
+}
+
static void
gtk_window_class_init (GtkWindowClass *klass)
{
@@ -805,6 +826,7 @@ gtk_window_class_init (GtkWindowClass *klass)
widget_class->style_updated = gtk_window_style_updated;
widget_class->snapshot = gtk_window_snapshot;
widget_class->pick = gtk_window_pick;
+ widget_class->next_focus_child = gtk_window_next_focus_child;
container_class->add = gtk_window_add;
container_class->remove = gtk_window_remove;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]