summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-04-29 08:01:56 (GMT)
committerKim Kibum <kb0929.kim@samsung.com>2012-04-29 08:01:56 (GMT)
commit7376a57ffc2c7c0ec155ae90cdb1db195d2bba4e (patch)
treeb6557ac565ed693756d48a8765b434352d8c048e
parentf37db1dbb6858f965e5fb39c89a040677c7dc3be (diff)
downloadstarter-7376a57ffc2c7c0ec155ae90cdb1db195d2bba4e.zip
starter-7376a57ffc2c7c0ec155ae90cdb1db195d2bba4e.tar.gz
starter-7376a57ffc2c7c0ec155ae90cdb1db195d2bba4e.tar.bz2
upload tizen1.0 source
-rwxr-xr-xCMakeLists.txt7
-rwxr-xr-xboot-mgr/starter.c10
-rwxr-xr-xboot-mgr/x11.c27
-rwxr-xr-xboot-mgr/x11.h1
-rwxr-xr-xdebian/changelog8
-rwxr-xr-xdebian/control2
-rwxr-xr-xdebian/starter.install.in1
-rwxr-xr-xdebian/starter.postinst2
-rwxr-xr-xlock-mgr/CMakeLists.txt2
-rwxr-xr-xlock-mgr/include/lockd-process-mgr.h5
-rwxr-xr-xlock-mgr/include/lockd-window-mgr.h43
-rwxr-xr-xlock-mgr/src/lock-daemon.c88
-rwxr-xr-xlock-mgr/src/lockd-process-mgr.c99
-rwxr-xr-xlock-mgr/src/lockd-window-mgr.c287
-rwxr-xr-x[-rw-r--r--]packaging/starter.spec24
-rwxr-xr-xstarter.desktop.in11
16 files changed, 545 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53e401c..6221694 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(starter C)
-SET(VENDOR "tizen")
-SET(PACKAGE ${PROJECT_NAME})
-SET(PKGNAME "org.${VENDOR}.${PACKAGE}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(BINDIR "${PREFIX}/bin")
SET(DATADIR "${PREFIX}/share")
@@ -15,10 +12,6 @@ SET(BOOT_MGR boot-mgr)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${LOCK_MGR})
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${BOOT_MGR})
-# install desktop file & icon
-CONFIGURE_FILE(${PROJECT_NAME}.desktop.in ${PROJECT_NAME}.desktop)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop DESTINATION share/applications)
-
INSTALL(FILES ${CMAKE_SOURCE_DIR}/rd4starter DESTINATION /etc/init.d
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
diff --git a/boot-mgr/starter.c b/boot-mgr/starter.c
index 4e07eed..b10a121 100755
--- a/boot-mgr/starter.c
+++ b/boot-mgr/starter.c
@@ -38,10 +38,6 @@
#include "lock-daemon.h"
#include "lockd-debug.h"
-#ifndef PACKAGE_NAME
-#define PACKAGE_NAME "org.tizen.starter"
-#endif
-
#define PWLOCK_PKG "org.tizen.pwlock"
#define VCONFKEY_START "memory/startapps/sequence"
#define PWLOCK_FIRST_BOOT "db/setting/pwlock_boot"
@@ -70,14 +66,16 @@ static void _set_elm_theme(void)
{
char *vstr;
char *theme;
+ Elm_Theme *th = NULL;
vstr = vconf_get_str(VCONFKEY_SETAPPL_WIDGET_THEME_STR);
if (vstr == NULL)
theme = DEFAULT_THEME;
else
theme = vstr;
+ th = elm_theme_new();
_DBG("theme vconf[%s]\n set[%s]\n", vstr, theme);
- elm_theme_all_set(theme);
+ elm_theme_set(th, theme);
if (vstr)
free(vstr);
@@ -240,8 +238,6 @@ int main(int argc, char *argv[])
{
struct appdata ad;
- set_window_scale();
-
elm_init(argc, argv);
_init(&ad);
diff --git a/boot-mgr/x11.c b/boot-mgr/x11.c
index 820f4a2..e2fd23f 100755
--- a/boot-mgr/x11.c
+++ b/boot-mgr/x11.c
@@ -85,30 +85,3 @@ void prop_int_set(const char *name, unsigned int val)
XCloseDisplay(d);
}
-void set_window_scale(void)
-{
- double root_width = 0.0, root_height = 0.0;
- char buf[128] = { 0, };
- Display *disp;
- int screen_num;
-
- disp = XOpenDisplay(NULL);
- if (disp == NULL)
- return;
-
- screen_num = DefaultScreen(disp);
-
- root_width = DisplayWidth(disp, screen_num);
- root_height = DisplayHeight(disp, screen_num);
-
- XCloseDisplay(disp);
-
- snprintf(buf, sizeof(buf), "%lf", root_height / DEFAULT_WINDOW_H);
-
- if (root_width == 800 && root_height == 1280) {
- snprintf(buf, sizeof(buf), "0.71");
- }
-
- setenv("ELM_SCALE", buf, 1);
- setenv("SCALE_FACTOR", buf, 1);
-}
diff --git a/boot-mgr/x11.h b/boot-mgr/x11.h
index dca365b..0d53a75 100755
--- a/boot-mgr/x11.h
+++ b/boot-mgr/x11.h
@@ -24,6 +24,5 @@
void prop_string_set(const char *name, const char *value);
void prop_int_set(const char *name, unsigned int val);
-void set_window_scale(void);
#endif /* __STARTER_X11_H__ */
diff --git a/debian/changelog b/debian/changelog
index 87fb097..8ab5674 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+starter (0.4.0-1) unstable; urgency=low
+
+ * apply lock screen
+ * Git: pkgs/s/starter
+ * Tag: starter_0.4.0-1
+
+ -- Seungtaek Chung <seungtaek.chung@samsung.com> Tue, 20 Mar 2012 19:44:21 +0900
+
starter (0.3.44) unstable; urgency=low
* rollback the boilerplate
diff --git a/debian/control b/debian/control
index ae2c243..00ad5af 100755
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: starter
Section: devel
Priority: extra
Maintainer: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
-Build-Depends: debhelper (>= 5), libappcore-efl-dev, libglib2.0-dev, libslp-tapi-dev, libslp-setting-dev, libheynoti-dev, libaul-1-dev, libx11-dev, libelm-dev, libefreet-dev, dlog-dev, libecore-dev, libsvi-dev, libslp-utilx-dev, libail-0-dev, libui-gadget-dev
+Build-Depends: debhelper (>= 5), libappcore-efl-dev, libglib2.0-dev, libslp-tapi-dev, libslp-setting-dev, libheynoti-dev, libaul-1-dev, libx11-dev, libelm-dev, libefreet-dev, dlog-dev, libecore-dev, libsvi-dev, libslp-utilx-dev, libail-0-dev
Standards-Version: 3.7.2
Package: starter
diff --git a/debian/starter.install.in b/debian/starter.install.in
index 45ba987..e881840 100755
--- a/debian/starter.install.in
+++ b/debian/starter.install.in
@@ -1,4 +1,3 @@
@PREFIX@/bin/*
-@PREFIX@/share/*
@PREFIX@/lib/*
/etc/init.d/*
diff --git a/debian/starter.postinst b/debian/starter.postinst
index 54da911..11f2f38 100755
--- a/debian/starter.postinst
+++ b/debian/starter.postinst
@@ -2,7 +2,7 @@
vconftool set -t int "memory/startapps/sequence" 0 -i -u 5000 -g 5000
-vconftool set -t string db/lockscreen/pkgname "org.tizen.idle-lock" -u 5000 -g 5000
+vconftool set -t string db/lockscreen/pkgname "org.tizen.draglock" -u 5000 -g 5000
vconftool -i set -t int memory/idle_lock/state "0" -u 5000 -g 5000
diff --git a/lock-mgr/CMakeLists.txt b/lock-mgr/CMakeLists.txt
index 081f2ac..3a8c9d3 100755
--- a/lock-mgr/CMakeLists.txt
+++ b/lock-mgr/CMakeLists.txt
@@ -24,7 +24,6 @@ pkg_check_modules(pkgs_lock_daemon REQUIRED
utilX
ecore-input
glib-2.0
- ui-gadget
bundle
)
FOREACH (flag ${pkgs_lock_daemon_CFLAGS})
@@ -36,6 +35,7 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED
src/lock-daemon.c
src/lockd-debug.c
src/lockd-process-mgr.c
+ src/lockd-window-mgr.c
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
diff --git a/lock-mgr/include/lockd-process-mgr.h b/lock-mgr/include/lockd-process-mgr.h
index a4becb3..13e34fc 100755
--- a/lock-mgr/include/lockd-process-mgr.h
+++ b/lock-mgr/include/lockd-process-mgr.h
@@ -25,10 +25,13 @@
int lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
int phone_lock_state);
-void lockd_process_mgr_restart_lock(int phone_lock_state);
+int lockd_process_mgr_restart_lock(int phone_lock_state);
int lockd_process_mgr_start_phone_lock(void);
+void lockd_process_mgr_terminate_lock_app(int lock_app_pid,
+ int state);
+
void lockd_process_mgr_terminate_phone_lock(int phone_lock_pid);
int lockd_process_mgr_check_lock(int pid);
diff --git a/lock-mgr/include/lockd-window-mgr.h b/lock-mgr/include/lockd-window-mgr.h
new file mode 100755
index 0000000..763303e
--- /dev/null
+++ b/lock-mgr/include/lockd-window-mgr.h
@@ -0,0 +1,43 @@
+/*
+ * starter
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@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 __LOCKD_WINDOW_MGR_H__
+#define __LOCKD_WINDOW_MGR_H__
+
+typedef struct _lockw_data lockw_data;
+
+void lockd_window_set_window_property(lockw_data * data, int lock_app_pid,
+ void *event);
+
+void lockd_window_set_window_effect(lockw_data * data, int lock_app_pid,
+ void *event);
+
+void lockd_window_set_phonelock_pid(lockw_data * data, int phone_lock_pid);
+
+void lockd_window_mgr_ready_lock(void *data, lockw_data * lockw,
+ Eina_Bool(*create_cb) (void *, int, void *),
+ Eina_Bool(*show_cb) (void *, int, void *));
+
+void lockd_window_mgr_finish_lock(lockw_data * lockw);
+
+lockw_data *lockd_window_init(void);
+
+#endif /* __LOCKD_WINDOW_MGR_H__ */
diff --git a/lock-mgr/src/lock-daemon.c b/lock-mgr/src/lock-daemon.c
index 5dfefcf..b45114f 100755
--- a/lock-mgr/src/lock-daemon.c
+++ b/lock-mgr/src/lock-daemon.c
@@ -40,12 +40,15 @@
#include "lockd-debug.h"
#include "lock-daemon.h"
#include "lockd-process-mgr.h"
+#include "lockd-window-mgr.h"
static int phone_lock_pid;
struct lockd_data {
+ int lock_app_pid;
int phone_lock_app_pid;
int phone_lock_state;
+ lockw_data *lockw;
};
struct ucred {
@@ -58,8 +61,10 @@ struct ucred {
#define PHLOCK_SOCK_PREFIX "/tmp/phlock"
#define PHLOCK_SOCK_MAXBUFF 65535
#define PHLOCK_APP_CMDLINE "/opt/apps/org.tizen.phone-lock/bin/phone-lock"
+#define LAUNCH_INTERVAL 100*1000
static void lockd_launch_app_lockscreen(struct lockd_data *lockd);
+static void lockd_unlock_lockscreen(struct lockd_data *lockd);
static void _lockd_notify_pm_state_cb(keynode_t * node, void *data)
{
@@ -103,6 +108,10 @@ _lockd_notify_lock_state_cb(keynode_t * node, void *data)
if (val == VCONFKEY_IDLE_UNLOCK) {
LOCKD_DBG("unlocked..!!");
+ if (lockd->lock_app_pid != 0) {
+ LOCKD_DBG("terminate lock app..!!");
+ lockd_process_mgr_terminate_lock_app(lockd->lock_app_pid, 1);
+ }
}
}
@@ -125,15 +134,59 @@ _lockd_notify_phone_lock_verification_cb(keynode_t * node, void *data)
}
if (val == TRUE) {
+ lockd_window_mgr_finish_lock(lockd->lockw);
vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_UNLOCK);
}
}
+static int lockd_app_dead_cb(int pid, void *data)
+{
+ LOCKD_DBG("app dead cb call! (pid : %d)", pid);
+
+ struct lockd_data *lockd = (struct lockd_data *)data;
+
+ if (pid == lockd->lock_app_pid && lockd->phone_lock_state == 0) {
+ LOCKD_DBG("lock app(pid:%d) is destroyed.", pid);
+ lockd_unlock_lockscreen(lockd);
+ }
+ return 0;
+}
+
+static Eina_Bool lockd_app_create_cb(void *data, int type, void *event)
+{
+ struct lockd_data *lockd = (struct lockd_data *)data;
+
+ if (lockd == NULL) {
+ return EINA_TRUE;
+ }
+ LOCKD_DBG("%s, %d", __func__, __LINE__);
+ lockd_window_set_window_effect(lockd->lockw, lockd->lock_app_pid,
+ event);
+ lockd_window_set_window_property(lockd->lockw, lockd->lock_app_pid,
+ event);
+ return EINA_FALSE;
+}
+
+static Eina_Bool lockd_app_show_cb(void *data, int type, void *event)
+{
+ struct lockd_data *lockd = (struct lockd_data *)data;
+
+ if (lockd == NULL) {
+ return EINA_TRUE;
+ }
+ LOCKD_DBG("%s, %d", __func__, __LINE__);
+ lockd_window_set_window_property(lockd->lockw, lockd->lock_app_pid,
+ event);
+
+ return EINA_FALSE;
+}
+
static void lockd_launch_app_lockscreen(struct lockd_data *lockd)
{
LOCKD_DBG("launch app lock screen");
int call_state = -1, bootlock_state = -1;
+ int r = 0;
vconf_get_bool(VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL,
&bootlock_state);
@@ -144,6 +197,18 @@ static void lockd_launch_app_lockscreen(struct lockd_data *lockd)
lockd->phone_lock_state = 0;
}
+ if (lockd_process_mgr_check_lock(lockd->lock_app_pid) == TRUE) {
+ LOCKD_DBG("Lock Screen App is already running.");
+ r = lockd_process_mgr_restart_lock(lockd->phone_lock_state);
+ if (r < 0) {
+ LOCKD_DBG("Restarting Lock Screen App is fail [%d].", r);
+ usleep(LAUNCH_INTERVAL);
+ } else {
+ LOCKD_DBG("Restarting Lock Screen App, pid[%d].", r);
+ return;
+ }
+ }
+
vconf_get_int(VCONFKEY_CALL_STATE, &call_state);
if (call_state != VCONFKEY_CALL_OFF) {
LOCKD_DBG
@@ -154,7 +219,6 @@ static void lockd_launch_app_lockscreen(struct lockd_data *lockd)
if (lockd->phone_lock_state == 1) {
vconf_set_bool(VCONFKEY_PHONE_LOCK_VERIFICATION, FALSE);
- /* Check phone lock application is already exit */
if (lockd_process_mgr_check_lock(lockd->phone_lock_app_pid) == TRUE) {
LOCKD_DBG("phone lock App is already running.");
return;
@@ -165,9 +229,29 @@ static void lockd_launch_app_lockscreen(struct lockd_data *lockd)
phone_lock_pid = lockd->phone_lock_app_pid;
LOCKD_DBG("%s, %d, phone_lock_pid = %d", __func__, __LINE__,
phone_lock_pid);
+ lockd_window_set_phonelock_pid(lockd->lockw, phone_lock_pid);
+ } else {
+ lockd->lock_app_pid =
+ lockd_process_mgr_start_lock(lockd, lockd_app_dead_cb,
+ lockd->phone_lock_state);
+ if (lockd->lock_app_pid < 0)
+ return;
+ vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_LOCK);
+ lockd_window_mgr_ready_lock(lockd, lockd->lockw, lockd_app_create_cb,
+ lockd_app_show_cb);
}
}
+static void lockd_unlock_lockscreen(struct lockd_data *lockd)
+{
+ LOCKD_DBG("unlock lock screen");
+ lockd->lock_app_pid = 0;
+
+ lockd_window_mgr_finish_lock(lockd->lockw);
+
+ vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_UNLOCK);
+}
+
inline static void lockd_set_sock_option(int fd, int cli)
{
int size;
@@ -460,7 +544,6 @@ static void lockd_init_vconf(struct lockd_data *lockd)
LOCKD_ERR
("[Error] vconf notify : lock state");
}
-
}
static void lockd_start_lock_daemon(void *data)
@@ -482,6 +565,7 @@ static void lockd_start_lock_daemon(void *data)
if (r < 0) {
LOCKD_DBG("lockd init socket failed: %d", r);
}
+ lockd->lockw = lockd_window_init();
LOCKD_DBG("%s, %d", __func__, __LINE__);
}
diff --git a/lock-mgr/src/lockd-process-mgr.c b/lock-mgr/src/lockd-process-mgr.c
index 1d5eaf6..f227d72 100755
--- a/lock-mgr/src/lockd-process-mgr.c
+++ b/lock-mgr/src/lockd-process-mgr.c
@@ -27,7 +27,91 @@
#include "lockd-debug.h"
#include "lockd-process-mgr.h"
+#define VCONFKEY_LOCKP_PKG_NAME "db/lockscreen/pkgname"
+#define LOCKD_DEFAULT_PKG_NAME "org.tizen.draglock"
#define LOCKD_PHONE_LOCK_PKG_NAME "org.tizen.phone-lock"
+#define RETRY_MAXCOUNT 30
+#define RELAUNCH_INTERVAL 100*1000
+
+static char *_lockd_process_mgr_get_pkgname(void)
+{
+ char *pkgname = NULL;
+
+ pkgname = vconf_get_str(VCONFKEY_LOCKP_PKG_NAME);
+
+ LOCKD_DBG("pkg name is %s", pkgname);
+
+ if (pkgname == NULL) {
+ return LOCKD_DEFAULT_PKG_NAME;
+ }
+
+ return pkgname;
+}
+
+int lockd_process_mgr_restart_lock(int phone_lock_state)
+{
+ char *lock_app_path = NULL;
+ int pid;
+ bundle *b = NULL;
+
+ lock_app_path = _lockd_process_mgr_get_pkgname();
+
+ b = bundle_create();
+
+ if (phone_lock_state)
+ bundle_add(b, "mode", "lock");
+ else
+ bundle_add(b, "mode", "normal");
+
+ pid = aul_launch_app(lock_app_path, b);
+
+ LOCKD_DBG("Reset : aul_launch_app(%s, NULL), pid = %d", lock_app_path,
+ pid);
+
+ if (b)
+ bundle_free(b);
+
+ return pid;
+}
+
+int
+lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
+ int phone_lock_state)
+{
+ char *lock_app_path = NULL;
+ int pid;
+ bundle *b = NULL;
+
+ lock_app_path = _lockd_process_mgr_get_pkgname();
+
+ b = bundle_create();
+
+ if (phone_lock_state)
+ bundle_add(b, "mode", "lock");
+ else
+ bundle_add(b, "mode", "normal");
+
+ int i;
+ for (i=0; i<RETRY_MAXCOUNT; i++)
+ {
+ pid = aul_launch_app(lock_app_path, b);
+
+ LOCKD_DBG("aul_launch_app(%s, NULL), pid = %d", lock_app_path, pid);
+
+ if (pid == AUL_R_ECOMM) {
+ LOCKD_DBG("Relaunch lock application [%d]times", i);
+ usleep(RELAUNCH_INTERVAL);
+ } else {
+ /* set listen and dead signal */
+ aul_listen_app_dead_signal(dead_cb, data);
+ if (b)
+ bundle_free(b);
+ return pid;
+ }
+ }
+ LOCKD_DBG("Relaunch lock application failed..!!");
+ return pid;
+}
int lockd_process_mgr_start_phone_lock(void)
{
@@ -48,6 +132,21 @@ int lockd_process_mgr_start_phone_lock(void)
return pid;
}
+void
+lockd_process_mgr_terminate_lock_app(int lock_app_pid, int state)
+{
+ LOCKD_DBG
+ ("lockd_process_mgr_terminate_lock_app, state:%d\n",
+ state);
+
+ if (state == 1) {
+ if (lock_app_pid != 0) {
+ LOCKD_DBG("Terminate Lock app(pid : %d)", lock_app_pid);
+ aul_terminate_pid(lock_app_pid);
+ }
+ }
+}
+
void lockd_process_mgr_terminate_phone_lock(int phone_lock_pid)
{
LOCKD_DBG("Terminate Phone Lock(pid : %d)", phone_lock_pid);
diff --git a/lock-mgr/src/lockd-window-mgr.c b/lock-mgr/src/lockd-window-mgr.c
new file mode 100755
index 0000000..a34995c
--- /dev/null
+++ b/lock-mgr/src/lockd-window-mgr.c
@@ -0,0 +1,287 @@
+/*
+ * starter
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@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 <Elementary.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <vconf.h>
+#include <bundle.h>
+#include <appcore-efl.h>
+
+#include "lockd-debug.h"
+#include "lockd-window-mgr.h"
+
+#define PACKAGE "starter"
+#define VCONFKEY_PHONE_LOCK_VERIFICATION "memory/lockscreen/phone_lock_verification"
+
+struct _lockw_data {
+ Ecore_X_Window input_x_window;
+
+ Evas_Object *main_win;
+ Evas_Object *main_layout;
+
+ Ecore_X_Window lock_x_window;
+
+ Ecore_Event_Handler *h_keydown;
+ Ecore_Event_Handler *h_wincreate;
+ Ecore_Event_Handler *h_winshow;
+
+ int phone_lock_state;
+ int phone_lock_app_pid;
+};
+
+static Eina_Bool _lockd_window_key_down_cb(void *data, int type, void *event)
+{
+ LOCKD_DBG("Key Down CB.");
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static int
+_lockd_window_check_validate_rect(Ecore_X_Display * dpy, Ecore_X_Window window)
+{
+ Ecore_X_Window root;
+ Ecore_X_Window child;
+
+ int rel_x = 0;
+ int rel_y = 0;
+ int abs_x = 0;
+ int abs_y = 0;
+
+ unsigned int width = 0;
+ unsigned int height = 0;
+ unsigned int border = 0;
+ unsigned int depth = 0;
+
+ Eina_Bool ret = FALSE;
+
+ root = ecore_x_window_root_first_get();
+
+ if (XGetGeometry
+ (dpy, window, &root, &rel_x, &rel_y, &width, &height, &border,
+ &depth)) {
+ if (XTranslateCoordinates
+ (dpy, window, root, 0, 0, &abs_x, &abs_y, &child)) {
+ if ((abs_x - border) >= 480 || (abs_y - border) >= 800
+ || (width + abs_x) <= 0 || (height + abs_y) <= 0) {
+ ret = FALSE;
+ } else {
+ ret = TRUE;
+ }
+ }
+ }
+ return ret;
+}
+
+static Window get_user_created_window(Window win)
+{
+ Atom type_ret = 0;
+ int ret, size_ret = 0;
+ unsigned long num_ret = 0, bytes = 0;
+ unsigned char *prop_ret = NULL;
+ unsigned int xid;
+ Atom prop_user_created_win;
+
+ prop_user_created_win =
+ XInternAtom(ecore_x_display_get(), "_E_USER_CREATED_WINDOW", False);
+
+ ret =
+ XGetWindowProperty(ecore_x_display_get(), win,
+ prop_user_created_win, 0L, 1L, False, 0,
+ &type_ret, &size_ret, &num_ret, &bytes,
+ &prop_ret);
+
+ if (ret != Success) {
+ if (prop_ret)
+ XFree((void *)prop_ret);
+ return win;
+ } else if (!prop_ret) {
+ return win;
+ }
+
+ memcpy(&xid, prop_ret, sizeof(unsigned int));
+ XFree((void *)prop_ret);
+
+ return xid;
+}
+
+void
+lockd_window_set_window_property(lockw_data * data, int lock_app_pid,
+ void *event)
+{
+ Ecore_X_Event_Window_Create *e = event;
+ Ecore_X_Window user_window = 0;
+ lockw_data *lockw = (lockw_data *) data;
+ int pid = 0;
+
+ if (!lockw) {
+ return;
+ }
+ LOCKD_DBG("%s, %d", __func__, __LINE__);
+
+ user_window = get_user_created_window((Window) (e->win));
+
+ ecore_x_netwm_pid_get(user_window, &pid);
+
+ LOCKD_DBG("Check PID(%d) window. (lock_app_pid : %d)\n", pid,
+ lock_app_pid);
+
+ if (lock_app_pid == pid) {
+ if (_lockd_window_check_validate_rect
+ (ecore_x_display_get(), user_window) == TRUE) {
+ lockw->lock_x_window = user_window;
+ LOCKD_DBG
+ ("This is lock application. Set window property. win id : %x",
+ user_window);
+
+ ecore_x_icccm_name_class_set(user_window, "LOCK_SCREEN",
+ "LOCK_SCREEN");
+
+ ecore_x_netwm_window_type_set(user_window,
+ ECORE_X_WINDOW_TYPE_NOTIFICATION);
+
+ utilx_set_system_notification_level(ecore_x_display_get
+ (), user_window,
+ UTILX_NOTIFICATION_LEVEL_NORMAL);
+
+ utilx_set_window_opaque_state(ecore_x_display_get(),
+ user_window,
+ UTILX_OPAQUE_STATE_ON);
+ }
+ }
+}
+
+void
+lockd_window_set_window_effect(lockw_data * data, int lock_app_pid, void *event)
+{
+ Ecore_X_Event_Window_Create *e = event;
+ Ecore_X_Window user_window = 0;
+ int pid = 0;
+
+ user_window = get_user_created_window((Window) (e->win));
+ ecore_x_netwm_pid_get(user_window, &pid);
+
+ LOCKD_DBG("%s, %d", __func__, __LINE__);
+
+ LOCKD_DBG("PID(%d) window created. (lock_app_pid : %d)\n", pid,
+ lock_app_pid);
+
+ if (lock_app_pid == pid) {
+ if (_lockd_window_check_validate_rect
+ (ecore_x_display_get(), user_window) == TRUE) {
+ LOCKD_DBG
+ ("This is lock application. Disable window effect. win id : %x\n",
+ user_window);
+
+ utilx_set_window_effect_state(ecore_x_display_get(),
+ user_window, 0);
+ }
+ }
+}
+
+void lockd_window_set_phonelock_pid(lockw_data * data, int phone_lock_pid)
+{
+ lockw_data *lockw = (lockw_data *) data;
+
+ if (!lockw) {
+ return;
+ }
+ LOCKD_DBG("%s, %d", __func__, __LINE__);
+ lockw->phone_lock_app_pid = phone_lock_pid;
+ LOCKD_DBG("%s, %d, lockw->phone_lock_app_pid = %d", __func__, __LINE__,
+ lockw->phone_lock_app_pid);
+}
+
+void
+lockd_window_mgr_ready_lock(void *data, lockw_data * lockw,
+ Eina_Bool(*create_cb) (void *, int, void *),
+ Eina_Bool(*show_cb) (void *, int, void *))
+{
+ Ecore_X_Window xwin;
+
+ if (lockw == NULL) {
+ LOCKD_ERR("lockw is NULL.");
+ return;
+ }
+
+ lockw->h_wincreate =
+ ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE, create_cb,
+ data);
+ lockw->h_winshow =
+ ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, show_cb, data);
+
+ xwin = lockw->input_x_window;
+ utilx_grab_key(ecore_x_display_get(), xwin, KEY_SELECT, EXCLUSIVE_GRAB);
+
+ lockw->h_keydown =
+ ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+ _lockd_window_key_down_cb, NULL);
+}
+
+void lockd_window_mgr_finish_lock(lockw_data * lockw)
+{
+ Ecore_X_Window xwin;
+
+ if (lockw == NULL) {
+ LOCKD_ERR("lockw is NULL.");
+ return;
+ }
+ if (lockw->h_wincreate != NULL) {
+ ecore_event_handler_del(lockw->h_wincreate);
+ lockw->h_wincreate = NULL;
+ }
+ if (lockw->h_winshow != NULL) {
+ ecore_event_handler_del(lockw->h_winshow);
+ lockw->h_winshow = NULL;
+ }
+
+ xwin = lockw->input_x_window;
+ utilx_ungrab_key(ecore_x_display_get(), xwin, KEY_SELECT);
+
+ if (lockw->h_keydown != NULL) {
+ ecore_event_handler_del(lockw->h_keydown);
+ lockw->h_keydown = NULL;
+ }
+}
+
+lockw_data *lockd_window_init(void)
+{
+ lockw_data *lockw = NULL;
+ Ecore_X_Window input_x_window;
+ Ecore_X_Window root_window;
+ long pid;
+
+ lockw = (lockw_data *) malloc(sizeof(lockw_data));
+ memset(lockw, 0x0, sizeof(lockw_data));
+
+ pid = getpid();
+ input_x_window = ecore_x_window_input_new(0, 0, 0, 1, 1);
+ ecore_x_icccm_title_set(input_x_window, "lock-daemon-input-window");
+ ecore_x_netwm_name_set(input_x_window, "lock-daemon-input-window");
+ ecore_x_netwm_pid_set(input_x_window, pid);
+ LOCKD_DBG("Created input window : %p", input_x_window);
+ lockw->input_x_window = input_x_window;
+
+ root_window = ecore_x_window_root_first_get();
+ ecore_x_window_client_sniff(root_window);
+
+ return lockw;
+}
+
diff --git a/packaging/starter.spec b/packaging/starter.spec
index cd4bf90..e6909ea 100644..100755
--- a/packaging/starter.spec
+++ b/packaging/starter.spec
@@ -1,9 +1,9 @@
Name: starter
Summary: starter
-Version: 0.3.44
+Version: 0.4.0
Release: 1
-Group: TO_BE/FILLED_IN
-License: Apache-2.0
+Group: Apache
+License: TO_BE/FILLED_IN
Source0: starter-%{version}.tar.gz
Requires(post): /usr/bin/vconftool
BuildRequires: cmake
@@ -14,14 +14,10 @@ BuildRequires: pkgconfig(heynoti)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(ecore-evas)
-BuildRequires: pkgconfig(eet)
-BuildRequires: pkgconfig(ecore-input)
BuildRequires: pkgconfig(utilX)
-BuildRequires: pkgconfig(ui-gadget)
+BuildRequires: pkgconfig(appcore-efl)
%description
Description: Starter
@@ -30,26 +26,30 @@ Description: Starter
%prep
%setup -q
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
%build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
-make
+make -j1
%install
+rm -rf %{buildroot}
%make_install
%post
vconftool set -t int "memory/startapps/sequence" 0 -i -u 5000 -g 5000
-vconftool set -t string db/lockscreen/pkgname "org.tizen.idle-lock" -u 5000 -g 5000
+vconftool set -t string db/lockscreen/pkgname "org.tizen.draglock" -u 5000 -g 5000
vconftool -i set -t int memory/idle_lock/state "0" -u 5000 -g 5000
ln -sf /etc/init.d/rd4starter /etc/rc.d/rc4.d/S81starter
ln -sf /etc/init.d/rd3starter /etc/rc.d/rc3.d/S43starter
+sync
+
%files
+%defattr(-,root,root,-)
%{_sysconfdir}/init.d/rd4starter
%{_sysconfdir}/init.d/rd3starter
-%{_datadir}/applications/starter.desktop
%{_bindir}/starter
%{_libdir}/liblock-daemon.so
+
diff --git a/starter.desktop.in b/starter.desktop.in
deleted file mode 100755
index 593ecc3..0000000
--- a/starter.desktop.in
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Name=@PROJECT_NAME@
-Exec=@BINDIR@/@PROJECT_NAME@
-Icon=elementary
-Terminal=false
-Type=Application
-Categories=Application;Utility;
-
-X-SLP-BaseLayoutWidth=720
-X-SLP-BaseLayoutHeight=1280