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.
This commit is contained in:
Emmanuele Bassi 2008-12-16 10:39:52 +00:00
parent ea5a6abd9d
commit 7ebb9ff6b7

View File

@ -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,