GtkEntry: Remove recompute idle

Just do it directly
This commit is contained in:
Timm Bäder 2015-12-03 18:14:45 +01:00
parent cfc23cbf32
commit f11f989f1f

View File

@ -227,7 +227,6 @@ struct _GtkEntryPrivate
guint blink_time; /* time in msec the cursor has blinked since last user event */
guint blink_timeout;
guint recompute_idle;
guint16 preedit_length; /* length of preedit string, in bytes */
guint16 preedit_cursor; /* offset of cursor within preedit string, in chars */
@ -2887,12 +2886,6 @@ gtk_entry_destroy (GtkWidget *widget)
priv->blink_timeout = 0;
}
if (priv->recompute_idle)
{
g_source_remove (priv->recompute_idle);
priv->recompute_idle = 0;
}
if (priv->magnifier)
_gtk_magnifier_set_inspected (GTK_MAGNIFIER (priv->magnifier), NULL);
@ -2961,9 +2954,6 @@ gtk_entry_finalize (GObject *object)
if (priv->blink_timeout)
g_source_remove (priv->blink_timeout);
if (priv->recompute_idle)
g_source_remove (priv->recompute_idle);
if (priv->selection_bubble)
gtk_widget_destroy (priv->selection_bubble);
@ -4226,10 +4216,6 @@ gtk_entry_update_handles (GtkEntry *entry,
_gtk_text_handle_set_mode (priv->text_handle, mode);
/* Wait for recomputation before repositioning */
if (priv->recompute_idle != 0)
return;
height = gdk_window_get_height (priv->text_area);
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL);
@ -5512,8 +5498,19 @@ buffer_notify_text (GtkEntryBuffer *buffer,
GParamSpec *spec,
GtkEntry *entry)
{
int new_current_pos, new_selection_bound;
guint buffer_length;
if (entry->priv->handling_key_event)
gtk_entry_obscure_mouse_cursor (entry);
/* Make sure the cursor/selection stays in the new text length */
buffer_length = gtk_entry_buffer_get_length (buffer);
new_current_pos = MIN (entry->priv->current_pos, buffer_length);
new_selection_bound = MIN (entry->priv->selection_bound, buffer_length);
gtk_entry_set_positions (entry, new_current_pos, new_selection_bound);
gtk_entry_recompute (entry);
emit_changed (entry);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_TEXT]);
@ -6229,20 +6226,16 @@ update_im_cursor_location (GtkEntry *entry)
gtk_im_context_set_cursor_location (priv->im_context, &area);
}
static gboolean
recompute_idle_func (gpointer data)
static void
gtk_entry_recompute (GtkEntry *entry)
{
GtkEntry *entry = GTK_ENTRY (data);
GtkEntryPrivate *priv = entry->priv;
priv->recompute_idle = 0;
if (gtk_widget_has_screen (GTK_WIDGET (entry)))
{
GtkTextHandleMode handle_mode;
gtk_entry_reset_layout (entry);
gtk_entry_check_cursor_blink (entry);
gtk_entry_adjust_scroll (entry);
gtk_widget_queue_draw (GTK_WIDGET (entry));
update_im_cursor_location (entry);
@ -6253,25 +6246,8 @@ recompute_idle_func (gpointer data)
if (handle_mode != GTK_TEXT_HANDLE_MODE_NONE)
gtk_entry_update_handles (entry, handle_mode);
}
}
return FALSE;
}
static void
gtk_entry_recompute (GtkEntry *entry)
{
GtkEntryPrivate *priv = entry->priv;
gtk_entry_reset_layout (entry);
gtk_entry_check_cursor_blink (entry);
if (!priv->recompute_idle)
{
priv->recompute_idle = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 15, /* between resize and redraw */
recompute_idle_func, entry, NULL);
g_source_set_name_by_id (priv->recompute_idle, "[gtk+] recompute_idle_func");
}
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
static void