aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-text/e-text.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-01-28 14:03:48 +0800
committerChris Lahey <clahey@src.gnome.org>2000-01-28 14:03:48 +0800
commit12ba6679acf39fabedc1748a57998a418e549df6 (patch)
tree33d34de46c999271603f3357a7b08ac9942446e1 /widgets/e-text/e-text.c
parent905f7de48f5c591caa340f099fff821e07bf82e4 (diff)
downloadgsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar.gz
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar.bz2
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar.lz
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar.xz
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.tar.zst
gsoc2013-evolution-12ba6679acf39fabedc1748a57998a418e549df6.zip
Handle the grab and ungrab command instead of doing focus by hand. This
2000-01-28 Christopher James Lahey <clahey@helixcode.com> * widgets/e-text.c (e_text_command): Handle the grab and ungrab command instead of doing focus by hand. This fixes a problem related to the scroll wheel. (e_text_command): Reset the blink timer in many more command situations so that the cursor blinks less when you're interacting with it. * widgets/e-text-event-processor-emacs-like.c: Send the grab focus command when starting a selection and the ungrab focus command when ending it. * widgets/e-text-event-processor-types.h: Added grab command type so that the event processor can tell the widget to grab the focus. * widgets/e-reflow.c: Redefined all sizes using #defines so that they can be tweaked later. Added scroll wheel handling and set up adjustment increments so that the scroll bars will work correctly. * widgets/e-minicard.h: Added minicard focus type enum. This doesn't mean anything yet, but it will later be used to say which direction the focus is coming from (below for shift-tab, above for tab.) svn path=/trunk/; revision=1650
Diffstat (limited to 'widgets/e-text/e-text.c')
-rw-r--r--widgets/e-text/e-text.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c
index 1aef2ded6c..bfff8e251a 100644
--- a/widgets/e-text/e-text.c
+++ b/widgets/e-text/e-text.c
@@ -1771,7 +1771,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y);
_get_tep(text);
return_val = e_text_event_processor_handle_event (text->tep,
- &e_tep_event);
+ &e_tep_event);
if (event->button.button == 1) {
if (event->type == GDK_BUTTON_PRESS)
text->button_down = TRUE;
@@ -1781,18 +1781,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
text->lastx = button.x;
text->lasty = button.y;
text->last_state = button.state;
- if (event->type == GDK_BUTTON_PRESS && text->timer) {
- g_timer_reset(text->timer);
- }
- if (event->type == GDK_BUTTON_PRESS) {
- gnome_canvas_item_grab (item,
- GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
- text->i_cursor,
- button.time);
- } else {
- gnome_canvas_item_ungrab (item, button.time);
- }
- } else if (text->editable && event->type == GDK_BUTTON_RELEASE) {
+ } else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) {
gnome_canvas_item_grab_focus (item);
return 1;
}
@@ -1972,6 +1961,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
case E_TEP_MOVE:
text->selection_start = _get_position(text, command);
text->selection_end = text->selection_start;
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_SELECT:
text->selection_end = _get_position(text, command);
@@ -1979,6 +1971,8 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
sel_end = MAX(text->selection_start, text->selection_end);
if (sel_start != sel_end) {
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
+ } else if (text->timer) {
+ g_timer_reset(text->timer);
}
break;
case E_TEP_DELETE:
@@ -1988,6 +1982,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
_delete_selection(text);
split_into_lines (text);
recalc_bounds (text);
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_INSERT:
@@ -1997,6 +1994,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
_insert(text, command->string, command->value);
split_into_lines (text);
recalc_bounds (text);
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_COPY:
sel_start = MIN(text->selection_start, text->selection_end);
@@ -2004,18 +2004,36 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
if (sel_start != sel_end) {
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
}
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_PASTE:
e_text_get_selection (text, clipboard_atom, command->time);
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_GET_SELECTION:
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
break;
case E_TEP_ACTIVATE:
+ if (text->timer) {
+ g_timer_reset(text->timer);
+ }
break;
case E_TEP_SET_SELECT_BY_WORD:
text->select_by_word = command->value;
break;
+ case E_TEP_GRAB:
+ gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text),
+ GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
+ text->i_cursor,
+ command->time);
+ break;
+ case E_TEP_UNGRAB:
+ gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time);
+ break;
case E_TEP_NOP:
break;
}