summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Friedrich <efriedrich@de.adit-jv.com>2023-01-07 13:40:19 +0100
committerEugen Friedrich <efriedrich@de.adit-jv.com>2023-01-07 13:40:19 +0100
commiteaf7f8aada22ce8bf9e9a2b49bf6a232370aad23 (patch)
tree52a5d3b4d136b5021d7b21d524f1e79c955c2a3b
parent936705f9df8117e428d703e0c57f5d6e6cb5133b (diff)
parent8fbf58778215df0c8286c14e0fe88f59c95f9ae4 (diff)
downloadwayland-ivi-extension-eaf7f8aada22ce8bf9e9a2b49bf6a232370aad23.tar.gz
Merge remote-tracking branch 'upstream/pull/139'
* upstream/pull/139 multi-touch-viewer: add the type of shell selection input Reviewed-by: Eugen Friedrich <efriedrich@de.adit-jv.com> Reviewed-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com> Tested-by: Doan Ngoc Au <au.doanngoc@vn.bosch.com>
-rw-r--r--ivi-layermanagement-examples/multi-touch-viewer/include/window.h9
-rw-r--r--ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c72
-rw-r--r--ivi-layermanagement-examples/multi-touch-viewer/src/window.c9
3 files changed, 64 insertions, 26 deletions
diff --git a/ivi-layermanagement-examples/multi-touch-viewer/include/window.h b/ivi-layermanagement-examples/multi-touch-viewer/include/window.h
index 40e2925..d81dda6 100644
--- a/ivi-layermanagement-examples/multi-touch-viewer/include/window.h
+++ b/ivi-layermanagement-examples/multi-touch-viewer/include/window.h
@@ -46,6 +46,12 @@ struct Task
struct wl_list link;
};
+enum TypeOfShell
+{
+ WL_SHELL = 1,
+ IVI_SHELL = 2
+};
+
struct WaylandDisplay
{
struct Task display_task;
@@ -57,6 +63,7 @@ struct WaylandDisplay
EGLDisplay egldisplay;
EGLConfig eglconfig;
EGLContext eglcontext;
+ enum TypeOfShell shell_type;
int running;
int epoll_fd;
@@ -102,7 +109,7 @@ struct WaylandEglWindow
};
struct WaylandDisplay*
-CreateDisplay(int argc, char **argv);
+CreateDisplay(int argc, char **argv, enum TypeOfShell shell_type);
void
DestroyDisplay(struct WaylandDisplay *p_display);
diff --git a/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c b/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c
index 6645730..5d97ad4 100644
--- a/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c
+++ b/ivi-layermanagement-examples/multi-touch-viewer/src/multi-touch-viewer.c
@@ -30,6 +30,7 @@
#include <sys/stat.h>
#include <wayland-client-protocol.h>
#include "multi-touch-viewer.h"
+#include "getopt.h"
#define WINDOW_TITLE "multi_touch_viewer"
#define WINDOW_WIDTH 1080
@@ -69,6 +70,7 @@ static const char *gp_frag_shader_text =
static struct touch_event_test_params *gp_test_params = NULL;
static int g_is_print_log = 0;
+static enum TypeOfShell g_shell_type = IVI_SHELL;
/******************************************************************************/
@@ -587,7 +589,7 @@ setup_signal()
/******************************************************************************/
-int
+static int
touch_event_test_main(struct touch_event_test_params *p_params)
{
struct WaylandDisplay *p_display;
@@ -595,7 +597,7 @@ touch_event_test_main(struct touch_event_test_params *p_params)
setup_signal();
- p_display = CreateDisplay(0, NULL);
+ p_display = CreateDisplay(0, NULL, g_shell_type);
if (NULL == p_display)
{
LOG_ERROR("Failed to create display\n");
@@ -641,39 +643,65 @@ touch_event_test_main(struct touch_event_test_params *p_params)
return 0;
}
-void
+static void
usage(int status)
{
- printf("usage: multi-touch-viewer [OPTION]\n");
- printf(" -p : print received touch point\n");
+ fprintf(stderr, " -h, --help display this help and exit.\n"
+ " -p, --print-log print received touch point.\n"
+ " -s, --shell-type select the type of shell, default is the ivi_shell:\n"
+ " - wl_shell: to using the wl_shell.\n"
+ " - ivi_shell: to using the ivi_shell.\n");
exit(status);
}
-int
-main(int argc, char **argv)
+static void
+parse_options(int argc, char *argv[])
{
- _UNUSED_(argc);
- _UNUSED_(argv);
- struct touch_event_test_params params;
+ int opt = -1, option_index = 0;
+ static const struct option options[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "print-log", no_argument, NULL, 'p' },
+ { "shell-type", required_argument, NULL, 's' },
+ { 0, 0, NULL, 0 }
+ };
- memset(&params, 0x00, sizeof params);
+ while (1) {
+ opt = getopt_long(argc, argv, "hps:", options, NULL);
- if (argc == 2)
- {
- if (0 == strcmp(argv[1], "-p"))
- {
- g_is_print_log = 1;
- }
- else
- {
- usage(EXIT_SUCCESS);
+ if (opt == -1)
+ break;
+
+ switch (opt) {
+ case 'h':
+ usage(0);
+ break;
+ case 'p':
+ g_is_print_log = 1;
+ break;
+ case 's':
+ if (strcmp(optarg, "wl_shell") == 0)
+ g_shell_type = WL_SHELL;
+ break;
+ default:
+ usage(-1);
+ break;
}
}
+ printf("multi-touch-viewer runs with %s and logging %s\n",
+ (g_shell_type == WL_SHELL) ? "wl_shell" : "ivi_shell",
+ (g_is_print_log == 1) ? "enable" : "disable");
+}
- gp_test_params = &params;
+int
+main(int argc, char **argv)
+{
+ parse_options(argc, argv);
- wl_list_init(&params.touch_point_list);
+ struct touch_event_test_params params;
+ memset(&params, 0x00, sizeof params);
+ gp_test_params = &params;
+ wl_list_init(&params.touch_point_list);
log_array_init(&params.log_array, 500);
return touch_event_test_main(&params);
diff --git a/ivi-layermanagement-examples/multi-touch-viewer/src/window.c b/ivi-layermanagement-examples/multi-touch-viewer/src/window.c
index 41b02a9..abd7788 100644
--- a/ivi-layermanagement-examples/multi-touch-viewer/src/window.c
+++ b/ivi-layermanagement-examples/multi-touch-viewer/src/window.c
@@ -79,12 +79,14 @@ registry_handle_global(void *p_data, struct wl_registry *p_registry,
p_display->p_compositor = wl_registry_bind(p_registry, id,
&wl_compositor_interface, 1);
}
- else if (0 == strcmp(p_interface, "wl_shell"))
+ else if ((0 == strcmp(p_interface, "wl_shell")) &&
+ (p_display->shell_type == WL_SHELL))
{
p_display->p_shell = wl_registry_bind(p_registry, id,
&wl_shell_interface, 1);
}
- else if (0 == strcmp(p_interface, "ivi_application"))
+ else if ((0 == strcmp(p_interface, "ivi_application")) &&
+ (p_display->shell_type == IVI_SHELL))
{
p_display->p_ivi_application = wl_registry_bind(p_registry, id,
&ivi_application_interface, 1);
@@ -500,7 +502,7 @@ DisplayAcquireWindowSurface(struct WaylandDisplay *p_display,
}
struct WaylandDisplay *
-CreateDisplay(int argc, char **argv)
+CreateDisplay(int argc, char **argv, enum TypeOfShell shell_type)
{
struct WaylandDisplay *p_display;
@@ -521,6 +523,7 @@ CreateDisplay(int argc, char **argv)
return NULL;
}
+ p_display->shell_type = shell_type;
p_display->epoll_fd = os_epoll_create_cloexec();
p_display->display_fd = wl_display_get_fd(p_display->p_display);
p_display->display_task.run = handle_display_data;