summaryrefslogtreecommitdiff
path: root/tests/test-homescreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-homescreen.c')
-rw-r--r--tests/test-homescreen.c903
1 files changed, 740 insertions, 163 deletions
diff --git a/tests/test-homescreen.c b/tests/test-homescreen.c
index bb761a3..1e2949e 100644
--- a/tests/test-homescreen.c
+++ b/tests/test-homescreen.c
@@ -1,13 +1,27 @@
/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright © 2012 Intel Corporation
+ * Copyright © 2013 TOYOTA MOTOR CORPORATION
*
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
*
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
*/
/**
- * @brief HomeScreen for uint test of Weston(Wayland) IVI plugins
+ * @brief HomeScreen for unit test of Weston(Wayland) IVI plugins
*
* @date Feb-08-2013
*/
@@ -25,22 +39,27 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/mman.h>
#include <signal.h>
+#include <fcntl.h>
#include <linux/input.h>
#include <wayland-client.h>
-#include "ico_ivi_shell-client-protocol.h"
#include "ico_window_mgr-client-protocol.h"
#include "ico_input_mgr-client-protocol.h"
+#include "ico_input_mgr.h"
#include "test-common.h"
#define MAX_APPID 128
-#define ICO_IVI_MAX_COORDINATE 16383
+#define SHM_SIZE (16*1024*1024)
+#define MAX_CON_NAME 127
+#define MAX_OUTPUT 8
struct surface_name {
struct surface_name *next;
int surfaceid;
int pid;
char appid[MAX_APPID];
+ int node;
int x;
int y;
int width;
@@ -48,20 +67,18 @@ struct surface_name {
int visible;
};
-#define MAX_CON_NAME 127
-
struct display {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
- struct ico_ivi_shell *ico_ivi_shell;
struct ico_window_mgr *ico_window_mgr;
struct ico_input_mgr_control *ico_input_mgr;
struct ico_input_mgr_device *ico_input_device;
struct ico_exinput *ico_exinput;
struct input *input;
- struct output *output;
+ int num_output;
+ struct output *output[MAX_OUTPUT];
struct surface *surface;
struct surface_name *surface_name;
struct surface_name *bgsurface_name;
@@ -81,6 +98,7 @@ struct input {
struct wl_seat *seat;
struct wl_pointer *pointer;
struct wl_keyboard *keyboard;
+ struct wl_touch *touch;
float x, y;
uint32_t button_mask;
struct surface *pointer_focus;
@@ -216,6 +234,39 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
print_log("HOMESCREEN: got keyboard modifier");
}
+static void
+touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+ struct wl_surface *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+ print_log("HOMESCREEN: got touch down %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+ int32_t id)
+{
+ print_log("HOMESCREEN: got touch up %d", id);
+}
+
+static void
+touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time,
+ int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+ print_log("HOMESCREEN: got touch motion %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_frame(void *data, struct wl_touch *wl_touch)
+{
+ print_log("HOMESCREEN: got touch frame");
+}
+
+static void
+touch_handle_cancel(void *data, struct wl_touch *wl_touch)
+{
+ print_log("HOMESCREEN: got touch cancel");
+}
+
static const struct wl_pointer_listener pointer_listener = {
pointer_handle_enter,
pointer_handle_leave,
@@ -232,33 +283,57 @@ static const struct wl_keyboard_listener keyboard_listener = {
keyboard_handle_modifiers,
};
+static const struct wl_touch_listener touch_listener = {
+ touch_handle_down,
+ touch_handle_up,
+ touch_handle_motion,
+ touch_handle_frame,
+ touch_handle_cancel
+};
+
static void
seat_handle_capabilities(void *data, struct wl_seat *seat,
enum wl_seat_capability caps)
{
struct input *input = data;
+ print_log("HOMESCREEN: seat_handle_capabilities caps=%x", caps);
+
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
input->pointer = wl_seat_get_pointer(seat);
+ print_log("HOMESCREEN: seat_handle_capabilities add pointer=%x", (int)input->pointer);
wl_pointer_set_user_data(input->pointer, input);
- wl_pointer_add_listener(input->pointer, &pointer_listener,
- input);
+ wl_pointer_add_listener(input->pointer, &pointer_listener, input);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
+ print_log("HOMESCREEN: seat_handle_capabilities delete pointer");
wl_pointer_destroy(input->pointer);
input->pointer = NULL;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
input->keyboard = wl_seat_get_keyboard(seat);
+ print_log("HOMESCREEN: seat_handle_capabilities add keyboard=%x", (int)input->keyboard);
wl_keyboard_set_user_data(input->keyboard, input);
- wl_keyboard_add_listener(input->keyboard, &keyboard_listener,
- input);
+ wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
+ print_log("HOMESCREEN: seat_handle_capabilities delete keyboard");
wl_keyboard_destroy(input->keyboard);
input->keyboard = NULL;
}
+
+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
+ input->touch = wl_seat_get_touch(seat);
+ print_log("HOMESCREEN: seat_handle_capabilities add touch=%x", (int)input->touch);
+ wl_touch_set_user_data(input->touch, input);
+ wl_touch_add_listener(input->touch, &touch_listener, input);
+ }
+ else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
+ print_log("HOMESCREEN: seat_handle_capabilities delete touch");
+ wl_touch_destroy(input->touch);
+ input->touch = NULL;
+ }
}
static const struct wl_seat_listener seat_listener = {
@@ -292,7 +367,7 @@ static const struct wl_surface_listener surface_listener = {
};
static void
-create_surface(struct display *display)
+create_surface(struct display *display, const char *title)
{
struct surface *surface;
int id;
@@ -309,6 +384,7 @@ create_surface(struct display *display)
wl_shell_get_shell_surface(display->shell, surface->surface);
if (surface->shell_surface) {
wl_shell_surface_set_toplevel(surface->shell_surface);
+ wl_shell_surface_set_title(surface->shell_surface, title);
}
}
wl_display_flush(display->display);
@@ -325,7 +401,8 @@ create_surface(struct display *display)
surface->egl_surface = opengl_create_window(display->display, surface->surface,
surface->dpy, surface->conf,
surface->ctx, display->init_width,
- display->init_height, display->init_color);
+ display->init_height,
+ display->init_color);
clear_surface(display);
print_log("HOMESCREEN: created egl_surface %08x", (int)surface->egl_surface);
}
@@ -335,7 +412,7 @@ static void
clear_surface(struct display *display)
{
if (! display->surface) {
- create_surface(display);
+ create_surface(display, "HomeScreen-BG");
}
else {
opengl_clear_window(display->init_color);
@@ -351,6 +428,9 @@ output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
{
struct output *output = data;
+ print_log("HOMESCREEN: Event[handle_geometry] %08x x/y=%d/%d p.w/h=%d/%d trans=%d",
+ (int)wl_output, x, y, physical_width, physical_height, transform);
+
output->x = x;
output->y = y;
}
@@ -361,26 +441,26 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
{
struct output *output = data;
+ print_log("HOMESCREEN: Event[handle_mode] %08x x/y=%d/%d flags=%08x refresh=%d",
+ (int)wl_output, width, height, flags, refresh);
+
if (flags & WL_OUTPUT_MODE_CURRENT) {
struct display *display = output->display;
output->width = width;
output->height = height;
- print_log("HOMESCREEN: Event[handle_mode] x/y=%d/%d bgsurf=%08x",
- width, height, (int)display->bgsurface_name);
-
display->init_width = width;
display->init_height = height;
if (display->bgsurface_name) {
ico_window_mgr_set_positionsize(display->ico_window_mgr,
display->bgsurface_name->surfaceid,
- 0, 0, width, height);
+ 0, 0, 0, 0, width, height);
}
else if (display->bg_created == 0) {
display->bg_created = 9;
- create_surface(output->display);
+ create_surface(display, "HomeScreen-BG");
}
}
}
@@ -402,10 +482,14 @@ search_surface(struct display *display, const char *surfname)
}
if (p) {
- return(p->surfaceid);
+ return p->surfaceid;
}
else {
- return(-1);
+ if ((strcasecmp(surfname, "all") == 0) ||
+ (strcasecmp(surfname, "main") == 0)) {
+ return ICO_WINDOW_MGR_V_MAINSURFACE;
+ }
+ return -1;
}
}
@@ -419,7 +503,10 @@ search_surfacename(struct display *display, const char *surfname)
if (strcmp(p->appid, surfname) == 0) break;
p = p->next;
}
- return(p);
+ if (! p) {
+ print_log("HOMESCREEN: app(%s) dose not exist", surfname);
+ }
+ return p;
}
static struct surface_name *
@@ -430,16 +517,16 @@ search_surfaceid(struct display *display, const int surfaceid)
p = display->surface_name;
while (p) {
if (p->surfaceid == surfaceid) {
- return(p);
+ return p;
}
p = p->next;
}
- return(NULL);
+ return NULL;
}
static void
window_created(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, int32_t pid, const char *appid)
+ uint32_t surfaceid, const char *winname, int32_t pid, const char *appid)
{
struct display *display = data;
struct surface_name *p;
@@ -454,12 +541,12 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
p = p->next;
}
if (p) {
- print_log("HOMESCREEN: Event[window_created] surface=%08x(app=%s) exist",
- (int)surfaceid, appid);
+ print_log("HOMESCREEN: Event[window_created] surface=%08x(app=%s,name=%s) exist",
+ (int)surfaceid, appid, winname);
}
else {
- print_log("HOMESCREEN: Event[window_created] new surface=%08x(app=%s)",
- (int)surfaceid, appid);
+ print_log("HOMESCREEN: Event[window_created] new surface=%08x(app=%s) winname=%s",
+ (int)surfaceid, appid, winname);
p = malloc(sizeof(struct surface_name));
if (! p) {
return;
@@ -479,7 +566,7 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
/* Set default size and show */
if (p->width > 0) {
ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
- p->x, p->y, p->width, p->height);
+ 0, p->x, p->y, p->width, p->height, 0);
}
print_log("HOMESCREEN: Created window[%08x] (app=%s)", (int)surfaceid, appid);
@@ -489,9 +576,10 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
if (display->bg_created == 1) {
display->bg_created = 9;
ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
- 0, 0, display->init_width, display->init_height);
+ 0, 0, 0,
+ display->init_width, display->init_height, 0);
}
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 0);
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 0, 0);
print_log("HOMESCREEN: Created window[%08x] (app=%s) Visible",
(int)surfaceid, appid);
p->visible = 1;
@@ -499,6 +587,13 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
}
static void
+window_name(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t surfaceid, const char *winname)
+{
+ print_log("HOMESCREEN: Window Name[%08x] (name=%s)", (int)surfaceid, winname);
+}
+
+static void
window_destroyed(void *data, struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid)
{
struct display *display = data;
@@ -544,54 +639,111 @@ window_visible(void *data, struct ico_window_mgr *ico_window_mgr,
}
else {
print_log("HOMESCREEN: Event[window_visible] surface=%08x "
- "visible=%d raise=%d hint=%d",
- (int)surfaceid, visible, raise, hint);
+ "visible=%d raise=%d hint=%d", (int)surfaceid, visible, raise, hint);
p->visible = visible;
- if (hint == 0) {
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, visible, 9);
+ if (hint == 1) {
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+ visible, ICO_WINDOW_MGR_V_NOCHANGE, 0);
}
}
}
static void
window_configure(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, const char *appid, int32_t layer,
+ uint32_t surfaceid, uint32_t node, uint32_t layer,
int32_t x, int32_t y, int32_t width, int32_t height, int32_t hint)
{
struct display *display = data;
struct surface_name *p;
print_log("HOMESCREEN: Event[window_configure] surface=%08x "
- "app=%s x/y=%d/%d w/h=%d/%d hint=%d",
- (int)surfaceid, appid, x, y, width, height, hint);
+ "node=%x x/y=%d/%d w/h=%d/%d hint=%d",
+ (int)surfaceid, node, x, y, width, height, hint);
p = search_surfaceid(display, (int)surfaceid);
if (! p) {
- print_log("HOMESCREEN: Event[window_configure] surface=%08x(app=%s) new create",
- (int)surfaceid, appid);
- window_created(data, ico_window_mgr, surfaceid, 0, appid);
- p = search_surfaceid(display, (int)surfaceid);
- if (! p) {
- print_log("HOMESCREEN: Event[window_configure] can not make table");
- return;
- }
+ print_log("HOMESCREEN: Event[window_configure] surface=%08x dose not exist",
+ (int)surfaceid);
+ }
+ else {
+ p->node = node;
}
}
static void
+window_layer_visible(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t layer, int32_t visible)
+{
+ print_log("HOMESCREEN: Event[layer_visible]layer=%x visible=%d",
+ (int)layer, visible);
+}
+
+static void
window_active(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, const uint32_t active)
+ uint32_t surfaceid, const int32_t active)
{
print_log("HOMESCREEN: Event[window_active] surface=%08x acive=%d",
(int)surfaceid, (int)active);
+ if ((surfaceid & 0x0000ffff) == 0x0001) {
+ ico_window_mgr_set_visible(ico_window_mgr, surfaceid,
+ ICO_WINDOW_MGR_V_NOCHANGE, 0, 0);
+ }
+}
+
+static void
+window_surfaces(void *data, struct ico_window_mgr *ico_window_mgr,
+ const char *appid, struct wl_array *surfaces)
+{
+ print_log("HOMESCREEN: Event[app_surfaces] app=%s", appid);
+}
+
+static void
+window_map(void *data, struct ico_window_mgr *ico_window_mgr,
+ int32_t event, uint32_t surfaceid, uint32_t type, uint32_t target,
+ int32_t width, int32_t height, int32_t stride, uint32_t format)
+{
+#if 0
+ struct display *display = data;
+#endif
+ char sevt[16];
+
+ switch (event) {
+ case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS:
+ strcpy(sevt, "Contents"); break;
+ case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE:
+ strcpy(sevt, "Resize"); break;
+ case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP:
+ strcpy(sevt, "Map"); break;
+ case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP:
+ strcpy(sevt, "Unmap"); break;
+ case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR:
+ sprintf(sevt, "Error %d", type); break;
+ default:
+ sprintf(sevt, "??%d??", event); break;
+ }
+ print_log("HOMESCREEN: Event[map_surface] ev=%s(%d) surf=%08x type=%d target=%x "
+ "w/h/s/f=%d/%d/%d/%x",
+ sevt, event, (int)surfaceid, type, target, width, height, stride, format);
+#if 0
+ if ((event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP) ||
+ (event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS)) {
+ opengl_thumbnail(display->display, surfaceid, display->surface->dpy,
+ display->surface->conf, display->surface->egl_surface,
+ display->surface->ctx, target, width, height, stride, format);
+ }
+#endif
}
static const struct ico_window_mgr_listener window_mgr_listener = {
window_created,
+ window_name,
window_destroyed,
window_visible,
window_configure,
- window_active
+ window_active,
+ window_layer_visible,
+ window_surfaces,
+ window_map
};
static void
@@ -626,6 +778,56 @@ static const struct ico_exinput_listener exinput_listener = {
};
static void
+cb_input_regions(void *data, struct ico_input_mgr_device *ico_input_mgr_device,
+ struct wl_array *regions)
+{
+ struct ico_uifw_input_region *region;
+ int n;
+ char schange[16];
+
+ n = 0;
+ if (regions) {
+ wl_array_for_each(region, regions) {
+ n ++;
+ print_log("HOMESCREEN: Event[input_regions] number of regions=%d", n);
+ }
+ n = 0;
+ wl_array_for_each(region, regions) {
+ n ++;
+ switch (region->change) {
+ case ICO_INPUT_MGR_DEVICE_REGION_ADD:
+ strcpy(schange, "Add");
+ break;
+ case ICO_INPUT_MGR_DEVICE_REGION_REMOVE:
+ strcpy(schange, "Remove");
+ break;
+ case ICO_INPUT_MGR_DEVICE_REGION_REMOVEALL:
+ strcpy(schange, "RemoveAll");
+ break;
+ default:
+ sprintf(schange, "?%d?", region->change);
+ break;
+ }
+ print_log("HOMESCREEN:%2d. %s %d.%08(%d/%d) &d/%d-%d/%d "
+ "hot=%d/%d cur=%d/%d-%d/%d attr=%x",
+ n, schange, region->node, region->surfaceid, region->surface_x,
+ region->surface_y, region->x, region->y, region->width,
+ region->height, region->hotspot_x, region->hotspot_y,
+ region->cursor_x, region->cursor_y, region->cursor_width,
+ region->cursor_height, region->attr);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: Event[input_regions] no region");
+ }
+}
+
+static const struct ico_input_mgr_device_listener device_listener = {
+ cb_input_regions
+};
+
+
+static void
handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
@@ -637,14 +839,12 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
if (strcmp(interface, "wl_compositor") == 0) {
display->compositor =
- wl_registry_bind(display->registry,
- id, &wl_compositor_interface, 1);
+ wl_registry_bind(display->registry, id, &wl_compositor_interface, 1);
}
else if (strcmp(interface, "wl_seat") == 0) {
input = calloc(1, sizeof *input);
input->display = display;
- input->seat = wl_registry_bind(display->registry, id,
- &wl_seat_interface, 1);
+ input->seat = wl_registry_bind(display->registry, id, &wl_seat_interface, 1);
input->pointer_focus = NULL;
input->keyboard_focus = NULL;
@@ -652,60 +852,52 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
display->input = input;
}
else if (strcmp(interface, "wl_output") == 0) {
- output = malloc(sizeof *output);
- output->display = display;
- output->output = wl_registry_bind(display->registry,
- id, &wl_output_interface, 1);
- wl_output_add_listener(output->output,
- &output_listener, output);
- display->output = output;
+ if (display->num_output < MAX_OUTPUT) {
+ output = malloc(sizeof *output);
+ output->display = display;
+ output->output = wl_registry_bind(display->registry, id, &wl_output_interface, 1);
+ wl_output_add_listener(output->output, &output_listener, output);
+ display->output[display->num_output] = output;
- print_log("HOMESCREEN: created output global %p", display->output);
+ print_log("HOMESCREEN: created output[%d] global %p",
+ display->num_output, display->output[display->num_output]);
+ display->num_output ++;
+ }
}
else if (strcmp(interface, "wl_shell") == 0) {
display->shell =
- wl_registry_bind(display->registry,
- id, &wl_shell_interface, 1);
- }
- else if (strcmp(interface, "ico_ivi_shell") == 0) {
- display->ico_ivi_shell =
- wl_registry_bind(display->registry,
- id, &ico_ivi_shell_interface, 1);
+ wl_registry_bind(display->registry, id, &wl_shell_interface, 1);
}
else if (strcmp(interface, "ico_window_mgr") == 0) {
display->ico_window_mgr =
- wl_registry_bind(display->registry,
- id, &ico_window_mgr_interface, 1);
- ico_window_mgr_add_listener(display->ico_window_mgr,
- &window_mgr_listener, display);
+ wl_registry_bind(display->registry, id, &ico_window_mgr_interface, 1);
+ ico_window_mgr_add_listener(display->ico_window_mgr, &window_mgr_listener, display);
print_log("HOMESCREEN: created window_mgr global %p", display->ico_window_mgr);
- ico_window_mgr_set_eventcb(display->ico_window_mgr, 1);
+ ico_window_mgr_declare_manager(display->ico_window_mgr, 1);
}
else if (strcmp(interface, "ico_input_mgr_control") == 0) {
- display->ico_input_mgr =
- wl_registry_bind(display->registry,
- id, &ico_input_mgr_control_interface, 1);
+ display->ico_input_mgr = wl_registry_bind(display->registry, id,
+ &ico_input_mgr_control_interface, 1);
print_log("HOMESCREEN: created input_mgr global %p", display->ico_input_mgr);
}
else if (strcmp(interface, "ico_input_mgr_device") == 0) {
- display->ico_input_device =
- wl_registry_bind(display->registry,
- id, &ico_input_mgr_device_interface, 1);
+ display->ico_input_device = wl_registry_bind(display->registry, id,
+ &ico_input_mgr_device_interface, 1);
+ ico_input_mgr_device_add_listener(display->ico_input_device,
+ &device_listener, display);
print_log("HOMESCREEN: created input_device global %p", display->ico_input_device);
}
else if (strcmp(interface, "ico_exinput") == 0) {
display->ico_exinput =
- wl_registry_bind(display->registry,
- id, &ico_exinput_interface, 1);
- ico_exinput_add_listener(display->ico_exinput,
- &exinput_listener, display);
+ wl_registry_bind(display->registry, id, &ico_exinput_interface, 1);
+ ico_exinput_add_listener(display->ico_exinput, &exinput_listener, display);
print_log("HOMESCREEN: created exinput global %p", display->ico_exinput);
- ico_window_mgr_set_eventcb(display->ico_window_mgr, 1);
+ ico_window_mgr_declare_manager(display->ico_window_mgr, 1);
display->bg_created = 1;
- create_surface(display);
+ create_surface(display, "HomeScreen-BG");
}
}
@@ -713,41 +905,6 @@ static const struct wl_registry_listener registry_listener = {
handle_global
};
-static char *
-skip_spaces(char *buf)
-{
- while ((*buf == ' ') || (*buf == '\t')) {
- buf++;
- }
- return(buf);
-}
-
-static int
-pars_command(char *buf, char *pt[], const int len)
-{
- char *p;
- int narg;
-
- memset(pt, 0, sizeof(int *)*10);
- p = buf;
- for (narg = 0; narg < len; narg++) {
- p = skip_spaces(p);
- if (*p == 0) break;
- pt[narg] = p;
- for (; *p; p++) {
- if ((*p == ' ') || (*p == '\t') ||
- (*p == '=') || (*p == ',')) break;
- }
- if (*p == 0) {
- narg++;
- break;
- }
- *p = 0;
- p++;
- }
- return (narg);
-}
-
static void
launch_app(struct display *display, char *buf)
{
@@ -775,7 +932,10 @@ kill_app(struct display *display, char *buf)
narg = pars_command(buf, args, 10);
if (narg >= 1) {
p = search_surfacename(display, args[0]);
- if (kill(p->pid, SIGINT) < 0) {
+ if (! p) {
+ print_log("HOMESCREEN: kill[%s] Application dose not exist", args[0]);
+ }
+ else if (kill(p->pid, SIGINT) < 0) {
print_log("HOMESCREEN: kill[%s.%d] Application dose not exist",
p->appid, p->pid);
}
@@ -843,31 +1003,46 @@ static void
positionsize_surface(struct display *display, char *buf)
{
char *args[10];
+ struct surface_name *p;
int narg;
int surfaceid;
int x, y, width, height;
+ int anima = 0;
+ int node = 0;
narg = pars_command(buf, args, 10);
if (narg >= 5) {
surfaceid = search_surface(display, args[0]);
+ p = search_surfacename(display, args[0]);
x = strtol(args[1], (char **)0, 0);
y = strtol(args[2], (char **)0, 0);
width = strtol(args[3], (char **)0, 0);
height = strtol(args[4], (char **)0, 0);
+ if (narg >= 6) {
+ node = strtol(args[5], (char **)0, 0);
+ if (p) {
+ p->node = node;
+ }
+ }
+ else if (p) {
+ node = p->node;
+ }
+ if (narg >= 7) {
+ anima = strtol(args[6], (char **)0, 0);
+ }
if ((surfaceid >= 0) && (x >= 0) && (y >=0) && (width >= 0) && (height >=0)) {
- print_log("HOMESCREEN: set_positionsize(%s,%08x,%d,%d,%d,%d)",
- args[0], surfaceid, x, y, width, height);
+ print_log("HOMESCREEN: set_positionsize(%s,%08x,%d,%d,%d,%d,%d)",
+ args[0], surfaceid, node, x, y, width, height);
ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
- x, y, width, height);
+ node, x, y, width, height, anima);
}
else {
- print_log("HOMESCREEN: Unknown surface(%s) at positionsize command",
- args[0]);
+ print_log("HOMESCREEN: Unknown surface(%s) at positionsize command", args[0]);
}
}
else {
print_log("HOMESCREEN: positionsize command"
- "[positionsize appid x y width heigh] has no argument");
+ "[positionsize appid x y width heigh node anima] has no argument");
}
}
@@ -875,27 +1050,48 @@ static void
move_surface(struct display *display, char *buf)
{
char *args[10];
+ struct surface_name *p;
int narg;
int surfaceid;
int x, y;
+ int anima = 0;
+ int node = 0;
narg = pars_command(buf, args, 10);
if (narg >= 3) {
surfaceid = search_surface(display, args[0]);
+ p = search_surfacename(display, args[0]);
x = strtol(args[1], (char **)0, 0);
y = strtol(args[2], (char **)0, 0);
+ if (narg >= 4) {
+ node = strtol(args[3], (char **)0, 0);
+ if (node < 0) {
+ if (p) node = p->node;
+ else node = 0;
+ }
+ if (p) p->node = node;
+ }
+ else if (p) {
+ node = p->node;
+ }
+ if (narg >= 5) {
+ anima = strtol(args[4], (char **)0, 0);
+ }
+
if ((surfaceid >= 0) && (x >= 0) && (y >=0)) {
- print_log("HOMESCREEN: move(%s,%08x,%d,%d)", args[0], surfaceid, x, y);
+ print_log("HOMESCREEN: move(%s,%08x,%d.%d,%d anima=%d)", args[0], surfaceid,
+ node, x, y, anima);
ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
- x, y,
- ICO_IVI_MAX_COORDINATE+1, ICO_IVI_MAX_COORDINATE+1);
+ node, x, y,
+ ICO_WINDOW_MGR_V_NOCHANGE,
+ ICO_WINDOW_MGR_V_NOCHANGE, anima);
}
else {
print_log("HOMESCREEN: Unknown surface(%s) at move command", args[0]);
}
}
else {
- print_log("HOMESCREEN: move command[positionsize appid x y] has no argument");
+ print_log("HOMESCREEN: move command[positionsize appid x y node anima] has no argument");
}
}
@@ -903,20 +1099,32 @@ static void
resize_surface(struct display *display, char *buf)
{
char *args[10];
+ struct surface_name *p;
int narg;
int surfaceid;
int width, height;
+ int anima = 0;
+ int node = 0;
narg = pars_command(buf, args, 10);
if (narg >= 3) {
surfaceid = search_surface(display, args[0]);
+ p = search_surfacename(display, args[0]);
+ if (p) {
+ node = p->node;
+ }
width = strtol(args[1], (char **)0, 0);
height = strtol(args[2], (char **)0, 0);
+ if (narg >= 4) {
+ anima = strtol(args[3], (char **)0, 0);
+ }
+
if ((surfaceid >= 0) && (width >= 0) && (height >=0)) {
- print_log("HOMESCREEN: resize(%s,%08x,%d,%d)", args[0], surfaceid, width, height);
+ print_log("HOMESCREEN: resize(%s,%08x,%d.%d,%d,anima=%d)",
+ args[0], surfaceid, node, width, height, anima);
ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
- ICO_IVI_MAX_COORDINATE+1, ICO_IVI_MAX_COORDINATE+1,
- width, height);
+ node, ICO_WINDOW_MGR_V_NOCHANGE,
+ ICO_WINDOW_MGR_V_NOCHANGE, width, height, anima);
}
else {
print_log("HOMESCREEN: Unknown surface(%s) at resize command", args[0]);
@@ -924,7 +1132,7 @@ resize_surface(struct display *display, char *buf)
}
else {
print_log("HOMESCREEN: positionsize command"
- "[resize appid width heigh] has no argument");
+ "[resize appid width heigh anima] has no argument");
}
}
@@ -936,24 +1144,29 @@ visible_surface(struct display *display, char *buf)
int surfaceid;
int visible;
int raise;
+ int anima = 0;
narg = pars_command(buf, args, 10);
if (narg >= 3) {
surfaceid = search_surface(display, args[0]);
visible = strtol(args[1], (char **)0, 0);
raise = strtol(args[2], (char **)0, 0);
+ if (narg >= 4) {
+ anima = strtol(args[3], (char **)0, 0);
+ }
if ((surfaceid >= 0) && (visible >= 0) && (raise >=0)) {
- print_log("HOMESCREEN: visible(%s,%08x,%d,%d)",
- args[0], surfaceid, visible, raise);
+ print_log("HOMESCREEN: visible(%s,%08x,%d,%d,%d)",
+ args[0], surfaceid, visible, raise, anima);
ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
- visible, raise);
+ visible, raise, anima);
}
else {
print_log("HOMESCREEN: Unknown surface(%s) at visible command", args[0]);
}
}
else {
- print_log("HOMESCREEN: visible command[visible appid visible raise] has no argument");
+ print_log("HOMESCREEN: visible command[visible appid visible raise] "
+ "has no argument");
}
}
@@ -963,18 +1176,56 @@ show_surface(struct display *display, char *buf, const int show)
char *args[10];
int narg;
int surfaceid;
+ int anima = 0;
+ int ax = 0;
+ int ay = 0;
+ int awidth = 1;
+ int aheight = 1;
narg = pars_command(buf, args, 10);
if (narg >= 1) {
surfaceid = search_surface(display, args[0]);
+ if (narg >= 2) {
+ anima = strtol(args[1], (char **)0, 0);
+ if (anima >= 2) {
+ ax = 0;
+ ay = 0;
+ awidth = 1;
+ aheight = 1;
+ if (narg >= 3) ax = strtol(args[2], (char **)0, 0);
+ if (narg >= 4) ay = strtol(args[3], (char **)0, 0);
+ if (narg >= 5) awidth = strtol(args[4], (char **)0, 0);
+ if (narg >= 6) aheight = strtol(args[5], (char **)0, 0);
+ }
+ }
if (surfaceid >= 0) {
if (show) {
- print_log("HOMESCREEN: show(%s,%08x)", args[0], surfaceid);
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 9);
+ if (anima >= 2) {
+ print_log("HOMESCREEN: show anima(%s,%08x,x/y=%d/%d,w/h=%d/%d)",
+ args[0], surfaceid, ax, ay, awidth, aheight);
+ ico_window_mgr_visible_animation(display->ico_window_mgr, surfaceid,
+ 1, ax, ay, awidth, aheight);
+ }
+ else {
+ print_log("HOMESCREEN: show(%s,%08x,anima=%d)",
+ args[0], surfaceid, anima);
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+ 1, ICO_WINDOW_MGR_V_NOCHANGE, anima);
+ }
}
else {
- print_log("HOMESCREEN: hide(%s,%08x)", args[0], surfaceid);
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 0, 9);
+ if (anima >= 2) {
+ print_log("HOMESCREEN: hide anima(%s,%08x,x/y=%d/%d,w/h=%d/%d)",
+ args[0], surfaceid, ax, ay, awidth, aheight);
+ ico_window_mgr_visible_animation(display->ico_window_mgr, surfaceid,
+ 0, ax, ay, awidth, aheight);
+ }
+ else {
+ print_log("HOMESCREEN: hide(%s,%08x,anima=%d)",
+ args[0], surfaceid, anima);
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+ 0, ICO_WINDOW_MGR_V_NOCHANGE, anima);
+ }
}
}
else {
@@ -982,7 +1233,8 @@ show_surface(struct display *display, char *buf, const int show)
}
}
else {
- print_log("HOMESCREEN: show command[show/hide appid] has no argument");
+ print_log("HOMESCREEN: show command[show/hide appid anima x y width height]"
+ " has no argument");
}
}
@@ -992,18 +1244,24 @@ raise_surface(struct display *display, char *buf, const int raise)
char *args[10];
int narg;
int surfaceid;
+ int anima = 0;
narg = pars_command(buf, args, 10);
if (narg >= 1) {
surfaceid = search_surface(display, args[0]);
+ if (narg >= 2) {
+ anima = strtol(args[1], (char **)0, 0);
+ }
if (surfaceid >= 0) {
if (raise) {
- print_log("HOMESCREEN: raise(%s,%08x)", args[0], surfaceid);
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 9, 1);
+ print_log("HOMESCREEN: raise(%s,%08x,anima=%d)", args[0], surfaceid, anima);
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+ ICO_WINDOW_MGR_V_NOCHANGE, 1, anima);
}
else {
- print_log("HOMESCREEN: lower(%s,%08x)", args[0], surfaceid);
- ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 9, 0);
+ print_log("HOMESCREEN: lower(%s,%08x,anima=%d)", args[0], surfaceid, anima);
+ ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+ ICO_WINDOW_MGR_V_NOCHANGE, 0, anima);
}
}
else {
@@ -1011,7 +1269,116 @@ raise_surface(struct display *display, char *buf, const int raise)
}
}
else {
- print_log("HOMESCREEN: show command[raise/lower appid] has no argument");
+ print_log("HOMESCREEN: show command[raise/lower appid anima] has no argument");
+ }
+}
+
+static void
+active_window(struct display *display, char *buf)
+{
+ char *args[10];
+ int narg;
+ int surfaceid;
+ int target;
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 1) {
+ surfaceid = search_surface(display, args[0]);
+ if (narg >= 2) {
+ target = strtol(args[1], (char **)0, 0);
+ }
+ else {
+ target = ICO_WINDOW_MGR_ACTIVE_POINTER | ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
+ }
+ if (surfaceid >= 0) {
+ print_log("HOMESCREEN: active(%s,%08x,target=%x)", args[0], surfaceid, target);
+ ico_window_mgr_set_active(display->ico_window_mgr, surfaceid, target);
+ }
+ else {
+ print_log("HOMESCREEN: Unknown surface(%s) at active command", args[0]);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: active command[active appid[target]] has no argument");
+ }
+}
+
+
+static void
+animation_surface(struct display *display, char *buf)
+{
+ char *args[10];
+ int narg;
+ int surfaceid;
+ int time;
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 2) {
+ surfaceid = search_surface(display, args[0]);
+ if (surfaceid >= 0) {
+ if (narg >= 3) {
+ time = strtol(args[2], (char **)0, 0);
+ }
+ else {
+ time = 0;
+ }
+ print_log("HOMESCREEN: animation(%s,%08x,%s,%d)",
+ args[0], surfaceid, args[1], time);
+ ico_window_mgr_set_animation(display->ico_window_mgr, surfaceid, 0x7fffffff,
+ args[1], time);
+ }
+ else {
+ print_log("HOMESCREEN: Unknown surface(%s) at animation command", args[0]);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: animation command"
+ "[animation appid animation time] has no argument");
+ }
+}
+
+static void
+map_surface(struct display *display, char *buf, int map)
+{
+ char *args[10];
+ int narg;
+ int surfaceid;
+ int fps;
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 1) {
+ surfaceid = search_surface(display, args[0]);
+ if (surfaceid >= 0) {
+ if (narg >= 2) {
+ fps = strtol(args[1], (char **)0, 0);
+ }
+ else {
+ fps = 0;
+ }
+ if (map) {
+ print_log("HOMESCREEN: map surface(%s,%08x,%d)",
+ args[0], surfaceid, fps);
+ ico_window_mgr_map_surface(display->ico_window_mgr, surfaceid, fps);
+ }
+ else {
+ print_log("HOMESCREEN: unmap surface(%s,%08x)", args[0], surfaceid);
+ ico_window_mgr_unmap_surface(display->ico_window_mgr, surfaceid);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: Unknown surface(%s) at %s command", args[0],
+ map ? "map" : "unmap");
+ }
+ }
+ else {
+ if (map) {
+ print_log("HOMESCREEN: map surface command"
+ "[map surface framerate] has no argument");
+ }
+ else {
+ print_log("HOMESCREEN: unmap surface command"
+ "[unmap surface] has no argument");
+ }
}
}
@@ -1053,9 +1420,10 @@ input_add(struct display *display, char *buf)
fix = 0;
}
if ((input >= 0) && (fix >=0)) {
- print_log("HOMESCREEN: input_add(%s.%d to %s[%d])", args[0], input, args[2], fix);
+ print_log("HOMESCREEN: input_add(%s.%d to %s[%d])",
+ args[0], input, args[2], fix);
ico_input_mgr_control_add_input_app(display->ico_input_mgr,
- args[2], args[0], input, fix);
+ args[2], args[0], input, fix, 0);
}
else {
print_log("HOMESCREEN: Unknown input(%s) at input_add command", args[1]);
@@ -1097,6 +1465,98 @@ input_del(struct display *display, char *buf)
}
static void
+input_send(struct display *display, char *buf)
+{
+ char *args[10];
+ int narg;
+ int surfaceid;
+ int type;
+ int no;
+ int code;
+ int value;
+ char appid[64];
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 5) {
+ memset(appid, 0, sizeof(appid));
+ if (args[0][0] == '@') {
+ strncpy(appid, &args[0][1], sizeof(appid)-1);
+ surfaceid = 0;
+ }
+ else {
+ surfaceid = search_surface(display, args[0]);
+ }
+ if (strcasecmp(args[1], "POINTER") == 0) {
+ type = ICO_INPUT_MGR_DEVICE_TYPE_POINTER;
+ }
+ else if (strcasecmp(args[1], "KEYBOARD") == 0) {
+ type = ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD;
+ }
+ else if (strcasecmp(args[1], "TOUCH") == 0) {
+ type = ICO_INPUT_MGR_DEVICE_TYPE_TOUCH;
+ }
+ else if (strcasecmp(args[1], "SWITCH") == 0) {
+ type = ICO_INPUT_MGR_DEVICE_TYPE_SWITCH;
+ }
+ else if (strcasecmp(args[1], "HAPTIC") == 0) {
+ type = ICO_INPUT_MGR_DEVICE_TYPE_HAPTIC;
+ }
+ else {
+ type = strtol(args[1], (char **)0, 0);
+ }
+ no = strtol(args[2], (char **)0, 0);
+ if (strcasecmp(args[3], "ABS_X") == 0) {
+ code = ABS_X;
+ }
+ else if (strcasecmp(args[3], "ABS_Y") == 0) {
+ code = ABS_Y;
+ }
+ else if (strcasecmp(args[3], "ABS_Z") == 0) {
+ code = ABS_Z;
+ }
+ else if (strcasecmp(args[3], "REL_X") == 0) {
+ code = REL_X | (EV_REL << 16);
+ }
+ else if (strcasecmp(args[3], "REL_Y") == 0) {
+ code = REL_Y | (EV_REL << 16);
+ }
+ else if (strcasecmp(args[3], "REL_Z") == 0) {
+ code = REL_Z | (EV_REL << 16);
+ }
+ else if (strcasecmp(args[3], "BTN_TOUCH") == 0) {
+ code = BTN_TOUCH;
+ }
+ else if (strcasecmp(args[3], "BTN_LEFT") == 0) {
+ code = BTN_LEFT;
+ }
+ else if (strcasecmp(args[3], "BTN_RIGHT") == 0) {
+ code = BTN_RIGHT;
+ }
+ else if (strcasecmp(args[3], "BTN_MIDDLE") == 0) {
+ code = BTN_MIDDLE;
+ }
+ else if (strcasecmp(args[3], "BTN_RIGHT") == 0) {
+ code = BTN_RIGHT;
+ }
+ else {
+ code = strtol(args[3], (char **)0, 0);
+ }
+ value = strtol(args[4], (char **)0, 0);
+ if (narg >= 6) {
+ value = (value << 16) + strtol(args[5], (char **)0, 0);
+ }
+ print_log("HOMESCREEN: input_send(%s.%x,%d,%d,%x,%d)",
+ appid, surfaceid, type, no, code, value);
+ ico_input_mgr_control_send_input_event(display->ico_input_mgr,
+ appid, surfaceid, type, no, code, value);
+ }
+ else {
+ print_log("HOMESCREEN: input_send command[input_send {@app/serface} type no code "
+ "value [value2]] has no argument");
+ }
+}
+
+static void
input_conf(struct display *display, char *buf)
{
char *args[10];
@@ -1257,11 +1717,93 @@ send_event(const char *cmd)
if (msgsnd(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0) < 0) {
fprintf(stderr, "HOMESCREEN: message queue(%d(0x%x)) send error[%d]\n",
- mqkey, mqkey, errno);
+ mqkey, mqkey, errno);
return;
}
}
+static void
+set_region(struct display *display, char *buf)
+{
+ char *args[10];
+ int narg;
+ int x, y, width, height;
+ int hot_x, hot_y;
+ int c_x, c_y, c_width, c_height;
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 5) {
+ x = strtol(args[1], (char **)0, 0);
+ y = strtol(args[2], (char **)0, 0);
+ width = strtol(args[3], (char **)0, 0);
+ height = strtol(args[4], (char **)0, 0);
+ hot_x = x + (width / 2);
+ hot_y = y + (height / 2);
+ c_x = x + 5;
+ c_y = y + 5;
+ c_width = width - 10;
+ if (c_width <= 0) c_width = 2;
+ c_height = height - 10;
+ if (c_height <= 0) c_height = 2;
+ print_log("HOMESCREEN: ico_exinput_set_input_region(%s,%d,%d-%d,%d,"
+ "hot=%d,%d,cur=%d,%d-%d,%d,attr=0)",
+ args[0] ? args[0] : "(null)", x, y, width, height,
+ hot_x, hot_y, c_x, c_y, c_width, c_height);
+ if (strcasecmp(args[0], "NULL") == 0) {
+ ico_exinput_set_input_region(display->ico_exinput, "", x, y,
+ width, height, hot_x, hot_y, c_x, c_y,
+ c_width, c_height, 0);
+ }
+ else {
+ ico_exinput_set_input_region(display->ico_exinput, args[0], x, y,
+ width, height, hot_x, hot_y, c_x, c_y,
+ c_width, c_height, 0);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: set_region command[set_region winname@appid x y "
+ "width height] has no argument");
+ }
+}
+
+static void
+unset_region(struct display *display, char *buf)
+{
+ char *args[10];
+ int narg;
+ int x, y, width, height;
+
+ narg = pars_command(buf, args, 10);
+ if (narg >= 1) {
+ if (narg >= 5) {
+ x = strtol(args[1], (char **)0, 0);
+ y = strtol(args[2], (char **)0, 0);
+ width = strtol(args[3], (char **)0, 0);
+ height = strtol(args[4], (char **)0, 0);
+ }
+ else {
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ }
+ print_log("HOMESCREEN: ico_exinput_unset_input_region(%s,08x,%d,%d-%d,%d)",
+ args[0] ? args[0] : "(null)", x, y, width, height);
+ if (strcasecmp(args[0], "NULL") == 0) {
+ ico_exinput_unset_input_region(display->ico_exinput, "", x, y,
+ width, height);
+ }
+ else {
+ ico_exinput_unset_input_region(display->ico_exinput, args[0],
+ x, y, width, height);
+ }
+ }
+ else {
+ print_log("HOMESCREEN: unset_region command[unset_region winname@appid x y "
+ "width height] has no argument");
+ }
+}
+
/*
* Main Program
*
@@ -1274,6 +1816,11 @@ int main(int argc, char *argv[])
char buf[256];
int ret, fd;
int msec;
+#if 1 /* use mkostemp */
+ extern int mkostemp(char *template, int flags);
+#else /* use mkostemp */
+ long flags;
+#endif /* use mkostemp */
display = malloc(sizeof *display);
assert(display);
@@ -1306,8 +1853,7 @@ int main(int argc, char *argv[])
assert(display->display);
display->registry = wl_display_get_registry(display->display);
- wl_registry_add_listener(display->registry,
- &registry_listener, display);
+ wl_registry_add_listener(display->registry, &registry_listener, display);
wl_display_dispatch(display->display);
fd = 0;
@@ -1315,12 +1861,11 @@ int main(int argc, char *argv[])
while (1) {
sleep_with_wayland(display->display, 20);
if (display->prompt) {
- printf("HOMESCREEN: "); fflush(stdout);
+ printf("HOMESCREEN> "); fflush(stdout);
}
- ret = getdata(display->ico_window_mgr, "HOMESCREEN: ", fd, buf, sizeof(buf));
+ ret = getdata(display->ico_window_mgr, "HOMESCREEN> ", fd, buf, sizeof(buf));
if (ret < 0) {
- fprintf(stderr, "HOMESCREEN: read error: fd %d, %m\n",
- fd);
+ fprintf(stderr, "HOMESCREEN: read error: fd %d, %m\n", fd);
return -1;
}
if (ret == 0) continue;
@@ -1380,6 +1925,22 @@ int main(int argc, char *argv[])
/* Raise/Lower surface window */
raise_surface(display, &buf[5], 0);
}
+ else if (strncasecmp(buf, "active", 6) == 0) {
+ /* Active surface window */
+ active_window(display, &buf[6]);
+ }
+ else if (strncasecmp(buf, "animation", 9) == 0) {
+ /* Set animation surface window */
+ animation_surface(display, &buf[9]);
+ }
+ else if (strncasecmp(buf, "map", 3) == 0) {
+ /* map surface */
+ map_surface(display, &buf[3], 1);
+ }
+ else if (strncasecmp(buf, "unmap", 5) == 0) {
+ /* unmap surface */
+ map_surface(display, &buf[5], 0);
+ }
else if (strncasecmp(buf, "input_add", 9) == 0) {
/* Set input switch to application */
input_add(display, &buf[9]);
@@ -1388,6 +1949,10 @@ int main(int argc, char *argv[])
/* Reset input switch to application*/
input_del(display, &buf[9]);
}
+ else if (strncasecmp(buf, "input_send", 10) == 0) {
+ /* Input event send to application*/
+ input_send(display, &buf[10]);
+ }
else if (strncasecmp(buf, "input_conf", 10) == 0) {
/* input switch configuration */
input_conf(display, &buf[10]);
@@ -1400,6 +1965,18 @@ int main(int argc, char *argv[])
/* input switch event */
input_sw(display, &buf[8]);
}
+ else if (strncasecmp(buf, "set_region", 10) == 0) {
+ /* set input region */
+ set_region(display, &buf[10]);
+ }
+ else if (strncasecmp(buf, "unset_region", 12) == 0) {
+ /* unset input region */
+ unset_region(display, &buf[12]);
+ }
+ else if (strncasecmp(buf, "input_sw", 8) == 0) {
+ /* input switch event */
+ input_sw(display, &buf[8]);
+ }
else if (strncasecmp(buf, "sleep", 5) == 0) {
/* Sleep */
msec = sec_str_2_value(&buf[6]);
@@ -1429,6 +2006,6 @@ int main(int argc, char *argv[])
send_event(NULL);
- return(0);
+ return 0;
}