2 Copyright (c) 2007 Lubos Lunak <l.lunak@suse.cz>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "glibevents.h"
24 #include <QApplication>
26 GlibEvents::GlibEvents()
28 g_main_context_ref( g_main_context_default());
29 connect( &timer
, SIGNAL( timeout()), SLOT( process()));
34 GlibEvents::~GlibEvents()
36 g_main_context_unref( g_main_context_default());
39 void GlibEvents::process()
41 if( g_main_depth() > 0 )
42 return; // avoid reentrancy when Qt's Glib integration is used
43 while( g_main_context_pending( g_main_context_default()))
44 g_main_context_iteration( g_main_context_default(), false );
47 #include "glibevents.moc"