Summary: Library for developing the widget service provider
Version: 1.1.3
Release: 1
-Group: HomeTF/widget
+Group: Applications/Core Applications
License: Flora License, Version 1.1
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
BuildRequires: pkgconfig(eina)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: model-build-features
%if %{with wayland}
%else
Feature for life-cycle management by the master provider.
%package devel
-Summary: widget data provider development library (dev)
+Summary: Header & package configuration files
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
-Header & package configuration files for developing the widget service provider
+Widget data provider development library (dev)
%prep
%setup -q
# libwidget_provider_app
%package -n %{name}_app
Summary: Library for developing the widget app provider
-Group: HomeTF/widget
-License: Flora
-Requires: libwidget_provider
+Group: Applications/Core Applications
+License: Flora License, Version 1.1
%description -n %{name}_app
Provider APIs to develop the widget provider applications.
%package -n %{name}_app-devel
-Summary: Header & package configuration files to support development of the widget provider applications.
+Summary: Widget provider application development library (dev)
Group: Development/Libraries
Requires: %{name}_app
%description -n %{name}_app-devel
-widget provider application development library (dev)
+Header & package configuration files to support development of the widget provider applications.
+
+%post -n %{name}_app -p /sbin/ldconfig
+%postun -n %{name}_app -p /sbin/ldconfig
%files -n %{name}_app
%manifest %{name}.manifest
#include <dlog.h>
#include <widget_errno.h>
+#include <widget_service.h>
#include <widget_buffer.h>
#include <widget_util.h>
int errno;
-struct fb_info {
- char *id;
- int w;
- int h;
- int bufsz;
- void *buffer;
-
- int pixels;
- int handle;
+static struct info {
+ int master_disconnected;
+} s_info = {
+ .master_disconnected = 0,
};
int fb_init(void *disp)
{
+ s_info.master_disconnected = 0;
return WIDGET_ERROR_NONE;
}
static inline int sync_for_file(struct fb_info *info)
{
int fd;
- widget_fb_t *buffer;
+ widget_fb_t buffer;
+ const char *path;
buffer = info->buffer;
if (!buffer) {
return WIDGET_ERROR_NONE;
}
- if (buffer->state != CREATED) {
+ if (buffer->state != WIDGET_FB_STATE_CREATED) {
ErrPrint("Invalid state of a FB\n");
return WIDGET_ERROR_INVALID_PARAMETER;
}
- if (buffer->type != BUFFER_TYPE_FILE) {
+ if (buffer->type != WIDGET_FB_TYPE_FILE) {
DbgPrint("Ingore sync\n");
return WIDGET_ERROR_NONE;
}
- fd = open(widget_util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
+ path = widget_util_uri_to_path(info->id);
+ if (!path) {
+ ErrPrint("Invalid id: %s\n", info->id);
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ fd = open(path, O_WRONLY | O_CREAT, 0644);
if (fd < 0) {
- ErrPrint("open %s: %d\n", widget_util_uri_to_path(info->id), errno);
+ ErrPrint("open %s: %d\n", path, errno);
return WIDGET_ERROR_IO_ERROR;
}
return WIDGET_ERROR_NONE;
}
+static inline int sync_for_pixmap(struct fb_info *info)
+{
+ return WIDGET_ERROR_NONE;
+}
+
int fb_sync(struct fb_info *info)
{
if (!info) {
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
return sync_for_file(info);
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ return sync_for_pixmap(info);
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
return WIDGET_ERROR_NONE;
}
if (sscanf(info->id, SCHEMA_SHM "%d", &info->handle) == 1) {
DbgPrint("SHMID: %d\n", info->handle);
} else if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &info->handle, &info->pixels) == 2) {
- ErrPrint("Unsupported type\n");
- free(info->id);
- free(info);
- return NULL;
+ DbgPrint("PIXMAP: %d\n", info->handle);
} else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
info->handle = -1;
} else {
return info;
}
+int fb_has_gem(struct fb_info *info)
+{
+ return 0;
+}
+
+int fb_create_gem(struct fb_info *info, int auto_align)
+{
+ return WIDGET_ERROR_NOT_SUPPORTED;
+}
+
+int fb_destroy_gem(struct fb_info *info)
+{
+ return WIDGET_ERROR_NONE;
+}
+
+void *fb_acquire_gem(struct fb_info *info)
+{
+ return NULL;
+}
+
+int fb_release_gem(struct fb_info *info)
+{
+ return WIDGET_ERROR_NONE;
+}
+
int fb_destroy(struct fb_info *info)
{
if (!info) {
}
if (info->buffer) {
- widget_fb_t *buffer;
+ widget_fb_t buffer;
buffer = info->buffer;
buffer->info = NULL;
}
}
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)) && info->handle != 0) {
- /* Dead Code */
- ErrPrint("Invalid FB is created\n");
- return 0;
+ return 1;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM)) && info->handle > 0) {
return 1;
} else {
void *fb_acquire_buffer(struct fb_info *info)
{
- struct pixmap_info *pixmap_info;
- widget_fb_t *buffer;
+ widget_fb_t buffer;
void *addr;
if (!info) {
if (!info->buffer) {
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- /*!
- * Use the S/W backend
- */
- ErrPrint("Unsupported type\n");
return NULL;
} else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
info->bufsz = info->w * info->h * info->pixels;
return NULL;
}
- buffer->type = BUFFER_TYPE_FILE;
+ buffer->type = WIDGET_FB_TYPE_FILE;
buffer->refcnt = 0;
- buffer->state = CREATED;
+ buffer->state = WIDGET_FB_STATE_CREATED;
buffer->info = info;
info->buffer = buffer;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
buffer = info->buffer;
switch (buffer->type) {
- case BUFFER_TYPE_FILE:
+ case WIDGET_FB_TYPE_PIXMAP:
+ addr = NULL;
+ break;
+ case WIDGET_FB_TYPE_FILE:
buffer->refcnt++;
/* Fall through */
- case BUFFER_TYPE_SHM:
+ case WIDGET_FB_TYPE_SHM:
addr = buffer->data;
break;
- case BUFFER_TYPE_PIXMAP:
default:
addr = NULL;
break;
int fb_release_buffer(void *data)
{
- widget_fb_t *buffer;
- struct fb_info *info;
+ widget_fb_t buffer;
if (!data) {
return WIDGET_ERROR_NONE;
buffer = container_of(data, struct widget_fb, data);
- if (buffer->state != CREATED) {
+ if (buffer->state != WIDGET_FB_STATE_CREATED) {
ErrPrint("Invalid handle\n");
return WIDGET_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case BUFFER_TYPE_SHM:
+ case WIDGET_FB_TYPE_SHM:
/*!
* \note
* SHM can not use the "info"
ErrPrint("shmdt: %d\n", errno);
}
break;
- case BUFFER_TYPE_FILE:
+ case WIDGET_FB_TYPE_PIXMAP:
+ break;
+ case WIDGET_FB_TYPE_FILE:
buffer->refcnt--;
if (buffer->refcnt == 0) {
struct fb_info *info;
info = buffer->info;
-
- buffer->state = DESTROYED;
- free(buffer);
-
if (info && info->buffer == buffer) {
info->buffer = NULL;
}
+ buffer->state = WIDGET_FB_STATE_DESTROYED;
+ free(buffer);
}
break;
- case BUFFER_TYPE_PIXMAP:
default:
ErrPrint("Unknown type\n");
return WIDGET_ERROR_INVALID_PARAMETER;
widget_fb_t buffer;
if (!info) {
- return BUFFER_TYPE_ERROR;
+ return WIDGET_FB_TYPE_ERROR;
}
buffer = info->buffer;
if (!buffer) {
- int type = BUFFER_TYPE_ERROR;
+ int type = WIDGET_FB_TYPE_ERROR;
/*!
* \note
* Try to get this from SCHEMA
*/
if (info->id) {
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- type = BUFFER_TYPE_FILE;
+ type = WIDGET_FB_TYPE_FILE;
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ type = WIDGET_FB_TYPE_PIXMAP;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- type = BUFFER_TYPE_SHM;
+ type = WIDGET_FB_TYPE_SHM;
}
}
buffer = container_of(data, struct widget_fb, data);
- if (buffer->state != CREATED) {
+ if (buffer->state != WIDGET_FB_STATE_CREATED) {
ErrPrint("Invalid handle\n");
return WIDGET_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case BUFFER_TYPE_SHM:
+ case WIDGET_FB_TYPE_SHM:
if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
ErrPrint("shmctl: %d\n", errno);
ret = WIDGET_ERROR_FAULT;
ret = buf.shm_nattch; /*!< This means attached count of process */
break;
- case BUFFER_TYPE_FILE:
+ case WIDGET_FB_TYPE_PIXMAP:
+ ret = buffer->refcnt;
+ break;
+ case WIDGET_FB_TYPE_FILE:
ret = buffer->refcnt;
break;
- case BUFFER_TYPE_PIXMAP:
default:
ret = WIDGET_ERROR_INVALID_PARAMETER;
break;
return WIDGET_ERROR_NONE;
}
+int fb_stride(struct fb_info *info)
+{
+ int stride;
+
+ stride = info->w * info->pixels;
+ DbgPrint("Stride: %d\n", stride);
+
+ return stride;
+}
+
+void fb_master_disconnected(void)
+{
+ s_info.master_disconnected = 1;
+}
+
/* End of a file */