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

List:       kde-commits
Subject:    [plasma-desktop/andriy/keyboard] kcms/keyboard: stop ibus daemon so it does not mess with our keyboa
From:       Andriy Rysin <arysin () gmail ! com>
Date:       2014-10-06 14:03:40
Message-ID: E1Xb8t2-0007E8-Gp () scm ! kde ! org
[Download RAW message or body]

Git commit d322ea9051c79a5d9a5eb7b48eccba54b80fa944 by Andriy Rysin.
Committed on 06/10/2014 at 13:44.
Pushed by rysin into branch 'andriy/keyboard'.

stop ibus daemon so it does not mess with our keyboard configuration

M  +4    -1    kcms/keyboard/keyboard_daemon.cpp
M  +21   -0    kcms/keyboard/xkb_helper.cpp
M  +1    -0    kcms/keyboard/xkb_helper.h

http://commits.kde.org/plasma-desktop/d322ea9051c79a5d9a5eb7b48eccba54b80fa944

diff --git a/kcms/keyboard/keyboard_daemon.cpp b/kcms/keyboard/keyboard_daemon.cpp
index b78a3d1..3363fc5 100644
--- a/kcms/keyboard/keyboard_daemon.cpp
+++ b/kcms/keyboard/keyboard_daemon.cpp
@@ -93,6 +93,9 @@ void KeyboardDaemon::configureKeyboard()
 	init_keyboard_hardware();
 
 	keyboardConfig.load();
+	if( keyboardConfig.configureLayouts ) {
+        XkbHelper::preInitialize();
+	}
 	XkbHelper::initializeKeyboardLayouts(keyboardConfig);
 	layoutMemory.configChanged();
 
@@ -186,7 +189,7 @@ void KeyboardDaemon::globalSettingsChanged(int category)
 void KeyboardDaemon::layoutChanged()
 {
 	//TODO: pass newLayout into layoutTrayIcon?
-        LayoutUnit newLayout = X11Helper::getCurrentLayout();
+    LayoutUnit newLayout = X11Helper::getCurrentLayout();
 
 	layoutMemory.layoutChanged();
 	if( layoutTrayIcon != NULL ) {
diff --git a/kcms/keyboard/xkb_helper.cpp b/kcms/keyboard/xkb_helper.cpp
index d36ffb0..2ff9e7d 100644
--- a/kcms/keyboard/xkb_helper.cpp
+++ b/kcms/keyboard/xkb_helper.cpp
@@ -181,3 +181,24 @@ bool XkbHelper::initializeKeyboardLayouts(KeyboardConfig& config)
 	}
 	return false;
 }
+
+bool XkbHelper::preInitialize()
+{
+    // stop ibus so it does not mess with our layouts, we can remove this when we integrate IM into keyboard module
+
+    QString ibusExe = QStandardPaths::findExecutable("ibus");
+    if( ibusExe.isEmpty() ) {
+        return 0;
+    }
+
+    KProcess ibusProcess;
+    ibusProcess << ibusExe << "exit";
+    ibusProcess.setOutputChannelMode(KProcess::SeparateChannels);
+    int res = ibusProcess.execute();
+
+    if( res == 0 ) {
+        qWarning() << "ibus successfully stopped";
+    }
+
+    return 0;
+}
diff --git a/kcms/keyboard/xkb_helper.h b/kcms/keyboard/xkb_helper.h
index 5e4f94d..d3dab1d 100644
--- a/kcms/keyboard/xkb_helper.h
+++ b/kcms/keyboard/xkb_helper.h
@@ -30,6 +30,7 @@ public:
 	static bool initializeKeyboardLayouts(KeyboardConfig& config);
 	static bool initializeKeyboardLayouts(const QList<LayoutUnit>& layouts);
 	static bool runConfigLayoutCommand(const QStringList& setxkbmapCommandArguments);
+    static bool preInitialize();
 };
 
 #endif /* XKB_HELPER_H_ */
[prev in list] [next in list] [prev in thread] [next in thread] 

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