[glide] Batch the undo operations for the ctrl+/- operations by key release...fixes performance
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Batch the undo operations for the ctrl+/- operations by key release...fixes performance
- Date: Fri, 30 Apr 2010 19:38:46 +0000 (UTC)
commit 3323e5df7a43297e2672590c5ec2b05ccac6458b
Author: Robert Carr <racarr Valentine localdomain>
Date: Fri Apr 30 15:38:41 2010 -0400
Batch the undo operations for the ctrl+/- operations by key release...fixes performance
src/glide-text.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/glide-text.c b/src/glide-text.c
index e633c22..ef421e4 100644
--- a/src/glide-text.c
+++ b/src/glide-text.c
@@ -222,6 +222,8 @@ struct _GlideTextPrivate
gfloat drag_center_y;
gboolean just_selected;
+
+ gboolean resize_key_down;
};
enum
@@ -1728,6 +1730,22 @@ glide_text_button_release (ClutterActor *actor,
}
static gboolean
+glide_text_key_release (ClutterActor *actor,
+ ClutterKeyEvent *event)
+{
+ GlideText *text = GLIDE_TEXT (actor);
+
+ if (text->priv->resize_key_down){
+ glide_undo_manager_end_actor_action (glide_actor_get_undo_manager (GLIDE_ACTOR (text)),
+ GLIDE_ACTOR (text));
+ text->priv->resize_key_down = FALSE;
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean
glide_text_key_press (ClutterActor *actor,
ClutterKeyEvent *event)
{
@@ -2520,9 +2538,9 @@ glide_text_increase_font_size (GlideText *self,
glide_text_dirty_cache (self);
glide_text_update_actor_size (self);
+ self->priv->resize_key_down = TRUE;
+
- glide_undo_manager_end_actor_action (glide_actor_get_undo_manager (GLIDE_ACTOR (self)),
- GLIDE_ACTOR (self));
return TRUE;
}
@@ -2542,9 +2560,8 @@ glide_text_decrease_font_size (GlideText *self,
glide_text_dirty_cache (self);
glide_text_update_actor_size (self);
-
- glide_undo_manager_end_actor_action (glide_actor_get_undo_manager (GLIDE_ACTOR (self)),
- GLIDE_ACTOR (self));
+
+ self->priv->resize_key_down = TRUE;
return TRUE;
}
@@ -2732,6 +2749,7 @@ glide_text_class_init (GlideTextClass *klass)
actor_class->get_preferred_height = glide_text_get_preferred_height;
actor_class->allocate = glide_text_allocate;
actor_class->key_press_event = glide_text_key_press;
+ actor_class->key_release_event = glide_text_key_release;
actor_class->button_press_event = glide_text_button_press;
actor_class->button_release_event = glide_text_button_release;
actor_class->motion_event = glide_text_motion;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]