1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-23 20:51:43 +00:00
freebsd-ports/x11-toolkits/qt32/files/qapplication.cpp.diff
Alan Eldridge d1662ca0ad Repocopy from qt30. Modified to current status.
NOT TO BE USED AS A DEPENDENCY UNTIL AFTER 5.0 RELEASE!!!!
2003-01-06 15:05:36 +00:00

75 lines
2.0 KiB
Diff

===================================================================
RCS file: /home2/webcvs/mirror/qt-copy/src/kernel/qapplication.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -p -r1.61 -r1.62
--- qt-copy/src/kernel/qapplication.cpp 2002/11/13 16:46:34 1.61
+++ qt-copy/src/kernel/qapplication.cpp 2002/11/14 08:57:34 1.62
@@ -3257,6 +3257,66 @@ Q_EXPORT void qt_dispatchEnterLeave( QWi
}
+#ifdef Q_WS_MACX
+extern QWidget *qt_tryModalHelperMac( QWidget * top ); //qapplication_mac.cpp
+#endif
+
+
+/*!\internal
+
+ Called from qapplication_<platform>.cpp, returns TRUE
+ if the widget should accept the event.
+ */
+bool qt_tryModalHelper( QWidget *widget, QWidget **rettop ) {
+ QWidget *modal=0, *top=QApplication::activeModalWidget();
+ if ( rettop ) *rettop = top;
+
+ if ( qApp->activePopupWidget() )
+ return TRUE;
+
+#ifdef Q_WS_MACX
+ top = qt_tryModalHelperMac( top );
+ if ( rettop ) *rettop = top;
+#endif
+
+ QWidget* groupLeader = widget;
+ widget = widget->topLevelWidget();
+
+ if ( widget->testWFlags(Qt::WShowModal) ) // widget is modal
+ modal = widget;
+ if ( !top || modal == top ) // don't block event
+ return TRUE;
+
+ QWidget * p = widget->parentWidget(); // Check if the active modal widget is a parent of our widget
+ while ( p ) {
+ if ( p == top )
+ return TRUE;
+ p = p->parentWidget();
+ }
+
+ while ( groupLeader && !groupLeader->testWFlags( Qt::WGroupLeader ) )
+ groupLeader = groupLeader->parentWidget();
+
+ if ( groupLeader ) {
+ // Does groupLeader have a child in qt_modal_stack?
+ bool unrelated = TRUE;
+ modal = qt_modal_stack->first();
+ while (modal && unrelated) {
+ QWidget* p = modal->parentWidget();
+ while ( p && p != groupLeader && !p->testWFlags( Qt::WGroupLeader) ) {
+ p = p->parentWidget();
+ }
+ modal = qt_modal_stack->next();
+ if ( p == groupLeader ) unrelated = FALSE;
+ }
+
+ if ( unrelated )
+ return TRUE; // don't block event
+ }
+ return FALSE;
+}
+
+
/*!
Returns the desktop widget (also called the root window).