From kde-commits Tue Apr 15 13:31:29 2014 From: =?utf-8?q?=C3=80lex_Fiestas?= Date: Tue, 15 Apr 2014 13:31:29 +0000 To: kde-commits Subject: [plasma-desktop] /: [kcm/keyboard] Port X11Helper::setGroup to xcb. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=139756870023418 Git commit d5a61432ca84b7babca8b190d2590072b6705977 by =C3=80lex Fiestas. Committed on 15/04/2014 at 13:24. Pushed by afiestas into branch 'master'. [kcm/keyboard] Port X11Helper::setGroup to xcb. The X11 version of it had some delay flushing the request which make the experience suck and since this code is async (we expect the event after the request) it was making it look like it did not work. Porting the code to xcb fixed it. M +1 -1 CMakeLists.txt M +6 -0 kcms/keyboard/CMakeLists.txt M +21 -2 kcms/keyboard/x11_helper.cpp http://commits.kde.org/plasma-desktop/d5a61432ca84b7babca8b190d2590072b6705= 977 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e30263..8018e70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ set_package_properties(X11 PROPERTIES DESCRIPTION "X11 li= braries" PURPOSE "Required for building the X11 based works= pace" ) if(X11_FOUND) - find_package(XCB REQUIRED COMPONENTS XCB XFIXES DAMAGE COMPOSITE SHAPE S= YNC RENDER RANDR KEYSYMS IMAGE SHM XTEST) + find_package(XCB REQUIRED COMPONENTS XCB XFIXES DAMAGE COMPOSITE SHAPE S= YNC RENDER RANDR KEYSYMS IMAGE SHM XTEST XKB) set_package_properties(XCB PROPERTIES TYPE REQUIRED) find_package(XCB COMPONENTS ICCCM) add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test= applications for KWin") diff --git a/kcms/keyboard/CMakeLists.txt b/kcms/keyboard/CMakeLists.txt index de382c5..478bace 100644 --- a/kcms/keyboard/CMakeLists.txt +++ b/kcms/keyboard/CMakeLists.txt @@ -48,6 +48,8 @@ target_link_libraries(kded_keyboard KF5::Plasma KF5::XmlGui KF5::KDE4Support + XCB::XCB + XCB::XKB ${X11_LIBRARIES} ${X11_Xkbfile_LIB} ) @@ -106,6 +108,8 @@ target_link_libraries(keyboard_layout_widget KF5::I18n KF5::Service KF5::Plasma + XCB::XCB + XCB::XKB KF5::KDE4Support ${X11_LIBRARIES} ${X11_Xkbfile_LIB} @@ -157,6 +161,8 @@ target_link_libraries(kcm_keyboard KF5::WindowSystem KF5::Plasma KF5::XmlGui + XCB::XCB + XCB::XKB KF5::KDE4Support ${X11_Xkbfile_LIB} ${X11_LIBRARIES} diff --git a/kcms/keyboard/x11_helper.cpp b/kcms/keyboard/x11_helper.cpp index de9f768..7790902 100644 --- a/kcms/keyboard/x11_helper.cpp +++ b/kcms/keyboard/x11_helper.cpp @@ -18,6 +18,10 @@ = #include "x11_helper.h" = +#define explicit explicit_is_keyword_in_cpp +#include +#undef explicit + #include = #include @@ -29,7 +33,6 @@ #include #include #include -//#include #include = = @@ -191,7 +194,23 @@ QList X11Helper::getLayoutsList() = bool X11Helper::setGroup(unsigned int group) { - return XkbLockGroup(QX11Info::display(), XkbUseCoreKbd, group); + qDebug() << group; + xcb_void_cookie_t cookie; + cookie =3D xcb_xkb_latch_lock_state(QX11Info::connection(), + XCB_XKB_ID_USE_CORE_KBD, + 0, 0, + 1, + group, + 0, 0, 0 + ); + xcb_generic_error_t *error =3D nullptr; + error =3D xcb_request_check(QX11Info::connection(), cookie); + if (error) { + qDebug() << "Couldn't change the group" << error->error_code; + return false; + } + + return true; } = unsigned int X11Helper::getGroup()