Remember the orientation of client.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 14 May 2015 09:50:24 +0000 (18:50 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 14 May 2015 09:50:24 +0000 (18:50 +0900)
And use it for newly created instances.

Change-Id: I1e34423bbc8017023a022513f076e954070b28a2

include/client_life.h
src/client_life.c
src/instance.c
src/server.c

index e4fa187..b7691a6 100644 (file)
@@ -112,4 +112,7 @@ extern int client_browse_category_list(const char *category, int (*cb)(struct cl
 extern int client_broadcast(struct inst_info *inst, struct packet *packet);
 
 extern const char *client_direct_addr(const struct client_node *client);
+
+extern int client_orientation(const struct client_node *client);
+extern void client_set_orientation(struct client_node *client, int orientation);
 /* End of a file */
index 8d5c87c..130d51c 100644 (file)
@@ -109,6 +109,7 @@ struct client_node {
 
        int faulted;
        char *direct_addr;
+       int orientation;
 };
 
 static inline void invoke_global_destroyed_cb(struct client_node *client)
@@ -1023,4 +1024,14 @@ HAPI const char *client_direct_addr(const struct client_node *client)
        return client ? client->direct_addr : NULL;
 }
 
+HAPI void client_set_orientation(struct client_node *client, int orientation)
+{
+       client->orientation = orientation;
+}
+
+HAPI int client_orientation(const struct client_node *client)
+{
+       return client->orientation;
+}
+
 /* End of a file */
index 0720682..079887d 100644 (file)
@@ -980,6 +980,7 @@ HAPI struct inst_info *instance_create(struct client_node *client, double timest
                if (client_event_callback_add(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst) < 0) {
                        ErrPrint("Failed to add client event callback: %s\n", inst->id);
                }
+               inst->orientation = client_orientation(client);
        }
 
        if (fork_package(inst, pkgname) < 0) {
index 1b734e8..7f60a96 100644 (file)
@@ -4075,7 +4075,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_orientation(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_change_orientation(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        double timestamp;
@@ -4102,6 +4102,8 @@ static struct packet *client_orientation(pid_t pid, int handle, const struct pac
 
        ret = 0;
 
+       client_set_orientation(client, degree);
+
        pkg_list = (Eina_List *)package_list();
 
        EINA_LIST_FOREACH(pkg_list, l, pkg) {
@@ -4114,7 +4116,6 @@ static struct packet *client_orientation(pid_t pid, int handle, const struct pac
                }
        }
        DbgPrint("%d instances are affected (orientation: %d)\n", ret, degree);
-
 out:
        return NULL;
 }
@@ -9417,7 +9418,7 @@ static struct method s_client_table[] = {
        },
        {
                .cmd = CMD_STR_ORIENTATION,
-               .handler = client_orientation,
+               .handler = client_change_orientation,
        },
        {
                .cmd = CMD_STR_CHANGE_VISIBILITY,