diff options
author | Michele Calgaro <[email protected]> | 2024-09-19 17:48:43 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2024-09-20 20:06:45 +0900 |
commit | 94368f4722fa8eae1f7e7cd4b02679a760b0d620 (patch) | |
tree | 4fdf1f3f6250211c2ab47dc568e299ea4e139c3c /khotkeys/app/kded.cpp | |
parent | 7f1a1e931e73b53939ca39faca82c80cf5da5cf4 (diff) | |
download | tdebase-94368f4722fa8eae1f7e7cd4b02679a760b0d620.tar.gz tdebase-94368f4722fa8eae1f7e7cd4b02679a760b0d620.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 <[email protected]>
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(); } |