union _updated {
struct _slave {
- int (*dbox)(const char *pkgname, const char *id, int idx, int x, int y, int w, int h);
- int (*gbar)(const char *pkgname, const char *id, int idx, const char *descfile, int x, int y, int w, int h);
+ int (*send)(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile);
} slave;
struct _app {
- int (*dbox)(const char *id, int x, int y, int w, int h);
- int (*gbar)(const char *id, int x, int y, int w, int h);
- int (*dbox_extra)(const char *id, int idx, int x, int y, int w, int h);
- int (*gbar_extra)(const char *id, int idx, int x, int y, int w, int h);
+ int (*send)(const char *id, int idx, int x, int y, int w, int h, int gbar);
} app;
} updated;
} s_info = {
#define FUNC_PREFIX "dynamicbox_"
#define FUNC_DYNAMICBOX_SEND_UPDATED FUNC_PREFIX "send_updated"
-#define FUNC_DYNAMICBOX_SEND_DESC_UPDATED FUNC_PREFIX "send_desc_updated"
-
-#define FUNC_DYNAMICBOX_PROVIDER_APP_DBOX_UPDATED FUNC_PREFIX "provider_app_dbox_updated"
-#define FUNC_DYNAMICBOX_PROVIDER_APP_GBAR_UPDATED FUNC_PREFIX "provider_app_gbar_updated"
-#define FUNC_DYNAMICBOX_PROVIDER_APP_DBOX_EXTRA_UPDATED FUNC_PREFIX "provider_app_dbox_extra_updated"
-#define FUNC_DYNAMICBOX_PROVIDER_APP_GBAR_EXTRA_UPDATED FUNC_PREFIX "provider_app_gbar_extra_updated"
-
+#define FUNC_DYNAMICBOX_PROVIDER_APP_UPDATED FUNC_PREFIX "provider_app_updated"
#define FUNC_DYNAMICBOX_FIND_PKGNAME FUNC_PREFIX "find_pkgname"
#define FUNC_DYNAMICBOX_REQUEST_UPDATE_BY_ID FUNC_PREFIX "request_update_by_id"
#define FUNC_DYNAMICBOX_TRIGGER_UPDATE_MONITOR FUNC_PREFIX "trigger_update_monitor"
static inline void load_update_function(void)
{
/* Must to be checked the slave function first. */
- s_info.updated.slave.dbox = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_SEND_UPDATED);
- s_info.updated.slave.gbar = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_SEND_DESC_UPDATED);
- if (s_info.updated.slave.dbox && s_info.updated.slave.gbar) {
+ s_info.updated.slave.send = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_SEND_UPDATED);
+ if (s_info.updated.slave.send) {
s_info.type = LOAD_TYPE_SLAVE;
DbgPrint("Slave detected\n");
} else {
- s_info.updated.app.dbox = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_PROVIDER_APP_DBOX_UPDATED);
- s_info.updated.app.gbar = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_PROVIDER_APP_GBAR_UPDATED);
- s_info.updated.app.dbox_extra = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_PROVIDER_APP_DBOX_EXTRA_UPDATED);
- s_info.updated.app.gbar_extra = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_PROVIDER_APP_GBAR_EXTRA_UPDATED);
- if (s_info.updated.app.dbox && s_info.updated.app.gbar
- && s_info.updated.app.dbox_extra && s_info.updated.app.gbar_extra)
- {
+ s_info.updated.app.send = dlsym(RTLD_DEFAULT, FUNC_DYNAMICBOX_PROVIDER_APP_UPDATED);
+ if (s_info.updated.app.send) {
s_info.type = LOAD_TYPE_APP;
DbgPrint("App detected\n");
}
}
}
-static int send_dbox_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h)
+static int send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
{
int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (s_info.type == LOAD_TYPE_APP) {
- if (idx == DBOX_PRIMARY_BUFFER) {
- ret = s_info.updated.app.dbox(id, x, y, w, h);
- } else {
- ret = s_info.updated.app.dbox_extra(id, idx, x, y, w, h);
- }
+ ret = s_info.updated.app.send(id, idx, x, y, w, h, gbar);
} else if (s_info.type == LOAD_TYPE_SLAVE) {
- ret = s_info.updated.slave.dbox(pkgname, id, idx, x, y, w, h);
+ ret = s_info.updated.slave.send(pkgname, id, idx, x, y, w, h, gbar, descfile);
} else {
dynamicbox_damage_region_t region = {
.x = x,
.w = w,
.h = h,
};
- ret = dynamicbox_provider_send_updated(pkgname, id, ®ion);
- }
-
- return ret;
-}
-
-static int send_gbar_updated(const char *pkgname, const char *id, int idx, const char *descfile, int x, int y, int w, int h)
-{
- int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
-
- if (s_info.type == LOAD_TYPE_UNKNOWN) {
- load_update_function();
- }
-
- if (s_info.type == LOAD_TYPE_APP) {
- if (idx == DBOX_PRIMARY_BUFFER) {
- ret = s_info.updated.app.gbar(id, x, y, w, h);
- } else {
- ret = s_info.updated.app.gbar_extra(id, idx, x, y, w, h);
- }
- } else if (s_info.type == LOAD_TYPE_SLAVE) {
- ret = s_info.updated.slave.gbar(pkgname, id, idx, descfile, x, y, w, h);
- } else {
- dynamicbox_damage_region_t region = {
- .x = x,
- .y = y,
- .w = w,
- .h = h,
- };
- ret = dynamicbox_provider_send_desc_updated(pkgname, id, descfile, ®ion);
+ ret = dynamicbox_provider_send_updated(pkgname, id, idx, ®ion, gbar, descfile);
}
return ret;
*/
if (user_data->is_gbar == 1) {
- if (send_gbar_updated(pkgname, id, DBOX_PRIMARY_BUFFER, NULL, 0, 0, w, h) < 0) {
+ if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
ErrPrint("Failed to send GBAR updated (%s)\n", id);
}
} else {
- if (send_dbox_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h) < 0) {
+ if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
ErrPrint("Failed to send updated (%s)\n", id);
}
}
ErrPrint("Failed to get size (%s)\n", id);
}
- if (user_data->is_gbar == 1) {
- if (send_gbar_updated(pkgname, id, idx, NULL, 0, 0, w, h) < 0) {
- ErrPrint("Failed to send GBAR updated (%s) %d\n", id, idx);
- }
- } else {
- if (send_dbox_updated(pkgname, id, idx, 0, 0, w, h) < 0) {
- ErrPrint("Failed to send updated (%s) %d\n", id, idx);
- }
+ if (send_updated(pkgname, id, idx, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
+ ErrPrint("Failed to send GBAR updated (%s) %d\n", id, idx);
}
}
* to make more efficient updates
*/
- if (user_data->is_gbar == 1) {
- if (send_gbar_updated(pkgname, id, DBOX_PRIMARY_BUFFER, NULL, 0, 0, w, h) < 0) {
- ErrPrint("Failed to send GBAR updated (%s)\n", id);
- }
- } else {
- if (send_dbox_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h) < 0) {
- ErrPrint("Failed to send updated (%s)\n", id);
- }
+ if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
+ ErrPrint("Failed to send GBAR updated (%s)\n", id);
}
return DBOX_STATUS_ERROR_NONE;