aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frame.c9
-rw-r--r--src/frame.h2
-rw-r--r--src/sc_editor.c51
3 files changed, 25 insertions, 37 deletions
diff --git a/src/frame.c b/src/frame.c
index 591dafd..16d272f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -641,3 +641,12 @@ void cursor_movev(struct frame *fr, int *cpara, int *cpos, int *ctrail,
signed int dir)
{
}
+
+
+void check_callback_click(struct frame *fr, int para)
+{
+ Paragraph *p = fr->paras[para];
+ if ( p->type == PARA_TYPE_CALLBACK ) {
+ p->click_func(0.0, 0.0, p->bvp, p->vp);
+ }
+}
diff --git a/src/frame.h b/src/frame.h
index 39fe13f..976fc2b 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -139,4 +139,6 @@ extern void cursor_moveh(struct frame *fr, int *cpara, int *cpos, int *ctrail,
extern void cursor_movev(struct frame *fr, int *cpara, int *cpos, int *ctrail,
signed int dir);
+extern void check_callback_click(struct frame *fr, int para);
+
#endif /* FRAME_H */
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;
}
}