# Set required packages
INCLUDE(FindPkgConfig)
-IF (with_wayland)
- ADD_DEFINITIONS("-DWAYLAND")
+IF(with_wayland)
+ ADD_DEFINITIONS("-DWAYLAND")
ENDIF(with_wayland)
+IF(with_x11)
+ ADD_DEFINITIONS("-DX11")
+ENDIF(with_x11)
pkg_check_modules(libpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config)
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"lowmem-syspopup", 1,0,5,0,0,"org.tizen.lowmem-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"lowbat-syspopup", 1,0,5,0,0,"org.tizen.lowbat-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"net-popup", 0,0,-1,0,0,"org.tizen.net-popup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usb-syspopup", 1,0,-1,2,2,"org.tizen.usb-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"ims-syspopup", 1,1,-1,2,2,"org.tizen.ims-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mdm-syspopup", 1,1,5,0,0,"org.tizen.mdm-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"tickernoti-syspopup", 1,1,-1,2,2,"org.tizen.tickernoti-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usbotg-syspopup", 0,0,-1,0,0,"org.tizen.usbotg-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usb-syspopup", 1,0,-1,2,2,"org.tizen.usb-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"ims-syspopup", 1,1,-1,2,2,"org.tizen.ims-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mdm-syspopup", 1,1,5,0,0,"org.tizen.mdm-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"tickernoti-syspopup", 1,1,-1,2,2,"org.tizen.tickernoti-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usbotg-syspopup", 0,0,-1,0,0,"org.tizen.usbotg-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"allshare-popup", 0,0,-1,0,0,"org.tizen.allshare-popup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mmc-syspopup", 0,0,-1,0,0,"org.tizen.mmc-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mmc-syspopup", 0,0,-1,0,0,"org.tizen.mmc-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"datausage-syspopup", 1,0,-1,0,0,"org.tizen.datausage-syspopup");
-/*
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"drm", 0,0,5,0,0,"org.tizen.drm-popup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"incoming_call", 2,0,-1,2,2,"org.tizen.incoming_call");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"phone_lock", 2,0,-1,2,2,"org.tizen.screen_lock");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"screen_lock", 1,0,-1,0,2,"org.tizen.screen_lock");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"alarm", 1,0,-1,0,2,"org.tizen.alarm");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"timer", 1,0,5,0,2,"org.tizen.timer");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"schedule_alarm", 1,0,-1,0,2,"org.tizen.schedule_alarm");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"change_select_network", 0,0,-1,0,0,"org.tizen.change_select_network");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"privacy_lock", 0,0,-1,0,2,"org.tizen.privacy_lock");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"active_sync_policy", 0,0,-1,0,0,"org.tizen.active_sync_policy");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"memory_full", 0,1,5,0,0,"org.tizen.memory_full");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"charger_conn", 0,1,5,0,0,"org.tizen.charger_conn");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"sim_extraction", 0,1,5,0,0,"org.tizen.sim_extraction");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"time_zone_update", 0,1,5,0,0,"org.tizen.time_zone_update");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"nfc-syspopup", 0,1,3,0,0,"org.tizen.nfc-sys-popup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"push-syspopup", 2,0,5,0,0,"org.tizen.push-syspopup");
-*/
-
#define AUL_SP_DBUS_SIGNAL_INTERFACE "org.tizen.aul.syspopup"
#define AUL_SP_DBUS_LAUNCH_REQUEST_SIGNAL "syspopup_launch_request"
+#define WIN_PROP_NAME "SYSTEM_POPUP"
+
+#ifndef KEY_END
+#define KEY_END "XF86Stop"
#endif
+#endif /* __SIMPLE_UTIL__ */
syspopup *_syspopup_find_by_id(int id);
void _syspopup_del(int id);
-int _syspopup_init(void (*term_handler) (void *),
- gboolean(*timeout_handler) (void *));
+int _syspopup_init(void (*term_handler)(void *),
+ gboolean (*timeout_handler)(gpointer));
int _syspopup_reset_timeout(syspopup *sp, syspopup_info_t *info);
int _syspopup_set_term_type(syspopup *sp, syspopup_info_t *info);
int _syspopup_set_endkey_type(syspopup *sp, syspopup_info_t *info);
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
+%if %{with wayland}
+BuildRequires: pkgconfig(ecore-wayland)
+BuildRequires: pkgconfig(capi-ui-efl-util)
+%else
%if %{with x}
BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(ecore-x)
%endif
+%endif
BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-system-settings)
%description
syspopup package for popup
%build
%cmake . \
-%if %{with wayland} && !%{with x}
+%if %{with wayland}
-Dwith_wayland=TRUE \
+%else
+%if %{with x}
+-Dwith_x11=TRUE \
+%endif
%endif
-DEXTRA_CFLAGS=-fPIC
#include <sys/types.h>
#include <grp.h>
#include <gio/gio.h>
+#include <bundle.h>
#include <bundle_internal.h>
/* For multi-user support */
static int sp_id = 0;
static void (*_term_handler)(void *data);
-static gboolean (*_timeout_handler)(void *data);
+static gboolean (*_timeout_handler)(gpointer data);
syspopup *_syspopup_get_head(void)
{
static void __syspopup_free(syspopup *sp)
{
- if (sp->name != NULL)
+ if (sp->name)
free(sp->name);
- if (sp->dupped_bundle != NULL)
+ if (sp->dupped_bundle)
bundle_free(sp->dupped_bundle);
free(sp);
syspopup *tmp;
syspopup *target;
- target = _syspopup_find_by_id(id);
+ if (syspopup_head == NULL)
+ return;
- if (syspopup_head == NULL || target == NULL)
+ target = _syspopup_find_by_id(id);
+ if (target == NULL)
return;
if (syspopup_head == target) {
}
int _syspopup_init(void (*term_handler)(void *),
- gboolean (*timeout_handler)(void *))
+ gboolean (*timeout_handler)(gpointer))
{
GDBusConnection *conn = NULL;
GError *err = NULL;
if (info->timeout > 0) {
sp->timeout_id = g_timeout_add_seconds(info->timeout,
- _timeout_handler, (void *)sp->id);
- _D("add timeout - timeout : id=%d,timeout=%d(sec)",
+ _timeout_handler,
+ (gpointer)((intptr_t)sp->id));
+ _D("add timeout: id = %d, sec = %d",
sp->id, info->timeout);
}
int _syspopup_set_name_to_bundle(bundle *b, char *popup_name)
{
+ int ret;
+
if (b == NULL || popup_name == NULL)
return -1;
- bundle_add(b, SYSPOPUP_NAME, popup_name);
+ ret = bundle_add(b, SYSPOPUP_NAME, popup_name);
+ if (ret != BUNDLE_ERROR_NONE)
+ return -1;
return 0;
}
static sqlite3 *db = NULL;
-/**
- * * db initialize
- * */
+/* db initialize */
static int __init(void)
{
int rc;
rc, sqlite3_extended_errcode(db));
return -1;
} else {
- _D("db open sucess");
+ _D("db open success");
}
return 0;
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(syspopup-app C)
-SET(SRCS syspopup-app.c)
+SET(SRCS src/syspopup-app.c)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
SET(VENDOR "tizen")
SET(PACKAGE ${PROJECT_NAME})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/syspopup)
INCLUDE(FindPkgConfig)
-pkg_check_modules(syspopup_app_pkgs REQUIRED appcore-efl libtzplatform-config)
+pkg_check_modules(syspopup_app_pkgs REQUIRED
+ capi-appfw-application
+ elementary
+ capi-system-system-settings)
FOREACH(flag ${syspopup_app_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
--- /dev/null
+/*
+ * syspopup-app
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef __SYSPOPUP_APP_H__
+#define __SYSPOPUP_APP_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "SYSPOPUP-APP"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _E
+#define _E _ERR
+#endif
+
+#ifndef _D
+#define _D _DBG
+#endif
+
+#ifndef _I
+#define _I _INFO
+#endif
+
+#ifndef PACKAGE
+#define PACKAGE "syspopup-app"
+#endif
+
+#define KEY_SYSPOPUP_TITLE "_SYSPOPUP_TITLE_"
+#define KEY_SYSPOPUP_CONTENT "_SYSPOPUP_CONTENT_"
+
+#define BUF_LEN 256
+
+#endif /* __SYSPOPUP_APP_H__ */
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.syspopup-app" version="0.1.0-0" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.syspopup-app" api-version="3.0" version="0.1.0-0" install-location="internal-only">
<label>syspopup-app</label>
<author email="sewook7.park@samsung.com" href="www.samsung.com">Sewook Park</author>
<description>syspopup-app</description>
<ui-application appid="org.tizen.syspopup-app" exec="/usr/bin/syspopup-app" nodisplay="true" multiple="false" type="capp" taskmanage="false">
<label>syspopup-app</label>
- <icon> </icon>
</ui-application>
</manifest>
--- /dev/null
+/*
+ * syspopup-app
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include <stdio.h>
+#include <app.h>
+#include <app_control.h>
+#include <app_control_internal.h>
+#include <Elementary.h>
+#include <system_settings.h>
+
+#include "syspopup.h"
+#include "syspopup-app.h"
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *popup;
+} appdata_s;
+
+syspopup_handler syspopup_h = {
+ .def_term_fn = NULL,
+ .def_timeout_fn = NULL,
+};
+
+static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_app_exit();
+}
+
+static Evas_Object *create_win(const char *name)
+{
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+ if (win == NULL)
+ return NULL;
+
+ elm_win_title_set(win, name);
+ elm_win_borderless_set(win, EINA_TRUE);
+ elm_win_alpha_set(win, EINA_TRUE);
+
+ evas_object_smart_callback_add(win, "delete,request",
+ win_delete_request_cb, NULL);
+
+ return win;
+}
+
+static bool app_create(void *data)
+{
+ appdata_s *ad = data;
+
+ ad->win = create_win(PACKAGE);
+ if (ad->win == NULL)
+ return false;
+
+ return true;
+}
+
+static void response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_app_exit();
+}
+
+static void block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ appdata_s *ad = data;
+
+ if (ad == NULL)
+ return;
+
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+}
+
+static void set_popup_text(Evas_Object *popup, bundle *b)
+{
+ const char *value;
+ const char *title = "Unknown Title";
+ const char *content = "Unknown Content";
+
+ value = bundle_get_val(b, KEY_SYSPOPUP_TITLE);
+ if (value)
+ title = value;
+
+ elm_object_part_text_set(popup, "title,text", title);
+
+ value = bundle_get_val(b, KEY_SYSPOPUP_CONTENT);
+ if (value)
+ content = value;
+
+ elm_object_text_set(popup, content);
+}
+
+static void create_popup(appdata_s *ad, bundle *b)
+{
+ int ret;
+
+ ad->popup = elm_popup_add(ad->win);
+ if (ad->popup == NULL)
+ return;
+
+ ret = syspopup_create(b, &syspopup_h, ad->win, ad);
+ if (ret < 0)
+ return;
+
+ evas_object_show(ad->win);
+
+ elm_object_style_set(ad->popup, "char_wrap_style");
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(ad->popup, "block,clicked", block_clicked_cb, ad);
+ set_popup_text(ad->popup, b);
+ evas_object_smart_callback_add(ad->popup, "response", response_cb, ad);
+
+ evas_object_show(ad->popup);
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ int ret;
+ bundle *b = NULL;
+ appdata_s *ad = data;
+
+ ret = app_control_to_bundle(app_control, &b);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ return;
+
+ if (syspopup_has_popup(b)) {
+ syspopup_reset(b);
+ return;
+ }
+
+ create_popup(ad, b);
+}
+
+static void app_terminate(void *data)
+{
+ appdata_s *ad = data;
+
+ if (ad == NULL)
+ return;
+
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+
+ if (ad->win) {
+ evas_object_del(ad->win);
+ ad->win = NULL;
+ }
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ char *locale = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+
+ return;
+}
+
+int main(int argc, char *argv[])
+{
+ appdata_s ad = {0,};
+ int ret = 0;
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers;
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers, APP_EVENT_LANGUAGE_CHANGED,
+ ui_app_lang_changed, &ad);
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+
+ return ret;
+}
+++ /dev/null
-/*
- * syspopup
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include <stdio.h>
-#include <appcore-efl.h>
-
-#ifndef WAYLAND
-#include <Ecore_X.h>
-#endif
-
-#include "syspopup.h"
-#include "syspopup-app.h"
-
-#include <time.h>
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "SYSPOPUP-APP"
-
-#define _E(fmt, arg...) LOGE(fmt,##arg)
-#define _D(fmt, arg...) LOGD(fmt,##arg)
-
-/*
-struct quickpanel {
- int type;
- int priv_id;
- char *title;
- char *content;
- time_t rtime;
- bundle *args;
- bundle *args_group;
- int group_id;
-};
-*/
-
-int myterm(bundle *b, void *data)
-{
- /*
- char b_str[QP_BUF_LEN];
- int ret = 0;
- const char* val;
-
- struct appdata *ad = data;
- struct quickpanel* qp;
-
- val = bundle_get_val(b,"_INTERNAL_SYSPOPUP_NAME_");
- printf("[SYSTEM POPUP] Popup Name : %s\n", val);
-
- qp = malloc(sizeof(struct quickpanel));
- memset(qp,0,sizeof(struct quickpanel));
-
- //qp->type = QP_TYPE_SYSPOPUP;
- qp->type = quickpanel_get_type_id("org.tizen.syspopup-app", NULL, 0);
- qp->priv_id = QP_PRIVID;
- qp->title = ad->title;
- qp->content = ad->content;
- qp->args = b;
- qp->group_id = qp->priv_id;
-
- ret = quickpanel_insert(qp);
- if (ret < 0)
- printf("[SYSTEM POPUP] Error!! Cannot insert to quickpanel!\n");
-
- free(qp);
- */
- return 0;
-}
-
-int mytimeout(bundle *b, void* data)
-{
- /*
- char b_str[QP_BUF_LEN];
- int ret = 0;
- const char* val;
-
- struct appdata *ad = data;
- struct quickpanel* qp;
-
- val = bundle_get_val(b,"_INTERNAL_SYSPOPUP_NAME_");
- printf("[SYSTEM POPUP] Popup Name : %s\n", val);
-
- qp = malloc(sizeof(struct quickpanel));
- memset(qp,0,sizeof(struct quickpanel));
-
- //qp->type = QP_TYPE_SYSPOPUP;
- qp->type = quickpanel_get_type_id("org.tizen.syspopup-app", NULL, 0);
- qp->priv_id = QP_PRIVID;
- qp->title = ad->title;
- qp->content = ad->content;
- qp->args = b;
- qp->group_id = qp->priv_id;
-
- ret = quickpanel_insert(qp);
- if (ret < 0)
- printf("[SYSTEM POPUP] Error!! Cannot insert to quickpanel!\n");
-
- free(qp);
- */
- return 0;
-}
-
-syspopup_handler handler = {
- .def_term_fn = myterm,
- .def_timeout_fn = mytimeout
-};
-
-static void __win_del(void *data, Evas_Object * obj, void *event)
-{
- elm_exit();
-}
-
-/*
-static int rotate(enum appcore_rm m, void *data)
-{
- struct appdata *ad = data;
- int r;
-
- if (ad == NULL || ad->win == NULL)
- return 0;
-
- switch(m) {
- case APPCORE_RM_PORTRAIT_NORMAL:
- r = 0;
- break;
- case APPCORE_RM_PORTRAIT_REVERSE:
- r = 180;
- break;
- case APPCORE_RM_LANDSCAPE_NORMAL:
- r = 270;
- break;
- case APPCORE_RM_LANDSCAPE_REVERSE:
- r = 90;
- break;
- default:
- r = -1;
- break;
- }
-
- if (r >= 0)
- elm_win_rotation_with_resize_set(ad->win, r);
-
- return 0;
-}
-*/
-
-static Evas_Object *__create_win(const char *name)
-{
- Ecore_Evas *ee;
- Evas_Object *eo;
- int w;
- int h;
-
- eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
- if (eo) {
- elm_win_title_set(eo, name);
- elm_win_borderless_set(eo, EINA_TRUE);
-
- elm_win_alpha_set(eo, EINA_TRUE);
-
- evas_object_smart_callback_add(eo, "delete,request",
- __win_del, NULL);
-
- ee = ecore_evas_ecore_evas_get(evas_object_evas_get(eo));
- evas_output_size_get(ee, &w, &h);
- evas_object_resize(eo, w, h);
- }
-
- return eo;
-}
-
-static int __app_create(void *data)
-{
- struct appdata *ad = data;
- Evas_Object *win;
- int r;
-
- /* create window */
- win = __create_win(PACKAGE);
- if (win == NULL)
- return -1;
- ad->win = win;
- /* evas_object_show(win);*/
-
- /* init internationalization */
- r = appcore_set_i18n(PACKAGE, LOCALEDIR);
- if (r)
- return -1;
-
- /* appcore_set_rotation_cb(rotate, ad);*/
-
- appcore_measure_start();
- return 0;
-}
-
-static int __app_terminate(void *data)
-{
- struct appdata *ad = data;
-
- _D("__app_terminate called");
-
- if (ad->win)
- evas_object_del(ad->win);
-
- return 0;
-}
-
-static int __app_pause(void *data)
-{
- struct appdata *ad = data;
-
- return 0;
-}
-
-static int __app_resume(void *data)
-{
- struct appdata *ad = data;
-
- return 0;
-}
-
-static void __prt_recvd_bundle(const char *key, const char *value, void *d)
-{
- _D("recvd - key: %s, value: %s\n", key, value);
-}
-
-static void __response_cb(void *data, Evas_Object * obj, void *event_info)
-{
- if ((int)event_info != 5)
- evas_object_del(obj);
- elm_exit();
-}
-
-static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- evas_object_del(obj);
-}
-
-static int __app_reset(bundle *b, void *data)
-{
- struct appdata *ad = data;
- Evas_Object *popup;
- const char *val;
- int ret = 0;
-
- ad->b = bundle_dup(b);
-
- bundle_iterate(b, __prt_recvd_bundle, NULL);
-
- if (syspopup_has_popup(b)) {
- syspopup_reset(b);
- } else {
- popup = elm_popup_add(ad->win);
- if (popup != NULL) {
- ret = syspopup_create(b, &handler, ad->win, ad);
- evas_object_show(ad->win);
-
- if (ret == 0) {
- val = bundle_get_val(b, "_SYSPOPUP_TITLE_");
- if (val) {
- snprintf(ad->title, TITLE_BUF_LEN, "%s",
- val);
- } else {
- snprintf(ad->title, TITLE_BUF_LEN, "%s",
- "Unknown Title");
- }
-
- val = bundle_get_val(b, "_SYSPOPUP_CONTENT_");
- if (val) {
- snprintf(ad->content, CONTENT_BUF_LEN,
- "%s", val);
- } else {
- snprintf(ad->content, CONTENT_BUF_LEN,
- "%s", "Unknown Content");
- }
-
- elm_object_style_set(popup, "char_wrap_style");
- evas_object_size_hint_weight_set(popup,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, NULL);
- elm_object_part_text_set(popup, "title,text", ad->title);
- elm_object_text_set(popup, ad->content);
- evas_object_smart_callback_add(popup,
- "response",
- __response_cb,
- NULL);
-
- evas_object_show(popup);
- }
- }
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- struct appdata ad;
- struct appcore_ops ops = {
- .create = __app_create,
- .terminate = __app_terminate,
- .pause = __app_pause,
- .resume = __app_resume,
- .reset = __app_reset,
- };
-
- memset(&ad, 0x0, sizeof(struct appdata));
- ops.data = &ad;
-
- return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
-}
-
+++ /dev/null
-/*
- * syspopup
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#ifndef __SYSPOPUP_APP_H__
-#define __SYSPOPUP_APP_H__
-
-#include <Elementary.h>
-
-#if !defined(PACKAGE)
-# define PACKAGE "syspopup-app"
-#endif
-
-#define NAME_BUF_LEN 256
-#define TITLE_BUF_LEN 256
-#define CONTENT_BUF_LEN 256
-
-#define QP_BUF_LEN 10
-#define QP_PRIVID 1
-#define QP_TERM 1
-#define QP_TIMEOUT 1
-
-struct appdata {
- Evas_Object *win;
- Evas_Object *popup;
- bundle *b;
- char title[TITLE_BUF_LEN];
- char content[CONTENT_BUF_LEN];
- /* add more variables here */
-};
-
-#endif /* __SYSPOPUP_APP_H__ */
-
# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 aul libtzplatform-config)
+SET(pc_requires "bundle")
+
+pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config)
FOREACH(flag ${spcpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
SET(CMAKE_SKIP_BUILD_RPATH true)
-# Get uname value to set 'TARGET' definition
+# Get uname value to set 'TARGET' definition
# TODO: Is this needed?
FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
target_link_libraries(syspopup_caller syspopup_mods ${spcpkgs_LDFLAGS})
SET_TARGET_PROPERTIES(syspopup_caller PROPERTIES SOVERSION 0.1.0)
+SET(PC_NAME libsyspopup_caller)
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -lsyspopup_caller)
+
# pkgconfig file
#CONFIGURE_FILE(syspopup-caller.pc.in syspopup-caller/syspopup-caller.pc @ONLY)
CONFIGURE_FILE(syspopup-caller.pc.in ${CMAKE_CURRENT_BINARY_DIR}/syspopup-caller.pc @ONLY)
# Package Information for pkg-config
-prefix=/usr
+prefix=@PREFIX@
exec_prefix=@EXEC_PREFIX@
libdir=@LIB_INSTALL_DIR@
includedir=@INCLUDEDIR@
-Name: libsyspopup_caller
+Name: @PC_NAME@
Description: system popup caller library - may be integrated in AUL
Version: @VERSION@
-Requires: dlog bundle sqlite3 glib-2.0 aul
-Libs: -L${libdir} -lsyspopup_caller
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
Cflags: -I${includedir}
if (_syspopup_set_name_to_bundle(b, popup_name) < 0) {
_E("bundle set error\n");
_syspopup_info_free(info);
-
- if (is_bundle == 1) {
+ if (is_bundle == 1)
bundle_free(b);
- }
+
return -1;
}
SET(APPSVC_SPPPGS_CHECK_MODULES "dlog bundle sqlite3 glib-2.0 gio-2.0 evas elementary ecore ecore-input libtzplatform-config")
SET(pc_requires "bundle elementary")
-IF (with_wayland)
- pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES})
-ELSE (with_wayland)
+IF(with_wayland)
+ pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES} ecore-wayland capi-ui-efl-util)
+ENDIF(with_wayland)
+IF(with_x11)
pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES} utilX ecore-x x11)
-ENDIF (with_wayland)
+ENDIF(with_x11)
FOREACH(flag ${sppkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
### Build ###
+IF(with_wayland)
+ add_library(syspopup SHARED syspopup.c syspopup_efl.c syspopup_wayland.c)
+ENDIF(with_wayland)
+IF(with_x11)
+ add_library(syspopup SHARED syspopup.c syspopup_efl.c syspopup_x.c)
+ENDIF(with_x11)
-add_library(syspopup SHARED syspopup.c syspopup_efl.c)
target_link_libraries(syspopup syspopup_mods ${sppkgs_LDFLAGS})
SET_TARGET_PROPERTIES(syspopup PROPERTIES SOVERSION 0.1.0)
*
*/
-
#include "syspopup_core.h"
#include "syspopup.h"
#include "syspopup_api.h"
+#include "syspopup_efl.h"
#include "simple_util.h"
-#ifndef WAYLAND
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <Ecore_X.h>
-#include <utilX.h>
-#endif
-
-#define WIN_PROP_NAME "SYSTEM_POPUP"
-
-#ifndef WAYLAND
-static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom,
- Atom type, unsigned int *val,
- unsigned int len)
-{
- unsigned char *prop_ret;
- Atom type_ret;
- unsigned long bytes_after;
- unsigned long num_ret;
- int format_ret;
- unsigned int i;
- int num;
-
- prop_ret = NULL;
- if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
- type, &type_ret, &format_ret, &num_ret,
- &bytes_after, &prop_ret) != Success)
- return -1;
-
- if (type_ret != type || format_ret != 32)
- num = -1;
- else if (num_ret == 0 || !prop_ret)
- num = 0;
- else {
- if (num_ret < len)
- len = num_ret;
-
- for (i = 0; i < len; i++) {
- val[i] = ((unsigned long *)prop_ret)[i];
- }
-
- num = len;
- }
-
- if (prop_ret)
- XFree(prop_ret);
-
- return num;
-}
-#endif
-
-#ifndef WAYLAND
-static void __X_syspopup_term_handler(void *data)
-{
- syspopup *tmp;
- syspopup *next;
- Display *d;
- Window win;
-
- _D("enter syspopup term handler");
-
- d = XOpenDisplay(NULL);
-
- tmp = _syspopup_get_head();
- while (tmp) {
- _D("term action %d - %s", tmp->term_act, tmp->name);
- next = tmp->next;
-
- switch (tmp->term_act) {
- case SYSPOPUP_TERM:
- win = (Window)tmp->internal_data;
-
- if (tmp->def_term_fn != NULL)
- tmp->def_term_fn(tmp->dupped_bundle,
- tmp->user_data);
-
- XKillClient(d, win);
- break;
- case SYSPOPUP_HIDE:
- win = (Window)tmp->internal_data;
-
- if (tmp->def_term_fn != NULL)
- tmp->def_term_fn(tmp->dupped_bundle,
- tmp->user_data);
- XUnmapWindow(d, win);
- break;
- default:
- _D("term action IGNORED: %s", tmp->name);
- }
-
- tmp = next;
- }
-
- XCloseDisplay(d);
-}
-#endif
-
-#ifndef WAYLAND
-static gboolean __X_syspopup_timeout_handler(void *user_data)
+API int syspopup_create(bundle *b, syspopup_handler *handler,
+ Evas_Object *parent, void *user_data)
{
- syspopup *sp = NULL;
- Display *d;
+ const char *popup_name;
+ syspopup *sp;
int id;
- Window win;
-
- id = (int)user_data;
- d = XOpenDisplay(NULL);
-
- sp = _syspopup_find_by_id(id);
- if (sp != NULL) {
- _D("find timeout - %s", sp->name);
- if (sp->def_timeout_fn != NULL)
- sp->def_timeout_fn(sp->dupped_bundle, sp->user_data);
-
- win = (Window)sp->internal_data;
- XKillClient(d, win);
- } else {
- _E("no find timeout");
- }
-
- XCloseDisplay(d);
-
- return 0;
-}
-#endif
-
-#ifndef WAYLAND
-static int __X_syspopup_change_xwin_type(Display *dpy, Window win)
-{
- Atom win_type_atom;
- Atom win_type_utility_atom;
-
- win_type_atom = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
- win_type_utility_atom =
- XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_NOTIFICATION", False);
- XChangeProperty(dpy, win, win_type_atom, XA_ATOM, 32, PropModeReplace,
- (unsigned char *)&win_type_utility_atom, 1);
- return 0;
-}
-#endif
-
-#ifndef WAYLAND
-static int __X_syspopup_disable_focus(Display *dpy, Window win)
-{
- XWMHints *hints;
-
- hints = XAllocWMHints();
- if (hints == NULL)
+ if (parent == NULL || handler == NULL) {
+ _E("parent window or handler is NULL");
return -1;
-
- hints->flags = InputHint | StateHint;
- hints->input = 0;
- hints->initial_state = NormalState;
-
- XSetWMHints(dpy, win, hints);
- XFree(hints);
-
- return 0;
-}
-#endif
-
-#ifndef WAYLAND
-int X_syspopup_rotation_get(Display *dpy, Window win)
-{
- Window active_win;
- Window root_win;
- int rotation = -1;
- int ret;
-
- Atom atom_active_win;
- Atom atom_win_rotate_angle;
-
- root_win = XDefaultRootWindow(dpy);
-
- atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
- ret = __utilx_ss_get_window_property(dpy, root_win, atom_active_win,
- XA_WINDOW,
- (unsigned int *)&active_win, 1);
- if (ret < 0)
- return ret;
-
- atom_win_rotate_angle = XInternAtom(dpy,
- "_E_ILLUME_ROTATE_ROOT_ANGLE", False);
- ret = __utilx_ss_get_window_property(dpy, root_win,
- atom_win_rotate_angle, XA_CARDINAL,
- (unsigned int *)&rotation, 1);
- if (ret != -1)
- return rotation;
-
- return -1;
-}
-#endif
-
-int X_syspopup_process_keypress(int id, const char *keyname)
-{
-#ifndef WAYLAND
- Display *d;
- Window win;
- syspopup *sp = NULL;
-
- _D("key press - %s", keyname);
-
- if (strcmp(keyname, KEY_END) == 0) {
- d = XOpenDisplay(NULL);
- sp = _syspopup_find_by_id(id);
- if (sp != NULL) {
- _D("find key down: %s", sp->name);
- if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) {
- if (sp->def_term_fn != NULL)
- sp->def_term_fn(sp->dupped_bundle,
- sp->user_data);
-
- win = (Window) sp->internal_data;
- XKillClient(d, win);
- } else if (sp->endkey_act == SYSPOPUP_KEYEND_HIDE) {
- if (sp->def_term_fn != NULL)
- sp->def_term_fn(sp->dupped_bundle,
- sp->user_data);
-
- win = (Window) sp->internal_data;
- XUnmapWindow(d, win);
- }
- } else {
- _E("no find key down");
- }
-
- XCloseDisplay(d);
}
-#endif
-
- return 0;
-}
-#ifdef ROTATE_USING_X_CLIENT
-int X_syspopup_process_rotate(int id)
-{
-#ifndef WAYLAND
- Display *d;
- Window win;
- syspopup *sp = NULL;
-
- sp = _syspopup_find_by_id(id);
-
- if (sp == NULL)
+ popup_name = _syspopup_get_name_from_bundle(b);
+ if (popup_name == NULL) {
+ _E("popup_name is NULL");
return -1;
-
- win = (Window) sp->internal_data;
-
- d = XOpenDisplay(NULL);
- sp->rotate_cb(d, win, sp);
- XCloseDisplay(d);
-#endif
-
- return 0;
-}
-#else
-#ifndef WAYLAND
-static void __efl_rotation_set(Evas_Object* win, Ecore_X_Window xwin)
-{
- ecore_x_icccm_name_class_set(xwin, WIN_PROP_NAME, WIN_PROP_NAME);
- if (elm_win_wm_rotation_supported_get(win)) {
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(win, &rots, 4);
- } else {
- _E("win rotation no supported");
}
-}
-#endif
-#endif
-
-#ifndef WAYLAND
-int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win,
- int (*rotate_func) (Display*, Window, syspopup*),
- syspopup_handler *handler, void *user_data)
-{
- syspopup *sp = NULL;
- syspopup_info_t *info;
- const char *popup_name = _syspopup_get_name_from_bundle(b);
- XWindowAttributes attr;
- int is_unviewable = 0;
-
- if (popup_name == NULL || handler == NULL)
- return -1;
- info = _syspopup_info_get(popup_name);
- if (info == NULL)
- return -1;
-
- if (_syspopup_init(__X_syspopup_term_handler,
- __X_syspopup_timeout_handler) < 0){
- _syspopup_info_free(info);
+ sp = _syspopup_find(popup_name);
+ if (sp) {
+ _E("already exist - syspopup: %s", popup_name);
return -1;
}
- XGetWindowAttributes(dpy, xwin, &attr);
-
- if (attr.map_state == IsViewable) {
- XUnmapWindow(dpy, xwin);
- is_unviewable = 1;
- }
-
- sp = (syspopup *) malloc(sizeof(syspopup));
- if (sp == NULL) {
- _syspopup_info_free(info);
+ id = syspopup_efl_create(popup_name, b, parent,
+ handler, user_data);
+ if (id < 0) {
+ _E("Failed to create syspopup");
return -1;
}
- sp->name = strdup(info->name);
- sp->def_term_fn = handler->def_term_fn;
- sp->def_timeout_fn = handler->def_timeout_fn;
- sp->user_data = user_data;
- sp->internal_data = (void *)xwin;
- sp->win = (void *)win;
- sp->rotate_cb = rotate_func;
- sp->timeout_id = 0;
- sp->dupped_bundle = bundle_dup(b);
- _syspopup_add_new(sp);
-
- _syspopup_set_term_type(sp, info);
- _syspopup_set_endkey_type(sp, info);
-
- _syspopup_reset_timeout(sp, info);
-
- __X_syspopup_change_xwin_type(dpy, xwin);
- utilx_set_system_notification_level(dpy, xwin, info->prio);
-
- utilx_grab_key(dpy, xwin, KEY_END, TOP_POSITION_GRAB);
-
- if (info->focus == 1) {
- __X_syspopup_disable_focus (dpy, xwin);
- }
-
-#ifdef ROTATE_USING_X_CLIENT
- rotate_func(dpy, xwin, sp);
-#else
- __efl_rotation_set((Evas_Object* )win,(Ecore_X_Window)xwin);
-#endif
-
- if (is_unviewable == 1) {
- XMapWindow(dpy, xwin);
- }
-
- _syspopup_info_free(info);
-
- return sp->id;
+ return 0;
}
-#endif
-/**
- * @brief This API reset created the system popup's properties
- *
- * This API reset created the system popup's properties based on
- * system popup information DB after extracting popup name from
- * given bundle system popup properties to be reset : timeout,
- * default action type, ....
- *
- * @param[in] b bundle received by app_reset handler
- * (included system popup name)
- * @return 0 if success, negative value(<0) if fail
- * @retval 0 - success
- * @retval -1 - generic error
- */
-int X_syspopup_reset(bundle *b)
+API int syspopup_reset(bundle *b)
{
-#ifndef WAYLAND
- const char *popup_name;
- syspopup_info_t *info;
- syspopup *sp = NULL;
-
- popup_name = _syspopup_get_name_from_bundle(b);
- if (popup_name == NULL)
- return -1;
-
- sp = _syspopup_find(popup_name);
- if (!sp)
- return -1;
- else {
- Display *d;
- Window win;
-
- info = _syspopup_info_get(popup_name);
- if (info == NULL)
- return -1;
- _syspopup_reset_timeout(sp, info);
-
- if (sp->dupped_bundle)
- free(sp->dupped_bundle);
-
- sp->dupped_bundle = bundle_dup(b);
-
- do {
- d = XOpenDisplay(NULL);
- if (d == NULL)
- break;
-
- win = (Window)sp->internal_data;
- if (win == NULL)
- break;
-
- utilx_set_system_notification_level(d, win, info->prio);
-
- if (info->focus == 1)
- __X_syspopup_disable_focus (d, win);
-
-#ifdef ROTATE_USING_X_CLIENT
- int (*rotate_func) (Display *, Window, syspopup *);
- rotate_func = sp->rotate_cb;
- rotate_func(d, win, sp);
-#else
- __efl_rotation_set((Evas_Object *)sp->win, (Ecore_X_Window)win);
-#endif
- XMapWindow(d, win);
- XCloseDisplay(d);
- } while (0);
-
- _syspopup_info_free(info);
- }
-#endif
-
- return 0;
+ return syspopup_efl_reset(b);
}
API int syspopup_has_popup(bundle *b)
if (popup_name == NULL)
return 0;
- if (_syspopup_find(popup_name) != NULL)
+ if (_syspopup_find(popup_name))
return 1;
return 0;
{
const char *popup_name;
syspopup_info_t *info;
- syspopup *sp = NULL;
+ syspopup *sp;
int ret;
popup_name = _syspopup_get_name_from_bundle(b);
}
sp = _syspopup_find(popup_name);
- if (!sp) {
+ if (sp == NULL) {
_E("find syspopup error");
return -1;
- } else {
- info = _syspopup_info_get(popup_name);
- if (info == NULL) {
- _E("get syspopup info error");
- return -1;
- }
+ }
- info->timeout = time;
- ret = _syspopup_reset_timeout(sp, info);
- _syspopup_info_free(info);
+ info = _syspopup_info_get(popup_name);
+ if (info == NULL) {
+ _E("get syspopup info error");
+ return -1;
}
+ info->timeout = time;
+ ret = _syspopup_reset_timeout(sp, info);
+ _syspopup_info_free(info);
+
return ret;
}
*
*/
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Input.h>
#include "syspopup_core.h"
#include "syspopup.h"
#include "syspopup_api.h"
#include "simple_util.h"
-#include <Evas.h>
-#include <Ecore.h>
-#include <Ecore_Input.h>
-
-#ifndef WAYLAND
-#include <Ecore_X.h>
-#include <utilX.h>
+#if defined(X11)
+#include "syspopup_x.h"
+#elif defined(WAYLAND)
+#include "syspopup_wayland.h"
#endif
-#ifndef WAYLAND
-static Eina_Bool __x_keypress_cb(void *data, int type, void *event)
+static Eina_Bool __keydown_cb(void *data, int type, void *event)
{
- int id = (int)data;
+ int id = (int)((intptr_t)data);
Ecore_Event_Key *ev = event;
if (ev == NULL)
- return 0;
-
- X_syspopup_process_keypress(id, ev->keyname);
+ return ECORE_CALLBACK_DONE;
- return ECORE_CALLBACK_RENEW;
-}
-#endif
-
-#ifdef ROTATE_USING_X_CLIENT
-static Eina_Bool __x_rotate_cb(void *data, int type, void *event)
-{
- int id = (int)data;
-
-#ifndef WAYLAND
- Ecore_X_Event_Client_Message *ev = event;
-
- if (!event)
- return ECORE_CALLBACK_RENEW;
-
- if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
- X_syspopup_process_rotate(id);
+#if defined(X11)
+ x_syspopup_process_keypress(id, ev->keyname);
+#elif defined(WAYLAND)
+ wl_syspopup_process_keypress(id, ev->keyname);
#endif
- return ECORE_CALLBACK_RENEW;
+ return ECORE_CALLBACK_DONE;
}
-#ifndef WAYLAND
-static int __efl_rotate(Display *dpy, Window win, syspopup *sp)
-{
- int rotation;
-
- rotation = X_syspopup_rotation_get(dpy, win);
-
- if (rotation == -1) {
- rotation = 0;
- }
-
- if (rotation >= 0)
- elm_win_rotation_with_resize_set(sp->win, rotation);
-
- return 0;
-}
-#endif
-#else
-#ifndef WAYLAND
-static int __efl_rotate(Display *dpy, Window win, syspopup *sp)
+static int __efl_rotate_cb(void *d, void *w, void *s)
{
return 0;
}
-#endif /* WAYLAND */
-#endif /* ROTATE_USING_X_CLIENT */
-API int syspopup_create(bundle *b, syspopup_handler *handler,
- Evas_Object *parent, void *user_data)
+int syspopup_efl_create(const char *popup_name, bundle *b, Evas_Object *parent,
+ syspopup_handler *handler, void *user_data)
{
-#ifndef WAYLAND
- Ecore_X_Window xwin;
- Display *dpy;
- const char *popup_name;
- syspopup *sp = NULL;
- int id;
- XWindowAttributes attr;
- int is_unviewable = 0;
-
- popup_name = _syspopup_get_name_from_bundle(b);
- if (popup_name == NULL || handler == NULL) {
- _E("popup_name or handler is NULL");
+ syspopup *sp;
+ syspopup_info_t *info;
+
+ info = _syspopup_info_get(popup_name);
+ if (info == NULL) {
+ _E("Failed to get syspopup info: %s", popup_name);
return -1;
}
- if (parent == NULL) {
- _E("parent window is NULL");
+ sp = (syspopup *)malloc(sizeof(syspopup));
+ if (sp == NULL) {
+ _syspopup_info_free(info);
return -1;
}
- sp = _syspopup_find(popup_name);
- if (sp) {
- _E("already exist - syspopup %s", popup_name);
+ sp->name = strdup(info->name);
+ sp->def_term_fn = handler->def_term_fn;
+ sp->def_timeout_fn = handler->def_timeout_fn;
+ sp->user_data = user_data;
+ sp->win = (void *)parent;
+ sp->timeout_id = 0;
+ sp->dupped_bundle = bundle_dup(b);
+ sp->rotate_cb = __efl_rotate_cb;
+
+ _syspopup_add_new(sp);
+ _syspopup_set_term_type(sp, info);
+ _syspopup_set_endkey_type(sp, info);
+
+#if defined(X11)
+ sp->internal_data = (void *)elm_win_xwindow_get(parent);
+ if (x_syspopup_init(sp, info) < 0) {
+ _syspopup_info_free(info);
+ _syspopup_del(sp->id);
+ return -1;
+ }
+#elif defined(WAYLAND)
+ sp->internal_data = (void *)elm_win_wl_window_get(parent);
+ if (wl_syspopup_init(sp, info) < 0) {
+ _syspopup_info_free(info);
+ _syspopup_del(sp->id);
return -1;
- } else {
- xwin = elm_win_xwindow_get(parent);
- dpy = ecore_x_display_get();
-
- id = X_make_syspopup(b, dpy, xwin, parent, __efl_rotate,
- handler, user_data);
- if (id < 0) {
- _E("fail to make X syspopup");
- return -1;
- }
-
- /* X_syspopup_core should process 2 events */
- /* First, rotate event */
- /* Second, keypress event */
- utilx_grab_key(dpy, xwin, KEY_BACK, TOP_POSITION_GRAB);
- ecore_event_handler_add(ECORE_EVENT_KEY_UP, __x_keypress_cb, (void *)id);
-
-#ifdef ROTATE_USING_X_CLIENT
- ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,__x_rotate_cb, (void *)id);
-#endif
}
#endif
- return 0;
+ _syspopup_reset_timeout(sp, info);
+ ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __keydown_cb,
+ (const void *)((intptr_t)sp->id));
+
+ _syspopup_info_free(info);
+
+ return sp->id;
}
-API int syspopup_reset(bundle *b)
+int syspopup_efl_reset(bundle *b)
{
-#ifndef WAYLAND
- return X_syspopup_reset(b);
-#else
- return 0;
+#if defined(X11)
+ return x_syspopup_reset(b);
+#elif defined(WAYLAND)
+ return wl_syspopup_reset(b);
#endif
}
--- /dev/null
+/*
+ * syspopup
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __SYSPOPUP_EFL_H__
+#define __SYSPOPUP_EFL_H__
+
+#include <bundle.h>
+
+#include "syspopup.h"
+
+int syspopup_efl_create(const char *popup_name, bundle *b, Evas_Object *parent,
+ syspopup_handler *handler, void *user_data);
+int syspopup_efl_reset(bundle *b);
+
+#endif /* __SYSPOPUP_EFL_H__ */
--- /dev/null
+/*
+ * syspopup wayland
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <Ecore_Wayland.h>
+#include <efl_util.h>
+#include <Ecore.h>
+
+#include "syspopup.h"
+#include "syspopup_wayland.h"
+#include "simple_util.h"
+
+static void __wl_syspopup_term_handler(void *data)
+{
+ syspopup *tmp;
+
+ tmp = _syspopup_get_head();
+ while (tmp) {
+ _D("term action %d - %s", tmp->term_act, tmp->name);
+
+ switch (tmp->term_act) {
+ case SYSPOPUP_TERM:
+ if (tmp->def_term_fn)
+ tmp->def_term_fn(tmp->dupped_bundle,
+ tmp->user_data);
+ break;
+ case SYSPOPUP_HIDE:
+ if (tmp->def_term_fn)
+ tmp->def_term_fn(tmp->dupped_bundle,
+ tmp->user_data);
+
+ ecore_wl_window_hide((Ecore_Wl_Window *)tmp->internal_data);
+ break;
+ default:
+ _D("term action IGNORED: %s", tmp->name);
+ }
+
+ tmp = tmp->next;
+ }
+}
+
+static gboolean __wl_syspopup_timeout_handler(gpointer user_data)
+{
+ syspopup *sp;
+ int id = (int)((intptr_t)user_data);
+
+ sp = _syspopup_find_by_id(id);
+ if (sp == NULL) {
+ _E("Failed to find the syspopup");
+ return FALSE;
+ }
+
+ _D("find timeout - %s", sp->name);
+ if (sp->def_timeout_fn)
+ sp->def_timeout_fn(sp->dupped_bundle, sp->user_data);
+
+ return FALSE;
+}
+
+static void __wl_rotation_set(syspopup *sp)
+{
+ int rots[] = {0, 90, 180, 270};
+
+ ecore_wl_window_class_name_set(sp->internal_data, WIN_PROP_NAME);
+ if (elm_win_wm_rotation_supported_get(sp->win))
+ elm_win_wm_rotation_available_rotations_set(sp->win, rots, 4);
+ else
+ _E("win rotation is not supported");
+}
+
+static efl_util_notification_level_e __wl_syspopup_get_notification_level(int priority)
+{
+ switch (priority) {
+ case 0:
+ return EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ case 1:
+ return EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM;
+ case 2:
+ return EFL_UTIL_NOTIFICATION_LEVEL_HIGH;
+ default:
+ return EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ }
+}
+
+int wl_syspopup_init(syspopup *sp, syspopup_info_t *info)
+{
+ Ecore_Wl_Window *wl_win;
+ efl_util_notification_level_e level;
+
+ if (_syspopup_init(__wl_syspopup_term_handler,
+ __wl_syspopup_timeout_handler) < 0)
+ return -1;
+
+ wl_win = (Ecore_Wl_Window *)sp->internal_data;
+ ecore_wl_window_type_set(wl_win, ECORE_WL_WINDOW_TYPE_NOTIFICATION);
+
+ level = __wl_syspopup_get_notification_level(info->prio);
+ efl_util_set_notification_window_level(sp->win, level);
+ if (info->focus)
+ ecore_wl_window_focus_skip_set(wl_win, EINA_TRUE);
+
+ __wl_rotation_set(sp);
+
+ return 0;
+}
+
+int wl_syspopup_reset(bundle *b)
+{
+ const char *popup_name;
+ syspopup_info_t *info;
+ syspopup *sp;
+ Ecore_Wl_Window *wl_win;
+ efl_util_notification_level_e level;
+
+ popup_name = _syspopup_get_name_from_bundle(b);
+ if (popup_name == NULL)
+ return -1;
+
+ sp = _syspopup_find(popup_name);
+ if (sp == NULL)
+ return -1;
+
+ info = _syspopup_info_get(popup_name);
+ if (info == NULL)
+ return -1;
+
+ _syspopup_reset_timeout(sp, info);
+ if (sp->dupped_bundle)
+ free(sp->dupped_bundle);
+
+ sp->dupped_bundle = bundle_dup(b);
+
+ wl_win = (Ecore_Wl_Window *)sp->internal_data;
+ ecore_wl_window_type_set(wl_win, ECORE_WL_WINDOW_TYPE_NOTIFICATION);
+
+ level = __wl_syspopup_get_notification_level(info->prio);
+ efl_util_set_notification_window_level(sp->win, level);
+ if (info->focus)
+ ecore_wl_window_focus_skip_set(wl_win, EINA_TRUE);
+
+ __wl_rotation_set(sp);
+
+ _syspopup_info_free(info);
+
+ return 0;
+}
+
+int wl_syspopup_process_keypress(int id, const char *keyname)
+{
+ syspopup *sp;
+
+ if (keyname == NULL)
+ return 0;
+
+ _D("key press - %s", keyname);
+
+ if (strcmp(keyname, KEY_END) != 0)
+ return 0;
+
+ sp = _syspopup_find_by_id(id);
+ if (sp == NULL)
+ return 0;
+
+ _D("find key down - %s", sp->name);
+ if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) {
+ if (sp->def_term_fn)
+ sp->def_term_fn(sp->dupped_bundle, sp->user_data);
+ } else if (sp->endkey_act == SYSPOPUP_KEYEND_HIDE) {
+ if (sp->def_term_fn)
+ sp->def_term_fn(sp->dupped_bundle, sp->user_data);
+
+ ecore_wl_window_hide((Ecore_Wl_Window *)sp->internal_data);
+ } else {
+ _E("no find key down");
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * syspopup wayland
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __SYSPOPUP_WAYLAND_H__
+#define __SYSPOPUP_WAYLAND_H__
+
+#include <bundle.h>
+
+#include "syspopup_core.h"
+#include "syspopup_db.h"
+
+int wl_syspopup_init(syspopup *sp, syspopup_info_t *info);
+int wl_syspopup_reset(bundle *b);
+int wl_syspopup_process_keypress(int id, const char *keyname);
+
+#endif /* __SYSPOPUP_WAYLAND_H__ */
--- /dev/null
+/*
+ * syspopup x11
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <utilX.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <Ecore_X.h>
+
+#include "syspopup.h"
+#include "syspopup_x.h"
+#include "simple_util.h"
+
+static void __x_rotation_set(Display *dpy, Window win, syspopup *sp);
+
+static void __x_syspopup_term_handler(void *data)
+{
+ syspopup *tmp;
+ Display *dpy;
+ Window win;
+
+ dpy = XOpenDisplay(NULL);
+ tmp = _syspopup_get_head();
+ while (tmp) {
+ _D("term action %d - %s", tmp->term_act, tmp->name);
+
+ switch (tmp->term_act) {
+ case SYSPOPUP_TERM:
+ win = (Window)tmp->internal_data;
+
+ if (tmp->def_term_fn)
+ tmp->def_term_fn(tmp->dupped_bundle,
+ tmp->user_data);
+
+ XKillClient(dpy, win);
+ break;
+ case SYSPOPUP_HIDE:
+ win = (Window)tmp->internal_data;
+
+ if (tmp->def_term_fn)
+ tmp->def_term_fn(tmp->dupped_bundle,
+ tmp->user_data);
+ XUnmapWindow(dpy, win);
+ break;
+ default:
+ _D("term action IGNORED: %s", tmp->name);
+ }
+
+ tmp = tmp->next;
+ }
+
+ XCloseDisplay(dpy);
+}
+
+static gboolean __x_syspopup_timeout_handler(gpointer user_data)
+{
+ int id = (int)((intptr_t)user_data);
+ syspopup *sp;
+ Display *dpy;
+ Window win;
+
+ sp = _syspopup_find_by_id(id);
+ if (sp == NULL) {
+ _E("Failed to find the syspopup");
+ return FALSE;
+ }
+
+ dpy = XOpenDisplay(NULL);
+
+ _D("find timeout - %s", sp->name);
+ if (sp->def_timeout_fn != NULL)
+ sp->def_timeout_fn(sp->dupped_bundle, sp->user_data);
+
+ win = (Window)sp->internal_data;
+ XKillClient(dpy, win);
+ XCloseDisplay(dpy);
+
+ return FALSE;
+}
+
+static int __x_syspopup_change_xwin_type(Display *dpy, Window win)
+{
+ Atom win_type_atom;
+ Atom win_type_utility_atom;
+
+ win_type_atom = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+ win_type_utility_atom =
+ XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_NOTIFICATION", False);
+ XChangeProperty(dpy, win, win_type_atom, XA_ATOM, 32, PropModeReplace,
+ (unsigned char *)&win_type_utility_atom, 1);
+
+ return 0;
+}
+
+static int __x_syspopup_disable_focus(Display *dpy, Window win)
+{
+ XWMHints *hints;
+
+ hints = XAllocWMHints();
+ if (hints == NULL)
+ return -1;
+
+ hints->flags = InputHint | StateHint;
+ hints->input = 0;
+ hints->initial_state = NormalState;
+
+ XSetWMHints(dpy, win, hints);
+ XFree(hints);
+
+ return 0;
+}
+
+#ifdef ROTATE_USING_X_CLIENT
+static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom,
+ Atom type, unsigned int *val,
+ unsigned int len)
+{
+ unsigned char *prop_ret;
+ Atom type_ret;
+ unsigned long bytes_after;
+ unsigned long num_ret;
+ int format_ret;
+ unsigned int i;
+ int num;
+
+ prop_ret = NULL;
+ if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
+ return -1;
+
+ if (type_ret != type || format_ret != 32)
+ num = -1;
+ else if (num_ret == 0 || !prop_ret)
+ num = 0;
+ else {
+ if (num_ret < len)
+ len = num_ret;
+
+ for (i = 0; i < len; i++)
+ val[i] = ((unsigned long *)prop_ret)[i];
+
+ num = len;
+ }
+
+ if (prop_ret)
+ XFree(prop_ret);
+
+ return num;
+}
+
+static int x_syspopup_rotation_get(Display *dpy, Window win)
+{
+ Window active_win;
+ Window root_win;
+ Atom atom_active_win;
+ Atom atom_win_rotate_angle;
+ int rotation = -1;
+ int ret;
+
+ root_win = XDefaultRootWindow(dpy);
+
+ atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ ret = __utilx_ss_get_window_property(dpy, root_win, atom_active_win,
+ XA_WINDOW,
+ (unsigned int *)&active_win, 1);
+ if (ret < 0)
+ return ret;
+
+ atom_win_rotate_angle = XInternAtom(dpy,
+ "_E_ILLUME_ROTATE_ROOT_ANGLE", False);
+ ret = __utilx_ss_get_window_property(dpy, root_win,
+ atom_win_rotate_angle, XA_CARDINAL,
+ (unsigned int *)&rotation, 1);
+ if (ret != -1)
+ return rotation;
+
+ return -1;
+}
+
+static int x_syspopup_process_rotate(int id)
+{
+ Display *dpy;
+ Window win;
+ syspopup *sp;
+
+ sp = _syspopup_find_by_id(id);
+ if (sp == NULL)
+ return -1;
+
+ win = (Window) sp->internal_data;
+ dpy = XOpenDisplay(NULL);
+ __x_rotation_set(dpy, win, sp);
+ XCloseDisplay(dpy);
+
+ return 0;
+}
+
+static Eina_Bool __x_rotate_cb(void *data, int type, void *event)
+{
+ int id = (intptr_t)data;
+ Ecore_X_Event_Client_Message *ev = event;
+
+ if (ev && ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
+ x_syspopup_process_rotate(id);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void __x_rotation_set(Display *dpy, Window win, syspopup *sp)
+{
+ int rotation;
+
+ rotation = x_syspopup_rotation_get(dpy, win);
+ if (rotation == -1)
+ rotation = 0;
+
+ elm_win_rotation_with_resize_set(sp->win, rotation);
+
+ return 0;
+}
+#else
+static void __x_rotation_set(Display *dpy, Window win, syspopup *sp)
+{
+ int rots[] = {0, 90, 180, 270};
+
+ ecore_x_icccm_name_class_set(win, WIN_PROP_NAME, WIN_PROP_NAME);
+ if (elm_win_wm_rotation_supported_get(sp->win))
+ elm_win_wm_rotation_available_rotations_set(sp->win, rots, 4);
+ else
+ _E("win rotation is not supported");
+}
+#endif
+
+int x_syspopup_init(syspopup *sp, syspopup_info_t *info)
+{
+ Ecore_X_Window xwin;
+ Display *dpy;
+ XWindowAttributes attr;
+ int is_unviewable = 0;
+
+ if (_syspopup_init(__x_syspopup_term_handler,
+ __x_syspopup_timeout_handler) < 0)
+ return -1;
+
+ xwin = (Ecore_X_Window)sp->internal_data;
+ dpy = ecore_x_display_get();
+ XGetWindowAttributes(dpy, xwin, &attr);
+ if (attr.map_state == IsViewable) {
+ XUnmapWindow(dpy, xwin);
+ is_unviewable = 1;
+ }
+
+ __x_syspopup_change_xwin_type(dpy, xwin);
+ utilx_set_system_notification_level(dpy, xwin, info->prio);
+ if (info->focus)
+ __x_syspopup_disable_focus(dpy, xwin);
+
+ __x_rotation_set(dpy, xwin, sp);
+
+ if (is_unviewable)
+ XMapWindow(dpy, xwin);
+
+#ifdef ROTATE_USING_X_CLIENT
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __x_rotate_cb,
+ (const void *)((intptr_t)sp->id));
+#endif
+
+ return 0;
+}
+
+int x_syspopup_reset(bundle *b)
+{
+ const char *popup_name;
+ syspopup_info_t *info;
+ syspopup *sp;
+ Display *d;
+ Window win;
+
+ popup_name = _syspopup_get_name_from_bundle(b);
+ if (popup_name == NULL)
+ return -1;
+
+ sp = _syspopup_find(popup_name);
+ if (sp == NULL)
+ return -1;
+
+ info = _syspopup_info_get(popup_name);
+ if (info == NULL)
+ return -1;
+
+ _syspopup_reset_timeout(sp, info);
+
+ if (sp->dupped_bundle)
+ free(sp->dupped_bundle);
+
+ sp->dupped_bundle = bundle_dup(b);
+
+ do {
+ d = XOpenDisplay(NULL);
+ if (d == NULL)
+ break;
+
+ win = (Window)sp->internal_data;
+ if (win == NULL)
+ break;
+
+ utilx_set_system_notification_level(d, win, info->prio);
+
+ if (info->focus)
+ __x_syspopup_disable_focus(d, win);
+
+ __x_rotation_set(d, win, sp);
+ XMapWindow(d, win);
+ XCloseDisplay(d);
+ } while (0);
+
+ _syspopup_info_free(info);
+
+ return 0;
+}
+
+int x_syspopup_process_keypress(int id, const char *keyname)
+{
+ Display *dpy;
+ Window win;
+ syspopup *sp = NULL;
+
+ if (keyname == NULL)
+ return 0;
+
+ _D("key press - %s", keyname);
+
+ if (strcmp(keyname, KEY_END) != 0)
+ return 0;
+
+ sp = _syspopup_find_by_id(id);
+ if (sp == NULL)
+ return 0;
+
+ dpy = XOpenDisplay(NULL);
+
+ _D("find key down: %s", sp->name);
+ if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) {
+ if (sp->def_term_fn)
+ sp->def_term_fn(sp->dupped_bundle,
+ sp->user_data);
+
+ win = (Window)sp->internal_data;
+ XKillClient(dpy, win);
+ } else if (sp->endkey_act == SYSPOPUP_KEYEND_HIDE) {
+ if (sp->def_term_fn)
+ sp->def_term_fn(sp->dupped_bundle,
+ sp->user_data);
+
+ win = (Window)sp->internal_data;
+ XUnmapWindow(dpy, win);
+ } else {
+ _E("no find key down");
+ }
+
+ XCloseDisplay(dpy);
+
+ return 0;
+}
--- /dev/null
+/*
+ * syspopup x11
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __SYSPOPUP_X_H__
+#define __SYSPOPUP_X_H__
+
+#include <bundle.h>
+
+#include "syspopup_core.h"
+#include "syspopup_db.h"
+
+int x_syspopup_init(syspopup *sp, syspopup_info_t *info);
+int x_syspopup_reset(bundle *b);
+int x_syspopup_process_keypress(int id, const char *keyname);
+
+#endif /* __SYSPOPUP_X_H__ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <bundle.h>
#include "syspopup_caller.h"
-void usage()
+static void usage(void)
{
printf("[usage] sp_test launch/destroy popup_name..."
"(key1,val1,key2,val2,...)\n");
bundle_add(b, argv[i], argv[i + 1]);
ret = syspopup_launch(argv[2], b);
bundle_free(b);
- if(ret < 0) return -1;
+ if (ret < 0)
+ return -1;
} else if (strcmp(argv[1], "destroy") == 0) {
ret = syspopup_destroy_all();
- if(ret < 0) return -1;
+ if (ret < 0)
+ return -1;
} else {
usage();
}