[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/krunner
From:       Martin Gräßlin <kde () martin-graesslin ! com>
Date:       2010-10-16 8:57:02
Message-ID: 20101016085702.67702AC896 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1186410 by graesslin:

Interact with KWin startup feedback effect.

The kwin effect registers a manager selection when it is responsible
for the startup feedback. KRunner will not activate its startup feedback
when the selection is claimed.
See also svn rev 1186408 and review request http://reviewboard.kde.org/r/5529/



 M  +23 -1     startupid.cpp  
 M  +5 -0      startupid.h  


--- trunk/KDE/kdebase/workspace/krunner/startupid.cpp #1186409:1186410
@@ -1,5 +1,6 @@
 /* This file is part of the KDE project
    Copyright (C) 2001 Lubos Lunak <l.lunak@kde.org>
+   Copyright (C) 2010 Martin Gräßlin <kde@martin-graesslin.com>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -24,6 +25,7 @@
 #include "klaunchsettings.h"
 
 #include <kiconloader.h>
+#include <kmanagerselection.h>
 #include <QCursor>
 #include <kapplication.h>
 #include <QImage>
@@ -53,7 +55,8 @@
         startup_info( KStartupInfo::CleanOnCantDetect ),
         startup_window( None ),
         blinking( true ),
-        bouncing( false )
+        bouncing( false ),
+        selection_watcher( new KSelectionWatcher( "_KDE_STARTUP_FEEDBACK", -1, this ))
     {
         setObjectName( QLatin1String( name ) );
     hide(); // is QWidget only because of x11Event()
@@ -76,6 +79,9 @@
     connect( &startup_info,
         SIGNAL( gotRemoveStartup( const KStartupInfoId&, const KStartupInfoData& )),
         SLOT( gotRemoveStartup( const KStartupInfoId& )));
+    connect( selection_watcher, SIGNAL(newOwner(Window)), SLOT(newOwner()));
+    connect( selection_watcher, SIGNAL(lostOwner()), SLOT(lostOwner()));
+    active_selection = ( selection_watcher->owner() != None );
     }
 
 StartupId::~StartupId()
@@ -92,6 +98,8 @@
 
 void StartupId::gotNewStartup( const KStartupInfoId& id_P, const KStartupInfoData& data_P )
     {
+    if( active_selection )
+        return;
     QString icon = data_P.findIcon();
     current_startup = id_P;
     startups[ id_P ] = icon;
@@ -100,6 +108,8 @@
 
 void StartupId::gotStartupChange( const KStartupInfoId& id_P, const KStartupInfoData& data_P )
     {
+    if( active_selection )
+        return;
     if( current_startup == id_P )
         {
         QString icon = data_P.findIcon();
@@ -113,6 +123,8 @@
 
 void StartupId::gotRemoveStartup( const KStartupInfoId& id_P )
     {
+    if( active_selection )
+        return;
     startups.remove( id_P );
     if( startups.count() == 0 )
         {
@@ -340,4 +352,14 @@
     QApplication::flush();
     }
 
+void StartupId::newOwner()
+    {
+    active_selection = true;
+    }
+
+void StartupId::lostOwner()
+    {
+    active_selection = false;
+    }
+
 #include "startupid.moc"
--- trunk/KDE/kdebase/workspace/krunner/startupid.h #1186409:1186410
@@ -29,6 +29,7 @@
 #include <QMap>
 #include <kstartupinfo.h>
 
+class KSelectionWatcher;
 
 class StartupId
     : public QWidget
@@ -48,6 +49,8 @@
         void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
         void gotRemoveStartup( const KStartupInfoId& id );
         void finishKDEStartup();
+        void newOwner();
+        void lostOwner();
     protected:
         KStartupInfo startup_info;
         WId startup_window;
@@ -60,6 +63,8 @@
         unsigned int frame;
         enum { NUM_BLINKING_PIXMAPS = 5 };
         QPixmap pixmaps[ NUM_BLINKING_PIXMAPS ];
+        KSelectionWatcher* selection_watcher;
+        bool active_selection;
     };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic