save the state at the start of a drag and use it throughout until the button is released

This commit is contained in:
Dana Jansens 2003-04-06 06:19:15 +00:00
parent c42314ec44
commit 852f36235e

View file

@ -178,7 +178,8 @@ static gboolean fire_motion(MouseAction a, Context context, Client *c,
break; break;
} }
b->action[a]->data.resize.final = final; b->action[a]->data.resize.final = final;
} } else
g_assert_not_reached();
b->action[a]->func(&b->action[a]->data); b->action[a]->func(&b->action[a]->data);
return TRUE; return TRUE;
} }
@ -204,7 +205,7 @@ static void event(ObEvent *e, void *foo)
{ {
static Time ltime; static Time ltime;
static int px, py, cx, cy, cw, ch, dx, dy; static int px, py, cx, cy, cw, ch, dx, dy;
static guint button = 0, lbutton = 0; static guint button = 0, state = 0, lbutton = 0;
static gboolean drag = FALSE, drag_used = FALSE; static gboolean drag = FALSE, drag_used = FALSE;
static Corner corner = Corner_TopLeft; static Corner corner = Corner_TopLeft;
gboolean click = FALSE; gboolean click = FALSE;
@ -239,6 +240,7 @@ static void event(ObEvent *e, void *foo)
corner = pick_corner(px, py, cx, cy, cw, ch); corner = pick_corner(px, py, cx, cy, cw, ch);
} }
button = e->data.x.e->xbutton.button; button = e->data.x.e->xbutton.button;
state = e->data.x.e->xbutton.state;
} }
context = engine_get_context(e->data.x.client, context = engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window); e->data.x.e->xbutton.window);
@ -261,8 +263,7 @@ static void event(ObEvent *e, void *foo)
/* end drags */ /* end drags */
if (drag_used) { if (drag_used) {
fire_motion(MouseAction_Motion, context, fire_motion(MouseAction_Motion, context,
e->data.x.client, e->data.x.e->xbutton.state, e->data.x.client, state, button,
e->data.x.e->xbutton.button,
cx, cy, cw, ch, dx, dy, TRUE, corner); cx, cy, cw, ch, dx, dy, TRUE, corner);
drag = drag_used = FALSE; drag = drag_used = FALSE;
@ -291,6 +292,7 @@ static void event(ObEvent *e, void *foo)
} }
button = 0; button = 0;
state = 0;
ltime = e->data.x.e->xbutton.time; ltime = e->data.x.e->xbutton.time;
} }
fire_button(MouseAction_Release, context, fire_button(MouseAction_Release, context,
@ -318,8 +320,7 @@ static void event(ObEvent *e, void *foo)
e->data.x.e->xbutton.window); e->data.x.e->xbutton.window);
drag_used = fire_motion(MouseAction_Motion, context, drag_used = fire_motion(MouseAction_Motion, context,
e->data.x.client, e->data.x.client,
e->data.x.e->xmotion.state, state, button, cx, cy, cw, ch, dx, dy,
button, cx, cy, cw, ch, dx, dy,
FALSE, corner); FALSE, corner);
} }
} }