summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMake/FindPCRE.cmake37
-rw-r--r--CMakeLists.txt13
-rw-r--r--sway/handlers.c3
3 files changed, 43 insertions, 10 deletions
diff --git a/CMake/FindPCRE.cmake b/CMake/FindPCRE.cmake
new file mode 100644
index 00000000..dbbd60ad
--- /dev/null
+++ b/CMake/FindPCRE.cmake
@@ -0,0 +1,37 @@
1# Copyright (C) 2007-2009 LuaDist.
2# Created by Peter Kapec <kapecp@gmail.com>
3# Redistribution and use of this file is allowed according to the terms of the MIT license.
4# For details see the COPYRIGHT file distributed with LuaDist.
5# Note:
6# Searching headers and libraries is very simple and is NOT as powerful as scripts
7# distributed with CMake, because LuaDist defines directories to search for.
8# Everyone is encouraged to contact the author with improvements. Maybe this file
9# becomes part of CMake distribution sometimes.
10
11# - Find pcre
12# Find the native PCRE headers and libraries.
13#
14# PCRE_INCLUDE_DIRS - where to find pcre.h, etc.
15# PCRE_LIBRARIES - List of libraries when using pcre.
16# PCRE_FOUND - True if pcre found.
17
18# Look for the header file.
19FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h)
20
21# Look for the library.
22FIND_LIBRARY(PCRE_LIBRARY NAMES pcre)
23
24# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
25INCLUDE(FindPackageHandleStandardArgs)
26FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
27
28# Copy the results to the output variables.
29IF(PCRE_FOUND)
30 SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
31 SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
32ELSE(PCRE_FOUND)
33 SET(PCRE_LIBRARIES)
34 SET(PCRE_INCLUDE_DIRS)
35ENDIF(PCRE_FOUND)
36
37MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e639e1f..bbf61299 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
1cmake_minimum_required(VERSION 2.8.5) 1cmake_minimum_required(VERSION 2.8.5)
2project(sway C) 2project(sway C)
3set(CMAKE_C_FLAGS "-g") 3set(CMAKE_C_FLAGS "-g")
4set(CMAKE_C_STANDARD 99)
4set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/") 5set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
5add_definitions("-Wall -Wextra -Wno-unused-parameter") 6add_definitions("-Wall -Wextra -Wno-unused-parameter")
6set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake) 7set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)
@@ -20,19 +21,13 @@ add_definitions("${GIT_VERSION_FLAG}")
20find_package(XKBCommon REQUIRED) 21find_package(XKBCommon REQUIRED)
21find_package(WLC REQUIRED) 22find_package(WLC REQUIRED)
22find_package(A2X REQUIRED) 23find_package(A2X REQUIRED)
23 24find_package(PCRE REQUIRED)
24if (UNIX)
25 find_library(DL_LIBRARY dl)
26 mark_as_advanced(DL_LIBRARY)
27 if (NOT DL_LIBRARY)
28 message(FATAL_ERROR "libdl is needed on unix systems")
29 endif ()
30endif (UNIX)
31 25
32FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) 26FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
33 27
34include_directories( 28include_directories(
35 ${WLC_INCLUDE_DIRS} 29 ${WLC_INCLUDE_DIRS}
30 ${PCRE_INCLUDE_DIRS}
36 include/ 31 include/
37) 32)
38 33
@@ -43,7 +38,7 @@ add_executable(sway
43target_link_libraries(sway 38target_link_libraries(sway
44 ${WLC_LIBRARIES} 39 ${WLC_LIBRARIES}
45 ${XKBCOMMON_LIBRARIES} 40 ${XKBCOMMON_LIBRARIES}
46 ${DL_LIBRARY} 41 ${PCRE_LIBRARIES}
47) 42)
48 43
49INSTALL( 44INSTALL(
diff --git a/sway/handlers.c b/sway/handlers.c
index 330f6c0c..93b124bd 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -302,7 +302,8 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
302 302
303 struct sway_mode *mode = config->current_mode; 303 struct sway_mode *mode = config->current_mode;
304 304
305 uint32_t sym = tolower(wlc_keyboard_get_keysym_for_key(key, modifiers)); 305 struct wlc_modifiers no_mods = { 0, 0 };
306 uint32_t sym = tolower(wlc_keyboard_get_keysym_for_key(key, &no_mods));
306 307
307 int i; 308 int i;
308 309