uint32_t device,
int32_t enabled)
{
- (void)data;
- (void)controller;
- (void)device;
- (void)enabled;
+ struct surface_context *ctx_surf = data;
+
+ if (ctx_surf == NULL) {
+ fprintf(stderr, "%s: Invalid surface context\n", __FUNCTION__);
+ return;
+ }
+ if (device & IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD) {
+ ctx_surf->prop.hasKeyboardFocus = enabled;
+ }
}
static struct ivi_controller_surface_listener controller_surface_listener=
ILM_EXPORT ilmErrorTypes
ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId)
{
- ilmErrorTypes returnValue = ILM_FAILED;
- (void)pSurfaceId;
- returnValue = ILM_SUCCESS;
- return returnValue;
+ struct ilm_control_context *ctx = sync_and_acquire_instance();
+ struct surface_context *ctx_surf = NULL;
+
+ wl_list_for_each(ctx_surf, &ctx->wl.list_surface, link) {
+ if (ctx_surf->prop.hasKeyboardFocus) {
+ *pSurfaceId = ctx_surf->id_surface;
+ break;
+ }
+ }
+
+ release_instance();
+ return ILM_SUCCESS;
}
ILM_EXPORT ilmErrorTypes
ivi_controller_surface_send_pixelformat(resource,
prop->pixelformat);
}
+ if (mask & IVI_NOTIFICATION_KEYBOARD_FOCUS) {
+ ivi_controller_surface_send_input_focus(resource,
+ IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD,
+ prop->hasKeyboardFocus);
+ }
if (mask & IVI_NOTIFICATION_REMOVE) {
send_surface_add_event(ivisurf, resource, IVI_NOTIFICATION_REMOVE);
}
wl_resource_destroy(resource);
}
+static void send_all_keyboard_focus(struct ivishell *shell)
+{
+ struct ivi_layout_SurfaceProperties props;
+ struct ivicontroller_surface *ctrlsurf;
+ struct ivisurface *current_surf;
+ uint32_t id_surface;
+
+ wl_list_for_each(current_surf, &shell->list_surface, link) {
+ ivi_layout_getPropertiesOfSurface(current_surf->layout_surface,
+ &props);
+ id_surface = ivi_layout_getIdOfSurface(current_surf->layout_surface);
+ wl_list_for_each(ctrlsurf, &shell->list_controller_surface, link) {
+ if (id_surface != ctrlsurf->id_surface) {
+ continue;
+ }
+ ivi_controller_surface_send_input_focus(ctrlsurf->resource,
+ IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD,
+ props.hasKeyboardFocus);
+ }
+ }
+}
+
static void
controller_surface_set_input_focus(struct wl_client *client,
struct wl_resource *resource,
if (device & IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD) {
if (enabled) {
ivi_layout_SetKeyboardFocusOn(ivisurf->layout_surface);
+ send_all_keyboard_focus(ivisurf->shell);
}
}
}