diff options
author | Thomas White <taw@bitwiz.org.uk> | 2016-03-28 22:51:49 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2016-03-28 22:51:49 +0200 |
commit | fe17e48d6b5bb0e05cab77812b0e36f181666810 (patch) | |
tree | 6984b1b9e997fa9b031ba303a62069f68ab39610 /src/sc_editor.c | |
parent | d4de5d06c2ac66b15aa01da3f29dbb33ea270249 (diff) |
Restore callback clicks
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index c61c51a..05da7c9 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -773,26 +773,6 @@ static void calculate_box_size(struct frame *fr, SCEditor *e, } -static int callback_click(SCEditor *e, struct frame *fr, double x, double y) -{ -#if 0 -/* FIXME */ - int ln, bn, pn; - struct wrap_box *bx; - - find_cursor(fr, x, y, &ln, &bn, &pn); - if ( (ln==0) && (bn==0) && (pn==0) ) return 0; - /* FIXME: The above might be the case in a non-error situation. - * find_cursor() needs a better way of returning an error */ - bx = cbox(fr, ln, bn); - if ( bx->type == WRAP_BOX_CALLBACK ) { - return bx->click_func(x, y, bx->bvp, bx->vp); - } -#endif - return 0; -} - - static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, SCEditor *e) { @@ -837,26 +817,23 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, } else { - /* If this is a callback box, check to see if the owner - * is interested */ - if ( !callback_click(e, clicked, x, y) ) { - - /* else position cursor and prepare for possible - * drag */ + /* Position cursor and prepare for possible drag */ + e->cursor_frame = clicked; + find_cursor(clicked, x-fr->x, y-fr->y, + &e->cursor_para, &e->cursor_pos, + &e->cursor_trail); - e->cursor_frame = clicked; - find_cursor(clicked, x-fr->x, y-fr->y, - &e->cursor_para, &e->cursor_pos, - &e->cursor_trail); + e->start_corner_x = event->x - e->border_offs_x; + e->start_corner_y = event->y - e->border_offs_y; - e->start_corner_x = event->x - e->border_offs_x; - e->start_corner_y = event->y - e->border_offs_y; - - if ( fr->resizable ) { - e->drag_status = DRAG_STATUS_COULD_DRAG; - e->drag_reason = DRAG_REASON_MOVE; - } + if ( event->type == GDK_2BUTTON_PRESS ) { + check_callback_click(e->cursor_frame, + e->cursor_para); + } + if ( fr->resizable ) { + e->drag_status = DRAG_STATUS_COULD_DRAG; + e->drag_reason = DRAG_REASON_MOVE; } } |