Check the created viewer window state(visibility)
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 20 Aug 2012 08:10:12 +0000 (17:10 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 20 Aug 2012 08:14:51 +0000 (17:14 +0900)
Change-Id: I608502ef08daf7b2e7179817705c3202b45ecf08

debian/changelog
include/xmonitor.h
packaging/com.samsung.data-provider-master.spec
src/client_rpc.c
src/server.c
src/xmonitor.c

index 078ed28..ca608d3 100644 (file)
@@ -1,3 +1,10 @@
+data-provider-master (0.7.1) unstable; urgency=low
+
+  * Git: slp/pkgs/d/data-provider-master
+  * Tag: data-provider-master_0.7.1
+
+ -- Sung-jae Park <nicesj.park@samsung.com>  Mon, 20 Aug 2012 17:10:46 +0900
+
 data-provider-master (0.7.0) unstable; urgency=low
 
   * Git: slp/pkgs/d/data-provider-master
index acb8dff..108bc88 100644 (file)
@@ -21,6 +21,6 @@
 
 extern int xmonitor_init(void);
 extern void xmonitor_fini(void);
-extern int xmonitor_update_state(void);
+extern int xmonitor_update_state(int pid);
 
 /* End of a file */
index 3c90915..e22b0d6 100644 (file)
@@ -1,6 +1,6 @@
 Name: com.samsung.data-provider-master
 Summary: Master data provider
-Version: 0.7.0
+Version: 0.7.1
 Release: 1
 Group: main/app
 License: Samsung Proprietary License
index a84effa..533de65 100644 (file)
@@ -207,6 +207,11 @@ int client_rpc_broadcast(struct inst_info *inst, struct packet *packet)
                        if (!rpc->client)
                                continue;
 
+                       if (client_pid(rpc->client) < 0) {
+                               ErrPrint("Client[%p] has PID[%d]\n", rpc->client, client_pid(rpc->client));
+                               continue;
+                       }
+
                        DbgPrint("Send packet to %d\n", client_pid(rpc->client));
                        (void)client_rpc_async_request(rpc->client, packet_ref(packet));
                }
@@ -215,6 +220,11 @@ int client_rpc_broadcast(struct inst_info *inst, struct packet *packet)
                        if (!rpc->client)
                                continue;
 
+                       if (client_pid(rpc->client) < 0) {
+                               ErrPrint("Client[%p] has PID[%d]\n", rpc->client, client_pid(rpc->client));
+                               continue;
+                       }
+
                        if (instance_client(inst) == rpc->client) {
                                DbgPrint("Send packet to %d\n", client_pid(rpc->client));
                                (void)client_rpc_async_request(rpc->client, packet_ref(packet));
index 0b7ca8f..fc1905f 100644 (file)
@@ -24,6 +24,7 @@
 #include "fault_manager.h"
 #include "fb.h" /* fb_type */
 #include "group.h"
+#include "xmonitor.h"
 
 static struct info {
        int fd;
@@ -77,7 +78,12 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet
                goto out;
        }
 
-       client_rpc_initialize(client, handle);
+       ret = client_rpc_initialize(client, handle);
+       if (ret < 0)
+               ErrPrint("Failed to initialize the RPC for %d\n", pid);
+       else
+               xmonitor_update_state(pid);
+
        ret = 0;
 
 out:
index 7d8d398..c983834 100644 (file)
@@ -89,7 +89,7 @@ static Eina_Bool destroy_cb(void *data, int type, void *event)
        return ECORE_CALLBACK_RENEW;
 }
 
-int xmonitor_update_state(void)
+int xmonitor_update_state(int target_pid)
 {
        Ecore_X_Window win;
        struct client_node *client;
@@ -102,10 +102,20 @@ int xmonitor_update_state(void)
                return -ENOENT;
 
        client = client_find_by_pid(pid);
-       if (!client)
+       if (!client) {
+               DbgPrint("Client %d is not registered yet\n", pid);
                return -EINVAL;
+       }
 
-       client_resumed(client);
+       if (target_pid != pid) {
+               DbgPrint("Client is paused\n");
+               client_paused(client);
+       } else {
+               DbgPrint("Client is resumed\n");
+               client_resumed(client);
+       }
+
+       slave_handle_state_change();
        return 0;
 }
 
@@ -131,16 +141,15 @@ static Eina_Bool client_cb(void *data, int type, void *event)
        if (!strcmp(name, "_X_ILLUME_DEACTIVATE_WINDOW")) {
                DbgPrint("PAUSE EVENT\n");
                client_paused(client);
+
                slave_handle_state_change();
        } else if (!strcmp(name, "_X_ILLUME_ACTIVATE_WINDOW")) {
                DbgPrint("RESUME EVENT\n");
                client_resumed(client);
 
-               if (!setting_is_lcd_off()) {
-                       slave_handle_state_change();
-               } else {
-                       DbgPrint("Locked. ignore resume event.\n");
-               }
+               slave_handle_state_change();
+       } else {
+               /* ignore event */
        }
 
        free(name);