From 88dec7a2580f336ae11d805839ce3204c67ac07a Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 12 Feb 2000 01:07:15 +0000 Subject: Made a click on a text widget set the cursor properly. 2000-02-11 Christopher James Lahey * widgets/e-text/e-text.c (e_text_event): Made a click on a text widget set the cursor properly. svn path=/trunk/; revision=1740 --- ChangeLog | 5 +++++ widgets/e-text/e-text.c | 21 ++++++++++++++++++--- widgets/text/e-text.c | 21 ++++++++++++++++++--- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d72b0f61a8..102a88517a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-02-11 Christopher James Lahey + + * widgets/e-text/e-text.c (e_text_event): Made a click on a text + widget set the cursor properly. + 2000-02-11 Christopher James Lahey * widgets/e-text/e-text.h: Removed some arguments from the .h that diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index b33e99194d..8dde3bbaed 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-text/e-text.c @@ -1898,6 +1898,24 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) break; case GDK_BUTTON_PRESS: /* Fall Through */ case GDK_BUTTON_RELEASE: + if ((!text->editing) + && text->editable + && event->type == GDK_BUTTON_RELEASE + && event->button.button == 1) { + GdkEventButton button = event->button; + + gnome_canvas_item_grab_focus (item); + + e_tep_event.type = GDK_BUTTON_PRESS; + e_tep_event.button.time = button.time; + e_tep_event.button.state = button.state; + e_tep_event.button.button = button.button; + 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.type = GDK_BUTTON_RELEASE; + } if (text->editing) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; @@ -1916,9 +1934,6 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) text->lastx = button.x; text->lasty = button.y; text->last_state = button.state; - } else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { - gnome_canvas_item_grab_focus (item); - return 1; } break; case GDK_MOTION_NOTIFY: diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index b33e99194d..8dde3bbaed 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -1898,6 +1898,24 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) break; case GDK_BUTTON_PRESS: /* Fall Through */ case GDK_BUTTON_RELEASE: + if ((!text->editing) + && text->editable + && event->type == GDK_BUTTON_RELEASE + && event->button.button == 1) { + GdkEventButton button = event->button; + + gnome_canvas_item_grab_focus (item); + + e_tep_event.type = GDK_BUTTON_PRESS; + e_tep_event.button.time = button.time; + e_tep_event.button.state = button.state; + e_tep_event.button.button = button.button; + 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.type = GDK_BUTTON_RELEASE; + } if (text->editing) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; @@ -1916,9 +1934,6 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) text->lastx = button.x; text->lasty = button.y; text->last_state = button.state; - } else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { - gnome_canvas_item_grab_focus (item); - return 1; } break; case GDK_MOTION_NOTIFY: -- cgit