From ce28748ced4ed6778a730a9ca638c2d557dbc026 Mon Sep 17 00:00:00 2001 From: planc Date: Tue, 8 Mar 2022 15:15:25 +0800 Subject: FindX11: add xcb-xtest and xcb-keysyms --- Modules/FindX11.cmake | 34 +++++++++++++++++++++++++++++++++- Tests/FindX11/Test/CMakeLists.txt | 2 ++ Tests/FindX11/Test/main.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 5a9d2a0..8e5a5f1 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -34,6 +34,8 @@ and also the following more fine grained variables and targets: X11_xcb_randr_INCLUDE_PATH, X11_xcb_randr_LIB, X11_xcb_randr_FOUND, X11::xcb_randr X11_xcb_util_INCLUDE_PATH, X11_xcb_util_LIB, X11_xcb_util_FOUND, X11::xcb_util X11_xcb_xfixes_INCLUDE_PATH, X11_xcb_xfixes_LIB, X11_xcb_xfixes_FOUND, X11::xcb_xfixes + X11_xcb_xtest_INCLUDE_PATH, X11_xcb_xtest_LIB, X11_xcb_xtest_FOUND, X11::xcb_xtest + X11_xcb_keysyms_INCLUDE_PATH, X11_xcb_keysyms_LIB,X11_xcb_keysyms_FOUND,X11::xcb_keysyms X11_xcb_xkb_INCLUDE_PATH, X11_xcb_xkb_LIB, X11_xcb_xkb_FOUND, X11::xcb_xkb X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor @@ -84,7 +86,7 @@ and also the following more fine grained variables and targets: Added the ``Xaw``, ``xcb_util``, and ``xcb_xfixes`` libraries. .. versionadded:: 3.24 - Added the ``xcb_randr`` library. + Added the ``xcb_randr``, ``xcb_xtext``, and ``xcb_keysyms`` libraries. #]=======================================================================] @@ -134,6 +136,8 @@ if (UNIX) find_path(X11_xcb_randr_INCLUDE_PATH xcb/randr.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_util_INCLUDE_PATH xcb/xcb_aux.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_xfixes_INCLUDE_PATH xcb/xfixes.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xtest_INCLUDE_PATH xcb/xtest.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_keysyms_INCLUDE_PATH xcb/xcb_keysyms.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) @@ -188,6 +192,8 @@ if (UNIX) find_library(X11_xcb_randr_LIB xcb-randr ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_util_LIB xcb-util ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_xfixes_LIB xcb-xfixes ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xtest_LIB xcb-xtest ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_keysyms_LIB xcb-keysyms ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_xkb_LIB xcb-xkb ${X11_LIB_SEARCH_PATH}) find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) @@ -299,6 +305,14 @@ if (UNIX) set(X11_xcb_xfixes_FOUND TRUE) endif () + if (X11_xcb_xtest_LIB) + set(X11_xcb_xtest_FOUND TRUE) + endif () + + if (X11_xcb_keysyms_LIB) + set(X11_xcb_keysyms_FOUND TRUE) + endif () + if (X11_xcb_xkb_LIB) set(X11_xcb_xkb_FOUND TRUE) endif () @@ -631,6 +645,20 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_xtest_FOUND AND NOT TARGET X11::xcb_xtest) + add_library(X11::xcb_xtest UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xtest PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xtest_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_keysyms_FOUND AND NOT TARGET X11::xcb_keysyms) + add_library(X11::xcb_keysyms UNKNOWN IMPORTED) + set_target_properties(X11::xcb_keysyms PROPERTIES + IMPORTED_LOCATION "${X11_xcb_keysyms_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_xkb_FOUND AND NOT TARGET X11::xcb_xkb) add_library(X11::xcb_xkb UNKNOWN IMPORTED) set_target_properties(X11::xcb_xkb PROPERTIES @@ -853,6 +881,10 @@ if (UNIX) X11_xcb_util_INCLUDE_PATH X11_xcb_xfixes_LIB X11_xcb_xfixes_INCLUDE_PATH + X11_xcb_xtest_LIB + X11_xcb_xtest_INCLUDE_PATH + X11_xcb_keysyms_LIB + X11_xcb_keysyms_INCLUDE_PATH X11_xcb_xkb_LIB X11_X11_xcb_LIB X11_X11_xcb_INCLUDE_PATH diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index ddee835..18a73a3 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -36,6 +36,8 @@ test_x11_component(x11_components xcb_icccm) test_x11_component(x11_components xcb_randr) test_x11_component(x11_components xcb_util) test_x11_component(x11_components xcb_xfixes) +test_x11_component(x11_components xcb_xtest) +test_x11_component(x11_components xcb_keysyms) test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index ce6f224..653a2be 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -376,6 +376,34 @@ static void test_xcb_xfixes(void) # endif +# ifdef HAVE_xcb_xtest +# include + +static void test_xcb_xtest(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_test_get_version_unchecked(connection, 1, 0); + xcb_disconnect(connection); +} + +# endif + +# ifdef HAVE_xcb_keysyms +# include + +static void test_xcb_keysyms(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_key_symbols_t* symbols = xcb_key_symbols_alloc(connection); + if (symbols != NULL) + xcb_key_symbols_free(symbols); + xcb_disconnect(connection); +} + +# endif + #endif #include -- cgit v0.12