summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>2022-12-08 13:28:33 +0700
committerTran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>2023-04-28 15:09:08 +0700
commit8a735a3ee6695778c9907f6bd044e9be7db1ef37 (patch)
tree827622855cae8244cdd66f0599dda1e14e726705
parent2113642587f98e2e4f82e4cb786a5740b555bc45 (diff)
downloadwayland-ivi-extension-8a735a3ee6695778c9907f6bd044e9be7db1ef37.tar.gz
ivi-input-modules: read default seat name from weston.ini file
Currently, the default seat name is "default". On weston 10, the wayland backend is using 'seat0' as the default seat name. This resulted in failing input examples and tests. To avoid this situation in the future, the default seat name should be configured in weston.ini file. Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
-rw-r--r--ivi-input-modules/ivi-input-controller/src/ivi-input-controller.c51
1 files changed, 46 insertions, 5 deletions
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 82900dc..a3c0ea5 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
@@ -73,6 +73,8 @@ struct input_context {
struct wl_listener surface_destroyed;
struct wl_listener compositor_destroy_listener;
struct wl_listener seat_create_listener;
+
+ char *seat_default_name;
};
enum kbd_events {
@@ -997,12 +999,12 @@ handle_seat_create(struct wl_listener *listener, void *data)
/* If default seat is created, we have to add it to the accepted_seat_list
* of all surfaces. Also we have to send an acceptance event to all clients */
- if (!strcmp(ctx->west_seat->seat_name, "default")) {
+ if (!strcmp(ctx->west_seat->seat_name, input_ctx->seat_default_name)) {
wl_list_for_each(surf, &input_ctx->ivishell->list_surface, link) {
add_accepted_seat(surf, ctx);
send_input_acceptance(input_ctx,
interface->get_id_of_surface(surf->layout_surface),
- "default", ILM_TRUE);
+ input_ctx->seat_default_name, ILM_TRUE);
}
}
}
@@ -1049,12 +1051,12 @@ handle_surface_create(struct wl_listener *listener, void *data)
wl_list_init(&ivisurface->accepted_seat_list);
- seat_ctx = input_ctrl_get_seat_ctx(input_ctx, "default");
+ seat_ctx = input_ctrl_get_seat_ctx(input_ctx, input_ctx->seat_default_name);
if (seat_ctx) {
add_accepted_seat(ivisurface, seat_ctx);
send_input_acceptance(input_ctx,
interface->get_id_of_surface(ivisurface->layout_surface),
- "default", ILM_TRUE);
+ input_ctx->seat_default_name, ILM_TRUE);
}
}
@@ -1263,6 +1265,10 @@ destroy_input_context(struct input_context *ctx)
* free up the controller structure*/
wl_resource_destroy(resource);
}
+
+ if (ctx->seat_default_name) {
+ free(ctx->seat_default_name);
+ }
free(ctx);
}
@@ -1304,6 +1310,36 @@ input_controller_destroy(struct wl_listener *listener, void *data)
}
}
+static int
+get_config( struct input_context *ctx)
+{
+ int ret = 0;
+ struct weston_config *config = NULL;
+ struct weston_config_section *section = NULL;
+ ctx->seat_default_name = NULL;
+
+ config = wet_get_config(ctx->ivishell->compositor);
+ if (!config)
+ goto exit;
+
+ section = weston_config_get_section(config, "ivi-shell", NULL, NULL);
+ if (!section)
+ goto exit;
+
+ weston_config_section_get_string(section,
+ "default-seat",
+ &ctx->seat_default_name, "default");
+exit:
+ if (!ctx->seat_default_name) {
+ ctx->seat_default_name = strdup("default");
+ if (!ctx->seat_default_name) {
+ weston_log("%s: Failed to allocate memory for seat default name\n", __FUNCTION__);
+ ret = -1;
+ }
+ }
+
+ return ret;
+}
static struct input_context *
create_input_context(struct ivishell *shell)
@@ -1321,6 +1357,12 @@ create_input_context(struct ivishell *shell)
wl_list_init(&ctx->resource_list);
wl_list_init(&ctx->seat_list);
+ /* get the default seat*/
+ if (get_config(ctx) != 0) {
+ free(ctx);
+ return NULL;
+ }
+
/* Add signal handlers for ivi surfaces. */
ctx->surface_created.notify = handle_surface_create;
ctx->surface_destroyed.notify = handle_surface_destroy;
@@ -1341,7 +1383,6 @@ create_input_context(struct ivishell *shell)
return ctx;
}
-
static int
input_controller_init(struct ivishell *shell)
{