|
Lines 22-40
Link Here
|
| 22 |
|
22 |
|
| 23 |
#include <kiconloader.h> |
23 |
#include <kiconloader.h> |
| 24 |
#include <qcursor.h> |
24 |
#include <qcursor.h> |
| 25 |
#include <qapplication.h> |
25 |
#include <kapplication.h> |
| 26 |
#include <qimage.h> |
26 |
#include <qimage.h> |
| 27 |
#include <qbitmap.h> |
27 |
#include <qbitmap.h> |
| 28 |
#include <kconfig.h> |
28 |
#include <kconfig.h> |
| 29 |
#include <X11/Xlib.h> |
29 |
#include <X11/Xlib.h> |
| 30 |
|
30 |
|
| 31 |
StartupId::StartupId( QObject* parent, const char* name ) |
31 |
#define KDE_STARTUP_ICON "kmenu" |
| 32 |
: QObject( parent, name ), |
32 |
|
|
|
33 |
enum kde_startup_status_enum { StartupPre, StartupIn, StartupDone }; |
| 34 |
static kde_startup_status_enum kde_startup_status = StartupPre; |
| 35 |
static Atom kde_splash_progress; |
| 36 |
|
| 37 |
StartupId::StartupId( QWidget* parent, const char* name ) |
| 38 |
: QWidget( parent, name ), |
| 33 |
startup_info( KStartupInfo::CleanOnCantDetect ), |
39 |
startup_info( KStartupInfo::CleanOnCantDetect ), |
| 34 |
startup_widget( NULL ), |
40 |
startup_widget( NULL ), |
| 35 |
blinking( true ), |
41 |
blinking( true ), |
| 36 |
bouncing( false ) |
42 |
bouncing( false ) |
| 37 |
{ |
43 |
{ |
|
|
44 |
hide(); // is QWidget only because of x11Event() |
| 45 |
if( kde_startup_status == StartupPre ) |
| 46 |
{ |
| 47 |
kde_splash_progress = XInternAtom( qt_xdisplay(), "_KDE_SPLASH_PROGRESS", False ); |
| 48 |
XWindowAttributes attrs; |
| 49 |
XGetWindowAttributes( qt_xdisplay(), qt_xrootwin(), &attrs); |
| 50 |
XSelectInput( qt_xdisplay(), qt_xrootwin(), attrs.your_event_mask | SubstructureNotifyMask); |
| 51 |
kapp->installX11EventFilter( this ); |
| 52 |
} |
| 38 |
connect( &update_timer, SIGNAL( timeout()), SLOT( update_startupid())); |
53 |
connect( &update_timer, SIGNAL( timeout()), SLOT( update_startupid())); |
| 39 |
connect( &startup_info, |
54 |
connect( &startup_info, |
| 40 |
SIGNAL( gotNewStartup( const KStartupInfoId&, const KStartupInfoData& )), |
55 |
SIGNAL( gotNewStartup( const KStartupInfoId&, const KStartupInfoData& )), |
|
Lines 85-98
void StartupId::gotRemoveStartup( const
Link Here
|
| 85 |
startups.remove( id_P ); |
100 |
startups.remove( id_P ); |
| 86 |
if( startups.count() == 0 ) |
101 |
if( startups.count() == 0 ) |
| 87 |
{ |
102 |
{ |
| 88 |
stop_startupid(); |
|
|
| 89 |
current_startup = KStartupInfoId(); // null |
103 |
current_startup = KStartupInfoId(); // null |
|
|
104 |
if( kde_startup_status == StartupIn ) |
| 105 |
start_startupid( KDE_STARTUP_ICON ); |
| 106 |
else |
| 107 |
stop_startupid(); |
| 90 |
return; |
108 |
return; |
| 91 |
} |
109 |
} |
| 92 |
current_startup = startups.begin().key(); |
110 |
current_startup = startups.begin().key(); |
| 93 |
start_startupid( startups[ current_startup ] ); |
111 |
start_startupid( startups[ current_startup ] ); |
| 94 |
} |
112 |
} |
| 95 |
|
113 |
|
|
|
114 |
bool StartupId::x11Event( XEvent* e ) |
| 115 |
{ |
| 116 |
if( e->type == ClientMessage && e->xclient.window == qt_xrootwin() |
| 117 |
&& e->xclient.message_type == kde_splash_progress ) |
| 118 |
{ |
| 119 |
const char* s = e->xclient.data.b; |
| 120 |
if( strcmp( s, "kicker" ) == 0 && kde_startup_status == StartupPre ) |
| 121 |
{ |
| 122 |
kde_startup_status = StartupIn; |
| 123 |
if( startups.count() == 0 ) |
| 124 |
start_startupid( KDE_STARTUP_ICON ); |
| 125 |
// 60(?) sec timeout - shouldn't be hopefully needed anyway, ksmserver should have it too |
| 126 |
QTimer::singleShot( 60000, this, SLOT( finishKDEStartup())); |
| 127 |
} |
| 128 |
else if( strcmp( s, "session ready" ) == 0 && kde_startup_status < StartupDone ) |
| 129 |
QTimer::singleShot( 2000, this, SLOT( finishKDEStartup())); |
| 130 |
} |
| 131 |
return false; |
| 132 |
} |
| 133 |
|
| 134 |
void StartupId::finishKDEStartup() |
| 135 |
{ |
| 136 |
kde_startup_status = StartupDone; |
| 137 |
kapp->removeX11EventFilter( this ); |
| 138 |
if( startups.count() == 0 ) |
| 139 |
stop_startupid(); |
| 140 |
} |
| 141 |
|
| 96 |
void StartupId::stop_startupid() |
142 |
void StartupId::stop_startupid() |
| 97 |
{ |
143 |
{ |
| 98 |
delete startup_widget; |
144 |
delete startup_widget; |