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.
24 #include <kapplication.h>
29 XtToolkitInitialize();
30 context
= XtCreateApplicationContext();
31 int argc
= qApp
->argc();
32 XtDisplayInitialize( context
, QX11Info::display(), qAppName().toLatin1(), QX11Info::appClass(),
33 NULL
, 0, &argc
, qApp
->argv());
34 connect( &timer
, SIGNAL( timeout()), SLOT( idleProcess()));
35 kapp
->installX11EventFilter( this );
36 // No way to find out when to process Xt events, so poll :(
44 bool XtEvents::x11Event( XEvent
* e
)
46 return XtDispatchEvent( e
);
49 void XtEvents::idleProcess()
53 XtInputMask mask
= XtAppPending( context
);
54 mask
&= ~XtIMXEvent
; // these are processed in x11Event()
57 // TODO protect from zero timers starving everything
58 XtAppProcessEvent( context
, mask
);
62 #include "xtevents.moc"