From 8eae5398c55e5a66df891522d15d4489f6557cb1 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Thu, 6 Jan 2022 05:34:42 +0100 Subject: [PATCH] fix clipping cursor texts --- src/callback.c | 3 ++- src/draw.c | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/callback.c b/src/callback.c index d13f77b2..d123cc14 100644 --- a/src/callback.c +++ b/src/callback.c @@ -26,7 +26,8 @@ static int waves_selected(int event, int key, int state, int button) { int i; int is_inside = 0, skip = 0; - if(xctx->ui_state & (STARTPAN2 | STARTSELECT | STARTMOVE | STARTCOPY)) skip = 1; + static int excl = STARTZOOM | STARTRECT | STARTLINE | STARTWIRE | STARTPAN2 | STARTSELECT | STARTMOVE | STARTCOPY; + if(xctx->ui_state & excl) skip = 1; if(state & Mod1Mask) skip = 1; if(event == MotionNotify && (state & Button2Mask)) skip = 1; if(event == ButtonPress && button == Button2) skip = 1; diff --git a/src/draw.c b/src/draw.c index 8dd28d87..225b7743 100644 --- a/src/draw.c +++ b/src/draw.c @@ -2154,7 +2154,7 @@ static void draw_cursor(double active_cursorx, double other_cursorx, int cursor_ char tmpstr[1024]; double txtsize = gr->txtsizex; int flip = (other_cursorx > active_cursorx) ? 0 : 1; - int xoffs = flip ? 2 : -2; + int xoffs = flip ? 3 : -3; if(xx >= gr->x1 && xx <= gr->x2) { drawline(cursor_color, NOW, xx, gr->ry1, xx, gr->ry2, 1); @@ -2466,24 +2466,24 @@ void draw_graph(int i, const int flags, Graph_ctx *gr) my_free(1392, &color); my_free(1408, &sweep); } /* if(flags & 8) */ - - /* cursor1 */ - if((flags & 2) && (flags & 8)) draw_cursor(xctx->graph_cursor1_x, xctx->graph_cursor2_x, 1, gr); - /* cursor2 */ - if((flags & 4) && (flags & 8)) draw_cursor(xctx->graph_cursor2_x, xctx->graph_cursor1_x, 3, gr); - /* difference between cursors */ - if((flags & 2) && (flags & 4) && (flags & 8)) draw_cursor_difference(gr); - + bbox(START, 0.0, 0.0, 0.0, 0.0); + bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2); + bbox(SET_INSIDE, 0.0, 0.0, 0.0, 0.0); + if(flags & 8) { + /* cursor1 */ + if((flags & 2)) draw_cursor(xctx->graph_cursor1_x, xctx->graph_cursor2_x, 1, gr); + /* cursor2 */ + if((flags & 4)) draw_cursor(xctx->graph_cursor2_x, xctx->graph_cursor1_x, 3, gr); + /* difference between cursors */ + if((flags & 2) && (flags & 4)) draw_cursor_difference(gr); + } if(flags & 1) { /* copy save buffer to screen */ - bbox(START, 0.0, 0.0, 0.0, 0.0); - bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2); - bbox(SET, 0.0, 0.0, 0.0, 0.0); if(!xctx->draw_window) { XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y, xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y); } - bbox(END, 0.0, 0.0, 0.0, 0.0); } + bbox(END, 0.0, 0.0, 0.0, 0.0); } /* flags: