downstream: re-enable unconditionally keyboard focus 09/32709/1
authorJanos Kovacs <jankovac503@gmail.com>
Fri, 19 Dec 2014 14:53:43 +0000 (16:53 +0200)
committerJanos Kovacs <jankovac503@gmail.com>
Fri, 19 Dec 2014 16:10:57 +0000 (18:10 +0200)
keyboard focus functions were added to weston-ivi-shell.
The supporting counterpart is re-enabled here by removing
the #ifdef SUPPORT_INPUT_FOCUS.

Change-Id: I68bb9596086e44819f268bd39744f62ecdf7652f

weston-ivi-shell/src/ivi-controller.c
weston-ivi-shell/src/ivi-layout-export.h

index 861b460..8f8213b 100755 (executable)
@@ -452,13 +452,11 @@ send_surface_event(struct wl_resource *resource,
                                                 prop->pixelformat);
     }
 #endif
-#ifdef SUPPORT_INPUT_FOCUS
     if (mask & IVI_NOTIFICATION_KEYBOARD_FOCUS) {
         ivi_controller_surface_send_input_focus(resource,
                         IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD,
                         prop->has_keyboard_focus);
     }
-#endif
     if (mask & IVI_NOTIFICATION_REMOVE) {
         send_surface_add_event(ivisurf, resource, IVI_NOTIFICATION_REMOVE);
     }
@@ -1085,7 +1083,6 @@ controller_surface_destroy(struct wl_client *client,
 
 static void send_all_keyboard_focus(struct ivishell *shell)
 {
-#ifdef SUPPORT_INPUT_FOCUS
     const struct ivi_layout_surface_properties *props;
     struct ivicontroller_surface *ctrlsurf;
     struct ivisurface *current_surf;
@@ -1105,7 +1102,6 @@ static void send_all_keyboard_focus(struct ivishell *shell)
                             props->has_keyboard_focus);
         }
     }
-#endif
 }
 
 static void
@@ -1114,18 +1110,15 @@ controller_surface_set_input_focus(struct wl_client *client,
               uint32_t device,
               int32_t enabled)
 {
-#ifdef SUPPORT_INPUT_FOCUS
     (void)client;
     struct ivisurface *ivisurf = wl_resource_get_user_data(resource);
 
     if (device & IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD) {
         if (enabled) {
-            uint32_t id = ivi_layout_get_id_of_surface(ivisurf->layout_surface);
-            ivi_layout_set_keyboard_focus_on(&id, 1);
+            ivi_layout_set_keyboard_focus_on(ivisurf->layout_surface);
             send_all_keyboard_focus(ivisurf->shell);
         }
     }
-#endif
 }
 
 static const
@@ -1659,7 +1652,10 @@ controller_set_keyboard_focus(struct wl_client *client,
                               struct wl_resource *resource,
                               struct wl_array *surfaces)
 {
-#ifdef SUPPORT_INPUT_FOCUS
+#if 0
+    /* this supposed to go away in later rteleases as
+       ivi_layout_set_keyboard_focus_on() nowadays takes a single surface
+       as opposed to an array */
     struct ivicontroller *ctrl = wl_resource_get_user_data(resource);
     ivi_layout_set_keyboard_focus_on(surfaces->data, surfaces->size);
     send_all_keyboard_focus(ctrl->shell);
index 9962932..5b5c403 100644 (file)
@@ -52,8 +52,8 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <stdbool.h>
-#include <weston/compositor.h>
+#include "stdbool.h"
+#include "compositor.h"
 
 #define IVI_SUCCEEDED (0)
 #define IVI_FAILED (-1)
@@ -81,6 +81,7 @@ struct ivi_layout_surface_properties
        bool visibility;
        int32_t transition_type;
        uint32_t transition_duration;
+       uint32_t has_keyboard_focus;
 };
 
 struct ivi_layout_layer_properties
@@ -104,20 +105,20 @@ struct ivi_layout_layer_properties
 };
 
 enum ivi_layout_notification_mask {
-       IVI_NOTIFICATION_NONE           = 0,
-       IVI_NOTIFICATION_OPACITY        = (1 << 1),
-       IVI_NOTIFICATION_SOURCE_RECT    = (1 << 2),
-       IVI_NOTIFICATION_DEST_RECT      = (1 << 3),
-       IVI_NOTIFICATION_DIMENSION      = (1 << 4),
-       IVI_NOTIFICATION_POSITION       = (1 << 5),
-       IVI_NOTIFICATION_ORIENTATION    = (1 << 6),
-       IVI_NOTIFICATION_VISIBILITY     = (1 << 7),
-       IVI_NOTIFICATION_PIXELFORMAT    = (1 << 8),
-       IVI_NOTIFICATION_ADD            = (1 << 9),
-       IVI_NOTIFICATION_REMOVE         = (1 << 10),
-       IVI_NOTIFICATION_CONFIGURE      = (1 << 11),
+       IVI_NOTIFICATION_NONE        = 0,
+       IVI_NOTIFICATION_OPACITY     = (1 << 1),
+       IVI_NOTIFICATION_SOURCE_RECT = (1 << 2),
+       IVI_NOTIFICATION_DEST_RECT   = (1 << 3),
+       IVI_NOTIFICATION_DIMENSION   = (1 << 4),
+       IVI_NOTIFICATION_POSITION    = (1 << 5),
+       IVI_NOTIFICATION_ORIENTATION = (1 << 6),
+       IVI_NOTIFICATION_VISIBILITY  = (1 << 7),
+       IVI_NOTIFICATION_PIXELFORMAT = (1 << 8),
+       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
+       IVI_NOTIFICATION_ALL         = 0xFFFF
 };
 
 enum ivi_layout_transition_type{
@@ -514,6 +515,29 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
 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 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.
  *
@@ -643,6 +667,18 @@ ivi_layout_screen_get_output(struct ivi_layout_screen *);
 struct weston_surface *
 ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf);
 
+/**
+ * \brief Get size; width, height, and stride.
+ *
+ * \return IVI_SUCCEEDED if the method call was successful
+ * \return IVI_FAILED if the method call was failed
+ */
+int32_t
+ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf,
+                           int32_t *width,
+                           int32_t *height,
+                           int32_t *stride);
+
 int32_t
 ivi_layout_layer_set_transition(struct ivi_layout_layer *ivilayer,
                                enum ivi_layout_transition_type type,