bool visibility;
int32_t transition_type;
uint32_t transition_duration;
+ uint32_t has_keyboard_focus;
};
struct ivi_layout_layer_properties
IVI_NOTIFICATION_ADD = (1 << 9),
IVI_NOTIFICATION_REMOVE = (1 << 10),
IVI_NOTIFICATION_CONFIGURE = (1 << 11),
+ IVI_NOTIFICATION_KEYBOARD_FOCUS = (1 << 12),
IVI_NOTIFICATION_ALL = 0xFFFF
};
wl_fixed_t
ivi_layout_surface_get_opacity(struct ivi_layout_surface *ivisurf);
+
+/**
+ * \brief Set the keyboard focus on a certain surface
+ * To receive keyboard events, 2 conditions must be fulfilled:
+ * 1- The surface must accept events from keyboard. See ilm_UpdateInputEventAcc eptanceOn
+ * 2- The keyboard focus must be set on that surface
+ *
+ * \return 0 if the method call was successful
+ * \return -1 if the method call was failed
+ */
+int32_t
+ivi_layout_set_keyboard_focus_on(struct ivi_layout_surface *ivisurf);
+
+
/**
* \brief Set the destination area of a surface within a layer for rendering.
*
}
WL_EXPORT int32_t
+ivi_layout_set_keyboard_focus_on(struct ivi_layout_surface *ivisurf)
+{
+ struct ivi_layout *layout = get_layout_instance();
+ struct wl_list *seat_list = &layout->compositor->seat_list;
+ struct wl_list *surface_list = &layout->surface_list;
+ struct ivi_layout_surface *current_surf;
+
+ if (ivisurf == NULL) {
+ weston_log("%s: invalid argument\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (seat_list == NULL) {
+ weston_log("%s: seat list is NULL\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (ivisurf->surface == NULL) {
+ weston_log("%s: ivisurf has no surface\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (surface_list == NULL) {
+ weston_log("%s: surface list is NULL\n", __FUNCTION__);
+ return -1;
+ }
+
+ wl_list_for_each(current_surf, &layout->surface_list, link) {
+ if (current_surf == ivisurf) {
+ current_surf->prop.has_keyboard_focus = 1;
+ current_surf->pending.prop.has_keyboard_focus = 1;
+ } else {
+ current_surf->prop.has_keyboard_focus = 0;
+ current_surf->pending.prop.has_keyboard_focus = 0;
+ }
+ current_surf->event_mask |= IVI_NOTIFICATION_KEYBOARD_FOCUS;
+ }
+
+ return 0;
+}
+
+
+WL_EXPORT int32_t
ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
int32_t x, int32_t y,
int32_t width, int32_t height)
keyboard_grab_key(struct weston_keyboard_grab *grab, uint32_t time,
uint32_t key, uint32_t state)
{
+ struct ivi_layout *layout = get_layout_instance();
+ struct weston_keyboard *keyboard = grab->keyboard;
+ struct wl_display *display = keyboard->seat->compositor->wl_display;
+ struct ivi_layout_surface *surf;
+ struct wl_resource *resource;
+ uint32_t serial;
+
+ wl_list_for_each(surf, &layout->surface_list, link) {
+ if (surf->prop.has_keyboard_focus) {
+ resource = wl_resource_find_for_client(
+ &keyboard->resource_list,
+ wl_resource_get_client(surf->surface->resource));
+ if (!resource)
+ resource = wl_resource_find_for_client(
+ &keyboard->focus_resource_list,
+ wl_resource_get_client(surf->surface->resource));
+
+ if (resource) {
+ serial = wl_display_next_serial(display);
+ wl_keyboard_send_key(resource, serial, time, key, state);
+ } else {
+ weston_log("%s: No resource found for surface %d\n",
+ __FUNCTION__, surf->id_surface);
+ }
+ }
+ }
}
static void
uint32_t mods_depressed, uint32_t mods_latched,
uint32_t mods_locked, uint32_t group)
{
+ struct ivi_layout *layout = get_layout_instance();
+ struct weston_keyboard *keyboard = grab->keyboard;
+ struct ivi_layout_surface *surf;
+ struct wl_resource *resource;
+ int sent_to_pointer_client = 0;
+ struct weston_pointer *pointer = keyboard->seat->pointer;
+
+ /* Send modifiers to focussed surface */
+ wl_list_for_each(surf, &layout->surface_list, link) {
+ if (surf->prop.has_keyboard_focus) {
+ resource = wl_resource_find_for_client(
+ &keyboard->resource_list,
+ wl_resource_get_client(surf->surface->resource));
+ if (!resource)
+ resource = wl_resource_find_for_client(
+ &keyboard->focus_resource_list,
+ wl_resource_get_client(surf->surface->resource));
+
+ if (resource) {
+ wl_keyboard_send_modifiers(resource, serial,
+ mods_depressed,
+ mods_latched, mods_locked,
+ group);
+ if (pointer && pointer->focus
+ && pointer->focus->surface->resource
+ && pointer->focus->surface == surf->surface)
+ sent_to_pointer_client = 1;
+ } else {
+ weston_log("%s: No resource found for surface %d\n",
+ __FUNCTION__, surf->id_surface);
+ }
+ }
+ }
+
+ /* Send modifiers to pointer's client, if not already sent */
+ if (!sent_to_pointer_client && pointer && pointer->focus
+ && pointer->focus->surface->resource) {
+ struct wl_client *pointer_client =
+ wl_resource_get_client(pointer->focus->surface->resource);
+ wl_resource_for_each(resource, &keyboard->resource_list) {
+ if (wl_resource_get_client(resource) == pointer_client) {
+ sent_to_pointer_client = 1;
+ wl_keyboard_send_modifiers(resource, serial, mods_depressed,
+ mods_latched, mods_locked, group);
+ break;
+ }
+ }
+
+ if (!sent_to_pointer_client) {
+ wl_resource_for_each(resource, &keyboard->focus_resource_list) {
+ wl_keyboard_send_modifiers(resource, serial, mods_depressed,
+ mods_latched, mods_locked, group);
+ break;
+ }
+ }
+ }
}
static void