summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>2015-02-13 12:21:16 +0100
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>2015-02-13 12:21:16 +0100
commitd32942db24a02debf5a4b026ba82609cef4fe3b6 (patch)
tree733c1c1334ef9f1b3231da90463f12e8ba5604f2
parent33bcba92e9eb554fa684305c80c3c0652056ecf8 (diff)
downloadweston-common-accepted/tizen_3.0.2014.q4_common.tar.gz
weston-common-accepted/tizen_3.0.2014.q4_common.tar.bz2
weston-common-accepted/tizen_3.0.2014.q4_common.zip
Enabling the QA plugin and using "weston-qa-client --move <ID> <x> <y>" now permits to change a surface position with the command line. (former display command is now : "weston-qa-client --list") Change-Id: Ia43edad05d31747ef8f5a5d4bb4a727340ec39da Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
-rw-r--r--src/qa-plugin/qa-client.c37
-rw-r--r--src/qa-plugin/qa-plugin.c31
-rw-r--r--src/qa-plugin/qa.xml9
3 files changed, 68 insertions, 9 deletions
diff --git a/src/qa-plugin/qa-client.c b/src/qa-plugin/qa-client.c
index 24451f0..133baf9 100644
--- a/src/qa-plugin/qa-client.c
+++ b/src/qa-plugin/qa-client.c
@@ -1,6 +1,7 @@
/* Copyright 2014 Manuel Bachmann <tarnyko@tarnyko.net> */
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <wayland-client.h>
@@ -13,12 +14,20 @@ static void
qa_handle_surface_list (void *data, struct qa *qa,
const char *list)
{
- printf ("qa-client: SURFACES LIST :\n%s", list);
+ printf ("SURFACES LIST :\n%s", list);
+ done = 1;
+}
+
+static void
+qa_handle_surface_move (void *data, struct qa *qa)
+{
+ printf ("SURFACE MOVE...\n");
done = 1;
}
static const struct qa_listener qa_listener = {
- qa_handle_surface_list
+ qa_handle_surface_list,
+ qa_handle_surface_move
};
static void
@@ -28,7 +37,7 @@ registry_handle_global (void *data, struct wl_registry *registry,
if (strcmp (interface, "qa") == 0) {
qa = wl_registry_bind (registry, id,
&qa_interface, version);
- printf ("qa-client: registered the \"qa\" interface.\n");
+ printf ("weston-qa-client: registered the \"qa\" interface.\n\n");
}
}
@@ -46,20 +55,30 @@ static const struct wl_registry_listener registry_listener = {
int main (int argc, char *argv[])
{
+ if (((argc != 2) && (argc != 5)) ||
+ ((argc == 2) && (strcmp(argv[1],"--help") == 0)) ||
+ ((argc == 2) && (strcmp(argv[1],"--list") != 0)) ||
+ ((argc == 5) && (strcmp(argv[1],"--move") != 0))) {
+ printf ("Usage : weston-qa-client --list : list displayed surfaces\n");
+ printf (" weston-qa-client --move <ID> <x> <y> : move surface to position\n");
+ printf (" weston-qa-client --help : this help section\n\n");
+ return 0;
+ }
+
struct wl_display *display = NULL;
struct wl_registry *registry = NULL;
int res = 0;
display = wl_display_connect (NULL);
if (!display) {
- printf ("qa-client: display error.\n");
+ printf ("weston-qa-client: display error.\n");
printf ("Did you define XDG_RUNTIME_DIR ?\n");
return -1;
}
registry = wl_display_get_registry (display);
if (!registry) {
- printf ("qa-client: registry error.\n");
+ printf ("weston-qa-client: registry error.\n");
return -1;
}
@@ -72,7 +91,13 @@ int main (int argc, char *argv[])
qa_add_listener (qa, &qa_listener, NULL);
- qa_surface_list (qa);
+ if ((argc == 2) && (strcmp(argv[1],"--list") == 0)) {
+ qa_surface_list (qa);
+ } else if ((argc == 5) && (strcmp(argv[1],"--move") == 0)) {
+ qa_surface_move (qa, atoi(argv[2]),
+ atoi(argv[3]),
+ atoi(argv[4]));
+ }
while ((res != -1) && (done == 0))
res = wl_display_dispatch (display);
diff --git a/src/qa-plugin/qa-plugin.c b/src/qa-plugin/qa-plugin.c
index dc095d4..069e055 100644
--- a/src/qa-plugin/qa-plugin.c
+++ b/src/qa-plugin/qa-plugin.c
@@ -23,12 +23,13 @@ qa_surface_list (struct wl_client *client,
resp = strdup ("");
- wl_list_for_each (view, &ec->view_list, link) { printf ("RHA ");
+ wl_list_for_each (view, &ec->view_list, link) {
if ((view->surface) &&
(view->geometry.x != 0.0) &&
(view->geometry.y != 0.0)) {
- asprintf (&temp, "Surface %p : X+Y = %.2f+%.2f - WxH = %dx%d\n",
- view->surface, view->geometry.x, view->geometry.y,
+ asprintf (&temp, "Surface %d : X+Y = %.2f+%.2f - WxH = %dx%d\n",
+ (unsigned int) view->surface,
+ view->geometry.x, view->geometry.y,
view->surface->width, view->surface->height);
resp = realloc (resp, strlen(resp) + strlen (temp) + 1);
strncat (resp, temp, strlen(temp));
@@ -41,6 +42,29 @@ qa_surface_list (struct wl_client *client,
}
static void
+qa_surface_move (struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ uint32_t x,
+ uint32_t y)
+{
+ struct weston_view *view;
+
+ weston_log ("qa-plugin: requested to move surface %d to %d+%d...\n", id, x, y);
+
+ wl_list_for_each (view, &ec->view_list, link) {
+ if ((view->surface) &&
+ ((unsigned int) view->surface == id)) {
+ view->geometry.x = (float) x;
+ view->geometry.y = (float) y;
+ view->transform.dirty = 1;
+ }
+ }
+
+ qa_send_move_surface (resource);
+}
+
+static void
qa_destroy (struct wl_client *client,
struct wl_resource *resource)
{
@@ -49,6 +73,7 @@ qa_destroy (struct wl_client *client,
static const struct qa_interface qa_implementation = {
qa_surface_list,
+ qa_surface_move,
qa_destroy
};
diff --git a/src/qa-plugin/qa.xml b/src/qa-plugin/qa.xml
index b804b64..1ee7fd8 100644
--- a/src/qa-plugin/qa.xml
+++ b/src/qa-plugin/qa.xml
@@ -3,12 +3,21 @@
<interface name="qa" version="1">
<request name="surface_list"/>
+
+ <request name="surface_move">
+ <arg name="id" type="uint"/>
+ <arg name="x" type="uint"/>
+ <arg name="y" type="uint"/>
+ </request>
+
<request name="destroy" type="destructor"/>
<event name="list_surface">
<arg name="list" type="string"/>
</event>
+ <event name="move_surface"/>
+
</interface>
</protocol>