From: Janos Kovacs Date: Fri, 19 Dec 2014 14:27:53 +0000 (+0200) Subject: downstream: ivi-shell: Implement ivi_layout_get_keyboard_focus_surface_id X-Git-Tag: accepted/tizen/ivi/20141223.020144~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d021434cbe84b79e7d4d74404ab79f79e832677;p=profile%2Fivi%2Fweston-ivi-shell.git downstream: ivi-shell: Implement ivi_layout_get_keyboard_focus_surface_id This commit implements the function ivi_layout_get_keyboard_focus_surface_id. Note: This function is not used by wayland-ivi-extension's ivi-controller, so it has not been tested for correct behaviour, only that it seems correct and compiles successfully. original patch backported to upstream Weston ivi-shell: 79e4a00 by Jonathan Maw on 15 of Aug 2014 Change-Id: I50c994113e45c351a9bceabcc66c77e3d480adc7 --- diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h index ce74ef2..5b5c403 100644 --- a/ivi-shell/ivi-layout-export.h +++ b/ivi-shell/ivi-layout-export.h @@ -530,6 +530,15 @@ ivi_layout_set_keyboard_focus_on(struct ivi_layout_surface *ivisurf); /** + * \brief Get the indentifier of the surface which hold the keyboard focus + * + * \return 0 if the method call was successful + * \return -1 if the method call was failed + */ +int32_t +ivi_layout_get_keyboard_focus_surface_id(struct ivi_layout_surface **pSurfaceId); + +/** * \brief Set the destination area of a surface within a layer for rendering. * * The surface will be scaled to this rectangle for rendering. diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 956c9a9..5505097 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -2213,6 +2213,27 @@ ivi_layout_set_keyboard_focus_on(struct ivi_layout_surface *ivisurf) return 0; } +WL_EXPORT int32_t +ivi_layout_get_keyboard_focus_surface_id(struct ivi_layout_surface **pSurfaceId) +{ + struct wl_list *surface_list = &get_layout_instance()->surface_list; + struct ivi_layout_surface *current_surf; + + if (surface_list == NULL) { + weston_log("%s: surface list is NULL\n", __FUNCTION__); + return -1; + } + + wl_list_for_each(current_surf, surface_list, link) { + if (current_surf->prop.has_keyboard_focus != 0) { + *pSurfaceId = current_surf; + break; + } + } + + return 0; +} + WL_EXPORT int32_t ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,