From 8ea33dbd6a84411f54dba4b3e0c6767683f18edf Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 20 Aug 2012 17:10:12 +0900 Subject: [PATCH] Check the created viewer window state(visibility) Change-Id: I608502ef08daf7b2e7179817705c3202b45ecf08 --- debian/changelog | 7 +++++++ include/xmonitor.h | 2 +- packaging/com.samsung.data-provider-master.spec | 2 +- src/client_rpc.c | 10 ++++++++++ src/server.c | 8 +++++++- src/xmonitor.c | 25 +++++++++++++++++-------- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 078ed28..ca608d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 20 Aug 2012 17:10:46 +0900 + data-provider-master (0.7.0) unstable; urgency=low * Git: slp/pkgs/d/data-provider-master diff --git a/include/xmonitor.h b/include/xmonitor.h index acb8dff..108bc88 100644 --- a/include/xmonitor.h +++ b/include/xmonitor.h @@ -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 */ diff --git a/packaging/com.samsung.data-provider-master.spec b/packaging/com.samsung.data-provider-master.spec index 3c90915..e22b0d6 100644 --- a/packaging/com.samsung.data-provider-master.spec +++ b/packaging/com.samsung.data-provider-master.spec @@ -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 diff --git a/src/client_rpc.c b/src/client_rpc.c index a84effa..533de65 100644 --- a/src/client_rpc.c +++ b/src/client_rpc.c @@ -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)); diff --git a/src/server.c b/src/server.c index 0b7ca8f..fc1905f 100644 --- a/src/server.c +++ b/src/server.c @@ -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: diff --git a/src/xmonitor.c b/src/xmonitor.c index 7d8d398..c983834 100644 --- a/src/xmonitor.c +++ b/src/xmonitor.c @@ -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); -- 2.7.4