Changeset 301 for trunk/src


Ignore:
Timestamp:
Nov 6, 2009, 8:08:18 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed: Due to the vertical PM coordinate space flip comparing to the Qt coordinate space, WM_SIZE events from PM may also mean widget movement. These move events were not reported to Qt which resulted widget positions from the Qt point of view not matching the actual positions on screen (#90).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r289 r301  
    20682068    }
    20692069
     2070    // Note: due to the vertical coordinate space flip in PM, WM_SIZE events may
     2071    // also mean moving the widget in Qt coordinates
     2072
     2073    if (qmsg.msg == WM_MOVE || qmsg.msg == WM_SIZE) { // move event
     2074        QPoint oldPos = data->crect.topLeft();
     2075        SWP swp;
     2076        if (isWindow()) {
     2077            WinQueryWindowPos(fId, &swp);
     2078            // flip y coordinate
     2079            swp.y = QApplication::desktop()->height() - (swp.y + swp.cy);
     2080            QTLWExtra *top = d_func()->topData();
     2081            swp.x += top->frameStrut.left();
     2082            swp.y += top->frameStrut.top();
     2083        } else {
     2084            WinQueryWindowPos(internalWinId(), &swp);
     2085            // flip y coordinate
     2086            swp.y = parentWidget()->height() - (swp.y + swp.cy);
     2087        }
     2088        QPoint newCPos(swp.x, swp.y);
     2089        if (newCPos != oldPos) {
     2090            data->crect.moveTopLeft(newCPos);
     2091            if (isVisible()) {
     2092                QMoveEvent e(newCPos, oldPos); // cpos (client position)
     2093                QApplication::sendSpontaneousEvent(this, &e);
     2094            } else {
     2095                QMoveEvent *e = new QMoveEvent(newCPos, oldPos);
     2096                QApplication::postEvent(this, e);
     2097            }
     2098        }
     2099    }
    20702100    if (qmsg.msg == WM_SIZE) { // resize event
    20712101        QSize oldSize = data->crect.size();
     
    21272157            }
    21282158        }
    2129     } else if (qmsg.msg == WM_MOVE) { // move event
    2130         QPoint oldPos = data->crect.topLeft();
    2131         SWP swp;
    2132         if (isWindow()) {
    2133             WinQueryWindowPos(fId, &swp);
    2134             // flip y coordinate
    2135             swp.y = QApplication::desktop()->height() - (swp.y + swp.cy);
    2136             QTLWExtra *top = d_func()->topData();
    2137             swp.x += top->frameStrut.left();
    2138             swp.y += top->frameStrut.top();
    2139         } else {
    2140             WinQueryWindowPos(internalWinId(), &swp);
    2141             // flip y coordinate
    2142             swp.y = parentWidget()->height() - (swp.y + swp.cy);
    2143         }
    2144         QPoint newCPos(swp.x, swp.y);
    2145         if (newCPos != oldPos) {
    2146             data->crect.moveTopLeft(newCPos);
    2147             if (isVisible()) {
    2148                 QMoveEvent e(newCPos, oldPos); // cpos (client position)
    2149                 QApplication::sendSpontaneousEvent(this, &e);
    2150             } else {
    2151                 QMoveEvent *e = new QMoveEvent(newCPos, oldPos);
    2152                 QApplication::postEvent(this, e);
    2153             }
    2154         }
    21552159    }
    21562160    setAttribute(Qt::WA_WState_ConfigPending, false);                // clear config flag
Note: See TracChangeset for help on using the changeset viewer.