Changeset 114
- Timestamp:
- Aug 14, 2009, 11:20:20 PM (16 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qapplication_pm.cpp
r112 r114 132 132 // inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); } 133 133 // inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); } 134 134 135 // inline uint testWindowState(uint teststate){ return dataPtr()->window_state & teststate; } 135 136 // inline void forceUpdate() { … … 1446 1447 // qwidget_pm.cpp), we have to validate areas that intersect with our 1447 1448 // children and siblings, taking their clip regions into account. 1448 //validateObstacles();1449 validateObstacles(); 1449 1450 1450 1451 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); … … 1473 1474 d_func()->hd = WinBeginPaint(internalWinId(), 0, &rcl); 1474 1475 1476 1477 1478 1479 1480 1481 1475 1482 // it's possible that the update rectangle is empty 1476 1483 if (rcl.xRight <= rcl.xLeft || rcl.yTop <= rcl.yBottom) { -
trunk/src/gui/kernel/qwidget_p.h
r112 r114 633 633 634 634 void setModal_sys(); 635 636 637 638 639 640 641 642 643 635 644 QSizePolicy size_policy; 636 645 QLocale locale; -
trunk/src/gui/kernel/qwidget_pm.cpp
r112 r114 107 107 } 108 108 109 // Returns a QWidget pointer or 0 if there is no widget corresponding to the110 // given HWND. As opposed to QWidget::find(), correctly handles WC_FRAME windows111 // created for top level widgets. Used for debugging.112 static QWidget *widgetFromId(HWND hwnd)113 {114 char buf[10];115 if (WinQueryClassName(hwnd, sizeof(buf), buf)) {116 if (!strcmp(buf, "#1")) // WC_FRAME117 hwnd = WinWindowFromID(hwnd, FID_CLIENT);118 return QWidget::find(hwnd);119 }120 return 0;121 }122 123 // Returns a human readable widget name in the form "class/name".124 // Used for debugging.125 static QByteArray widgetName(QWidget *w)126 {127 if (w)128 return QString()129 .sprintf("%s/%s", w->metaObject()->className(),130 w->objectName().toLocal8Bit().constData()).toLocal8Bit();131 return QByteArray("<no-widget>");132 }133 134 109 /*! 135 110 \internal … … 170 145 qDebug("qt_WinInvalidateRegionEx: hwnd=%08lX [%s] " 171 146 "hwndFrom=%08lX hwndTo=%08lX", hwnd, 172 widgetName(widgetFromId(hwnd)).constData(),147 ).constData(), 173 148 hwndFrom, hwndTo); 174 149 #endif … … 200 175 #if defined(QT_DEBUGWIDGETMASK) 201 176 qDebug(" child=%08lX [fl=%08lX] [%s]", child, swp.fl, 202 widgetName(widgetFromId(child)).constData());177 ).constData()); 203 178 #endif 204 179 // proceed only if not hidden … … 286 261 qDebug("qt_WinProcessWindowObstacles: hwnd=%08lX [%s], prcl=%p " 287 262 "hrgn=%08lX, op=%ld flags=%08lX", hwnd, 288 widgetName(widgetFromId(hwnd)).constData(),263 ).constData(), 289 264 prcl, hrgn, op, flags); 290 265 #endif … … 339 314 #if defined(QT_DEBUGWIDGETMASK) 340 315 qDebug(" child=%08lX [fl=%08lX] [%s]", relative, swp.fl, 341 widgetName(widgetFromId(relative)).constData());316 ).constData()); 342 317 #endif 343 318 // skip if hidden … … 379 354 #if defined(QT_DEBUGWIDGETMASK) 380 355 qDebug(" sibling=%08lX [fl=%08lX] [%s]", relative, swp.fl, 381 widgetName(widgetFromId(relative)).constData());356 ).constData()); 382 357 #endif 383 358 // skip if hidden … … 429 404 #if defined(QT_DEBUGWIDGETMASK) 430 405 qDebug(" parent=%08lX [fl=%08lX] [%s]", parent, swp.fl, 431 widgetName(widgetFromId(parent)).constData());406 ).constData()); 432 407 #endif 433 408 delta.x += swp.x; … … 438 413 #if defined(QT_DEBUGWIDGETMASK) 439 414 qDebug(" ancestor=%08lX [fl=%08lX] [%s]", relative, swp.fl, 440 widgetName(widgetFromId(parent)).constData());415 ).constData()); 441 416 #endif 442 417 // skip if hidden … … 489 464 #if defined(QT_DEBUGWIDGETMASK) 490 465 qDebug("qt_WinSetWindowPos: hwnd=%08lX [%s] fl=%08lX", hwnd, 491 widgetName(widgetFromId(hwnd)).constData(), fl);466 ).constData(), fl); 492 467 #endif 493 468 … … 577 552 qDebug(" moving up? %ld", up); 578 553 qDebug(" hwndFrom=%08lX [%s]", hwndFrom, 579 widgetName(widgetFromId(hwndFrom)).constData());554 ).constData()); 580 555 qDebug(" hwndTo=%08lX [%s]", hwndTo, 581 widgetName(widgetFromId(hwndTo)).constData());556 ).constData()); 582 557 #endif 583 558 … … 593 568 #if defined(QT_DEBUGWIDGETMASK) 594 569 qDebug(" sibling=%08lX [fl=%08lX] [%s]", sibling, swp.fl, 595 widgetName(widgetFromId(sibling)).constData());570 ).constData()); 596 571 #endif 597 572 // proceed only if not hidden … … 624 599 #if defined(QT_DEBUGWIDGETMASK) 625 600 qDebug(" sibling=%08lX [fl=%08lX] [%s]", sibling, swp.fl, 626 widgetName(widgetFromId(sibling)).constData());601 ).constData()); 627 602 #endif 628 603 // proceed only if not hidden … … 904 879 "| style = %08lX\n" 905 880 "| fcFlags = %08lX", 906 widgetName(q).constData(), ownerw, title.constData(), fStyle,907 fcFlags);881 , 882 fcFlags); 908 883 #endif 909 884 fId = WinCreateWindow(HWND_DESKTOP, WC_FRAME, title, fStyle, … … 932 907 "| title = '%s'\n" 933 908 "| style = %08lX", 934 widgetName(q).constData(), fId, className.constData(),909 ame(q).constData(), fId, className.constData(), 935 910 title.constData(), style); 936 911 #endif … … 945 920 "| title = '%s'\n" 946 921 "| style = %08lX", 947 widgetName(q).constData(), className.constData(),922 ame(q).constData(), className.constData(), 948 923 title.constData(), style); 949 924 #endif … … 1059 1034 "| title = '%s'\n" 1060 1035 "| style = %08lX", 1061 widgetName(q).constData(), parentw, className.constData(),1036 ame(q).constData(), parentw, className.constData(), 1062 1037 title.constData(), style); 1063 1038 #endif … … 1133 1108 #if defined(QT_DEBUGWINCREATEDESTROY) 1134 1109 qDebug("|Destroying window [%s]:\n" 1135 "| hwnd = %08lX", widgetName(this).constData(), id);1110 "| hwnd = %08lX", ame(this).constData(), id); 1136 1111 #endif 1137 1112 … … 1149 1124 QPoint QWidget::mapToGlobal(const QPoint &pos) const 1150 1125 { 1151 // @todo implement 1152 return QPoint(); 1126 Q_D(const QWidget); 1127 QWidget *parentWindow = window(); 1128 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId()) { 1129 QPoint toGlobal = mapTo(parentWindow, pos) + parentWindow->pos(); 1130 // Adjust for window decorations 1131 toGlobal += parentWindow->geometry().topLeft() - parentWindow->frameGeometry().topLeft(); 1132 return toGlobal; 1133 } 1134 QPoint pos2 = d->mapToWS(pos); 1135 POINTL ptl; 1136 ptl.x = pos2.x(); 1137 // flip y (local) coordinate 1138 ptl.y = height() - (pos2.y() + 1); 1139 WinMapWindowPoints(internalWinId(), HWND_DESKTOP, &ptl, 1); 1140 // flip y (global) coordinate 1141 ptl.y = QApplication::desktop()->height() - (ptl.y + 1); 1142 return QPoint(ptl.x, ptl.y); 1153 1143 } 1154 1144 1155 1145 QPoint QWidget::mapFromGlobal(const QPoint &pos) const 1156 1146 { 1157 // @todo implement 1158 return QPoint(); 1147 Q_D(const QWidget); 1148 QWidget *parentWindow = window(); 1149 if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId()) { 1150 QPoint fromGlobal = mapFrom(parentWindow, pos - parentWindow->pos()); 1151 // Adjust for window decorations 1152 fromGlobal -= parentWindow->geometry().topLeft() - parentWindow->frameGeometry().topLeft(); 1153 return fromGlobal; 1154 } 1155 POINTL ptl; 1156 ptl.x = pos.x(); 1157 // flip y (global) coordinate 1158 ptl.y = QApplication::desktop()->height() - (pos.y() + 1); 1159 WinMapWindowPoints(HWND_DESKTOP, internalWinId(), &ptl, 1); 1160 // flip y (local) coordinate 1161 ptl.y = height() - (ptl.y + 1); 1162 return d->mapFromWS(QPoint(ptl.x, ptl.y)); 1159 1163 } 1160 1164 … … 1513 1517 } 1514 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1515 1576 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.