add xctx->mouse_inside var to better decide if crosshair has to be drawn

This commit is contained in:
stefan schippers 2023-09-29 10:09:13 +02:00
parent c569f93a65
commit 405d950412
3 changed files with 5 additions and 0 deletions

View File

@ -1001,6 +1001,7 @@ void draw_crosshair(int del)
sdw = xctx->draw_window;
sdp = xctx->draw_pixmap;
if(!xctx->mouse_inside) return;
xctx->draw_pixmap = 0;
xctx->draw_window = 1;
@ -1144,8 +1145,10 @@ int rstate; /* (reduced state, without ShiftMask) */
{
case LeaveNotify:
draw_crosshair(1);
xctx->mouse_inside = 0;
break;
case EnterNotify:
xctx->mouse_inside = 1;
if(tclgetboolvar("draw_crosshair"))
tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL);
else

View File

@ -608,6 +608,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->enable_drill = 0;
xctx->prev_set_modify = -1;
xctx->prev_crossx = xctx->prev_crossy = 0.0;
xctx->mouse_inside = 0;
xctx->pending_fullzoom = 0;
my_strncpy(xctx->hiersep, ".", S(xctx->hiersep));
xctx->no_undo = 0;

View File

@ -977,6 +977,7 @@ typedef struct {
double p_xx1,p_xx2,p_yy1,p_yy2;
/* draw_crosshair */
double prev_crossx, prev_crossy;
int mouse_inside;
/* set_modify */
int prev_set_modify;
/* pan */