Fix error canceling tool-loop with left-button (when the user starts drawing with right-button).

This commit is contained in:
David Capello 2011-08-22 13:47:28 -03:00
parent e090c966bf
commit ee612bb366
2 changed files with 16 additions and 13 deletions

View File

@ -1428,12 +1428,11 @@ static Message* new_mouse_msg(int type, JWidget widget)
msg->mouse.x = jmouse_x(0);
msg->mouse.y = jmouse_y(0);
msg->mouse.flags =
type == JM_BUTTONRELEASED ? jmouse_b(1):
jmouse_b(0);
msg->mouse.left = msg->mouse.flags & 1 ? true: false;
msg->mouse.right = msg->mouse.flags & 2 ? true: false;
msg->mouse.middle = msg->mouse.flags & 4 ? true: false;
msg->mouse.flags = (type == JM_BUTTONRELEASED ? jmouse_b(1):
jmouse_b(0));
msg->mouse.left = ((jmouse_b(0) & 1) != (jmouse_b(1) & 1));
msg->mouse.right = ((jmouse_b(0) & 2) != (jmouse_b(1) & 2));
msg->mouse.middle = ((jmouse_b(0) & 4) != (jmouse_b(1) & 4));
if (widget != NULL)
jmessage_add_dest(msg, widget);

View File

@ -216,6 +216,7 @@ void ToolLoopManager::snapToGrid(bool flexible, Point& point)
void ToolLoopManager::calculateDirtyArea(ToolLoop* loop, const Points& points, Rect& dirty_area)
{
if (points.size() > 0) {
Point minpt, maxpt;
calculateMinMax(points, minpt, maxpt);
@ -224,6 +225,9 @@ void ToolLoopManager::calculateDirtyArea(ToolLoop* loop, const Points& points, R
loop->getPointShape()->getModifiedArea(loop, minpt.x, minpt.y, r1);
loop->getPointShape()->getModifiedArea(loop, maxpt.x, maxpt.y, r2);
dirty_area = r1.createUnion(r2);
}
else
dirty_area = Rect();
}
void ToolLoopManager::calculateMinMax(const Points& points, Point& minpt, Point& maxpt)