Merge branch 'focus-testsuite-fixes' into 'main'
text: Fix fallout from focus changes See merge request GNOME/gtk!5841
This commit is contained in:
@@ -320,6 +320,8 @@ static void gtk_text_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_text_notify (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_text_finalize (GObject *object);
|
||||
static void gtk_text_dispose (GObject *object);
|
||||
|
||||
@@ -738,6 +740,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
gobject_class->finalize = gtk_text_finalize;
|
||||
gobject_class->set_property = gtk_text_set_property;
|
||||
gobject_class->get_property = gtk_text_get_property;
|
||||
gobject_class->notify = gtk_text_notify;
|
||||
|
||||
widget_class->map = gtk_text_map;
|
||||
widget_class->unmap = gtk_text_unmap;
|
||||
@@ -1815,6 +1818,17 @@ gtk_text_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_notify (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
if (pspec->name == I_("has-focus"))
|
||||
gtk_text_check_cursor_blink (GTK_TEXT (object));
|
||||
|
||||
if (G_OBJECT_CLASS (gtk_text_parent_class)->notify)
|
||||
G_OBJECT_CLASS (gtk_text_parent_class)->notify (object, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_ensure_text_handles (GtkText *self)
|
||||
{
|
||||
@@ -6455,8 +6469,11 @@ static gboolean
|
||||
cursor_blinks (GtkText *self)
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (self));
|
||||
|
||||
if (gtk_event_controller_focus_is_focus (GTK_EVENT_CONTROLLER_FOCUS (priv->focus_controller)) &&
|
||||
if (gtk_widget_get_mapped (GTK_WIDGET (self)) &&
|
||||
gtk_window_is_active (GTK_WINDOW (root)) &&
|
||||
gtk_event_controller_focus_is_focus (GTK_EVENT_CONTROLLER_FOCUS (priv->focus_controller)) &&
|
||||
priv->editable &&
|
||||
priv->selection_bound == priv->current_pos)
|
||||
{
|
||||
|
||||
@@ -1641,7 +1641,7 @@ test_widget (void)
|
||||
builder = builder_new_from_string (buffer, -1, NULL);
|
||||
button1 = gtk_builder_get_object (builder, "button1");
|
||||
|
||||
g_assert_true (gtk_widget_has_focus (GTK_WIDGET (button1)));
|
||||
g_assert_true (gtk_widget_is_focus (GTK_WIDGET (button1)));
|
||||
window1 = gtk_builder_get_object (builder, "window1");
|
||||
gtk_window_destroy (GTK_WINDOW (window1));
|
||||
|
||||
|
||||
@@ -208,14 +208,14 @@ load_ui_file (GFile *ui_file,
|
||||
timeout_handle_id = g_timeout_add (2000,
|
||||
quit_iteration_loop,
|
||||
&keep_running);
|
||||
while (keep_running)
|
||||
{
|
||||
if (!g_main_context_iteration (NULL, FALSE))
|
||||
break;
|
||||
}
|
||||
while (keep_running && !gtk_window_is_active (GTK_WINDOW (window)))
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
if (keep_running)
|
||||
g_source_remove (timeout_handle_id);
|
||||
|
||||
g_assert (gtk_window_is_active (GTK_WINDOW (window)));
|
||||
|
||||
if (ext)
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user