From 060c93233ea862b032b05390e6bb1d69781dac3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 11 Jun 2014 07:51:07 +0200 Subject: [PATCH] Make xcb-icccm truely optional ICCCM dependency is a beast due to two different existing versions in different packages. Thus it cannot be a hard dep without causing problems for our downstreams. This change ensures that ICCCM is really considered as an optional dep and that the version we need is found, if not we mark it as non-found. ICCCM is only used by one test application which can easily be disabled and some enum values are used in events.cpp. If ICCCM is not found those are replaced by defines generated in config-kwin.h. BUG: 336035 --- CMakeLists.txt | 33 +++++++++++++++++++-------------- config-kwin.h.cmake | 7 +++++++ events.cpp | 2 ++ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60d3c66cf7..53512363f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,24 +138,29 @@ set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" ) # All the required XCB components -find_package(XCB REQUIRED COMPONENTS - XCB - XFIXES - DAMAGE - COMPOSITE - SHAPE - SYNC - RENDER - RANDR - KEYSYMS - IMAGE - SHM - XTEST +find_package(XCB + REQUIRED COMPONENTS + XCB + XFIXES + DAMAGE + COMPOSITE + SHAPE + SYNC + RENDER + RANDR + KEYSYMS + IMAGE + SHM + XTEST + OPTIONAL_COMPONENTS + ICCCM ) set_package_properties(XCB PROPERTIES TYPE REQUIRED) # and the optional XCB dependencies -find_package(XCB COMPONENTS ICCCM) +if (XCB_ICCCM_VERSION VERSION_LESS "0.4") + set(XCB_ICCCM_FOUND FALSE) +endif() add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin") feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index d9bf15eb39..67aba7b3c9 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -17,3 +17,10 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MALLOC_H 1 + +#cmakedefine XCB_ICCCM_FOUND 1 +#ifndef XCB_ICCCM_FOUND +#define XCB_ICCCM_WM_STATE_WITHDRAWN 0 +#define XCB_ICCCM_WM_STATE_NORMAL 1 +#define XCB_ICCCM_WM_STATE_ICONIC 3 +#endif diff --git a/events.cpp b/events.cpp index cb2aeaceae..d84e09d240 100644 --- a/events.cpp +++ b/events.cpp @@ -54,7 +54,9 @@ along with this program. If not, see . #include #include +#ifdef XCB_ICCCM_FOUND #include +#endif #include "composite.h" #include "killwindow.h"