From 7ee11e8dbcc74513c79a491232b6da227791df66 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 21 Jan 2025 16:07:23 +0100 Subject: [PATCH] various fixes related to crosshair mouse display --- src/callback.c | 32 ++++++++++++++++---------------- src/draw.c | 9 +++------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/callback.c b/src/callback.c index dadf52e1..07ea4a3e 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1380,25 +1380,25 @@ void draw_crosshair(int what) } else { if(xhair_size) { draw_xhair_line(xctx->gctiled, xhair_size, - X_TO_SCREEN(xctx->mousex_snap) - xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) - xhair_size, - X_TO_SCREEN(xctx->mousex_snap) + xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) - xhair_size); + X_TO_SCREEN(xctx->prev_crossx) - xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) - xhair_size, + X_TO_SCREEN(xctx->prev_crossx) + xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) - xhair_size); draw_xhair_line(xctx->gctiled, xhair_size, - X_TO_SCREEN(xctx->mousex_snap) - xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) + xhair_size, - X_TO_SCREEN(xctx->mousex_snap) + xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) + xhair_size); + X_TO_SCREEN(xctx->prev_crossx) - xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) + xhair_size, + X_TO_SCREEN(xctx->prev_crossx) + xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) + xhair_size); draw_xhair_line(xctx->gctiled, xhair_size, - X_TO_SCREEN(xctx->mousex_snap) - xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) - xhair_size, - X_TO_SCREEN(xctx->mousex_snap) - xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) + xhair_size); + X_TO_SCREEN(xctx->prev_crossx) - xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) - xhair_size, + X_TO_SCREEN(xctx->prev_crossx) - xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) + xhair_size); draw_xhair_line(xctx->gctiled, xhair_size, - X_TO_SCREEN(xctx->mousex_snap) + xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) - xhair_size, - X_TO_SCREEN(xctx->mousex_snap) + xhair_size, - Y_TO_SCREEN(xctx->mousey_snap) + xhair_size); + X_TO_SCREEN(xctx->prev_crossx) + xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) - xhair_size, + X_TO_SCREEN(xctx->prev_crossx) + xhair_size, + Y_TO_SCREEN(xctx->prev_crossy) + xhair_size); } else { /* full screen span xhair */ drawtempline(xctx->gctiled, NOW, X_TO_XSCHEM(xctx->areax1), xctx->prev_crossy, X_TO_XSCHEM(xctx->areax2), xctx->prev_crossy); diff --git a/src/draw.c b/src/draw.c index 2165bd21..9c5f9d6e 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1196,17 +1196,14 @@ void draw_xhair_line(GC gc, int size, double linex1, double liney1, double linex 0, size ? LineSolid : xDashType, xCap, xJoin); } else { XSetLineAttributes (display, gc, - XLINEWIDTH(xctx->lw), xDashType, xCap, xJoin); + size ? 0 : XLINEWIDTH(xctx->lw), size ? LineSolid : xDashType, xCap, xJoin); } - if(xctx->draw_window) XDrawLine(display, xctx->window, gc, (int)x1, (int)y1, (int)x2, (int)y2); if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc, (int)x1, (int)y1, (int)x2, (int)y2); - if(!big_gr) { - XSetLineAttributes (display, gc, - XLINEWIDTH(xctx->lw), LineSolid, LINECAP, LINEJOIN); - } + XSetLineAttributes (display, gc, + XLINEWIDTH(xctx->lw), LineSolid, LINECAP, LINEJOIN); } }