- Timestamp:
- Aug 20, 2011, 8:26:35 PM (14 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qwidget_pm.cpp
r1008 r1013 231 231 232 232 /*! 233 \internal 234 235 Helper function to collect all relative windows intersecting with the given 236 \a hwnd and placed above it in z-order. The area of interest is limited to 237 the \a prcl rectangle (in window coordinates) which may be NULL to indicate 238 the whole window. If \a hrgn is not NULL, all found obstacles are combined 239 with the given region using the \a op operation (CRGN_*); otherwise they are 233 \enum PWOFlags 234 \relates QWidget 235 236 Flags for qt_WinProcessWindowObstacles() that define which relative windows 237 to process. 238 239 \warning This enum is only available on OS/2. 240 241 \value PWO_Children Child windows. 242 \value PWO_Siblings Sibling windows. 243 \value PWO_Ancestors Siblings of the parent window and all ancestors. 244 \value PWO_Screen Screen area. 245 \value PWO_TopLevel All top level windows. 246 \value PWO_Default Default value suitable for most paint operations 247 (equivalent to specifying all flags except PWO_TopLevel). 248 */ 249 250 /*! 251 \fn LONG qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, HRGN hrgn, 252 LONG op, LONG flags) 253 \relates QWidget 254 255 Collects all relative PM windows intersecting with the given \a hwnd and 256 placed above it in Z-order. The area of interest is limited to the \a prcl 257 rectangle (in window coordinates) which may be \c NULL to indicate the whole 258 window. If \a hrgn is not \c NULL, all found obstacles are combined with 259 the given region using the \a op operation (\c CRGN_*); otherwise they are 240 260 directly validated on the window. The scope of relativeness is defined by 241 the \a flags argument which is one or more PWO _* flags OR-ed together.261 the \a flags argument which is one or more PWOFlags OR-ed together. 242 262 243 263 Returns the complexity of the combined region (only when \a hrgn is not 244 NULL). Note that if no combining occurs (e.g. no relatives in the requested 245 scope), the return value is RGN_NULL regardless of the original complexity 246 of \a hrgn. 264 \c NULL). Note that if no combining occurs (e.g. no relatives in the 265 requested scope), the return value is \c RGN_NULL regardless of the original 266 complexity of \a hrgn. 267 268 This function is especially useful for 3rd-party applications that embed 269 themselves into a Qt application by painting directly on a PM window of a Qt 270 widget (that gets created when QWidget::winId() is called), bypassing Qt 271 completely. An example of such an application would be a video player that 272 renders and paints frames in an external non-Qt thread or process. 273 274 Qt does not use the \c WS_CLIPSIBLINGS and \c WS_CLIPCHILDREN flags when 275 creating PM windows for non-top-level widgets (because that would break 276 support for non-rectangular widgets due to a bug in PM) and this function 277 acts as a functional replacement for these flags. Any application that 278 paints on the PM window of the Qt widget directy must call 279 qt_WinProcessWindowObstacles() to correctly clip out portions of the widget 280 covered by other widgets placed above it in Z-order and avoid unexpected 281 painting over these widgets. 282 283 \snippet doc/src/snippets/code/src_gui_painting_embedded_pm.cpp 0 284 285 \warning This function is only available on OS/2. 247 286 */ 248 LONG qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, HRGN hrgn,249 LONG op, LONG flags)287 LONG APIENTRY qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, HRGN hrgn, 288 LONG op, LONG flags) 250 289 { 251 290 Q_ASSERT(hwnd); 291 292 if (flags == 0) 293 flags = PWO_Children | PWO_Siblings | PWO_Ancestors | PWO_Screen; 252 294 253 295 HPS displayPS = qt_display_ps(); … … 345 387 // but only if they are not top-level windows (that cannot be 346 388 // non-rectangular and thus are always correctly clipped by the system) 347 if ((flags & PWO_Sib ings) && parent != desktop) {389 if ((flags & PWO_Siblings) && parent != desktop) { 348 390 for (relative = swpSelf.hwndInsertBehind; 349 391 relative != HWND_TOP; relative = swp.hwndInsertBehind) { … … 698 740 HRGN hrgnObst = GpiCreateRegion(hps, 0, NULL); 699 741 qt_WinProcessWindowObstacles(hwnd, &rclAff, hrgnObst, CRGN_OR, 700 PWO_Sib ings | PWO_Ancestors |742 PWO_Siblings | PWO_Ancestors | 701 743 PWO_Screen | PWO_TopLevel); 702 744 // shift region of obstacles and affected region back to … … 1142 1184 #if defined(QT_DEBUGWINCREATEDESTROY) 1143 1185 qDebug() << "|Creating top level window (frame)" << q 1144 << "\n| owner" << qDebug FmtHex(ownerw)1186 << "\n| owner" << qDebugHWND(ownerw) 1145 1187 << "\n| title" << title 1146 1188 << "\n| style" << qDebugFmtHex(fStyle) … … 1191 1233 #if defined(QT_DEBUGWINCREATEDESTROY) 1192 1234 qDebug() << "|Creating top level window (client)" << q 1193 << "\n| owner & parent" << qDebug FmtHex(fId)1235 << "\n| owner & parent" << qDebugHWND(fId) 1194 1236 << "\n| class" << className 1195 1237 << "\n| title" << title … … 1325 1367 #if defined(QT_DEBUGWINCREATEDESTROY) 1326 1368 qDebug() << "|Creating child window" << q 1327 << " /n| owner & parent" << qDebugFmtHex(parentw)1328 << " /n| class" << className1329 << " /n| title" << title1330 << " /n| style" << qDebugFmtHex(style);1369 << "\n| owner & parent" << qDebugHWND(parentw) 1370 << "\n| class" << className 1371 << "\n| title" << title 1372 << "\n| style" << qDebugFmtHex(style); 1331 1373 #endif 1332 1374 id = WinCreateWindow(parentw, className, title, style, … … 1395 1437 qDebug() << "|Destroying window" << this 1396 1438 << "\n| hwnd" << qDebugFmtHex(id); 1397 if (id != winId())1398 qDebug() << " (frame) \n| hwnd" << qDebugFmtHex(winId()) << "(client)";1439 if (id != internalWinId()) 1440 qDebug() << "| hwnd" << qDebugFmtHex(internalWinId()) << "(client)"; 1399 1441 #endif 1400 1442 qt_WinDestroyWindow(id); … … 1472 1514 if (old_fid != NULLHANDLE && q->windowType() != Qt::Desktop) { 1473 1515 // destroy HWND 1516 #if defined(QT_DEBUGWINCREATEDESTROY) 1517 qDebug() << "|Destroying window" << q 1518 << "\n| hwnd" << qDebugFmtHex(old_fid); 1519 if (old_fid != data.winid) 1520 qDebug() << "| hwnd" << qDebugFmtHex(data.winid) << "(client)"; 1521 #endif 1474 1522 qt_WinDestroyWindow(old_fid); 1475 1523 } … … 2519 2567 if (updateRcl.xLeft != updateRcl.xRight && 2520 2568 updateRcl.yBottom != updateRcl.yTop) { 2521 qt_WinProcessWindowObstacles(data.winid, &updateRcl, 0, 0 );2569 qt_WinProcessWindowObstacles(data.winid, &updateRcl, 0, 0, PWO_Default); 2522 2570 } 2523 2571 } -
trunk/src/gui/kernel/qwindowdefs_pm.h
r1006 r1013 76 76 #define NULLHANDLE ((LHANDLE)0) 77 77 78 #define APIENTRY _System 79 78 80 // constants to address extra window data (nothing so far) 79 81 #define QT_EXTRAWINDATASIZE (sizeof(LONG) * 0) … … 90 92 Q_GUI_EXPORT QWidget *qt_widget_from_hwnd(HWND hwnd); 91 93 92 /** \internal flags for qt_WinProcessWindowObstacles() */ 93 enum { 94 enum PWOFlags { 94 95 PWO_Children = 0x01, 95 PWO_Sib ings = 0x02,96 PWO_Siblings = 0x02, 96 97 PWO_Ancestors = 0x04, 97 98 PWO_Screen = 0x08, 98 99 PWO_TopLevel = 0x80000000, 99 // PWO_Default is suitable in most cases (for simple paint operations) 100 PWO_Default = PWO_Children | PWO_Sibings | PWO_Ancestors | PWO_Screen, 100 PWO_Default = 0 /*PWO_Children | PWO_Siblings | PWO_Ancestors | PWO_Screen*/, 101 101 }; 102 102 103 Q_GUI_EXPORT LONG qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, HRGN hrgn, 104 LONG op, LONG flags = PWO_Default); 103 #ifdef Q_QDOC 104 LONG qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, HRGN hrgn, 105 LONG op, LONG flags); 106 #else 107 Q_GUI_EXPORT LONG APIENTRY qt_WinProcessWindowObstacles(HWND hwnd, RECTL *prcl, 108 HRGN hrgn, LONG op, 109 LONG flags); 110 #endif 105 111 106 112 // QDebug helpers for debugging various API types
Note:
See TracChangeset
for help on using the changeset viewer.