diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-09-19 17:48:43 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-09-20 22:43:03 +0900 |
| commit | ba58d6adacea8a968620c708cabbce7a0857c91e (patch) | |
| tree | 04220baf1d3a60482d7cf329e4cae7f51520ea50 /khotkeys/app/kded.cpp | |
| parent | 77134aead8562da8b7a58ffe58af65e5c4cafb7a (diff) | |
| download | tdebase-ba58d6ad.tar.gz tdebase-ba58d6ad.zip | |
Various fixes for khotkeys. This resolves issue #326.
1. ensure there is a single khotkeys instance running per session
instead of per screen (remote multihead related code)
2. allow khotkeys to be run as a kded module
3. make sure that khotkeys run either as a standalone application or as
a kded module, but not both at the same time
4. do not register khotkeys as a main DCOP entry (like an app) anymore.
When run as kded module, this was causing kded to be registered as
khotkeys a second time.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 94368f4722fa8eae1f7e7cd4b02679a760b0d620)
Diffstat (limited to 'khotkeys/app/kded.cpp')
| -rw-r--r-- | khotkeys/app/kded.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/khotkeys/app/kded.cpp b/khotkeys/app/kded.cpp index db4153e01..c78504919 100644 --- a/khotkeys/app/kded.cpp +++ b/khotkeys/app/kded.cpp @@ -16,6 +16,7 @@ #include "kded.h" +#include <dcopclient.h> #include <tdecmdlineargs.h> #include <tdeconfig.h> #include <tdelocale.h> @@ -35,9 +36,17 @@ extern "C" TDE_EXPORT KDEDModule *create_khotkeys( const TQCString& obj ) - { - return new KHotKeys::KHotKeysModule( obj ); - } +{ + // Check if khotkeys is already running as a stand alone application. + // In such case just exit. + if (kapp->dcopClient()->isApplicationRegistered("khotkeys")) + { + kdWarning(1217) << "khotkeys [kded module] is already running as a standalone application. Exiting." << endl; + return nullptr; + } + + return new KHotKeys::KHotKeysModule( obj ); +} namespace KHotKeys { @@ -47,22 +56,7 @@ namespace KHotKeys KHotKeysModule::KHotKeysModule( const TQCString& obj ) : KDEDModule( obj ) { - for( int i = 0; - i < 5; - ++i ) - { - if( kapp->dcopClient()->isApplicationRegistered( "khotkeys" )) - { - TQByteArray data, replyData; - TQCString reply; - // wait for it to finish - kapp->dcopClient()->call( "khotkeys*", "khotkeys", "quit()", data, reply, replyData ); - sleep( 1 ); - } - } - client.registerAs( "khotkeys", false ); // extra dcop connection (like if it was an app) init_global_data( true, this ); // grab keys - // CHECKME triggery a dalsi vytvaret az tady za inicializaci actions_root = NULL; reread_configuration(); } |
