entrance: merge of my work, I still need to push some code. But I think it's a first step to unbork entrance...
What's in this patch ? theme rewriting, only a really basic theme is available for time. you can now set up the wallpaper in the login screen or in the conf authentication is more secure. xephyr support Add some tux Many bug fix
47
configure.ac
|
@ -47,21 +47,32 @@ AC_MSG_RESULT([${enable_pam}])
|
||||||
|
|
||||||
# Grub2
|
# Grub2
|
||||||
AC_ARG_ENABLE([grub2],
|
AC_ARG_ENABLE([grub2],
|
||||||
[AC_HELP_STRING([--enable-grub2], [enable grub2 support. @<:@default=disabled@:>@])],
|
[AC_HELP_STRING([--disable-grub2], [disable grub2 support. @<:@default=enabled@:>@])],
|
||||||
[
|
[
|
||||||
if test "x${enableval}" = "xyes" ; then
|
if test "x${disableval}" = "xyes" ; then
|
||||||
enable_grub2="yes"
|
|
||||||
else
|
|
||||||
enable_grub2="no"
|
enable_grub2="no"
|
||||||
|
else
|
||||||
|
enable_grub2="yes"
|
||||||
fi
|
fi
|
||||||
],
|
],
|
||||||
[enable_grub2="no"])
|
[enable_grub2="yes"])
|
||||||
AC_MSG_CHECKING([whether to support grub2 reboot features])
|
AC_MSG_CHECKING([whether to support grub2 reboot features])
|
||||||
AC_MSG_RESULT([${enable_grub2}])
|
AC_MSG_RESULT([${enable_grub2}])
|
||||||
|
|
||||||
if test "x${enable_grub2}" = "xyes" ; then
|
|
||||||
AC_DEFINE([HAVE_GRUB2], [1], [Set to 1 if grub is enabled.])
|
# Ekbd
|
||||||
fi
|
AC_ARG_ENABLE([ekbd],
|
||||||
|
[AC_HELP_STRING([--disable-ekbd], [disable virtual keyboard. @<:@default=enabled@:>@])],
|
||||||
|
[
|
||||||
|
if test "x${disableval}" = "xyes" ; then
|
||||||
|
enable_ekbd="no"
|
||||||
|
else
|
||||||
|
enable_ekbd="yes"
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[enable_ekbd="yes"])
|
||||||
|
AC_MSG_CHECKING([whether to support virtual keyboard features])
|
||||||
|
AC_MSG_RESULT([${enable_grub2}])
|
||||||
|
|
||||||
# consolekit
|
# consolekit
|
||||||
AC_ARG_ENABLE([consolekit],
|
AC_ARG_ENABLE([consolekit],
|
||||||
|
@ -105,6 +116,21 @@ AC_C___ATTRIBUTE__
|
||||||
PKG_CHECK_MODULES([ENTRANCE], [efreet >= 1.0.0 eina >= 1.0.0 eet >= 1.4.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-file >= 1.0.0 xcb >= 1.0.0])
|
PKG_CHECK_MODULES([ENTRANCE], [efreet >= 1.0.0 eina >= 1.0.0 eet >= 1.4.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-file >= 1.0.0 xcb >= 1.0.0])
|
||||||
PKG_CHECK_MODULES([ENTRANCE_CLIENT], [eet >= 1.4.0 edje >= 1.0.0 elementary >= 0.5.0.0 ecore-evas >= 1.0.0 evas >= 1.0.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-x >= 1.0.0 eina >= 1.0.0])
|
PKG_CHECK_MODULES([ENTRANCE_CLIENT], [eet >= 1.4.0 edje >= 1.0.0 elementary >= 0.5.0.0 ecore-evas >= 1.0.0 evas >= 1.0.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-x >= 1.0.0 eina >= 1.0.0])
|
||||||
|
|
||||||
|
# Grub2
|
||||||
|
if test "x${enable_grub2}" = "xyes" ; then
|
||||||
|
AC_DEFINE([HAVE_GRUB2], [1], [Set to 1 if grub is enabled.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ekbd
|
||||||
|
if test "x${enable_consolekit}" = "xyes" ; then
|
||||||
|
PKG_CHECK_MODULES([ENTRANCE_EKBD], [ekbd], [enable_ekbd="yes"], [enable_ekbd="no"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HAVE_CONSOLEKIT, [test "x${enable_ekbd}" = "xyes"])
|
||||||
|
if test "x${enable_ekbd}" = "xyes" ; then
|
||||||
|
AC_DEFINE([HAVE_EKBD], [1], [Set to 1 if ekbd is enabled.])
|
||||||
|
fi
|
||||||
|
|
||||||
# Consolekit
|
# Consolekit
|
||||||
if test "x${enable_consolekit}" = "xyes" ; then
|
if test "x${enable_consolekit}" = "xyes" ; then
|
||||||
PKG_CHECK_MODULES([ENTRANCE_CK], [dbus-1 ck-connector], [enable_consolekit="yes"], [enable_consolekit="no"])
|
PKG_CHECK_MODULES([ENTRANCE_CK], [dbus-1 ck-connector], [enable_consolekit="yes"], [enable_consolekit="no"])
|
||||||
|
@ -161,8 +187,10 @@ src/bin/Makefile
|
||||||
src/daemon/Makefile
|
src/daemon/Makefile
|
||||||
data/Makefile
|
data/Makefile
|
||||||
data/themes/Makefile
|
data/themes/Makefile
|
||||||
data/themes/old/Makefile
|
|
||||||
data/themes/beaumonts/Makefile
|
data/themes/beaumonts/Makefile
|
||||||
|
data/themes/default/Makefile
|
||||||
|
data/themes/fade/Makefile
|
||||||
|
data/themes/old/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,6 +208,7 @@ echo "Configuration Options Summary:"
|
||||||
echo
|
echo
|
||||||
echo " pam..................: ${have_pam}"
|
echo " pam..................: ${have_pam}"
|
||||||
echo " grub2................: ${enable_grub2}"
|
echo " grub2................: ${enable_grub2}"
|
||||||
|
echo " ekbd.................: ${enable_ekbd}"
|
||||||
echo " consolekit...........: ${enable_consolekit}"
|
echo " consolekit...........: ${enable_consolekit}"
|
||||||
echo
|
echo
|
||||||
echo " edje_cc..............: ${edje_cc}"
|
echo " edje_cc..............: ${edje_cc}"
|
||||||
|
|
|
@ -32,7 +32,7 @@ group "Entrance_Config" struct {
|
||||||
* 1 = True, 0 = False */
|
* 1 = True, 0 = False */
|
||||||
value "daemonize" uchar: 1;
|
value "daemonize" uchar: 1;
|
||||||
|
|
||||||
/* Enable numlock */
|
/* Enable numlock TODO support it */
|
||||||
value "numlock" uchar: 1;
|
value "numlock" uchar: 1;
|
||||||
|
|
||||||
/** Bool to determine if entrance must login user with the session_login command
|
/** Bool to determine if entrance must login user with the session_login command
|
||||||
|
@ -54,6 +54,20 @@ group "Entrance_Config" struct {
|
||||||
/* Log file */
|
/* Log file */
|
||||||
value "logfile" string: "/var/log/entrance.log";
|
value "logfile" string: "/var/log/entrance.log";
|
||||||
|
|
||||||
/* Theme to use */
|
/* Theme to use. This one could be overided if you permit setting below */
|
||||||
value "theme" string: "default";
|
value "theme" string: "default";
|
||||||
|
|
||||||
|
/* Allow settings in gui, who overides this one until it's updated */
|
||||||
|
value "custom_conf" uchar: 1;
|
||||||
|
|
||||||
|
/* background */
|
||||||
|
value "background_path" string: "";
|
||||||
|
/* if it's an edj file */
|
||||||
|
value "background_group" string: "";
|
||||||
|
|
||||||
|
/* Elementary profile */
|
||||||
|
value "elementary_profile" string: "default";
|
||||||
|
|
||||||
|
/* Use a virtual keyboard */
|
||||||
|
value "virtual_keyboard" uchar: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
SUBDIRS = beaumonts old
|
SUBDIRS = default
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
AUTOMAKE_OPTIONS = 1.4 foreign
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
EDJE_CC = @edje_cc@
|
||||||
|
EDJE_FLAGS = -v -id $(top_srcdir)/data/themes/default/images -fd $(top_srcdir)/data/themes/default/fonts
|
||||||
|
|
||||||
|
filesdir = $(datadir)/entrance/themes/
|
||||||
|
files_DATA = default.edj
|
||||||
|
|
||||||
|
EXTRA_DIST = default.edc
|
||||||
|
|
||||||
|
|
||||||
|
default.edj: Makefile $(EXTRA_DIST)
|
||||||
|
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||||
|
$(top_srcdir)/data/themes/default/default.edc \
|
||||||
|
$(top_builddir)/data/themes/default/default.edj
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
rm -f *.edj
|
||||||
|
|
|
@ -0,0 +1,499 @@
|
||||||
|
/*
|
||||||
|
* Default theme for Entrance
|
||||||
|
* By Michael Bouchaud
|
||||||
|
* Licence CC-By-Sa
|
||||||
|
* Photo by Philippe Caseiro
|
||||||
|
* Licence CC-By-Sa
|
||||||
|
*/
|
||||||
|
|
||||||
|
externals {
|
||||||
|
external: "elm";
|
||||||
|
}
|
||||||
|
|
||||||
|
collections {
|
||||||
|
group {
|
||||||
|
name: "entrance/background/default";
|
||||||
|
images {
|
||||||
|
image: "entrance_background.jpg" LOSSY 90;
|
||||||
|
}
|
||||||
|
parts {
|
||||||
|
part { name: "base";
|
||||||
|
type: IMAGE;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
image {
|
||||||
|
normal: "entrance_background.jpg";
|
||||||
|
scale_hint: STATIC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group {
|
||||||
|
name: "entrance/background";
|
||||||
|
data.item: "items" "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
group {
|
||||||
|
name: "entrance/wallpaper/default";
|
||||||
|
parts {
|
||||||
|
part { name: "base";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 255 255 255 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "clip1";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
rel2 {
|
||||||
|
to: "cur";
|
||||||
|
relative: 0.0 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "clip2";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
rel1 {
|
||||||
|
to: "cur";
|
||||||
|
relative: 1.0 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "cur";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
min: 1 0;
|
||||||
|
max: 1 99999;
|
||||||
|
visible: 0;
|
||||||
|
align: 1.0 0.5;
|
||||||
|
}
|
||||||
|
description { state: "user" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.wallpaper.default";
|
||||||
|
clip_to: "clip1";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.wallpaper.user";
|
||||||
|
clip_to: "clip2";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.login";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
programs {
|
||||||
|
program { name: "wallpaper_user";
|
||||||
|
signal: "entrance,wallpaper,user";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "user" 0.0;
|
||||||
|
target: "cur";
|
||||||
|
}
|
||||||
|
program { name: "wallpaper_default";
|
||||||
|
signal: "entrance,wallpaper,default";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "cur";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group {
|
||||||
|
name : "entrance";
|
||||||
|
|
||||||
|
images {
|
||||||
|
}
|
||||||
|
|
||||||
|
parts {
|
||||||
|
part { name: "clip";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
//color: 255 255 255 0;
|
||||||
|
}
|
||||||
|
description { state: "show" 0.0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.login";
|
||||||
|
clip_to: "clip";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
max: 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.users";
|
||||||
|
type: EXTERNAL;
|
||||||
|
// source: "elm/list";
|
||||||
|
// source: "elm/genlist";
|
||||||
|
source: "elm/gengrid";
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
rel1.relative: 0.0 0.2;
|
||||||
|
rel2.relative: 0.0 0.8;
|
||||||
|
rel2.to_x: "entrance.login";
|
||||||
|
visible: 1;
|
||||||
|
params {
|
||||||
|
bool: "horizontal" 0;
|
||||||
|
double: "vertical page relative" 0.0;
|
||||||
|
int: "horizontal item size" 96;
|
||||||
|
int: "vertical item size" 120;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
part { name: "entrance.actions";
|
||||||
|
type: EXTERNAL;
|
||||||
|
source: "elm/hoversel";
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
fixed: 1 1;
|
||||||
|
visible: 0;
|
||||||
|
max: 0 0;
|
||||||
|
align: 1.0 1.0;
|
||||||
|
params {
|
||||||
|
string: "label" "action";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description { state: "enabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.conf";
|
||||||
|
type: EXTERNAL;
|
||||||
|
source: "elm/button";
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
fixed: 1 1;
|
||||||
|
visible: 1;
|
||||||
|
max: 0 0;
|
||||||
|
align: 1.0 1.0;
|
||||||
|
rel2.to_x: "entrance.actions";
|
||||||
|
rel2.relative: 0.0 1.0;
|
||||||
|
params {
|
||||||
|
string: "label" "Settings";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description { state: "enabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
part { name: "entrance.error";
|
||||||
|
type: TEXT;
|
||||||
|
mouse_events: 0;
|
||||||
|
effect: SOFT_SHADOW;
|
||||||
|
scale: 1;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 255 255 255 0;
|
||||||
|
fixed: 1 1;
|
||||||
|
rel1.to_y: "entrance.xsessions";
|
||||||
|
rel1.relative: 0.0 1.0;
|
||||||
|
align: 0.5 0.0;
|
||||||
|
text {
|
||||||
|
text: "Error on login ! Maybe wrong password ?";
|
||||||
|
font: "Sans";
|
||||||
|
size: 18;
|
||||||
|
min: 1 1;
|
||||||
|
align: 0.5 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description { state: "visible" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
rel1.offset: 0 50;
|
||||||
|
rel2.offset: 0 50;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
programs {
|
||||||
|
program {
|
||||||
|
name: "action_enabled";
|
||||||
|
signal: "entrance,action,enabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "enabled" 0.0;
|
||||||
|
target: "entrance.actions";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "action_disabled";
|
||||||
|
signal: "entrance,action,disabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "entrance.actions";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "user_enabled";
|
||||||
|
signal: "entrance,users,enabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "enabled" 0.0;
|
||||||
|
target: "entrance.users";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "user_disabled";
|
||||||
|
signal: "entrance,users,disabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "entrance.users";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "conf_enabled";
|
||||||
|
signal: "entrance,custom_conf,enabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "enabled" 0.0;
|
||||||
|
target: "entrance.conf";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "conf_disabled";
|
||||||
|
signal: "entrance,custom_conf,disabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "entrance.conf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
group {
|
||||||
|
name : "entrance/login";
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "entrance.login";
|
||||||
|
type: SWALLOW;
|
||||||
|
repeat_events: 0;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
min: 140 0;
|
||||||
|
max: 0 0;
|
||||||
|
align: 0.5 1.0;
|
||||||
|
rel2.to_y: "entrance.password";
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
part {
|
||||||
|
name: "entrance.password";
|
||||||
|
type: SWALLOW;
|
||||||
|
repeat_events: 0;
|
||||||
|
source: "entrance/entry/password";
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
min: 140 0;
|
||||||
|
max: 0 0;
|
||||||
|
align: 0.5 0.5;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.xsessions";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
max: 0 0;
|
||||||
|
rel1.to_y: "entrance.password";
|
||||||
|
rel1.relative: 0.0 1.0;
|
||||||
|
align: 0.5 0.0;
|
||||||
|
//visible: 0;
|
||||||
|
}
|
||||||
|
description { state: "enabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PROGRAMS
|
||||||
|
*/
|
||||||
|
programs {
|
||||||
|
program {
|
||||||
|
name: "xsession_enabled";
|
||||||
|
signal: "entrance,xsession,enabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "enabled" 0.0;
|
||||||
|
target: "entrance.xsessions";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "xsession_disabled";
|
||||||
|
signal: "entrance,xsession,disabled";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "entrance.xsessions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* PROGRAMS
|
||||||
|
*
|
||||||
|
|
||||||
|
programs {
|
||||||
|
program {
|
||||||
|
name: "login_error";
|
||||||
|
signal: "entrance,auth,error";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "visible" 0.0;
|
||||||
|
transition: DECELERATE 0.2;
|
||||||
|
target: "entrance.error";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "login_change";
|
||||||
|
signal: "entrance.auth.change";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
transition: ACCELERATE 0.4;
|
||||||
|
target: "entrance.error";
|
||||||
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
name: "auth_enable";
|
||||||
|
signal: "entrance.auth.enable";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "auth" 0.0;
|
||||||
|
transition: ACCELERATE 0.8;
|
||||||
|
target: "entrance.users";
|
||||||
|
target: "entrance.password";
|
||||||
|
target: "entrance.xsessions";
|
||||||
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
name: "auth_disable";
|
||||||
|
signal: "entrance.auth.disable";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
transition: LINEAR 0.5;
|
||||||
|
target: "entrance.users";
|
||||||
|
target: "entrance.password";
|
||||||
|
target: "entrance.xsessions";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "login";
|
||||||
|
signal: "entrance.auth.valid";
|
||||||
|
source: "";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
transition: LINEAR 0.7;
|
||||||
|
target: "clip";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "login_valid";
|
||||||
|
signal: "mouse,down,*";
|
||||||
|
source: "valid";
|
||||||
|
action: SIGNAL_EMIT "entrance.auth.request" "";
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group { name: "entrance/conf/login";
|
||||||
|
parts {
|
||||||
|
alias: "entrance.login" "login:entrance.login";
|
||||||
|
alias: "entrance.password" "login:entrance.password";
|
||||||
|
alias: "entrance.xsessions" "login:entrance.xsessions";
|
||||||
|
part { name: "base";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "entrance.conf";
|
||||||
|
type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "hover";
|
||||||
|
type: RECT;
|
||||||
|
mouse_events: 1;
|
||||||
|
repeat_events: 0;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 196;
|
||||||
|
}
|
||||||
|
description { state: "hidden" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "login";
|
||||||
|
type: GROUP;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
description { state: "hidden" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group { name: "entrance/user";
|
||||||
|
data.item: "items" "adrielhernandez-cmyk-tux brunocb-tux-1-euro cisoun-tux-coup-de-soleil eliaden-tux-marin fcys14-tux-breton fcys14-tux-croco fcys14-tux-pompier fcys14-yoshi-tux m4r10-tux-crema mybob-calimetux overlord59-astro-tux overlord59-dj-tux-mix-platine overlord59-magic-tux overlord59-tux-pianiste touko-tux-pirate";
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "entrance.icon";
|
||||||
|
type: SWALLOW;
|
||||||
|
mouse_events: 0;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
min: 96 96;
|
||||||
|
visible: 1;
|
||||||
|
//aspect : 1.0 1.0;
|
||||||
|
//aspect_preference : BOTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ADD_USER_ICON(NAME) \
|
||||||
|
group { name: "entrance/user/"NAME; \
|
||||||
|
images { \
|
||||||
|
image: NAME".png" COMP; \
|
||||||
|
} \
|
||||||
|
parts { \
|
||||||
|
part { name: "base"; \
|
||||||
|
type: RECT; \
|
||||||
|
description { state: "default" 0.0; \
|
||||||
|
visible: 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
part { name: "icon"; \
|
||||||
|
type: IMAGE; \
|
||||||
|
description { \
|
||||||
|
image { \
|
||||||
|
normal: NAME".png"; \
|
||||||
|
scale_hint: STATIC; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
ADD_USER_ICON("adrielhernandez-cmyk-tux")
|
||||||
|
ADD_USER_ICON("brunocb-tux-1-euro")
|
||||||
|
ADD_USER_ICON("cisoun-tux-coup-de-soleil")
|
||||||
|
ADD_USER_ICON("eliaden-tux-marin")
|
||||||
|
ADD_USER_ICON("fcys14-tux-breton")
|
||||||
|
ADD_USER_ICON("fcys14-tux-croco")
|
||||||
|
ADD_USER_ICON("fcys14-tux-pompier")
|
||||||
|
ADD_USER_ICON("fcys14-yoshi-tux")
|
||||||
|
ADD_USER_ICON("m4r10-tux-crema")
|
||||||
|
ADD_USER_ICON("mybob-calimetux")
|
||||||
|
ADD_USER_ICON("overlord59-astro-tux")
|
||||||
|
ADD_USER_ICON("overlord59-dj-tux-mix-platine")
|
||||||
|
ADD_USER_ICON("overlord59-magic-tux")
|
||||||
|
ADD_USER_ICON("overlord59-tux-pianiste")
|
||||||
|
ADD_USER_ICON("touko-tux-pirate")
|
||||||
|
}
|
||||||
|
|
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 963 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 230 KiB |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 188 B |
After Width: | Height: | Size: 252 B |
After Width: | Height: | Size: 200 B |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 223 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 509 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 180 B |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
|
@ -16,10 +16,14 @@ entrance_client_SOURCES = \
|
||||||
../event/entrance_event.c \
|
../event/entrance_event.c \
|
||||||
entrance_client.h \
|
entrance_client.h \
|
||||||
entrance_client.c \
|
entrance_client.c \
|
||||||
|
entrance_conf.h \
|
||||||
|
entrance_conf.c \
|
||||||
entrance_connect.h \
|
entrance_connect.h \
|
||||||
entrance_connect.c \
|
entrance_connect.c \
|
||||||
entrance_fill.h \
|
entrance_fill.h \
|
||||||
entrance_fill.c \
|
entrance_fill.c \
|
||||||
|
entrance_login.h \
|
||||||
|
entrance_login.c \
|
||||||
entrance_gui.h \
|
entrance_gui.h \
|
||||||
entrance_gui.c
|
entrance_gui.c
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,6 @@ static const Ecore_Getopt options =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
|
||||||
entrance_client_main(const char *theme)
|
|
||||||
{
|
|
||||||
PT("client init\n");
|
|
||||||
if (entrance_gui_init(theme)) return EXIT_FAILURE;
|
|
||||||
PT("client run\n");
|
|
||||||
entrance_connect_init();
|
|
||||||
elm_run();
|
|
||||||
entrance_connect_shutdown();
|
|
||||||
PT("_client: client shutdown\n");
|
|
||||||
entrance_gui_shutdown();
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -70,12 +56,23 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
eina_init();
|
eina_init();
|
||||||
ecore_init();
|
ecore_init();
|
||||||
ecore_x_init(NULL);
|
ecore_x_init(display);
|
||||||
elm_init(argc, argv);
|
elm_init(argc, argv);
|
||||||
entrance_client_main(theme);
|
PT("login init\n");
|
||||||
|
entrance_login_init();
|
||||||
|
PT("client init\n");
|
||||||
|
if (!entrance_gui_init(theme)) return EXIT_FAILURE;
|
||||||
|
PT("client run\n");
|
||||||
|
entrance_connect_init();
|
||||||
|
elm_run();
|
||||||
|
entrance_connect_shutdown();
|
||||||
|
PT("_client: client shutdown\n");
|
||||||
|
entrance_gui_shutdown();
|
||||||
|
entrance_login_shutdown();
|
||||||
elm_shutdown();
|
elm_shutdown();
|
||||||
ecore_x_shutdown();
|
ecore_x_shutdown();
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,16 @@
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#include "../event/entrance_event.h"
|
||||||
#include "entrance_gui.h"
|
#include "entrance_gui.h"
|
||||||
|
#include "entrance_conf.h"
|
||||||
#include "entrance_connect.h"
|
#include "entrance_connect.h"
|
||||||
#include "entrance_client.h"
|
#include "entrance_client.h"
|
||||||
#include "entrance_gui.h"
|
#include "entrance_gui.h"
|
||||||
#include "entrance_fill.h"
|
#include "entrance_fill.h"
|
||||||
#include "../event/entrance_event.h"
|
#include "entrance_login.h"
|
||||||
|
|
||||||
#define PT(x) \
|
#define PT(f, x...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
current_time = time(NULL); \
|
current_time = time(NULL); \
|
||||||
|
@ -24,7 +26,7 @@ do \
|
||||||
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
||||||
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
||||||
"%b %_2d %T", local_time); \
|
"%b %_2d %T", local_time); \
|
||||||
fprintf(stderr, "(%s) "PACKAGE"_client: %s", entrance_time_d, x); \
|
fprintf(stderr, "(%s) "PACKAGE"_client: "f, entrance_time_d, ##x); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
extern time_t current_time;
|
extern time_t current_time;
|
||||||
|
|
|
@ -0,0 +1,591 @@
|
||||||
|
#include "entrance_client.h"
|
||||||
|
|
||||||
|
typedef struct Entrance_Conf_Background_
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
const char *name;
|
||||||
|
} Entrance_Conf_Background;
|
||||||
|
|
||||||
|
typedef struct Entrance_Int_Conf_
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Evas_Object *preview;
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} bg;
|
||||||
|
const char *theme;
|
||||||
|
const char *elm_profile;
|
||||||
|
Eina_Bool vkbd_enabled : 1;
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *user;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Evas_Object *preview;
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} bg;
|
||||||
|
Eina_Bool remember_session : 1;
|
||||||
|
} user;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Evas_Object *btn_ok;
|
||||||
|
Evas_Object *btn_apply;
|
||||||
|
} gui;
|
||||||
|
|
||||||
|
} Entrance_Int_Conf;
|
||||||
|
|
||||||
|
|
||||||
|
static void _entrance_conf_init(void);
|
||||||
|
static void _entrance_conf_shutdown(void);
|
||||||
|
static char *_entrance_conf_bg_text_get(void *data, Evas_Object *obj, const char *part);
|
||||||
|
static Evas_Object *_entrance_conf_bg_content_get(void *data, Evas_Object *obj, const char *part);
|
||||||
|
static Eina_Bool _entrance_conf_bg_state_get(void *data, Evas_Object *obj, const char *part);
|
||||||
|
static void _entrance_conf_bg_sel(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _entrance_conf_changed();
|
||||||
|
static void _entrance_conf_apply();
|
||||||
|
|
||||||
|
static Entrance_Fill *_entrance_background_fill = NULL;
|
||||||
|
static Entrance_Int_Conf *_entrance_int_conf = NULL;
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_entrance_conf_bg_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Entrance_Conf_Background *cbg;
|
||||||
|
cbg = data;
|
||||||
|
return strdup(cbg->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_entrance_conf_bg_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
|
{
|
||||||
|
Entrance_Conf_Background *cbg;
|
||||||
|
Evas_Object *o = NULL;
|
||||||
|
cbg = data;
|
||||||
|
if (part && !strcmp("elm.swallow.icon", part))
|
||||||
|
{
|
||||||
|
o = elm_image_add(obj);
|
||||||
|
elm_image_file_set(o, cbg->path, cbg->group);
|
||||||
|
elm_image_smooth_set(o, EINA_FALSE);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND,
|
||||||
|
EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_entrance_conf_bg_state_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_bg_del(void *data, Evas_Object *obj EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Entrance_Conf_Background *cbg;
|
||||||
|
cbg = data;
|
||||||
|
eina_stringshare_del(cbg->name);
|
||||||
|
eina_stringshare_del(cbg->path);
|
||||||
|
eina_stringshare_del(cbg->group);
|
||||||
|
free(cbg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_bg_sel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
Entrance_Conf_Background *cbg;
|
||||||
|
cbg = elm_object_item_data_get(event_info);
|
||||||
|
fprintf(stderr, "%s %s\n", cbg->path, cbg->group);
|
||||||
|
if (!elm_layout_file_set(_entrance_int_conf->bg.preview,
|
||||||
|
cbg->path, cbg->group))
|
||||||
|
{
|
||||||
|
PT("Error on loading ");
|
||||||
|
fprintf(stderr, "%s %s\n", cbg->path, cbg->group);
|
||||||
|
}
|
||||||
|
_entrance_int_conf->bg.path = cbg->path;
|
||||||
|
_entrance_int_conf->bg.group = cbg->group;
|
||||||
|
_entrance_conf_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vkbd */
|
||||||
|
static void
|
||||||
|
_entrance_conf_vkbd_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Actionslider_Pos p;
|
||||||
|
|
||||||
|
PT("User change vkbd state\n");
|
||||||
|
|
||||||
|
p = elm_actionslider_indicator_pos_get(obj);
|
||||||
|
_entrance_int_conf->vkbd_enabled = !!(p == ELM_ACTIONSLIDER_RIGHT);
|
||||||
|
_entrance_conf_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scale */
|
||||||
|
static void
|
||||||
|
_entrance_conf_scale_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_entrance_int_conf->scale = elm_spinner_value_get(obj);
|
||||||
|
_entrance_conf_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Buttons Cb */
|
||||||
|
static void
|
||||||
|
_entrance_conf_ok_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_entrance_conf_apply();
|
||||||
|
evas_object_del(data);
|
||||||
|
_entrance_conf_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_apply_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_entrance_conf_apply();
|
||||||
|
_entrance_conf_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_close_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
evas_object_del(data);
|
||||||
|
_entrance_conf_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Eina_List *
|
||||||
|
_entrance_conf_backgrounds_get(Evas_Object *obj, const char *user)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *edj;
|
||||||
|
Eina_List *list, *l, *nl = NULL;
|
||||||
|
Entrance_Conf_Background *cbg;
|
||||||
|
const char *str;
|
||||||
|
const char *path;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
Eina_Iterator *it;
|
||||||
|
|
||||||
|
o = entrance_gui_theme_get(obj, "entrance/background");
|
||||||
|
edj = elm_layout_edje_get(o);
|
||||||
|
edje_object_file_get(edj, &path, NULL);
|
||||||
|
list = entrance_gui_stringlist_get(edje_object_data_get(edj, "items"));
|
||||||
|
EINA_LIST_FOREACH(list, l, str)
|
||||||
|
{
|
||||||
|
cbg = calloc(1, sizeof(Entrance_Conf_Background));
|
||||||
|
snprintf(buf, sizeof(buf),
|
||||||
|
"entrance/background/%s", str);
|
||||||
|
|
||||||
|
cbg->path = eina_stringshare_add(path);
|
||||||
|
cbg->group = eina_stringshare_add(buf);
|
||||||
|
cbg->name = eina_stringshare_add(str);
|
||||||
|
nl = eina_list_append(nl, cbg);
|
||||||
|
}
|
||||||
|
entrance_gui_stringlist_free(list);
|
||||||
|
evas_object_del(o);
|
||||||
|
|
||||||
|
//TODO parse share/entrance/background
|
||||||
|
it = eina_file_ls(PACKAGE_DATA_DIR"/backgrounds");
|
||||||
|
EINA_ITERATOR_FOREACH(it, str)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
len = strlen(str);
|
||||||
|
if (len < 4) continue;
|
||||||
|
if (!strcmp(&str[len-4], ".edj"))
|
||||||
|
{
|
||||||
|
cbg = calloc(1, sizeof(Entrance_Conf_Background));
|
||||||
|
snprintf(buf, sizeof(buf),
|
||||||
|
"entrance/background/%s", str);
|
||||||
|
cbg->path = str;
|
||||||
|
cbg->group = eina_stringshare_add("e/desktop/background");
|
||||||
|
{
|
||||||
|
char *name, *p;
|
||||||
|
name = strrchr(str, '/');
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
name++;
|
||||||
|
name = strdupa(name);
|
||||||
|
p = strrchr(name, '.');
|
||||||
|
if (p) *p = '\0';
|
||||||
|
}
|
||||||
|
cbg->name = eina_stringshare_add(name);
|
||||||
|
}
|
||||||
|
nl = eina_list_append(nl, cbg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eina_stringshare_del(str);
|
||||||
|
}
|
||||||
|
eina_iterator_free(it);
|
||||||
|
|
||||||
|
return nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_apply()
|
||||||
|
{
|
||||||
|
Entrance_Conf_Gui_Event conf;
|
||||||
|
|
||||||
|
conf.bg.path = _entrance_int_conf->bg.path;
|
||||||
|
conf.bg.group = _entrance_int_conf->bg.group;
|
||||||
|
conf.vkbd_enabled = _entrance_int_conf->vkbd_enabled;
|
||||||
|
|
||||||
|
entrance_gui_conf_set(&conf);
|
||||||
|
entrance_connect_conf_send(&conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Build it */
|
||||||
|
static Evas_Object *
|
||||||
|
_entrance_conf_build(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *t, *bx, *hbx, *o;
|
||||||
|
Eina_List *l;
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
t = elm_table_add(obj);
|
||||||
|
elm_table_padding_set(t, 5 , 5);
|
||||||
|
evas_object_size_hint_weight_set(t, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
|
||||||
|
/* Background */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Background");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
hbx = elm_box_add(t);
|
||||||
|
elm_box_horizontal_set(hbx, EINA_TRUE);
|
||||||
|
elm_table_pack(t, hbx, 0, j, 2, 3);
|
||||||
|
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
o = elm_genlist_add(hbx);
|
||||||
|
elm_scroller_bounce_set(o, EINA_FALSE, EINA_TRUE);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
l = _entrance_conf_backgrounds_get(o, NULL);
|
||||||
|
entrance_fill(o, _entrance_background_fill,
|
||||||
|
l, _entrance_conf_bg_sel, o);
|
||||||
|
eina_list_free(l);
|
||||||
|
elm_box_pack_end(hbx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
bx = elm_box_add(hbx);
|
||||||
|
elm_box_pack_end(hbx, bx);
|
||||||
|
evas_object_show(bx);
|
||||||
|
o = elm_layout_add(hbx);
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
_entrance_int_conf->bg.preview = o;
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = evas_object_rectangle_add(hbx);
|
||||||
|
evas_object_color_set(o, 0, 0, 0, 0);
|
||||||
|
evas_object_size_hint_min_set(o, 256, 0);
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_show(hbx);
|
||||||
|
j += 3;
|
||||||
|
|
||||||
|
/* Touch Screen */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Use a virtual keyboard");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = elm_actionslider_add(t);
|
||||||
|
elm_object_style_set(o, "bar");
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_object_part_text_set(o, "left", "Disabled");
|
||||||
|
elm_object_part_text_set(o, "right", "Enabled");
|
||||||
|
|
||||||
|
elm_actionslider_magnet_pos_set(o, ELM_ACTIONSLIDER_LEFT);
|
||||||
|
elm_actionslider_enabled_pos_set(o, ELM_ACTIONSLIDER_LEFT |
|
||||||
|
ELM_ACTIONSLIDER_RIGHT);
|
||||||
|
evas_object_smart_callback_add(o, "selected",
|
||||||
|
_entrance_conf_vkbd_changed, NULL);
|
||||||
|
if (_entrance_int_conf->vkbd_enabled)
|
||||||
|
elm_actionslider_indicator_pos_set(o, ELM_ACTIONSLIDER_RIGHT);
|
||||||
|
else
|
||||||
|
elm_actionslider_indicator_pos_set(o, ELM_ACTIONSLIDER_LEFT);
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
/* Elementary Profile */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "elementary profile");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = elm_button_add(t);
|
||||||
|
elm_object_text_set(o, _entrance_int_conf->elm_profile);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
/* Scaling */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Scaling");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = elm_spinner_add(t);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_entrance_conf_scale_changed, NULL);
|
||||||
|
elm_spinner_value_set(o, _entrance_int_conf->scale);
|
||||||
|
elm_spinner_min_max_set(o, 0.25, 5.0);
|
||||||
|
elm_spinner_step_set(o, 0.15);
|
||||||
|
elm_spinner_label_format_set(o, "%.2f");
|
||||||
|
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
o = evas_object_rectangle_add(o);
|
||||||
|
evas_object_color_set(o, 0, 0, 0, 0);
|
||||||
|
evas_object_size_hint_min_set(o, 128, 0);
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
|
||||||
|
evas_object_show(t);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_entrance_conf_user_build(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *t, *bx, *o, *ly;
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
ly = entrance_gui_theme_get(obj, "entrance/conf/login");
|
||||||
|
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(ly);
|
||||||
|
|
||||||
|
t = elm_table_add(obj);
|
||||||
|
elm_object_part_content_set(ly, "entrance.conf", t);
|
||||||
|
elm_table_padding_set(t, 5 , 5);
|
||||||
|
|
||||||
|
/* Background */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Background");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
o = elm_gengrid_add(t);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 2, 3);
|
||||||
|
elm_gengrid_item_size_set(o, 80, 50);
|
||||||
|
elm_gengrid_align_set(o, 0.0, 0.0);
|
||||||
|
evas_object_show(o);
|
||||||
|
j += 3;
|
||||||
|
|
||||||
|
/* Session to autoselect */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Session to use");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = elm_hoversel_add(t);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_object_text_set(o, "Session");
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
/* Remember last session */
|
||||||
|
o = elm_label_add(t);
|
||||||
|
elm_object_text_set(o, "Remember last session");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_table_pack(t, o, 0, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
o = elm_actionslider_add(t);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_object_part_text_set(o, "left", "Enabled");
|
||||||
|
elm_object_part_text_set(o, "right", "Disabled");
|
||||||
|
elm_table_pack(t, o, 1, j, 1, 1);
|
||||||
|
evas_object_show(o);
|
||||||
|
++j;
|
||||||
|
|
||||||
|
evas_object_show(t);
|
||||||
|
|
||||||
|
return ly;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_control_changed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||||
|
{
|
||||||
|
Elm_Object_Item *it;
|
||||||
|
it = event;
|
||||||
|
elm_naviframe_item_promote(elm_object_item_data_get(it));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
static void
|
||||||
|
_entrance_conf_changed(void)
|
||||||
|
{
|
||||||
|
const char *bg_path;
|
||||||
|
const char *bg_group;
|
||||||
|
|
||||||
|
entrance_gui_background_get(&bg_path, &bg_group);
|
||||||
|
if ((_entrance_int_conf->theme != entrance_gui_theme_name_get())
|
||||||
|
|| (_entrance_int_conf->bg.path != bg_path)
|
||||||
|
|| (_entrance_int_conf->bg.group != bg_group)
|
||||||
|
|| (_entrance_int_conf->scale != elm_config_scale_get())
|
||||||
|
|| (_entrance_int_conf->elm_profile != elm_config_profile_get())
|
||||||
|
|| (_entrance_int_conf->vkbd_enabled != entrance_gui_vkbd_enabled_get()))
|
||||||
|
{
|
||||||
|
elm_object_disabled_set(_entrance_int_conf->gui.btn_ok, EINA_FALSE);
|
||||||
|
elm_object_disabled_set(_entrance_int_conf->gui.btn_apply, EINA_FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elm_object_disabled_set(_entrance_int_conf->gui.btn_ok, EINA_TRUE);
|
||||||
|
elm_object_disabled_set(_entrance_int_conf->gui.btn_apply, EINA_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_init(void)
|
||||||
|
{
|
||||||
|
PT("conf init\n");
|
||||||
|
_entrance_background_fill =
|
||||||
|
entrance_fill_new("default",
|
||||||
|
_entrance_conf_bg_text_get,
|
||||||
|
_entrance_conf_bg_content_get,
|
||||||
|
_entrance_conf_bg_state_get,
|
||||||
|
_entrance_conf_bg_del);
|
||||||
|
_entrance_int_conf = calloc(1, sizeof(Entrance_Int_Conf));
|
||||||
|
_entrance_int_conf->theme = entrance_gui_theme_name_get();
|
||||||
|
entrance_gui_background_get(&(_entrance_int_conf->bg.path),
|
||||||
|
&(_entrance_int_conf->bg.group));
|
||||||
|
_entrance_int_conf->vkbd_enabled = entrance_gui_vkbd_enabled_get();
|
||||||
|
_entrance_int_conf->scale = elm_config_scale_get();
|
||||||
|
_entrance_int_conf->elm_profile = elm_config_profile_get();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_conf_shutdown(void)
|
||||||
|
{
|
||||||
|
PT("conf shutdown\n");
|
||||||
|
entrance_fill_del(_entrance_background_fill);
|
||||||
|
free(_entrance_int_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_conf_begin(Evas_Object *obj, Evas_Object *parent)
|
||||||
|
{
|
||||||
|
PT("Build config panel\n");
|
||||||
|
Evas_Object *win, *bg, *bx, *hbx, *sc, *nf, *o;
|
||||||
|
Elm_Object_Item *it, *itc;
|
||||||
|
Elm_Object_Item *itu, *ituc;
|
||||||
|
|
||||||
|
_entrance_conf_init();
|
||||||
|
|
||||||
|
win = elm_hover_add(obj);
|
||||||
|
elm_hover_parent_set(win, parent);
|
||||||
|
// win = elm_popup_add(obj);
|
||||||
|
bg = elm_bg_add(win);
|
||||||
|
bx = elm_box_add(win);
|
||||||
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_object_content_set(win, bx);
|
||||||
|
|
||||||
|
sc = elm_segment_control_add(bx);
|
||||||
|
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(bx, sc);
|
||||||
|
evas_object_smart_callback_add(sc, "changed",
|
||||||
|
_entrance_conf_control_changed, NULL);
|
||||||
|
evas_object_show(sc);
|
||||||
|
|
||||||
|
nf = elm_naviframe_add(bx);
|
||||||
|
evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(bx, nf);
|
||||||
|
evas_object_show(nf);
|
||||||
|
|
||||||
|
o = _entrance_conf_build(nf);
|
||||||
|
it = elm_naviframe_item_simple_push(nf, o);
|
||||||
|
itc = elm_segment_control_item_add(sc, NULL, "General");
|
||||||
|
elm_object_item_data_set(itc, it);
|
||||||
|
|
||||||
|
o = _entrance_conf_user_build(nf);
|
||||||
|
itu = elm_naviframe_item_simple_push(nf, o);
|
||||||
|
ituc = elm_segment_control_item_add(sc, NULL, "User");
|
||||||
|
elm_object_item_data_set(ituc, itu);
|
||||||
|
|
||||||
|
/* Ok Apply Close */
|
||||||
|
hbx = elm_box_add(bx);
|
||||||
|
elm_box_horizontal_set(hbx, EINA_TRUE);
|
||||||
|
elm_box_homogeneous_set(hbx, EINA_TRUE);
|
||||||
|
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(bx, hbx);
|
||||||
|
evas_object_show(hbx);
|
||||||
|
|
||||||
|
o = elm_button_add(hbx);
|
||||||
|
elm_object_text_set(o, "Ok");
|
||||||
|
elm_object_disabled_set(o, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_add(o, "clicked",
|
||||||
|
_entrance_conf_ok_clicked, win);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(hbx, o);
|
||||||
|
_entrance_int_conf->gui.btn_ok = o;
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = elm_button_add(hbx);
|
||||||
|
elm_object_text_set(o, "Apply");
|
||||||
|
elm_object_disabled_set(o, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_add(o, "clicked",
|
||||||
|
_entrance_conf_apply_clicked, NULL);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(hbx, o);
|
||||||
|
_entrance_int_conf->gui.btn_apply = o;
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = elm_button_add(hbx);
|
||||||
|
elm_object_text_set(o, "Close");
|
||||||
|
evas_object_smart_callback_add(o, "clicked",
|
||||||
|
_entrance_conf_close_clicked, win);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(hbx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
elm_segment_control_item_selected_set(itc, EINA_TRUE);
|
||||||
|
|
||||||
|
{
|
||||||
|
Evas_Coord xx, yy, ww, hh, x, y, w, h;
|
||||||
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
|
evas_object_geometry_get(bx, NULL, NULL, &ww, &hh);
|
||||||
|
xx = 50;//x + (w / 2) - (ww / 2);
|
||||||
|
yy = 50;//y + (y / 2) - (hh / 2);
|
||||||
|
evas_object_move(bg, xx, yy);
|
||||||
|
evas_object_resize(bg, w - 100, h - 100);
|
||||||
|
evas_object_move(bx, xx, yy);
|
||||||
|
evas_object_resize(bx, w - 100, h - 100);
|
||||||
|
}
|
||||||
|
evas_object_show(bg);
|
||||||
|
evas_object_show(bx);
|
||||||
|
evas_object_show(win);
|
||||||
|
evas_object_freeze_events_set(win, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef ENTRANCE_CONFIG_H
|
||||||
|
#define ENTRANCE_CONFIG_H
|
||||||
|
|
||||||
|
void entrance_conf_begin(Evas_Object *obj, Evas_Object *parent);
|
||||||
|
|
||||||
|
#endif /* ENTRANCE_CONFIG_H */
|
|
@ -1,20 +1,18 @@
|
||||||
#include <Ecore_Con.h>
|
#include <Ecore_Con.h>
|
||||||
#include "entrance_client.h"
|
#include "entrance_client.h"
|
||||||
|
|
||||||
Ecore_Con_Server *_entrance_connect;
|
|
||||||
Eina_List *_handlers;
|
|
||||||
|
|
||||||
static Eina_Bool _entrance_connect_add(void *data, int type, void *event);
|
static Eina_Bool _entrance_connect_add(void *data, int type, void *event);
|
||||||
static Eina_Bool _entrance_connect_del(void *data, int type, void *event);
|
static Eina_Bool _entrance_connect_del(void *data, int type, void *event);
|
||||||
static Eina_Bool _entrance_connect_data(void *data, int type, void *event);
|
static Eina_Bool _entrance_connect_data(void *data, int type, void *event);
|
||||||
|
|
||||||
|
Ecore_Con_Server *_entrance_connect;
|
||||||
|
Eina_List *_handlers;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_entrance_connect_add(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
_entrance_connect_add(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
PT("connected\n");
|
PT("connected\n");
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,68 +29,123 @@ static Eina_Bool
|
||||||
_entrance_connect_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_entrance_connect_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Server_Data *ev;
|
Ecore_Con_Event_Server_Data *ev;
|
||||||
Entrance_Event *eev;
|
|
||||||
ev = event;
|
ev = event;
|
||||||
|
|
||||||
eev = entrance_event_decode(ev->data, ev->size);
|
entrance_event_received(ev->data, ev->size);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_entrance_connect_read_cb(const void *data, size_t size EINA_UNUSED, void *user_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
const Entrance_Event *eev;
|
||||||
|
eev = data;
|
||||||
if (eev)
|
if (eev)
|
||||||
{
|
{
|
||||||
if (eev->type == ENTRANCE_EVENT_STATUS)
|
if (eev->type == ENTRANCE_EVENT_STATUS)
|
||||||
{
|
{
|
||||||
if (eev->event.status.granted)
|
if (eev->event.status.granted)
|
||||||
entrance_gui_auth_valid();
|
{
|
||||||
|
PT("Auth granted :)\n");
|
||||||
|
entrance_gui_auth_valid();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
entrance_gui_auth_error();
|
{
|
||||||
|
PT("Auth error :(\n");
|
||||||
|
entrance_gui_auth_error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (eev->type == ENTRANCE_EVENT_MAXTRIES)
|
else if (eev->type == ENTRANCE_EVENT_MAXTRIES)
|
||||||
entrance_gui_auth_wait();
|
{
|
||||||
|
PT("Max tries !\n");
|
||||||
|
entrance_gui_auth_max_tries();
|
||||||
|
}
|
||||||
else if (eev->type == ENTRANCE_EVENT_XSESSIONS)
|
else if (eev->type == ENTRANCE_EVENT_XSESSIONS)
|
||||||
entrance_gui_xsession_set(eev->event.xsessions.xsessions);
|
{
|
||||||
|
PT("Xsession received\n");
|
||||||
|
entrance_gui_xsessions_set(eev->event.xsessions.xsessions);
|
||||||
|
}
|
||||||
else if (eev->type == ENTRANCE_EVENT_USERS)
|
else if (eev->type == ENTRANCE_EVENT_USERS)
|
||||||
entrance_gui_users_set(eev->event.users.users);
|
{
|
||||||
|
PT("Users received\n");
|
||||||
|
entrance_gui_users_set(eev->event.users.users);
|
||||||
|
}
|
||||||
else if (eev->type == ENTRANCE_EVENT_ACTIONS)
|
else if (eev->type == ENTRANCE_EVENT_ACTIONS)
|
||||||
entrance_gui_actions_set(eev->event.actions.actions);
|
{
|
||||||
|
PT("Action received\n");
|
||||||
|
entrance_gui_actions_set(eev->event.actions.actions);
|
||||||
|
}
|
||||||
|
else if (eev->type == ENTRANCE_EVENT_CONF_GUI)
|
||||||
|
{
|
||||||
|
PT("Gui conf received\n");
|
||||||
|
entrance_gui_conf_set(&(eev->event.conf_gui));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
PT("unknow signal\n");
|
{
|
||||||
|
PT("UNKNOW signal ");
|
||||||
|
fprintf(stderr, "%d\n", eev->type);
|
||||||
|
}
|
||||||
|
//free(eev);
|
||||||
}
|
}
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_entrance_connect_write_cb(const void *data, size_t size, void *user_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
ecore_con_server_send(_entrance_connect, data, size);
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_connect_auth_send(const char *login, const char *password, const char *session)
|
entrance_connect_auth_send(const char *login, const char *password, const char *session, Eina_Bool open_session)
|
||||||
{
|
{
|
||||||
Entrance_Event eev;
|
Entrance_Event eev;
|
||||||
void *data;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
|
PT("Request auth\n");
|
||||||
eev.event.auth.login = login;
|
eev.event.auth.login = login;
|
||||||
eev.event.auth.password = password;
|
eev.event.auth.password = password;
|
||||||
eev.event.auth.session = session;
|
eev.event.auth.session = session;
|
||||||
|
eev.event.auth.open_session = open_session;
|
||||||
eev.type = ENTRANCE_EVENT_AUTH;
|
eev.type = ENTRANCE_EVENT_AUTH;
|
||||||
data = entrance_event_encode(&eev, &size);
|
entrance_event_send(&eev);
|
||||||
ecore_con_server_send(_entrance_connect, data, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_connect_action_send(int id)
|
entrance_connect_action_send(unsigned char id)
|
||||||
{
|
{
|
||||||
Entrance_Event eev;
|
Entrance_Event eev;
|
||||||
void *data;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
|
PT("Request action %d\n", id);
|
||||||
eev.event.action.action = id;
|
eev.event.action.action = id;
|
||||||
eev.type = ENTRANCE_EVENT_ACTION;
|
eev.type = ENTRANCE_EVENT_ACTION;
|
||||||
data = entrance_event_encode(&eev, &size);
|
entrance_event_send(&eev);
|
||||||
ecore_con_server_send(_entrance_connect, data, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_connect_conf_send(Entrance_Conf_Gui_Event *ev)
|
||||||
|
{
|
||||||
|
Entrance_Event eev;
|
||||||
|
PT("Send config\n");
|
||||||
|
eev.event.conf_gui.bg.path = ev->bg.path;
|
||||||
|
eev.event.conf_gui.bg.group = ev->bg.group;
|
||||||
|
|
||||||
|
eev.type = ENTRANCE_EVENT_CONF_GUI;
|
||||||
|
entrance_event_send(&eev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_connect_init()
|
entrance_connect_init()
|
||||||
{
|
{
|
||||||
Ecore_Event_Handler *h;
|
Ecore_Event_Handler *h;
|
||||||
ecore_con_init();
|
ecore_con_init();
|
||||||
|
entrance_event_init(_entrance_connect_read_cb,
|
||||||
|
_entrance_connect_write_cb,
|
||||||
|
NULL);
|
||||||
_entrance_connect = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM,
|
_entrance_connect = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM,
|
||||||
"entrance", 42, NULL);
|
"entrance", 42, NULL);
|
||||||
if (_entrance_connect)
|
if (_entrance_connect)
|
||||||
PT("client server init ok\n");
|
PT("client server init ok\n");
|
||||||
else
|
else
|
||||||
|
@ -115,6 +168,7 @@ entrance_connect_shutdown()
|
||||||
PT("client server shutdown\n");
|
PT("client server shutdown\n");
|
||||||
EINA_LIST_FREE(_handlers, h)
|
EINA_LIST_FREE(_handlers, h)
|
||||||
ecore_event_handler_del(h);
|
ecore_event_handler_del(h);
|
||||||
|
entrance_event_shutdown();
|
||||||
ecore_con_shutdown();
|
ecore_con_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef ENTRANCE_CONNECT_
|
#ifndef ENTRANCE_CONNECT_
|
||||||
#define ENTRANCE_CONNECT_
|
#define ENTRANCE_CONNECT_
|
||||||
void entrance_connect_init();
|
void entrance_connect_init();
|
||||||
void entrance_connect_auth_send(const char *login, const char *password, const char *session);
|
void entrance_connect_auth_send(const char *login, const char *password, const char *session, Eina_Bool open_session);
|
||||||
void entrance_connect_action_send(int id);
|
void entrance_connect_action_send(unsigned char id);
|
||||||
|
void entrance_connect_conf_send(Entrance_Conf_Gui_Event *conf);
|
||||||
void entrance_connect_shutdown();
|
void entrance_connect_shutdown();
|
||||||
#endif /* ENTRANCE_CONNECT_ */
|
#endif /* ENTRANCE_CONNECT_ */
|
||||||
|
|
|
@ -5,10 +5,12 @@ struct Entrance_Fill_
|
||||||
const char *item_style; //maybee need to be provided by theme ?
|
const char *item_style; //maybee need to be provided by theme ?
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
EntranceFillTextGetFunc text_get;
|
EntranceFillTextGetFunc text_get;
|
||||||
EntranceFillContentGetFunc content_get;
|
EntranceFillContentGetFunc content_get;
|
||||||
EntranceFillStateGetFunc state_get;
|
EntranceFillStateGetFunc state_get;
|
||||||
EntranceFillDelFunc del;
|
EntranceFillDelFunc del;
|
||||||
|
Evas_Smart_Cb sel;
|
||||||
|
void *data;
|
||||||
} func;
|
} func;
|
||||||
Elm_Genlist_Item_Class *glc;
|
Elm_Genlist_Item_Class *glc;
|
||||||
Elm_Gengrid_Item_Class *ggc;
|
Elm_Gengrid_Item_Class *ggc;
|
||||||
|
@ -16,23 +18,26 @@ struct Entrance_Fill_
|
||||||
|
|
||||||
///////////////// LIST ///////////////////////////////
|
///////////////// LIST ///////////////////////////////
|
||||||
static void
|
static void
|
||||||
_entrance_fill_list(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
|
_entrance_fill_list(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func, void *data)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
void *content;
|
void *content;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(contents, l, content)
|
EINA_LIST_FOREACH(contents, l, content)
|
||||||
{
|
{
|
||||||
|
Elm_Object_Item *it = NULL;
|
||||||
if (ef->func.text_get)
|
if (ef->func.text_get)
|
||||||
elm_list_item_append(obj, ef->func.text_get(content, NULL, NULL), NULL,
|
it = elm_list_item_append(obj, ef->func.text_get(content, NULL, NULL), NULL,
|
||||||
NULL, func, content);
|
NULL, func, data);
|
||||||
|
if (it)
|
||||||
|
elm_object_item_data_set(it, content);
|
||||||
}
|
}
|
||||||
elm_list_go(obj);
|
elm_list_go(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////// GENLIST /////////////////////////////
|
///////////////// GENLIST /////////////////////////////
|
||||||
static void
|
static void
|
||||||
_entrance_fill_genlist(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
|
_entrance_fill_genlist(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func, void *data)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Elm_Genlist_Item_Class *glc;
|
Elm_Genlist_Item_Class *glc;
|
||||||
|
@ -53,14 +58,18 @@ _entrance_fill_genlist(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents,
|
||||||
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(contents, l, content)
|
EINA_LIST_FOREACH(contents, l, content)
|
||||||
elm_genlist_item_append(obj, glc,
|
{
|
||||||
content, NULL, ELM_GENLIST_ITEM_NONE,
|
Elm_Object_Item *it;
|
||||||
func, content);
|
it = elm_genlist_item_append(obj, glc,
|
||||||
|
content, NULL, ELM_GENLIST_ITEM_NONE,
|
||||||
|
func, data);
|
||||||
|
elm_object_item_data_set(it, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////// GENGRID /////////////////////////////
|
///////////////// GENGRID /////////////////////////////
|
||||||
static void
|
static void
|
||||||
_entrance_fill_gengrid(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
|
_entrance_fill_gengrid(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func, void *data)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Elm_Gengrid_Item_Class *ggc;
|
Elm_Gengrid_Item_Class *ggc;
|
||||||
|
@ -80,28 +89,61 @@ _entrance_fill_gengrid(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents,
|
||||||
ggc->func.del = ef->func.del;
|
ggc->func.del = ef->func.del;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(contents, l, content)
|
EINA_LIST_FOREACH(contents, l, content)
|
||||||
elm_gengrid_item_append(obj, ggc,
|
{
|
||||||
content, func, content);
|
Elm_Object_Item *it;
|
||||||
|
it = elm_gengrid_item_append(obj, ggc,
|
||||||
|
content, func, data);
|
||||||
|
elm_object_item_data_set(it, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////// HOVERSEL /////////////////////////////
|
///////////////// HOVERSEL /////////////////////////////
|
||||||
static void
|
static void
|
||||||
_entrance_fill_hoversell(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
|
_entrance_fill_hoversell_func_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Entrance_Fill *ef;
|
||||||
|
|
||||||
|
ef = evas_object_data_get(obj, "fill_data");
|
||||||
|
if (!ef) return;
|
||||||
|
if (ef->func.sel)
|
||||||
|
ef->func.sel(ef->func.data, obj, event_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_entrance_fill_hoversell(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func, void *data)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *str = NULL;
|
|
||||||
void *content;
|
void *content;
|
||||||
|
char *str = NULL;
|
||||||
|
char *ic = NULL;
|
||||||
|
|
||||||
|
if (!ef->func.text_get) return;
|
||||||
|
ef->func.sel = func;
|
||||||
|
ef->func.data = data;
|
||||||
EINA_LIST_FOREACH(contents, l, content)
|
EINA_LIST_FOREACH(contents, l, content)
|
||||||
{
|
{
|
||||||
if (ef->func.text_get)
|
Elm_Object_Item *it;
|
||||||
str = ef->func.text_get(content, obj, NULL);
|
str = ef->func.text_get(content, obj, NULL);
|
||||||
elm_hoversel_item_add(obj, str, NULL,
|
ic = ef->func.text_get(content, obj, "icon");
|
||||||
ELM_ICON_FILE, func, content);
|
it = elm_hoversel_item_add(obj, str, ic,
|
||||||
free(str);
|
ELM_ICON_FILE,
|
||||||
|
_entrance_fill_hoversell_func_cb, NULL);
|
||||||
|
elm_object_item_data_set(it, content);
|
||||||
|
evas_object_data_set(elm_object_item_widget_get(it), "fill_data", ef);
|
||||||
|
if (ic)
|
||||||
|
{
|
||||||
|
free(ic);
|
||||||
|
ic = NULL;
|
||||||
|
}
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
free(str);
|
||||||
|
str = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////// MAIN /////////////////////////////
|
||||||
Entrance_Fill *
|
Entrance_Fill *
|
||||||
entrance_fill_new(const char *item_style, EntranceFillTextGetFunc text_get, EntranceFillContentGetFunc content_get, EntranceFillStateGetFunc state_get, EntranceFillDelFunc del_func)
|
entrance_fill_new(const char *item_style, EntranceFillTextGetFunc text_get, EntranceFillContentGetFunc content_get, EntranceFillStateGetFunc state_get, EntranceFillDelFunc del_func)
|
||||||
{
|
{
|
||||||
|
@ -123,20 +165,25 @@ entrance_fill_del(Entrance_Fill *ef)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_fill(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
|
entrance_fill(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func, void *data)
|
||||||
{
|
{
|
||||||
const char *type;
|
const char *type;
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
if ((type = elm_object_widget_type_get(obj)))
|
if ((type = elm_object_widget_type_get(obj)))
|
||||||
{
|
{
|
||||||
if (!strcmp(type, "elm_list"))
|
if (!strcmp(type, "elm_list"))
|
||||||
_entrance_fill_list(obj, ef, contents, func);
|
_entrance_fill_list(obj, ef, contents, func, data);
|
||||||
else if (!strcmp(type, "elm_genlist"))
|
else if (!strcmp(type, "elm_genlist"))
|
||||||
_entrance_fill_genlist(obj, ef, contents, func);
|
_entrance_fill_genlist(obj, ef, contents, func, data);
|
||||||
else if (!strcmp(type, "elm_gengrid"))
|
else if (!strcmp(type, "elm_gengrid"))
|
||||||
_entrance_fill_gengrid(obj, ef, contents, func);
|
_entrance_fill_gengrid(obj, ef, contents, func, data);
|
||||||
else if (!strcmp(type, "elm_hoversel"))
|
else if (!strcmp(type, "elm_hoversel"))
|
||||||
_entrance_fill_hoversell(obj, ef, contents, func);
|
_entrance_fill_hoversell(obj, ef, contents, func, data);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PT("Unknow object type to fill ");
|
||||||
|
fprintf(stderr, "%s\n", type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ typedef Eina_Bool (*EntranceFillStateGetFunc) (void *data, Evas_Object *obj, con
|
||||||
typedef void (*EntranceFillDelFunc) (void *data, Evas_Object *obj);
|
typedef void (*EntranceFillDelFunc) (void *data, Evas_Object *obj);
|
||||||
|
|
||||||
Entrance_Fill *entrance_fill_new(const char *item_style, EntranceFillTextGetFunc label_get, EntranceFillContentGetFunc content_get, EntranceFillStateGetFunc state_get, EntranceFillDelFunc del_func);
|
Entrance_Fill *entrance_fill_new(const char *item_style, EntranceFillTextGetFunc label_get, EntranceFillContentGetFunc content_get, EntranceFillStateGetFunc state_get, EntranceFillDelFunc del_func);
|
||||||
void entrance_fill(Evas_Object *obj, Entrance_Fill *egf, Eina_List *contents, Evas_Smart_Cb func);
|
void entrance_fill(Evas_Object *obj, Entrance_Fill *egf, Eina_List *contents, Evas_Smart_Cb func, void *data);
|
||||||
void entrance_fill_del(Entrance_Fill *ef);
|
void entrance_fill_del(Entrance_Fill *ef);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,33 @@
|
||||||
#ifndef ENTRANCE_GUI_H_
|
#ifndef ENTRANCE_GUI_H_
|
||||||
#define ENTRANCE_GUI_H_
|
#define ENTRANCE_GUI_H_
|
||||||
|
|
||||||
|
#define ENTRANCE_GUI_GET(edj, name) edje_object_part_external_object_get(elm_layout_edje_get(edj), name)
|
||||||
|
|
||||||
int entrance_gui_init(const char *theme);
|
int entrance_gui_init(const char *theme);
|
||||||
void entrance_gui_run();
|
void entrance_gui_shutdown(void);
|
||||||
void entrance_gui_shutdown();
|
void entrance_gui_run(void);
|
||||||
|
Evas_Object *entrance_gui_theme_get (Evas_Object *win, const char *group);
|
||||||
|
void entrance_gui_auth_valid(void);
|
||||||
|
void entrance_gui_auth_error(void);
|
||||||
|
void entrance_gui_auth_max_tries(void);
|
||||||
|
void entrance_gui_xsession_set(Eina_List *xsessions);
|
||||||
|
void entrance_gui_actions_set(Eina_List *actions);
|
||||||
|
void entrance_gui_users_set(Eina_List *users);
|
||||||
|
const Eina_List *entrance_gui_users_get(void);
|
||||||
|
void entrance_gui_xsessions_set(Eina_List *users);
|
||||||
|
const Eina_List *entrance_gui_xsessions_get(void);
|
||||||
|
void entrance_gui_conf_set(const Entrance_Conf_Gui_Event *conf);
|
||||||
|
Eina_List *entrance_gui_stringlist_get(const char *name);
|
||||||
|
void entrance_gui_stringlist_free(Eina_List *list);
|
||||||
|
const char *entrance_gui_theme_name_get(void);
|
||||||
|
void entrance_gui_background_get(const char **path, const char **group);
|
||||||
|
Eina_Bool entrance_gui_vkbd_enabled_get(void);
|
||||||
|
const char *entrance_gui_theme_path_get(void);
|
||||||
|
|
||||||
|
/*
|
||||||
char *entrance_gui_user_get();
|
char *entrance_gui_user_get();
|
||||||
char *entrance_gui_password_get();
|
char *entrance_gui_password_get();
|
||||||
void entrance_gui_auth_error();
|
|
||||||
void entrance_gui_auth_valid();
|
|
||||||
void entrance_gui_auth_wait();
|
|
||||||
char *entrance_gui_login_command_get();
|
char *entrance_gui_login_command_get();
|
||||||
void entrance_gui_xsession_set(Eina_List *xsessions);
|
*/
|
||||||
void entrance_gui_users_set(Eina_List *users);
|
|
||||||
void entrance_gui_actions_set(Eina_List *actions);
|
|
||||||
|
|
||||||
#endif /* ENTRANCE_GUI_H_ */
|
#endif /* ENTRANCE_GUI_H_ */
|
||||||
|
|
|
@ -0,0 +1,407 @@
|
||||||
|
#include "entrance_client.h"
|
||||||
|
|
||||||
|
#define ENTRANCE_PASSWD_LEN 256
|
||||||
|
|
||||||
|
typedef struct Entrance_Login_ Entrance_Login;
|
||||||
|
|
||||||
|
static void _login_reset(Evas_Object *widget);
|
||||||
|
static void _login_backspace(Evas_Object *widget);
|
||||||
|
static void _login_delete(Evas_Object *widget);
|
||||||
|
static void _login_select(Evas_Object *widget);
|
||||||
|
static void _login_update(Evas_Object *widget);
|
||||||
|
static void _login_check_auth(Evas_Object *widget);
|
||||||
|
static void _login_password_catch(Evas_Object *widget, Eina_Bool catch);
|
||||||
|
static Eina_Bool _login_key_down_cb(void *data, int type, void *event);
|
||||||
|
static void _login_xsession_update(Evas_Object *obj);
|
||||||
|
static void _login_xsession_clicked_cb(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static Eina_Bool _login_input_event_cb(void *data EINA_UNUSED, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info);
|
||||||
|
static void _login_password_focused_cb(void *data, Evas_Object *obj, void *event);
|
||||||
|
static void _login_password_unfocused_cb(void *data, Evas_Object *obj, void *event);
|
||||||
|
static void _login_login_activated_cb(void *data, Evas_Object *obj, void *event);
|
||||||
|
static char *_login_xsession_text_get(void *data, Evas_Object *obj, const char *part);
|
||||||
|
|
||||||
|
static Entrance_Fill *_login_fill;
|
||||||
|
|
||||||
|
struct Entrance_Login_
|
||||||
|
{
|
||||||
|
Ecore_Event_Handler *handler;
|
||||||
|
char passwd[ENTRANCE_PASSWD_LEN];
|
||||||
|
Entrance_Xsession *session;
|
||||||
|
Eina_Bool open_session : 1;
|
||||||
|
Eina_Bool selected : 1;
|
||||||
|
Eina_Bool catch : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LOGIN_GET(widget) \
|
||||||
|
Entrance_Login *login; \
|
||||||
|
login = evas_object_data_get(widget, "entrance"); \
|
||||||
|
if (!login) return
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_reset(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
memset(login->passwd, 0, sizeof(char) * ENTRANCE_PASSWD_LEN);
|
||||||
|
_login_update(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_backspace(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
int len, val, pos;
|
||||||
|
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
len = strlen(login->passwd);
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
pos = evas_string_char_prev_get(login->passwd, len, &val);
|
||||||
|
if ((pos < len) && (pos >= 0))
|
||||||
|
{
|
||||||
|
login->passwd[pos] = '\0';
|
||||||
|
_login_update(widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_delete(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
_login_backspace(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_select(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
Evas_Object *o;
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.password");
|
||||||
|
elm_entry_select_all(o);
|
||||||
|
login->selected = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_unselect(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.password");
|
||||||
|
elm_entry_select_none(o);
|
||||||
|
login->selected = EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_update(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
char str[ENTRANCE_PASSWD_LEN];
|
||||||
|
int len;
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
|
||||||
|
len = eina_unicode_utf8_get_len(login->passwd);
|
||||||
|
|
||||||
|
memset(str, '*', sizeof(char) * len);
|
||||||
|
str[len] = '\0';
|
||||||
|
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.password");
|
||||||
|
elm_object_text_set(o, str);
|
||||||
|
elm_entry_cursor_end_set(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_check_auth(Evas_Object *widget)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
const char *host;
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.login");
|
||||||
|
host = elm_entry_markup_to_utf8(elm_object_text_get(o));
|
||||||
|
if (login->session)
|
||||||
|
entrance_connect_auth_send(host, login->passwd,
|
||||||
|
login->session->name,
|
||||||
|
login->open_session);
|
||||||
|
else
|
||||||
|
entrance_connect_auth_send(host, login->passwd,
|
||||||
|
NULL, login->open_session);
|
||||||
|
|
||||||
|
_login_reset(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_password_catch(Evas_Object *widget, Eina_Bool catch)
|
||||||
|
{
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
if (login->catch != catch)
|
||||||
|
{
|
||||||
|
if (catch)
|
||||||
|
{
|
||||||
|
login->handler = ecore_event_handler_add(
|
||||||
|
ECORE_EVENT_KEY_DOWN, _login_key_down_cb, widget);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ecore_event_handler_del(login->handler);
|
||||||
|
login->handler = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
login->catch = catch;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_login_key_down_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
|
{
|
||||||
|
Ecore_Event_Key *ev;
|
||||||
|
LOGIN_GET(data) ECORE_CALLBACK_PASS_ON;
|
||||||
|
ev = event;
|
||||||
|
|
||||||
|
if (!strcmp(ev->key, "KP_Enter"))
|
||||||
|
{
|
||||||
|
_login_check_auth(data);
|
||||||
|
}
|
||||||
|
else if (!strcmp(ev->key, "Return"))
|
||||||
|
{
|
||||||
|
_login_check_auth(data);
|
||||||
|
}
|
||||||
|
else if (!strcmp(ev->key, "BackSpace"))
|
||||||
|
{
|
||||||
|
if (login->selected)
|
||||||
|
{
|
||||||
|
_login_reset(data);
|
||||||
|
_login_unselect(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_login_backspace(data);
|
||||||
|
}
|
||||||
|
else if (!strcmp(ev->key, "Delete"))
|
||||||
|
{
|
||||||
|
if (login->selected)
|
||||||
|
{
|
||||||
|
_login_reset(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_login_delete(data);
|
||||||
|
}
|
||||||
|
else if (!strcmp(ev->key, "Tab"))
|
||||||
|
{
|
||||||
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
||||||
|
elm_object_focus_next(data, ELM_FOCUS_PREVIOUS);
|
||||||
|
else
|
||||||
|
elm_object_focus_next(data, ELM_FOCUS_NEXT);
|
||||||
|
}
|
||||||
|
else if ((!strcmp(ev->key, "u"))
|
||||||
|
&& (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL))
|
||||||
|
{
|
||||||
|
_login_reset(data);
|
||||||
|
}
|
||||||
|
else if ((!strcmp(ev->key, "a"))
|
||||||
|
&& (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL))
|
||||||
|
{
|
||||||
|
_login_select(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ev->compose)
|
||||||
|
{
|
||||||
|
if (login->selected)
|
||||||
|
{
|
||||||
|
_login_reset(data);
|
||||||
|
_login_unselect(data);
|
||||||
|
}
|
||||||
|
if (strlen(login->passwd) <
|
||||||
|
(ENTRANCE_PASSWD_LEN - strlen(ev->compose)))
|
||||||
|
{
|
||||||
|
strcat(login->passwd, ev->compose);
|
||||||
|
_login_update(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_login_input_event_cb(void *data, Evas_Object *obj EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
LOGIN_GET(data) EINA_FALSE;
|
||||||
|
return (login->catch
|
||||||
|
&& ((type == EVAS_CALLBACK_KEY_UP)
|
||||||
|
|| (type == EVAS_CALLBACK_KEY_DOWN)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_password_focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_login_password_catch(data, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_password_unfocused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_login_password_catch(data, EINA_FALSE);
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
_login_login_activated_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
elm_object_focus_set(data, EINA_TRUE);
|
||||||
|
edje_object_signal_emit(data,
|
||||||
|
"entrance,auth,enable", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_login_xsession_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part)
|
||||||
|
{
|
||||||
|
Entrance_Xsession *xsession;
|
||||||
|
xsession = data;
|
||||||
|
if ((part) && (!strcmp(part, "icon")))
|
||||||
|
{
|
||||||
|
if (xsession->icon)
|
||||||
|
return strdup(xsession->icon);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return strdup(xsession->name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_xsession_update(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *icon;
|
||||||
|
LOGIN_GET(obj);
|
||||||
|
o = elm_object_part_content_get(obj, "entrance.xsessions");
|
||||||
|
if (!login->session) return;
|
||||||
|
icon = elm_icon_add(o);
|
||||||
|
elm_object_text_set(o, login->session->name);
|
||||||
|
elm_image_file_set(o, login->session->icon, NULL);
|
||||||
|
elm_object_content_set(o, icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_login_xsession_clicked_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
LOGIN_GET(data);
|
||||||
|
login->session = elm_object_item_data_get(event_info);
|
||||||
|
_login_xsession_update(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_init(void)
|
||||||
|
{
|
||||||
|
_login_fill = entrance_fill_new(NULL, _login_xsession_text_get,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_shutdown(void)
|
||||||
|
{
|
||||||
|
// TODO callback_del on widget
|
||||||
|
//_login_password_catch(NULL, EINA_FALSE);
|
||||||
|
//free(_login);
|
||||||
|
entrance_fill_del(_login_fill);
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
entrance_login_add(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *h, *p;
|
||||||
|
Entrance_Login *login;
|
||||||
|
|
||||||
|
/* layout */
|
||||||
|
o = entrance_gui_theme_get(obj, "entrance/login");
|
||||||
|
login = calloc(1, sizeof(Entrance_Login));
|
||||||
|
evas_object_data_set(o, "entrance", login);
|
||||||
|
|
||||||
|
|
||||||
|
/* login */
|
||||||
|
h = elm_entry_add(o);
|
||||||
|
elm_entry_single_line_set(h, EINA_TRUE);
|
||||||
|
elm_entry_scrollable_set(h, EINA_TRUE);
|
||||||
|
elm_object_part_content_set(o, "entrance.login", h);
|
||||||
|
elm_object_focus_set(h, EINA_TRUE);
|
||||||
|
evas_object_show(h);
|
||||||
|
|
||||||
|
/* password */
|
||||||
|
p = elm_entry_add(o);
|
||||||
|
elm_entry_single_line_set(p, EINA_TRUE);
|
||||||
|
elm_entry_scrollable_set(p, EINA_TRUE);
|
||||||
|
elm_object_part_content_set(o, "entrance.password", p);
|
||||||
|
evas_object_show(p);
|
||||||
|
|
||||||
|
/* callbacks */
|
||||||
|
elm_object_event_callback_add(o, _login_input_event_cb, o);
|
||||||
|
evas_object_smart_callback_add(h, "activated",
|
||||||
|
_login_login_activated_cb, p);
|
||||||
|
evas_object_smart_callback_add(p, "focused",
|
||||||
|
_login_password_focused_cb, o);
|
||||||
|
evas_object_smart_callback_add(p, "unfocused",
|
||||||
|
_login_password_unfocused_cb, o);
|
||||||
|
h = elm_hoversel_add(o);
|
||||||
|
elm_hoversel_hover_parent_set(h, obj);
|
||||||
|
evas_object_data_set(o, "entrance", login);
|
||||||
|
elm_object_part_content_set(o, "entrance.xsessions", h);
|
||||||
|
_login_xsession_update(o);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_xsessions_populate(Evas_Object *widget, Eina_List *xsessions)
|
||||||
|
{
|
||||||
|
PT("Session set\n");
|
||||||
|
Evas_Object *o;
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.xsessions");
|
||||||
|
entrance_fill(o, _login_fill, xsessions,
|
||||||
|
_login_xsession_clicked_cb, widget);
|
||||||
|
login->session = eina_list_data_get(xsessions);
|
||||||
|
_login_xsession_update(widget);
|
||||||
|
edje_object_signal_emit(widget,
|
||||||
|
"entrance,xsession,enabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_login_set(Evas_Object *widget, const char *user)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.login");
|
||||||
|
elm_object_text_set(o, user);
|
||||||
|
elm_object_signal_emit(widget,
|
||||||
|
"entrance,auth,enable", "");
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.password");
|
||||||
|
elm_object_focus_set(o, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_session_set(Evas_Object *widget, const char *name)
|
||||||
|
{
|
||||||
|
Entrance_Xsession *sess;
|
||||||
|
Evas_Object *o;
|
||||||
|
const Eina_List *l = NULL;
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(entrance_gui_xsessions_get(), l, sess)
|
||||||
|
{
|
||||||
|
if ((sess->name) &&
|
||||||
|
(!strcmp(sess->name, name)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (l)
|
||||||
|
login->session = sess;
|
||||||
|
o = elm_object_part_content_get(widget, "entrance.xsessions");
|
||||||
|
_login_xsession_update(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_login_open_session_set(Evas_Object *widget, Eina_Bool open_session)
|
||||||
|
{
|
||||||
|
LOGIN_GET(widget);
|
||||||
|
open_session = !!open_session;
|
||||||
|
if (login->open_session != open_session)
|
||||||
|
login->open_session = open_session;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef ENTRANCE_LOGIN_H
|
||||||
|
#define ENTRANCE_LOGIN_H
|
||||||
|
|
||||||
|
typedef void (*Entrance_Login_Cb) (void *data, Eina_Bool granted);
|
||||||
|
|
||||||
|
void entrance_login_init(void);
|
||||||
|
void entrance_login_shutdown(void);
|
||||||
|
Evas_Object *entrance_login_add(Evas_Object *win);
|
||||||
|
void entrance_login_xsessions_populate(Evas_Object *widget, Eina_List *xsessions);
|
||||||
|
void entrance_login_login_set(Evas_Object *widget, const char *user);
|
||||||
|
void entrance_login_session_set(Evas_Object *widget, const char *user);
|
||||||
|
void entrance_login_open_session_set(Evas_Object *obj, Eina_Bool open_session);
|
||||||
|
void entrance_login_callback_set(Entrance_Login_Cb greater_cb, void *data);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include "entrance_client.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_vkbd_init(void)
|
||||||
|
{
|
||||||
|
ekbd_init();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_vkbd_shutdown(void)
|
||||||
|
{
|
||||||
|
ekbd_shutdown();
|
||||||
|
|
||||||
|
}
|
|
@ -6,12 +6,13 @@
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
#define ENTRANCE_DISPLAY ":0.0"
|
#define ENTRANCE_DISPLAY ":0.0"
|
||||||
|
#define ENTRANCE_XEPHYR ":1.0"
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
struct tm *local_time;
|
struct tm *local_time;
|
||||||
char entrance_time_d[4096];
|
char entrance_time_d[4096];
|
||||||
|
|
||||||
static Eina_Bool _open_log();
|
static Eina_Bool _open_log();
|
||||||
static int _entrance_main(const char *dname);
|
static Eina_Bool _entrance_main(const char *dname);
|
||||||
static void _remove_lock();
|
static void _remove_lock();
|
||||||
static void _signal_cb(int sig);
|
static void _signal_cb(int sig);
|
||||||
static void _signal_log(int sig);
|
static void _signal_log(int sig);
|
||||||
|
@ -26,16 +27,12 @@ static Ecore_Exe *_entrance_client = NULL;
|
||||||
static void
|
static void
|
||||||
_signal_cb(int sig)
|
_signal_cb(int sig)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
PT("signal %d received\n", sig);
|
||||||
snprintf(buf, sizeof(buf), "signal %d received\n", sig);
|
|
||||||
PT(buf);
|
|
||||||
//FIXME if I don't have main loop at this time ?
|
//FIXME if I don't have main loop at this time ?
|
||||||
if (_entrance_client) ecore_exe_terminate(_entrance_client);
|
if (_entrance_client)
|
||||||
/*
|
ecore_exe_terminate(_entrance_client);
|
||||||
entrance_session_shutdown();
|
else
|
||||||
entrance_xserver_shutdown();
|
ecore_main_loop_quit();
|
||||||
exit(1);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,9 +142,10 @@ _entrance_wait()
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static Eina_Bool
|
||||||
_entrance_main(const char *dname)
|
_entrance_main(const char *dname)
|
||||||
{
|
{
|
||||||
|
PT("starting...\n");
|
||||||
if (!entrance_config->autologin)
|
if (!entrance_config->autologin)
|
||||||
{
|
{
|
||||||
if (!_entrance_client)
|
if (!_entrance_client)
|
||||||
|
@ -155,16 +153,18 @@ _entrance_main(const char *dname)
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||||
_entrance_client_del, NULL);
|
_entrance_client_del, NULL);
|
||||||
PT("Exec entrance_client\n");
|
PT("Exec entrance_client: ");
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
|
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
|
||||||
dname, entrance_config->theme);
|
dname, entrance_config->theme);
|
||||||
|
printf("%s\n", buf);
|
||||||
|
|
||||||
_entrance_client = ecore_exe_run(buf, NULL);
|
_entrance_client = ecore_exe_run(buf, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ecore_main_loop_quit();
|
ecore_main_loop_quit();
|
||||||
return 0;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -175,9 +175,9 @@ _entrance_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
ev = event;
|
ev = event;
|
||||||
if (ev->exe != _entrance_client)
|
if (ev->exe != _entrance_client)
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
PT("client have terminated\n");
|
||||||
ecore_main_loop_quit();
|
ecore_main_loop_quit();
|
||||||
_entrance_client = NULL;
|
_entrance_client = NULL;
|
||||||
PT("client have terminated\n");
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_DONE;
|
return ECORE_CALLBACK_DONE;
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,8 @@ int
|
||||||
main (int argc, char ** argv)
|
main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int args;
|
int args;
|
||||||
int pid;
|
int pid = -1;
|
||||||
char *dname = strdup(ENTRANCE_DISPLAY);
|
char *dname;
|
||||||
char *entrance_user = NULL;
|
char *entrance_user = NULL;
|
||||||
unsigned char nodaemon = 0;
|
unsigned char nodaemon = 0;
|
||||||
unsigned char quit_option = 0;
|
unsigned char quit_option = 0;
|
||||||
|
@ -238,15 +238,36 @@ main (int argc, char ** argv)
|
||||||
|
|
||||||
if (getuid() != 0)
|
if (getuid() != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Only root can run this program\n");
|
fprintf(stderr, "Sorry, only root can run this program!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (!_xephyr && getenv("ENTRANCE_XEPHYR"))
|
||||||
|
_xephyr = EINA_TRUE;
|
||||||
|
|
||||||
|
if (_xephyr)
|
||||||
|
{
|
||||||
|
_testing = EINA_TRUE;
|
||||||
|
dname = strdup(ENTRANCE_XEPHYR);
|
||||||
|
putenv(strdup("ENTRANCE_XEPHYR=1"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dname = strdup(ENTRANCE_DISPLAY);
|
||||||
|
if (!_testing && getenv("ENTRANCE_TESTING"))
|
||||||
|
_testing = EINA_TRUE;
|
||||||
|
|
||||||
if (_testing)
|
if (_testing)
|
||||||
nodaemon = EINA_TRUE;
|
{
|
||||||
|
putenv(strdup("ENTRANCE_TESTING=1"));
|
||||||
|
nodaemon = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
eet_init();
|
eet_init();
|
||||||
entrance_config_init();
|
entrance_config_init();
|
||||||
|
if (!entrance_config)
|
||||||
|
{
|
||||||
|
PT("No config loaded, sorry must quit ...");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if (!_testing && !_get_lock())
|
if (!_testing && !_get_lock())
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -273,7 +294,7 @@ main (int argc, char ** argv)
|
||||||
entrance_config_shutdown();
|
entrance_config_shutdown();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!_open_log())
|
if (!_testing && !_open_log())
|
||||||
{
|
{
|
||||||
PT("Can't open log file !!!!\n");
|
PT("Can't open log file !!!!\n");
|
||||||
entrance_config_shutdown();
|
entrance_config_shutdown();
|
||||||
|
@ -297,7 +318,7 @@ main (int argc, char ** argv)
|
||||||
unsetenv("ENTRANCE_QUIT");
|
unsetenv("ENTRANCE_QUIT");
|
||||||
_remove_lock();
|
_remove_lock();
|
||||||
entrance_config_shutdown();
|
entrance_config_shutdown();
|
||||||
PT("Good bye\n");
|
PT("Bye, see you.\n\n");
|
||||||
entrance_close_log();
|
entrance_close_log();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -320,9 +341,14 @@ main (int argc, char ** argv)
|
||||||
signal(SIGUSR2, _signal_log);
|
signal(SIGUSR2, _signal_log);
|
||||||
|
|
||||||
PT("session init\n");
|
PT("session init\n");
|
||||||
entrance_session_init(entrance_config->command.xauth_file);
|
entrance_session_init(dname);
|
||||||
PT("xserver init\n");
|
if (!_xephyr)
|
||||||
pid = entrance_xserver_init(_entrance_main, dname);
|
{
|
||||||
|
PT("xserver init\n");
|
||||||
|
pid = entrance_xserver_init(_entrance_main, dname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_entrance_main(dname);
|
||||||
PT("history init\n");
|
PT("history init\n");
|
||||||
entrance_history_init();
|
entrance_history_init();
|
||||||
if (entrance_config->autologin && !entrance_user)
|
if (entrance_config->autologin && !entrance_user)
|
||||||
|
@ -357,40 +383,46 @@ main (int argc, char ** argv)
|
||||||
}
|
}
|
||||||
entrance_history_shutdown();
|
entrance_history_shutdown();
|
||||||
PT("history shutdown\n");
|
PT("history shutdown\n");
|
||||||
entrance_xserver_shutdown();
|
if (_xephyr)
|
||||||
PT("xserver shutdown\n");
|
{
|
||||||
|
//ecore_exe_terminate(xephyr);
|
||||||
|
PT("Xephyr shutdown\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entrance_xserver_shutdown();
|
||||||
|
PT("xserver shutdown\n");
|
||||||
|
}
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
entrance_pam_shutdown();
|
entrance_pam_shutdown();
|
||||||
PT("pam shutdown\n");
|
PT("pam shutdown\n");
|
||||||
#endif
|
#endif
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
ecore_shutdown();
|
|
||||||
PT("ecore shutdown\n");
|
PT("ecore shutdown\n");
|
||||||
|
ecore_shutdown();
|
||||||
|
PT("session shutdown\n");
|
||||||
|
entrance_session_shutdown();
|
||||||
|
free(dname);
|
||||||
if (entrance_session_logged_get())
|
if (entrance_session_logged_get())
|
||||||
{
|
{
|
||||||
entrance_config_shutdown();
|
PT("user logged, waiting...\n");
|
||||||
PT("config shutdown\n");
|
|
||||||
entrance_session_shutdown();
|
|
||||||
PT("session shutdown\n");
|
|
||||||
eet_shutdown();
|
|
||||||
PT("eet shutdown\n");
|
|
||||||
free(dname);
|
|
||||||
PT("Bye user logged, see you.\n");
|
|
||||||
entrance_close_log();
|
|
||||||
_entrance_wait();
|
_entrance_wait();
|
||||||
|
/* no more running here */
|
||||||
}
|
}
|
||||||
_remove_lock();
|
_remove_lock();
|
||||||
entrance_config_shutdown();
|
|
||||||
PT("config shutdown\n");
|
PT("config shutdown\n");
|
||||||
entrance_session_shutdown();
|
entrance_config_shutdown();
|
||||||
PT("session shutdown\n");
|
|
||||||
eet_shutdown();
|
|
||||||
PT("eet shutdown\n");
|
PT("eet shutdown\n");
|
||||||
|
eet_shutdown();
|
||||||
free(dname);
|
free(dname);
|
||||||
PT("ending xserver\n");
|
if (!_xephyr)
|
||||||
kill(pid, SIGTERM);
|
{
|
||||||
entrance_xserver_end();
|
PT("ending xserver\n");
|
||||||
PT("Bye, see you.\n\n");
|
kill(pid, SIGTERM);
|
||||||
|
entrance_xserver_end();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PT("No session to wait, exiting\n");
|
||||||
entrance_close_log();
|
entrance_close_log();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,22 +17,22 @@
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
#include "entrance_pam.h"
|
#include "entrance_pam.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "../event/entrance_event.h"
|
||||||
#include "entrance_config.h"
|
#include "entrance_config.h"
|
||||||
#include "entrance_xserver.h"
|
#include "entrance_xserver.h"
|
||||||
#include "entrance_server.h"
|
#include "entrance_server.h"
|
||||||
#include "entrance_history.h"
|
#include "entrance_history.h"
|
||||||
#include "entrance_action.h"
|
#include "entrance_action.h"
|
||||||
#include "../event/entrance_event.h"
|
|
||||||
|
|
||||||
#define PT(x) \
|
#define PT(f, x...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
current_time = time(NULL); \
|
current_time = time(NULL); \
|
||||||
local_time = localtime(¤t_time); \
|
local_time = localtime(¤t_time); \
|
||||||
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
||||||
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
||||||
"%b %_2d %T", local_time); \
|
"%b %_2d %T", local_time); \
|
||||||
fprintf(stderr, "(%s) "PACKAGE": %s", entrance_time_d, x); \
|
fprintf(stderr, "(%s) "PACKAGE": "f, entrance_time_d, ##x); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
extern time_t current_time;
|
extern time_t current_time;
|
||||||
|
|
|
@ -16,14 +16,13 @@ static Eina_List *_entrance_actions = NULL;
|
||||||
|
|
||||||
typedef struct Entrance_Action_Data__
|
typedef struct Entrance_Action_Data__
|
||||||
{
|
{
|
||||||
int id;
|
unsigned char id;
|
||||||
const char *label;
|
const char *label;
|
||||||
Entrance_Action_Cb func;
|
Entrance_Action_Cb func;
|
||||||
void *data;
|
void *data;
|
||||||
} Entrance_Action_Data;
|
} Entrance_Action_Data;
|
||||||
|
|
||||||
static Ecore_Exe *_action_exe = NULL;
|
static Ecore_Exe *_action_exe = NULL;
|
||||||
static Ecore_Event_Handler *_handle = NULL;
|
|
||||||
|
|
||||||
static Entrance_Action_Data *
|
static Entrance_Action_Data *
|
||||||
_entrance_action_add(const char *label, Entrance_Action_Cb func, void *data)
|
_entrance_action_add(const char *label, Entrance_Action_Cb func, void *data)
|
||||||
|
@ -33,9 +32,9 @@ _entrance_action_add(const char *label, Entrance_Action_Cb func, void *data)
|
||||||
ead->label = eina_stringshare_add(label);
|
ead->label = eina_stringshare_add(label);
|
||||||
ead->func = func;
|
ead->func = func;
|
||||||
ead->data = data;
|
ead->data = data;
|
||||||
ead->id = _entrance_actions ? (eina_list_count(_entrance_actions)) : 0;
|
ead->id = (unsigned char)eina_list_count(_entrance_actions);
|
||||||
_handle = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||||
_entrance_action_exe_event_del_cb, NULL);
|
_entrance_action_exe_event_del_cb, NULL);
|
||||||
return ead;
|
return ead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +95,7 @@ entrance_action_run(int action)
|
||||||
static void
|
static void
|
||||||
_entrance_action_suspend(void *data __UNUSED__)
|
_entrance_action_suspend(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
|
PT("Suspend");
|
||||||
_action_exe = NULL;
|
_action_exe = NULL;
|
||||||
ecore_exe_run(entrance_config->command.suspend, NULL);
|
ecore_exe_run(entrance_config->command.suspend, NULL);
|
||||||
}
|
}
|
||||||
|
@ -103,12 +103,14 @@ _entrance_action_suspend(void *data __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_entrance_action_shutdown(void *data __UNUSED__)
|
_entrance_action_shutdown(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
|
PT("Shutdown");
|
||||||
_action_exe = ecore_exe_run(entrance_config->command.shutdown, NULL);
|
_action_exe = ecore_exe_run(entrance_config->command.shutdown, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_entrance_action_reboot(void *data __UNUSED__)
|
_entrance_action_reboot(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
|
PT("Reboot\n");
|
||||||
_action_exe = ecore_exe_run(entrance_config->command.reboot, NULL);
|
_action_exe = ecore_exe_run(entrance_config->command.reboot, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,8 +120,10 @@ _entrance_action_exe_event_del_cb(void *data __UNUSED__, int type __UNUSED__, vo
|
||||||
Ecore_Exe_Event_Del *ev;
|
Ecore_Exe_Event_Del *ev;
|
||||||
Eina_Bool ret = ECORE_CALLBACK_PASS_ON;
|
Eina_Bool ret = ECORE_CALLBACK_PASS_ON;
|
||||||
ev = event;
|
ev = event;
|
||||||
|
if (!ev->exe) return ret;
|
||||||
if (ev->exe == _action_exe)
|
if (ev->exe == _action_exe)
|
||||||
{
|
{
|
||||||
|
PT("action quit requested by user\n");
|
||||||
ecore_main_loop_quit();
|
ecore_main_loop_quit();
|
||||||
ret = ECORE_CALLBACK_DONE;
|
ret = ECORE_CALLBACK_DONE;
|
||||||
}
|
}
|
||||||
|
@ -131,12 +135,12 @@ _entrance_action_exe_event_del_cb(void *data __UNUSED__, int type __UNUSED__, vo
|
||||||
static void
|
static void
|
||||||
_entrance_action_grub2(void *data)
|
_entrance_action_grub2(void *data)
|
||||||
{
|
{
|
||||||
intptr_t i = 0;
|
size_t i = 0;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
i = (intptr_t)data;
|
i = (size_t)data;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"grub-reboot %ld && %s", i, entrance_config->command.reboot);
|
"grub-reboot %d && %s", i, entrance_config->command.reboot);
|
||||||
_action_exe = ecore_exe_run(buf, NULL);
|
_action_exe = ecore_exe_run(buf, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -166,7 +170,7 @@ _entrance_action_grub2_get(void)
|
||||||
{
|
{
|
||||||
Eina_File *f;
|
Eina_File *f;
|
||||||
unsigned char grub2_ok = 0;
|
unsigned char grub2_ok = 0;
|
||||||
intptr_t menuentry = 0;
|
size_t menuentry = 0;
|
||||||
char *data;
|
char *data;
|
||||||
char *r, *r2;
|
char *r, *r2;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -238,11 +242,8 @@ _entrance_action_grub2_get(void)
|
||||||
action = malloc((tmp - r2 + 1 + 11) * sizeof (char));
|
action = malloc((tmp - r2 + 1 + 11) * sizeof (char));
|
||||||
if (!action) goto end_line;
|
if (!action) goto end_line;
|
||||||
|
|
||||||
buf = alloca((tmp - r2 + 1 + 11 + 10) * sizeof (char));
|
|
||||||
|
|
||||||
sprintf(action, "Reboot on %s", local);
|
sprintf(action, "Reboot on %s", local);
|
||||||
sprintf(buf, "GRUB2 '%s'\n", action);
|
PT("GRUB2 '%s'\n", action);
|
||||||
PT(buf);
|
|
||||||
_entrance_actions =
|
_entrance_actions =
|
||||||
eina_list_append(_entrance_actions,
|
eina_list_append(_entrance_actions,
|
||||||
_entrance_action_add(action,
|
_entrance_action_add(action,
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
static void _defaults_set(Entrance_Config *config);
|
static void _defaults_set(Entrance_Config *config);
|
||||||
static void _users_get();
|
static void _users_get();
|
||||||
static void _config_free(Entrance_Config *config);
|
static void _config_free(Entrance_Config *config);
|
||||||
static Entrance_Config *_cache_get(Eet_Data_Descriptor *edd);
|
static Entrance_Config *_cache_get();
|
||||||
|
|
||||||
|
static Eet_Data_Descriptor *_entrance_config_descriptor;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_defaults_set(Entrance_Config *config)
|
_defaults_set(Entrance_Config *config)
|
||||||
|
@ -26,6 +28,7 @@ _defaults_set(Entrance_Config *config)
|
||||||
config->numlock = EINA_FALSE;
|
config->numlock = EINA_FALSE;
|
||||||
config->xsessions = EINA_FALSE;
|
config->xsessions = EINA_FALSE;
|
||||||
config->autologin = EINA_FALSE;
|
config->autologin = EINA_FALSE;
|
||||||
|
config->custom_conf = EINA_FALSE;
|
||||||
config->userlogin = eina_stringshare_add("mylogintouse");
|
config->userlogin = eina_stringshare_add("mylogintouse");
|
||||||
config->lockfile = eina_stringshare_add("/var/run/entrance.pid");
|
config->lockfile = eina_stringshare_add("/var/run/entrance.pid");
|
||||||
config->logfile = eina_stringshare_add("/var/log/entrance.log");
|
config->logfile = eina_stringshare_add("/var/log/entrance.log");
|
||||||
|
@ -83,21 +86,25 @@ _users_get()
|
||||||
}
|
}
|
||||||
|
|
||||||
static Entrance_Config *
|
static Entrance_Config *
|
||||||
_cache_get(Eet_Data_Descriptor *edd)
|
_cache_get()
|
||||||
{
|
{
|
||||||
Entrance_Config *config = NULL;
|
Entrance_Config *config = NULL;
|
||||||
Eet_File *file;
|
Eet_File *file;
|
||||||
|
|
||||||
if (!ecore_file_is_dir("/var/cache/"PACKAGE))
|
|
||||||
ecore_file_mkdir("/var/cache/"PACKAGE);
|
|
||||||
file = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE,
|
file = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE,
|
||||||
EET_FILE_MODE_READ);
|
EET_FILE_MODE_READ);
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
PT("Error!!! On read /var/cache"PACKAGE"/"ENTRANCE_CONFIG_FILE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
config = eet_data_read(file, edd, ENTRANCE_CONFIG_KEY);
|
config = eet_data_read(file, _entrance_config_descriptor,
|
||||||
|
ENTRANCE_CONFIG_KEY);
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
fprintf(stderr, PACKAGE": Warning no configuration found! This must \
|
PT(": Warning no configuration found! This must "
|
||||||
not append, we will go back to default configuration\n");
|
"not append, we will go back to default configuration\n");
|
||||||
config = (Entrance_Config *) calloc(1, sizeof(Entrance_Config));
|
config = (Entrance_Config *) calloc(1, sizeof(Entrance_Config));
|
||||||
_defaults_set(config);
|
_defaults_set(config);
|
||||||
}
|
}
|
||||||
|
@ -110,6 +117,7 @@ _cache_get(Eet_Data_Descriptor *edd)
|
||||||
static void
|
static void
|
||||||
_config_free(Entrance_Config *config)
|
_config_free(Entrance_Config *config)
|
||||||
{
|
{
|
||||||
|
PT("Config free\n");
|
||||||
eina_stringshare_del(config->session_path);
|
eina_stringshare_del(config->session_path);
|
||||||
eina_stringshare_del(config->command.xinit_path);
|
eina_stringshare_del(config->command.xinit_path);
|
||||||
eina_stringshare_del(config->command.xinit_args);
|
eina_stringshare_del(config->command.xinit_args);
|
||||||
|
@ -158,6 +166,12 @@ entrance_config_init()
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "lockfile", lockfile, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "lockfile", lockfile, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "logfile", logfile, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "logfile", logfile, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "theme", theme, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "theme", theme, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "background_path", bg.path, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "background_group", bg.group, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "elementary_profile", elm_profile, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "virtual_keyboard", vkbd_enabled, EET_T_UCHAR);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "custom_conf", custom_conf, EET_T_UCHAR);
|
||||||
|
_entrance_config_descriptor = edd;
|
||||||
|
|
||||||
if (stat( "/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE, &cache) == -1)
|
if (stat( "/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE, &cache) == -1)
|
||||||
{
|
{
|
||||||
|
@ -171,8 +185,7 @@ entrance_config_init()
|
||||||
_users_get();
|
_users_get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entrance_config = _cache_get(edd);
|
entrance_config = _cache_get();
|
||||||
eet_data_descriptor_free(edd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,5 +193,56 @@ void
|
||||||
entrance_config_shutdown()
|
entrance_config_shutdown()
|
||||||
{
|
{
|
||||||
_config_free(entrance_config);
|
_config_free(entrance_config);
|
||||||
|
eet_data_descriptor_free(_entrance_config_descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_config_set(const Entrance_Conf_Gui_Event *conf)
|
||||||
|
{
|
||||||
|
Eet_File *file;
|
||||||
|
Eina_Bool update = EINA_FALSE;
|
||||||
|
if (conf->bg.path && conf->bg.path != entrance_config->bg.path)
|
||||||
|
{
|
||||||
|
if (entrance_config->bg.path)
|
||||||
|
eina_stringshare_replace(&entrance_config->bg.path, conf->bg.path);
|
||||||
|
else
|
||||||
|
entrance_config->bg.path = eina_stringshare_add(conf->bg.path);
|
||||||
|
update = EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (conf->bg.group && conf->bg.group != entrance_config->bg.group)
|
||||||
|
{
|
||||||
|
if (entrance_config->bg.group)
|
||||||
|
eina_stringshare_replace(&entrance_config->bg.group, conf->bg.group);
|
||||||
|
else
|
||||||
|
entrance_config->bg.group = eina_stringshare_add(conf->bg.group);
|
||||||
|
if (!update)
|
||||||
|
update = EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (conf->vkbd_enabled != entrance_config->vkbd_enabled)
|
||||||
|
{
|
||||||
|
entrance_config->vkbd_enabled = conf->vkbd_enabled;
|
||||||
|
if (!update)
|
||||||
|
update = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
PT("Config save\n");
|
||||||
|
if (!ecore_file_is_dir("/var/cache/"PACKAGE))
|
||||||
|
ecore_file_mkdir("/var/cache/"PACKAGE);
|
||||||
|
file = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE,
|
||||||
|
EET_FILE_MODE_READ_WRITE);
|
||||||
|
if (!file)
|
||||||
|
file = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE,
|
||||||
|
EET_FILE_MODE_WRITE);
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
PT("Warning can't open /var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
eet_data_write(file, _entrance_config_descriptor, ENTRANCE_CONFIG_KEY,
|
||||||
|
entrance_config, 1);
|
||||||
|
eet_close(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,18 +21,27 @@ struct _Entrance_Config
|
||||||
const char *reboot;
|
const char *reboot;
|
||||||
const char *suspend;
|
const char *suspend;
|
||||||
} command;
|
} command;
|
||||||
Eina_Bool daemonize;// :1;
|
|
||||||
Eina_Bool numlock;// :1;
|
|
||||||
Eina_Bool xsessions;
|
|
||||||
Eina_Bool autologin;
|
|
||||||
const char *userlogin;
|
const char *userlogin;
|
||||||
const char *lockfile;
|
const char *lockfile;
|
||||||
const char *logfile;
|
const char *logfile;
|
||||||
const char *theme;
|
const char *theme;
|
||||||
|
const char *elm_profile;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} bg;
|
||||||
|
Eina_Bool daemonize;
|
||||||
|
Eina_Bool numlock;
|
||||||
|
Eina_Bool xsessions;
|
||||||
|
Eina_Bool autologin;
|
||||||
|
Eina_Bool custom_conf;
|
||||||
|
Eina_Bool vkbd_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
void entrance_config_init();
|
void entrance_config_init();
|
||||||
void entrance_config_shutdown();
|
void entrance_config_shutdown();
|
||||||
|
void entrance_config_set(const Entrance_Conf_Gui_Event *conf);
|
||||||
|
|
||||||
Entrance_Config *entrance_config;
|
Entrance_Config *entrance_config;
|
||||||
|
|
||||||
|
|
|
@ -19,23 +19,32 @@ void
|
||||||
entrance_history_init()
|
entrance_history_init()
|
||||||
{
|
{
|
||||||
Eet_Data_Descriptor *edd;
|
Eet_Data_Descriptor *edd;
|
||||||
Eet_Data_Descriptor_Class eddc, eddcl;
|
Eet_Data_Descriptor_Class eddc;
|
||||||
// TODO add idler to load history and thread stuff
|
// TODO add idler to load history and thread stuff
|
||||||
|
// TODO screenshot a new session after 3 min
|
||||||
|
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Login);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Login);
|
||||||
edd = eet_data_descriptor_stream_new(&eddc);
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Login, "login", login, EET_T_STRING);
|
#define EET_LOGIN_ADD(NAME, TYPE) \
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Login, "session", session, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Login, # NAME, NAME, TYPE);
|
||||||
|
EET_LOGIN_ADD(login, EET_T_STRING);
|
||||||
|
EET_LOGIN_ADD(session, EET_T_STRING);
|
||||||
|
EET_LOGIN_ADD(icon.path, EET_T_STRING);
|
||||||
|
EET_LOGIN_ADD(icon.group, EET_T_STRING);
|
||||||
|
EET_LOGIN_ADD(background.path, EET_T_STRING);
|
||||||
|
EET_LOGIN_ADD(background.group, EET_T_STRING);
|
||||||
|
#undef EET_LOGIN_ADD
|
||||||
|
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_History);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_History);
|
||||||
_eddh = eet_data_descriptor_stream_new(&eddcl);
|
_eddh = eet_data_descriptor_stream_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_eddh, Entrance_History, "history", history, edd);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_eddh, Entrance_History, "history", history, edd);
|
||||||
|
|
||||||
_entrance_history_read();
|
_entrance_history_read();
|
||||||
_entrance_user_init();
|
_entrance_user_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *entrance_history_get()
|
Eina_List
|
||||||
|
*entrance_history_get()
|
||||||
{
|
{
|
||||||
return _lusers;
|
return _lusers;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +87,8 @@ _entrance_history_write()
|
||||||
ef = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_HISTORY_FILE,
|
ef = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_HISTORY_FILE,
|
||||||
EET_FILE_MODE_WRITE);
|
EET_FILE_MODE_WRITE);
|
||||||
|
|
||||||
if (!eet_data_write(ef, _eddh, ENTRANCE_SESSION_KEY, _entrance_history, 1))
|
if (!eet_data_write(ef, _eddh, ENTRANCE_SESSION_KEY,
|
||||||
|
_entrance_history, 1))
|
||||||
PT("Error on updating last session login\n");
|
PT("Error on updating last session login\n");
|
||||||
|
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
|
@ -100,7 +110,12 @@ entrance_history_push(const char *login, const char *session)
|
||||||
{
|
{
|
||||||
if (!strcmp(login, el->login))
|
if (!strcmp(login, el->login))
|
||||||
{
|
{
|
||||||
if (el->session && strcmp(session, el->session))
|
if (!session)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(el->session);
|
||||||
|
el->session = NULL;
|
||||||
|
}
|
||||||
|
else if (el->session && strcmp(session, el->session))
|
||||||
{
|
{
|
||||||
eina_stringshare_replace(&el->session, session);
|
eina_stringshare_replace(&el->session, session);
|
||||||
_history_update = EINA_TRUE;
|
_history_update = EINA_TRUE;
|
||||||
|
@ -110,7 +125,7 @@ entrance_history_push(const char *login, const char *session)
|
||||||
}
|
}
|
||||||
if (!el)
|
if (!el)
|
||||||
{
|
{
|
||||||
if ((el = (Entrance_Login *) malloc(sizeof(Entrance_Login))))
|
if (el = calloc(1, sizeof(Entrance_Login)))
|
||||||
{
|
{
|
||||||
el->login = eina_stringshare_add(login);
|
el->login = eina_stringshare_add(login);
|
||||||
el->session = eina_stringshare_add(session);
|
el->session = eina_stringshare_add(session);
|
||||||
|
@ -141,12 +156,13 @@ _entrance_user_init()
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
Entrance_User *eu;
|
Entrance_User_Event *eu;
|
||||||
Eina_List *lu = NULL;
|
Eina_List *lu = NULL;
|
||||||
char *token;
|
char *token;
|
||||||
char *user;
|
char *user;
|
||||||
int uid;
|
int uid;
|
||||||
|
|
||||||
|
PT("scan for users\n");
|
||||||
f = fopen("/etc/passwd", "r");
|
f = fopen("/etc/passwd", "r");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
|
@ -156,22 +172,20 @@ _entrance_user_init()
|
||||||
strtok(NULL, ":");
|
strtok(NULL, ":");
|
||||||
token = strtok(NULL, ":");
|
token = strtok(NULL, ":");
|
||||||
uid = atoi(token);
|
uid = atoi(token);
|
||||||
if (uid > 500 && uid < 3000)
|
if (uid > 999 && uid < 3000)
|
||||||
lu = eina_list_append(lu, eina_stringshare_add(user));
|
lu = eina_list_append(lu, eina_stringshare_add(user));
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
EINA_LIST_FREE(lu, user)
|
EINA_LIST_FREE(lu, user)
|
||||||
{
|
{
|
||||||
if ((eu = (Entrance_User *) malloc(sizeof(Entrance_User))))
|
if ((eu = (Entrance_User_Event *) calloc(1, sizeof(Entrance_User_Event))))
|
||||||
{
|
{
|
||||||
eu->login = eina_stringshare_add(user);
|
eu->login = eina_stringshare_add(user);
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"/var/cache/"PACKAGE"/users/%s.edj", user);
|
"/var/cache/"PACKAGE"/users/%s.edj", user);
|
||||||
if (ecore_file_exists(buf))
|
if (ecore_file_exists(buf))
|
||||||
eu->image = eina_stringshare_add(buf);
|
eu->image.path = eina_stringshare_add(buf);
|
||||||
else
|
|
||||||
eu->image = NULL;
|
|
||||||
eu->lsess = _entrance_history_match(user);
|
eu->lsess = _entrance_history_match(user);
|
||||||
eina_stringshare_del(user);
|
eina_stringshare_del(user);
|
||||||
_lusers = eina_list_append(_lusers, eu);
|
_lusers = eina_list_append(_lusers, eu);
|
||||||
|
@ -182,7 +196,7 @@ _entrance_user_init()
|
||||||
static void
|
static void
|
||||||
_entrance_user_shutdown()
|
_entrance_user_shutdown()
|
||||||
{
|
{
|
||||||
Entrance_User *eu;
|
Entrance_User_Event *eu;
|
||||||
EINA_LIST_FREE(_lusers, eu)
|
EINA_LIST_FREE(_lusers, eu)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(eu->login);
|
eina_stringshare_del(eu->login);
|
||||||
|
|
|
@ -8,15 +8,31 @@ Eina_List *entrance_history_get();
|
||||||
|
|
||||||
typedef struct _Entrance_Login Entrance_Login;
|
typedef struct _Entrance_Login Entrance_Login;
|
||||||
typedef struct _Entrance_History Entrance_History;
|
typedef struct _Entrance_History Entrance_History;
|
||||||
|
typedef struct _Entrance_Background Entrance_Background;
|
||||||
|
|
||||||
|
struct _Entrance_Background
|
||||||
|
{
|
||||||
|
const char *group;
|
||||||
|
const char *path;
|
||||||
|
};
|
||||||
|
|
||||||
struct _Entrance_Login
|
struct _Entrance_Login
|
||||||
{
|
{
|
||||||
const char *login;
|
const char *login;
|
||||||
const char *session;
|
const char *session;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} icon;
|
||||||
|
Entrance_Background background;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Entrance_History
|
struct _Entrance_History
|
||||||
{
|
{
|
||||||
|
const char *theme;
|
||||||
|
Eina_Bool vkbdscreen;
|
||||||
|
Entrance_Background background;
|
||||||
Eina_List *history;
|
Eina_List *history;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -239,15 +239,12 @@ pam_error:
|
||||||
int
|
int
|
||||||
entrance_pam_item_set(ENTRANCE_PAM_ITEM_TYPE type, const void *value)
|
entrance_pam_item_set(ENTRANCE_PAM_ITEM_TYPE type, const void *value)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
last_result = pam_set_item(_pam_handle, type, value);
|
last_result = pam_set_item(_pam_handle, type, value);
|
||||||
if (last_result == PAM_SUCCESS) {
|
if (last_result == PAM_SUCCESS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "PAM error: %d on %d", last_result, type);
|
PT("PAM error: %d on %d", last_result, type);
|
||||||
PT(buf);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,73 +10,54 @@ static Eina_Bool _entrance_server_data(void *data, int type, void *event);
|
||||||
Ecore_Con_Server *_entrance_server = NULL;
|
Ecore_Con_Server *_entrance_server = NULL;
|
||||||
Eina_List *_handlers = NULL;
|
Eina_List *_handlers = NULL;
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_my_hack2(void *data)
|
_entrance_server_add(void *data __UNUSED__, int type __UNUSED__, void *event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
//Ecore_Con_Event_Client_Add *ev;
|
||||||
Entrance_Event eev;
|
Entrance_Event eev;
|
||||||
void *enc;
|
//ev = event;
|
||||||
int size;
|
|
||||||
eev.type = ENTRANCE_EVENT_ACTIONS;
|
|
||||||
eev.event.actions.actions = entrance_action_get();
|
|
||||||
enc = entrance_event_encode(&eev, &size);
|
|
||||||
ecore_con_client_send(data, enc, size);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_my_hack(void *data)
|
|
||||||
{
|
|
||||||
Entrance_Event eev;
|
|
||||||
void *enc;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
eev.type = ENTRANCE_EVENT_XSESSIONS;
|
|
||||||
if (entrance_config->xsessions)
|
|
||||||
{
|
|
||||||
eev.event.xsessions.xsessions = entrance_session_list_get();
|
|
||||||
enc = entrance_event_encode(&eev, &size);
|
|
||||||
ecore_con_client_send(data, enc, size);
|
|
||||||
}
|
|
||||||
ecore_timer_add(0.5, _my_hack2, data);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_entrance_server_add(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Con_Event_Client_Add *ev;
|
|
||||||
Entrance_Event eeu;
|
|
||||||
ev = event;
|
|
||||||
void *enc;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
PT("server client connected\n");
|
PT("server client connected\n");
|
||||||
eeu.type = ENTRANCE_EVENT_USERS;
|
PT("Sending users\n");
|
||||||
eeu.event.users.users = entrance_history_get();
|
eev.type = ENTRANCE_EVENT_USERS;
|
||||||
enc = entrance_event_encode(&eeu, &size);
|
eev.event.users.users = entrance_history_get();
|
||||||
ecore_con_client_send(ev->client, enc, size);
|
entrance_event_send(&eev);
|
||||||
// ecore_con_client_flush(ev->client);
|
|
||||||
ecore_timer_add(0.5, _my_hack, ev->client);
|
PT("Sending actions\n");
|
||||||
/*
|
eev.type = ENTRANCE_EVENT_ACTIONS;
|
||||||
eev.type = ENTRANCE_EVENT_XSESSIONS;
|
eev.event.actions.actions = entrance_action_get();
|
||||||
|
entrance_event_send(&eev);
|
||||||
if (entrance_config->xsessions)
|
if (entrance_config->xsessions)
|
||||||
{
|
{
|
||||||
|
PT("Sending xsessions\n");
|
||||||
|
eev.type = ENTRANCE_EVENT_XSESSIONS;
|
||||||
eev.event.xsessions.xsessions = entrance_session_list_get();
|
eev.event.xsessions.xsessions = entrance_session_list_get();
|
||||||
enc = entrance_event_encode(&eev, &size);
|
entrance_event_send(&eev);
|
||||||
ecore_con_client_send(data, enc, size);
|
}
|
||||||
|
if (entrance_config->custom_conf)
|
||||||
|
{
|
||||||
|
PT("Sending custom settings is enabled\n");
|
||||||
|
eev.type = ENTRANCE_EVENT_CONF_GUI;
|
||||||
|
eev.event.conf_gui.enabled = EINA_TRUE;
|
||||||
|
eev.event.conf_gui.bg.path = entrance_config->bg.path;
|
||||||
|
eev.event.conf_gui.bg.group = entrance_config->bg.group;
|
||||||
|
|
||||||
|
printf("sending %s %s\n", entrance_config->bg.path,
|
||||||
|
entrance_config->bg.group);
|
||||||
|
entrance_event_send(&eev);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_entrance_server_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_entrance_server_del(void *data __UNUSED__, int type __UNUSED__, void *event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
Ecore_Con_Event_Client_Del *ev;
|
Ecore_Con_Event_Client_Del *ev;
|
||||||
ev = event;
|
ev = event;
|
||||||
|
*/
|
||||||
PT("server client disconnected\n");
|
PT("server client disconnected\n");
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
@ -87,36 +68,66 @@ _entrance_server_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
Ecore_Con_Event_Client_Data *ev;
|
Ecore_Con_Event_Client_Data *ev;
|
||||||
Entrance_Event *eev, neev;
|
|
||||||
int size;
|
|
||||||
void *enc;
|
|
||||||
|
|
||||||
ev = event;
|
ev = event;
|
||||||
eev = entrance_event_decode(ev->data, ev->size);
|
entrance_event_received(ev->data, ev->size);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_entrance_server_read_cb(const void *data, size_t size EINA_UNUSED, void *user_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
const Entrance_Event *eev;
|
||||||
|
Entrance_Event neev;
|
||||||
|
eev = data;
|
||||||
if (eev->type == ENTRANCE_EVENT_AUTH)
|
if (eev->type == ENTRANCE_EVENT_AUTH)
|
||||||
{
|
{
|
||||||
neev.type = ENTRANCE_EVENT_STATUS;
|
neev.type = ENTRANCE_EVENT_STATUS;
|
||||||
if (entrance_session_authenticate(eev->event.auth.login,
|
if (entrance_session_authenticate(eev->event.auth.login,
|
||||||
eev->event.auth.password))
|
eev->event.auth.password))
|
||||||
{
|
{
|
||||||
entrance_session_login(eev->event.auth.session, EINA_TRUE);
|
|
||||||
neev.event.status.granted = EINA_TRUE;
|
|
||||||
PT("server authenticate granted\n");
|
PT("server authenticate granted\n");
|
||||||
|
if (eev->event.auth.open_session)
|
||||||
|
{
|
||||||
|
PT("opening session now ...\n");
|
||||||
|
entrance_session_login(eev->event.auth.session, EINA_TRUE);
|
||||||
|
}
|
||||||
|
neev.event.status.granted = EINA_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
neev.event.status.granted = EINA_FALSE;
|
neev.event.status.granted = EINA_FALSE;
|
||||||
PT("server authenticate error\n");
|
PT("server authenticate error\n");
|
||||||
}
|
}
|
||||||
enc = entrance_event_encode(&neev, &size);
|
entrance_event_send(&neev);
|
||||||
ecore_con_client_send(ev->client, enc, size);
|
|
||||||
}
|
}
|
||||||
else if (eev->type == ENTRANCE_EVENT_ACTION)
|
else if (eev->type == ENTRANCE_EVENT_ACTION)
|
||||||
entrance_action_run(eev->event.action.action);
|
{
|
||||||
|
PT("Action received\n");
|
||||||
|
entrance_action_run(eev->event.action.action);
|
||||||
|
}
|
||||||
|
else if (eev->type == ENTRANCE_EVENT_CONF_GUI)
|
||||||
|
{
|
||||||
|
PT("Conf Gui received\n");
|
||||||
|
entrance_config_set(&eev->event.conf_gui);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
PT("UNKNOW signal server\n");
|
PT("UNKNOW signal server\n");
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
static Eina_Bool
|
||||||
|
_entrance_server_write_cb(const void *data, size_t size, void *user_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
const Eina_List *l;
|
||||||
|
Ecore_Con_Client *ecc;
|
||||||
|
EINA_LIST_FOREACH(ecore_con_server_clients_get(_entrance_server), l, ecc)
|
||||||
|
ecore_con_client_send(ecc, data, size);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -124,6 +135,10 @@ entrance_server_init()
|
||||||
{
|
{
|
||||||
Ecore_Event_Handler *h;
|
Ecore_Event_Handler *h;
|
||||||
ecore_con_init();
|
ecore_con_init();
|
||||||
|
entrance_event_init(_entrance_server_read_cb,
|
||||||
|
_entrance_server_write_cb,
|
||||||
|
NULL);
|
||||||
|
|
||||||
_entrance_server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM,
|
_entrance_server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM,
|
||||||
"entrance", 42, NULL);
|
"entrance", 42, NULL);
|
||||||
if (!_entrance_server)
|
if (!_entrance_server)
|
||||||
|
@ -148,21 +163,16 @@ entrance_server_shutdown()
|
||||||
ecore_con_server_del(_entrance_server);
|
ecore_con_server_del(_entrance_server);
|
||||||
EINA_LIST_FREE(_handlers, h)
|
EINA_LIST_FREE(_handlers, h)
|
||||||
ecore_event_handler_del(h);
|
ecore_event_handler_del(h);
|
||||||
|
entrance_event_shutdown();
|
||||||
ecore_con_shutdown();
|
ecore_con_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_server_client_wait()
|
entrance_server_client_wait()
|
||||||
{
|
{
|
||||||
const Eina_List *l;
|
|
||||||
Entrance_Event eev;
|
Entrance_Event eev;
|
||||||
Ecore_Con_Client *ecc;
|
|
||||||
void *enc;
|
|
||||||
int size;
|
|
||||||
eev.type = ENTRANCE_EVENT_MAXTRIES;
|
eev.type = ENTRANCE_EVENT_MAXTRIES;
|
||||||
eev.event.maxtries.maxtries = EINA_TRUE;
|
eev.event.maxtries.maxtries = EINA_TRUE;
|
||||||
enc = entrance_event_encode(&eev, &size);
|
entrance_event_send(&eev);
|
||||||
EINA_LIST_FOREACH(ecore_con_server_clients_get(_entrance_server), l, ecc)
|
|
||||||
ecore_con_client_send(ecc, enc, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
|
|
||||||
#define HAVE_SHADOW 1
|
#define HAVE_SHADOW 1
|
||||||
|
|
||||||
static char *_mcookie;
|
static char *_mcookie = NULL;
|
||||||
|
static const char *_dname = NULL;
|
||||||
static char **env;
|
static char **env;
|
||||||
static char *_login = NULL;
|
static char *_login = NULL;
|
||||||
static unsigned char _logged = 0;
|
static unsigned char _logged = 0;
|
||||||
|
@ -48,7 +49,8 @@ _entrance_session_cookie_add(const char *mcookie, const char *display,
|
||||||
|
|
||||||
if (!xauth_cmd || !auth_file) return 1;
|
if (!xauth_cmd || !auth_file) return 1;
|
||||||
snprintf(buf, sizeof(buf), "%s -f %s -q", xauth_cmd, auth_file);
|
snprintf(buf, sizeof(buf), "%s -f %s -q", xauth_cmd, auth_file);
|
||||||
PT("write auth");
|
PT("write auth on ");
|
||||||
|
fprintf(stderr, "display %s with file %s\n", display, auth_file);
|
||||||
cmd = popen(buf, "w");
|
cmd = popen(buf, "w");
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +112,7 @@ _entrance_session_begin(struct passwd *pwd, const char *cookie)
|
||||||
entrance_pam_env_set("USER", pwd->pw_name);
|
entrance_pam_env_set("USER", pwd->pw_name);
|
||||||
entrance_pam_env_set("LOGNAME", pwd->pw_name);
|
entrance_pam_env_set("LOGNAME", pwd->pw_name);
|
||||||
entrance_pam_env_set("PATH", entrance_config->session_path);
|
entrance_pam_env_set("PATH", entrance_config->session_path);
|
||||||
entrance_pam_env_set("DISPLAY", ":0.0");
|
entrance_pam_env_set("DISPLAY", _dname);//":0.0");
|
||||||
entrance_pam_env_set("MAIL", "");
|
entrance_pam_env_set("MAIL", "");
|
||||||
entrance_pam_env_set("XAUTHORITY", cookie);
|
entrance_pam_env_set("XAUTHORITY", cookie);
|
||||||
entrance_pam_env_set("XDG_SESSION_CLASS", "greeter");
|
entrance_pam_env_set("XDG_SESSION_CLASS", "greeter");
|
||||||
|
@ -151,7 +153,7 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
||||||
env[n++]=strdup(buf);
|
env[n++]=strdup(buf);
|
||||||
snprintf(buf, sizeof(buf), "PATH=%s", entrance_config->session_path);
|
snprintf(buf, sizeof(buf), "PATH=%s", entrance_config->session_path);
|
||||||
env[n++]=strdup(buf);
|
env[n++]=strdup(buf);
|
||||||
snprintf(buf, sizeof(buf), "DISPLAY=%s", ":0.0");
|
snprintf(buf, sizeof(buf), "DISPLAY=%s", _dname);//":0.0");
|
||||||
env[n++]=strdup(buf);
|
env[n++]=strdup(buf);
|
||||||
snprintf(buf, sizeof(buf), "MAIL=");
|
snprintf(buf, sizeof(buf), "MAIL=");
|
||||||
env[n++]=strdup(buf);
|
env[n++]=strdup(buf);
|
||||||
|
@ -166,7 +168,7 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
||||||
if (-1 == system(buf))
|
if (-1 == system(buf))
|
||||||
PT("Error on session start command\n");
|
PT("Error on session start command\n");
|
||||||
if(_entrance_session_userid_set(pwd)) return;
|
if(_entrance_session_userid_set(pwd)) return;
|
||||||
_entrance_session_cookie_add(_mcookie, ":0",
|
_entrance_session_cookie_add(_mcookie, _dname,//":0",
|
||||||
entrance_config->command.xauth_path, cookie);
|
entrance_config->command.xauth_path, cookie);
|
||||||
if (chdir(pwd->pw_dir))
|
if (chdir(pwd->pw_dir))
|
||||||
{
|
{
|
||||||
|
@ -220,15 +222,13 @@ entrance_session_pid_get()
|
||||||
static const char *dig = "0123456789abcdef";
|
static const char *dig = "0123456789abcdef";
|
||||||
|
|
||||||
void
|
void
|
||||||
entrance_session_init(const char *file)
|
entrance_session_init(const char *dname)
|
||||||
{
|
{
|
||||||
uint16_t word;
|
uint16_t word;
|
||||||
uint8_t hi, lo;
|
uint8_t hi, lo;
|
||||||
int i;
|
int i;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
PT("Session init\n");
|
|
||||||
|
|
||||||
_mcookie = calloc(33, sizeof(char));
|
_mcookie = calloc(33, sizeof(char));
|
||||||
_mcookie[0] = 'a';
|
_mcookie[0] = 'a';
|
||||||
|
|
||||||
|
@ -244,12 +244,15 @@ entrance_session_init(const char *file)
|
||||||
_mcookie[i+3] = dig[hi >> 4];
|
_mcookie[i+3] = dig[hi >> 4];
|
||||||
}
|
}
|
||||||
// remove(file);
|
// remove(file);
|
||||||
snprintf(buf, sizeof(buf), "XAUTHORITY=%s", file);
|
snprintf(buf, sizeof(buf), "XAUTHORITY=%s",
|
||||||
|
entrance_config->command.xauth_file);
|
||||||
putenv(strdup(buf));
|
putenv(strdup(buf));
|
||||||
//PT("cookie %s \n", _mcookie);
|
//PT("cookie %s \n", _mcookie);
|
||||||
_entrance_session_cookie_add(_mcookie, ":0",
|
_entrance_session_cookie_add(_mcookie, dname,
|
||||||
entrance_config->command.xauth_path, file);
|
entrance_config->command.xauth_path,
|
||||||
|
entrance_config->command.xauth_file);
|
||||||
_entrance_session_desktops_init();
|
_entrance_session_desktops_init();
|
||||||
|
_dname = dname;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -269,10 +272,11 @@ entrance_session_shutdown()
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
entrance_session_authenticate(const char *login, const char *passwd)
|
entrance_session_authenticate(const char *login, const char *passwd)
|
||||||
{
|
{
|
||||||
|
Eina_Bool auth;
|
||||||
_login = strdup(login);
|
_login = strdup(login);
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
return (!entrance_pam_auth_set(login, passwd)
|
auth = !!(!entrance_pam_auth_set(login, passwd)
|
||||||
&& !entrance_pam_authenticate());
|
&& !entrance_pam_authenticate());
|
||||||
#else
|
#else
|
||||||
char *enc, *v;
|
char *enc, *v;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
@ -293,8 +297,11 @@ entrance_session_authenticate(const char *login, const char *passwd)
|
||||||
if(!v || *v == '\0')
|
if(!v || *v == '\0')
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
enc = crypt(passwd, v);
|
enc = crypt(passwd, v);
|
||||||
return !strcmp(enc, v);
|
auth = !strcmp(enc, v);
|
||||||
#endif
|
#endif
|
||||||
|
eina_stringshare_del(passwd);
|
||||||
|
memset((char *)passwd, 0, strlen(passwd));
|
||||||
|
return auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct passwd *
|
static struct passwd *
|
||||||
|
@ -328,8 +335,8 @@ entrance_session_login(const char *session, Eina_Bool push)
|
||||||
}
|
}
|
||||||
if (push) entrance_history_push(pwd->pw_name, session);
|
if (push) entrance_history_push(pwd->pw_name, session);
|
||||||
cmd = _entrance_session_find_command(pwd->pw_dir, session);
|
cmd = _entrance_session_find_command(pwd->pw_dir, session);
|
||||||
PT("launching session for user ");
|
PT("launching session ");
|
||||||
fprintf(stderr, "%s\n", _login);
|
fprintf(stderr, "%s for user %s\n", session, _login);
|
||||||
_entrance_session_run(pwd, cmd, buf);
|
_entrance_session_run(pwd, cmd, buf);
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
@ -391,9 +398,8 @@ _entrance_session_desktops_init()
|
||||||
|
|
||||||
efreet_desktop_type_alias(EFREET_DESKTOP_TYPE_APPLICATION, "XSession");
|
efreet_desktop_type_alias(EFREET_DESKTOP_TYPE_APPLICATION, "XSession");
|
||||||
PT("scanning directory: ");
|
PT("scanning directory: ");
|
||||||
/* Maybee need to scan other directories ?
|
/* Maybee need to scan other directories ? */
|
||||||
* _entrance_session_desktops_scan("/etc/share/xsessions");
|
_entrance_session_desktops_scan("/etc/share/xsessions");
|
||||||
*/
|
|
||||||
_entrance_session_desktops_scan("/etc/X11/dm/Sessions");
|
_entrance_session_desktops_scan("/etc/X11/dm/Sessions");
|
||||||
snprintf(buf, sizeof(buf), "%s/xsessions", efreet_data_home_get());
|
snprintf(buf, sizeof(buf), "%s/xsessions", efreet_data_home_get());
|
||||||
_entrance_session_desktops_scan(buf);
|
_entrance_session_desktops_scan(buf);
|
||||||
|
@ -416,7 +422,7 @@ _entrance_session_desktops_scan(const char *dir)
|
||||||
|
|
||||||
if (ecore_file_is_dir(dir))
|
if (ecore_file_is_dir(dir))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s", dir);
|
fprintf(stderr, " %s", dir);
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
EINA_LIST_FREE(files, filename)
|
EINA_LIST_FREE(files, filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define ENTRANCE_SESSION_H_
|
#define ENTRANCE_SESSION_H_
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
void entrance_session_init(const char *file);
|
void entrance_session_init(const char *dname);
|
||||||
void entrance_session_end(const char *login);
|
void entrance_session_end(const char *login);
|
||||||
void entrance_session_shutdown();
|
void entrance_session_shutdown();
|
||||||
Eina_Bool entrance_session_authenticate(const char *login, const char *pwd);
|
Eina_Bool entrance_session_authenticate(const char *login, const char *pwd);
|
||||||
|
|
|
@ -35,6 +35,7 @@ _xserver_start()
|
||||||
char **args = NULL;
|
char **args = NULL;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
PT("Launching xserver\n");
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid)
|
if (!pid)
|
||||||
{
|
{
|
||||||
|
@ -109,13 +110,13 @@ entrance_xserver_init(Entrance_X_Cb start, const char *dname)
|
||||||
sigset_t newset;
|
sigset_t newset;
|
||||||
sigemptyset(&newset);
|
sigemptyset(&newset);
|
||||||
|
|
||||||
PT("xserver init\n");
|
|
||||||
_xserver = calloc(1, sizeof(Entrance_Xserver));
|
_xserver = calloc(1, sizeof(Entrance_Xserver));
|
||||||
_xserver->dname = eina_stringshare_add(dname);
|
_xserver->dname = eina_stringshare_add(dname);
|
||||||
_xserver->start = start;
|
_xserver->start = start;
|
||||||
pid = _xserver_start();
|
pid = _xserver_start();
|
||||||
snprintf(buf, sizeof(buf), "ENTRANCE_XPID=%d", pid);
|
snprintf(buf, sizeof(buf), "ENTRANCE_XPID=%d", pid);
|
||||||
putenv(strdup(buf));
|
putenv(strdup(buf));
|
||||||
|
PT("xserver adding signal user handler\n");
|
||||||
_handler_start = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
|
_handler_start = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
|
||||||
_xserver_started,
|
_xserver_started,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef ENTRANCE_XLIB_H_
|
#ifndef ENTRANCE_XLIB_H_
|
||||||
#define ENTRANCE_XLIB_H_
|
#define ENTRANCE_XLIB_H_
|
||||||
typedef int (*Entrance_X_Cb)(const char *data);
|
typedef Eina_Bool (*Entrance_X_Cb)(const char *data);
|
||||||
int entrance_xserver_init(Entrance_X_Cb start, const char *dname);
|
int entrance_xserver_init(Entrance_X_Cb start, const char *dname);
|
||||||
void entrance_xserver_wait();
|
void entrance_xserver_wait();
|
||||||
void entrance_xserver_end();
|
void entrance_xserver_end();
|
||||||
|
|
|
@ -2,20 +2,32 @@
|
||||||
#include <Eet.h>
|
#include <Eet.h>
|
||||||
#include "entrance_event.h"
|
#include "entrance_event.h"
|
||||||
|
|
||||||
|
|
||||||
#define ENTRANCE_EVENT_AUTH_NAME "EntranceEventAuth"
|
#define ENTRANCE_EVENT_AUTH_NAME "EntranceEventAuth"
|
||||||
#define ENTRANCE_EVENT_MAXTRIES_NAME "EntranceEventMaxtries"
|
#define ENTRANCE_EVENT_MAXTRIES_NAME "EntranceEventMaxtries"
|
||||||
#define ENTRANCE_EVENT_XSESSIONS_NAME "EntranceEventSession"
|
#define ENTRANCE_EVENT_XSESSIONS_NAME "EntranceEventSession"
|
||||||
#define ENTRANCE_EVENT_STATUS_NAME "EntranceEventStatus"
|
#define ENTRANCE_EVENT_STATUS_NAME "EntranceEventStatus"
|
||||||
#define ENTRANCE_EVENT_USERS_NAME "EntranceEventUsers"
|
#define ENTRANCE_EVENT_USERS_NAME "EntranceEventUsers"
|
||||||
|
#define ENTRANCE_EVENT_USER_NAME "EntranceEventUser"
|
||||||
#define ENTRANCE_EVENT_ACTIONS_NAME "EntranceEventActions"
|
#define ENTRANCE_EVENT_ACTIONS_NAME "EntranceEventActions"
|
||||||
#define ENTRANCE_EVENT_ACTION_NAME "EntranceEventAction"
|
#define ENTRANCE_EVENT_ACTION_NAME "EntranceEventAction"
|
||||||
|
#define ENTRANCE_EVENT_CONF_GUI_NAME "EntranceEventConfGui"
|
||||||
|
|
||||||
static Eina_Bool _entrance_event_type_set(const char *type, void *data, Eina_Bool unknow);
|
static Eina_Bool _entrance_event_type_set(const char *type, void *data, Eina_Bool unknow);
|
||||||
static const char *_entrance_event_type_get(const void *data, Eina_Bool *unknow);
|
static const char *_entrance_event_type_get(const void *data, Eina_Bool *unknow);
|
||||||
|
|
||||||
static Eet_Data_Descriptor *_entrance_event_auth_dd();
|
static Eet_Data_Descriptor *_entrance_event_auth_dd();
|
||||||
static Eet_Data_Descriptor *_entrance_event_status_dd();
|
static Eet_Data_Descriptor *_entrance_event_status_dd();
|
||||||
static Eet_Data_Descriptor *_entrance_event_xsessions_dd();
|
static Eet_Data_Descriptor *_entrance_event_xsessions_dd();
|
||||||
|
static Eet_Data_Descriptor *_entrance_event_conf_gui_dd();
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _Entrance_Event_Private {
|
||||||
|
Eet_Data_Descriptor *event_descriptor;
|
||||||
|
Eet_Connection *event_connection;
|
||||||
|
Eet_Read_Cb *func_read_cb;
|
||||||
|
} Entrance_Event_Private;
|
||||||
|
|
||||||
|
static Entrance_Event_Private *_eep = NULL;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_entrance_event_type_set(const char *type, void *data, Eina_Bool unknow)
|
_entrance_event_type_set(const char *type, void *data, Eina_Bool unknow)
|
||||||
|
@ -33,10 +45,14 @@ _entrance_event_type_set(const char *type, void *data, Eina_Bool unknow)
|
||||||
*ev = ENTRANCE_EVENT_XSESSIONS;
|
*ev = ENTRANCE_EVENT_XSESSIONS;
|
||||||
else if (!strcmp(type, ENTRANCE_EVENT_USERS_NAME))
|
else if (!strcmp(type, ENTRANCE_EVENT_USERS_NAME))
|
||||||
*ev = ENTRANCE_EVENT_USERS;
|
*ev = ENTRANCE_EVENT_USERS;
|
||||||
|
else if (!strcmp(type, ENTRANCE_EVENT_USER_NAME))
|
||||||
|
*ev = ENTRANCE_EVENT_USER;
|
||||||
else if (!strcmp(type, ENTRANCE_EVENT_ACTIONS_NAME))
|
else if (!strcmp(type, ENTRANCE_EVENT_ACTIONS_NAME))
|
||||||
*ev = ENTRANCE_EVENT_ACTIONS;
|
*ev = ENTRANCE_EVENT_ACTIONS;
|
||||||
else if (!strcmp(type, ENTRANCE_EVENT_ACTION_NAME))
|
else if (!strcmp(type, ENTRANCE_EVENT_ACTION_NAME))
|
||||||
*ev = ENTRANCE_EVENT_ACTION;
|
*ev = ENTRANCE_EVENT_ACTION;
|
||||||
|
else if (!strcmp(type, ENTRANCE_EVENT_CONF_GUI_NAME))
|
||||||
|
*ev = ENTRANCE_EVENT_CONF_GUI;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("error on type set\n");
|
printf("error on type set\n");
|
||||||
|
@ -60,14 +76,19 @@ _entrance_event_type_get(const void *data, Eina_Bool *unknow)
|
||||||
return ENTRANCE_EVENT_XSESSIONS_NAME;
|
return ENTRANCE_EVENT_XSESSIONS_NAME;
|
||||||
else if (*ev == ENTRANCE_EVENT_USERS)
|
else if (*ev == ENTRANCE_EVENT_USERS)
|
||||||
return ENTRANCE_EVENT_USERS_NAME;
|
return ENTRANCE_EVENT_USERS_NAME;
|
||||||
|
else if (*ev == ENTRANCE_EVENT_USER)
|
||||||
|
return ENTRANCE_EVENT_USER_NAME;
|
||||||
else if (*ev == ENTRANCE_EVENT_ACTIONS)
|
else if (*ev == ENTRANCE_EVENT_ACTIONS)
|
||||||
return ENTRANCE_EVENT_ACTIONS_NAME;
|
return ENTRANCE_EVENT_ACTIONS_NAME;
|
||||||
else if (*ev == ENTRANCE_EVENT_ACTION)
|
else if (*ev == ENTRANCE_EVENT_ACTION)
|
||||||
return ENTRANCE_EVENT_ACTION_NAME;
|
return ENTRANCE_EVENT_ACTION_NAME;
|
||||||
if (*unknow)
|
else if (*ev == ENTRANCE_EVENT_CONF_GUI)
|
||||||
|
return ENTRANCE_EVENT_CONF_GUI_NAME;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
printf("error on type get\n");
|
printf("error on type get\n");
|
||||||
*unknow = EINA_TRUE;
|
if (unknow)
|
||||||
|
*unknow = EINA_TRUE;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +108,8 @@ _entrance_event_xsessions_dd()
|
||||||
|
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Xsessions_Event);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Xsessions_Event);
|
||||||
eddl = eet_data_descriptor_stream_new(&eddcl);
|
eddl = eet_data_descriptor_stream_new(&eddcl);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Xsessions_Event, "xsessions", xsessions, edd);
|
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Xsessions_Event, "xsessions",
|
||||||
|
xsessions, edd);
|
||||||
return eddl;
|
return eddl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +126,8 @@ _entrance_event_auth_dd()
|
||||||
password, EET_T_STRING);
|
password, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Auth_Event, "session",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Auth_Event, "session",
|
||||||
session, EET_T_STRING);
|
session, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Auth_Event, "open_session",
|
||||||
|
open_session, EET_T_UCHAR);
|
||||||
return edd;
|
return edd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,6 +144,25 @@ _entrance_event_maxtries_dd()
|
||||||
return edd;
|
return edd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eet_Data_Descriptor *
|
||||||
|
_entrance_event_conf_gui_dd()
|
||||||
|
{
|
||||||
|
Eet_Data_Descriptor *edd;
|
||||||
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc,
|
||||||
|
Entrance_Conf_Gui_Event);
|
||||||
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "enabled",
|
||||||
|
enabled, EET_T_UCHAR);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "bg.path",
|
||||||
|
bg.path, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "bg.group",
|
||||||
|
bg.group, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "vkbd_enabled",
|
||||||
|
vkbd_enabled, EET_T_UCHAR);
|
||||||
|
return edd;
|
||||||
|
}
|
||||||
|
|
||||||
static Eet_Data_Descriptor *
|
static Eet_Data_Descriptor *
|
||||||
_entrance_event_status_dd()
|
_entrance_event_status_dd()
|
||||||
{
|
{
|
||||||
|
@ -138,20 +181,42 @@ _entrance_event_users_dd()
|
||||||
{
|
{
|
||||||
Eet_Data_Descriptor *edd, *eddl;
|
Eet_Data_Descriptor *edd, *eddl;
|
||||||
Eet_Data_Descriptor_Class eddc, eddcl;
|
Eet_Data_Descriptor_Class eddc, eddcl;
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_User);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_User_Event);
|
||||||
edd = eet_data_descriptor_stream_new(&eddc);
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User, "login",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "login",
|
||||||
login, EET_T_STRING);
|
login, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User, "image",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "image.path",
|
||||||
image, EET_T_STRING);
|
image.path, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User, "lsess",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "image.group",
|
||||||
|
image.group, EET_T_STRING);
|
||||||
|
// TODO screenshot
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "lsess",
|
||||||
lsess, EET_T_STRING);
|
lsess, EET_T_STRING);
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Users_Event);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Users_Event);
|
||||||
eddl = eet_data_descriptor_stream_new(&eddcl);
|
eddl = eet_data_descriptor_stream_new(&eddcl);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Users_Event, "users", users, edd);
|
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Users_Event, "users",
|
||||||
|
users, edd);
|
||||||
return eddl;
|
return eddl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eet_Data_Descriptor *
|
||||||
|
_entrance_event_user_dd()
|
||||||
|
{
|
||||||
|
Eet_Data_Descriptor *edd;
|
||||||
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_User_Event);
|
||||||
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "login",
|
||||||
|
login, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "image.path",
|
||||||
|
image.path, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "image.group",
|
||||||
|
image.group, EET_T_STRING);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_User_Event, "lsess",
|
||||||
|
lsess, EET_T_STRING);
|
||||||
|
return edd;
|
||||||
|
}
|
||||||
|
|
||||||
static Eet_Data_Descriptor *
|
static Eet_Data_Descriptor *
|
||||||
_entrance_event_actions_dd()
|
_entrance_event_actions_dd()
|
||||||
{
|
{
|
||||||
|
@ -162,10 +227,11 @@ _entrance_event_actions_dd()
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action, "label",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action, "label",
|
||||||
label, EET_T_STRING);
|
label, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action, "id",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action, "id",
|
||||||
id, EET_T_INT);
|
id, EET_T_UCHAR);
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Actions_Event);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Actions_Event);
|
||||||
eddl = eet_data_descriptor_stream_new(&eddcl);
|
eddl = eet_data_descriptor_stream_new(&eddcl);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Actions_Event, "actions", actions, edd);
|
EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Actions_Event, "actions",
|
||||||
|
actions, edd);
|
||||||
return eddl;
|
return eddl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +243,7 @@ _entrance_event_action_dd()
|
||||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Status_Event);
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Status_Event);
|
||||||
edd = eet_data_descriptor_stream_new(&eddc);
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action_Event, "action",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Action_Event, "action",
|
||||||
action, EET_T_INT);
|
action, EET_T_UCHAR);
|
||||||
return edd;
|
return edd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,35 +262,70 @@ _entrance_event_new()
|
||||||
eddc.func.type_set = _entrance_event_type_set;
|
eddc.func.type_set = _entrance_event_type_set;
|
||||||
unified = eet_data_descriptor_stream_new(&eddc);
|
unified = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_XSESSIONS_NAME, _entrance_event_xsessions_dd());
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_XSESSIONS_NAME,
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_AUTH_NAME, _entrance_event_auth_dd());
|
_entrance_event_xsessions_dd());
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_MAXTRIES_NAME, _entrance_event_maxtries_dd());
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_AUTH_NAME,
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_STATUS_NAME, _entrance_event_status_dd());
|
_entrance_event_auth_dd());
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_USERS_NAME, _entrance_event_users_dd());
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_MAXTRIES_NAME,
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTIONS_NAME, _entrance_event_actions_dd());
|
_entrance_event_maxtries_dd());
|
||||||
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTION_NAME, _entrance_event_action_dd());
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_STATUS_NAME,
|
||||||
|
_entrance_event_status_dd());
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_USERS_NAME,
|
||||||
|
_entrance_event_users_dd());
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_USER_NAME,
|
||||||
|
_entrance_event_user_dd());
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTIONS_NAME,
|
||||||
|
_entrance_event_actions_dd());
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTION_NAME,
|
||||||
|
_entrance_event_action_dd());
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_CONF_GUI_NAME,
|
||||||
|
_entrance_event_conf_gui_dd());
|
||||||
|
|
||||||
EET_DATA_DESCRIPTOR_ADD_UNION(edd, Entrance_Event, "event", event, type, unified);
|
EET_DATA_DESCRIPTOR_ADD_UNION(edd, Entrance_Event, "event",
|
||||||
|
event, type, unified);
|
||||||
return edd;
|
return edd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static Eina_Bool
|
||||||
entrance_event_encode(Entrance_Event *eev, int *size)
|
_entrance_event_read_cb(const void *data, size_t size, void *user_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Eet_Data_Descriptor *edd;
|
void *ev;
|
||||||
|
ev = eet_data_descriptor_decode(_eep->event_descriptor, data, size);
|
||||||
edd = _entrance_event_new();
|
if (_eep->func_read_cb)
|
||||||
|
_eep->func_read_cb(ev, size, user_data);
|
||||||
return eet_data_descriptor_encode(edd, eev, size);
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entrance_Event *
|
void
|
||||||
entrance_event_decode(void *data, int size)
|
entrance_event_init(Eet_Read_Cb func_read_cb, Eet_Write_Cb func_write_cb, void *func_data)
|
||||||
{
|
{
|
||||||
Eet_Data_Descriptor *edd;
|
_eep = calloc(1, sizeof(Entrance_Event_Private));
|
||||||
|
_eep->func_read_cb = func_read_cb;
|
||||||
edd = _entrance_event_new();
|
_eep->event_descriptor = _entrance_event_new();
|
||||||
|
_eep->event_connection = eet_connection_new(_entrance_event_read_cb,
|
||||||
return eet_data_descriptor_decode(edd, data, size);
|
func_write_cb,
|
||||||
|
func_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_event_shutdown(void)
|
||||||
|
{
|
||||||
|
eet_connection_close(_eep->event_connection, NULL);
|
||||||
|
eet_data_descriptor_free(_eep->event_descriptor);
|
||||||
|
free(_eep);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_event_send(const Entrance_Event *data)
|
||||||
|
{
|
||||||
|
eet_connection_send(_eep->event_connection, _eep->event_descriptor,
|
||||||
|
data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entrance_event_received(const void *data, size_t size)
|
||||||
|
{
|
||||||
|
eet_connection_received(_eep->event_connection, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,11 @@ typedef enum Entrance_Event_Type_
|
||||||
ENTRANCE_EVENT_STATUS,
|
ENTRANCE_EVENT_STATUS,
|
||||||
ENTRANCE_EVENT_XSESSIONS,
|
ENTRANCE_EVENT_XSESSIONS,
|
||||||
ENTRANCE_EVENT_USERS,
|
ENTRANCE_EVENT_USERS,
|
||||||
|
ENTRANCE_EVENT_USER,
|
||||||
ENTRANCE_EVENT_ACTIONS,
|
ENTRANCE_EVENT_ACTIONS,
|
||||||
ENTRANCE_EVENT_ACTION,
|
ENTRANCE_EVENT_ACTION,
|
||||||
ENTRANCE_EVENT_MAXTRIES
|
ENTRANCE_EVENT_MAXTRIES,
|
||||||
|
ENTRANCE_EVENT_CONF_GUI,
|
||||||
} Entrance_Event_Type;
|
} Entrance_Event_Type;
|
||||||
|
|
||||||
typedef struct Entrance_Xsession_
|
typedef struct Entrance_Xsession_
|
||||||
|
@ -30,6 +32,7 @@ typedef struct Entrance_Auth_Event_
|
||||||
const char *login;
|
const char *login;
|
||||||
const char *password;
|
const char *password;
|
||||||
const char *session;
|
const char *session;
|
||||||
|
Eina_Bool open_session;
|
||||||
} Entrance_Auth_Event;
|
} Entrance_Auth_Event;
|
||||||
|
|
||||||
typedef struct Entrance_Maxtries_Event_
|
typedef struct Entrance_Maxtries_Event_
|
||||||
|
@ -44,16 +47,24 @@ typedef struct Entrance_Status_Event_
|
||||||
|
|
||||||
typedef struct Entrance_Action_Event_
|
typedef struct Entrance_Action_Event_
|
||||||
{
|
{
|
||||||
int action;
|
unsigned char action;
|
||||||
} Entrance_Action_Event;
|
} Entrance_Action_Event;
|
||||||
|
|
||||||
typedef struct Entrance_User_
|
typedef struct Entrance_User_Event_
|
||||||
{
|
{
|
||||||
const char *login;
|
const char *login;
|
||||||
const char *image;
|
|
||||||
const char *lsess;
|
const char *lsess;
|
||||||
} Entrance_User;
|
struct
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} image;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
const char *group;
|
||||||
|
} background;
|
||||||
|
} Entrance_User_Event;
|
||||||
|
|
||||||
typedef struct Entrance_Users_Event_
|
typedef struct Entrance_Users_Event_
|
||||||
{
|
{
|
||||||
|
@ -62,7 +73,7 @@ typedef struct Entrance_Users_Event_
|
||||||
|
|
||||||
typedef struct Entrance_Action_
|
typedef struct Entrance_Action_
|
||||||
{
|
{
|
||||||
int id;
|
unsigned char id;
|
||||||
const char *label;
|
const char *label;
|
||||||
} Entrance_Action;
|
} Entrance_Action;
|
||||||
|
|
||||||
|
@ -71,6 +82,20 @@ typedef struct Entrance_Actions_Event_
|
||||||
Eina_List *actions;
|
Eina_List *actions;
|
||||||
} Entrance_Actions_Event;
|
} Entrance_Actions_Event;
|
||||||
|
|
||||||
|
typedef struct Entrance_Conf_Gui_Event_
|
||||||
|
{
|
||||||
|
Eina_Bool enabled;
|
||||||
|
const char *theme;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *group;
|
||||||
|
const char *path;
|
||||||
|
} bg;
|
||||||
|
Eina_Bool vkbd_enabled;
|
||||||
|
} Entrance_Conf_Gui_Event;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct Entrance_Event_
|
typedef struct Entrance_Event_
|
||||||
{
|
{
|
||||||
Entrance_Event_Type type;
|
Entrance_Event_Type type;
|
||||||
|
@ -81,11 +106,15 @@ typedef struct Entrance_Event_
|
||||||
Entrance_Maxtries_Event maxtries;
|
Entrance_Maxtries_Event maxtries;
|
||||||
Entrance_Status_Event status;
|
Entrance_Status_Event status;
|
||||||
Entrance_Users_Event users;
|
Entrance_Users_Event users;
|
||||||
|
Entrance_User_Event user;
|
||||||
Entrance_Actions_Event actions;
|
Entrance_Actions_Event actions;
|
||||||
Entrance_Action_Event action;
|
Entrance_Action_Event action;
|
||||||
|
Entrance_Conf_Gui_Event conf_gui;
|
||||||
} event;
|
} event;
|
||||||
} Entrance_Event;
|
} Entrance_Event;
|
||||||
|
|
||||||
void *entrance_event_encode(Entrance_Event *ev, int *size);
|
void entrance_event_init(Eet_Read_Cb func_read_cb, Eet_Write_Cb func_write_cb, void *func_data);
|
||||||
Entrance_Event *entrance_event_decode(void *data, int size);
|
void entrance_event_shutdown(void);
|
||||||
|
void entrance_event_send(const Entrance_Event *data);
|
||||||
|
void entrance_event_received(const void *data, size_t size);
|
||||||
#endif /* ENTRANCE_EVENT_ */
|
#endif /* ENTRANCE_EVENT_ */
|
||||||
|
|