bug fix: TC-127 31/29531/2
authorRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Thu, 16 Oct 2014 05:17:19 +0000 (14:17 +0900)
committerRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Wed, 29 Oct 2014 08:38:54 +0000 (17:38 +0900)
TC-127 - No notification pop up while incoming call comes on.
It is a phenomenon in which pop-up of OnScreen is not displayed by
notification.Since OnScreen will generate and show Surface if notification
comes, but SystemController does not assume that one application makes two
or more Surfaces.
Repair displayed all the norifications by one surface at OnScreen.

Change-Id: I503a5a9a23eb18ec19b4874afc067ff5e5e314ea
Bug-Tizen: TC-127
Signed-off-by: Ryota Okubi <ryota.okubi@mail.toyota-td.jp>
include/ico_syc_type.h
include/ico_syc_winctl.h
lib/apps-framework/ico_syc_appresctl.c
lib/apps-framework/ico_syc_userctl.c
lib/apps-framework/ico_syc_winctl.c
src/homescreen/CicoHomeScreen.cpp
src/onscreen/CicoOSPopWindow.cpp
src/onscreen/CicoOSPopWindow.h
src/onscreen/CicoOnScreen.cpp
src/onscreen/CicoOnScreen.h
tool/notification/send_notification.cpp

index 43db1f8..7e7b4ed 100644 (file)
@@ -175,7 +175,7 @@ typedef enum _window_aspect {
     ICO_SYC_WIN_ASPECT_ALIGN_LEFT  = 1,
     ICO_SYC_WIN_ASPECT_ALIGN_RIGHT  = 2,
     ICO_SYC_WIN_ASPECT_ALIGN_TOP  = 4,
-    ICO_SYC_WIN_ASPECT_ALIGN_BOTTOM  = 8,
+    ICO_SYC_WIN_ASPECT_ALIGN_BOTTOM  = 8
 } ico_syc_win_aspect_e;
 
 /**
@@ -201,40 +201,40 @@ typedef enum _state_onoff {
  * window move information (zone/position/size)
  */
 typedef struct _win_move {
-    char *zone;     /* area of showing application window */
-    int  layer;     /* layer of showing application window */
-    int  pos_x;     /* window's display position (x) */
-    int  pos_y;     /* window's display position (y) */
-    int  width;     /* window width */
-    int  height;    /* window height */
+    const char *zone;   /* area of showing application window */
+    int  layer;         /* layer of showing application window */
+    int  pos_x;         /* window's display position (x) */
+    int  pos_y;         /* window's display position (y) */
+    int  width;         /* window width */
+    int  height;        /* window height */
 } ico_syc_win_move_t;
 
 /*
  * window information
  */
 typedef struct _win_info {
-    char *appid;    /* application id */
-    char *name;     /* window's surface name */
-    int  surface;   /* window's surface id */
+    const char *appid;  /* application id */
+    const char *name;   /* window's surface name */
+    int  surface;       /* window's surface id */
 } ico_syc_win_info_t;
 
 /*
  * window attributes
  */
 typedef struct _win_attr {
-    char *appid;    /* application id */
-    char *name;     /* window's surface name */
-    char *zone;     /* window's current zone name */
-    int  surface;   /* window's surface id */
-    int  nodeid;    /* ecu number and display number in the ecu */
-    int  layer;     /* id of layer that the application's window is on */
-    int  pos_x;     /* window's display position (x) */
-    int  pos_y;     /* window's display position (y) */
-    int  width;     /* window width */
-    int  height;    /* window height */
-    int  raise;     /* changed order showing surface in the layer */
-    int  visible;   /* visible status */
-    int  active;    /* window active status */
+    const char *appid;  /* application id */
+    const char *name;   /* window's surface name */
+    const char *zone;   /* window's current zone name */
+    int  surface;       /* window's surface id */
+    int  nodeid;        /* ecu number and display number in the ecu */
+    int  layer;         /* id of layer that the application's window is on */
+    int  pos_x;         /* window's display position (x) */
+    int  pos_y;         /* window's display position (y) */
+    int  width;         /* window width */
+    int  height;        /* window height */
+    int  raise;         /* changed order showing surface in the layer */
+    int  visible;       /* visible status */
+    int  active;        /* window active status */
 } ico_syc_win_attr_t;
 
 /*
@@ -242,13 +242,13 @@ typedef struct _win_attr {
  * (notify from callback function)
  */
 typedef struct _thumb_info {
-    char *appid;    /* application id */
-    int  surface;   /* window's surface id */
-    int  type;      /* buffer type(ICO_WINDOW_MGR_MAP_TYPE_EGL/SHM/PIXEL)*/
-    int  width;     /* window width */
-    int  height;    /* window height */
-    int  stride;    /* byte par line of frame buffer */
-    int  format;    /* format of buffer */
+    const char *appid;  /* application id */
+    int  surface;       /* window's surface id */
+    int  type;          /* buffer type(ICO_WINDOW_MGR_MAP_TYPE_EGL/SHM/PIXEL)*/
+    int  width;         /* window width */
+    int  height;        /* window height */
+    int  stride;        /* byte par line of frame buffer */
+    int  format;        /* format of buffer */
 } ico_syc_thumb_info_t;
 
 /*
@@ -263,41 +263,41 @@ typedef struct _layer_attr {
  * user list
  */
 typedef struct _user_list {
-    int  user_num;      /* number of user */
-    char **userlist;    /* address of user list */
-    char *user_login;   /* name of login user */
+    int  user_num;          /* number of user */
+    char **userlist;        /* address of user list */
+    const char *user_login; /* name of login user */
 } ico_syc_userlist_t;
 
 /*
  * window resource information
  */
 typedef struct _res_win {
-    char *ECU;          /* name to identify ECU */
-    char *display;      /* name to identify Display in ECU */
-    char *layer;        /* name to identify Layer in Display */
-    char *layout;       /* name to identify Layout in Layer */
-    char *area;         /* name to Output position in Layout */
-    char *dispatchApp;  /* dispatch of application */
-    char *role;         /* role of notice */
-    uint32_t resourceId;/* ID number of resource(surface id) */
+    const char *ECU;        /* name to identify ECU */
+    const char *display;    /* name to identify Display in ECU */
+    const char *layer;      /* name to identify Layer in Display */
+    const char *layout;     /* name to identify Layout in Layer */
+    const char *area;       /* name to Output position in Layout */
+    const char *dispatchApp;/* dispatch of application */
+    const char *role;       /* role of notice */
+    uint32_t resourceId;    /* ID number of resource(surface id) */
 } ico_syc_res_window_t;
 
 /*
  * sound resource information
  */
 typedef struct _res_sound {
-    char *zone;         /* area of playing sound */
-    char *name;         /* sound stream name */
-    char *id;           /* sound id */
-    int  adjust;        /* adjust action */
+    const char *zone;       /* area of playing sound */
+    const char *name;       /* sound stream name */
+    const char *id;         /* sound id */
+    int  adjust;            /* adjust action */
 } ico_syc_res_sound_t;
 
 /*
  * input resource information
  */
 typedef struct _res_input {
-    char *name;         /* input device name */
-    int  event;         /* input event id */
+    const char *name;       /* input device name */
+    int  event;             /* input event id */
 } ico_syc_res_input_t;
 
 /*
@@ -324,9 +324,9 @@ typedef struct _input_region {
  * resource(window/sound/input) information
  */
 typedef struct _res_info {
-    ico_syc_res_window_t *window;  /* window resource information */
-    ico_syc_res_sound_t  *sound;   /* sound resource information */
-    ico_syc_res_input_t  *input;   /* input resource information */
+    ico_syc_res_window_t *window;   /* window resource information */
+    ico_syc_res_sound_t  *sound;    /* sound resource information */
+    ico_syc_res_input_t  *input;    /* input resource information */
 } ico_syc_res_info_t;
 
 /*
index c95accc..10eb3f8 100644 (file)
@@ -46,8 +46,8 @@ typedef enum _window_show {
 #define ICO_SYC_WIN_SURF_ONESHOT    0x10000000
 #define ICO_SYC_WIN_SURF_FLAGS      0xff000000
 typedef struct _animation_info {
-    char *name;     /* name of animation (ex. fade,slide,zoom etc..) */
-    int  time;      /* millisecond time to show the transition's animation */
+    const char *name;   /* name of animation (ex. fade,slide,zoom etc..) */
+    int  time;          /* millisecond time to show the transition's animation */
 } ico_syc_animation_t;
 
 /*============================================================================*/
index edf5c1e..d73cd67 100644 (file)
@@ -34,9 +34,9 @@ static ico_syc_res_window_t *_create_res_window(const char *ECU,
                                                 const char *dispatchApp,
                                                 const char *role,
                                                 uint32_t resourceId);
-static ico_syc_res_sound_t *_create_res_sound(char *zone, char *name, char *id,
-                                              int adjust);
-static ico_syc_res_input_t *_create_res_input(char *name, int event);
+static ico_syc_res_sound_t *_create_res_sound(const char *zone, const char *name,
+                                              const char *id, int adjust);
+static ico_syc_res_input_t *_create_res_input(const char *name, int event);
 static void _free_res_window(ico_syc_res_window_t *window);
 static void _free_res_sound(ico_syc_res_sound_t *sound);
 static void _free_res_input(ico_syc_res_input_t *input);
@@ -124,7 +124,7 @@ static ico_syc_res_window_t *
  */
 /*--------------------------------------------------------------------------*/
 static ico_syc_res_sound_t *
-_create_res_sound(char *zone, char *name, char *id, int adjust)
+_create_res_sound(const char *zone, const char *name, const char *id, int adjust)
 {
     ico_syc_res_sound_t *info   = NULL;
 
@@ -164,7 +164,7 @@ _create_res_sound(char *zone, char *name, char *id, int adjust)
  */
 /*--------------------------------------------------------------------------*/
 static ico_syc_res_input_t *
-_create_res_input(char *name, int event)
+_create_res_input(const char *name, int event)
 {
     ico_syc_res_input_t *info   = NULL;
 
@@ -204,13 +204,13 @@ _free_res_window(ico_syc_res_window_t *w)
     }
 
     /* free element */
-    free(w->ECU);
-    free(w->display);
-    free(w->layer);
-    free(w->layout);
-    free(w->area);
-    free(w->dispatchApp);
-    free(w->role);
+    free((void *)w->ECU);
+    free((void *)w->display);
+    free((void *)w->layer);
+    free((void *)w->layout);
+    free((void *)w->area);
+    free((void *)w->dispatchApp);
+    free((void *)w->role);
     /* free */
     free(w);
 
@@ -234,9 +234,9 @@ _free_res_sound(ico_syc_res_sound_t *sound)
     }
 
     /* free element */
-    free(sound->zone);
-    free(sound->name);
-    free(sound->id);
+    free((void *)sound->zone);
+    free((void *)sound->name);
+    free((void *)sound->id);
     /* free */
     free(sound);
 
@@ -260,7 +260,7 @@ _free_res_input(ico_syc_res_input_t *input)
     }
 
     /* free element */
-    free(input->name);
+    free((void *)input->name);
     /* free */
     free(input);
 
index 8d43058..55efdf5 100644 (file)
@@ -345,7 +345,7 @@ ico_syc_cb_userlist(ico_syc_callback_t callback, void *user_data,
         }
         free(list);
     }
-    free(userlist->user_login);
+    free((void *)userlist->user_login);
     free(userlist);
 
     return;
index 624e777..c51c91c 100644 (file)
@@ -627,9 +627,9 @@ ico_syc_cb_win(ico_syc_callback_t callback, void *user_data,
 
     /* free memory */
     g_object_unref(parser);
-    free(win_info->appid);
-    free(win_info->name);
-    free(win_info);
+    free((void *)win_info->appid);
+    free((void *)win_info->name);
+    free((void *)win_info);
 
     return;
 }
@@ -719,9 +719,9 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
 
     /* free memory */
     g_object_unref(parser);
-    free(win_attr->appid);
-    free(win_attr->name);
-    free(win_attr->zone);
+    free((void *)win_attr->appid);
+    free((void *)win_attr->name);
+    free((void *)win_attr->zone);
     free(win_attr);
 
     return;
@@ -810,7 +810,7 @@ ico_syc_cb_thumb(ico_syc_callback_t callback, void *user_data,
 
     /* free memory */
     g_object_unref(parser);
-    free(thumb_info->appid);
+    free((void *)thumb_info->appid);
     free(thumb_info);
 
     return;
index 781048d..a7dedff 100644 (file)
@@ -346,14 +346,13 @@ CicoHomeScreen::requestChangeZone(CicoHSAppInfo* appinfo)
     }
 
     ICO_DBG("change zone: \"%s\"->\"%s\"", wininfo->zone, dispzone);
-    ico_syc_win_move_t move = {
-        .zone   = (char*)dispzone,
-        .layer  = layer,
-        .pos_x  = 0,
-        .pos_y  = 0,
-        .width  = 0,
-        .height = 0
-    };
+    ico_syc_win_move_t move;
+    move.zone   = dispzone;
+    move.layer  = layer;
+    move.pos_x  = 0;
+    move.pos_y  = 0;
+    move.width  = 0;
+    move.height = 0;
 
     ico_syc_move(wininfo->appid, wininfo->surface, &move,
                  &hs_instance->moveZoneAnimation);
@@ -738,7 +737,7 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_info_t *win_info)
 
     ico_syc_win_move_t move;
 
-    move.zone  = (char*)dispZoneConf->fullname.c_str();
+    move.zone  = dispZoneConf->fullname.c_str();
     move.layer = HS_LAYER_APPLICATION;
     if (ailItem->m_display != 0) {
         move.layer = HS_LAYER_2NDDISP_APP;
@@ -751,7 +750,7 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_info_t *win_info)
 
     ico_syc_move(win_info->appid,win_info->surface,&move,NULL);
     ico_syc_animation_t animation;
-    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
+    animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
     animation.time = ICO_HS_MENU_ANIMATION_DURATION;
     const string& lastStartupApp = m_appHis->getLastStartupAppid();
     if (true == lastStartupApp.empty()) {
@@ -882,7 +881,7 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
             move.width  = oPOSC->m_w;
             move.height = oPOSC->m_h;
             ico_syc_animation_t animation;
-            animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
+            animation.name = ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
             animation.time = ICO_HS_MENU_ANIMATION_DURATION;
             ico_syc_move(win_info->appid, win_info->surface, &move, &animation);
 
@@ -1185,14 +1184,14 @@ CicoHomeScreen::StartRelations(void)
 {
     int ret;
     strncpy(sb_package_name,
-            (char *)config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
-                                             ICO_HS_CONFIG_SB,
-                                             ICO_HS_APPID_DEFAULT_SB),
+            config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
+                                    ICO_HS_CONFIG_SB,
+                                    ICO_HS_APPID_DEFAULT_SB),
             ICO_HS_MAX_PROCESS_NAME);
     strncpy(os_package_name,
-             (char *)config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
-                                             ICO_HS_CONFIG_ONS,
-                                             ICO_HS_APPID_DEFAULT_ONS),
+            config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
+                                    ICO_HS_CONFIG_ONS,
+                                    ICO_HS_APPID_DEFAULT_ONS),
             ICO_HS_MAX_PROCESS_NAME);
 // TODO
 #if 1   /* ToDo     */
@@ -1290,9 +1289,9 @@ CicoHomeScreen::Initialize(int orientation, CicoGKeyFileConfig *config)
     // load switch display zone config
     moveZoneName = config->ConfigGetString("switchzone", "movezone", NULL);
 
-    moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone",
-                                                            "animation",
-                                                            ICO_HS_ANIMATION_FADE);
+    moveZoneAnimation.name = config->ConfigGetString("switchzone",
+                                                     "animation",
+                                                     ICO_HS_ANIMATION_FADE);
 
     moveZoneAnimation.time = config->ConfigGetInteger("switchzone",
                                                       "animatime", 400);
@@ -1698,7 +1697,7 @@ CicoHomeScreen::StartHomeScreen(int orientation)
     /* create server instance */
     CicoHSServer *server = CicoHSServer::getInstance();
     server->setAppCtrl(m_appctrl);
-    server->startup(10001, (const char*)"ico_hs_protocol");
+    server->startup(10001, "ico_hs_protocol");
 
     /* Initialize WindowController */
     CicoHSWindowController::Initialize();
@@ -1744,9 +1743,9 @@ CicoHomeScreen::StartHomeScreen(int orientation)
     // load switch display zone config
     moveZoneName = config->ConfigGetString("switchzone", "movezone", NULL);
 
-    moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone",
-                                                            "animation",
-                                                            ICO_HS_ANIMATION_FADE);
+    moveZoneAnimation.name = config->ConfigGetString("switchzone",
+                                                     "animation",
+                                                     ICO_HS_ANIMATION_FADE);
     moveZoneAnimation.time = config->ConfigGetInteger("switchzone",
                                                       "animatime", 400);
     // debug log
@@ -1840,10 +1839,10 @@ CicoHomeScreen::ChangeMode(int pattern)
         ico_syc_animation_t animation;
         ICO_DBG("CicoHomeScreen::ChangeMode: MENU->APP");
         if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE)  {
-            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
+            animation.name = ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
         }
         else    {
-            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
+            animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Hide(&animation);
@@ -1860,10 +1859,10 @@ CicoHomeScreen::ChangeMode(int pattern)
         ico_syc_animation_t animation;
         ICO_DBG("CicoHomeScreen::ChangeMode: APP->MENU");
         if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE)  {
-            animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
+            animation.name = ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
         }
         else    {
-            animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_FADE;
+            animation.name = ICO_HS_MENU_SHOW_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Show(&animation);
@@ -1959,7 +1958,7 @@ CicoHomeScreen::SetRegulation(void* data)
     // regulation action
     hs_instance->ctl_bar_window->SetRegulation();
     ico_syc_animation_t animation;
-    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
+    animation.name = ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
     animation.time = ICO_HS_MENU_ANIMATION_DURATION;
     hs_instance->menu_window->Hide(&animation);
 
@@ -2389,7 +2388,7 @@ CicoHomeScreen::ShowApp_i(const std::string& app)
     }
 
     ico_syc_animation_t animation;
-    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
+    animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
     animation.time = ICO_HS_MENU_ANIMATION_DURATION;
 
     ico_syc_show(appinfo->GetAppId(), appinfo->GetLastSurface(), &animation);
@@ -2436,7 +2435,7 @@ CicoHomeScreen::HideApp(const std::string& app)
     }
 
     ico_syc_animation_t animation;
-    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
+    animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
     animation.time = ICO_HS_MENU_ANIMATION_DURATION;
 
     int surface = ai->GetLastSurface();
@@ -2456,7 +2455,7 @@ CicoHomeScreen::HideApp(const std::string& app)
 void
 CicoHomeScreen::MoveApp(const std::string& app, const std::string& zone)
 {
-    CicoHSAppInfo *appinfo = GetAppInfo((const char*)app.c_str());
+    CicoHSAppInfo *appinfo = GetAppInfo(app.c_str());
     if ((CicoHSAppInfo*)0 == appinfo) {
         ICO_DBG("GetAppInfo(%s) is NULL" , app.c_str());
         return;
@@ -2464,18 +2463,19 @@ CicoHomeScreen::MoveApp(const std::string& app, const std::string& zone)
 
     int surface = appinfo->GetLastSurface();
     ico_hs_window_info* wininfo = appinfo->GetWindowInfobySurface(surface);
-    int layer = HS_LAYER_APPLICATION;
-    const char *dispzone = (const char*)zone.c_str();
-    ico_syc_win_move_t move = {
-        .zone   = (char*)dispzone,
-        .layer  = layer,
-        .pos_x  = 0,
-        .pos_y  = 0,
-        .width  = 0,
-        .height = 0
-    };
-
-    ico_syc_move(wininfo->appid, wininfo->surface, &move,
-                 &hs_instance->moveZoneAnimation);
+    if (wininfo)    {
+        int layer = HS_LAYER_APPLICATION;
+        const char *dispzone = zone.c_str();
+        ico_syc_win_move_t move;
+        move.zone   = dispzone;
+        move.layer  = layer;
+        move.pos_x  = 0;
+        move.pos_y  = 0;
+        move.width  = 0;
+        move.height = 0;
+
+        ico_syc_move(wininfo->appid, wininfo->surface, &move,
+                     &hs_instance->moveZoneAnimation);
+    }
 }
 // vim: set expandtab ts=4 sw=4:
index ffd563e..6fc7919 100644 (file)
@@ -26,6 +26,7 @@ using namespace std;
 //==========================================================================
 // static members
 //==========================================================================
+Ecore_Evas*  CicoOSPopWindow::m_window = NULL;
 
 //==========================================================================
 // functions
@@ -43,10 +44,9 @@ using namespace std;
 CicoOSPopWindow::CicoOSPopWindow(notification_type_e type) : CicoNotification(type)
 {
     ICO_TRA("Enter type(%d)", (int)type);
-    m_window      = NULL;
     m_icon        = NULL;
     m_theme       = NULL;
-    m_resourceId  = 0;
+    m_resourceId  = CicoOnScreen::GetResourceId();
     m_context     = NULL;
     m_buttonTouch = false;
     ICO_TRA("Leave");
@@ -55,14 +55,14 @@ CicoOSPopWindow::CicoOSPopWindow(notification_type_e type) : CicoNotification(ty
 CicoOSPopWindow::CicoOSPopWindow(notification_h noti) : CicoNotification(noti)
 {
     ICO_TRA("Enter");
-    m_window      = NULL;
     m_icon        = NULL;
     m_theme       = NULL;
-    m_resourceId  = 0;
+    m_resourceId  = CicoOnScreen::GetResourceId();
     m_context     = NULL;
     m_buttonTouch = false;
     ICO_TRA("Leave");
 }
+
 //--------------------------------------------------------------------------
 /**
  * @brief   CicoOnScreen::~CicoOnScreen
@@ -74,20 +74,12 @@ CicoOSPopWindow::CicoOSPopWindow(notification_h noti) : CicoNotification(noti)
 //--------------------------------------------------------------------------
 CicoOSPopWindow::~CicoOSPopWindow(void)
 {
-    ICO_TRA("Enter sur:%d, priv_id:%d", m_resourceId, GetPrivId());
-    if (NULL != m_window) {
-        ecore_evas_free(m_window);
-        m_window = NULL;
-    }
-    // if (NULL != m_icon) /* import m_window */
-    m_icon = NULL;
-    // if (NULL != m_theme) /* import m_window */
-    m_theme = NULL;
+    ICO_TRA("Enter sur:%08x, priv_id:%d", m_resourceId, GetPrivId());
+
     if (NULL != m_context) {
         int r = ico_syc_release_res(m_context);
         ICO_DBG("_____ %d = ico_syc_release_res", r);
     }
-
     ICO_DBG("_____ %d, %d", (int)m_buttonTouch, (int)m_appsvc_pkgname.empty());
 
     if ((true == m_buttonTouch) && (false == m_appsvc_pkgname.empty())) {
@@ -98,6 +90,17 @@ CicoOSPopWindow::~CicoOSPopWindow(void)
         }
     }
 
+    if (m_theme)    {
+        usleep(POPUP_DELETE_WAIT*1000);
+        evas_object_hide(m_theme);
+        evas_object_del(m_theme);
+        m_theme = NULL;
+    }
+    if (m_icon) {
+        evas_object_hide(m_icon);
+        evas_object_del(m_icon);
+        m_icon = NULL;
+    }
     ICO_TRA("Leave");
 }
 
@@ -114,7 +117,8 @@ bool
 CicoOSPopWindow::showPopup()
 {
     ICO_TRA("Enter");
-    if (NULL == m_window) {
+
+    if (NULL == m_theme) {
         if (false == InitializeWindow()) {
             ICO_TRA("Leave false");
             return false;
@@ -141,8 +145,7 @@ CicoOSPopWindow::showPopup()
     // Get icon path
     const char *icon = GetIconPath();
     ICO_DBG("Received: %s : %i : %s : %s : %s : %p",
-            pkgname, priv_id, title, content,
-            text, (void *)service_handle);
+            pkgname, priv_id, title, content, text, (void *)service_handle);
 
     if (NULL != service_handle) {
         const char* pn = appsvc_get_pkgname(service_handle);
@@ -203,7 +206,7 @@ CicoOSPopWindow::showPopup()
     return true;
 }
 
-bool 
+bool
 CicoOSPopWindow::acquireRes()
 {
     ICO_TRA("Enter");
@@ -213,7 +216,7 @@ CicoOSPopWindow::acquireRes()
     }
     ico_syc_res_window_t w;
     makeResWindowT(w);
-    m_context = ico_syc_acquire_res( &w, NULL, NULL, ICO_SYC_RES_ONSCREEN);
+    m_context = ico_syc_acquire_res(&w, NULL, NULL, ICO_SYC_RES_ONSCREEN);
     if (NULL == m_context) {
         ICO_TRA("Leave false");
         return false;
@@ -244,7 +247,7 @@ CicoOSPopWindow::hidePopup(bool buttonTouch)
     ICO_TRA("Leave");
 }
 
-bool    
+bool
 CicoOSPopWindow::releaseRes()
 {
     ICO_TRA("Enter");
@@ -261,10 +264,9 @@ CicoOSPopWindow::releaseRes()
     return false;
 }
 
-
 //--------------------------------------------------------------------------
 /**
- * @brief   CicoOnScreen::InitializePopup
+ * @brief   CicoOnScreen::InitializeWindow
  *          Initialize popup window
  *
  * @param[in]   none
@@ -275,9 +277,12 @@ bool
 CicoOSPopWindow::InitializeWindow(void)
 {
     ICO_TRA("Enter");
-    if (false == createMainWindow()) {
-        ICO_TRA("Leave(ERR)");
-        return false;
+
+    if (NULL == m_window) {
+        if (false == createMainWindow()) {
+            ICO_TRA("Leave(ERR)");
+            return false;
+        }
     }
     m_theme = edje_object_add(ecore_evas_get(m_window));
     if (NULL == m_theme) {
@@ -285,7 +290,7 @@ CicoOSPopWindow::InitializeWindow(void)
         ICO_TRA("Leave(ERR)");
         return false;
     }
-    if (!edje_object_file_set(m_theme, ICO_OS_THEMES_EDJ_FILEPATH, "main")) {
+    if (! edje_object_file_set(m_theme, ICO_OS_THEMES_EDJ_FILEPATH, "main")) {
         Edje_Load_Error err = edje_object_load_error_get(m_theme);
         const char *errmsg = edje_load_error_str(err);
         ICO_ERR("could not load 'main' from onscreen.edj: %s", errmsg);
@@ -297,8 +302,9 @@ CicoOSPopWindow::InitializeWindow(void)
     m_icon = evas_object_image_filled_add(ecore_evas_get(m_window));
     evas_object_pointer_mode_set(m_icon, EVAS_OBJECT_POINTER_MODE_NOGRAB);
     edje_object_part_swallow(m_theme, "icon", m_icon);
+
     /* getting size of screen */
-    /* home screen size is full of display*/
+    /* home screen size is full of display */
     int display_width  = 0;
     int display_height = 0;
     ecore_wl_screen_size_get(&display_width, &display_height);
@@ -331,6 +337,7 @@ bool
 CicoOSPopWindow::createMainWindow()
 {
     ICO_TRA("Enter");
+
     // Window setup
     m_window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, "frame=0");
     if (NULL == m_window) {
@@ -338,12 +345,27 @@ CicoOSPopWindow::createMainWindow()
         ICO_TRA("Leave(ERR)");
         return false;
     }
+
+    ecore_evas_title_set(m_window, POPUP_WINDOW_TITLE);
     ecore_evas_alpha_set(m_window, EINA_TRUE);
     ecore_evas_show(m_window);
+
     ICO_TRA("Leave");
     return true;
 }
 
+void
+CicoOSPopWindow::removeMainWindow()
+{
+    ICO_TRA("Enter");
+
+    if (NULL != m_window) {
+        ecore_evas_free(m_window);
+        m_window = NULL;
+    }
+    ICO_TRA("Leave");
+}
+
 //--------------------------------------------------------------------------
 /**
  * @brief   callback function of evas mouse up event
@@ -369,32 +391,16 @@ CicoOSPopWindow::evasMouseUpCB(void *data, Evas *e, Evas_Object *obj,
 }
 
 
-static char id0_ECU[]         = "Center";
-
-static char id00_display[]   = "Center";
-// static char id01_display[]   = "Mid";
-
-// static char id001_layer[]    = "Application";
-// static char id002_layer[]    = "SoftKeyboard";
-// static char id003_layer[]    = "HomeScreen";
-// static char id004_layer[]    = "ControlBar";
-// static char id005_layer[]    = "InterruptApp";
-static char id006_layer[]    = "OnScreen";
-// static char id007_layer[]    = "Touch";
-// static char id008_layer[]    = "Cursor";
-// static char id011_layer[]    = "MainApp";
-// static char id012_layer[]    = "SubDispMainApp";
-// static char id013_layer[]    = "SubDispSubApp";
+static const char id0_ECU[]        = "Center";
 
-static char id00611_layout[] = "Whole";
-// static char id00612_layout[] = "Half";
+static const char id00_display[]   = "Center";
+static const char id006_layer[]    = "OnScreen";
+static const char id00611_layout[] = "Whole";
+static const char id006111_area[]  = "Full";
 
-static char id006111_area[]  = "Full";
-// static char id006121_area[]  = "Upper";
-// static char id006122_area[]  = "Lower";
+static const char role_incoming[]  = "incoming";
+static const char role_message[]   = "message";
 
-static char role_incoming[] = "incoming";
-static char role_message[]  = "message";
 void
 CicoOSPopWindow::makeResWindowT(ico_syc_res_window_t& w)
 {
index ff67716..087828a 100644 (file)
 #define STATUS_BAR_HEIGHT    64
 #define CTRL_BAR_HEIGHT      128
 #define WIDTH                1080
-#if 1
 #define HEIGHT               1920
-#else
-#define HEIGHT               (1920 - STATUS_BAR_HEIGHT - CTRL_BAR_HEIGHT)
-#endif
 
 /* Popup Size */
 #define POPUP_WIDTH         640
 #define POPUP_FRAME_WIDTH   (POPUP_WIDTH+POPUP_FRAME_THICK)
 #define POPUP_FRAME_HEIGHT  (POPUP_HEIGHT+POPUP_FRAME_THICK)
 
-#if 0
-#define POPUP_ST_X          ((WIDTH-POPUP_WIDTH)/2)
-#define POPUP_ST_Y          ((HEIGHT-POPUP_HEIGHT)/2)
+/* OnScreen window name(title) */
+#define POPUP_WINDOW_TITLE  "OnScreen"
 
-/* Popup Frame Size */
-#define POPUP_FRAME_THICK   10
-#define POPUP_FRAME_WIDTH   (POPUP_WIDTH+POPUP_FRAME_THICK)
-#define POPUP_FRAME_HEIGHT  (POPUP_HEIGHT+POPUP_FRAME_THICK)
-#define POPUP_FRAME_ST_X    (POPUP_ST_X-POPUP_FRAME_THICK/2)
-#define POPUP_FRAME_ST_Y    (POPUP_ST_Y-POPUP_FRAME_THICK/2)
-
-/* Popup Icon Size */
-#define POPUP_ICON_WIDTH    50
-#define POPUP_ICON_HEIGHT   50
-#define POPUP_ICON_ST_X     POPUP_ST_X
-#define POPUP_ICON_ST_Y     POPUP_ST_Y
-
-/* Popup Title Size */
-#define POPUP_TITLE_WIDTH   (POPUP_WIDTH-POPUP_ICON_WIDTH)
-#define POPUP_TITLE_HEIGHT  POPUP_ICON_HEIGHT
-#define POPUP_TITLE_ST_X    (POPUP_ST_X+POPUP_ICON_WIDTH)
-#define POPUP_TITLE_ST_Y    POPUP_ST_Y
-
-/* Popup Content BG Size */
-#define POPUP_CONTENT_BG_WIDTH  POPUP_WIDTH
-#define POPUP_CONTENT_BG_HEIGHT (POPUP_HEIGHT-POPUP_TITLE_HEIGHT)
-#define POPUP_CONTENT_BG_ST_X   POPUP_ST_X
-#define POPUP_CONTENT_BG_ST_Y   (POPUP_ST_Y+POPUP_TITLE_HEIGHT)
-
-/* Popup Content Size */
-#define POPUP_CONTENT_WIDTH  POPUP_WIDTH
-#define POPUP_CONTENT_HEIGHT POPUP_TITLE_HEIGHT
-#define POPUP_CONTENT_ST_X   POPUP_ST_X
-#define POPUP_CONTENT_ST_Y   (POPUP_ST_Y+POPUP_TITLE_HEIGHT+(POPUP_HEIGHT-POPUP_CONTENT_HEIGHT)/2)
-
-#define ICO_ORIENTATION_VERTICAL (1) 
-#define ICO_ORIENTATION_HORIZONTAL (2)
-
-#define LEMOLO_PKGNAME       "org.tizen.dialer"
-#endif
+/* Wait time for delete popup(ms) */
+#define POPUP_DELETE_WAIT   100
 
 #define FALSE                0
 #define TRUE                 1
 
-#if 0
-#define ICON_PATH      (char *)"/usr/share/icons/default/small/org.tizen.dialer.png"
-#endif
 #define ICO_OS_THEMES_EDJ_FILEPATH "/usr/apps/org.tizen.ico.onscreen/res/themes/onscreen.edj"
 /*============================================================================*/
 /* Define data types                                                          */
@@ -131,14 +89,16 @@ public:
         return (const CicoNotification&)*this;
     }
     bool    createMainWindow();
+    void    removeMainWindow();
+
 private:
     bool    InitializeWindow(void);
     static void evasMouseUpCB(void *data, Evas *e, Evas_Object *obj,
                               void *event_info);
     void    makeResWindowT(ico_syc_res_window_t& w);
+    static Ecore_Evas*  m_window;
 
 public:
-    Ecore_Evas*  m_window;
     Evas_Object* m_icon;
     Evas_Object* m_theme;
     uint32_t     m_resourceId;
@@ -146,6 +106,5 @@ public:
     std::string  m_appsvc_pkgname;
     bool         m_buttonTouch;
 };
-
 #endif  // __CICO_ONSCREEN_POP_WINDOW_H__
 // vim:set expandtab ts=4 sw=4:
index 9ba5b3b..8dcfc8a 100644 (file)
@@ -23,6 +23,7 @@ using namespace std;
 // static members
 //==========================================================================
 CicoOnScreen * CicoOnScreen::os_instance=NULL;
+uint32_t    CicoOnScreen::surfaceid = 0;
 
 //==========================================================================
 // functions
@@ -57,23 +58,26 @@ CicoOnScreen::CicoOnScreen(void)
 //--------------------------------------------------------------------------
 CicoOnScreen::~CicoOnScreen(void)
 {
-//    ICO_TRA("CicoOnScreen::~CicoOnScreen Enter");
+//  ICO_TRA("CicoOnScreen::~CicoOnScreen Enter");
     list<CicoOSPopWindow*>::iterator p = m_mngWin.begin();
     while (p != m_mngWin.end()) {
         CicoOSPopWindow* pt = *p;
+        pt->removeMainWindow();
         delete pt;
     }
     m_mngWin.clear();
     p = m_waitMngWin.begin();
     while (p != m_waitMngWin.end()) {
         CicoOSPopWindow* pt = *p;
+        pt->removeMainWindow();
         delete pt;
     }
     m_waitMngWin.clear();
 
     delete m_request;
     m_request = NULL;
-//    ICO_TRA("CicoOnScreen::~CicoOnScreen Leave");
+    m_del = false;
+//  ICO_TRA("CicoOnScreen::~CicoOnScreen Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -101,6 +105,7 @@ CicoOnScreen::StartOnScreen(void)
     CicoOSClient* cosc = CicoOSClient::getInstance();
     cosc->connect();
 
+    // create surface
     if (NULL == m_reserve) {
         m_reserve = new CicoOSPopWindow(NOTIFICATION_TYPE_NONE);
         m_reserve->createMainWindow();
@@ -122,7 +127,7 @@ bool CicoOnScreen::insertNoti(notification_h noti_h)
         ICO_TRA("Leave (false)");
         return false;
     }
-    if (!w->Empty()) {
+    if (! w->Empty()) {
         if (NOTIFICATION_TYPE_NOTI == w->GetType()) {
             m_waitMngWin.push_back(w);
             w = NULL;
@@ -136,6 +141,7 @@ bool CicoOnScreen::insertNoti(notification_h noti_h)
     ICO_TRA("Leave (true)");
     return true;
 }
+
 bool CicoOnScreen::deleteNoti(int priv_id)
 {
     ICO_TRA("Enter");
@@ -233,6 +239,21 @@ CicoOnScreen::NotificationCallback(void *data, notification_type_e type,
     ICO_TRA("Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ * @brief   CicoOnScreen::GetResourceId
+ *          Get resource id (sourface id)
+ *
+ * @param      nothing
+ * @return     resource id
+ */
+//--------------------------------------------------------------------------
+uint32_t
+CicoOnScreen::GetResourceId(void)
+{
+    return CicoOnScreen::surfaceid;
+}
+
 bool CicoOnScreen::requestShowSC()
 {
     ICO_TRA("Enter");
@@ -245,26 +266,35 @@ bool CicoOnScreen::requestShowSC()
         return false;
     }
 
-    list<CicoOSPopWindow*>::iterator p = m_waitMngWin.begin();
-    m_del = false;
-    m_request = *p;
-    m_waitMngWin.remove(m_request);
-    bool r = m_request->showPopup();
-    while (false == r) { // fail showPop request
-        ICO_ERR("_____ Fail SHOW POP REQUEST(%d)",
-                m_request->GetPrivId());
-        delete m_request;
-        m_request = NULL;
-        if (m_waitMngWin.empty()) {
-            break;
-        }
-        p = m_waitMngWin.begin();
+    list<CicoOSPopWindow*>::iterator p;
+    bool r;
+    while (1) {
         m_del = false;
+        p = m_waitMngWin.begin();
         m_request = *p;
         m_waitMngWin.remove(m_request);
         r = m_request->showPopup();
+        if (true == r) {
+            r = m_request->acquireRes();
+            if (true == r)  {
+                if (true == m_del)  {
+                    m_request->hidePopup();
+                    m_del = false;
+                }
+            }
+            else    {
+                ICO_ERR("_____ Fail Acquire Resource(%d)", m_request->GetPrivId());
+            }
+        }
+        else    {
+            ICO_ERR("_____ Fail SHOW POP REQUEST(%d)", m_request->GetPrivId());
+        }
+        if (true == r)      break;
+        delete m_request;
+        m_request = NULL;
+        if (m_waitMngWin.empty())   break;
     }
-    ICO_TRA("Leave %s", r? "true": "false");
+    ICO_TRA("Leave %s", r ? "true": "false");
     return r;
 }
 
@@ -282,6 +312,7 @@ CicoOnScreen::EventCallBack(const ico_syc_ev_e event,
                             const void *detail, void *user_data)
 {
     ICO_TRA("Enter(event %d, %x, %x)", (int)event, detail, user_data);
+
     ico_syc_res_info_t *ri = (ico_syc_res_info_t*) detail;
     if (NULL == ri) {
         ICO_ERR("____ CALLBACK NG PARAM");
@@ -317,21 +348,22 @@ CicoOnScreen::EventCallBack(const ico_syc_ev_e event,
             ICO_TRA("_____ no WINDOW");
             break;  // break of switch event
         }
-        os_instance->entryWindowId(ri->window->resourceId);
+        CicoOnScreen::surfaceid = ri->window->resourceId;
+        ICO_TRA("_____ surfaceid=%08x", CicoOnScreen::surfaceid);
         break;  // break of switch event
     }
     default:
         ICO_TRA("_____ UNKNOWN event(%d)", (int)event);
         break;  // break of switch event
     }
-
     ICO_TRA("Leave");
 }
 
 bool
 CicoOnScreen::releaseWindow(uint32_t resourceId)
 {
-    ICO_TRA("Enter(%d)", resourceId);
+    ICO_TRA("Enter(%08x)", resourceId);
+
     bool bR = false;
     list<CicoOSPopWindow*> tmp;
 
@@ -345,36 +377,21 @@ CicoOnScreen::releaseWindow(uint32_t resourceId)
     p = tmp.begin();
     for (; p != tmp.end(); ++p) {
         CicoOSPopWindow* w = *p;
+        if (w == m_request) {
+            m_request = NULL;
+        }
         m_mngWin.remove(w);
         delete w;
         bR = true;
     }
     tmp.clear();
 
-    ICO_TRA("Leave %s", bR? "true": "false");
-    return bR;
-}
-
-bool
-CicoOnScreen::entryWindowId(uint32_t resourceId)
-{
-    ICO_TRA("Enter(%d)", resourceId);
-    bool bR = false;
-    if (NULL != m_request) {
-        m_request->m_resourceId = resourceId;
-        if (true == m_request->acquireRes()) {
-            m_mngWin.push_back(m_request);
-            if (true == m_del) {
-                ICO_TRA("____ HIDE REQUEST");
-                m_request->hidePopup();
-            }
-        }
-        else {
-            delete m_request;
-        }
-        m_del = false;
+    if (m_request)  {
+        delete m_request;
         m_request = NULL;
-        bR = requestShowSC();
+        m_del = false;
+
+        (void) requestShowSC();
     }
     ICO_TRA("Leave %s", bR? "true": "false");
     return bR;
index 74f5abd..8248630 100644 (file)
@@ -64,18 +64,21 @@ public:
                                      notification_type_e type,
                                      notification_op *op_list,
                                      int num_op);
+
+    static uint32_t GetResourceId(void);
+
 protected:
     bool requestShowSC();
 
     static void EventCallBack(const ico_syc_ev_e event,
                               const void *detail,
                               void *user_data);
-    bool entryWindowId(uint32_t resourceId);
     bool releaseWindow(uint32_t resourceId);
     bool insertNoti(notification_h noti_h);
     bool deleteNoti(int priv_id);
 
     static CicoOnScreen *os_instance;
+    static uint32_t     surfaceid;
 
 protected:
     CicoNotificationService notiservice_;
index d7070e9..78d483f 100644 (file)
@@ -80,8 +80,8 @@ insert_notification(notification_type_e type,
                errorToString(noti_err));
         return -1;
     }
-     
-    //set Title 
+
+    //set Title
     if (NULL == title) {
         return -1;
     }
@@ -94,7 +94,7 @@ insert_notification(notification_type_e type,
         cout << "Failed to set notification title <error code>:"<< noti_err<<endl;
         return -1;
     }
-    
+
     //set Content
     if (NULL == content) {
         return -1;
@@ -108,8 +108,8 @@ insert_notification(notification_type_e type,
         cout << "Failed to set notification content <error code>:"<< noti_err<<endl;
         return -1;
     }
-    
-    //set Icon_path 
+
+    //set Icon_path
     if (NULL == icon) {
         return -1;
     }
@@ -127,24 +127,24 @@ insert_notification(notification_type_e type,
         printf("notification_insert failed(%s).\n",
                errorToString(noti_err));
         return -1;
-    } 
+    }
 
     //free to notification
     noti_err = notification_free(noti);
     if (noti_err != NOTIFICATION_ERROR_NONE) {
         cout <<"Failed to free notification <error code>:"<< noti_err <<endl;
         return -1;
-    } 
+    }
+
     return 0;
-} 
+}
 
 int
 main(int argc, char **argv)
 {
     const char* msgTyp = "TYPE_NOTI";
     notification_type_e nType = NOTIFICATION_TYPE_NOTI;
-    
+
     if (argc == 2) {
         string sargv1(argv[1]);
         if (0 == sargv1.compare("--ongoing")) {
@@ -154,46 +154,46 @@ main(int argc, char **argv)
     }
 
     cout << "Notification TestProgram Start("<<msgTyp<<")=========" <<endl;
-    
+
     insert_notification(nType,
                         NOTIFICATION_GROUP_ID_DEFAULT,
                         NOTIFICATION_PRIV_ID_NONE,
                         "org.tizen.dialer",
-                        "test_title",
+                        "test_title1",
                         "0123456789012345678901234",
                         "/usr/share/icons/default/small/org.tizen.dialer.png");
 
     insert_notification(nType,
                         NOTIFICATION_GROUP_ID_NONE,
                         NOTIFICATION_PRIV_ID_NONE,
-                        "GV3ySIINq7.GhostCluster",
-                        "test_title",
-                        "test_content",
-                        "/opt/share/icons/default/small/GV3ySIINq7.GhostCluster.png");
+                        "terminal",
+                        "test_title2",
+                        "test_content2",
+                        "/usr/share/icons/default/small/terminal.png");
 
     insert_notification(nType,
                         NOTIFICATION_GROUP_ID_NONE,
                         NOTIFICATION_PRIV_ID_NONE,
-                        "ODBQpKvkS1.Settings",
-                        "test_title",
-                        "test_content",
-                        "/opt/share/icons/default/small/ODBQpKvkS1.Settings.png");
+                        "navigator",
+                        "test_title3",
+                        "test_content3",
+                        "/usr/share/icons/default/small/navigator.png");
 
     insert_notification(nType,
                         NOTIFICATION_GROUP_ID_NONE,
                         NOTIFICATION_PRIV_ID_NONE,
-                        "lYjFlj49Q4.saythis",
-                        "test_title",
-                        "test_content",
-                        "/opt/share/icons/default/small/lYjFlj49Q4.saythis.png");
+                        "smartdevicelink",
+                        "test_title4",
+                        "test_content4",
+                        "/usr/share/icons/default/small/devices.png");
 
     insert_notification(nType,
                         NOTIFICATION_GROUP_ID_NONE,
                         NOTIFICATION_PRIV_ID_NONE,
-                        "t8j6HTRpuz.MediaPlayer",
-                        "test_title",
-                        "test_content",
-                        "/opt/share/icons/default/small/t8j6HTRpuz.MediaPlayer.png");
+                        "org.tizen.ico.app-soundsample",
+                        "test_title5",
+                        "test_content5",
+                        "/usr/share/icons/default/small/org.tizen.ico.app-soundsample.png");
 
     cout << "Notification_TestProgram End!=========" <<endl;
     return 0;