View | Details | Raw Unified | Return to bug 143697
Collapse All | Expand All

(-)kdesktop/startupid.cpp.sav (-4 / +50 lines)
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;
(-)kdesktop/startupid.h.sav (-3 / +5 lines)
Lines 22-28 Link Here
22
22
23
#include <sys/types.h>
23
#include <sys/types.h>
24
24
25
#include <qobject.h>
25
#include <qwidget.h>
26
#include <qpixmap.h>
26
#include <qpixmap.h>
27
#include <qstring.h>
27
#include <qstring.h>
28
#include <qtimer.h>
28
#include <qtimer.h>
Lines 32-45 Link Here
32
class QStyle;
32
class QStyle;
33
33
34
class StartupId
34
class StartupId
35
    : public QObject
35
    : public QWidget
36
    {
36
    {
37
    Q_OBJECT
37
    Q_OBJECT
38
    public:
38
    public:
39
        StartupId( QObject* parent = 0, const char* name = 0 );
39
        StartupId( QWidget* parent = 0, const char* name = 0 );
40
        virtual ~StartupId();
40
        virtual ~StartupId();
41
        void configure();
41
        void configure();
42
    protected:
42
    protected:
43
        virtual bool x11Event( XEvent* e );
43
        void start_startupid( const QString& icon );
44
        void start_startupid( const QString& icon );
44
        void stop_startupid();
45
        void stop_startupid();
45
    protected slots:
46
    protected slots:
Lines 47-52 class StartupId Link Here
47
        void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
48
        void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
48
        void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
49
        void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
49
        void gotRemoveStartup( const KStartupInfoId& id );
50
        void gotRemoveStartup( const KStartupInfoId& id );
51
        void finishKDEStartup();
50
    protected:
52
    protected:
51
        KStartupInfo startup_info;
53
        KStartupInfo startup_info;
52
        QWidget* startup_widget;
54
        QWidget* startup_widget;

Return to bug 143697