[yast-commit] r39773 - in /branches/tmp/sh/qt4-port/qt/src: YQUI.h YQUI_core.cc
Author: sh-sh-sh Date: Mon Jul 30 13:22:42 2007 New Revision: 39773 URL: http://svn.opensuse.org/viewcvs/yast?rev=39773&view=rev Log: fixed event handling Modified: branches/tmp/sh/qt4-port/qt/src/YQUI.h branches/tmp/sh/qt4-port/qt/src/YQUI_core.cc Modified: branches/tmp/sh/qt4-port/qt/src/YQUI.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/qt4-port/qt/src/YQUI.h?rev=39773&r1=39772&r2=39773&view=diff ============================================================================== --- branches/tmp/sh/qt4-port/qt/src/YQUI.h (original) +++ branches/tmp/sh/qt4-port/qt/src/YQUI.h Mon Jul 30 13:22:42 2007 @@ -40,6 +40,7 @@ class Q3WidgetStack; class QCursor; class QEvent; +class QEventLoop; class YEvent; class QY2Settings; class YQPackageSelectorPlugin; @@ -783,6 +784,11 @@ */ bool _do_exit_loop; + /** + * Event loop object. Required since a YaST2 UI needs to react to commands + * from the YCP command stream as well as to X11 / Qt events. + **/ + QEventLoop * _eventLoop; /** * Font family or list of font families to use ("Sans Serif" etc.) Modified: branches/tmp/sh/qt4-port/qt/src/YQUI_core.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/qt4-port/qt/src/YQUI_core.cc?rev=39773&r1=39772&r2=39773&view=diff ============================================================================== --- branches/tmp/sh/qt4-port/qt/src/YQUI_core.cc (original) +++ branches/tmp/sh/qt4-port/qt/src/YQUI_core.cc Mon Jul 30 13:22:42 2007 @@ -60,7 +60,7 @@ , YUI( with_threads ) , _main_win( NULL ) , _main_dialog_id(0) - , _do_exit_loop( false ) + , _eventLoop( 0 ) , _font_family( "Sans Serif" ) , _lang_fonts( 0 ) , _loaded_current_font( false ) @@ -121,6 +121,11 @@ processCommandLineArgs( argc_copy, argv_copy ); calcDefaultSize(); + // Event loop object. Required since a YaST2 UI needs to react to commands + // from the YCP command stream as well as to X11 / Qt events. + _eventLoop = new QEventLoop( this ); + _do_exit_loop = false; + // Create main window for `opt(`defaultsize) dialogs. // @@ -393,14 +398,22 @@ void YQUI::idleLoop( int fd_ycp ) { _leave_idle_loop = false; + const int timeout_millisec = 100; // process Qt events until fd_ycp is readable. QSocketNotifier * notifier = new QSocketNotifier( fd_ycp, QSocketNotifier::Read ); QObject::connect(notifier, SIGNAL( activated( int ) ), this, SLOT( leaveIdleLoop( int ) ) ); notifier->setEnabled( true ); + y2debug( "Entering loop" ); + while ( !_leave_idle_loop ) - qApp->processOneEvent(); + { + // qApp->processOneEvent(); + qApp->processEvents( QEventLoop::AllEvents, timeout_millisec ); + } + + y2debug( "loop done" ); delete notifier; } @@ -419,7 +432,7 @@ _event_handler.sendEvent( event ); if ( _do_exit_loop ) - qApp->exit_loop(); + _eventLoop->exit( 1 ); } } @@ -443,14 +456,18 @@ qApp->focusWidget()->setFocus(); normalCursor(); + + y2debug( "Processing events" ); _do_exit_loop = true; // should exit_loop() be called in sendEvent()? while ( ! pendingEvent() ) { - qApp->enter_loop(); + _eventLoop->exec(); } _do_exit_loop = false; + y2debug( "QApp::processEvents() done" ); + event = _event_handler.consumePendingEvent(); dialog->activate( false ); @@ -562,7 +579,10 @@ } ( (YQDialog *) dialog)->ensureOnlyOneDefaultButton(); + + y2debug( "processing events" ); qApp->processEvents(); + y2debug( "processing events done" ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org