static bool app_do_modal = false;
extern QWidgetList *qt_modal_stack; // stack of modal widgets
-int qt_last_x = 0;
-int qt_last_y = 0;
+qreal qt_last_x = 0;
+qreal qt_last_y = 0;
QPointer<QWidget> qt_last_mouse_receiver = 0;
static Qt::MouseButtons buttons = Qt::NoButton;
QEvent::Type type;
// move first
Qt::MouseButtons stateChange = e->buttons ^ buttons;
- if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
+ if (e->globalPos != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
QWidget * tlw = e->widget.data();
- QPoint localPoint = e->localPos;
- QPoint globalPoint = e->globalPos;
+ QPointF localPoint = e->localPos;
+ QPointF globalPoint = e->globalPos;
QWidget *mouseWindow = tlw;
Qt::MouseButton button = Qt::NoButton;
// find the tlw if we didn't get it from the plugin
if (!mouseWindow) {
- mouseWindow = QApplication::topLevelAt(globalPoint);
+ mouseWindow = QApplication::topLevelAt(globalPoint.toPoint());
}
if (!mouseWindow && !implicit_mouse_grabber)
if (mouseWindow && mouseWindow != tlw) {
//we did not get a sensible localPoint from the window system, so let's calculate it
- localPoint = mouseWindow->mapFromGlobal(globalPoint);
+ localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint());
}
// which child should have it?
QWidget *mouseWidget = mouseWindow;
if (mouseWindow) {
- QWidget *w = mouseWindow->childAt(localPoint);
+ QWidget *w = mouseWindow->childAt(localPoint.toPoint());
if (w) {
mouseWidget = w;
}
mouseWidget = implicit_mouse_grabber.data();
mouseWindow = mouseWidget->window();
if (mouseWindow != tlw)
- localPoint = mouseWindow->mapFromGlobal(globalPoint);
+ localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint());
}
Q_ASSERT(mouseWidget);
//localPoint is local to mouseWindow, but it needs to be local to mouseWidget
- localPoint = mouseWidget->mapFrom(mouseWindow, localPoint);
+ localPoint = mouseWidget->mapFrom(mouseWindow, localPoint.toPoint());
if (buttons == Qt::NoButton) {
//qDebug() << "resetting mouse grabber";
#ifndef QT_NO_CONTEXTMENU
if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
- QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QApplication::keyboardModifiers());
+ QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint.toPoint(), globalPoint.toPoint(), QApplication::keyboardModifiers());
QApplication::sendSpontaneousEvent(mouseWidget, &e);
}
#endif // QT_NO_CONTEXTMENU
void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
{
// QPoint localPoint = ev.pos();
- QPoint globalPoint = e->globalPos;
+ QPointF globalPoint = e->globalPos;
// bool trustLocalPoint = !!tlw; //is there something the local point can be local to?
QWidget *mouseWidget;
// find the tlw if we didn't get it from the plugin
if (!mouseWindow) {
- mouseWindow = QApplication::topLevelAt(globalPoint);
+ mouseWindow = QApplication::topLevelAt(globalPoint.toPoint());
}
if (!mouseWindow)
qDebug() << "modal blocked wheel event" << mouseWindow;
return;
}
- QPoint p = mouseWindow->mapFromGlobal(globalPoint);
- QWidget *w = mouseWindow->childAt(p);
+ QPointF p = mouseWindow->mapFromGlobal(globalPoint.toPoint());
+ QWidget *w = mouseWindow->childAt(p.toPoint());
if (w) {
mouseWidget = w;
- p = mouseWidget->mapFromGlobal(globalPoint);
+ p = mouseWidget->mapFromGlobal(globalPoint.toPoint());
}
QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(),
#endif //QT_NO_CURSOR
-extern int qt_last_x,qt_last_y;
+extern qreal qt_last_x,qt_last_y;
QPoint QCursor::pos()
{
- return QPoint(qt_last_x, qt_last_y);
+ return QPointF(qt_last_x, qt_last_y).toPoint();
}
void QCursor::setPos(int x, int y)
*/
-void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
+void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent(w, time, local, global, b);
}
-void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
{
if (tlw) {
QWidgetData *data = qt_qwidget_data(tlw);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
+void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(w, time, local, global, d, o);
}
-void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
{
if (tlw) {
QWidgetData *data = qt_qwidget_data(tlw);
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
- static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
- static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
const QString& text = QString(), bool autorep = false,
ushort count = 1);
- static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
- static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
struct TouchPoint {
int id; // for application use
class MouseEvent : public UserEvent {
public:
- MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+ MouseEvent(QWidget * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
: UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { }
- QPoint localPos;
- QPoint globalPos;
+ QPointF localPos;
+ QPointF globalPos;
Qt::MouseButtons buttons;
};
class WheelEvent : public UserEvent {
public:
- WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+ WheelEvent(QWidget *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
: UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { }
int delta;
- QPoint localPos;
- QPoint globalPos;
+ QPointF localPos;
+ QPointF globalPos;
Qt::Orientation orient;
};