From 7ebb9ff6b7bc04d2a47a0d7202f7190ce41faa80 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 16 Dec 2008 10:39:52 +0000 Subject: [PATCH] Allow selecting with line-start and line-end bindings Instead of installing the line-start and line-end key bindings using the bare ClutterBindingPool API, we can use the internal clutter_text_add_move_binding(), which automatically installs the same key binding with the Shift modifier mask. This allows selecting when pressing Shift+Home or Shift+End. The selection behaviour is still incorrect around the zeroeth position, with all the text after the first line being selected. --- clutter/clutter-text.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 86c366ca0..f99b22b17 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1458,7 +1458,7 @@ clutter_text_real_activate (ClutterText *self, return FALSE; } -static void +static inline void clutter_text_add_move_binding (ClutterBindingPool *pool, const gchar *action, guint key_val, @@ -1836,26 +1836,21 @@ clutter_text_class_init (ClutterTextClass *klass) CLUTTER_KP_Down, G_CALLBACK (clutter_text_real_move_down)); - clutter_binding_pool_install_action (binding_pool, "line-start", - CLUTTER_Home, 0, - G_CALLBACK (clutter_text_real_line_start), - NULL, NULL); - clutter_binding_pool_install_action (binding_pool, "line-start", - CLUTTER_KP_Home, 0, - G_CALLBACK (clutter_text_real_line_start), - NULL, NULL); - clutter_binding_pool_install_action (binding_pool, "line-start", - CLUTTER_Begin, 0, - G_CALLBACK (clutter_text_real_line_start), - NULL, NULL); - clutter_binding_pool_install_action (binding_pool, "line-end", - CLUTTER_End, 0, - G_CALLBACK (clutter_text_real_line_end), - NULL, NULL); - clutter_binding_pool_install_action (binding_pool, "line-end", - CLUTTER_KP_End, 0, - G_CALLBACK (clutter_text_real_line_end), - NULL, NULL); + clutter_text_add_move_binding (binding_pool, "line-start", + CLUTTER_Home, + G_CALLBACK (clutter_text_real_line_start)); + clutter_text_add_move_binding (binding_pool, "line-start", + CLUTTER_KP_Home, + G_CALLBACK (clutter_text_real_line_start)); + clutter_text_add_move_binding (binding_pool, "line-start", + CLUTTER_Begin, + G_CALLBACK (clutter_text_real_line_start)); + clutter_text_add_move_binding (binding_pool, "line-end", + CLUTTER_End, + G_CALLBACK (clutter_text_real_line_end)); + clutter_text_add_move_binding (binding_pool, "line-end", + CLUTTER_KP_End, + G_CALLBACK (clutter_text_real_line_end)); clutter_binding_pool_install_action (binding_pool, "delete-next", CLUTTER_Delete, 0,