libfreerdp-kbd: fix keymaps search
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 8 Jan 2012 17:42:30 +0000 (12:42 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 8 Jan 2012 17:42:30 +0000 (12:42 -0500)
libfreerdp-kbd/CMakeLists.txt
libfreerdp-kbd/layouts_xkb.c

index f6e9d4d..060846f 100644 (file)
@@ -34,11 +34,13 @@ if(X11_FOUND)
        target_link_libraries(freerdp-kbd ${X11_LIBRARIES})
 endif()
 
-find_suggested_package(XKBFile)
-if(XKBFILE_FOUND)
-       add_definitions(-DWITH_XKBFILE)
-       include_directories(${XKBFILE_INCLUDE_DIRS})
-       target_link_libraries(freerdp-kbd ${XKBFILE_LIBRARIES})
+if(NOT APPLE)
+       find_suggested_package(XKBFile)
+       if(XKBFILE_FOUND)
+               add_definitions(-DWITH_XKBFILE)
+               include_directories(${XKBFILE_INCLUDE_DIRS})
+               target_link_libraries(freerdp-kbd ${XKBFILE_LIBRARIES})
+       endif()
 endif()
 
 add_definitions(-DKEYMAP_PATH="${FREERDP_KEYMAP_PATH}")
index b9ad07f..e71f50d 100644 (file)
@@ -235,8 +235,12 @@ static int load_xkb_keyboard(KeycodeToVkcode map, char* kbd)
 
                if((fp = fopen(xkbfilepath, "r")) == NULL)
                {
-                       /* If ran from the source tree, the keymaps will be in the parent directory */
-                       snprintf(xkbfilepath, sizeof(xkbfilepath), "../keymaps/%s", xkbfile);
+                       /* If ran from the root of the source tree */
+                       snprintf(xkbfilepath, sizeof(xkbfilepath), "./keymaps/%s", xkbfile);
+
+                       /* If ran from the client directory */
+                       if((fp = fopen(xkbfilepath, "r")) == NULL)
+                               snprintf(xkbfilepath, sizeof(xkbfilepath), "../../keymaps/%s", xkbfile);
 
                        if((fp = fopen(xkbfilepath, "r")) == NULL)
                        {