Commit 5d086f9c authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fix for broken DragEnter/DragLeave.

parent cf530345
......@@ -647,22 +647,30 @@ void FlowDrawQt::event_handler(FlowCtx* ctx, QEvent* event, QWidget* target)
button_pressed = 0;
button_clicked_and_pressed = 0;
}
if (pos.x() > 0 && pos.y() > 0 && pos.x() < target->width() && pos.y() < target->height()) {
if (button1_pressed || button2_pressed || button3_pressed) {
if (!ctx->cursor_present) {
sts = ctx->event_handler(flow_eEvent_Enter, pos.x(), pos.y(), 0, 0);
} else {
sts = ctx->event_handler(
flow_eEvent_ButtonMotion, pos.x(), pos.y(), 0, 0);
}
} else {
sts = ctx->event_handler(
flow_eEvent_CursorMotion, pos.x(), pos.y(), 0, 0);
}
} else if (ctx->cursor_present && (button1_pressed || button2_pressed || button3_pressed)) {
sts = ctx->event_handler(flow_eEvent_Leave, pos.x(), pos.y(), 0, 0);
}
break;
}
case QEvent::Enter: {
QPoint pos = QCursor::pos();
QPoint pos = target->mapFromGlobal(QCursor::pos());
sts = ctx->event_handler(flow_eEvent_Enter, pos.x(), pos.y(), 0, 0);
break;
}
case QEvent::Leave: {
QPoint pos = QCursor::pos();
QPoint pos = target->mapFromGlobal(QCursor::pos());
sts = ctx->event_handler(flow_eEvent_Leave, pos.x(), pos.y(), 0, 0);
break;
}
......@@ -674,9 +682,6 @@ void FlowDrawQt::event_handler(FlowCtx* ctx, QEvent* event, QWidget* target)
sts = ctx->event_handler(flow_eEvent_Unmap, 0, 0, 0, 0);
break;
}
case QEvent::FocusIn:
case QEvent::FocusOut:
break;
case QEvent::Wheel: {
QWheelEvent* wheelEvent = ((QWheelEvent*)event);
if (wheelEvent->delta() > 0) {
......
......@@ -705,22 +705,30 @@ void GlowDrawQt::event_handler(QEvent* event, QWidget* target)
button_pressed = 0;
button_clicked_and_pressed = 0;
}
if (pos.x() > 0 && pos.y() > 0 && pos.x() < target->width() && pos.y() < target->height()) {
if (button1_pressed || button2_pressed || button3_pressed) {
if (!ctx->cursor_present) {
sts = ctx->event_handler(glow_eEvent_Enter, pos.x(), pos.y(), 0, 0);
} else {
sts = ctx->event_handler(
glow_eEvent_ButtonMotion, pos.x(), pos.y(), 0, 0);
}
} else {
sts = ctx->event_handler(
glow_eEvent_CursorMotion, pos.x(), pos.y(), 0, 0);
}
} else if (ctx->cursor_present && (button1_pressed || button2_pressed || button3_pressed)) {
sts = ctx->event_handler(glow_eEvent_Leave, pos.x(), pos.y(), 0, 0);
}
break;
}
case QEvent::Enter: {
QPoint pos = QCursor::pos();
QPoint pos = target->mapFromGlobal(QCursor::pos());
sts = ctx->event_handler(glow_eEvent_Enter, pos.x(), pos.y(), 0, 0);
break;
}
case QEvent::Leave: {
QPoint pos = QCursor::pos();
QPoint pos = target->mapFromGlobal(QCursor::pos());
sts = ctx->event_handler(glow_eEvent_Leave, pos.x(), pos.y(), 0, 0);
break;
}
......@@ -732,9 +740,6 @@ void GlowDrawQt::event_handler(QEvent* event, QWidget* target)
sts = ctx->event_handler(glow_eEvent_Unmap, 0, 0, 0, 0);
break;
}
case QEvent::FocusIn:
case QEvent::FocusOut:
break;
case QEvent::Wheel: {
// TODO: the event handler should also take scroll delta as a parameter
QWheelEvent* wheelEvent = ((QWheelEvent*)event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment