eventcontrollerkey: Change behavior of contains-focus
contains-focus now returns TRUE when is-focus is TRUE instead of FALSE. Fixes #2184
This commit is contained in:
@@ -112,11 +112,11 @@ update_focus (GtkEventControllerKey *key,
|
||||
case GDK_NOTIFY_ANCESTOR:
|
||||
case GDK_NOTIFY_NONLINEAR:
|
||||
is_focus = focus_in;
|
||||
contains_focus = FALSE;
|
||||
contains_focus = is_focus;
|
||||
break;
|
||||
case GDK_NOTIFY_INFERIOR:
|
||||
is_focus = focus_in;
|
||||
contains_focus = !focus_in;
|
||||
contains_focus = TRUE;
|
||||
break;
|
||||
case GDK_NOTIFY_UNKNOWN:
|
||||
default:
|
||||
@@ -257,7 +257,7 @@ gtk_event_controller_key_class_init (GtkEventControllerKeyClass *klass)
|
||||
* GtkEventControllerKey:is-focus:
|
||||
*
|
||||
* Whether focus is in the controllers widget itself,
|
||||
* as opposed to in a descendent widget. See
|
||||
* opposed to in a descendent widget. See also
|
||||
* #GtkEventControllerKey:contains-focus.
|
||||
*
|
||||
* When handling focus events, this property is updated
|
||||
@@ -274,8 +274,9 @@ gtk_event_controller_key_class_init (GtkEventControllerKeyClass *klass)
|
||||
/**
|
||||
* GtkEventControllerKey:contains-focus:
|
||||
*
|
||||
* Whether focus is in a descendant of the controllers widget.
|
||||
* See #GtkEventControllerKey:is-focus.
|
||||
* Whether focus is contain in the controllers widget. See
|
||||
* See #GtkEventControllerKey:is-focus for whether the focus is in the widget itself
|
||||
* or inside a descendent.
|
||||
*
|
||||
* When handling focus events, this property is updated
|
||||
* before #GtkEventControllerKey::focus-in or
|
||||
|
||||
@@ -5619,7 +5619,6 @@ gtk_tree_view_key_controller_focus_out (GtkEventControllerKey *key,
|
||||
|
||||
/* destroy interactive search dialog */
|
||||
if (tree_view->priv->search_window &&
|
||||
!gtk_event_controller_key_is_focus (key) &&
|
||||
!gtk_event_controller_key_contains_focus (key))
|
||||
gtk_tree_view_search_window_hide (tree_view->priv->search_window, tree_view,
|
||||
gtk_get_current_event_device ());
|
||||
|
||||
@@ -139,7 +139,7 @@ test_window_focus (void)
|
||||
|
||||
g_assert_cmpstr (s->str, ==,
|
||||
"window: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_VIRTUAL is-focus: 0 contains-focus: 1\n"
|
||||
"box: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_ANCESTOR is-focus: 1 contains-focus: 0\n");
|
||||
"box: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_ANCESTOR is-focus: 1 contains-focus: 1\n");
|
||||
g_string_truncate (s, 0);
|
||||
|
||||
gtk_widget_grab_focus (entry1);
|
||||
@@ -150,7 +150,7 @@ test_window_focus (void)
|
||||
g_assert_cmpstr (s->str, ==,
|
||||
"box: focus-out GDK_CROSSING_NORMAL GDK_NOTIFY_INFERIOR is-focus: 0 contains-focus: 1\n"
|
||||
"box1: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_VIRTUAL is-focus: 0 contains-focus: 1\n"
|
||||
"entry1: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_ANCESTOR is-focus: 1 contains-focus: 0\n");
|
||||
"entry1: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_ANCESTOR is-focus: 1 contains-focus: 1\n");
|
||||
|
||||
g_string_truncate (s, 0);
|
||||
|
||||
@@ -165,7 +165,7 @@ test_window_focus (void)
|
||||
"entry1: focus-out GDK_CROSSING_NORMAL GDK_NOTIFY_NONLINEAR is-focus: 0 contains-focus: 0\n"
|
||||
"box1: focus-out GDK_CROSSING_NORMAL GDK_NOTIFY_NONLINEAR_VIRTUAL is-focus: 0 contains-focus: 0\n"
|
||||
"box2: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_NONLINEAR_VIRTUAL is-focus: 0 contains-focus: 1\n"
|
||||
"entry2: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_NONLINEAR is-focus: 1 contains-focus: 0\n");
|
||||
"entry2: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_NONLINEAR is-focus: 1 contains-focus: 1\n");
|
||||
|
||||
g_string_truncate (s, 0);
|
||||
|
||||
@@ -179,7 +179,7 @@ test_window_focus (void)
|
||||
g_assert_cmpstr (s->str, ==,
|
||||
"entry2: focus-out GDK_CROSSING_NORMAL GDK_NOTIFY_ANCESTOR is-focus: 0 contains-focus: 0\n"
|
||||
"box2: focus-out GDK_CROSSING_NORMAL GDK_NOTIFY_VIRTUAL is-focus: 0 contains-focus: 0\n"
|
||||
"box: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_INFERIOR is-focus: 1 contains-focus: 0\n");
|
||||
"box: focus-in GDK_CROSSING_NORMAL GDK_NOTIFY_INFERIOR is-focus: 1 contains-focus: 1\n");
|
||||
|
||||
g_string_truncate (s, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user