- Timestamp:
- Aug 3, 2009, 11:30:38 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/kernel/qeventdispatcher_pm.cpp
r89 r98 1325 1325 } 1326 1326 1327 void QEventDispatcherPM::createMsgQueue() 1328 { 1329 Q_D(QEventDispatcherPM); 1330 if (d->hmq == NULLHANDLE) 1331 d->createMsgQueue(); 1332 } 1333 1327 1334 QT_END_NAMESPACE -
trunk/src/corelib/kernel/qeventdispatcher_pm_p.h
r89 r98 90 90 void startingUp(); 91 91 void closingDown(); 92 93 void createMsgQueue(); 92 94 }; 93 95 -
trunk/src/gui/kernel/qapplication_pm.cpp
r95 r98 53 53 54 54 #include "qset.h" 55 56 #include "private/qeventdispatcher_pm_p.h" 55 57 56 58 #include "qwidget_p.h" … … 270 272 *****************************************************************************/ 271 273 274 struct QPMConfigRequest { 275 WId id; // widget to be configured 276 int req; // 0=move, 1=resize, 2=setGeo 277 int x, y, w, h; // request parameters 278 }; 279 280 Q_GLOBAL_STATIC(QList<QPMConfigRequest*>, configRequests); 281 282 void qPMRequestConfig(WId id, int req, int x, int y, int w, int h) 283 { 284 QPMConfigRequest *r = new QPMConfigRequest; 285 r->id = id; 286 r->req = req; 287 r->x = x; 288 r->y = y; 289 r->w = w; 290 r->h = h; 291 configRequests()->append(r); 292 } 293 272 294 /***************************************************************************** 273 295 GUI event dispatcher 274 296 *****************************************************************************/ 275 297 298 class QGuiEventDispatcherPM : public QEventDispatcherPM 299 { 300 Q_DECLARE_PRIVATE(QEventDispatcherPM) 301 public: 302 QGuiEventDispatcherPM(QObject *parent = 0); 303 bool processEvents(QEventLoop::ProcessEventsFlags flags); 304 }; 305 306 QGuiEventDispatcherPM::QGuiEventDispatcherPM(QObject *parent) 307 : QEventDispatcherPM(parent) 308 { 309 // pre-create the message queue early as we'll need it anyway in GUI mode 310 createMsgQueue(); 311 } 312 313 bool QGuiEventDispatcherPM::processEvents(QEventLoop::ProcessEventsFlags flags) 314 { 315 if (!QEventDispatcherPM::processEvents(flags)) 316 return false; 317 318 QPMConfigRequest *r; 319 for (;;) { 320 if (configRequests()->isEmpty()) 321 break; 322 r = configRequests()->takeLast(); 323 QWidget *w = QWidget::find(r->id); 324 QRect rect(r->x, r->y, r->w, r->h); 325 int req = r->req; 326 delete r; 327 328 if (w) { // widget exists 329 if (w->testAttribute(Qt::WA_WState_ConfigPending)) 330 break; // biting our tail 331 if (req == 0) 332 w->move(rect.topLeft()); 333 else if (req == 1) 334 w->resize(rect.size()); 335 else 336 w->setGeometry(rect); 337 } 338 } 339 340 return true; 341 } 342 276 343 void QApplicationPrivate::createEventDispatcher() 277 344 { 278 // @todo implement 345 Q_Q(QApplication); 346 if (q->type() != QApplication::Tty) 347 eventDispatcher = new QGuiEventDispatcherPM(q); 348 else 349 eventDispatcher = new QEventDispatcherPM(q); 279 350 } 280 351
Note:
See TracChangeset
for help on using the changeset viewer.