diff options
26 files changed, 214 insertions, 150 deletions
@@ -46,17 +46,21 @@ Pre-requisite: export LD_LIBRARY_PATH=<your installation path>/lib Start-up Weston: - Example: <your installation path>/bin/weston + Syntax: <your installation path>/bin/weston [wayland_display_to_listen_on] + Example: /usr/bin/weston -Swayland-1 Start-up HMI helper: - Example: <your installation path>/bin/layer-add-surfaces 1000 1 + Syntax: [wayland_display_to_connect_to] <your installation path>/bin/layer-add-surfaces <layer_id> <surface_count> + Example: WAYLAND_DISPLAY=wayland-1 $HOME/bin/layer-add-surfaces 1000 1 EGLWLMockNavigation: - Example: <your installation path>/bin/EGLWLMockNavigation + Syntax: [wayland_display_to_connect_to] <your installation path>/bin/EGLWLMockNavigation + Example: WAYLAND_DISPLAY=wayland-1 $HOME/bin/EGLWLMockNavigation How to test ==================================== 1. Build the testsuite by setting BUILD_ILM_API_TESTS option. Example: cmake -DBUILD_ILM_API_TESTS 2. After starting up Weston run the testsuite. - Example: <your installation path>/bin/ivi-layermanagement-api-test + Syntax: [wayland_display_to_connect_to] <your installation path>/bin/ivi-layermanagement-api-test + Example: WAYLAND_DISPLAY=wayland-1 $HOME/bin/ivi-layermanagement-api-test diff --git a/ivi-id-agent-modules/ivi-id-agent/CMakeLists.txt b/ivi-id-agent-modules/ivi-id-agent/CMakeLists.txt index 3e604a5..101d773 100644 --- a/ivi-id-agent-modules/ivi-id-agent/CMakeLists.txt +++ b/ivi-id-agent-modules/ivi-id-agent/CMakeLists.txt @@ -25,7 +25,7 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(WAYLAND_SERVER wayland-server REQUIRED) pkg_check_modules(WESTON weston>=6.0.0 REQUIRED) pkg_check_modules(PIXMAN pixman-1 REQUIRED) -pkg_check_modules(LIBWESTON_DESKTOP libweston-desktop-6 REQUIRED) +pkg_check_modules(LIBWESTON_DESKTOP libweston-desktop-9 REQUIRED) find_package(Threads REQUIRED) @@ -39,6 +39,7 @@ include_directories( link_directories( ${WAYLAND_SERVER_LIBRARY_DIRS} ${PIXMAN_LIBRARY_DIRS} + ${LIBWESTON_DESKTOP_LIBRARY_DIRS} ) diff --git a/ivi-id-agent-modules/ivi-id-agent/src/ivi-id-agent.c b/ivi-id-agent-modules/ivi-id-agent/src/ivi-id-agent.c index 8f0c199..87df2a3 100644 --- a/ivi-id-agent-modules/ivi-id-agent/src/ivi-id-agent.c +++ b/ivi-id-agent-modules/ivi-id-agent/src/ivi-id-agent.c @@ -26,9 +26,9 @@ #include <limits.h> #include <weston.h> -#include <libweston-6/libweston-desktop.h> -#include "config-parser.h" -#include <weston/ivi-layout-export.h> +#include <libweston-desktop/libweston-desktop.h> +#include <libweston/config-parser.h> +#include <ivi-layout-export.h> #ifndef INVALID_ID #define INVALID_ID 0xFFFFFFFF @@ -365,8 +365,10 @@ ivi_failed: static int32_t deinit(struct ivi_id_agent *ida) { - struct db_elem *db_elem; - wl_list_for_each(db_elem, &ida->app_list, link) { + struct db_elem *db_elem, *dl_elem_next; + wl_list_for_each_safe(db_elem, dl_elem_next, &ida->app_list, link) { + wl_list_remove(&db_elem->link); + free(db_elem->cfg_app_id); free(db_elem->cfg_title); free(db_elem); diff --git a/ivi-input-modules/ivi-input-controller/src/ivi-input-controller.c b/ivi-input-modules/ivi-input-controller/src/ivi-input-controller.c index b4d54d1..82900dc 100644 --- a/ivi-input-modules/ivi-input-controller/src/ivi-input-controller.c +++ b/ivi-input-modules/ivi-input-controller/src/ivi-input-controller.c @@ -25,13 +25,13 @@ #include <string.h> #include <weston.h> -#include <weston/ivi-layout-export.h> +#include <ivi-layout-export.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include "plugin-registry.h" +#include <libweston/plugin-registry.h> #include "ilm_types.h" #include "ivi-input-server-protocol.h" @@ -758,12 +758,29 @@ input_ctrl_touch_set_west_focus(struct seat_ctx *ctx_seat, } } +/** Check if the touch has focused resources. + * + * \param touch The touch to check for focused resources. + * \return Whether or not this touch has focused resources + */ +static bool +ivi_weston_touch_has_focus_resource(struct weston_touch *touch) +{ + if (!touch->focus) + return false; + + if (wl_list_empty(&touch->focus_resource_list)) + return false; + + return true; +} + static void input_ctrl_touch_west_send_cancel(struct weston_touch *touch) { struct wl_resource *resource; - if (!weston_touch_has_focus_resource(touch)) + if (!ivi_weston_touch_has_focus_resource(touch)) return; wl_resource_for_each(resource, &touch->focus_resource_list) diff --git a/ivi-layermanagement-api/ilmClient/include/ilm_client_platform.h b/ivi-layermanagement-api/ilmClient/include/ilm_client_platform.h index 1fb10af..f281c3e 100644 --- a/ivi-layermanagement-api/ilmClient/include/ilm_client_platform.h +++ b/ivi-layermanagement-api/ilmClient/include/ilm_client_platform.h @@ -35,7 +35,7 @@ typedef struct _ILM_CLIENT_PLATFORM_FUNC ilmErrorTypes (*destroy)(); } ILM_CLIENT_PLATFORM_FUNC; -ILM_CLIENT_PLATFORM_FUNC gIlmClientPlatformFunc; +extern ILM_CLIENT_PLATFORM_FUNC gIlmClientPlatformFunc; void init_ilmClientPlatformTable(); diff --git a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c index 55b1621..12052f8 100644 --- a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c +++ b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c @@ -27,6 +27,8 @@ #include "wayland-util.h" #include "ivi-application-client-protocol.h" +ILM_CLIENT_PLATFORM_FUNC gIlmClientPlatformFunc; + static ilmErrorTypes wayland_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, diff --git a/ivi-layermanagement-api/ilmCommon/include/ilm_common_platform.h b/ivi-layermanagement-api/ilmCommon/include/ilm_common_platform.h index 4e7b55e..ec49467 100644 --- a/ivi-layermanagement-api/ilmCommon/include/ilm_common_platform.h +++ b/ivi-layermanagement-api/ilmCommon/include/ilm_common_platform.h @@ -32,7 +32,7 @@ typedef struct _ILM_COMMON_PLATFORM_FUNC ilmErrorTypes (*destroy)(); } ILM_COMMON_PLATFORM_FUNC; -ILM_COMMON_PLATFORM_FUNC gIlmCommonPlatformFunc; +extern ILM_COMMON_PLATFORM_FUNC gIlmCommonPlatformFunc; void init_ilmCommonPlatformTable(); diff --git a/ivi-layermanagement-api/ilmCommon/src/ilm_common_wayland_platform.c b/ivi-layermanagement-api/ilmCommon/src/ilm_common_wayland_platform.c index 7470d0d..eef842d 100644 --- a/ivi-layermanagement-api/ilmCommon/src/ilm_common_wayland_platform.c +++ b/ivi-layermanagement-api/ilmCommon/src/ilm_common_wayland_platform.c @@ -32,6 +32,8 @@ static t_ilm_nativedisplay wayland_getNativedisplay(void); static t_ilm_bool wayland_isInitialized(void); static ilmErrorTypes wayland_destroy(void); +ILM_COMMON_PLATFORM_FUNC gIlmCommonPlatformFunc; + void init_ilmCommonPlatformTable(void) { gIlmCommonPlatformFunc.init = wayland_init; diff --git a/ivi-layermanagement-api/ilmControl/CMakeLists.txt b/ivi-layermanagement-api/ilmControl/CMakeLists.txt index f6bc551..b0e6b22 100644 --- a/ivi-layermanagement-api/ilmControl/CMakeLists.txt +++ b/ivi-layermanagement-api/ilmControl/CMakeLists.txt @@ -65,7 +65,7 @@ add_custom_command( include_directories( include ${ILM_COMMON_INCLUDE_DIRS} - ${WAYLAND_CLIENT_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/ivi-layermanagement-api/ilmControl/src/bitmap.c b/ivi-layermanagement-api/ilmControl/src/bitmap.c index 79d2a5d..2bbe758 100644 --- a/ivi-layermanagement-api/ilmControl/src/bitmap.c +++ b/ivi-layermanagement-api/ilmControl/src/bitmap.c @@ -26,6 +26,7 @@ #include <stdbool.h> #include <arpa/inet.h> #include "ivi-wm-client-protocol.h" +#include <endian.h> struct __attribute__ ((__packed__)) BITMAPFILEHEADER { char bfType[2]; diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c index f1e5404..b4fdfbf 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -833,7 +833,7 @@ input_listener_input_acceptance(void *data, struct accepted_seat *accepted_seat, *next; struct wayland_context *ctx = data; struct surface_context *surface_ctx = NULL; - int surface_found = 1; + int surface_found = 0; int accepted_seat_found = 0; wl_list_for_each(surface_ctx, &ctx->list_surface, link) { diff --git a/ivi-layermanagement-api/ilmInput/CMakeLists.txt b/ivi-layermanagement-api/ilmInput/CMakeLists.txt index b4c794c..f2ed324 100644 --- a/ivi-layermanagement-api/ilmInput/CMakeLists.txt +++ b/ivi-layermanagement-api/ilmInput/CMakeLists.txt @@ -50,7 +50,7 @@ include_directories( include ${CMAKE_CURRENT_BINARY_DIR} ${ILM_CONTROL_INCLUDE_DIRS} - ${WAYLAND_CLIENT_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} ) link_directories( diff --git a/ivi-layermanagement-examples/EGLWLInputEventExample/CMakeLists.txt b/ivi-layermanagement-examples/EGLWLInputEventExample/CMakeLists.txt index 76d8def..e8596e8 100644 --- a/ivi-layermanagement-examples/EGLWLInputEventExample/CMakeLists.txt +++ b/ivi-layermanagement-examples/EGLWLInputEventExample/CMakeLists.txt @@ -48,11 +48,11 @@ add_custom_command( ) include_directories( - ${GLESv2_INCLUDE_DIR} - ${EGL_INCLUDE_DIR} - ${WAYLAND_CLIENT_INCLUDE_DIR} - ${WAYLAND_CURSOR_INCLUDE_DIR} - ${FFI_INCLUDE_DIR} + ${GLESv2_INCLUDE_DIRS} + ${EGL_INCLUDE_DIRS} + ${WAYLAND_CLIENT_INCLUDE_DIRS} + ${WAYLAND_CURSOR_INCLUDE_DIRS} + ${FFI_INCLUDE_DIRS} "include" ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/ivi-layermanagement-examples/EGLWLInputEventExample/src/WLContext.cpp b/ivi-layermanagement-examples/EGLWLInputEventExample/src/WLContext.cpp index dedb5a8..edcbaff 100644 --- a/ivi-layermanagement-examples/EGLWLInputEventExample/src/WLContext.cpp +++ b/ivi-layermanagement-examples/EGLWLInputEventExample/src/WLContext.cpp @@ -85,7 +85,6 @@ create_cursors(WLContext* wlContext) fprintf(stderr, "could not load default theme\n"); return; } - wlContext->SetWLCursor((wl_cursor*) malloc(sizeof(wl_cursor))); for (j = 0; !cursor && j < ARRAY_SIZE(left_ptrs); ++j) cursor = wl_cursor_theme_get_cursor(wlContext->GetWLCursorTheme(), @@ -171,11 +170,10 @@ WLContext::SeatHandleCapabilities(void* data, struct wl_seat* seat, uint32_t cap context->ctx->SetPointerSurface(NULL); } - if (context->ctx->GetWLCursorTheme()) + if (context->ctx->GetWLCursorTheme()){ wl_cursor_theme_destroy(context->ctx->GetWLCursorTheme()); - - if (context->ctx->GetWLCursor()) - free(context->ctx->GetWLCursor()); + context->ctx->SetWLCursor(NULL); + } } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !context->wlKeyboard){ @@ -236,11 +234,11 @@ WLContext::DestroyWLContext() m_pointerSurface = NULL; } - if (m_wlCursorTheme) + if (m_wlCursorTheme){ wl_cursor_theme_destroy(m_wlCursorTheme); - - if (m_wlCursor) - free(m_wlCursor); + m_wlCursorTheme = NULL; + m_wlCursor = NULL; + } wl_registry_destroy(m_wlRegistry); wl_display_flush(m_wlDisplay); diff --git a/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt b/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt index aeb3269..5a01682 100644 --- a/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt +++ b/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt @@ -24,7 +24,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmControl/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmInput/include" - ${WAYLAND_CLIENT_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} ) link_directories( diff --git a/ivi-layermanagement-examples/LayerManagerControl/src/sceneio.cpp b/ivi-layermanagement-examples/LayerManagerControl/src/sceneio.cpp index 6b11c3d..54ecbf1 100644 --- a/ivi-layermanagement-examples/LayerManagerControl/src/sceneio.cpp +++ b/ivi-layermanagement-examples/LayerManagerControl/src/sceneio.cpp @@ -175,67 +175,6 @@ void exportSceneToTXTHelper(ostream& stream, StringMapTree* tree, string prefix stream << prefix + "}"; } -string decodeEscapesequences(string s) -{ - map<string, string> code; - code["\\[\\]"] = "\\"; - code["\\[n]"] = "\n"; - code["\\[t]"] = "\t"; - code["\\[v]"] = "\v"; - code["\\[b]"] = "\b"; - code["\\[f]"] = "\f"; - code["\\[r]"] = "\r"; - return replaceAll(s, code); -} - -void importSceneFromTXTHelper(istream& stream, StringMapTree* node) -{ - string in; - //Type - getline(stream, in); - int typeSize = in.find(":") - in.find_first_not_of('\t'); - int typeStart = in.find_first_not_of('\t'); - node->mNodeLabel = in.substr(typeStart, typeSize); - while (true) - { - long streamPosition = stream.tellg(); - getline(stream, in); - in = rtrim(in); - - //end of object - if (in.substr(0, 1) == "}") - return; - - //start of object property - if (in.substr(0, 1) == "[") - { - int startIndex = in.find('[') + 1; - int endIndex = in.find(":"); - string propertyName = in.substr(startIndex, endIndex - startIndex); - propertyName = decodeEscapesequences(propertyName); - - startIndex = endIndex + 1; - endIndex = in.find("]"); - string propertyType = in.substr(startIndex, endIndex - startIndex); - propertyType = decodeEscapesequences(propertyType); - - startIndex = in.find('[', endIndex) + 1; - endIndex = in.find_last_of(']'); - string propertyValue = in.substr(startIndex, endIndex - startIndex); - propertyValue = decodeEscapesequences(propertyValue); - - node->mNodeValues[propertyName] = make_pair(propertyType, propertyValue); - } - else - { - stream.seekg(streamPosition); - StringMapTree* child = new StringMapTree; - node->mChildren.push_back(child); - importSceneFromTXTHelper(stream, child); - } - } -} - string makeValidXMLCharacters(string s) { map<string, string> code; diff --git a/ivi-layermanagement-examples/layer-add-surfaces/CMakeLists.txt b/ivi-layermanagement-examples/layer-add-surfaces/CMakeLists.txt index f846663..78db1af 100644 --- a/ivi-layermanagement-examples/layer-add-surfaces/CMakeLists.txt +++ b/ivi-layermanagement-examples/layer-add-surfaces/CMakeLists.txt @@ -24,7 +24,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmClient/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmControl/include" - ${WAYLAND_CLIENT_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} ) link_directories( diff --git a/ivi-layermanagement-examples/multi-touch-viewer/CMakeLists.txt b/ivi-layermanagement-examples/multi-touch-viewer/CMakeLists.txt index b9036bf..2d0acac 100644 --- a/ivi-layermanagement-examples/multi-touch-viewer/CMakeLists.txt +++ b/ivi-layermanagement-examples/multi-touch-viewer/CMakeLists.txt @@ -56,7 +56,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${GLESv2_INCLUDE_DIRS} ${EGL_INCLUDE_DIRS} - ${WAYLAND_CLIENT_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} ) link_directories( diff --git a/ivi-layermanagement-examples/multi-touch-viewer/include/window.h b/ivi-layermanagement-examples/multi-touch-viewer/include/window.h index 40e2925..d81dda6 100644 --- a/ivi-layermanagement-examples/multi-touch-viewer/include/window.h +++ b/ivi-layermanagement-examples/multi-touch-viewer/include/window.h @@ -46,6 +46,12 @@ struct Task struct wl_list link; }; +enum TypeOfShell +{ + WL_SHELL = 1, + IVI_SHELL = 2 +}; + struct WaylandDisplay { struct Task display_task; @@ -57,6 +63,7 @@ struct WaylandDisplay EGLDisplay egldisplay; EGLConfig eglconfig; EGLContext eglcontext; + enum TypeOfShell shell_type; int running; int epoll_fd; @@ -102,7 +109,7 @@ struct WaylandEglWindow }; struct WaylandDisplay* -CreateDisplay(int argc, char **argv); +CreateDisplay(int argc, char **argv, enum TypeOfShell shell_type); void DestroyDisplay(struct WaylandDisplay *p_display); diff --git a/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c b/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c index 6645730..5d97ad4 100644 --- a/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c +++ b/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c @@ -30,6 +30,7 @@ #include <sys/stat.h> #include <wayland-client-protocol.h> #include "multi-touch-viewer.h" +#include "getopt.h" #define WINDOW_TITLE "multi_touch_viewer" #define WINDOW_WIDTH 1080 @@ -69,6 +70,7 @@ static const char *gp_frag_shader_text = static struct touch_event_test_params *gp_test_params = NULL; static int g_is_print_log = 0; +static enum TypeOfShell g_shell_type = IVI_SHELL; /******************************************************************************/ @@ -587,7 +589,7 @@ setup_signal() /******************************************************************************/ -int +static int touch_event_test_main(struct touch_event_test_params *p_params) { struct WaylandDisplay *p_display; @@ -595,7 +597,7 @@ touch_event_test_main(struct touch_event_test_params *p_params) setup_signal(); - p_display = CreateDisplay(0, NULL); + p_display = CreateDisplay(0, NULL, g_shell_type); if (NULL == p_display) { LOG_ERROR("Failed to create display\n"); @@ -641,39 +643,65 @@ touch_event_test_main(struct touch_event_test_params *p_params) return 0; } -void +static void usage(int status) { - printf("usage: multi-touch-viewer [OPTION]\n"); - printf(" -p : print received touch point\n"); + fprintf(stderr, " -h, --help display this help and exit.\n" + " -p, --print-log print received touch point.\n" + " -s, --shell-type select the type of shell, default is the ivi_shell:\n" + " - wl_shell: to using the wl_shell.\n" + " - ivi_shell: to using the ivi_shell.\n"); exit(status); } -int -main(int argc, char **argv) +static void +parse_options(int argc, char *argv[]) { - _UNUSED_(argc); - _UNUSED_(argv); - struct touch_event_test_params params; + int opt = -1, option_index = 0; + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "print-log", no_argument, NULL, 'p' }, + { "shell-type", required_argument, NULL, 's' }, + { 0, 0, NULL, 0 } + }; - memset(¶ms, 0x00, sizeof params); + while (1) { + opt = getopt_long(argc, argv, "hps:", options, NULL); - if (argc == 2) - { - if (0 == strcmp(argv[1], "-p")) - { - g_is_print_log = 1; - } - else - { - usage(EXIT_SUCCESS); + if (opt == -1) + break; + + switch (opt) { + case 'h': + usage(0); + break; + case 'p': + g_is_print_log = 1; + break; + case 's': + if (strcmp(optarg, "wl_shell") == 0) + g_shell_type = WL_SHELL; + break; + default: + usage(-1); + break; } } + printf("multi-touch-viewer runs with %s and logging %s\n", + (g_shell_type == WL_SHELL) ? "wl_shell" : "ivi_shell", + (g_is_print_log == 1) ? "enable" : "disable"); +} - gp_test_params = ¶ms; +int +main(int argc, char **argv) +{ + parse_options(argc, argv); - wl_list_init(¶ms.touch_point_list); + struct touch_event_test_params params; + memset(¶ms, 0x00, sizeof params); + gp_test_params = ¶ms; + wl_list_init(¶ms.touch_point_list); log_array_init(¶ms.log_array, 500); return touch_event_test_main(¶ms); diff --git a/ivi-layermanagement-examples/multi-touch-viewer/src/window.c b/ivi-layermanagement-examples/multi-touch-viewer/src/window.c index 41b02a9..abd7788 100644 --- a/ivi-layermanagement-examples/multi-touch-viewer/src/window.c +++ b/ivi-layermanagement-examples/multi-touch-viewer/src/window.c @@ -79,12 +79,14 @@ registry_handle_global(void *p_data, struct wl_registry *p_registry, p_display->p_compositor = wl_registry_bind(p_registry, id, &wl_compositor_interface, 1); } - else if (0 == strcmp(p_interface, "wl_shell")) + else if ((0 == strcmp(p_interface, "wl_shell")) && + (p_display->shell_type == WL_SHELL)) { p_display->p_shell = wl_registry_bind(p_registry, id, &wl_shell_interface, 1); } - else if (0 == strcmp(p_interface, "ivi_application")) + else if ((0 == strcmp(p_interface, "ivi_application")) && + (p_display->shell_type == IVI_SHELL)) { p_display->p_ivi_application = wl_registry_bind(p_registry, id, &ivi_application_interface, 1); @@ -500,7 +502,7 @@ DisplayAcquireWindowSurface(struct WaylandDisplay *p_display, } struct WaylandDisplay * -CreateDisplay(int argc, char **argv) +CreateDisplay(int argc, char **argv, enum TypeOfShell shell_type) { struct WaylandDisplay *p_display; @@ -521,6 +523,7 @@ CreateDisplay(int argc, char **argv) return NULL; } + p_display->shell_type = shell_type; p_display->epoll_fd = os_epoll_create_cloexec(); p_display->display_fd = wl_display_get_fd(p_display->p_display); p_display->display_task.run = handle_display_data; diff --git a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt index 0c4f5df..fc56304 100644 --- a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt +++ b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt @@ -22,14 +22,14 @@ project (simple-weston-client) find_package(PkgConfig) pkg_check_modules(WAYLAND_CLIENT wayland-client REQUIRED) pkg_check_modules(WAYLAND_CURSOR wayland-cursor REQUIRED) -pkg_check_modules(LIBWESTON_PROTOCOLS libweston-6-protocols QUIET) +pkg_check_modules(LIBWESTON_PROTOCOLS libweston-9-protocols QUIET) if(${LIBWESTON_PROTOCOLS_FOUND}) #check for DLT pkg_check_modules(DLT automotive-dlt QUIET) #import the pkgdatadir from libweston-protocols pkgconfig file - execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir libweston-6-protocols + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir libweston-9-protocols OUTPUT_VARIABLE WestonProtocols_PKGDATADIR) string(REGEX REPLACE "[\r\n]" "" WestonProtocols_PKGDATADIR "${WestonProtocols_PKGDATADIR}") SET(LIBWESTON_PROTOCOLS_PKGDATADIR ${WestonProtocols_PKGDATADIR}) @@ -80,10 +80,10 @@ if(${LIBWESTON_PROTOCOLS_FOUND}) endif(${LIBWESTON_PROTOCOLS_FOUND}) include_directories( - ${WAYLAND_CLIENT_INCLUDE_DIR} - ${WAYLAND_CURSOR_INCLUDE_DIR} + ${WAYLAND_CLIENT_INCLUDE_DIRS} + ${WAYLAND_CURSOR_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} - ${DLT_INCLUDE_DIR} + ${DLT_INCLUDE_DIRS} ) link_directories( diff --git a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c index fe3d1d0..37a942a 100644 --- a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c +++ b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c @@ -921,24 +921,8 @@ int main (int argc, const char * argv[]) Error: #ifdef LIBWESTON_DEBUG_PROTOCOL - weston_debug_v1_destroy(wlcontext->debug_iface); - - while (1) { - struct debug_stream *stream; - int empty = 1; - - wl_list_for_each(stream, &wlcontext->stream_list, link) - if (stream->obj) { - empty = 0; - break; - } - - if (empty) - break; - - if (wl_display_dispatch(wlcontext->wl_display) < 0) - break; - } + if(wlcontext->debug_iface) + weston_debug_v1_destroy(wlcontext->debug_iface); destroy_streams(wlcontext); wl_display_roundtrip(wlcontext->wl_display); diff --git a/protocol/CMakeLists.txt b/protocol/CMakeLists.txt index 529f148..548c8ba 100644 --- a/protocol/CMakeLists.txt +++ b/protocol/CMakeLists.txt @@ -60,6 +60,11 @@ add_library(${PROJECT_NAME} SHARED ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-protocol.c ) +target_link_libraries ( + ${PROJECT_NAME} + ${WAYLAND_CLIENT_LIBRARIES} +) + set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fPIC") diff --git a/weston-ivi-shell/src/ivi-controller.c b/weston-ivi-shell/src/ivi-controller.c index cabd31b..c27966a 100644 --- a/weston-ivi-shell/src/ivi-controller.c +++ b/weston-ivi-shell/src/ivi-controller.c @@ -28,6 +28,7 @@ #include "config.h" +#include <errno.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> @@ -86,6 +87,7 @@ struct screenshot_frame_listener { struct wl_listener frame_listener; struct wl_listener output_destroyed; struct wl_resource *screenshot; + struct weston_output *output; }; struct screen_id_info { @@ -435,6 +437,42 @@ create_screenshot_file(off_t size) { return fd; } +/** Read the current time from the Presentation clock + * + * \param compositor + * \param[out] ts The current time. + * + * \note Reading the current time in user space is always imprecise to some + * degree. + * + * This function is never meant to fail. If reading the clock does fail, + * an error message is logged and a zero time is returned. Callers are not + * supposed to detect or react to failures. + * + * \ingroup compositor + */ +static void +ivi_weston_compositor_read_presentation_clock( + const struct weston_compositor *compositor, + struct timespec *ts) +{ + static bool warned; + int ret; + + ret = clock_gettime(compositor->presentation_clock, ts); + if (ret < 0) { + ts->tv_sec = 0; + ts->tv_nsec = 0; + + if (!warned) + weston_log("Error: failure to read " + "the presentation clock %#x: '%s' (%d)\n", + compositor->presentation_clock, + strerror(errno), errno); + warned = true; + } +} + static void controller_surface_screenshot(struct wl_client *client, struct wl_resource *resource, @@ -518,7 +556,7 @@ controller_surface_screenshot(struct wl_client *client, } // get current timestamp - weston_compositor_read_presentation_clock(compositor, &stamp); + ivi_weston_compositor_read_presentation_clock(compositor, &stamp); stamp_ms = stamp.tv_sec * 1000 + stamp.tv_nsec / 1000000; ivi_screenshot_send_done(screenshot, fd, width, height, stride, format, @@ -852,6 +890,23 @@ calc_trans_matrix(struct weston_geometry *source_rect, weston_matrix_translate(m, translate_x, translate_y, 0.0f); } +/** + * \param surface The surface to be repainted + * + * Marks the output(s) that the surface is shown on as needing to be + * repainted. See weston_output_schedule_repaint(). + */ + +static void +ivi_weston_surface_schedule_repaint(struct weston_surface *surface) +{ + struct weston_output *output; + + wl_list_for_each(output, &surface->compositor->output_list, link) + if (surface->output_mask & (1u << output->id)) + weston_output_schedule_repaint(output); +} + void set_bkgnd_surface_prop(struct ivishell *shell) { @@ -909,7 +964,7 @@ set_bkgnd_surface_prop(struct ivishell *shell) wl_list_insert(&view->geometry.transformation_list, &shell->bkgnd_transform.link); weston_view_update_transform(view); - weston_surface_schedule_repaint(w_surface); + ivi_weston_surface_schedule_repaint(w_surface); } static void @@ -1206,7 +1261,7 @@ controller_screenshot_notify(struct wl_listener *listener, void *data) struct screenshot_frame_listener *l = wl_container_of(listener, l, frame_listener); - struct weston_output *output = data; + struct weston_output *output = l->output; int32_t width = 0; int32_t height = 0; int32_t stride = 0; @@ -1304,6 +1359,20 @@ screenshot_frame_listener_destroy(struct wl_resource *resource) free(l); } +/** + * \ingroup output + */ +static void +ivi_weston_output_damage(struct weston_output *output) +{ + struct weston_compositor *compositor = output->compositor; + + pixman_region32_union(&compositor->primary_plane.damage, + &compositor->primary_plane.damage, + &output->region); + weston_output_schedule_repaint(output); +} + static void controller_screen_screenshot(struct wl_client *client, struct wl_resource *resource, @@ -1336,6 +1405,8 @@ controller_screen_screenshot(struct wl_client *client, return; } + l->output = iviscrn->output; + wl_resource_set_implementation(l->screenshot, NULL, l, screenshot_frame_listener_destroy); l->output_destroyed.notify = screenshot_output_destroyed; @@ -1343,7 +1414,7 @@ controller_screen_screenshot(struct wl_client *client, l->frame_listener.notify = controller_screenshot_notify; wl_signal_add(&iviscrn->output->frame_signal, &l->frame_listener); iviscrn->output->disable_planes++; - weston_output_damage(iviscrn->output); + ivi_weston_output_damage(iviscrn->output); } static void diff --git a/weston-ivi-shell/src/ivi-controller.h b/weston-ivi-shell/src/ivi-controller.h index 00f5910..16dbe57 100644 --- a/weston-ivi-shell/src/ivi-controller.h +++ b/weston-ivi-shell/src/ivi-controller.h @@ -24,7 +24,7 @@ #define WESTON_IVI_SHELL_SRC_IVI_CONTROLLER_H_ #include "ivi-wm-server-protocol.h" -#include <weston/ivi-layout-export.h> +#include <ivi-layout-export.h> /* Convert timespec to milliseconds * |