|
@ -1,5 +1,5 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
SUBDIRS = default standard minimalist scaleable netbook illume illume-home
|
SUBDIRS = default standard minimalist scaleable netbook illume
|
||||||
|
|
||||||
EET_EET = @eet_eet@
|
EET_EET = @eet_eet@
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
@ -705,7 +705,6 @@ AC_E_OPTIONAL_MODULE([mixer], true, [CHECK_MODULE_MIXER])
|
||||||
AC_E_OPTIONAL_MODULE([connman], true, [CHECK_MODULE_CONNMAN])
|
AC_E_OPTIONAL_MODULE([connman], true, [CHECK_MODULE_CONNMAN])
|
||||||
AC_E_OPTIONAL_MODULE([bluez], true, [CHECK_MODULE_BLUEZ])
|
AC_E_OPTIONAL_MODULE([bluez], true, [CHECK_MODULE_BLUEZ])
|
||||||
AC_E_OPTIONAL_MODULE([ofono], true, [CHECK_MODULE_OFONO])
|
AC_E_OPTIONAL_MODULE([ofono], true, [CHECK_MODULE_OFONO])
|
||||||
AC_E_OPTIONAL_MODULE([illume], true)
|
|
||||||
AC_E_OPTIONAL_MODULE([illume2], true)
|
AC_E_OPTIONAL_MODULE([illume2], true)
|
||||||
AC_E_OPTIONAL_MODULE([syscon], true)
|
AC_E_OPTIONAL_MODULE([syscon], true)
|
||||||
AC_E_OPTIONAL_MODULE([everything], true)
|
AC_E_OPTIONAL_MODULE([everything], true)
|
||||||
|
@ -819,10 +818,6 @@ src/modules/bluez/Makefile
|
||||||
src/modules/bluez/module.desktop
|
src/modules/bluez/module.desktop
|
||||||
src/modules/ofono/Makefile
|
src/modules/ofono/Makefile
|
||||||
src/modules/ofono/module.desktop
|
src/modules/ofono/module.desktop
|
||||||
src/modules/illume/Makefile
|
|
||||||
src/modules/illume/module.desktop
|
|
||||||
src/modules/illume/keyboards/Makefile
|
|
||||||
src/modules/illume/dicts/Makefile
|
|
||||||
src/modules/illume2/Makefile
|
src/modules/illume2/Makefile
|
||||||
src/modules/illume2/doc/illume.dox
|
src/modules/illume2/doc/illume.dox
|
||||||
src/modules/illume2/doc/Makefile
|
src/modules/illume2/doc/Makefile
|
||||||
|
@ -895,7 +890,6 @@ config/minimalist/Makefile
|
||||||
config/scaleable/Makefile
|
config/scaleable/Makefile
|
||||||
config/netbook/Makefile
|
config/netbook/Makefile
|
||||||
config/illume/Makefile
|
config/illume/Makefile
|
||||||
config/illume-home/Makefile
|
|
||||||
$po_makefile_in
|
$po_makefile_in
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -138,10 +138,6 @@ if USE_MODULE_BLUEZ
|
||||||
SUBDIRS += bluez
|
SUBDIRS += bluez
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_MODULE_ILLUME
|
|
||||||
SUBDIRS += illume
|
|
||||||
endif
|
|
||||||
|
|
||||||
if USE_MODULE_ILLUME2
|
if USE_MODULE_ILLUME2
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
illume2 \
|
illume2 \
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
module.la
|
|
||||||
*.lo
|
|
||||||
Makefile.in
|
|
||||||
Makefile
|
|
||||||
.libs
|
|
||||||
.deps
|
|
||||||
module.desktop
|
|
|
@ -1,81 +0,0 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MODULE = illume
|
|
||||||
|
|
||||||
SUBDIRS = keyboards dicts
|
|
||||||
|
|
||||||
# data files for the module
|
|
||||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
|
||||||
files_DATA = \
|
|
||||||
e-module-$(MODULE).edj module.desktop
|
|
||||||
|
|
||||||
EXTRA_DIST = $(files_DATA)
|
|
||||||
|
|
||||||
# the module .so file
|
|
||||||
INCLUDES = -I. \
|
|
||||||
-I$(top_srcdir) \
|
|
||||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
|
||||||
-I$(top_srcdir)/src/bin \
|
|
||||||
-I$(top_builddir)/src/bin \
|
|
||||||
-I$(top_srcdir)/src/modules \
|
|
||||||
@e_cflags@
|
|
||||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
|
||||||
pkg_LTLIBRARIES = module.la
|
|
||||||
module_la_SOURCES = e_mod_main.c \
|
|
||||||
e_mod_main.h \
|
|
||||||
e_mod_layout.h \
|
|
||||||
e_mod_layout.c \
|
|
||||||
e_mod_win.h \
|
|
||||||
e_mod_win.c \
|
|
||||||
e_kbd.h \
|
|
||||||
e_kbd.c \
|
|
||||||
e_slipshelf.h \
|
|
||||||
e_slipshelf.c \
|
|
||||||
e_slipwin.h \
|
|
||||||
e_slipwin.c \
|
|
||||||
e_mod_gad_wifi.c \
|
|
||||||
e_mod_gad_wifi.h \
|
|
||||||
e_mod_gad_gsm.c \
|
|
||||||
e_mod_gad_gsm.h \
|
|
||||||
e_mod_gad_usb.c \
|
|
||||||
e_mod_gad_usb.h \
|
|
||||||
e_mod_gad_bluetooth.c \
|
|
||||||
e_mod_gad_bluetooth.h \
|
|
||||||
e_pwr.c \
|
|
||||||
e_pwr.h \
|
|
||||||
e_busywin.h \
|
|
||||||
e_busywin.c \
|
|
||||||
e_cfg.h \
|
|
||||||
e_cfg.c \
|
|
||||||
e_winilist.c \
|
|
||||||
e_winilist.h \
|
|
||||||
e_simplelock.c \
|
|
||||||
e_simplelock.h \
|
|
||||||
e_kbd_send.c \
|
|
||||||
e_kbd_send.h \
|
|
||||||
e_kbd_int.c \
|
|
||||||
e_kbd_int.h \
|
|
||||||
e_kbd_buf.c \
|
|
||||||
e_kbd_buf.h \
|
|
||||||
e_kbd_dict.c \
|
|
||||||
e_kbd_dict.h \
|
|
||||||
e_flaunch.c \
|
|
||||||
e_flaunch.h \
|
|
||||||
e_busycover.c \
|
|
||||||
e_busycover.h \
|
|
||||||
e_appwin.c \
|
|
||||||
e_appwin.h \
|
|
||||||
e_syswin.c \
|
|
||||||
e_syswin.h
|
|
||||||
|
|
||||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
|
||||||
module_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
|
||||||
|
|
||||||
wifigetdir = $(pkgdir)
|
|
||||||
|
|
||||||
wifiget_PROGRAMS = wifiget
|
|
||||||
wifiget_SOURCES = wifiget.c
|
|
||||||
wifiget_LDFLAGS =
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
|
@ -1,9 +0,0 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MODULE = illume
|
|
||||||
|
|
||||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)/dicts
|
|
||||||
files_DATA = \
|
|
||||||
English_(US).dic \
|
|
||||||
English_(US)_Small.dic
|
|
||||||
|
|
||||||
EXTRA_DIST = $(files_DATA)
|
|
|
@ -1,427 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_appwin.h"
|
|
||||||
|
|
||||||
// FIXME: stolen from slipwin. this is meant to be an "app control menu" that
|
|
||||||
// is always availabel by some key binding. this menu should have:
|
|
||||||
//
|
|
||||||
// close app
|
|
||||||
// kill app
|
|
||||||
// home
|
|
||||||
// shutdown
|
|
||||||
// suspend
|
|
||||||
// config
|
|
||||||
//
|
|
||||||
// maybe a list of extras?
|
|
||||||
|
|
||||||
typedef struct _Win_Entry Win_Entry;
|
|
||||||
|
|
||||||
struct _Win_Entry
|
|
||||||
{
|
|
||||||
E_Appwin *appwin;
|
|
||||||
E_Border *border;
|
|
||||||
Evas_Object *icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int E_EVENT_APPWIN_DEL = 0;
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Appwin *_e_appwin_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_appwin_free(E_Appwin *ess);
|
|
||||||
static Eina_Bool _e_appwin_cb_animate(void *data);
|
|
||||||
static void _e_appwin_slide(E_Appwin *ess, int out, double len);
|
|
||||||
static Eina_Bool _e_appwin_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_appwin_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_appwin_cb_zone_del(void *data, int type, void *event);
|
|
||||||
//static void _e_appwin_event_simple_free(void *data, void *ev);
|
|
||||||
static void _e_appwin_object_del_attach(void *o);
|
|
||||||
static void _e_appwin_cb_item_sel(void *data);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *appwins = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_appwin_init(void)
|
|
||||||
{
|
|
||||||
E_EVENT_APPWIN_DEL = ecore_event_type_new();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_appwin_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Appwin *
|
|
||||||
e_appwin_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Appwin *esw;
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
int x, y;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
esw = E_OBJECT_ALLOC(E_Appwin, E_APPWIN_TYPE, _e_appwin_free);
|
|
||||||
if (!esw) return NULL;
|
|
||||||
|
|
||||||
esw->zone = zone;
|
|
||||||
if (themedir) esw->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y, zone->w, zone->h);
|
|
||||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
e_popup_layer_set(esw->popup, 220);
|
|
||||||
|
|
||||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
|
||||||
esw->themedir,
|
|
||||||
"e/modules/appwin/base/default");
|
|
||||||
|
|
||||||
esw->focused_border = e_border_focused_get();
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
o = e_widget_ilist_add(esw->popup->evas, 32 * e_scale, 32 * e_scale, NULL);
|
|
||||||
esw->ilist_obj = o;
|
|
||||||
e_widget_ilist_selector_set(o, 1);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
x = zone->x;
|
|
||||||
y = zone->y + zone->h;
|
|
||||||
mw = zone->w;
|
|
||||||
|
|
||||||
mh = 300;
|
|
||||||
|
|
||||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
|
||||||
evas_object_show(esw->base_obj);
|
|
||||||
|
|
||||||
e_popup_show(esw->popup);
|
|
||||||
|
|
||||||
appwins = eina_list_append(appwins, esw);
|
|
||||||
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_e_appwin_cb_mouse_up, esw));
|
|
||||||
|
|
||||||
e_object_del_attach_func_set(E_OBJECT(esw), _e_appwin_object_del_attach);
|
|
||||||
|
|
||||||
return esw;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_appwin_show(E_Appwin *esw)
|
|
||||||
{
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
Eina_List *borders, *l;
|
|
||||||
Win_Entry *ent;
|
|
||||||
int i, selnum;
|
|
||||||
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_APPWIN_TYPE);
|
|
||||||
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
borders = e_border_client_list();
|
|
||||||
selnum = -1;
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
for (i = 0, l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
Evas_Object *ic;
|
|
||||||
const char *title;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
if ((!bd->client.icccm.accepts_focus) &&
|
|
||||||
(!bd->client.icccm.take_focus)) continue;
|
|
||||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
||||||
if (bd->user_skip_winlist) continue;
|
|
||||||
|
|
||||||
e_object_ref(E_OBJECT(bd));
|
|
||||||
title = "???";
|
|
||||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
|
||||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
|
||||||
ic = e_border_icon_add(bd, esw->popup->evas);
|
|
||||||
ent = calloc(1, sizeof(Win_Entry));
|
|
||||||
ent->appwin = esw;
|
|
||||||
ent->border = bd;
|
|
||||||
ent->icon = ic;
|
|
||||||
esw->borders = eina_list_append(esw->borders, ent);
|
|
||||||
e_widget_ilist_append(esw->ilist_obj, ic, title, _e_appwin_cb_item_sel, ent, NULL);
|
|
||||||
if (bd == e_border_focused_get()) selnum = i;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
if (selnum >= 0) e_widget_ilist_selected_set(esw->ilist_obj, selnum);
|
|
||||||
|
|
||||||
e_widget_ilist_go(esw->ilist_obj);
|
|
||||||
|
|
||||||
e_widget_ilist_preferred_size_get(esw->ilist_obj, &mw, &mh);
|
|
||||||
if (mh < (120 *e_scale)) mh = 120 * e_scale;
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, mw, mh);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, 0, 0);
|
|
||||||
|
|
||||||
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
mw = esw->zone->w;
|
|
||||||
if (mh > esw->zone->h) mh = esw->zone->h;
|
|
||||||
e_popup_resize(esw->popup, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
|
|
||||||
_e_appwin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_appwin_hide(E_Appwin *esw)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_APPWIN_TYPE);
|
|
||||||
|
|
||||||
_e_appwin_slide(esw, 0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_appwin_border_select_callback_set(E_Appwin *esw, void (*func) (void *data, E_Appwin *ess, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_APPWIN_TYPE);
|
|
||||||
esw->callback.func = func;
|
|
||||||
esw->callback.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_appwin_free(E_Appwin *esw)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
appwins = eina_list_remove(appwins, esw);
|
|
||||||
EINA_LIST_FREE(esw->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
if (esw->animator) ecore_animator_del(esw->animator);
|
|
||||||
if (esw->themedir) eina_stringshare_del(esw->themedir);
|
|
||||||
ecore_x_window_free(esw->clickwin);
|
|
||||||
e_object_del(E_OBJECT(esw->popup));
|
|
||||||
free(esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_appwin_cb_animate(void *data)
|
|
||||||
{
|
|
||||||
E_Appwin *esw;
|
|
||||||
double t, v;
|
|
||||||
|
|
||||||
esw = data;
|
|
||||||
t = ecore_loop_time_get() - esw->start;
|
|
||||||
if (t > esw->len) t = esw->len;
|
|
||||||
v = t / esw->len;
|
|
||||||
v = 1.0 - v;
|
|
||||||
v = v * v * v * v;
|
|
||||||
v = 1.0 - v;
|
|
||||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
|
||||||
e_popup_move(esw->popup,
|
|
||||||
esw->zone->x,
|
|
||||||
esw->zone->y + esw->zone->h - esw->adjust);
|
|
||||||
if (t == esw->len)
|
|
||||||
{
|
|
||||||
esw->animator = NULL;
|
|
||||||
if (esw->out)
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_appwin_slide(E_Appwin *esw, int out, double len)
|
|
||||||
{
|
|
||||||
if (out == esw->out) return;
|
|
||||||
if (len == 0.0) len = 0.000001; /* FIXME: handle len = 0.0 case */
|
|
||||||
|
|
||||||
if (!esw->animator)
|
|
||||||
esw->animator = ecore_animator_add(_e_appwin_cb_animate, esw);
|
|
||||||
esw->start = ecore_loop_time_get();
|
|
||||||
esw->len = len;
|
|
||||||
esw->out = out;
|
|
||||||
esw->adjust_start = esw->adjust;
|
|
||||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
|
||||||
else esw->adjust_target = 0;
|
|
||||||
if (esw->out)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
ecore_x_window_show(esw->clickwin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
|
||||||
ecore_x_window_hide(esw->clickwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_appwin_cb_mouse_up(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
E_Appwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (ev->window == esw->clickwin)
|
|
||||||
{
|
|
||||||
if (esw->out) _e_appwin_slide(esw, 0, 1.0);
|
|
||||||
else _e_appwin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static Eina_Bool
|
|
||||||
_e_appwin_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Appwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
// FIXME: handle new size pants
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_appwin_cb_zone_del(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Del *ev;
|
|
||||||
E_Appwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
e_object_del(E_OBJECT(esw));
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_appwin_event_simple_free(void *data __UNUSED__, void *ev)
|
|
||||||
{
|
|
||||||
struct _E_Event_Appwin_Simple *e;
|
|
||||||
|
|
||||||
e = ev;
|
|
||||||
e_object_unref(E_OBJECT(e->appwin));
|
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_appwin_object_del_attach(void *o)
|
|
||||||
{
|
|
||||||
E_Appwin *esw;
|
|
||||||
// E_Event_Appwin_Del *ev;
|
|
||||||
|
|
||||||
if (e_object_is_del(E_OBJECT(o))) return;
|
|
||||||
esw = o;
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
/* ev = calloc(1, sizeof(E_Event_Appwin_Del)); */
|
|
||||||
/* ev->appwin = esw; */
|
|
||||||
/* e_object_ref(E_OBJECT(esw)); */
|
|
||||||
/* fprintf(stderr, "event add E_EVENT_APPWIN_DEL\n"); */
|
|
||||||
/* ecore_event_add(E_EVENT_APPWIN_DEL, ev, */
|
|
||||||
/* _e_appwin_event_simple_free, NULL); */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_appwin_cb_item_sel(void *data)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = data;
|
|
||||||
if (ent->appwin->callback.func)
|
|
||||||
ent->appwin->callback.func(ent->appwin->callback.data, ent->appwin, ent->border);
|
|
||||||
e_appwin_hide(ent->appwin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
#ifndef E_APPWIN_H
|
|
||||||
#define E_APPWIN_H
|
|
||||||
|
|
||||||
typedef struct _E_Appwin E_Appwin;
|
|
||||||
typedef struct _E_Event_Appwin_Simple E_Event_Appwin_Del;
|
|
||||||
|
|
||||||
#define E_APPWIN_TYPE 0xE1b0983
|
|
||||||
|
|
||||||
struct _E_Appwin
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
E_Popup *popup;
|
|
||||||
Ecore_X_Window clickwin;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Evas_Object *ilist_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
E_Border *focused_border;
|
|
||||||
Eina_List *borders;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data, E_Appwin *ess, E_Border *bd);
|
|
||||||
void *data;
|
|
||||||
} callback;
|
|
||||||
const char *themedir;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
int adjust_start;
|
|
||||||
int adjust_target;
|
|
||||||
int adjust;
|
|
||||||
double start;
|
|
||||||
double len;
|
|
||||||
unsigned char out : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Appwin_Simple
|
|
||||||
{
|
|
||||||
E_Appwin *appwin;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_appwin_init(void);
|
|
||||||
EAPI int e_appwin_shutdown(void);
|
|
||||||
EAPI E_Appwin *e_appwin_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI void e_appwin_show(E_Appwin *esw);
|
|
||||||
EAPI void e_appwin_hide(E_Appwin *esw);
|
|
||||||
EAPI void e_appwin_border_select_callback_set(E_Appwin *esw, void (*func) (void *data, E_Appwin *ess, E_Border *bd), void *data);
|
|
||||||
|
|
||||||
extern EAPI int E_EVENT_APPWIN_DEL;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,167 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_busycover.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
#include "e_slipshelf.h"
|
|
||||||
|
|
||||||
// FIXME: make code work - place busycover in safe area
|
|
||||||
// FIXME: make theme for it
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Busycover *_e_busycover_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_busycover_free(E_Busycover *esw);
|
|
||||||
static Eina_Bool _e_busycover_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
//static void _e_busycover_cb_item_sel(void *data, void *data2);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *busycovers = NULL;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_busycover_add_object(E_Busycover *esw)
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
|
||||||
|
|
||||||
esw->base_obj = _theme_obj_new(esw->zone->container->bg_evas,
|
|
||||||
esw->themedir,
|
|
||||||
"e/modules/busycover/default");
|
|
||||||
edje_object_part_text_set(esw->base_obj, "e.text.title", "LOADING");
|
|
||||||
e_slipshelf_safe_app_region_get(esw->zone, &x, &y, &w, &h);
|
|
||||||
evas_object_move(esw->base_obj, x, y);
|
|
||||||
evas_object_resize(esw->base_obj, w, h);
|
|
||||||
evas_object_layer_set(esw->base_obj, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_busycover_init(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_busycover_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Busycover *
|
|
||||||
e_busycover_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Busycover *esw;
|
|
||||||
|
|
||||||
esw = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_free);
|
|
||||||
if (!esw) return NULL;
|
|
||||||
|
|
||||||
esw->zone = zone;
|
|
||||||
if (themedir) esw->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
busycovers = eina_list_append(busycovers, esw);
|
|
||||||
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
|
||||||
_e_busycover_cb_zone_move_resize, esw));
|
|
||||||
|
|
||||||
return esw;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Busycover_Handle *
|
|
||||||
e_busycover_push(E_Busycover *esw, const char *message, const char *icon)
|
|
||||||
{
|
|
||||||
E_Busycover_Handle *h;
|
|
||||||
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYCOVER_TYPE, NULL);
|
|
||||||
if (!esw->base_obj) _e_busycover_add_object(esw);
|
|
||||||
h = calloc(1, sizeof(E_Busycover_Handle));
|
|
||||||
h->busycover = esw;
|
|
||||||
if (message) h->message = eina_stringshare_add(message);
|
|
||||||
if (icon) h->icon = eina_stringshare_add(icon);
|
|
||||||
esw->handles = eina_list_prepend(esw->handles, h);
|
|
||||||
edje_object_part_text_set(esw->base_obj, "e.text.label", h->message);
|
|
||||||
/* FIXME: handle icon... */
|
|
||||||
evas_object_show(esw->base_obj);
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_BUSYCOVER_TYPE);
|
|
||||||
if (!eina_list_data_find(esw->handles, handle)) return;
|
|
||||||
esw->handles = eina_list_remove(esw->handles, handle);
|
|
||||||
if (handle->message) eina_stringshare_del(handle->message);
|
|
||||||
if (handle->icon) eina_stringshare_del(handle->icon);
|
|
||||||
free(handle);
|
|
||||||
if (esw->handles)
|
|
||||||
{
|
|
||||||
handle = esw->handles->data;
|
|
||||||
edje_object_part_text_set(esw->base_obj, "e.text.label",
|
|
||||||
handle->message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_object_del(esw->base_obj);
|
|
||||||
esw->base_obj = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_busycover_free(E_Busycover *esw)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
if (esw->base_obj) evas_object_del(esw->base_obj);
|
|
||||||
busycovers = eina_list_remove(busycovers, esw);
|
|
||||||
EINA_LIST_FREE(esw->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
if (esw->themedir) eina_stringshare_del(esw->themedir);
|
|
||||||
free(esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_busycover_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Busycover *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
|
||||||
|
|
||||||
e_slipshelf_safe_app_region_get(esw->zone, &x, &y, &w, &h);
|
|
||||||
evas_object_move(esw->base_obj, x, y);
|
|
||||||
evas_object_resize(esw->base_obj, w, h);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
#ifndef E_BUSYCOVER_H
|
|
||||||
#define E_BUSYCOVER_H
|
|
||||||
|
|
||||||
typedef struct _E_Busycover E_Busycover;
|
|
||||||
typedef struct _E_Busycover_Handle E_Busycover_Handle;
|
|
||||||
typedef struct _E_Event_Busycover_Simple E_Event_Busycover_Del;
|
|
||||||
|
|
||||||
#define E_BUSYCOVER_TYPE 0xE1b0782
|
|
||||||
|
|
||||||
struct _E_Busycover
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
const char *themedir;
|
|
||||||
Eina_List *handles;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Busycover_Handle
|
|
||||||
{
|
|
||||||
E_Busycover *busycover;
|
|
||||||
const char *message;
|
|
||||||
const char *icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Busycover_Simple
|
|
||||||
{
|
|
||||||
E_Busycover *busycover;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_busycover_init(void);
|
|
||||||
EAPI int e_busycover_shutdown(void);
|
|
||||||
EAPI E_Busycover *e_busycover_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI E_Busycover_Handle *e_busycover_push(E_Busycover *esw, const char *message, const char *icon);
|
|
||||||
EAPI void e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,278 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_busywin.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Busywin *_e_busywin_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_busywin_free(E_Busywin *esw);
|
|
||||||
static Eina_Bool _e_busywin_cb_animate(void *data);
|
|
||||||
static void _e_busywin_slide(E_Busywin *esw, int out, double len);
|
|
||||||
static Eina_Bool _e_busywin_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _e_busywin_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *busywins = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_busywin_init(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_busywin_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Busywin *
|
|
||||||
e_busywin_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Busywin *esw;
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
esw = E_OBJECT_ALLOC(E_Busywin, E_BUSYWIN_TYPE, _e_busywin_free);
|
|
||||||
if (!esw) return NULL;
|
|
||||||
|
|
||||||
esw->zone = zone;
|
|
||||||
if (themedir) esw->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y, zone->w, zone->h);
|
|
||||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
e_popup_layer_set(esw->popup, 250);
|
|
||||||
|
|
||||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
|
||||||
esw->themedir,
|
|
||||||
"e/modules/busywin/base/default");
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
x = zone->x;
|
|
||||||
y = zone->y + zone->h;
|
|
||||||
mw = zone->w;
|
|
||||||
|
|
||||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
|
||||||
evas_object_show(esw->base_obj);
|
|
||||||
|
|
||||||
e_popup_show(esw->popup);
|
|
||||||
|
|
||||||
busywins = eina_list_append(busywins, esw);
|
|
||||||
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_e_busywin_cb_mouse_up, esw));
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
|
||||||
_e_busywin_cb_zone_move_resize, esw));
|
|
||||||
|
|
||||||
return esw;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Busywin_Handle *
|
|
||||||
e_busywin_push(E_Busywin *esw, const char *message, const char *icon)
|
|
||||||
{
|
|
||||||
E_Busywin_Handle *h;
|
|
||||||
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYWIN_TYPE, NULL);
|
|
||||||
h = calloc(1, sizeof(E_Busywin_Handle));
|
|
||||||
h->busywin = esw;
|
|
||||||
if (message) h->message = eina_stringshare_add(message);
|
|
||||||
if (icon) h->icon = eina_stringshare_add(icon);
|
|
||||||
esw->handles = eina_list_prepend(esw->handles, h);
|
|
||||||
edje_object_part_text_set(esw->base_obj, "e.text.label", h->message);
|
|
||||||
/* FIXME: handle icon... */
|
|
||||||
_e_busywin_slide(esw, 1, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_busywin_pop(E_Busywin *esw, E_Busywin_Handle *handle)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_BUSYWIN_TYPE);
|
|
||||||
if (!eina_list_data_find(esw->handles, handle)) return;
|
|
||||||
esw->handles = eina_list_remove(esw->handles, handle);
|
|
||||||
if (handle->message) eina_stringshare_del(handle->message);
|
|
||||||
if (handle->icon) eina_stringshare_del(handle->icon);
|
|
||||||
free(handle);
|
|
||||||
if (esw->handles)
|
|
||||||
{
|
|
||||||
handle = esw->handles->data;
|
|
||||||
edje_object_part_text_set(esw->base_obj, "e.text.label",
|
|
||||||
handle->message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_e_busywin_slide(esw, 0, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_busywin_free(E_Busywin *esw)
|
|
||||||
{
|
|
||||||
busywins = eina_list_remove(busywins, esw);
|
|
||||||
while (esw->handlers)
|
|
||||||
{
|
|
||||||
if (esw->handlers->data)
|
|
||||||
ecore_event_handler_del(esw->handlers->data);
|
|
||||||
esw->handlers = eina_list_remove_list(esw->handlers, esw->handlers);
|
|
||||||
}
|
|
||||||
if (esw->animator) ecore_animator_del(esw->animator);
|
|
||||||
if (esw->themedir) eina_stringshare_del(esw->themedir);
|
|
||||||
ecore_x_window_free(esw->clickwin);
|
|
||||||
e_object_del(E_OBJECT(esw->popup));
|
|
||||||
free(esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_busywin_cb_animate(void *data)
|
|
||||||
{
|
|
||||||
E_Busywin *esw;
|
|
||||||
double t, v;
|
|
||||||
|
|
||||||
esw = data;
|
|
||||||
t = ecore_loop_time_get() - esw->start;
|
|
||||||
if (t > esw->len) t = esw->len;
|
|
||||||
if (esw->len > 0.0)
|
|
||||||
{
|
|
||||||
v = t / esw->len;
|
|
||||||
v = 1.0 - v;
|
|
||||||
v = v * v * v * v;
|
|
||||||
v = 1.0 - v;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t = esw->len;
|
|
||||||
v = 1.0;
|
|
||||||
}
|
|
||||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
|
||||||
e_popup_move(esw->popup,
|
|
||||||
esw->zone->x,
|
|
||||||
esw->zone->y + esw->zone->h - esw->adjust);
|
|
||||||
if (t == esw->len)
|
|
||||||
{
|
|
||||||
esw->animator = NULL;
|
|
||||||
if (esw->out)
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
|
||||||
else
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_busywin_slide(E_Busywin *esw, int out, double len)
|
|
||||||
{
|
|
||||||
if (out == esw->out) return;
|
|
||||||
esw->start = ecore_loop_time_get();
|
|
||||||
esw->len = len;
|
|
||||||
esw->out = out;
|
|
||||||
esw->adjust_start = esw->adjust;
|
|
||||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
|
||||||
else esw->adjust_target = 0;
|
|
||||||
if (esw->out)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
// ecore_x_window_show(esw->clickwin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
|
||||||
// ecore_x_window_hide(esw->clickwin);
|
|
||||||
}
|
|
||||||
if (len <= 0.0)
|
|
||||||
{
|
|
||||||
_e_busywin_cb_animate(esw);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!esw->animator)
|
|
||||||
esw->animator = ecore_animator_add(_e_busywin_cb_animate, esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_busywin_cb_mouse_up(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
E_Busywin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (ev->window == esw->clickwin)
|
|
||||||
{
|
|
||||||
if (esw->out) _e_busywin_slide(esw, 0, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
|
||||||
else _e_busywin_slide(esw, 1, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_busywin_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Busywin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
e_popup_move_resize(esw->popup,
|
|
||||||
esw->zone->x,
|
|
||||||
esw->zone->y + esw->zone->h - esw->adjust,
|
|
||||||
esw->zone->w, esw->popup->h);
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#ifndef E_BUSYWIN_H
|
|
||||||
#define E_BUSYWIN_H
|
|
||||||
|
|
||||||
typedef struct _E_Busywin E_Busywin;
|
|
||||||
typedef struct _E_Busywin_Handle E_Busywin_Handle;
|
|
||||||
typedef struct _E_Event_Busywin_Simple E_Event_Busywin_Del;
|
|
||||||
|
|
||||||
#define E_BUSYWIN_TYPE 0xE1b0976
|
|
||||||
|
|
||||||
struct _E_Busywin
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
const char *themedir;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
Eina_List *handles;
|
|
||||||
Ecore_X_Window clickwin;
|
|
||||||
int adjust_start;
|
|
||||||
int adjust_target;
|
|
||||||
int adjust;
|
|
||||||
double start;
|
|
||||||
double len;
|
|
||||||
unsigned char out : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Busywin_Handle
|
|
||||||
{
|
|
||||||
E_Busywin *busywin;
|
|
||||||
const char *message;
|
|
||||||
const char *icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Busywin_Simple
|
|
||||||
{
|
|
||||||
E_Busywin *busywin;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_busywin_init(void);
|
|
||||||
EAPI int e_busywin_shutdown(void);
|
|
||||||
EAPI E_Busywin *e_busywin_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI E_Busywin_Handle *e_busywin_push(E_Busywin *esw, const char *message, const char *icon);
|
|
||||||
EAPI void e_busywin_pop(E_Busywin *esw, E_Busywin_Handle *handle);
|
|
||||||
|
|
||||||
extern EAPI int E_EVENT_BUSYWIN_DEL;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,73 +0,0 @@
|
||||||
#ifndef E_CFG_H
|
|
||||||
#define E_CFG_H
|
|
||||||
|
|
||||||
#define ILLUME_CONFIG_MIN 3
|
|
||||||
#define ILLUME_CONFIG_MAJ 0
|
|
||||||
|
|
||||||
typedef struct _Illume_Cfg Illume_Cfg;
|
|
||||||
|
|
||||||
struct _Illume_Cfg
|
|
||||||
{
|
|
||||||
int config_version;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int mode;
|
|
||||||
int icon_size;
|
|
||||||
int single_click;
|
|
||||||
int single_click_delay;
|
|
||||||
} launcher;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int auto_suspend;
|
|
||||||
int auto_suspend_delay;
|
|
||||||
} power;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int cache_level; // DOME?
|
|
||||||
int fps;
|
|
||||||
} performance;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int main_gadget_size;
|
|
||||||
int extra_gagdet_size;
|
|
||||||
int style;
|
|
||||||
} slipshelf;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
struct {
|
|
||||||
int duration;
|
|
||||||
} slipshelf, kbd, busywin, layout;
|
|
||||||
} sliding;
|
|
||||||
|
|
||||||
// FIXME: save/load these up minor version for this and init...
|
|
||||||
struct {
|
|
||||||
int use_internal;
|
|
||||||
const char *run_keyboard;
|
|
||||||
const char *dict;
|
|
||||||
double fuzz_mul; // NEW
|
|
||||||
int ignore_auto_kbd; // NEW
|
|
||||||
int ignore_auto_type; // NEW
|
|
||||||
int ignore_auto_lang; // NEW
|
|
||||||
int ignore_hardware_keyboards; // NEW
|
|
||||||
int force_no_dict; // NEW
|
|
||||||
const char *layout; // NEW
|
|
||||||
} kbd;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_cfg_init(E_Module *m);
|
|
||||||
EAPI int e_cfg_shutdown(void);
|
|
||||||
|
|
||||||
EAPI int e_cfg_save(void);
|
|
||||||
|
|
||||||
EAPI void e_cfg_launcher(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_power(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_animation(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_slipshelf(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_thumbscroll(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_fps(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_gadgets(E_Container *con, const char *params);
|
|
||||||
EAPI void e_cfg_keyboard(E_Container *con, const char *params);
|
|
||||||
|
|
||||||
extern EAPI Illume_Cfg *illume_cfg;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,299 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_flaunch.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_flaunch_cb_button_select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Flaunch_App *fla;
|
|
||||||
|
|
||||||
fla = data;
|
|
||||||
if (fla->callback.func) fla->callback.func((void *)fla->callback.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Flaunch_App *
|
|
||||||
_e_fluanch_button_add(E_Flaunch *fl, const char *label, int expander, void (*func) (void *data), const void *data)
|
|
||||||
{
|
|
||||||
E_Flaunch_App *fla;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
fla = E_NEW(E_Flaunch_App, 1);
|
|
||||||
if (!fla) return NULL;
|
|
||||||
if (expander)
|
|
||||||
o = _theme_obj_new(fl->zone->container->bg_evas,
|
|
||||||
fl->themedir,
|
|
||||||
"e/modules/flaunch/button/default");
|
|
||||||
else
|
|
||||||
o = _theme_obj_new(fl->zone->container->bg_evas,
|
|
||||||
fl->themedir,
|
|
||||||
"e/modules/flaunch/button/start");
|
|
||||||
edje_object_part_text_set(o, "e.text.label", label);
|
|
||||||
fla->flaunch = fl;
|
|
||||||
fla->obj = o;
|
|
||||||
fla->callback.func = func;
|
|
||||||
if (!data) data = fla;
|
|
||||||
fla->callback.data = data;
|
|
||||||
edje_object_signal_callback_add(o, "e,action,do,select", "",
|
|
||||||
_e_flaunch_cb_button_select, fla);
|
|
||||||
return fla;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_flaunch_button_del(E_Flaunch_App *fla)
|
|
||||||
{
|
|
||||||
evas_object_del(fla->obj);
|
|
||||||
if (fla->desktop) eina_stringshare_del(fla->desktop);
|
|
||||||
free(fla);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_fluanch_cb_app_button(void *data)
|
|
||||||
{
|
|
||||||
E_Flaunch_App *fla;
|
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
|
|
||||||
fla = data;
|
|
||||||
if (!fla->desktop) return;
|
|
||||||
desktop = efreet_util_desktop_file_id_find(fla->desktop);
|
|
||||||
if (!desktop) return;
|
|
||||||
if (fla->flaunch->desktop_run_func) fla->flaunch->desktop_run_func(desktop);
|
|
||||||
efreet_desktop_free(desktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Flaunch_App *
|
|
||||||
_e_flaunch_app_add(E_Flaunch *fl, const char *deskfile)
|
|
||||||
{
|
|
||||||
E_Flaunch_App *fla;
|
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
const char *label = "";
|
|
||||||
|
|
||||||
desktop = efreet_util_desktop_file_id_find(deskfile);
|
|
||||||
if (desktop) label = desktop->name;
|
|
||||||
fla = _e_fluanch_button_add(fl, label, 1, _e_fluanch_cb_app_button, NULL);
|
|
||||||
if (deskfile) fla->desktop = eina_stringshare_add(deskfile);
|
|
||||||
fl->apps = eina_list_append(fl->apps, fla);
|
|
||||||
e_box_pack_end(fl->app_box_obj, fla->obj);
|
|
||||||
e_box_pack_options_set(fla->obj, 1, 1, 1, 1, 0.5, 0.5, 0, 0, 9999, 9999);
|
|
||||||
evas_object_show(fla->obj);
|
|
||||||
if (desktop) efreet_desktop_free(desktop);
|
|
||||||
return fla;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_flaunch_apps_clear(E_Flaunch *fl)
|
|
||||||
{
|
|
||||||
E_Flaunch_App *fla;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(fl->apps, fla)
|
|
||||||
_e_flaunch_button_del(fla);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_flaunch_apps_populate(E_Flaunch *fl)
|
|
||||||
{
|
|
||||||
Eina_List *bar_desktops;
|
|
||||||
Eina_List *l;
|
|
||||||
int num = 0, max, count;
|
|
||||||
|
|
||||||
// FIXME: 3 should become config here
|
|
||||||
max = 10;
|
|
||||||
// for now just look for any apps in "category" 'Bar' and add the first 3
|
|
||||||
// FIXME: category should be configurable...
|
|
||||||
bar_desktops = efreet_util_desktop_category_list("System");
|
|
||||||
if (bar_desktops)
|
|
||||||
{
|
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
printf("Have Desktops\n");
|
|
||||||
count = eina_list_count(bar_desktops);
|
|
||||||
if (count < max)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < (max - count) / 2; i++)
|
|
||||||
{
|
|
||||||
_e_flaunch_app_add(fl, "");
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EINA_LIST_FOREACH(bar_desktops, l, desktop)
|
|
||||||
{
|
|
||||||
printf("Desktop: %s\n", desktop->name);
|
|
||||||
if (desktop->orig_path)
|
|
||||||
{
|
|
||||||
const char *dname;
|
|
||||||
|
|
||||||
dname = ecore_file_file_get(desktop->orig_path);
|
|
||||||
if (dname)
|
|
||||||
{
|
|
||||||
_e_flaunch_app_add(fl, dname);
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num >= max) break;
|
|
||||||
}
|
|
||||||
EINA_LIST_FREE(bar_desktops, desktop)
|
|
||||||
efreet_desktop_free(desktop);
|
|
||||||
}
|
|
||||||
while (num < max)
|
|
||||||
{
|
|
||||||
_e_flaunch_app_add(fl, "");
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_fluanch_cb_home_button(void *data __UNUSED__)
|
|
||||||
{
|
|
||||||
printf("FIXME: this 'start' button has no defined behavior\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_flaunch_free(E_Flaunch *fl)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
if (fl->repopulate_timer) ecore_timer_del(fl->repopulate_timer);
|
|
||||||
_e_flaunch_apps_clear(fl);
|
|
||||||
_e_flaunch_button_del(fl->start_button);
|
|
||||||
eina_stringshare_del(fl->themedir);
|
|
||||||
evas_object_del(fl->app_box_obj);
|
|
||||||
evas_object_del(fl->box_obj);
|
|
||||||
EINA_LIST_FREE(fl->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
free(fl);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_flaunch_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Flaunch *fl;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
fl = data;
|
|
||||||
if (fl->zone == ev->zone)
|
|
||||||
{
|
|
||||||
evas_object_move(fl->box_obj, fl->zone->x, fl->zone->y + fl->zone->h - fl->height);
|
|
||||||
evas_object_resize(fl->box_obj, fl->zone->w, fl->height);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_flaunch_cb_delayed_repopulate(void *data)
|
|
||||||
{
|
|
||||||
E_Flaunch *fl;
|
|
||||||
|
|
||||||
fl = data;
|
|
||||||
_e_flaunch_apps_clear(fl);
|
|
||||||
_e_flaunch_apps_populate(fl);
|
|
||||||
fl->repopulate_timer = NULL;
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_flaunch_cb_cache_update(void *data, int type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Flaunch *fl;
|
|
||||||
|
|
||||||
fl = data;
|
|
||||||
if (fl->repopulate_timer) ecore_timer_del(fl->repopulate_timer);
|
|
||||||
fl->repopulate_timer =
|
|
||||||
ecore_timer_add(0.5, _e_flaunch_cb_delayed_repopulate, fl);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_flaunch_init(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_flaunch_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Flaunch *
|
|
||||||
e_flaunch_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Flaunch *fl;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
fl = E_OBJECT_ALLOC(E_Flaunch, E_FLAUNCH_TYPE, _e_flaunch_free);
|
|
||||||
if (!fl) return NULL;
|
|
||||||
fl->zone = zone;
|
|
||||||
|
|
||||||
fl->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
// FIXME: height should become config
|
|
||||||
fl->height = 30 * e_scale;
|
|
||||||
|
|
||||||
o = e_box_add(fl->zone->container->bg_evas);
|
|
||||||
e_box_orientation_set(o, 1);
|
|
||||||
e_box_homogenous_set(o, 0);
|
|
||||||
fl->box_obj = o;
|
|
||||||
|
|
||||||
fl->start_button = _e_fluanch_button_add(fl, "*", 0,
|
|
||||||
_e_fluanch_cb_home_button, fl);
|
|
||||||
e_box_pack_end(fl->box_obj, fl->start_button->obj);
|
|
||||||
e_box_pack_options_set(fl->start_button->obj, 1, 1, 0, 1, 0.5, 0.5, fl->height, 0, fl->height, 9999);
|
|
||||||
evas_object_show(fl->start_button->obj);
|
|
||||||
|
|
||||||
o = e_box_add(fl->zone->container->bg_evas);
|
|
||||||
e_box_orientation_set(o, 1);
|
|
||||||
e_box_homogenous_set(o, 1);
|
|
||||||
fl->app_box_obj = o;
|
|
||||||
|
|
||||||
e_box_pack_end(fl->box_obj, fl->app_box_obj);
|
|
||||||
e_box_pack_options_set(fl->app_box_obj, 1, 1, 1, 1, 0.5, 0.5, 0, 0, 9999, 9999);
|
|
||||||
|
|
||||||
_e_flaunch_apps_populate(fl);
|
|
||||||
|
|
||||||
evas_object_move(fl->box_obj, fl->zone->x, fl->zone->y + fl->zone->h - fl->height);
|
|
||||||
evas_object_resize(fl->box_obj, fl->zone->w, fl->height);
|
|
||||||
evas_object_show(fl->app_box_obj);
|
|
||||||
evas_object_layer_set(fl->box_obj, 10);
|
|
||||||
evas_object_show(fl->box_obj);
|
|
||||||
|
|
||||||
fl->handlers = eina_list_append
|
|
||||||
(fl->handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_ZONE_MOVE_RESIZE, _e_flaunch_cb_zone_move_resize, fl));
|
|
||||||
fl->handlers = eina_list_append
|
|
||||||
(fl->handlers, ecore_event_handler_add
|
|
||||||
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _e_flaunch_cb_cache_update, fl));
|
|
||||||
|
|
||||||
return fl;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_flaunch_desktop_exec_callback_set(E_Flaunch *fl, void (*func) (Efreet_Desktop *desktop))
|
|
||||||
{
|
|
||||||
fl->desktop_run_func = func;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
#ifndef E_FLAUNCH_H
|
|
||||||
#define E_FLAUNCH_H
|
|
||||||
|
|
||||||
typedef struct _E_Flaunch E_Flaunch;
|
|
||||||
typedef struct _E_Flaunch_App E_Flaunch_App;
|
|
||||||
|
|
||||||
#define E_FLAUNCH_TYPE 0xE1b7274
|
|
||||||
|
|
||||||
struct _E_Flaunch
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
int height;
|
|
||||||
const char *themedir;
|
|
||||||
Evas_Object *box_obj, *app_box_obj;
|
|
||||||
Eina_List *apps;
|
|
||||||
E_Flaunch_App *start_button;
|
|
||||||
E_Zone *zone;
|
|
||||||
void (*desktop_run_func) (Efreet_Desktop *desktop);
|
|
||||||
Ecore_Event_Handler *zone_resize_handler;
|
|
||||||
Eina_List *handlers;
|
|
||||||
Ecore_Timer *repopulate_timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Flaunch_App
|
|
||||||
{
|
|
||||||
E_Flaunch *flaunch;
|
|
||||||
Evas_Object *obj;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data);
|
|
||||||
const void *data;
|
|
||||||
} callback;
|
|
||||||
const char *desktop;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_flaunch_init(void);
|
|
||||||
EAPI int e_flaunch_shutdown(void);
|
|
||||||
EAPI E_Flaunch *e_flaunch_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI void e_flaunch_desktop_exec_callback_set(E_Flaunch *fl, void (*func) (Efreet_Desktop *desktop));
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,53 +0,0 @@
|
||||||
#ifndef E_KBD_H
|
|
||||||
#define E_KBD_H
|
|
||||||
|
|
||||||
typedef struct _E_Kbd E_Kbd;
|
|
||||||
|
|
||||||
#define E_KBD_TYPE 0xE1b0988
|
|
||||||
|
|
||||||
typedef enum _E_Kbd_Layout
|
|
||||||
{
|
|
||||||
E_KBD_LAYOUT_NONE,
|
|
||||||
E_KBD_LAYOUT_DEFAULT,
|
|
||||||
E_KBD_LAYOUT_ALPHA,
|
|
||||||
E_KBD_LAYOUT_NUMERIC,
|
|
||||||
E_KBD_LAYOUT_PIN,
|
|
||||||
E_KBD_LAYOUT_PHONE_NUMBER,
|
|
||||||
E_KBD_LAYOUT_HEX,
|
|
||||||
E_KBD_LAYOUT_TERMINAL,
|
|
||||||
E_KBD_LAYOUT_PASSWORD
|
|
||||||
} E_Kbd_Layout;
|
|
||||||
|
|
||||||
struct _E_Kbd
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Win *win;
|
|
||||||
E_Border *border;
|
|
||||||
Ecore_Timer *delay_hide;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
Eina_List *waiting_borders;
|
|
||||||
E_Kbd_Layout layout;
|
|
||||||
double start, len;
|
|
||||||
|
|
||||||
int h;
|
|
||||||
int adjust_start, adjust, adjust_end;
|
|
||||||
|
|
||||||
unsigned char visible : 1;
|
|
||||||
unsigned char actually_visible : 1;
|
|
||||||
unsigned char disabled : 1; // if we have a real kbd plugged in
|
|
||||||
unsigned char fullscreen : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_kbd_init(E_Module *m);
|
|
||||||
EAPI int e_kbd_shutdown(void);
|
|
||||||
|
|
||||||
EAPI E_Kbd *e_kbd_new(E_Zone *zone, const char *themedir, const char *syskbds, const char *sysdicts);
|
|
||||||
EAPI void e_kbd_enable(E_Kbd *kbd);
|
|
||||||
EAPI void e_kbd_disable(E_Kbd *kbd);
|
|
||||||
EAPI void e_kbd_show(E_Kbd *kbd);
|
|
||||||
EAPI void e_kbd_layout_set(E_Kbd *kbd, E_Kbd_Layout layout);
|
|
||||||
EAPI void e_kbd_hide(E_Kbd *kbd);
|
|
||||||
EAPI void e_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
|
||||||
EAPI void e_kbd_fullscreen_set(E_Zone *zone, int fullscreen);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,572 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_kbd_buf.h"
|
|
||||||
#include "e_kbd_dict.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
|
|
||||||
static E_Kbd_Buf_Layout *
|
|
||||||
_e_kbd_buf_new(void)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Layout *kbl;
|
|
||||||
|
|
||||||
kbl = E_NEW(E_Kbd_Buf_Layout, 1);
|
|
||||||
kbl->ref =1;
|
|
||||||
return kbl;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_layout_ref(E_Kbd_Buf_Layout *kbl)
|
|
||||||
{
|
|
||||||
kbl->ref++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_layout_unref(E_Kbd_Buf_Layout *kbl)
|
|
||||||
{
|
|
||||||
kbl->ref--;
|
|
||||||
if (kbl->ref > 0) return;
|
|
||||||
while (kbl->keys)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
|
|
||||||
ky = kbl->keys->data;
|
|
||||||
if (ky->key) eina_stringshare_del(ky->key);
|
|
||||||
if (ky->key_shift) eina_stringshare_del(ky->key_shift);
|
|
||||||
if (ky->key_capslock) eina_stringshare_del(ky->key_capslock);
|
|
||||||
free(ky);
|
|
||||||
kbl->keys = eina_list_remove_list(kbl->keys, kbl->keys);
|
|
||||||
}
|
|
||||||
free(kbl);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_string_matches_clear(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
while (kb->string_matches)
|
|
||||||
{
|
|
||||||
if (kb->string_matches->data)
|
|
||||||
eina_stringshare_del(kb->string_matches->data);
|
|
||||||
kb->string_matches = eina_list_remove_list(kb->string_matches, kb->string_matches);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_actual_string_clear(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
if (kb->actual_string) eina_stringshare_del(kb->actual_string);
|
|
||||||
kb->actual_string = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Kbd_Buf_Key *
|
|
||||||
_e_kbd_buf_at_coord_get(E_Kbd_Buf *kb __UNUSED__, E_Kbd_Buf_Layout *kbl, int x, int y)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = kbl->keys; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
|
|
||||||
ky = l->data;
|
|
||||||
if (ky->key)
|
|
||||||
{
|
|
||||||
if ((x >= ky->x) && (y >= ky->y) &&
|
|
||||||
(x < (ky->x + ky->w)) && (y < (ky->y + ky->h)))
|
|
||||||
return ky;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Kbd_Buf_Key *
|
|
||||||
_e_kbd_buf_closest_get(E_Kbd_Buf *kb __UNUSED__, E_Kbd_Buf_Layout *kbl, int x, int y)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
E_Kbd_Buf_Key *ky_closest = NULL;
|
|
||||||
int dist_closest = 0x7fffffff;
|
|
||||||
|
|
||||||
for (l = kbl->keys; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
int dist, dx, dy;
|
|
||||||
|
|
||||||
ky = l->data;
|
|
||||||
if (ky->key)
|
|
||||||
{
|
|
||||||
dx = x - (ky->x + (ky->w / 2));
|
|
||||||
dy = y - (ky->y + (ky->h / 2));
|
|
||||||
dist = (dx * dx) + (dy * dy);
|
|
||||||
if (dist < dist_closest)
|
|
||||||
{
|
|
||||||
ky_closest = ky;
|
|
||||||
dist_closest = dist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ky_closest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_buf_keystroke_key_string_get(E_Kbd_Buf *kb __UNUSED__, E_Kbd_Buf_Keystroke *ks, E_Kbd_Buf_Key *ky)
|
|
||||||
{
|
|
||||||
const char *str = NULL;
|
|
||||||
|
|
||||||
if ((ky) && (ky->key))
|
|
||||||
{
|
|
||||||
if (ks->shift)
|
|
||||||
{
|
|
||||||
if (ky->key_shift) str = ky->key_shift;
|
|
||||||
else str = ky->key;
|
|
||||||
}
|
|
||||||
else if (ks->capslock)
|
|
||||||
{
|
|
||||||
if (ky->key_capslock) str = ky->key_capslock;
|
|
||||||
else str = ky->key;
|
|
||||||
}
|
|
||||||
else str = ky->key;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_buf_keystroke_string_get(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
|
||||||
{
|
|
||||||
const char *str = NULL;
|
|
||||||
|
|
||||||
if (ks->key) str = ks->key;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
|
|
||||||
ky = _e_kbd_buf_at_coord_get(kb, ks->layout, ks->x, ks->y);
|
|
||||||
if (!ky) ky = _e_kbd_buf_closest_get(kb, ks->layout, ks->x, ks->y);
|
|
||||||
str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_actual_string_update(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
char *actual = NULL;
|
|
||||||
int actual_len = 0;
|
|
||||||
int actual_size = 0;
|
|
||||||
|
|
||||||
_e_kbd_buf_actual_string_clear(kb);
|
|
||||||
for (l = kb->keystrokes; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Keystroke *ks;
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
ks = l->data;
|
|
||||||
str = _e_kbd_buf_keystroke_string_get(kb, ks);
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
if ((actual_len + strlen(str) + 1) > actual_size)
|
|
||||||
{
|
|
||||||
actual_size += 64;
|
|
||||||
actual = malloc(actual_size);
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(actual);
|
|
||||||
strcpy(actual, str);
|
|
||||||
}
|
|
||||||
actual_len += strlen(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (actual)
|
|
||||||
{
|
|
||||||
kb->actual_string = eina_stringshare_add(actual);
|
|
||||||
if (actual) free(actual);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_buf_matches_find(Eina_List *matches, const char *s)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = matches; l; l = l->next)
|
|
||||||
{
|
|
||||||
if (!strcmp(l->data, s)) return s;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_matches_update(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
const char *word;
|
|
||||||
int pri, i;
|
|
||||||
E_Kbd_Dict *dicts[3];
|
|
||||||
|
|
||||||
_e_kbd_buf_string_matches_clear(kb);
|
|
||||||
dicts[0] = kb->dict.personal;
|
|
||||||
dicts[1] = kb->dict.sys;
|
|
||||||
dicts[2] = kb->dict.data;
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (!dicts[i]) continue;
|
|
||||||
e_kbd_dict_matches_lookup(dicts[i]);
|
|
||||||
e_kbd_dict_matches_first(dicts[i]);
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
word = e_kbd_dict_matches_match_get(dicts[i], &pri);
|
|
||||||
if (!word) break;
|
|
||||||
if (!_e_kbd_buf_matches_find(kb->string_matches, word))
|
|
||||||
kb->string_matches = eina_list_append(kb->string_matches,
|
|
||||||
eina_stringshare_add(word));
|
|
||||||
e_kbd_dict_matches_next(dicts[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_kbd_buf_cb_data_dict_reload(void *data)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf *kb;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
kb = data;
|
|
||||||
kb->dict.data_reload_delay = NULL;
|
|
||||||
e_kbd_buf_clear(kb);
|
|
||||||
if (kb->dict.data) e_kbd_dict_free(kb->dict.data);
|
|
||||||
e_user_dir_concat_static(buf, "dicts-dynamic/data.dic");
|
|
||||||
kb->dict.data = e_kbd_dict_new(buf);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_cb_data_dict_change(void *data, Ecore_File_Monitor *em __UNUSED__, Ecore_File_Event event __UNUSED__, const char *path __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf *kb;
|
|
||||||
|
|
||||||
kb = data;
|
|
||||||
if (kb->dict.data_reload_delay) ecore_timer_del(kb->dict.data_reload_delay);
|
|
||||||
kb->dict.data_reload_delay = ecore_timer_add(2.0, _e_kbd_buf_cb_data_dict_reload, kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Kbd_Buf *
|
|
||||||
e_kbd_buf_new(const char *sysdicts, const char *dict)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf *kb;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
kb = E_NEW(E_Kbd_Buf, 1);
|
|
||||||
if (!kb) return NULL;
|
|
||||||
kb->sysdicts = eina_stringshare_add(sysdicts);
|
|
||||||
|
|
||||||
e_user_dir_concat_static(buf, "dicts");
|
|
||||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
|
||||||
|
|
||||||
e_user_dir_snprintf(buf, sizeof(buf), "dicts/%s", dict);
|
|
||||||
kb->dict.sys = e_kbd_dict_new(buf);
|
|
||||||
if (!kb->dict.sys)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict);
|
|
||||||
kb->dict.sys = e_kbd_dict_new(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
e_user_dir_concat_static(buf, "dicts-dynamic");
|
|
||||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
|
||||||
|
|
||||||
e_user_dir_concat_static(buf, "dicts-dynamic/personal.dic");
|
|
||||||
kb->dict.personal = e_kbd_dict_new(buf);
|
|
||||||
if (!kb->dict.personal)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
f = fopen(buf, "w");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
fprintf(f, "\n");
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
kb->dict.personal = e_kbd_dict_new(buf);
|
|
||||||
}
|
|
||||||
e_user_dir_concat_static(buf, "dicts-dynamic/data.dic");
|
|
||||||
kb->dict.data = e_kbd_dict_new(buf);
|
|
||||||
kb->dict.data_monitor =
|
|
||||||
ecore_file_monitor_add(buf, _e_kbd_buf_cb_data_dict_change, kb);
|
|
||||||
return kb;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_free(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
e_kbd_buf_clear(kb);
|
|
||||||
e_kbd_buf_layout_clear(kb);
|
|
||||||
e_kbd_buf_lookup_cancel(kb);
|
|
||||||
eina_stringshare_del(kb->sysdicts);
|
|
||||||
if (kb->dict.sys) e_kbd_dict_free(kb->dict.sys);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_free(kb->dict.personal);
|
|
||||||
if (kb->dict.data) e_kbd_dict_free(kb->dict.data);
|
|
||||||
if (kb->dict.data_monitor) ecore_file_monitor_del(kb->dict.data_monitor);
|
|
||||||
if (kb->dict.data_reload_delay) ecore_timer_del(kb->dict.data_reload_delay);
|
|
||||||
free(kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_dict_set(E_Kbd_Buf *kb, const char *dict)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
e_kbd_buf_clear(kb);
|
|
||||||
|
|
||||||
if (kb->dict.sys) e_kbd_dict_free(kb->dict.sys);
|
|
||||||
|
|
||||||
e_user_dir_concat_static(buf, "dicts");
|
|
||||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
|
||||||
|
|
||||||
e_user_dir_snprintf(buf, sizeof(buf), "dicts/%s", dict);
|
|
||||||
kb->dict.sys = e_kbd_dict_new(buf);
|
|
||||||
if (!kb->dict.sys)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict);
|
|
||||||
kb->dict.sys = e_kbd_dict_new(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_clear(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
e_kbd_buf_lookup_cancel(kb);
|
|
||||||
while (kb->keystrokes)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Keystroke *ks;
|
|
||||||
|
|
||||||
ks = kb->keystrokes->data;
|
|
||||||
if (ks->key) eina_stringshare_del(ks->key);
|
|
||||||
_e_kbd_buf_layout_unref(ks->layout);
|
|
||||||
free(ks);
|
|
||||||
kb->keystrokes = eina_list_remove_list(kb->keystrokes, kb->keystrokes);
|
|
||||||
}
|
|
||||||
_e_kbd_buf_string_matches_clear(kb);
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_clear(kb->dict.sys);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_clear(kb->dict.personal);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_clear(kb->dict.data);
|
|
||||||
_e_kbd_buf_actual_string_clear(kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_layout_clear(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
if (kb->layout)
|
|
||||||
{
|
|
||||||
_e_kbd_buf_layout_unref(kb->layout);
|
|
||||||
kb->layout = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_layout_size_set(E_Kbd_Buf *kb, int w, int h)
|
|
||||||
{
|
|
||||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
|
||||||
if (!kb->layout) return;
|
|
||||||
kb->layout->w = w;
|
|
||||||
kb->layout->h = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_layout_fuzz_set(E_Kbd_Buf *kb, int fuzz)
|
|
||||||
{
|
|
||||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
|
||||||
if (!kb->layout) return;
|
|
||||||
kb->layout->fuzz = fuzz;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_layout_key_add(E_Kbd_Buf *kb, const char *key, const char *key_shift, const char *key_capslock, int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
|
|
||||||
if (!key) return;
|
|
||||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
|
||||||
if (!kb->layout) return;
|
|
||||||
ky = E_NEW(E_Kbd_Buf_Key, 1);
|
|
||||||
if (!ky) return;
|
|
||||||
ky->key = eina_stringshare_add(key);
|
|
||||||
if (key_shift) ky->key_shift = eina_stringshare_add(key_shift);
|
|
||||||
if (key_capslock) ky->key_capslock = eina_stringshare_add(key_capslock);
|
|
||||||
ky->x = x;
|
|
||||||
ky->y = y;
|
|
||||||
ky->w = w;
|
|
||||||
ky->h = h;
|
|
||||||
kb->layout->keys = eina_list_append(kb->layout->keys, ky);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_keystroke_add(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
str = _e_kbd_buf_keystroke_string_get(kb, ks);
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, 0);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, 0);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_pressed_key_add(E_Kbd_Buf *kb, const char *key, int shift, int capslock)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Keystroke *ks;
|
|
||||||
|
|
||||||
e_kbd_buf_lookup_cancel(kb);
|
|
||||||
if (!key) return;
|
|
||||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
|
||||||
if (!kb->layout) return;
|
|
||||||
ks = E_NEW(E_Kbd_Buf_Keystroke, 1);
|
|
||||||
if (!ks) return;
|
|
||||||
ks->key = eina_stringshare_add(key);
|
|
||||||
if (shift) ks->shift = 1;
|
|
||||||
if (capslock) ks->capslock = 1;
|
|
||||||
ks->layout = kb->layout;
|
|
||||||
_e_kbd_buf_layout_ref(ks->layout);
|
|
||||||
kb->keystrokes = eina_list_append(kb->keystrokes, ks);
|
|
||||||
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_advance(kb->dict.sys);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_advance(kb->dict.personal);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_advance(kb->dict.data);
|
|
||||||
_e_kbd_buf_keystroke_add(kb, ks);
|
|
||||||
|
|
||||||
_e_kbd_buf_actual_string_update(kb);
|
|
||||||
_e_kbd_buf_matches_update(kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_buf_keystroke_point_add(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = ks->layout->keys; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Key *ky;
|
|
||||||
const char *str;
|
|
||||||
int px, py, dx, dy, d;
|
|
||||||
|
|
||||||
ky = l->data;
|
|
||||||
px = ky->x + (ky->w / 2);
|
|
||||||
py = ky->y + (ky->h / 2);
|
|
||||||
dx = ks->x - px;
|
|
||||||
dy = ks->y - py;
|
|
||||||
d = sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (d <= ks->layout->fuzz)
|
|
||||||
{
|
|
||||||
str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky);
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, d);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, d);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_pressed_point_add(E_Kbd_Buf *kb, int x, int y, int shift, int capslock)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Keystroke *ks;
|
|
||||||
|
|
||||||
e_kbd_buf_lookup_cancel(kb);
|
|
||||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
|
||||||
if (!kb->layout) return;
|
|
||||||
ks = E_NEW(E_Kbd_Buf_Keystroke, 1);
|
|
||||||
if (!ks) return;
|
|
||||||
ks->x = x;
|
|
||||||
ks->y = y;
|
|
||||||
if (shift) ks->shift = 1;
|
|
||||||
if (capslock) ks->capslock = 1;
|
|
||||||
ks->layout = kb->layout;
|
|
||||||
_e_kbd_buf_layout_ref(ks->layout);
|
|
||||||
kb->keystrokes = eina_list_append(kb->keystrokes, ks);
|
|
||||||
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_advance(kb->dict.sys);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_advance(kb->dict.personal);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_advance(kb->dict.data);
|
|
||||||
|
|
||||||
_e_kbd_buf_keystroke_point_add(kb, ks);
|
|
||||||
|
|
||||||
_e_kbd_buf_actual_string_update(kb);
|
|
||||||
_e_kbd_buf_matches_update(kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI const char *
|
|
||||||
e_kbd_buf_actual_string_get(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
return kb->actual_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI const Eina_List *
|
|
||||||
e_kbd_buf_string_matches_get(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
return kb->string_matches;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_backspace(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
l = eina_list_last(kb->keystrokes);
|
|
||||||
if (l)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf_Keystroke *ks;
|
|
||||||
|
|
||||||
ks = l->data;
|
|
||||||
if (ks->key) eina_stringshare_del(ks->key);
|
|
||||||
_e_kbd_buf_layout_unref(ks->layout);
|
|
||||||
free(ks);
|
|
||||||
kb->keystrokes = eina_list_remove_list(kb->keystrokes, l);
|
|
||||||
if (kb->dict.sys) e_kbd_dict_word_letter_delete(kb->dict.sys);
|
|
||||||
if (kb->dict.personal) e_kbd_dict_word_letter_delete(kb->dict.personal);
|
|
||||||
if (kb->dict.data) e_kbd_dict_word_letter_delete(kb->dict.data);
|
|
||||||
_e_kbd_buf_actual_string_update(kb);
|
|
||||||
_e_kbd_buf_matches_update(kb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_word_use(E_Kbd_Buf *kb, const char *word)
|
|
||||||
{
|
|
||||||
if (kb->dict.personal)
|
|
||||||
e_kbd_dict_word_usage_adjust(kb->dict.personal, word, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: just faking delayed lookup with timer
|
|
||||||
static Eina_Bool
|
|
||||||
_e_kbd_buf_cb_faket(void *data)
|
|
||||||
{
|
|
||||||
E_Kbd_Buf *kb;
|
|
||||||
|
|
||||||
kb = data;
|
|
||||||
kb->lookup.faket = NULL;
|
|
||||||
kb->lookup.func(kb->lookup.data);
|
|
||||||
kb->lookup.func = NULL;
|
|
||||||
kb->lookup.data = NULL;
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_lookup(E_Kbd_Buf *kb, void (*func) (void *data), void *data)
|
|
||||||
{
|
|
||||||
e_kbd_buf_lookup_cancel(kb);
|
|
||||||
|
|
||||||
kb->lookup.func = func;
|
|
||||||
kb->lookup.data = data;
|
|
||||||
|
|
||||||
// FIXME: just faking delayed lookup with timer
|
|
||||||
kb->lookup.faket = ecore_timer_add(0.1, _e_kbd_buf_cb_faket, kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_buf_lookup_cancel(E_Kbd_Buf *kb)
|
|
||||||
{
|
|
||||||
// FIXME: just faking delayed lookup with timer
|
|
||||||
if (!kb->lookup.faket) return;
|
|
||||||
ecore_timer_del(kb->lookup.faket);
|
|
||||||
kb->lookup.faket = NULL;
|
|
||||||
|
|
||||||
kb->lookup.func = NULL;
|
|
||||||
kb->lookup.data = NULL;
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
#ifndef E_KBD_BUF_H
|
|
||||||
#define E_KBD_BUF_H
|
|
||||||
|
|
||||||
#include "e_kbd_dict.h"
|
|
||||||
|
|
||||||
typedef struct _E_Kbd_Buf E_Kbd_Buf;
|
|
||||||
typedef struct _E_Kbd_Buf_Key E_Kbd_Buf_Key;
|
|
||||||
typedef struct _E_Kbd_Buf_Keystroke E_Kbd_Buf_Keystroke;
|
|
||||||
typedef struct _E_Kbd_Buf_Layout E_Kbd_Buf_Layout;
|
|
||||||
|
|
||||||
struct _E_Kbd_Buf
|
|
||||||
{
|
|
||||||
const char *sysdicts;
|
|
||||||
Eina_List *keystrokes;
|
|
||||||
Eina_List *string_matches;
|
|
||||||
const char *actual_string;
|
|
||||||
E_Kbd_Buf_Layout *layout;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data);
|
|
||||||
void *data;
|
|
||||||
// FIXME: just faking delayed lookup with timer
|
|
||||||
Ecore_Timer *faket;
|
|
||||||
} lookup;
|
|
||||||
struct {
|
|
||||||
E_Kbd_Dict *sys;
|
|
||||||
E_Kbd_Dict *personal;
|
|
||||||
E_Kbd_Dict *data;
|
|
||||||
Ecore_File_Monitor *data_monitor;
|
|
||||||
Ecore_Timer *data_reload_delay;
|
|
||||||
} dict;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Buf_Key
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
|
||||||
const char *key, *key_shift, *key_capslock;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Buf_Keystroke
|
|
||||||
{
|
|
||||||
const char *key;
|
|
||||||
int x, y;
|
|
||||||
E_Kbd_Buf_Layout *layout;
|
|
||||||
unsigned char shift : 1;
|
|
||||||
unsigned char capslock : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Buf_Layout {
|
|
||||||
int ref;
|
|
||||||
int w, h;
|
|
||||||
int fuzz;
|
|
||||||
Eina_List *keys;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI E_Kbd_Buf *e_kbd_buf_new(const char *sysdicts, const char *dicts);
|
|
||||||
EAPI void e_kbd_buf_free(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_dict_set(E_Kbd_Buf *kb, const char *dict);
|
|
||||||
EAPI void e_kbd_buf_clear(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_layout_clear(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_layout_size_set(E_Kbd_Buf *kb, int w, int h);
|
|
||||||
EAPI void e_kbd_buf_layout_fuzz_set(E_Kbd_Buf *kb, int fuzz);
|
|
||||||
EAPI void e_kbd_buf_layout_key_add(E_Kbd_Buf *kb, const char *key, const char *key_shift, const char *key_capslock, int x, int y, int w, int h);
|
|
||||||
EAPI void e_kbd_buf_pressed_key_add(E_Kbd_Buf *kb, const char *key, int shift, int capslock);
|
|
||||||
EAPI void e_kbd_buf_pressed_point_add(E_Kbd_Buf *kb, int x, int y, int shift, int capslock);
|
|
||||||
EAPI const char *e_kbd_buf_actual_string_get(E_Kbd_Buf *kb);
|
|
||||||
EAPI const Eina_List *e_kbd_buf_string_matches_get(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_backspace(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_lookup(E_Kbd_Buf *kb, void (*func) (void *data), void *data);
|
|
||||||
EAPI void e_kbd_buf_lookup_cancel(E_Kbd_Buf *kb);
|
|
||||||
EAPI void e_kbd_buf_word_use(E_Kbd_Buf *kb, const char *word);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,875 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_kbd_dict.h"
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
|
|
||||||
#define MAXLATIN 0x100
|
|
||||||
|
|
||||||
static unsigned char _e_kbd_normalise_base[MAXLATIN];
|
|
||||||
static unsigned char _e_kbd_normalise_ready = 0;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_normalise_init(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const char *table[][2] =
|
|
||||||
{
|
|
||||||
{"À", "a"},
|
|
||||||
{"Á", "a"},
|
|
||||||
{"Â", "a"},
|
|
||||||
{"Ã", "a"},
|
|
||||||
{"Ä", "a"},
|
|
||||||
{"Å", "a"},
|
|
||||||
{"Æ", "a"},
|
|
||||||
{"Ç", "c"},
|
|
||||||
{"È", "e"},
|
|
||||||
{"É", "e"},
|
|
||||||
{"Ê", "e"},
|
|
||||||
{"Ë", "e"},
|
|
||||||
{"Ì", "i"},
|
|
||||||
{"Í", "i"},
|
|
||||||
{"Î", "i"},
|
|
||||||
{"Ï", "i"},
|
|
||||||
{"Ð", "d"},
|
|
||||||
{"Ñ", "n"},
|
|
||||||
{"Ò", "o"},
|
|
||||||
{"Ó", "o"},
|
|
||||||
{"Ô", "o"},
|
|
||||||
{"Õ", "o"},
|
|
||||||
{"Ö", "o"},
|
|
||||||
{"×", "x"},
|
|
||||||
{"Ø", "o"},
|
|
||||||
{"Ù", "u"},
|
|
||||||
{"Ú", "u"},
|
|
||||||
{"Û", "u"},
|
|
||||||
{"Ü", "u"},
|
|
||||||
{"Ý", "y"},
|
|
||||||
{"Þ", "p"},
|
|
||||||
{"ß", "s"},
|
|
||||||
{"à", "a"},
|
|
||||||
{"á", "a"},
|
|
||||||
{"â", "a"},
|
|
||||||
{"ã", "a"},
|
|
||||||
{"ä", "a"},
|
|
||||||
{"å", "a"},
|
|
||||||
{"æ", "a"},
|
|
||||||
{"ç", "c"},
|
|
||||||
{"è", "e"},
|
|
||||||
{"é", "e"},
|
|
||||||
{"ê", "e"},
|
|
||||||
{"ë", "e"},
|
|
||||||
{"ì", "i"},
|
|
||||||
{"í", "i"},
|
|
||||||
{"î", "i"},
|
|
||||||
{"ï", "i"},
|
|
||||||
{"ð", "o"},
|
|
||||||
{"ñ", "n"},
|
|
||||||
{"ò", "o"},
|
|
||||||
{"ó", "o"},
|
|
||||||
{"ô", "o"},
|
|
||||||
{"õ", "o"},
|
|
||||||
{"ö", "o"},
|
|
||||||
{"ø", "o"},
|
|
||||||
{"ù", "u"},
|
|
||||||
{"ú", "u"},
|
|
||||||
{"û", "u"},
|
|
||||||
{"ü", "u"},
|
|
||||||
{"ý", "y"},
|
|
||||||
{"þ", "p"},
|
|
||||||
{"ÿ", "y"}
|
|
||||||
}; // 63 items
|
|
||||||
|
|
||||||
if (_e_kbd_normalise_ready) return;
|
|
||||||
_e_kbd_normalise_ready = 1;
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
_e_kbd_normalise_base[i] = tolower(i);
|
|
||||||
for (;i < MAXLATIN; i++)
|
|
||||||
{
|
|
||||||
int glyph;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (j = 0; j < 63; j++)
|
|
||||||
{
|
|
||||||
evas_string_char_next_get(table[j][0], 0, &glyph);
|
|
||||||
if (glyph == i)
|
|
||||||
{
|
|
||||||
_e_kbd_normalise_base[i] = *table[j][1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_letter_normalise(int glyph)
|
|
||||||
{
|
|
||||||
// FIXME: ö -> o, ä -> a, Ó -> o etc. - ie normalise to latin-1
|
|
||||||
if (glyph < MAXLATIN) return _e_kbd_normalise_base[glyph];
|
|
||||||
return tolower(glyph) & 0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_normalized_strncmp(const char *a, const char *b, int len)
|
|
||||||
{
|
|
||||||
// FIXME: normalise 2 strings and then compare
|
|
||||||
if (len < 0) return strcasecmp(a, b);
|
|
||||||
return strncasecmp(a, b, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_normalized_strcmp(const char *a, const char *b)
|
|
||||||
{
|
|
||||||
return _e_kbd_dict_normalized_strncmp(a, b, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_normalized_strcpy(char *dst, const char *src)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
char *d;
|
|
||||||
|
|
||||||
for (p = src, d = dst; *p; p++, d++)
|
|
||||||
{
|
|
||||||
*d = _e_kbd_dict_letter_normalise(*p);
|
|
||||||
}
|
|
||||||
*d = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_matches_loolup_cb_sort(const void *d1, const void *d2)
|
|
||||||
{
|
|
||||||
const E_Kbd_Dict_Word *kw1, *kw2;
|
|
||||||
|
|
||||||
kw1 = d1;
|
|
||||||
kw2 = d2;
|
|
||||||
if (kw1->usage < kw2->usage) return 1;
|
|
||||||
else if (kw1->usage > kw2->usage) return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_writes_cb_sort(const void *d1, const void *d2)
|
|
||||||
{
|
|
||||||
const E_Kbd_Dict_Word *kw1, *kw2;
|
|
||||||
|
|
||||||
kw1 = d1;
|
|
||||||
kw2 = d2;
|
|
||||||
return _e_kbd_dict_normalized_strcmp(kw1->word, kw2->word);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_dict_line_next(E_Kbd_Dict *kd, const char *p)
|
|
||||||
{
|
|
||||||
const char *e, *pp;
|
|
||||||
|
|
||||||
e = kd->file.dict + kd->file.size;
|
|
||||||
for (pp = p; pp < e; pp++)
|
|
||||||
{
|
|
||||||
if (*pp == '\n')
|
|
||||||
return pp + 1;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
_e_kbd_dict_line_parse(E_Kbd_Dict *kd __UNUSED__, const char *p, int *usage)
|
|
||||||
{
|
|
||||||
const char *ps;
|
|
||||||
char *wd = NULL;
|
|
||||||
|
|
||||||
for (ps = p; !isspace(*ps); ps++);
|
|
||||||
wd = malloc(ps - p + 1);
|
|
||||||
if (!wd) return NULL;
|
|
||||||
strncpy(wd, p, ps - p);
|
|
||||||
wd[ps - p] = 0;
|
|
||||||
if (*ps == '\n') *usage = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ps++;
|
|
||||||
*usage = atoi(ps);
|
|
||||||
}
|
|
||||||
return wd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_lookup_build_line(E_Kbd_Dict *kd __UNUSED__, const char *p, const char *eol, int *glyphs)
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
int p2;
|
|
||||||
|
|
||||||
s = alloca(eol - p + 1);
|
|
||||||
strncpy(s, p, eol - p);
|
|
||||||
s[eol - p] = 0;
|
|
||||||
p2 = evas_string_char_next_get(s, 0, &(glyphs[0]));
|
|
||||||
if ((p2 > 0) && (glyphs[0] > 0))
|
|
||||||
evas_string_char_next_get(s, p2, &(glyphs[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_lookup_build(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
const char *p, *e, *eol;
|
|
||||||
int glyphs[2], pglyphs[2];
|
|
||||||
|
|
||||||
p = kd->file.dict;
|
|
||||||
e = p + kd->file.size;
|
|
||||||
pglyphs[0] = pglyphs[1] = 0;
|
|
||||||
while (p < e)
|
|
||||||
{
|
|
||||||
eol = strchr(p, '\n');
|
|
||||||
if (!eol) break;
|
|
||||||
if (eol > p)
|
|
||||||
{
|
|
||||||
glyphs[0] = glyphs[1] = 0;
|
|
||||||
_e_kbd_dict_lookup_build_line(kd, p, eol, glyphs);
|
|
||||||
if ((glyphs[1] != pglyphs[1]) ||
|
|
||||||
(glyphs[0] != pglyphs[0]))
|
|
||||||
{
|
|
||||||
int v1, v2;
|
|
||||||
|
|
||||||
if (isspace(glyphs[0]))
|
|
||||||
{
|
|
||||||
glyphs[0] = 0;
|
|
||||||
glyphs[1] = 0;
|
|
||||||
}
|
|
||||||
else if (isspace(glyphs[1]))
|
|
||||||
glyphs[1] = 0;
|
|
||||||
if (glyphs[0] == 0)
|
|
||||||
{
|
|
||||||
pglyphs[0] = pglyphs[1] = 0;
|
|
||||||
p = eol + 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
v1 = _e_kbd_dict_letter_normalise(glyphs[0]);
|
|
||||||
v2 = _e_kbd_dict_letter_normalise(glyphs[1]);
|
|
||||||
if (!kd->lookup.tuples[v1][v2])
|
|
||||||
kd->lookup.tuples[v1][v2] = p;
|
|
||||||
pglyphs[0] = v1;
|
|
||||||
pglyphs[1] = v2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = eol + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_kbd_dict_open(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
kd->file.fd = open(kd->file.file, O_RDONLY);
|
|
||||||
if (kd->file.fd < 0)
|
|
||||||
return 0;
|
|
||||||
if (fstat(kd->file.fd, &st) < 0)
|
|
||||||
{
|
|
||||||
close(kd->file.fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
kd->file.size = st.st_size;
|
|
||||||
kd->file.dict = mmap(NULL, kd->file.size, PROT_READ, MAP_SHARED,
|
|
||||||
kd->file.fd, 0);
|
|
||||||
if ((kd->file.dict== MAP_FAILED) || (!kd->file.dict))
|
|
||||||
{
|
|
||||||
close(kd->file.fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_close(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
if (kd->file.fd < 0) return;
|
|
||||||
memset(kd->lookup.tuples, 0, sizeof(kd->lookup.tuples));
|
|
||||||
munmap((void *)kd->file.dict, kd->file.size);
|
|
||||||
close(kd->file.fd);
|
|
||||||
kd->file.fd = -1;
|
|
||||||
kd->file.dict = NULL;
|
|
||||||
kd->file.size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Kbd_Dict *
|
|
||||||
e_kbd_dict_new(const char *file)
|
|
||||||
{
|
|
||||||
// alloc and load new dict - build quick-lookup table. words MUST be sorted
|
|
||||||
E_Kbd_Dict *kd;
|
|
||||||
|
|
||||||
_e_kbd_normalise_init();
|
|
||||||
kd = E_NEW(E_Kbd_Dict, 1);
|
|
||||||
if (!kd) return NULL;
|
|
||||||
kd->file.file = eina_stringshare_add(file);
|
|
||||||
if (!kd->file.file)
|
|
||||||
{
|
|
||||||
free(kd);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
kd->file.fd = -1;
|
|
||||||
if (!_e_kbd_dict_open(kd))
|
|
||||||
{
|
|
||||||
eina_stringshare_del(kd->file.file);
|
|
||||||
free(kd);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
_e_kbd_dict_lookup_build(kd);
|
|
||||||
return kd;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_free(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// free dict and anything in it
|
|
||||||
e_kbd_dict_word_letter_clear(kd);
|
|
||||||
e_kbd_dict_save(kd);
|
|
||||||
_e_kbd_dict_close(kd);
|
|
||||||
free(kd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Kbd_Dict_Word *
|
|
||||||
_e_kbd_dict_changed_write_find(E_Kbd_Dict *kd, const char *word)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = kd->changed.writes; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = l->data;
|
|
||||||
if (!strcmp(kw->word, word)) return kw;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_save(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
// save any changes (new words added, usage adjustments).
|
|
||||||
// all words MUST be sorted
|
|
||||||
if (!kd->changed.writes) return;
|
|
||||||
if (kd->changed.flush_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(kd->changed.flush_timer);
|
|
||||||
kd->changed.flush_timer = NULL;
|
|
||||||
}
|
|
||||||
ecore_file_unlink(kd->file.file);
|
|
||||||
f = fopen(kd->file.file, "w");
|
|
||||||
kd->changed.writes = eina_list_sort(kd->changed.writes,
|
|
||||||
eina_list_count(kd->changed.writes),
|
|
||||||
_e_kbd_dict_writes_cb_sort);
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
const char *p, *pn;
|
|
||||||
|
|
||||||
p = kd->file.dict;
|
|
||||||
while (p)
|
|
||||||
{
|
|
||||||
char *wd;
|
|
||||||
int usage = 0;
|
|
||||||
|
|
||||||
pn = _e_kbd_dict_line_next(kd, p);
|
|
||||||
if (!pn)
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wd = _e_kbd_dict_line_parse(kd, p, &usage);
|
|
||||||
if ((wd) && (strlen(wd) > 0))
|
|
||||||
{
|
|
||||||
if (kd->changed.writes)
|
|
||||||
{
|
|
||||||
int writeline;
|
|
||||||
|
|
||||||
writeline = 0;
|
|
||||||
while (kd->changed.writes)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
int cmp;
|
|
||||||
|
|
||||||
kw = kd->changed.writes->data;
|
|
||||||
cmp = _e_kbd_dict_normalized_strcmp(kw->word, wd);
|
|
||||||
if (cmp < 0)
|
|
||||||
{
|
|
||||||
fprintf(f, "%s %i\n", kw->word, kw->usage);
|
|
||||||
eina_stringshare_del(kw->word);
|
|
||||||
free(kw);
|
|
||||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
|
||||||
writeline = 1;
|
|
||||||
}
|
|
||||||
else if (cmp == 0)
|
|
||||||
{
|
|
||||||
fprintf(f, "%s %i\n", wd, kw->usage);
|
|
||||||
if (!strcmp(kw->word, wd))
|
|
||||||
writeline = 0;
|
|
||||||
else
|
|
||||||
writeline = 1;
|
|
||||||
eina_stringshare_del(kw->word);
|
|
||||||
free(kw);
|
|
||||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (cmp > 0)
|
|
||||||
{
|
|
||||||
writeline = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (writeline)
|
|
||||||
fprintf(f, "%s %i\n", wd, usage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(f, "%s %i\n", wd, usage);
|
|
||||||
}
|
|
||||||
if (wd) free(wd);
|
|
||||||
p = pn;
|
|
||||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
|
||||||
}
|
|
||||||
while (kd->changed.writes)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = kd->changed.writes->data;
|
|
||||||
fprintf(f, "%s %i\n", kw->word, kw->usage);
|
|
||||||
eina_stringshare_del(kw->word);
|
|
||||||
free(kw);
|
|
||||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
_e_kbd_dict_close(kd);
|
|
||||||
if (_e_kbd_dict_open(kd))
|
|
||||||
_e_kbd_dict_lookup_build(kd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_kbd_dict_cb_save_flush(void *data)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict *kd;
|
|
||||||
|
|
||||||
kd = data;
|
|
||||||
if ((kd->matches.list) ||
|
|
||||||
(kd->word.letters) ||
|
|
||||||
(kd->matches.deadends) ||
|
|
||||||
(kd->matches.leads))
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
kd->changed.flush_timer = NULL;
|
|
||||||
e_kbd_dict_save(kd);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_changed_write_add(E_Kbd_Dict *kd, const char *word, int usage)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = E_NEW(E_Kbd_Dict_Word, 1);
|
|
||||||
kw->word = eina_stringshare_add(word);
|
|
||||||
kw->usage = usage;
|
|
||||||
kd->changed.writes = eina_list_prepend(kd->changed.writes, kw);
|
|
||||||
if (eina_list_count(kd->changed.writes) > 64)
|
|
||||||
{
|
|
||||||
e_kbd_dict_save(kd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (kd->changed.flush_timer)
|
|
||||||
ecore_timer_del(kd->changed.flush_timer);
|
|
||||||
kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_dict_find_pointer(E_Kbd_Dict *kd, const char *p, int baselen, const char *word)
|
|
||||||
{
|
|
||||||
const char *pn;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if (!p) return NULL;
|
|
||||||
len = strlen(word);
|
|
||||||
while (p)
|
|
||||||
{
|
|
||||||
pn = _e_kbd_dict_line_next(kd, p);
|
|
||||||
if (!pn) return NULL;
|
|
||||||
if ((pn - p) > len)
|
|
||||||
{
|
|
||||||
if (!_e_kbd_dict_normalized_strncmp(p, word, len))
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
if (_e_kbd_dict_normalized_strncmp(p, word, baselen))
|
|
||||||
return NULL;
|
|
||||||
p = pn;
|
|
||||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_dict_find(E_Kbd_Dict *kd, const char *word)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
char *tword;
|
|
||||||
int glyphs[2], p2, v1, v2, i;
|
|
||||||
|
|
||||||
/* work backwards in leads. i.e.:
|
|
||||||
* going
|
|
||||||
* goin
|
|
||||||
* goi
|
|
||||||
* go
|
|
||||||
* g
|
|
||||||
*/
|
|
||||||
tword = alloca(strlen(word) + 1);
|
|
||||||
_e_kbd_dict_normalized_strcpy(tword, word);
|
|
||||||
p = eina_hash_find(kd->matches.leads, tword);
|
|
||||||
if (p) return p;
|
|
||||||
p2 = strlen(tword);
|
|
||||||
while (tword[0])
|
|
||||||
{
|
|
||||||
p2 = evas_string_char_prev_get(tword, p2, &i);
|
|
||||||
if (p2 < 0) break;
|
|
||||||
tword[p2] = 0;
|
|
||||||
p = eina_hash_find(kd->matches.leads, tword);
|
|
||||||
if (p)
|
|
||||||
return _e_kbd_dict_find_pointer(kd, p, p2, word);
|
|
||||||
}
|
|
||||||
/* looking at leads going back letters didn't work */
|
|
||||||
p = kd->file.dict;
|
|
||||||
if ((p[0] == '\n') && (kd->file.size <= 1)) return NULL;
|
|
||||||
glyphs[0] = glyphs[1] = 0;
|
|
||||||
p2 = evas_string_char_next_get(word, 0, &(glyphs[0]));
|
|
||||||
if ((p2 > 0) && (glyphs[0] > 0))
|
|
||||||
p2 = evas_string_char_next_get(word, p2, &(glyphs[1]));
|
|
||||||
v1 = _e_kbd_dict_letter_normalise(glyphs[0]);
|
|
||||||
if (glyphs[1] != 0)
|
|
||||||
{
|
|
||||||
v2 = _e_kbd_dict_letter_normalise(glyphs[1]);
|
|
||||||
p = kd->lookup.tuples[v1][v2];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
{
|
|
||||||
p = kd->lookup.tuples[v1][i];
|
|
||||||
if (p) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _e_kbd_dict_find_pointer(kd, p, p2, word);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_e_kbd_dict_find_full(E_Kbd_Dict *kd, const char *word)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
p = _e_kbd_dict_find(kd, word);
|
|
||||||
if (!p) return NULL;
|
|
||||||
len = strlen(word);
|
|
||||||
if (isspace(p[len])) return p;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_usage_adjust(E_Kbd_Dict *kd, const char *word, int adjust)
|
|
||||||
{
|
|
||||||
// add "adjust" to word usage count
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = _e_kbd_dict_changed_write_find(kd, word);
|
|
||||||
if (kw)
|
|
||||||
{
|
|
||||||
kw->usage += adjust;
|
|
||||||
if (kd->changed.flush_timer)
|
|
||||||
ecore_timer_del(kd->changed.flush_timer);
|
|
||||||
kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *line;
|
|
||||||
int usage = 0;
|
|
||||||
|
|
||||||
line = _e_kbd_dict_find_full(kd, word);
|
|
||||||
if (line)
|
|
||||||
{
|
|
||||||
char *wd;
|
|
||||||
|
|
||||||
// FIXME: we need to find an EXACT line match - case and all
|
|
||||||
wd = _e_kbd_dict_line_parse(kd, line, &usage);
|
|
||||||
if (wd) free(wd);
|
|
||||||
}
|
|
||||||
usage += adjust;
|
|
||||||
_e_kbd_dict_changed_write_add(kd, word, usage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_delete(E_Kbd_Dict *kd, const char *word)
|
|
||||||
{
|
|
||||||
// delete a word from the dictionary
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = _e_kbd_dict_changed_write_find(kd, word);
|
|
||||||
if (kw)
|
|
||||||
kw->usage = -1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_e_kbd_dict_find_full(kd, word))
|
|
||||||
_e_kbd_dict_changed_write_add(kd, word, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_letter_clear(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// clear the current word buffer
|
|
||||||
while (kd->word.letters)
|
|
||||||
e_kbd_dict_word_letter_delete(kd);
|
|
||||||
if (kd->matches.deadends)
|
|
||||||
{
|
|
||||||
eina_hash_free(kd->matches.deadends);
|
|
||||||
kd->matches.deadends = NULL;
|
|
||||||
}
|
|
||||||
if (kd->matches.leads)
|
|
||||||
{
|
|
||||||
eina_hash_free(kd->matches.leads);
|
|
||||||
kd->matches.leads = NULL;
|
|
||||||
}
|
|
||||||
while (kd->matches.list)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = kd->matches.list->data;
|
|
||||||
eina_stringshare_del(kw->word);
|
|
||||||
free(kw);
|
|
||||||
kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_letter_add(E_Kbd_Dict *kd, const char *letter, int dist)
|
|
||||||
{
|
|
||||||
// add a letter with a distance (0 == closest) as an option for the current
|
|
||||||
// letter position - advance starts a new letter position
|
|
||||||
Eina_List *l, *list;
|
|
||||||
E_Kbd_Dict_Letter *kl;
|
|
||||||
|
|
||||||
l = eina_list_last(kd->word.letters);
|
|
||||||
if (!l) return;
|
|
||||||
list = l->data;
|
|
||||||
kl = E_NEW(E_Kbd_Dict_Letter, 1);
|
|
||||||
if (!kl) return;
|
|
||||||
kl->letter = eina_stringshare_add(letter);
|
|
||||||
kl->dist = dist;
|
|
||||||
list = eina_list_append(list, kl);
|
|
||||||
l->data = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_letter_advance(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// start a new letter in the word
|
|
||||||
kd->word.letters = eina_list_append(kd->word.letters, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_word_letter_delete(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// delete the current letter completely
|
|
||||||
Eina_List *l, *list;
|
|
||||||
|
|
||||||
l = eina_list_last(kd->word.letters);
|
|
||||||
if (!l) return;
|
|
||||||
list = l->data;
|
|
||||||
while (list)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Letter *kl;
|
|
||||||
|
|
||||||
kl = list->data;
|
|
||||||
eina_stringshare_del(kl->letter);
|
|
||||||
free(kl);
|
|
||||||
list = eina_list_remove_list(list, list);
|
|
||||||
}
|
|
||||||
kd->word.letters = eina_list_remove_list(kd->word.letters, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_kbd_dict_matches_lookup_iter(E_Kbd_Dict *kd, Eina_List *word, Eina_List *more)
|
|
||||||
{
|
|
||||||
Eina_List *l, *list;
|
|
||||||
const char *p;
|
|
||||||
char *base, *buf, *wd, *bufapp;
|
|
||||||
E_Kbd_Dict_Letter *kl;
|
|
||||||
int len, dist = 0, d, baselen, maxdist = 0, md;
|
|
||||||
static int level = 0;
|
|
||||||
|
|
||||||
len = 0;
|
|
||||||
level++;
|
|
||||||
for (l = word; l; l = l->next)
|
|
||||||
{
|
|
||||||
kl = l->data;
|
|
||||||
len += strlen(kl->letter);
|
|
||||||
dist += kl->dist;
|
|
||||||
if (kl->dist > maxdist) maxdist = kl->dist;
|
|
||||||
}
|
|
||||||
if (maxdist < 1) maxdist = 1;
|
|
||||||
buf = alloca(len + 20); // 20 - just padding enough for 1 more utf8 char
|
|
||||||
base = alloca(len + 20);
|
|
||||||
base[0] = 0;
|
|
||||||
for (l = word; l; l = l->next)
|
|
||||||
{
|
|
||||||
kl = l->data;
|
|
||||||
strcat(base, kl->letter);
|
|
||||||
}
|
|
||||||
baselen = strlen(base);
|
|
||||||
strcpy(buf, base);
|
|
||||||
bufapp = buf + baselen;
|
|
||||||
list = more->data;
|
|
||||||
for (l = list; l; l = l->next)
|
|
||||||
{
|
|
||||||
kl = l->data;
|
|
||||||
if (kl->dist > maxdist) maxdist = kl->dist;
|
|
||||||
}
|
|
||||||
for (l = list; l; l = l->next)
|
|
||||||
{
|
|
||||||
kl = l->data;
|
|
||||||
strcpy(bufapp, kl->letter);
|
|
||||||
if ((kd->matches.deadends) && eina_hash_find(kd->matches.deadends, buf))
|
|
||||||
continue;
|
|
||||||
p = eina_hash_find(kd->matches.leads, buf);
|
|
||||||
if (p) p = _e_kbd_dict_find_pointer(kd, p, baselen, buf);
|
|
||||||
else p = _e_kbd_dict_find(kd, buf);
|
|
||||||
if (!p)
|
|
||||||
{
|
|
||||||
if (!kd->matches.deadends)
|
|
||||||
kd->matches.deadends = eina_hash_string_superfast_new(NULL);
|
|
||||||
eina_hash_add(kd->matches.deadends, buf, kd);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!kd->matches.leads)
|
|
||||||
kd->matches.leads = eina_hash_string_superfast_new(NULL);
|
|
||||||
eina_hash_add(kd->matches.leads, buf, p);
|
|
||||||
}
|
|
||||||
if ((!more->next) || (!more->next->data))
|
|
||||||
{
|
|
||||||
d = dist + kl->dist;
|
|
||||||
md = maxdist;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
int usage = 0;
|
|
||||||
|
|
||||||
wd = _e_kbd_dict_line_parse(kd, p, &usage);
|
|
||||||
if (!wd) break;
|
|
||||||
if (_e_kbd_dict_normalized_strcmp(wd, buf))
|
|
||||||
{
|
|
||||||
free(wd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
kw = E_NEW(E_Kbd_Dict_Word, 1);
|
|
||||||
if (kw)
|
|
||||||
{
|
|
||||||
int accuracy;
|
|
||||||
int w, b, w2, b2, wc, bc;
|
|
||||||
|
|
||||||
// match any capitalisation
|
|
||||||
for (w = 0, b = 0; wd[w] && buf[b];)
|
|
||||||
{
|
|
||||||
b2 = evas_string_char_next_get(buf, b, &bc);
|
|
||||||
w2 = evas_string_char_next_get(wd, w, &wc);
|
|
||||||
if (isupper(bc)) wd[w] = toupper(wc);
|
|
||||||
w = w2;
|
|
||||||
b = b2;
|
|
||||||
}
|
|
||||||
kw->word = eina_stringshare_add(wd);
|
|
||||||
// FIXME: magic combination of distance metric and
|
|
||||||
// frequency of usage. this is simple now, but could
|
|
||||||
// be tweaked
|
|
||||||
wc = eina_list_count(word);
|
|
||||||
if (md < 1) md = 1;
|
|
||||||
|
|
||||||
// basically a metric to see how far away the keys that
|
|
||||||
// were actually pressed are away from the letters of
|
|
||||||
// this word in a physical on-screen sense
|
|
||||||
accuracy = md - (d / (wc + 1));
|
|
||||||
// usage is the frequency of usage in the dictionary.
|
|
||||||
// it its < 1 time, it's assumed to be 1.
|
|
||||||
if (usage < 1) usage = 1;
|
|
||||||
// multiply usage by a factor of 100 for better detailed
|
|
||||||
// sorting. 10 == 1/10th factor
|
|
||||||
usage = 100 + ((usage - 1) * 10);
|
|
||||||
// and well just multiply and lets see. maybe this can
|
|
||||||
// do with multiplication factors etc. but simple for
|
|
||||||
// now.
|
|
||||||
kw->usage = (usage * accuracy) / md;
|
|
||||||
kd->matches.list = eina_list_append(kd->matches.list, kw);
|
|
||||||
}
|
|
||||||
free(wd);
|
|
||||||
p = _e_kbd_dict_line_next(kd, p);
|
|
||||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
|
||||||
if (!p) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
word = eina_list_append(word, kl);
|
|
||||||
_e_kbd_dict_matches_lookup_iter(kd, word, more->next);
|
|
||||||
word = eina_list_remove_list(word, eina_list_last(word));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
level--;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_matches_lookup(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// find all matches and sort them
|
|
||||||
while (kd->matches.list)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = kd->matches.list->data;
|
|
||||||
eina_stringshare_del(kw->word);
|
|
||||||
free(kw);
|
|
||||||
kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list);
|
|
||||||
}
|
|
||||||
if (kd->word.letters)
|
|
||||||
_e_kbd_dict_matches_lookup_iter(kd, NULL, kd->word.letters);
|
|
||||||
kd->matches.list = eina_list_sort(kd->matches.list,
|
|
||||||
eina_list_count(kd->matches.list),
|
|
||||||
_e_kbd_dict_matches_loolup_cb_sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_matches_first(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// jump to first match
|
|
||||||
kd->matches.list_ptr = kd->matches.list;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_dict_matches_next(E_Kbd_Dict *kd)
|
|
||||||
{
|
|
||||||
// jump to next match
|
|
||||||
kd->matches.list_ptr = kd->matches.list_ptr->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI const char *
|
|
||||||
e_kbd_dict_matches_match_get(E_Kbd_Dict *kd, int *pri_ret)
|
|
||||||
{
|
|
||||||
// return the word (string utf-8) for the current match
|
|
||||||
if (kd->matches.list_ptr)
|
|
||||||
{
|
|
||||||
E_Kbd_Dict_Word *kw;
|
|
||||||
|
|
||||||
kw = kd->matches.list_ptr->data;
|
|
||||||
if (kw)
|
|
||||||
{
|
|
||||||
*pri_ret = kw->usage;
|
|
||||||
return kw->word;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
#ifndef E_KBD_DICT_H
|
|
||||||
#define E_KBD_DICT_H
|
|
||||||
|
|
||||||
typedef struct _E_Kbd_Dict E_Kbd_Dict;
|
|
||||||
typedef struct _E_Kbd_Dict_Word E_Kbd_Dict_Word;
|
|
||||||
typedef struct _E_Kbd_Dict_Letter E_Kbd_Dict_Letter;
|
|
||||||
|
|
||||||
struct _E_Kbd_Dict_Word
|
|
||||||
{
|
|
||||||
const char *word;
|
|
||||||
int usage;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Dict_Letter
|
|
||||||
{
|
|
||||||
const char *letter;
|
|
||||||
int dist;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Dict
|
|
||||||
{
|
|
||||||
struct {
|
|
||||||
const char *file;
|
|
||||||
int fd;
|
|
||||||
const char *dict;
|
|
||||||
int size;
|
|
||||||
} file;
|
|
||||||
struct {
|
|
||||||
const char *tuples[128][128];
|
|
||||||
} lookup;
|
|
||||||
struct {
|
|
||||||
Ecore_Timer *flush_timer;
|
|
||||||
Eina_List *writes;
|
|
||||||
} changed;
|
|
||||||
struct {
|
|
||||||
Eina_List *letters;
|
|
||||||
} word;
|
|
||||||
struct {
|
|
||||||
Eina_Hash *deadends;
|
|
||||||
Eina_Hash *leads;
|
|
||||||
Eina_List *list;
|
|
||||||
Eina_List *list_ptr;
|
|
||||||
} matches;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
EAPI E_Kbd_Dict *e_kbd_dict_new(const char *file);
|
|
||||||
EAPI void e_kbd_dict_free(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_save(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_word_usage_adjust(E_Kbd_Dict *kd, const char *word, int adjust);
|
|
||||||
EAPI void e_kbd_dict_word_delete(E_Kbd_Dict *kd, const char *word);
|
|
||||||
EAPI void e_kbd_dict_word_letter_clear(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_word_letter_add(E_Kbd_Dict *kd, const char *letter, int dist);
|
|
||||||
EAPI void e_kbd_dict_word_letter_advance(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_word_letter_delete(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_matches_lookup(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_matches_first(E_Kbd_Dict *kd);
|
|
||||||
EAPI void e_kbd_dict_matches_next(E_Kbd_Dict *kd);
|
|
||||||
EAPI const char *e_kbd_dict_matches_match_get(E_Kbd_Dict *kd, int *pri_ret);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,123 +0,0 @@
|
||||||
#ifndef E_KBD_INT_H
|
|
||||||
#define E_KBD_INT_H
|
|
||||||
|
|
||||||
#include "e_kbd_buf.h"
|
|
||||||
|
|
||||||
typedef enum _E_Kbd_Int_Type
|
|
||||||
{
|
|
||||||
E_KBD_INT_TYPE_UNKNOWN = 0,
|
|
||||||
E_KBD_INT_TYPE_ALPHA = (1 << 0),
|
|
||||||
E_KBD_INT_TYPE_NUMERIC = (1 << 1),
|
|
||||||
E_KBD_INT_TYPE_PIN = (1 << 2),
|
|
||||||
E_KBD_INT_TYPE_PHONE_NUMBER = (1 << 3),
|
|
||||||
E_KBD_INT_TYPE_HEX = (1 << 4),
|
|
||||||
E_KBD_INT_TYPE_TERMINAL = (1 << 5),
|
|
||||||
E_KBD_INT_TYPE_PASSWORD = (1 << 6)
|
|
||||||
} E_Kbd_Int_Type;
|
|
||||||
|
|
||||||
/* The natural text direction of the keyboard */
|
|
||||||
typedef enum _E_kbd_Int_Direction
|
|
||||||
{
|
|
||||||
E_KBD_INT_DIRECTION_LTR = (1 << 0),
|
|
||||||
E_KBD_INT_DIRECTION_RTL = (1 << 1)
|
|
||||||
} E_Kbd_Int_Direction;
|
|
||||||
|
|
||||||
typedef struct _E_Kbd_Int E_Kbd_Int;
|
|
||||||
typedef struct _E_Kbd_Int_Key E_Kbd_Int_Key;
|
|
||||||
typedef struct _E_Kbd_Int_Key_State E_Kbd_Int_Key_State;
|
|
||||||
typedef struct _E_Kbd_Int_Layout E_Kbd_Int_Layout;
|
|
||||||
typedef struct _E_Kbd_Int_Match E_Kbd_Int_Match;
|
|
||||||
|
|
||||||
struct _E_Kbd_Int
|
|
||||||
{
|
|
||||||
E_Win *win;
|
|
||||||
const char *themedir, *syskbds, *sysdicts;
|
|
||||||
Evas_Object *base_obj, *layout_obj, *event_obj, *icon_obj, *box_obj;
|
|
||||||
Eina_List *layouts;
|
|
||||||
Eina_List *matches;
|
|
||||||
Ecore_Event_Handler *client_message_handler;
|
|
||||||
struct {
|
|
||||||
char *directory;
|
|
||||||
const char *file;
|
|
||||||
int w, h;
|
|
||||||
int fuzz;
|
|
||||||
int direction;
|
|
||||||
E_Kbd_Int_Type type;
|
|
||||||
Eina_List *keys;
|
|
||||||
E_Kbd_Int_Key *pressed;
|
|
||||||
int state;
|
|
||||||
} layout;
|
|
||||||
struct {
|
|
||||||
Evas_Coord x, y, cx, cy;
|
|
||||||
int lx, ly, clx, cly;
|
|
||||||
Ecore_Timer *hold_timer;
|
|
||||||
unsigned char down : 1;
|
|
||||||
unsigned char stroke : 1;
|
|
||||||
unsigned char zoom : 1;
|
|
||||||
} down;
|
|
||||||
struct {
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj, *ilist_obj;
|
|
||||||
} layoutlist;
|
|
||||||
struct {
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj, *ilist_obj;
|
|
||||||
Eina_List *matches;
|
|
||||||
} matchlist;
|
|
||||||
struct {
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj, *ilist_obj;
|
|
||||||
Eina_List *matches;
|
|
||||||
} dictlist;
|
|
||||||
struct {
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj, *layout_obj, *sublayout_obj;
|
|
||||||
E_Kbd_Int_Key *pressed;
|
|
||||||
} zoomkey;
|
|
||||||
|
|
||||||
E_Kbd_Buf *kbuf;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Int_Key
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
|
||||||
|
|
||||||
Eina_List *states;
|
|
||||||
Evas_Object *obj, *zoom_obj, *icon_obj, *zoom_icon_obj;
|
|
||||||
|
|
||||||
unsigned char pressed : 1;
|
|
||||||
unsigned char selected : 1;
|
|
||||||
|
|
||||||
unsigned char is_shift : 1;
|
|
||||||
unsigned char is_ctrl : 1;
|
|
||||||
unsigned char is_alt : 1;
|
|
||||||
unsigned char is_capslock : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Int_Key_State
|
|
||||||
{
|
|
||||||
int state;
|
|
||||||
const char *label, *icon;
|
|
||||||
const char *out;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Int_Layout
|
|
||||||
{
|
|
||||||
const char *path;
|
|
||||||
const char *dir;
|
|
||||||
const char *icon;
|
|
||||||
const char *name;
|
|
||||||
int type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Kbd_Int_Match
|
|
||||||
{
|
|
||||||
E_Kbd_Int *ki;
|
|
||||||
const char *str;
|
|
||||||
Evas_Object *obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI E_Kbd_Int *e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts);
|
|
||||||
EAPI void e_kbd_int_free(E_Kbd_Int *ki);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,38 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_kbd_send.h"
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_string_to_keysym(const char *str)
|
|
||||||
{
|
|
||||||
int glyph;
|
|
||||||
|
|
||||||
/* utf8 -> glyph id (unicode - ucs4) */
|
|
||||||
glyph = 0;
|
|
||||||
evas_string_char_next_get(str, 0, &glyph);
|
|
||||||
if (glyph <= 0) return NULL;
|
|
||||||
/* glyph id -> keysym */
|
|
||||||
if (glyph > 0xff) glyph |= 0x1000000;
|
|
||||||
return ecore_x_keysym_string_get(glyph);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_send_string_press(const char *str, Kbd_Mod mod)
|
|
||||||
{
|
|
||||||
const char *key = NULL;
|
|
||||||
|
|
||||||
key = _string_to_keysym(str);
|
|
||||||
if (!key) return;
|
|
||||||
e_kbd_send_keysym_press(key, mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_kbd_send_keysym_press(const char *key, Kbd_Mod mod)
|
|
||||||
{
|
|
||||||
if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_down("Control_L");
|
|
||||||
if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_down("Alt_L");
|
|
||||||
if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_down("Super_L");
|
|
||||||
ecore_x_test_fake_key_press(key);
|
|
||||||
if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_up("Super_L");
|
|
||||||
if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_up("Alt_L");
|
|
||||||
if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_up("Control_L");
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef E_KBD_SEND_H
|
|
||||||
#define E_KBD_SEND_H
|
|
||||||
|
|
||||||
typedef enum _Kbd_Mod
|
|
||||||
{
|
|
||||||
KBD_MOD_SHIFT = (1 << 0),
|
|
||||||
KBD_MOD_CTRL = (1 << 1),
|
|
||||||
KBD_MOD_ALT = (1 << 2),
|
|
||||||
KBD_MOD_WIN = (1 << 3)
|
|
||||||
} Kbd_Mod;
|
|
||||||
|
|
||||||
EAPI void e_kbd_send_string_press(const char *str, Kbd_Mod mod);
|
|
||||||
EAPI void e_kbd_send_keysym_press(const char *key, Kbd_Mod mod);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,209 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
|
|
||||||
typedef struct _Instance Instance;
|
|
||||||
|
|
||||||
struct _Instance
|
|
||||||
{
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Evas_Object *obj;
|
|
||||||
Ecore_Poller *poller;
|
|
||||||
int on;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* gadcon requirements */
|
|
||||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
|
||||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
||||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
||||||
/* and actually define the gadcon class that this module provides (just 1) */
|
|
||||||
static const E_Gadcon_Client_Class _gadcon_class =
|
|
||||||
{
|
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
|
||||||
"illume-bluetooth",
|
|
||||||
{
|
|
||||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
||||||
e_gadcon_site_is_not_toolbar
|
|
||||||
},
|
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
|
||||||
};
|
|
||||||
static E_Module *mod = NULL;
|
|
||||||
|
|
||||||
static Eina_Bool _cb_poll(void *data);
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
void
|
|
||||||
_e_mod_gad_bluetooth_init(E_Module *m)
|
|
||||||
{
|
|
||||||
mod = m;
|
|
||||||
e_gadcon_provider_register(&_gadcon_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_gad_bluetooth_shutdown(void)
|
|
||||||
{
|
|
||||||
e_gadcon_provider_unregister(&_gadcon_class);
|
|
||||||
mod = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
|
||||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
|
||||||
"e/modules/illume/gadget/bluetooth");
|
|
||||||
evas_object_show(o);
|
|
||||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
||||||
gcc->data = inst;
|
|
||||||
inst->gcc = gcc;
|
|
||||||
inst->obj = o;
|
|
||||||
e_gadcon_client_util_menu_attach(gcc);
|
|
||||||
|
|
||||||
inst->on = -1;
|
|
||||||
inst->poller = ecore_poller_add(ECORE_POLLER_CORE, 16, _cb_poll, inst);
|
|
||||||
|
|
||||||
return gcc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
ecore_poller_del(inst->poller);
|
|
||||||
evas_object_del(inst->obj);
|
|
||||||
free(inst);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
Evas_Coord mw, mh, mxw, mxh;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
mw = 0, mh = 0;
|
|
||||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
|
||||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
|
||||||
if ((mw < 1) || (mh < 1))
|
|
||||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
|
||||||
if (mw < 4) mw = 4;
|
|
||||||
if (mh < 4) mh = 4;
|
|
||||||
if ((mxw > 0) && (mxh > 0))
|
|
||||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
|
||||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
_gc_label(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return "Bluetooth (Illume)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
|
|
||||||
{
|
|
||||||
/* FIXME: need icon
|
|
||||||
Evas_Object *o;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
|
||||||
e_module_dir_get(clock_module));
|
|
||||||
edje_object_file_set(o, buf, "icon");
|
|
||||||
return o;
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return _gadcon_class.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_find_interface_class(int iclass)
|
|
||||||
{
|
|
||||||
Eina_List *devs;
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
devs = ecore_file_ls("/sys/bus/usb/devices");
|
|
||||||
EINA_LIST_FREE(devs, name)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s/%s",
|
|
||||||
"/sys/bus/usb/devices", name, "bInterfaceClass");
|
|
||||||
f = fopen(buf, "r");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
if (fgets(buf, sizeof(buf), f))
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
|
|
||||||
sscanf(buf, "%x", &id);
|
|
||||||
if (iclass == id)
|
|
||||||
{
|
|
||||||
EINA_LIST_FREE(devs, name)
|
|
||||||
free(name);
|
|
||||||
fclose(f);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
free(name);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_poll(void *data)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
int pon;
|
|
||||||
|
|
||||||
inst = data;
|
|
||||||
/* FIXME: get bt status and emit signal */
|
|
||||||
pon = inst->on;
|
|
||||||
inst->on = _find_interface_class(0xe0);
|
|
||||||
if (inst->on != pon)
|
|
||||||
{
|
|
||||||
if (inst->on)
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
|
||||||
else
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef E_MOD_GAD_BLUETOOTH_H
|
|
||||||
#define E_MOD_GAD_BLUETOOTH_H
|
|
||||||
|
|
||||||
void _e_mod_gad_bluetooth_init(E_Module *m);
|
|
||||||
void _e_mod_gad_bluetooth_shutdown(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,688 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
|
|
||||||
static E_DBus_Connection *conn = NULL;
|
|
||||||
static E_DBus_Connection *conn_system = NULL;
|
|
||||||
static E_DBus_Signal_Handler *changed_h = NULL;
|
|
||||||
static E_DBus_Signal_Handler *changed_fso_h = NULL;
|
|
||||||
static E_DBus_Signal_Handler *operatorch_h = NULL;
|
|
||||||
static E_DBus_Signal_Handler *operatorch_fso_h = NULL;
|
|
||||||
static E_DBus_Signal_Handler *namech_h = NULL;
|
|
||||||
static E_DBus_Signal_Handler *namech_system_h = NULL;
|
|
||||||
|
|
||||||
static Ecore_Timer *try_again_timer = NULL;
|
|
||||||
|
|
||||||
typedef enum _Phone_Sys
|
|
||||||
{
|
|
||||||
PH_SYS_UNKNOWN,
|
|
||||||
PH_SYS_QTOPIA,
|
|
||||||
PH_SYS_FSO
|
|
||||||
} Phone_Sys;
|
|
||||||
|
|
||||||
static Phone_Sys detected_system = PH_SYS_UNKNOWN;
|
|
||||||
|
|
||||||
typedef struct _Instance Instance;
|
|
||||||
|
|
||||||
struct _Instance
|
|
||||||
{
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Evas_Object *obj;
|
|
||||||
int strength;
|
|
||||||
char *oper;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* gadcon requirements */
|
|
||||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
|
||||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
||||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
||||||
/* and actually define the gadcon class that this module provides (just 1) */
|
|
||||||
static const E_Gadcon_Client_Class _gadcon_class =
|
|
||||||
{
|
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
|
||||||
"illume-gsm",
|
|
||||||
{
|
|
||||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
||||||
e_gadcon_site_is_not_toolbar
|
|
||||||
},
|
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
|
||||||
};
|
|
||||||
static E_Module *mod = NULL;
|
|
||||||
|
|
||||||
static Eina_Bool try_again(void *data);
|
|
||||||
static void *signal_unmarhsall(DBusMessage *msg, DBusError *err);
|
|
||||||
static void *operator_unmarhsall(DBusMessage *msg, DBusError *err);
|
|
||||||
static void signal_callback_qtopia(void *data, void *ret, DBusError *err);
|
|
||||||
static void signal_callback_fso(void *data, void *ret, DBusError *err);
|
|
||||||
static void operator_callback_qtopia(void *data, void *ret, DBusError *err);
|
|
||||||
static void operator_callback_fso(void *data, void *ret, DBusError *err);
|
|
||||||
static void signal_result_free(void *data);
|
|
||||||
static void operator_result_free(void *data);
|
|
||||||
static void get_signal(void *data);
|
|
||||||
static void get_operator(void *data);
|
|
||||||
static void signal_changed(void *data, DBusMessage *msg);
|
|
||||||
static void operator_changed(void *data, DBusMessage *msg);
|
|
||||||
static void fso_operator_changed(void *data, DBusMessage *msg);
|
|
||||||
static void name_changed(void *data, DBusMessage *msg);
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
try_again(void *data)
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Try again called\n");
|
|
||||||
get_signal(data);
|
|
||||||
get_operator(data);
|
|
||||||
try_again_timer = NULL;
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
void
|
|
||||||
_e_mod_gad_gsm_init(E_Module *m)
|
|
||||||
{
|
|
||||||
mod = m;
|
|
||||||
e_gadcon_provider_register(&_gadcon_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_gad_gsm_shutdown(void)
|
|
||||||
{
|
|
||||||
e_gadcon_provider_unregister(&_gadcon_class);
|
|
||||||
mod = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
|
||||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
|
||||||
"e/modules/illume/gadget/gsm");
|
|
||||||
evas_object_show(o);
|
|
||||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
||||||
gcc->data = inst;
|
|
||||||
inst->gcc = gcc;
|
|
||||||
inst->obj = o;
|
|
||||||
e_gadcon_client_util_menu_attach(gcc);
|
|
||||||
|
|
||||||
inst->strength = -1;
|
|
||||||
inst->oper = NULL;
|
|
||||||
|
|
||||||
conn = e_dbus_bus_get(DBUS_BUS_SESSION);
|
|
||||||
conn_system = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
|
||||||
|
|
||||||
if (conn)
|
|
||||||
{
|
|
||||||
namech_h = e_dbus_signal_handler_add(conn,
|
|
||||||
E_DBUS_FDO_BUS,
|
|
||||||
E_DBUS_FDO_PATH,
|
|
||||||
E_DBUS_FDO_INTERFACE,
|
|
||||||
"NameOwnerChanged",
|
|
||||||
name_changed, inst);
|
|
||||||
changed_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"signalStrengthChanged",
|
|
||||||
signal_changed, inst);
|
|
||||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"networkOperatorChanged",
|
|
||||||
operator_changed, inst);
|
|
||||||
}
|
|
||||||
if (conn_system)
|
|
||||||
{
|
|
||||||
namech_system_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
E_DBUS_FDO_BUS,
|
|
||||||
E_DBUS_FDO_PATH,
|
|
||||||
E_DBUS_FDO_INTERFACE,
|
|
||||||
"NameOwnerChanged",
|
|
||||||
name_changed, inst);
|
|
||||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"SignalStrength",
|
|
||||||
signal_changed, inst);
|
|
||||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"Status",
|
|
||||||
fso_operator_changed, inst);
|
|
||||||
}
|
|
||||||
get_signal(inst);
|
|
||||||
get_operator(inst);
|
|
||||||
|
|
||||||
return gcc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
if (conn) e_dbus_connection_close(conn);
|
|
||||||
if (conn_system) e_dbus_connection_close(conn_system);
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
evas_object_del(inst->obj);
|
|
||||||
if (inst->oper) free(inst->oper);
|
|
||||||
free(inst);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
Evas_Coord mw, mh, mxw, mxh;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
mw = 0, mh = 0;
|
|
||||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
|
||||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
|
||||||
if ((mw < 1) || (mh < 1))
|
|
||||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
|
||||||
if (mw < 4) mw = 4;
|
|
||||||
if (mh < 4) mh = 4;
|
|
||||||
if ((mxw > 0) && (mxh > 0))
|
|
||||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
|
||||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
_gc_label(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return "GSM (Illume)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
|
|
||||||
{
|
|
||||||
/* FIXME: need icon
|
|
||||||
Evas_Object *o;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
|
||||||
e_module_dir_get(clock_module));
|
|
||||||
edje_object_file_set(o, buf, "icon");
|
|
||||||
return o;
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return _gadcon_class.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_operator(char *op, void *data)
|
|
||||||
{
|
|
||||||
Instance *inst = data;
|
|
||||||
char *poper;
|
|
||||||
|
|
||||||
poper = inst->oper;
|
|
||||||
if ((poper) && (op) && (!strcmp(op, poper))) return;
|
|
||||||
if (op) inst->oper = strdup(op);
|
|
||||||
else inst->oper = NULL;
|
|
||||||
if (inst->oper != poper)
|
|
||||||
{
|
|
||||||
Edje_Message_String msg;
|
|
||||||
|
|
||||||
if (inst->oper) msg.str = inst->oper;
|
|
||||||
else msg.str = "";
|
|
||||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_STRING, 1, &msg);
|
|
||||||
}
|
|
||||||
if (poper) free(poper);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_signal(int sig, void *data)
|
|
||||||
{
|
|
||||||
Instance *inst = data;
|
|
||||||
int pstrength;
|
|
||||||
|
|
||||||
pstrength = inst->strength;
|
|
||||||
inst->strength = sig;
|
|
||||||
|
|
||||||
if (inst->strength != pstrength)
|
|
||||||
{
|
|
||||||
Edje_Message_Float msg;
|
|
||||||
double level;
|
|
||||||
|
|
||||||
level = (double)inst->strength / 100.0;
|
|
||||||
if (level < 0.0) level = 0.0;
|
|
||||||
else if (level > 1.0) level = 1.0;
|
|
||||||
msg.val = level;
|
|
||||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_FLOAT, 1, &msg);
|
|
||||||
if ((pstrength == -1) && (inst->strength >= 0))
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
|
||||||
else if ((pstrength >= 0) && (inst->strength == -1))
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void *
|
|
||||||
signal_unmarhsall(DBusMessage *msg, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
dbus_int32_t val = -1;
|
|
||||||
|
|
||||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID))
|
|
||||||
{
|
|
||||||
int *val_ret;
|
|
||||||
|
|
||||||
val_ret = malloc(sizeof(int));
|
|
||||||
if (val_ret)
|
|
||||||
{
|
|
||||||
*val_ret = val;
|
|
||||||
return val_ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
operator_unmarhsall(DBusMessage *msg, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
|
|
||||||
{
|
|
||||||
char *str_ret;
|
|
||||||
|
|
||||||
str_ret = malloc(strlen(str)+1);
|
|
||||||
if (str_ret)
|
|
||||||
{
|
|
||||||
strcpy(str_ret, str);
|
|
||||||
return str_ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
_fso_operator_unmarhsall(DBusMessage *msg)
|
|
||||||
{
|
|
||||||
/* We care only about the provider name right now. All the other status
|
|
||||||
* informations get ingnored for the gadget for now */
|
|
||||||
const char *provider = 0 , *name = 0, *reg_stat = 0;
|
|
||||||
DBusMessageIter iter, a_iter, s_iter, v_iter;
|
|
||||||
|
|
||||||
if (!dbus_message_has_signature(msg, "a{sv}")) return NULL;
|
|
||||||
|
|
||||||
dbus_message_iter_init(msg, &iter);
|
|
||||||
dbus_message_iter_recurse(&iter, &a_iter);
|
|
||||||
while (dbus_message_iter_get_arg_type(&a_iter) != DBUS_TYPE_INVALID)
|
|
||||||
{
|
|
||||||
dbus_message_iter_recurse(&a_iter, &s_iter);
|
|
||||||
dbus_message_iter_get_basic(&s_iter, &name);
|
|
||||||
|
|
||||||
if (strcmp(name, "registration") == 0)
|
|
||||||
{
|
|
||||||
dbus_message_iter_next(&s_iter);
|
|
||||||
dbus_message_iter_recurse(&s_iter, &v_iter);
|
|
||||||
dbus_message_iter_get_basic(&v_iter, ®_stat);
|
|
||||||
}
|
|
||||||
if (strcmp(name, "provider") == 0)
|
|
||||||
{
|
|
||||||
dbus_message_iter_next(&s_iter);
|
|
||||||
dbus_message_iter_recurse(&s_iter, &v_iter);
|
|
||||||
dbus_message_iter_get_basic(&v_iter, &provider);
|
|
||||||
}
|
|
||||||
dbus_message_iter_next(&a_iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reg_stat) return NULL;
|
|
||||||
if (strcmp(reg_stat, "unregistered") == 0) provider = "No Service";
|
|
||||||
else if (strcmp(reg_stat, "busy") == 0) provider = "Searching...";
|
|
||||||
else if (strcmp(reg_stat, "denied") == 0) provider = "SOS only";
|
|
||||||
|
|
||||||
if (!provider) return NULL;
|
|
||||||
|
|
||||||
return strdup(provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
fso_operator_unmarhsall(DBusMessage *msg, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
return _fso_operator_unmarhsall(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
signal_callback_qtopia(void *data, void *ret, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Qtopia signal callback called\n");
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
int *val_ret;
|
|
||||||
|
|
||||||
if ((detected_system == PH_SYS_UNKNOWN) && (changed_h) && (conn))
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn, changed_h);
|
|
||||||
changed_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"signalStrengthChanged",
|
|
||||||
signal_changed, data);
|
|
||||||
detected_system = PH_SYS_QTOPIA;
|
|
||||||
}
|
|
||||||
val_ret = ret;
|
|
||||||
update_signal(*val_ret, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Qtopia signal callback else part called\n");
|
|
||||||
detected_system = PH_SYS_UNKNOWN;
|
|
||||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
|
||||||
try_again_timer = ecore_timer_add(5.0, try_again, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
signal_callback_fso(void *data, void *ret, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: FSO signal callback called\n");
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
int *val_ret;
|
|
||||||
|
|
||||||
if ((detected_system == PH_SYS_UNKNOWN) && (changed_fso_h) && (conn_system))
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn_system, changed_fso_h);
|
|
||||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"SignalStrength",
|
|
||||||
signal_changed, data);
|
|
||||||
detected_system = PH_SYS_FSO;
|
|
||||||
}
|
|
||||||
val_ret = ret;
|
|
||||||
update_signal(*val_ret, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: FSO signal callback else part called\n");
|
|
||||||
detected_system = PH_SYS_UNKNOWN;
|
|
||||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
|
||||||
try_again_timer = ecore_timer_add(5.0, try_again, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
operator_callback_qtopia(void *data, void *ret, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Qtopia operator callback called\n");
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
if ((detected_system == PH_SYS_UNKNOWN) && (operatorch_h) && (conn))
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn, operatorch_h);
|
|
||||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"networkOperatorChanged",
|
|
||||||
operator_changed, data);
|
|
||||||
detected_system = PH_SYS_QTOPIA;
|
|
||||||
}
|
|
||||||
update_operator(ret, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Qtopia operator callback else part called\n");
|
|
||||||
detected_system = PH_SYS_UNKNOWN;
|
|
||||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
|
||||||
try_again_timer = ecore_timer_add(5.0, try_again, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
operator_callback_fso(void *data, void *ret, DBusError *err __UNUSED__)
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: FSO operator callback called\n");
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
if ((detected_system == PH_SYS_UNKNOWN) && (operatorch_fso_h) && (conn_system))
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn_system, operatorch_fso_h);
|
|
||||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"Status",
|
|
||||||
fso_operator_changed, data);
|
|
||||||
detected_system = PH_SYS_FSO;
|
|
||||||
}
|
|
||||||
update_operator(ret, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: FSO operator callback else part called\n");
|
|
||||||
detected_system = PH_SYS_UNKNOWN;
|
|
||||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
|
||||||
try_again_timer = ecore_timer_add(5.0, try_again, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
signal_result_free(void *data)
|
|
||||||
{
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
operator_result_free(void *data)
|
|
||||||
{
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_signal(void *data)
|
|
||||||
{
|
|
||||||
DBusMessage *msg;
|
|
||||||
|
|
||||||
// printf("GSM-gadget: Get signal called\n");
|
|
||||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_QTOPIA)) && (conn))
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"signalStrength");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
e_dbus_method_call_send(conn, msg,
|
|
||||||
signal_unmarhsall,
|
|
||||||
signal_callback_qtopia,
|
|
||||||
signal_result_free, -1, data);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_FSO)) && (conn_system))
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"GetSignalStrength");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
e_dbus_method_call_send(conn_system, msg,
|
|
||||||
signal_unmarhsall,
|
|
||||||
signal_callback_fso,
|
|
||||||
signal_result_free, -1, data);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_operator(void *data)
|
|
||||||
{
|
|
||||||
DBusMessage *msg;
|
|
||||||
|
|
||||||
// printf("GSM-gadget: Get operator called\n");
|
|
||||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_QTOPIA)) && (conn))
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"networkOperator");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
e_dbus_method_call_send(conn, msg,
|
|
||||||
operator_unmarhsall,
|
|
||||||
operator_callback_qtopia,
|
|
||||||
operator_result_free, -1, data);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_FSO)) && (conn_system))
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"GetStatus");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
e_dbus_method_call_send(conn_system, msg,
|
|
||||||
fso_operator_unmarhsall,
|
|
||||||
operator_callback_fso,
|
|
||||||
operator_result_free, -1, data);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
signal_changed(void *data, DBusMessage *msg)
|
|
||||||
{
|
|
||||||
DBusError err;
|
|
||||||
dbus_int32_t val = -1;
|
|
||||||
|
|
||||||
dbus_error_init(&err);
|
|
||||||
if (!dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID))
|
|
||||||
return;
|
|
||||||
update_signal(val, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
operator_changed(void *data, DBusMessage *msg)
|
|
||||||
{
|
|
||||||
DBusError err;
|
|
||||||
char *str = NULL;
|
|
||||||
|
|
||||||
dbus_error_init(&err);
|
|
||||||
if (!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
|
|
||||||
return;
|
|
||||||
update_operator(str, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
fso_operator_changed(void *data, DBusMessage *msg)
|
|
||||||
{
|
|
||||||
char *provider;
|
|
||||||
|
|
||||||
provider = _fso_operator_unmarhsall(msg);
|
|
||||||
update_operator(provider, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
name_changed(void *data, DBusMessage *msg)
|
|
||||||
{
|
|
||||||
DBusError err;
|
|
||||||
const char *s1, *s2, *s3;
|
|
||||||
|
|
||||||
dbus_error_init(&err);
|
|
||||||
if (!dbus_message_get_args(msg, &err,
|
|
||||||
DBUS_TYPE_STRING, &s1,
|
|
||||||
DBUS_TYPE_STRING, &s2,
|
|
||||||
DBUS_TYPE_STRING, &s3,
|
|
||||||
DBUS_TYPE_INVALID))
|
|
||||||
return;
|
|
||||||
if ((!strcmp(s1, "org.openmoko.qtopia.Phonestatus")) && (conn))
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: Qtopia name owner changed\n");
|
|
||||||
if (changed_h)
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn, changed_h);
|
|
||||||
changed_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"signalStrengthChanged",
|
|
||||||
signal_changed, data);
|
|
||||||
get_signal(data);
|
|
||||||
}
|
|
||||||
if (operatorch_h)
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn, operatorch_h);
|
|
||||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"/Status",
|
|
||||||
"org.openmoko.qtopia.Phonestatus",
|
|
||||||
"networkOperatorChanged",
|
|
||||||
operator_changed, data);
|
|
||||||
get_operator(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((!strcmp(s1, "org.freesmartphone.ogsmd")) && (conn_system))
|
|
||||||
{
|
|
||||||
// printf("GSM-gadget: FSO name owner changed\n");
|
|
||||||
if (changed_fso_h)
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn_system, changed_fso_h);
|
|
||||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"SignalStrength",
|
|
||||||
signal_changed, data);
|
|
||||||
get_signal(data);
|
|
||||||
}
|
|
||||||
if (operatorch_fso_h)
|
|
||||||
{
|
|
||||||
e_dbus_signal_handler_del(conn_system, operatorch_fso_h);
|
|
||||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
|
||||||
"org.freesmartphone.ogsmd",
|
|
||||||
"/org/freesmartphone/GSM/Device",
|
|
||||||
"org.freesmartphone.GSM.Network",
|
|
||||||
"Status",
|
|
||||||
fso_operator_changed, data);
|
|
||||||
get_operator(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef E_MOD_GAD_GSM_H
|
|
||||||
#define E_MOD_GAD_GSM_H
|
|
||||||
|
|
||||||
void _e_mod_gad_gsm_init(E_Module *m);
|
|
||||||
void _e_mod_gad_gsm_shutdown(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,210 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
|
|
||||||
typedef struct _Instance Instance;
|
|
||||||
|
|
||||||
struct _Instance
|
|
||||||
{
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Evas_Object *obj;
|
|
||||||
Ecore_Poller *poller;
|
|
||||||
int on;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* gadcon requirements */
|
|
||||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
|
||||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
||||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
||||||
/* and actually define the gadcon class that this module provides (just 1) */
|
|
||||||
static const E_Gadcon_Client_Class _gadcon_class =
|
|
||||||
{
|
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
|
||||||
"illume-usb",
|
|
||||||
{
|
|
||||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
||||||
e_gadcon_site_is_not_toolbar
|
|
||||||
},
|
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
|
||||||
};
|
|
||||||
static E_Module *mod = NULL;
|
|
||||||
|
|
||||||
static Eina_Bool _cb_poll(void *data);
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
void
|
|
||||||
_e_mod_gad_usb_init(E_Module *m)
|
|
||||||
{
|
|
||||||
mod = m;
|
|
||||||
e_gadcon_provider_register(&_gadcon_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_gad_usb_shutdown(void)
|
|
||||||
{
|
|
||||||
e_gadcon_provider_unregister(&_gadcon_class);
|
|
||||||
mod = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
|
||||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
|
||||||
"e/modules/illume/gadget/usb");
|
|
||||||
evas_object_show(o);
|
|
||||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
||||||
gcc->data = inst;
|
|
||||||
inst->gcc = gcc;
|
|
||||||
inst->obj = o;
|
|
||||||
e_gadcon_client_util_menu_attach(gcc);
|
|
||||||
|
|
||||||
inst->on = -1;
|
|
||||||
inst->poller = ecore_poller_add(ECORE_POLLER_CORE, 16, _cb_poll, inst);
|
|
||||||
|
|
||||||
return gcc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
ecore_poller_del(inst->poller);
|
|
||||||
evas_object_del(inst->obj);
|
|
||||||
free(inst);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
Evas_Coord mw, mh, mxw, mxh;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
mw = 0, mh = 0;
|
|
||||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
|
||||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
|
||||||
if ((mw < 1) || (mh < 1))
|
|
||||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
|
||||||
if (mw < 4) mw = 4;
|
|
||||||
if (mh < 4) mh = 4;
|
|
||||||
if ((mxw > 0) && (mxh > 0))
|
|
||||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
|
||||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
_gc_label(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return "USB (Illume)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
|
|
||||||
{
|
|
||||||
/* FIXME: need icon
|
|
||||||
Evas_Object *o;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
|
||||||
e_module_dir_get(clock_module));
|
|
||||||
edje_object_file_set(o, buf, "icon");
|
|
||||||
return o;
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return _gadcon_class.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_find_interface_class(int iclass)
|
|
||||||
{
|
|
||||||
Eina_List *devs;
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
devs = ecore_file_ls("/sys/bus/usb/devices");
|
|
||||||
EINA_LIST_FREE(devs, name)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s/%s",
|
|
||||||
"/sys/bus/usb/devices", name, "bInterfaceClass");
|
|
||||||
f = fopen(buf, "r");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
if (fgets(buf, sizeof(buf), f))
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
|
|
||||||
sscanf(buf, "%x", &id);
|
|
||||||
if (iclass == id)
|
|
||||||
{
|
|
||||||
EINA_LIST_FREE(devs, name)
|
|
||||||
free(name);
|
|
||||||
fclose(f);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(name);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_poll(void *data)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
int pon;
|
|
||||||
|
|
||||||
inst = data;
|
|
||||||
/* FIXME: get bt status and emit signal */
|
|
||||||
pon = inst->on;
|
|
||||||
inst->on = _find_interface_class(0x09);
|
|
||||||
if (inst->on != pon)
|
|
||||||
{
|
|
||||||
if (inst->on)
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
|
||||||
else
|
|
||||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
|
||||||
}
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef E_MOD_GAD_USB_H
|
|
||||||
#define E_MOD_GAD_USB_H
|
|
||||||
|
|
||||||
void _e_mod_gad_usb_init(E_Module *m);
|
|
||||||
void _e_mod_gad_usb_shutdown(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,241 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
|
|
||||||
typedef struct _Instance Instance;
|
|
||||||
|
|
||||||
struct _Instance
|
|
||||||
{
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Evas_Object *obj;
|
|
||||||
Ecore_Exe *wifiget_exe;
|
|
||||||
Ecore_Event_Handler *wifiget_data_handler;
|
|
||||||
Ecore_Event_Handler *wifiget_del_handler;
|
|
||||||
int strength;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* gadcon requirements */
|
|
||||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
|
||||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
||||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
||||||
/* and actually define the gadcon class that this module provides (just 1) */
|
|
||||||
static const E_Gadcon_Client_Class _gadcon_class =
|
|
||||||
{
|
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
|
||||||
"illume-wifi",
|
|
||||||
{
|
|
||||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
||||||
e_gadcon_site_is_not_toolbar
|
|
||||||
},
|
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
|
||||||
};
|
|
||||||
static E_Module *mod = NULL;
|
|
||||||
|
|
||||||
static void _wifiget_spawn(Instance *inst);
|
|
||||||
static void _wifiget_kill(Instance *inst);
|
|
||||||
static Eina_Bool _wifiget_cb_exe_data(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _wifiget_cb_exe_del(void *data, int type, void *event);
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
void
|
|
||||||
_e_mod_gad_wifi_init(E_Module *m)
|
|
||||||
{
|
|
||||||
mod = m;
|
|
||||||
e_gadcon_provider_register(&_gadcon_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_gad_wifi_shutdown(void)
|
|
||||||
{
|
|
||||||
e_gadcon_provider_unregister(&_gadcon_class);
|
|
||||||
mod = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
E_Gadcon_Client *gcc;
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
|
||||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
|
||||||
"e/modules/illume/gadget/wifi");
|
|
||||||
evas_object_show(o);
|
|
||||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
||||||
gcc->data = inst;
|
|
||||||
inst->gcc = gcc;
|
|
||||||
inst->obj = o;
|
|
||||||
e_gadcon_client_util_menu_attach(gcc);
|
|
||||||
|
|
||||||
inst->strength = -1;
|
|
||||||
_wifiget_spawn(inst);
|
|
||||||
|
|
||||||
return gcc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
_wifiget_kill(inst);
|
|
||||||
evas_object_del(inst->obj);
|
|
||||||
free(inst);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
|
|
||||||
{
|
|
||||||
Instance *inst;
|
|
||||||
Evas_Coord mw, mh, mxw, mxh;
|
|
||||||
|
|
||||||
inst = gcc->data;
|
|
||||||
mw = 0, mh = 0;
|
|
||||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
|
||||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
|
||||||
if ((mw < 1) || (mh < 1))
|
|
||||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
|
||||||
if (mw < 4) mw = 4;
|
|
||||||
if (mh < 4) mh = 4;
|
|
||||||
if ((mxw > 0) && (mxh > 0))
|
|
||||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
|
||||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
_gc_label(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return "Wifi (Illume)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
|
|
||||||
{
|
|
||||||
/* FIXME: need icon
|
|
||||||
Evas_Object *o;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
|
||||||
e_module_dir_get(clock_module));
|
|
||||||
edje_object_file_set(o, buf, "icon");
|
|
||||||
return o;
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
|
|
||||||
{
|
|
||||||
return _gadcon_class.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_wifiget_spawn(Instance *inst)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
if (inst->wifiget_exe) return;
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s/wifiget %i",
|
|
||||||
e_module_dir_get(mod), MODULE_ARCH, 8);
|
|
||||||
inst->wifiget_exe = ecore_exe_pipe_run(buf,
|
|
||||||
ECORE_EXE_PIPE_READ |
|
|
||||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
|
|
||||||
ECORE_EXE_NOT_LEADER,
|
|
||||||
inst);
|
|
||||||
inst->wifiget_data_handler =
|
|
||||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _wifiget_cb_exe_data, inst);
|
|
||||||
inst->wifiget_del_handler =
|
|
||||||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _wifiget_cb_exe_del, inst);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_wifiget_kill(Instance *inst)
|
|
||||||
{
|
|
||||||
if (!inst->wifiget_exe) return;
|
|
||||||
ecore_exe_terminate(inst->wifiget_exe);
|
|
||||||
ecore_exe_free(inst->wifiget_exe);
|
|
||||||
inst->wifiget_exe = NULL;
|
|
||||||
ecore_event_handler_del(inst->wifiget_data_handler);
|
|
||||||
inst->wifiget_data_handler = NULL;
|
|
||||||
ecore_event_handler_del(inst->wifiget_del_handler);
|
|
||||||
inst->wifiget_del_handler = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_wifiget_cb_exe_data(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Exe_Event_Data *ev;
|
|
||||||
Instance *inst;
|
|
||||||
int pstrength;
|
|
||||||
|
|
||||||
inst = data;
|
|
||||||
ev = event;
|
|
||||||
if (ev->exe != inst->wifiget_exe) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
pstrength = inst->strength;
|
|
||||||
if ((ev->lines) && (ev->lines[0].line))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; ev->lines[i].line; i++)
|
|
||||||
{
|
|
||||||
if (!strcmp(ev->lines[i].line, "ERROR"))
|
|
||||||
inst->strength = -999;
|
|
||||||
else
|
|
||||||
inst->strength = atoi(ev->lines[i].line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inst->strength != pstrength)
|
|
||||||
{
|
|
||||||
Edje_Message_Float msg;
|
|
||||||
double level;
|
|
||||||
|
|
||||||
level = (double)inst->strength / 100.0;
|
|
||||||
if (level < 0.0) level = 0.0;
|
|
||||||
else if (level > 1.0) level = 1.0;
|
|
||||||
msg.val = level;
|
|
||||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_FLOAT, 1, &msg);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_wifiget_cb_exe_del(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Exe_Event_Del *ev;
|
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
inst = data;
|
|
||||||
ev = event;
|
|
||||||
if (ev->exe != inst->wifiget_exe) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
inst->wifiget_exe = NULL;
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef E_MOD_GAD_WIFI_H
|
|
||||||
#define E_MOD_GAD_WIFI_H
|
|
||||||
|
|
||||||
void _e_mod_gad_wifi_init(E_Module *m);
|
|
||||||
void _e_mod_gad_wifi_shutdown(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,818 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_mod_main.h"
|
|
||||||
#include "e_mod_layout.h"
|
|
||||||
#include "e_kbd.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
#include "e_slipshelf.h"
|
|
||||||
|
|
||||||
/* FIXME: THIS CODE IS UGLY. MUST FIX!!!!! */
|
|
||||||
|
|
||||||
#define POST_NONE 0
|
|
||||||
#define POST_HIDE 1
|
|
||||||
#define POST_CLOSE 2
|
|
||||||
|
|
||||||
typedef struct _Effect Effect;
|
|
||||||
|
|
||||||
struct _Effect
|
|
||||||
{
|
|
||||||
E_Border *border;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
double time_start, in;
|
|
||||||
int direction;
|
|
||||||
int post;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Eina_Bool _e_mod_layout_cb_effect_animator(void *data);
|
|
||||||
static void _e_mod_layout_effect_slide_out(E_Border *bd, double in, int post);
|
|
||||||
static void _e_mod_layout_effect_slide_in(E_Border *bd, double in, int post);
|
|
||||||
static void _e_mod_layout_cb_hook_post_fetch(void *data, void *data2);
|
|
||||||
static void _e_mod_layout_post_border_assign(E_Border *bd, int not_new);
|
|
||||||
static void _e_mod_layout_cb_hook_post_border_assign(void *data, void *data2);
|
|
||||||
static void _e_mod_layout_cb_hook_end(void *data, void *data2);
|
|
||||||
static Eina_Bool _cb_event_border_add(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_border_remove(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_border_focus_in(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_border_focus_out(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_border_show(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_border_hide(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _cb_event_zone_move_resize(void *data, int type, void *event);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static E_Border_Hook *hook1 = NULL;
|
|
||||||
static E_Border_Hook *hook2 = NULL;
|
|
||||||
static E_Border_Hook *hook3 = NULL;
|
|
||||||
static Eina_List *handlers = NULL;
|
|
||||||
static Eina_List *effects = NULL;
|
|
||||||
|
|
||||||
/* mainwin is the main big window currently focused/visible */
|
|
||||||
static E_Border *dockwin = NULL;
|
|
||||||
static int dockwin_use = 0;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
void
|
|
||||||
_e_mod_layout_init(E_Module *m __UNUSED__)
|
|
||||||
{
|
|
||||||
hook1 = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH,
|
|
||||||
_e_mod_layout_cb_hook_post_fetch, NULL);
|
|
||||||
hook2 = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
|
|
||||||
_e_mod_layout_cb_hook_post_border_assign, NULL);
|
|
||||||
hook3 = e_border_hook_add(E_BORDER_HOOK_EVAL_END,
|
|
||||||
_e_mod_layout_cb_hook_end, NULL);
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_ADD, _cb_event_border_add, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_REMOVE,
|
|
||||||
_cb_event_border_remove, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_FOCUS_IN,
|
|
||||||
_cb_event_border_focus_in, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_FOCUS_OUT,
|
|
||||||
_cb_event_border_focus_out, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_SHOW,
|
|
||||||
_cb_event_border_show, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_BORDER_HIDE,
|
|
||||||
_cb_event_border_hide, NULL));
|
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_ZONE_MOVE_RESIZE,
|
|
||||||
_cb_event_zone_move_resize, NULL));
|
|
||||||
|
|
||||||
{
|
|
||||||
E_Zone *zone;
|
|
||||||
unsigned int area[4];
|
|
||||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
|
||||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
|
||||||
Ecore_X_Atom *supported, *supported_new;
|
|
||||||
int i, supported_num;
|
|
||||||
|
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
e_slipshelf_safe_app_region_get(zone, &wx, &wy, &ww, &wh);
|
|
||||||
e_kbd_safe_app_region_get(zone, &wx2, &wy2, &ww2, &wh2);
|
|
||||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
|
||||||
area[0] = wx;
|
|
||||||
area[1] = wy;
|
|
||||||
area[2] = ww;
|
|
||||||
area[3] = wh;
|
|
||||||
ecore_x_netwm_desk_workareas_set(zone->container->manager->root,
|
|
||||||
area, 1);
|
|
||||||
|
|
||||||
if (ecore_x_netwm_supported_get(zone->container->manager->root,
|
|
||||||
&supported, &supported_num))
|
|
||||||
{
|
|
||||||
int have_it = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < supported_num; i++)
|
|
||||||
{
|
|
||||||
if (supported[i] == ECORE_X_ATOM_NET_WORKAREA)
|
|
||||||
{
|
|
||||||
have_it = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!have_it)
|
|
||||||
{
|
|
||||||
supported_new = malloc(sizeof(Ecore_X_Atom) * (supported_num + 1));
|
|
||||||
if (supported_new)
|
|
||||||
{
|
|
||||||
memcpy(supported_new, supported, sizeof(Ecore_X_Atom) * supported_num);
|
|
||||||
supported_new[supported_num] = ECORE_X_ATOM_NET_WORKAREA;
|
|
||||||
supported_num++;
|
|
||||||
ecore_x_netwm_supported_set(zone->container->manager->root,
|
|
||||||
supported_new, supported_num);
|
|
||||||
free(supported_new);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(supported);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Ecore_X_Atom atom;
|
|
||||||
|
|
||||||
atom = ECORE_X_ATOM_NET_WORKAREA;
|
|
||||||
ecore_x_netwm_supported_set(zone->container->manager->root,
|
|
||||||
&atom, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_layout_shutdown(void)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
if (hook1)
|
|
||||||
{
|
|
||||||
e_border_hook_del(hook1);
|
|
||||||
hook1 = NULL;
|
|
||||||
}
|
|
||||||
if (hook2)
|
|
||||||
{
|
|
||||||
e_border_hook_del(hook2);
|
|
||||||
hook2 = NULL;
|
|
||||||
}
|
|
||||||
if (hook3)
|
|
||||||
{
|
|
||||||
e_border_hook_del(hook3);
|
|
||||||
hook3 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
EINA_LIST_FREE(handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_layout_border_hide(E_Border *bd)
|
|
||||||
{
|
|
||||||
_e_mod_layout_effect_slide_out(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_HIDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_layout_border_close(E_Border *bd)
|
|
||||||
{
|
|
||||||
_e_mod_layout_effect_slide_out(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_layout_border_show(E_Border *bd)
|
|
||||||
{
|
|
||||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
|
||||||
e_desk_show(bd->desk);
|
|
||||||
e_border_uniconify(bd);
|
|
||||||
e_border_show(bd);
|
|
||||||
e_border_raise(bd);
|
|
||||||
e_border_focus_set(bd, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_e_mod_layout_apply_all(void)
|
|
||||||
{
|
|
||||||
Eina_List *l, *borders;
|
|
||||||
|
|
||||||
borders = e_border_client_list();
|
|
||||||
for (l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
_e_mod_layout_post_border_assign(bd, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Eina_Bool
|
|
||||||
_e_mod_layout_cb_effect_animator(void *data)
|
|
||||||
{
|
|
||||||
Effect *ef;
|
|
||||||
double t, p;
|
|
||||||
|
|
||||||
ef = data;
|
|
||||||
t = ecore_loop_time_get() - ef->time_start;
|
|
||||||
if (ef->in > 0.0)
|
|
||||||
{
|
|
||||||
t /= ef->in;
|
|
||||||
if (t > 1.0) t = 1.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = 1.0 - t;
|
|
||||||
p = 1.0 - (p * p * p * p);
|
|
||||||
|
|
||||||
if (ef->direction == 1)
|
|
||||||
e_border_fx_offset(ef->border, 0, (-ef->border->zone->h * (1.0 - p)));
|
|
||||||
else
|
|
||||||
e_border_fx_offset(ef->border, 0, (-ef->border->zone->h * p));
|
|
||||||
|
|
||||||
if (t >= 1.0)
|
|
||||||
{
|
|
||||||
if (ef->post == POST_HIDE)
|
|
||||||
{
|
|
||||||
e_border_iconify(ef->border);
|
|
||||||
// e_border_focus_set(ef->border, 0, 1);
|
|
||||||
// printf("hide - focus out\n");
|
|
||||||
}
|
|
||||||
else if (ef->post == POST_CLOSE)
|
|
||||||
{
|
|
||||||
// e_border_focus_set(ef->border, 0, 1);
|
|
||||||
// printf("close - focus out\n");
|
|
||||||
// e_border_iconify(ef->border);
|
|
||||||
e_border_act_close_begin(ef->border);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// printf("show - focus in\n");
|
|
||||||
// e_border_focus_set(ef->border, 1, 1);
|
|
||||||
}
|
|
||||||
e_border_fx_offset(ef->border, 0, 0);
|
|
||||||
effects = eina_list_remove(effects, ef);
|
|
||||||
free(ef);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_effect_slide_out(E_Border *bd, double in, int post)
|
|
||||||
{
|
|
||||||
Effect *ef;
|
|
||||||
|
|
||||||
ef = E_NEW(Effect, 1);
|
|
||||||
ef->border = bd;
|
|
||||||
ef->animator = ecore_animator_add(_e_mod_layout_cb_effect_animator, ef);
|
|
||||||
ef->time_start = ecore_loop_time_get();
|
|
||||||
ef->in = in;
|
|
||||||
ef->direction = 0;
|
|
||||||
ef->post = post;
|
|
||||||
effects = eina_list_append(effects, ef);
|
|
||||||
|
|
||||||
e_border_fx_offset(ef->border, 0, 0);
|
|
||||||
if (in <= 0.0)
|
|
||||||
{
|
|
||||||
ef->animator = ecore_animator_del(ef->animator);
|
|
||||||
ef->animator = NULL;
|
|
||||||
_e_mod_layout_cb_effect_animator(ef);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_effect_slide_in(E_Border *bd, double in, int post)
|
|
||||||
{
|
|
||||||
Effect *ef;
|
|
||||||
|
|
||||||
ef = E_NEW(Effect, 1);
|
|
||||||
ef->border = bd;
|
|
||||||
ef->animator = ecore_animator_add(_e_mod_layout_cb_effect_animator, ef);
|
|
||||||
ef->time_start = ecore_loop_time_get();
|
|
||||||
ef->in = in;
|
|
||||||
ef->direction = 1;
|
|
||||||
ef->post = post;
|
|
||||||
effects = eina_list_append(effects, ef);
|
|
||||||
|
|
||||||
if (ef->border->iconic)
|
|
||||||
e_border_uniconify(ef->border);
|
|
||||||
e_border_focus_set(bd, 1, 1);
|
|
||||||
e_border_fx_offset(ef->border, 0, -ef->border->zone->h);
|
|
||||||
if (in <= 0.0)
|
|
||||||
{
|
|
||||||
ef->animator = ecore_animator_del(ef->animator);
|
|
||||||
ef->animator = NULL;
|
|
||||||
_e_mod_layout_cb_effect_animator(ef);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ecore_Timer *_dockwin_hide_timer = NULL;
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_mod_layout_cb_docwin_hide(void *data __UNUSED__)
|
|
||||||
{
|
|
||||||
_dockwin_hide_timer = NULL;
|
|
||||||
if (!dockwin) return ECORE_CALLBACK_CANCEL;
|
|
||||||
e_border_hide(dockwin, 2);
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_dockwin_show(void)
|
|
||||||
{
|
|
||||||
// if (dockwin_use) return;
|
|
||||||
dockwin_use = 1;
|
|
||||||
if (_dockwin_hide_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(_dockwin_hide_timer);
|
|
||||||
_dockwin_hide_timer = NULL;
|
|
||||||
}
|
|
||||||
if (!dockwin) return;
|
|
||||||
e_border_show(dockwin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_dockwin_hide(void)
|
|
||||||
{
|
|
||||||
// if (!dockwin_use) return;
|
|
||||||
dockwin_use = 0;
|
|
||||||
if (_dockwin_hide_timer) ecore_timer_del(_dockwin_hide_timer);
|
|
||||||
_dockwin_hide_timer = ecore_timer_add(0.2, _e_mod_layout_cb_docwin_hide, NULL);
|
|
||||||
/*
|
|
||||||
if (!dockwin) return;
|
|
||||||
e_border_hide(dockwin, 2);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_is_dialog(E_Border *bd)
|
|
||||||
{
|
|
||||||
int isdialog = 0, i;
|
|
||||||
|
|
||||||
if (bd->client.icccm.transient_for != 0)
|
|
||||||
isdialog = 1;
|
|
||||||
if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
|
|
||||||
{
|
|
||||||
isdialog = 1;
|
|
||||||
if (bd->client.netwm.extra_types)
|
|
||||||
{
|
|
||||||
for (i = 0; i < bd->client.netwm.extra_types_num; i++)
|
|
||||||
{
|
|
||||||
if (bd->client.netwm.extra_types[i] ==
|
|
||||||
ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
|
|
||||||
if ((bd->client.netwm.extra_types[i] !=
|
|
||||||
ECORE_X_WINDOW_TYPE_DIALOG) &&
|
|
||||||
(bd->client.netwm.extra_types[i] !=
|
|
||||||
ECORE_X_WINDOW_TYPE_SPLASH))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isdialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_cb_hook_post_fetch(void *data __UNUSED__, void *data2)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
if (!(bd = data2)) return;
|
|
||||||
if (bd->stolen) return;
|
|
||||||
if (bd->new_client)
|
|
||||||
{
|
|
||||||
if (bd->remember)
|
|
||||||
{
|
|
||||||
if (bd->bordername)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(bd->bordername);
|
|
||||||
bd->bordername = NULL;
|
|
||||||
bd->client.border.changed = 1;
|
|
||||||
}
|
|
||||||
e_remember_unuse(bd->remember);
|
|
||||||
bd->remember = NULL;
|
|
||||||
}
|
|
||||||
if (!_is_dialog(bd))
|
|
||||||
{
|
|
||||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
|
||||||
bd->client.border.changed = 1;
|
|
||||||
}
|
|
||||||
bd->client.e.state.centered = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_post_border_assign(E_Border *bd, int not_new)
|
|
||||||
{
|
|
||||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
|
||||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
|
||||||
int isdialog = 0;
|
|
||||||
int pbx, pby, pbw, pbh;
|
|
||||||
|
|
||||||
if (bd->stolen) return;
|
|
||||||
/* FIXME: make some modification based on policy */
|
|
||||||
if ((bd->new_client) && (not_new)) return;
|
|
||||||
pbx = bd->x;
|
|
||||||
pby = bd->y;
|
|
||||||
pbw = bd->w;
|
|
||||||
pbh = bd->h;
|
|
||||||
isdialog = _is_dialog(bd);
|
|
||||||
e_slipshelf_safe_app_region_get(bd->zone, &wx, &wy, &ww, &wh);
|
|
||||||
e_kbd_safe_app_region_get(bd->zone, &wx2, &wy2, &ww2, &wh2);
|
|
||||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
|
||||||
bd->client.e.state.centered = 0;
|
|
||||||
if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
|
|
||||||
(bd->client.qtopia.soft_menu))
|
|
||||||
{
|
|
||||||
{
|
|
||||||
unsigned int area[4];
|
|
||||||
|
|
||||||
dockwin = bd;
|
|
||||||
dockwin->lock_focus_out = 1;
|
|
||||||
area[0] = wx;
|
|
||||||
area[1] = wy;
|
|
||||||
area[2] = ww;
|
|
||||||
area[3] = wh - bd->h;
|
|
||||||
ecore_x_netwm_desk_workareas_set(bd->zone->container->manager->root,
|
|
||||||
area, 1);
|
|
||||||
// wy = wy + wh - bd->h;
|
|
||||||
// wh = bd->h;
|
|
||||||
if (bd->new_client)
|
|
||||||
{
|
|
||||||
_e_mod_layout_dockwin_show();
|
|
||||||
_e_mod_layout_dockwin_hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isdialog)
|
|
||||||
{
|
|
||||||
if (dockwin) wh -= dockwin->h;
|
|
||||||
// if (ww > (bd->client.icccm.min_w + bd->client_inset.l + bd->client_inset.r))
|
|
||||||
// ww = bd->client.icccm.min_w + bd->client_inset.l + bd->client_inset.r;
|
|
||||||
bd->w = ww;
|
|
||||||
if (bd->client.h < bd->client.icccm.min_h)
|
|
||||||
bd->h = bd->client.icccm.min_h +
|
|
||||||
bd->client_inset.t + bd->client_inset.b;
|
|
||||||
if (bd->h > wh) bd->h = wh;
|
|
||||||
bd->client.w = bd->w - bd->client_inset.l - bd->client_inset.r;
|
|
||||||
bd->client.h = bd->h - bd->client_inset.t - bd->client_inset.b;
|
|
||||||
bd->changes.size = 1;
|
|
||||||
// if (bd->client.icccm.max_w < bd->client.w)
|
|
||||||
// bd->client.icccm.max_w = bd->client.w;
|
|
||||||
// if (bd->client.icccm.base_w > bd->client.w)
|
|
||||||
// bd->client.icccm.base_w = bd->client.w;
|
|
||||||
// if (bd->client.icccm.base_h > (wh - bd->client_inset.t - bd->client_inset.b))
|
|
||||||
// bd->client.icccm.base_h = wh - bd->client_inset.t - bd->client_inset.b;
|
|
||||||
// if (bd->client.icccm.min_w > bd->client.w)
|
|
||||||
// bd->client.icccm.min_w = bd->client.w;
|
|
||||||
// if (bd->client.icccm.min_h > (wh - bd->client_inset.t - bd->client_inset.b))
|
|
||||||
// bd->client.icccm.min_h = wh - bd->client_inset.t - bd->client_inset.b;
|
|
||||||
if (bd->new_client)
|
|
||||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((dockwin) && (dockwin->client.qtopia.soft_menu) &&
|
|
||||||
(bd->client.qtopia.soft_menus))
|
|
||||||
{
|
|
||||||
wh -= dockwin->h;
|
|
||||||
}
|
|
||||||
if (bd->new_client)
|
|
||||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bd == dockwin)
|
|
||||||
{
|
|
||||||
bd->x = 0;
|
|
||||||
bd->y = wy + wh - bd->h;
|
|
||||||
bd->w = ww;
|
|
||||||
|
|
||||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
|
||||||
(pbw != bd->w) || (pbh != bd->h))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (bd->internal_ecore_evas)
|
|
||||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t);
|
|
||||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t,
|
|
||||||
bd->client.w,
|
|
||||||
bd->client.h);
|
|
||||||
*/ bd->changed = 1;
|
|
||||||
bd->changes.pos = 1;
|
|
||||||
bd->changes.size = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bd->lock_border = 1;
|
|
||||||
|
|
||||||
bd->lock_client_location = 1;
|
|
||||||
bd->lock_client_size = 1;
|
|
||||||
// bd->lock_client_stacking = 1;
|
|
||||||
bd->lock_client_desk = 1;
|
|
||||||
bd->lock_client_sticky = 1;
|
|
||||||
bd->lock_client_shade = 1;
|
|
||||||
bd->lock_client_maximize = 1;
|
|
||||||
|
|
||||||
bd->lock_user_location = 1;
|
|
||||||
bd->lock_user_size = 1;
|
|
||||||
// bd->lock_user_stacking = 1;
|
|
||||||
bd->lock_user_desk = 1;
|
|
||||||
bd->lock_user_sticky = 1;
|
|
||||||
bd->lock_user_shade = 1;
|
|
||||||
bd->lock_user_maximize = 1;
|
|
||||||
}
|
|
||||||
else if (isdialog)
|
|
||||||
{
|
|
||||||
// if (bd->new_client)
|
|
||||||
{
|
|
||||||
bd->client.e.state.centered = 0;
|
|
||||||
if (bd->new_client)
|
|
||||||
{
|
|
||||||
bd->x = wx + ((ww - bd->w) / 2);
|
|
||||||
bd->y = wy + ((wh - bd->h) / 2);
|
|
||||||
}
|
|
||||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
|
||||||
(pbw != bd->w) || (pbh != bd->h))
|
|
||||||
{
|
|
||||||
/* if (bd->internal_ecore_evas)
|
|
||||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t);
|
|
||||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t,
|
|
||||||
bd->client.w,
|
|
||||||
bd->client.h);
|
|
||||||
*/ bd->changed = 1;
|
|
||||||
bd->changes.pos = 1;
|
|
||||||
}
|
|
||||||
if (bd->remember)
|
|
||||||
{
|
|
||||||
e_remember_unuse(bd->remember);
|
|
||||||
bd->remember = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bd->placed = 1;
|
|
||||||
|
|
||||||
bd->lock_border = 1;
|
|
||||||
|
|
||||||
bd->lock_client_location = 1;
|
|
||||||
// bd->lock_client_size = 1;
|
|
||||||
bd->lock_client_desk = 1;
|
|
||||||
bd->lock_client_sticky = 1;
|
|
||||||
bd->lock_client_shade = 1;
|
|
||||||
bd->lock_client_maximize = 1;
|
|
||||||
|
|
||||||
bd->lock_user_location = 1;
|
|
||||||
bd->lock_user_size = 1;
|
|
||||||
// bd->lock_user_desk = 1;
|
|
||||||
// bd->lock_user_sticky = 1;
|
|
||||||
bd->lock_user_shade = 1;
|
|
||||||
bd->lock_user_maximize = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bd->placed = 1;
|
|
||||||
if (bd->focused)
|
|
||||||
{
|
|
||||||
if ((bd->need_fullscreen) || (bd->fullscreen)) e_kbd_fullscreen_set(bd->zone, 1);
|
|
||||||
else e_kbd_fullscreen_set(bd->zone, 0);
|
|
||||||
}
|
|
||||||
if (!((bd->need_fullscreen) || (bd->fullscreen)))
|
|
||||||
{
|
|
||||||
e_kbd_fullscreen_set(bd->zone, 0);
|
|
||||||
bd->x = wx;
|
|
||||||
bd->y = wy;
|
|
||||||
bd->w = ww;
|
|
||||||
bd->h = wh;
|
|
||||||
bd->client.w = bd->w;
|
|
||||||
bd->client.h = bd->h;
|
|
||||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
|
||||||
(pbw != bd->w) || (pbh != bd->h))
|
|
||||||
{
|
|
||||||
/* if (bd->internal_ecore_evas)
|
|
||||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t);
|
|
||||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t,
|
|
||||||
bd->client.w,
|
|
||||||
bd->client.h);
|
|
||||||
*/ bd->changed = 1;
|
|
||||||
bd->changes.pos = 1;
|
|
||||||
bd->changes.size = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bd->x = wx2;
|
|
||||||
bd->y = wy2;
|
|
||||||
bd->w = ww2;
|
|
||||||
bd->h = wh2;
|
|
||||||
bd->client.w = bd->w;
|
|
||||||
bd->client.h = bd->h;
|
|
||||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
|
||||||
(pbw != bd->w) || (pbh != bd->h))
|
|
||||||
{
|
|
||||||
/* if (bd->internal_ecore_evas)
|
|
||||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t);
|
|
||||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
|
||||||
bd->x + bd->fx.x + bd->client_inset.l,
|
|
||||||
bd->y + bd->fx.y + bd->client_inset.t,
|
|
||||||
bd->client.w,
|
|
||||||
bd->client.h);
|
|
||||||
*/ bd->changed = 1;
|
|
||||||
bd->changes.pos = 1;
|
|
||||||
bd->changes.size = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bd->remember)
|
|
||||||
{
|
|
||||||
e_remember_unuse(bd->remember);
|
|
||||||
bd->remember = NULL;
|
|
||||||
}
|
|
||||||
bd->lock_border = 1;
|
|
||||||
|
|
||||||
bd->lock_client_location = 1;
|
|
||||||
bd->lock_client_size = 1;
|
|
||||||
// bd->lock_client_stacking = 1;
|
|
||||||
bd->lock_client_desk = 1;
|
|
||||||
bd->lock_client_sticky = 1;
|
|
||||||
bd->lock_client_shade = 1;
|
|
||||||
bd->lock_client_maximize = 1;
|
|
||||||
|
|
||||||
bd->lock_user_location = 1;
|
|
||||||
bd->lock_user_size = 1;
|
|
||||||
// bd->lock_user_stacking = 1;
|
|
||||||
// bd->lock_user_desk = 1;
|
|
||||||
bd->lock_user_sticky = 1;
|
|
||||||
// bd->lock_user_shade = 1;
|
|
||||||
// bd->lock_user_maximize = 1;
|
|
||||||
|
|
||||||
bd->client.icccm.base_w = 1;
|
|
||||||
bd->client.icccm.base_h = 1;
|
|
||||||
bd->client.icccm.min_w = 1;
|
|
||||||
bd->client.icccm.min_h = 1;
|
|
||||||
bd->client.icccm.max_w = 32767;
|
|
||||||
bd->client.icccm.max_h = 32767;
|
|
||||||
bd->client.icccm.min_aspect = 0.0;
|
|
||||||
bd->client.icccm.max_aspect = 0.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_cb_hook_post_border_assign(void *data __UNUSED__, void *data2)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
if (!(bd = data2)) return;
|
|
||||||
_e_mod_layout_post_border_assign(bd, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_layout_cb_hook_end(void *data __UNUSED__, void *data2)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
if (!(bd = data2)) return;
|
|
||||||
if (bd->stolen) return;
|
|
||||||
if ((bd == dockwin) && (!dockwin_use) && (dockwin->visible))
|
|
||||||
_e_mod_layout_dockwin_hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Add *ev;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON; /* FIXME: Woot ? */
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Remove *ev;
|
|
||||||
Eina_List *l, *pl;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
if (ev->border == dockwin)
|
|
||||||
{
|
|
||||||
unsigned int area[4];
|
|
||||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
|
||||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
|
||||||
|
|
||||||
dockwin = NULL;
|
|
||||||
dockwin_use = 0;
|
|
||||||
e_slipshelf_safe_app_region_get(ev->border->zone, &wx, &wy, &ww, &wh);
|
|
||||||
e_kbd_safe_app_region_get(ev->border->zone, &wx2, &wy2, &ww2, &wh2);
|
|
||||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
|
||||||
area[0] = wx;
|
|
||||||
area[1] = wy;
|
|
||||||
area[2] = ww;
|
|
||||||
area[3] = wh;
|
|
||||||
ecore_x_netwm_desk_workareas_set(ev->border->zone->container->manager->root,
|
|
||||||
area, 1);
|
|
||||||
}
|
|
||||||
for (l = effects; l;)
|
|
||||||
{
|
|
||||||
Effect *ef;
|
|
||||||
|
|
||||||
ef = l->data;
|
|
||||||
pl = l;
|
|
||||||
l = l->next;
|
|
||||||
if (ef->border == ev->border)
|
|
||||||
{
|
|
||||||
effects = eina_list_remove_list(effects, pl);
|
|
||||||
ecore_animator_del(ef->animator);
|
|
||||||
free(ef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Focus_In *ev;
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
bd = ev->border;
|
|
||||||
if (bd != dockwin)
|
|
||||||
{
|
|
||||||
if (bd->client.qtopia.soft_menus)
|
|
||||||
{
|
|
||||||
if ((dockwin) && (!dockwin_use) &&
|
|
||||||
(dockwin->client.qtopia.soft_menu))
|
|
||||||
_e_mod_layout_dockwin_show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((dockwin) && (dockwin_use) &&
|
|
||||||
(dockwin->client.qtopia.soft_menu))
|
|
||||||
_e_mod_layout_dockwin_hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Focus_Out *ev;
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
bd = ev->border;
|
|
||||||
if (bd != dockwin)
|
|
||||||
{
|
|
||||||
if (bd->client.qtopia.soft_menus)
|
|
||||||
{
|
|
||||||
if ((dockwin) && (dockwin_use) &&
|
|
||||||
(dockwin->client.qtopia.soft_menu))
|
|
||||||
_e_mod_layout_dockwin_hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_show(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Show *ev;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON; /* FIXME: woot ?*/
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_border_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Hide *ev;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON; /* FIXME: woot ? */
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_event_zone_move_resize(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
_e_mod_layout_apply_all();
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef E_MOD_LAYOUT_H
|
|
||||||
#define E_MOD_LAYOUT_H
|
|
||||||
|
|
||||||
void _e_mod_layout_init(E_Module *m);
|
|
||||||
void _e_mod_layout_shutdown(void);
|
|
||||||
void _e_mod_layout_border_hide(E_Border *bd);
|
|
||||||
void _e_mod_layout_border_close(E_Border *bd);
|
|
||||||
void _e_mod_layout_border_show(E_Border *bd);
|
|
||||||
|
|
||||||
void _e_mod_layout_apply_all(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,93 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
|
|
||||||
#include "e_cfg.h"
|
|
||||||
#include "e_kbd.h"
|
|
||||||
#include "e_slipshelf.h"
|
|
||||||
#include "e_slipwin.h"
|
|
||||||
#include "e_pwr.h"
|
|
||||||
#include "e_busywin.h"
|
|
||||||
#include "e_simplelock.h"
|
|
||||||
#include "e_flaunch.h"
|
|
||||||
#include "e_slipwin.h"
|
|
||||||
#include "e_appwin.h"
|
|
||||||
#include "e_syswin.h"
|
|
||||||
|
|
||||||
#include "e_mod_main.h"
|
|
||||||
#include "e_mod_layout.h"
|
|
||||||
#include "e_mod_win.h"
|
|
||||||
|
|
||||||
#include "e_mod_gad_wifi.h"
|
|
||||||
#include "e_mod_gad_gsm.h"
|
|
||||||
#include "e_mod_gad_usb.h"
|
|
||||||
#include "e_mod_gad_bluetooth.h"
|
|
||||||
|
|
||||||
/* this is needed to advertise a label for the module IN the code (not just
|
|
||||||
* the .desktop file) but more specifically the api version it was compiled
|
|
||||||
* for so E can skip modules that are compiled for an incorrect API version
|
|
||||||
* safely) */
|
|
||||||
EAPI E_Module_Api e_modapi =
|
|
||||||
{
|
|
||||||
E_MODULE_API_VERSION, "Illume"
|
|
||||||
};
|
|
||||||
|
|
||||||
/* called first thing when E inits the module */
|
|
||||||
EAPI void *
|
|
||||||
e_modapi_init(E_Module *m)
|
|
||||||
{
|
|
||||||
/* check if illume2 is loaded and bail out if it is.
|
|
||||||
* Illume1 and illume2 both cannot be loaded @ the same time */
|
|
||||||
if (e_module_find("illume2")) return NULL;
|
|
||||||
|
|
||||||
/* set up the virtual keyboard */
|
|
||||||
e_cfg_init(m);
|
|
||||||
e_kbd_init(m);
|
|
||||||
e_busywin_init();
|
|
||||||
e_slipshelf_init();
|
|
||||||
e_slipwin_init();
|
|
||||||
e_pwr_init();
|
|
||||||
e_flaunch_init();
|
|
||||||
e_simplelock_init(m);
|
|
||||||
e_appwin_init();
|
|
||||||
e_syswin_init();
|
|
||||||
_e_mod_layout_init(m);
|
|
||||||
_e_mod_win_init(m);
|
|
||||||
|
|
||||||
_e_mod_gad_wifi_init(m);
|
|
||||||
_e_mod_gad_gsm_init(m);
|
|
||||||
_e_mod_gad_usb_init(m);
|
|
||||||
_e_mod_gad_bluetooth_init(m);
|
|
||||||
|
|
||||||
return m; /* return NULL on failure, anything else on success. the pointer
|
|
||||||
* returned will be set as m->data for convenience tracking */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* called on module shutdown - should clean up EVERYTHING or we leak */
|
|
||||||
EAPI int
|
|
||||||
e_modapi_shutdown(E_Module *m __UNUSED__)
|
|
||||||
{
|
|
||||||
_e_mod_gad_bluetooth_shutdown();
|
|
||||||
_e_mod_gad_usb_shutdown();
|
|
||||||
_e_mod_gad_gsm_shutdown();
|
|
||||||
_e_mod_gad_wifi_shutdown();
|
|
||||||
|
|
||||||
_e_mod_win_shutdown();
|
|
||||||
_e_mod_layout_shutdown();
|
|
||||||
e_syswin_shutdown();
|
|
||||||
e_appwin_shutdown();
|
|
||||||
e_simplelock_shutdown();
|
|
||||||
e_flaunch_shutdown();
|
|
||||||
e_pwr_shutdown();
|
|
||||||
e_slipwin_shutdown();
|
|
||||||
e_slipshelf_shutdown();
|
|
||||||
e_busywin_shutdown();
|
|
||||||
e_kbd_shutdown();
|
|
||||||
e_cfg_shutdown();
|
|
||||||
return 1; /* 1 for success, 0 for failure */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* called by E when it thinks this module should go save any config it has */
|
|
||||||
EAPI int
|
|
||||||
e_modapi_save(E_Module *m __UNUSED__)
|
|
||||||
{
|
|
||||||
return e_cfg_save(); /* 1 for success, 0 for failure */
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
#ifndef E_MOD_MAIN_H
|
|
||||||
#define E_MOD_MAIN_H
|
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
|
||||||
|
|
||||||
EAPI void *e_modapi_init(E_Module *m);
|
|
||||||
EAPI int e_modapi_shutdown(E_Module *m);
|
|
||||||
EAPI int e_modapi_save(E_Module *m);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef E_MOD_WIN_H
|
|
||||||
#define E_MOD_WIN_H
|
|
||||||
|
|
||||||
#include "e_slipshelf.h"
|
|
||||||
|
|
||||||
void _e_mod_win_init(E_Module *m);
|
|
||||||
void _e_mod_win_shutdown(void);
|
|
||||||
|
|
||||||
void _e_mod_win_cfg_update(void);
|
|
||||||
void _e_mod_win_slipshelf_cfg_update(void);
|
|
||||||
|
|
||||||
void e_mod_win_cfg_kbd_start(void);
|
|
||||||
void e_mod_win_cfg_kbd_stop(void);
|
|
||||||
void e_mod_win_cfg_kbd_update(void);
|
|
||||||
|
|
||||||
extern E_Slipshelf *slipshelf;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,198 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_pwr.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void _system_req_state(const char *state);
|
|
||||||
static void _system_unreq_state(void);
|
|
||||||
static Eina_Bool _cb_saver(void *data, int ev_type, void *ev);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Ecore_Event_Handler *save_handler = NULL;
|
|
||||||
static Ecore_Timer *suspend_timer = NULL;
|
|
||||||
static Ecore_X_Window coverwin = 0;
|
|
||||||
static int suspended = 0;
|
|
||||||
static int init_going = 0;
|
|
||||||
|
|
||||||
static E_DBus_Connection *conn = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_pwr_init(void)
|
|
||||||
{
|
|
||||||
save_handler = ecore_event_handler_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY,
|
|
||||||
_cb_saver, NULL);
|
|
||||||
|
|
||||||
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
|
||||||
_system_req_state("on");
|
|
||||||
e_pwr_cfg_update();
|
|
||||||
init_going = 1;
|
|
||||||
e_pwr_init_done();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_pwr_shutdown(void)
|
|
||||||
{
|
|
||||||
ecore_event_handler_del(save_handler);
|
|
||||||
save_handler = NULL;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_pwr_cfg_update(void)
|
|
||||||
{
|
|
||||||
if (suspend_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(suspend_timer);
|
|
||||||
suspend_timer = NULL;
|
|
||||||
}
|
|
||||||
e_screensaver_update();
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_pwr_init_done(void)
|
|
||||||
{
|
|
||||||
if (!init_going) return;
|
|
||||||
|
|
||||||
ecore_x_test_fake_key_down("Shift_L"); // fake a key to keep screensaver up
|
|
||||||
ecore_x_test_fake_key_up("Shift_L"); // fake a key to keep screensaver up
|
|
||||||
_system_unreq_state();
|
|
||||||
init_going = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static void
|
|
||||||
_system_req_state(const char *state)
|
|
||||||
{
|
|
||||||
DBusMessage *msg;
|
|
||||||
|
|
||||||
if (!conn) printf("@@ NO SYSTEM DBUS FOR OMPOWER\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.openmoko.Power",
|
|
||||||
"/",
|
|
||||||
"org.openmoko.Power.Core",
|
|
||||||
"RequestResourceState");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
DBusMessageIter iter;
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
dbus_message_iter_init_append(msg, &iter);
|
|
||||||
str = "cpu";
|
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
|
||||||
str = "illume";
|
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
|
||||||
str = state;
|
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
|
||||||
e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_system_unreq_state(void)
|
|
||||||
{
|
|
||||||
DBusMessage *msg;
|
|
||||||
|
|
||||||
if (!conn) printf("@@ NO SYSTEM DBUS FOR OMPOWER\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg = dbus_message_new_method_call("org.openmoko.Power",
|
|
||||||
"/",
|
|
||||||
"org.openmoko.Power.Core",
|
|
||||||
"RemoveRequestedResourceState");
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
DBusMessageIter iter;
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
dbus_message_iter_init_append(msg, &iter);
|
|
||||||
str = "cpu";
|
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
|
||||||
str = "illume";
|
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
|
||||||
e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL);
|
|
||||||
dbus_message_unref(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_suspend(void *data __UNUSED__)
|
|
||||||
{
|
|
||||||
suspended = 1;
|
|
||||||
|
|
||||||
/* FIXME: should be config */
|
|
||||||
if (illume_cfg->power.auto_suspend)
|
|
||||||
{
|
|
||||||
printf("@@ SUSPEND NOW!\n");
|
|
||||||
_system_req_state("off");
|
|
||||||
// ecore_exe_run("apm -s", NULL);
|
|
||||||
}
|
|
||||||
suspend_timer = NULL;
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_saver(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
|
|
||||||
{
|
|
||||||
Ecore_X_Event_Screensaver_Notify *event;
|
|
||||||
|
|
||||||
event = ev;
|
|
||||||
if (event->on)
|
|
||||||
{
|
|
||||||
if (init_going)
|
|
||||||
{
|
|
||||||
ecore_x_test_fake_key_down("Shift_L"); // fake a key to keep screensaver up
|
|
||||||
ecore_x_test_fake_key_up("Shift_L"); // fake a key to keep screensaver up
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!coverwin)
|
|
||||||
{
|
|
||||||
E_Zone *zone;
|
|
||||||
|
|
||||||
zone = e_util_container_zone_number_get(0, 0);
|
|
||||||
if (zone)
|
|
||||||
{
|
|
||||||
coverwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y,
|
|
||||||
zone->w, zone->h);
|
|
||||||
ecore_x_window_show(coverwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (suspend_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(suspend_timer);
|
|
||||||
suspend_timer = NULL;
|
|
||||||
}
|
|
||||||
if (illume_cfg->power.auto_suspend)
|
|
||||||
{
|
|
||||||
suspend_timer = ecore_timer_add(illume_cfg->power.auto_suspend_delay, _cb_suspend, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_system_unreq_state();
|
|
||||||
if (coverwin)
|
|
||||||
{
|
|
||||||
ecore_x_window_free(coverwin);
|
|
||||||
coverwin = 0;
|
|
||||||
}
|
|
||||||
if (suspend_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(suspend_timer);
|
|
||||||
suspend_timer = NULL;
|
|
||||||
}
|
|
||||||
if (suspended)
|
|
||||||
{
|
|
||||||
printf("@@ UNSUSPEND\n");
|
|
||||||
suspended = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
#ifndef E_PWR_H
|
|
||||||
#define E_PWR_H
|
|
||||||
|
|
||||||
EAPI int e_pwr_init(void);
|
|
||||||
EAPI int e_pwr_shutdown(void);
|
|
||||||
|
|
||||||
EAPI void e_pwr_cfg_update(void);
|
|
||||||
EAPI void e_pwr_init_done(void);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,263 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_simplelock.h"
|
|
||||||
|
|
||||||
/**************************** private data ******************************/
|
|
||||||
typedef struct _E_Simplelock_Data E_Simplelock_Data;
|
|
||||||
|
|
||||||
struct _E_Simplelock_Data
|
|
||||||
{
|
|
||||||
E_Popup *popup;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Ecore_X_Window win;
|
|
||||||
E_Zone *zone;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void _e_action_simplelock_cb(E_Object *obj, const char *params);
|
|
||||||
static Eina_Bool _e_simplelock_cb_key_down(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _e_simplelock_cb_key_up(void *data, int type, void *event);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
static E_Module *mod = NULL;
|
|
||||||
|
|
||||||
static Eina_List *locks = NULL;
|
|
||||||
static Ecore_X_Window grab_win;
|
|
||||||
static Eina_List *handlers = NULL;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_action_simplelock_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__)
|
|
||||||
{
|
|
||||||
if (locks)
|
|
||||||
e_simplelock_hide();
|
|
||||||
else
|
|
||||||
e_simplelock_show();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_simplelock_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Key *ev;
|
|
||||||
E_Action *act;
|
|
||||||
Eina_List *l;
|
|
||||||
E_Config_Binding_Key *bind;
|
|
||||||
E_Binding_Modifier mod;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->event_window != grab_win) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
for (l = e_config->key_bindings; l; l = l->next)
|
|
||||||
{
|
|
||||||
bind = l->data;
|
|
||||||
|
|
||||||
if (bind->action && strcmp(bind->action,"simple_lock")) continue;
|
|
||||||
|
|
||||||
mod = 0;
|
|
||||||
|
|
||||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
|
|
||||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
|
|
||||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
|
|
||||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
|
|
||||||
|
|
||||||
if (bind->key && (!strcmp(bind->key, ev->keyname)) &&
|
|
||||||
((bind->modifiers == mod) || (bind->any_mod)))
|
|
||||||
{
|
|
||||||
act = e_action_find(bind->action);
|
|
||||||
|
|
||||||
if (!act) continue;
|
|
||||||
e_simplelock_hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_simplelock_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Key *ev;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->event_window != grab_win) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
return ECORE_CALLBACK_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_simplelock_cb_zone_move_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
for (l = locks; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Simplelock_Data *esl;
|
|
||||||
|
|
||||||
esl = l->data;
|
|
||||||
if (esl->zone == ev->zone)
|
|
||||||
{
|
|
||||||
Evas_Coord minw, minh, mw, mh, ww, hh;
|
|
||||||
|
|
||||||
edje_object_size_min_get(esl->base_obj, &minw, &minh);
|
|
||||||
edje_object_size_min_calc(esl->base_obj, &mw, &mh);
|
|
||||||
ww = esl->zone->w;
|
|
||||||
if (minw == 1) ww = mw;
|
|
||||||
hh = esl->zone->h;
|
|
||||||
if (minh == 1) hh = mh;
|
|
||||||
e_popup_move_resize(esl->popup,
|
|
||||||
esl->zone->x + ((esl->zone->w - ww) / 2),
|
|
||||||
esl->zone->y + ((esl->zone->h - hh) / 2),
|
|
||||||
ww, hh);
|
|
||||||
evas_object_resize(esl->base_obj, esl->popup->w, esl->popup->h);
|
|
||||||
ecore_x_window_move_resize(esl->win,
|
|
||||||
esl->zone->x, esl->zone->y,
|
|
||||||
esl->zone->w, esl->zone->h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_simplelock_init(E_Module *m)
|
|
||||||
{
|
|
||||||
E_Action *act;
|
|
||||||
|
|
||||||
mod = m;
|
|
||||||
|
|
||||||
act = e_action_add("simple_lock");
|
|
||||||
if (act)
|
|
||||||
{
|
|
||||||
act->func.go = _e_action_simplelock_cb;
|
|
||||||
e_action_predef_name_set("Desktop", "Desktop Simple Lock",
|
|
||||||
"simple_lock", NULL, NULL, 0);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_simplelock_shutdown(void)
|
|
||||||
{
|
|
||||||
e_simplelock_hide();
|
|
||||||
e_action_predef_name_del("Desktop", "Simple Lock");
|
|
||||||
e_action_del("simple_lock");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_simplelock_show(void)
|
|
||||||
{
|
|
||||||
Eina_List *l, *l2, *l3;
|
|
||||||
|
|
||||||
if (locks) return 1;
|
|
||||||
for (l = e_manager_list(); l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Manager *man;
|
|
||||||
|
|
||||||
man = l->data;
|
|
||||||
for (l2 = man->containers; l2; l2 = l2->next)
|
|
||||||
{
|
|
||||||
E_Container *con;
|
|
||||||
|
|
||||||
con = l2->data;
|
|
||||||
for (l3 = con->zones; l3; l3 = l3->next)
|
|
||||||
{
|
|
||||||
E_Simplelock_Data *esl;
|
|
||||||
E_Zone *zone;
|
|
||||||
Evas_Coord mw, mh, minw = 0, minh = 0;
|
|
||||||
int ww, hh;
|
|
||||||
|
|
||||||
zone = l3->data;
|
|
||||||
esl = E_NEW(E_Simplelock_Data, 1);
|
|
||||||
esl->zone = zone;
|
|
||||||
esl->win = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y,
|
|
||||||
zone->w, zone->h);
|
|
||||||
ecore_x_window_show(esl->win);
|
|
||||||
if (!grab_win) grab_win = esl->win;
|
|
||||||
esl->popup = e_popup_new(zone, -1, -1, 1, 1);
|
|
||||||
e_popup_layer_set(esl->popup, 250);
|
|
||||||
esl->base_obj = _theme_obj_new(esl->popup->evas,
|
|
||||||
e_module_dir_get(mod),
|
|
||||||
"e/modules/simplelock/base/default");
|
|
||||||
edje_object_size_min_get(esl->base_obj, &minw, &minh);
|
|
||||||
edje_object_part_text_set(esl->base_obj,
|
|
||||||
"e.text.label", "LOCKED");
|
|
||||||
edje_object_size_min_calc(esl->base_obj, &mw, &mh);
|
|
||||||
ww = zone->w;
|
|
||||||
if (minw == 1) ww = mw;
|
|
||||||
hh = zone->h;
|
|
||||||
if (minh == 1) hh = mh;
|
|
||||||
e_popup_move_resize(esl->popup,
|
|
||||||
zone->x + ((zone->w - ww) / 2),
|
|
||||||
zone->y + ((zone->h - hh) / 2),
|
|
||||||
ww, hh);
|
|
||||||
evas_object_resize(esl->base_obj, esl->popup->w, esl->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(esl->popup, esl->base_obj);
|
|
||||||
evas_object_show(esl->base_obj);
|
|
||||||
|
|
||||||
e_popup_show(esl->popup);
|
|
||||||
|
|
||||||
locks = eina_list_append(locks, esl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!e_grabinput_get(grab_win, 0, grab_win))
|
|
||||||
{
|
|
||||||
e_simplelock_hide();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
handlers = eina_list_append
|
|
||||||
(handlers, ecore_event_handler_add
|
|
||||||
(ECORE_EVENT_KEY_DOWN, _e_simplelock_cb_key_down, NULL));
|
|
||||||
handlers = eina_list_append
|
|
||||||
(handlers, ecore_event_handler_add
|
|
||||||
(ECORE_EVENT_KEY_UP, _e_simplelock_cb_key_up, NULL));
|
|
||||||
handlers = eina_list_append
|
|
||||||
(handlers, ecore_event_handler_add
|
|
||||||
(E_EVENT_ZONE_MOVE_RESIZE, _e_simplelock_cb_zone_move_resize, NULL));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_simplelock_hide(void)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
if (!locks) return;
|
|
||||||
e_grabinput_release(grab_win, grab_win);
|
|
||||||
while (locks)
|
|
||||||
{
|
|
||||||
E_Simplelock_Data *esl;
|
|
||||||
|
|
||||||
esl = locks->data;
|
|
||||||
e_object_del(E_OBJECT(esl->popup));
|
|
||||||
ecore_x_window_free(esl->win);
|
|
||||||
free(esl);
|
|
||||||
locks = eina_list_remove_list(locks, locks);
|
|
||||||
}
|
|
||||||
grab_win = 0;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
#ifdef E_TYPEDEFS
|
|
||||||
|
|
||||||
#else
|
|
||||||
#ifndef E_SIMPLELOCK_H
|
|
||||||
#define E_SIMPLELOCK_H
|
|
||||||
|
|
||||||
EAPI int e_simplelock_init(E_Module *m);
|
|
||||||
EAPI int e_simplelock_shutdown(void);
|
|
||||||
|
|
||||||
EAPI int e_simplelock_show(void);
|
|
||||||
EAPI void e_simplelock_hide(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,961 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_slipshelf.h"
|
|
||||||
#include "e_winilist.h"
|
|
||||||
#include "e_cfg.h"
|
|
||||||
|
|
||||||
EAPI int E_EVENT_SLIPSHELF_ADD = 0;
|
|
||||||
EAPI int E_EVENT_SLIPSHELF_DEL = 0;
|
|
||||||
EAPI int E_EVENT_SLIPSHELF_CHANGE = 0;
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Slipshelf *_e_slipshelf_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_slipshelf_free(E_Slipshelf *ess);
|
|
||||||
static void _e_slipshelf_cb_toggle(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_home(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_apps(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_keyboard(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_app_next(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_app_prev(void *data, Evas_Object *obj, const char *emission, const char *source);
|
|
||||||
static void _e_slipshelf_cb_item_sel(void *data, E_Border *bd);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_animate(void *data);
|
|
||||||
static void _e_slipshelf_slide(E_Slipshelf *ess, int out, double len);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
static void _e_slipshelf_event_simple_free(void *data, void *ev);
|
|
||||||
static void _e_slipshelf_object_del_attach(void *o);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_border_focus_in(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_border_focus_out(void *data, int type, void *event);
|
|
||||||
static Eina_Bool _e_slipshelf_cb_border_property(void *data, int type, void *event);
|
|
||||||
static void _e_slipshelf_title_update(E_Slipshelf *ess);
|
|
||||||
static void _e_slipshelf_cb_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
|
|
||||||
static Evas_Object *_e_slipshelf_cb_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
|
|
||||||
static void _e_winilist_cb_item_sel(void *data, void *data2);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *slipshelves = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_slipshelf_init(void)
|
|
||||||
{
|
|
||||||
e_winilist_init();
|
|
||||||
E_EVENT_SLIPSHELF_ADD = ecore_event_type_new();
|
|
||||||
E_EVENT_SLIPSHELF_DEL = ecore_event_type_new();
|
|
||||||
E_EVENT_SLIPSHELF_CHANGE = ecore_event_type_new();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_slipshelf_shutdown(void)
|
|
||||||
{
|
|
||||||
e_winilist_shutdown();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Slipshelf *
|
|
||||||
e_slipshelf_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
Evas_Coord mw, mh, vx, vy, vw, vh;
|
|
||||||
int x, y;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
ess = E_OBJECT_ALLOC(E_Slipshelf, E_SLIPSHELF_TYPE, _e_slipshelf_free);
|
|
||||||
if (!ess) return NULL;
|
|
||||||
|
|
||||||
ess->zone = zone;
|
|
||||||
if (themedir) ess->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
ess->clickwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y, zone->w, zone->h);
|
|
||||||
ess->popup = e_popup_new(ess->zone, -1, -1, 1, 1);
|
|
||||||
ecore_x_window_configure(ess->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
ess->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
e_popup_layer_set(ess->popup, 200);
|
|
||||||
|
|
||||||
ess->main_size = illume_cfg->slipshelf.main_gadget_size * e_scale / 2.0;
|
|
||||||
ess->extra_size = illume_cfg->slipshelf.extra_gagdet_size * e_scale / 2.0;
|
|
||||||
|
|
||||||
ess->base_obj = _theme_obj_new(ess->popup->evas,
|
|
||||||
ess->themedir,
|
|
||||||
"e/modules/slipshelf/base/default");
|
|
||||||
if (illume_cfg->slipshelf.style == 1)
|
|
||||||
{
|
|
||||||
ess->control_obj = _theme_obj_new(ess->popup->evas,
|
|
||||||
ess->themedir,
|
|
||||||
"e/modules/slipshelf/controls/default");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ess->control_obj = _theme_obj_new(ess->popup->evas,
|
|
||||||
ess->themedir,
|
|
||||||
"e/modules/slipshelf/controls/applist");
|
|
||||||
edje_object_part_text_set(ess->control_obj, "e.del.label",
|
|
||||||
"REMOVE");
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.del.label",
|
|
||||||
"REMOVE");
|
|
||||||
}
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.controls",
|
|
||||||
ess->control_obj);
|
|
||||||
evas_object_show(ess->control_obj);
|
|
||||||
|
|
||||||
ess->focused_border = e_border_focused_get();
|
|
||||||
_e_slipshelf_title_update(ess);
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(ess->popup->evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.visible", o);
|
|
||||||
ess->vis_obj = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(ess->popup->evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
edje_extern_object_min_size_set(o, ess->extra_size, ess->extra_size);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.extra", o);
|
|
||||||
ess->swallow1_obj = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(ess->popup->evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
edje_extern_object_min_size_set(o, ess->main_size, ess->main_size);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.content", o);
|
|
||||||
ess->swallow2_obj = o;
|
|
||||||
|
|
||||||
edje_object_size_min_calc(ess->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
evas_object_resize(ess->base_obj, mw, mh);
|
|
||||||
edje_object_part_geometry_get(ess->base_obj, "e.swallow.visible", &vx, &vy, &vw, &vh);
|
|
||||||
// evas_object_geometry_get(ess->vis_obj, &vx, &vy, &vw, &vh);
|
|
||||||
|
|
||||||
evas_object_del(ess->swallow1_obj);
|
|
||||||
ess->gadcon_extra = e_gadcon_swallowed_new("slipshelf_extra", 0, ess->base_obj, "e.swallow.extra");
|
|
||||||
ess->gadcon_extra->instant_edit = 1;
|
|
||||||
edje_extern_object_min_size_set(ess->gadcon_extra->o_container, ess->extra_size, ess->extra_size);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.extra", ess->gadcon_extra->o_container);
|
|
||||||
|
|
||||||
e_gadcon_min_size_request_callback_set(ess->gadcon_extra, _e_slipshelf_cb_gadcon_min_size_request, ess);
|
|
||||||
e_gadcon_frame_request_callback_set(ess->gadcon_extra, _e_slipshelf_cb_gadcon_frame_request, ess);
|
|
||||||
e_gadcon_orient(ess->gadcon_extra, E_GADCON_ORIENT_TOP);
|
|
||||||
e_gadcon_zone_set(ess->gadcon_extra, ess->zone);
|
|
||||||
e_gadcon_ecore_evas_set(ess->gadcon_extra, ess->popup->ecore_evas);
|
|
||||||
|
|
||||||
evas_object_del(ess->swallow2_obj);
|
|
||||||
ess->gadcon = e_gadcon_swallowed_new("slipshelf", 0, ess->base_obj, "e.swallow.content");
|
|
||||||
ess->gadcon->instant_edit = 1;
|
|
||||||
edje_extern_object_min_size_set(ess->gadcon->o_container, ess->main_size, ess->main_size);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.content", ess->gadcon->o_container);
|
|
||||||
|
|
||||||
e_gadcon_min_size_request_callback_set(ess->gadcon, _e_slipshelf_cb_gadcon_min_size_request, ess);
|
|
||||||
e_gadcon_frame_request_callback_set(ess->gadcon, _e_slipshelf_cb_gadcon_frame_request, ess);
|
|
||||||
e_gadcon_orient(ess->gadcon, E_GADCON_ORIENT_TOP);
|
|
||||||
e_gadcon_zone_set(ess->gadcon, ess->zone);
|
|
||||||
e_gadcon_ecore_evas_set(ess->gadcon, ess->popup->ecore_evas);
|
|
||||||
|
|
||||||
ess->hidden = vy;
|
|
||||||
x = zone->x;
|
|
||||||
y = zone->y - ess->hidden;
|
|
||||||
mw = zone->w;
|
|
||||||
e_popup_move_resize(ess->popup, x, y, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(ess->base_obj, ess->popup->w, ess->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(ess->popup, ess->base_obj);
|
|
||||||
|
|
||||||
if (illume_cfg->slipshelf.style == 1)
|
|
||||||
{
|
|
||||||
// slipwin does this
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
o = e_winilist_add(ess->popup->evas);
|
|
||||||
edje_object_part_swallow(ess->control_obj, "e.swallow.content", o);
|
|
||||||
ess->scrollframe_obj = o;
|
|
||||||
e_winilist_border_select_callback_set(o,
|
|
||||||
_e_slipshelf_cb_item_sel,
|
|
||||||
ess);
|
|
||||||
e_winilist_special_append(o, NULL, "Home",
|
|
||||||
_e_winilist_cb_item_sel,
|
|
||||||
ess, NULL);
|
|
||||||
evas_object_show(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_object_show(ess->base_obj);
|
|
||||||
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,toggle", "", _e_slipshelf_cb_toggle, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,keyboard", "", _e_slipshelf_cb_keyboard, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,home", "", _e_slipshelf_cb_home, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,close", "", _e_slipshelf_cb_close, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,apps", "", _e_slipshelf_cb_apps, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,app,next", "", _e_slipshelf_cb_app_next, ess);
|
|
||||||
edje_object_signal_callback_add(ess->base_obj, "e,action,do,app,prev", "", _e_slipshelf_cb_app_prev, ess);
|
|
||||||
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,toggle", "", _e_slipshelf_cb_toggle, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,keyboard", "", _e_slipshelf_cb_keyboard, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,home", "", _e_slipshelf_cb_home, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,close", "", _e_slipshelf_cb_close, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,apps", "", _e_slipshelf_cb_apps, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,app,next", "", _e_slipshelf_cb_app_next, ess);
|
|
||||||
edje_object_signal_callback_add(ess->control_obj, "e,action,do,app,prev", "", _e_slipshelf_cb_app_prev, ess);
|
|
||||||
|
|
||||||
e_popup_show(ess->popup);
|
|
||||||
|
|
||||||
slipshelves = eina_list_append(slipshelves, ess);
|
|
||||||
|
|
||||||
ess->handlers = eina_list_append
|
|
||||||
(ess->handlers,
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_e_slipshelf_cb_mouse_up, ess));
|
|
||||||
ess->handlers = eina_list_append
|
|
||||||
(ess->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
|
||||||
_e_slipshelf_cb_border_focus_in, ess));
|
|
||||||
ess->handlers = eina_list_append
|
|
||||||
(ess->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
|
|
||||||
_e_slipshelf_cb_border_focus_out, ess));
|
|
||||||
ess->handlers = eina_list_append
|
|
||||||
(ess->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_PROPERTY,
|
|
||||||
_e_slipshelf_cb_border_property, ess));
|
|
||||||
ess->handlers = eina_list_append
|
|
||||||
(ess->handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
|
||||||
_e_slipshelf_cb_zone_move_resize, ess));
|
|
||||||
/* FIXME: handle:
|
|
||||||
*
|
|
||||||
* E_EVENT_BORDER_URGENT_CHANGE
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
ess->action.home.enabled = 1;
|
|
||||||
ess->action.close.enabled = 1;
|
|
||||||
ess->action.apps.enabled = 1;
|
|
||||||
ess->action.keyboard.enabled = 1;
|
|
||||||
ess->action.app_next.enabled = 1;
|
|
||||||
ess->action.app_prev.enabled = 1;
|
|
||||||
|
|
||||||
{
|
|
||||||
E_Event_Slipshelf_Add *ev;
|
|
||||||
|
|
||||||
ev = calloc(1, sizeof(E_Event_Slipshelf_Add));
|
|
||||||
ev->slipshelf = ess;
|
|
||||||
e_object_ref(E_OBJECT(ess));
|
|
||||||
ecore_event_add(E_EVENT_SLIPSHELF_ADD, ev,
|
|
||||||
_e_slipshelf_event_simple_free, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
e_object_del_attach_func_set(E_OBJECT(ess), _e_slipshelf_object_del_attach);
|
|
||||||
|
|
||||||
e_gadcon_populate(ess->gadcon_extra);
|
|
||||||
e_gadcon_populate(ess->gadcon);
|
|
||||||
return ess;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_action_enabled_set(E_Slipshelf *ess, E_Slipshelf_Action action, Eina_Bool enabled)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK(ess, E_SLIPSHELF_TYPE);
|
|
||||||
const char *sig = NULL;
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case E_SLIPSHELF_ACTION_HOME:
|
|
||||||
if (ess->action.home.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.home.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,home,enabled";
|
|
||||||
else sig = "e,state,action,home,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_CLOSE:
|
|
||||||
if (ess->action.close.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.close.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,close,enabled";
|
|
||||||
else sig = "e,state,action,close,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APPS:
|
|
||||||
if (ess->action.apps.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.apps.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,apps,enabled";
|
|
||||||
else sig = "e,state,action,apps,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_KEYBOARD:
|
|
||||||
if (ess->action.keyboard.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.keyboard.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,keyboard,enabled";
|
|
||||||
else sig = "e,state,action,keyboard,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_NEXT:
|
|
||||||
if (ess->action.app_next.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.app_next.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,app,next,enabled";
|
|
||||||
else sig = "e,state,action,app,next,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_PREV:
|
|
||||||
if (ess->action.app_prev.enabled != enabled)
|
|
||||||
{
|
|
||||||
ess->action.app_prev.enabled = enabled;
|
|
||||||
if (enabled) sig = "e,state,action,app,prev,enabled";
|
|
||||||
else sig = "e,state,action,app,prev,disabled";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sig)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(ess->control_obj, sig, "e");
|
|
||||||
edje_object_signal_emit(ess->base_obj, sig, "e");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Eina_Bool
|
|
||||||
e_slipshelf_action_enabled_get(E_Slipshelf *ess, E_Slipshelf_Action action)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK_RETURN(ess, E_SLIPSHELF_TYPE, 0);
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case E_SLIPSHELF_ACTION_HOME:
|
|
||||||
return ess->action.home.enabled;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_CLOSE:
|
|
||||||
return ess->action.home.enabled;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APPS:
|
|
||||||
return ess->action.home.enabled;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_KEYBOARD:
|
|
||||||
return ess->action.keyboard.enabled;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_NEXT:
|
|
||||||
return ess->action.app_next.enabled;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_PREV:
|
|
||||||
return ess->action.app_prev.enabled;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_action_callback_set(E_Slipshelf *ess, E_Slipshelf_Action action, void (*func) (const void *data, E_Slipshelf *ess, E_Slipshelf_Action action), const void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK(ess, E_SLIPSHELF_TYPE);
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case E_SLIPSHELF_ACTION_HOME:
|
|
||||||
ess->action.home.func = func;
|
|
||||||
ess->action.home.data = data;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_CLOSE:
|
|
||||||
ess->action.close.func = func;
|
|
||||||
ess->action.close.data = data;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APPS:
|
|
||||||
ess->action.apps.func = func;
|
|
||||||
ess->action.apps.data = data;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_KEYBOARD:
|
|
||||||
ess->action.keyboard.func = func;
|
|
||||||
ess->action.keyboard.data = data;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_NEXT:
|
|
||||||
ess->action.app_next.func = func;
|
|
||||||
ess->action.app_next.data = data;
|
|
||||||
break;
|
|
||||||
case E_SLIPSHELF_ACTION_APP_PREV:
|
|
||||||
ess->action.app_prev.func = func;
|
|
||||||
ess->action.app_prev.data = data;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
int sx, sy, sw, sh;
|
|
||||||
|
|
||||||
sx = zone->x;
|
|
||||||
sy = zone->y;
|
|
||||||
sw = zone->w;
|
|
||||||
sh = zone->h;
|
|
||||||
for (l = slipshelves; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(ess))) continue;
|
|
||||||
if (ess->zone == zone)
|
|
||||||
{
|
|
||||||
sh -= (ess->popup->h - ess->hidden);
|
|
||||||
sy += (ess->popup->h - ess->hidden);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (x) *x = sx;
|
|
||||||
if (y) *y = sy;
|
|
||||||
if (w) *w = sw;
|
|
||||||
if (h) *h = sh;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_default_title_set(E_Slipshelf *ess, const char *title)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK(ess, E_SLIPSHELF_TYPE);
|
|
||||||
eina_stringshare_replace(&ess->default_title, title);
|
|
||||||
if (!ess->focused_border)
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.text.label",
|
|
||||||
ess->default_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_border_select_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK(ess, E_SLIPSHELF_TYPE);
|
|
||||||
ess->callback_border_select.func = func;
|
|
||||||
ess->callback_border_select.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipshelf_border_home_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(ess);
|
|
||||||
E_OBJECT_TYPE_CHECK(ess, E_SLIPSHELF_TYPE);
|
|
||||||
ess->callback_border_home.func = func;
|
|
||||||
ess->callback_border_home.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_slipshelf_free(E_Slipshelf *ess)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
slipshelves = eina_list_remove(slipshelves, ess);
|
|
||||||
e_object_del(E_OBJECT(ess->gadcon));
|
|
||||||
e_object_del(E_OBJECT(ess->gadcon_extra));
|
|
||||||
EINA_LIST_FREE(ess->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
if (ess->animator) ecore_animator_del(ess->animator);
|
|
||||||
if (ess->themedir) eina_stringshare_del(ess->themedir);
|
|
||||||
if (ess->default_title) eina_stringshare_del(ess->default_title);
|
|
||||||
if (ess->clickwin) ecore_x_window_free(ess->clickwin);
|
|
||||||
e_object_del(E_OBJECT(ess->popup));
|
|
||||||
free(ess);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
if (ess->out) _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
else _e_slipshelf_slide(ess, 1, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_home(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
if ((ess->action.home.func) && (ess->action.home.enabled))
|
|
||||||
ess->action.home.func(ess->action.home.data, ess, E_SLIPSHELF_ACTION_HOME);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
if ((ess->action.close.func) && (ess->action.close.enabled))
|
|
||||||
ess->action.close.func(ess->action.close.data, ess, E_SLIPSHELF_ACTION_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_apps(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
if ((ess->action.apps.func) && (ess->action.apps.enabled))
|
|
||||||
ess->action.apps.func(ess->action.apps.data, ess, E_SLIPSHELF_ACTION_APPS);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_keyboard(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if ((ess->action.keyboard.func) && (ess->action.keyboard.enabled))
|
|
||||||
ess->action.keyboard.func(ess->action.keyboard.data, ess, E_SLIPSHELF_ACTION_KEYBOARD);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_app_next(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if ((ess->action.app_next.func) && (ess->action.app_next.enabled))
|
|
||||||
ess->action.app_next.func(ess->action.app_next.data, ess, E_SLIPSHELF_ACTION_APP_NEXT);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_app_prev(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if ((ess->action.app_prev.func) && (ess->action.app_prev.enabled))
|
|
||||||
ess->action.app_prev.func(ess->action.app_prev.data, ess, E_SLIPSHELF_ACTION_APP_PREV);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_slide_down_delay(void *data)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
_e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_item_sel(void *data, E_Border *bd)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
ess->bsel = bd;
|
|
||||||
if (bd)
|
|
||||||
{
|
|
||||||
if (e_border_focused_get() == bd)
|
|
||||||
{
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ess->callback_border_select.func)
|
|
||||||
ess->callback_border_select.func(ess->callback_border_select.data, ess, bd);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ess->callback_border_home.func)
|
|
||||||
ess->callback_border_home.func(ess->callback_border_home.data, ess, bd);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_applist_update(E_Slipshelf *ess)
|
|
||||||
{
|
|
||||||
Evas_Coord vx, vy, vw, vh, sfmw, sfmh, cmw, cmh, smw, smh;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
ess->bsel = e_border_focused_get();
|
|
||||||
|
|
||||||
e_winilist_optimial_size_get(ess->scrollframe_obj, &sfmw, &sfmh);
|
|
||||||
|
|
||||||
sfmw = 0;
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(ess->scrollframe_obj, sfmw, sfmh);
|
|
||||||
edje_object_part_swallow(ess->control_obj, "e.swallow.content",
|
|
||||||
ess->scrollframe_obj);
|
|
||||||
edje_object_size_min_calc(ess->control_obj, &cmw, &cmh);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(ess->control_obj, cmw, cmh);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.controls",
|
|
||||||
ess->control_obj);
|
|
||||||
edje_object_size_min_calc(ess->base_obj, &smw, &smh);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(ess->scrollframe_obj, 0, 0);
|
|
||||||
edje_object_part_swallow(ess->control_obj, "e.swallow.content",
|
|
||||||
ess->scrollframe_obj);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(ess->control_obj, 0, 0);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.controls",
|
|
||||||
ess->control_obj);
|
|
||||||
|
|
||||||
smw = ess->zone->w;
|
|
||||||
if (smh > ess->zone->h) smh = ess->zone->h;
|
|
||||||
|
|
||||||
evas_object_resize(ess->base_obj, smw, smh);
|
|
||||||
edje_object_calc_force(ess->base_obj);
|
|
||||||
edje_object_calc_force(ess->control_obj);
|
|
||||||
edje_object_part_geometry_get(ess->base_obj, "e.swallow.controls", &vx, &vy, &vw, &vh);
|
|
||||||
ess->control.w = vw;
|
|
||||||
ess->control.h = vh;
|
|
||||||
edje_extern_object_min_size_set(ess->control_obj, ess->control.w, ess->control.h);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.controls",
|
|
||||||
ess->control_obj);
|
|
||||||
edje_object_calc_force(ess->base_obj);
|
|
||||||
edje_object_calc_force(ess->control_obj);
|
|
||||||
edje_object_part_geometry_get(ess->base_obj, "e.swallow.visible", &vx, &vy, &vw, &vh);
|
|
||||||
|
|
||||||
ess->hidden = vy;
|
|
||||||
x = ess->zone->x;
|
|
||||||
y = ess->zone->y - ess->hidden + ess->adjust;
|
|
||||||
e_popup_move_resize(ess->popup, x, y, smw, smh);
|
|
||||||
evas_object_resize(ess->base_obj, ess->popup->w, ess->popup->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_animate(void *data)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
double t, v;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
t = ecore_loop_time_get() - ess->start;
|
|
||||||
if (t > ess->len) t = ess->len;
|
|
||||||
if (ess->len > 0.0)
|
|
||||||
{
|
|
||||||
v = t / ess->len;
|
|
||||||
v = 1.0 - v;
|
|
||||||
v = v * v * v * v;
|
|
||||||
v = 1.0 - v;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t = ess->len;
|
|
||||||
v = 1.0;
|
|
||||||
}
|
|
||||||
ess->adjust = (ess->adjust_target * v) + (ess->adjust_start * (1.0 - v));
|
|
||||||
e_popup_move(ess->popup,
|
|
||||||
ess->zone->x,
|
|
||||||
ess->zone->y - ess->hidden + ess->adjust);
|
|
||||||
if (t >= ess->len)
|
|
||||||
{
|
|
||||||
ess->animator = NULL;
|
|
||||||
if (ess->out)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(ess->control_obj, "e,state,out,end", "e");
|
|
||||||
edje_object_signal_emit(ess->base_obj, "e,state,out,end", "e");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(ess->control_obj, "e,state,in,end", "e");
|
|
||||||
edje_object_signal_emit(ess->base_obj, "e,state,in,end", "e");
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_slide(E_Slipshelf *ess, int out, double len)
|
|
||||||
{
|
|
||||||
if (out == ess->out) return;
|
|
||||||
ess->start = ecore_loop_time_get();
|
|
||||||
ess->len = len;
|
|
||||||
ess->out = out;
|
|
||||||
ess->adjust_start = ess->adjust;
|
|
||||||
if (ess->out)
|
|
||||||
{
|
|
||||||
_e_slipshelf_applist_update(ess);
|
|
||||||
|
|
||||||
edje_object_signal_emit(ess->control_obj, "e,state,out,begin", "e");
|
|
||||||
edje_object_signal_emit(ess->base_obj, "e,state,out,begin", "e");
|
|
||||||
ecore_x_window_configure(ess->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
ess->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
ecore_x_window_show(ess->clickwin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(ess->control_obj, "e,state,in,begin", "e");
|
|
||||||
edje_object_signal_emit(ess->base_obj, "e,state,in,begin", "e");
|
|
||||||
ecore_x_window_hide(ess->clickwin);
|
|
||||||
}
|
|
||||||
if (ess->out) ess->adjust_target = ess->hidden;
|
|
||||||
else ess->adjust_target = 0;
|
|
||||||
if (len <= 0.0)
|
|
||||||
{
|
|
||||||
_e_slipshelf_cb_animate(ess);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ess->animator)
|
|
||||||
ess->animator = ecore_animator_add(_e_slipshelf_cb_animate, ess);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_mouse_up(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
ess = data;
|
|
||||||
if (ev->window == ess->clickwin)
|
|
||||||
{
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
if (ess->out) _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
else _e_slipshelf_slide(ess, 1, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
ess = data;
|
|
||||||
if (ess->zone == ev->zone)
|
|
||||||
{
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = NULL;
|
|
||||||
_e_slipshelf_slide(ess, 0, 0.0);
|
|
||||||
e_popup_move_resize(ess->popup,
|
|
||||||
ess->zone->x,
|
|
||||||
ess->zone->y - ess->hidden + ess->adjust,
|
|
||||||
ess->zone->w, ess->popup->h);
|
|
||||||
evas_object_resize(ess->base_obj, ess->popup->w, ess->popup->h);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_event_simple_free(void *data __UNUSED__, void *ev)
|
|
||||||
{
|
|
||||||
struct _E_Event_Slipshelf_Simple *e;
|
|
||||||
|
|
||||||
e = ev;
|
|
||||||
e_object_unref(E_OBJECT(e->slipshelf));
|
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_object_del_attach(void *o)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
if (e_object_is_del(E_OBJECT(o))) return;
|
|
||||||
ess = o;
|
|
||||||
/* ev = calloc(1, sizeof(E_Event_Slipshelf_Del)); */
|
|
||||||
/* ev->slipshelf = ess; */
|
|
||||||
/* e_object_ref(E_OBJECT(ess)); */
|
|
||||||
/* fprintf(stderr, "event add E_EVENT_SLIPSHELF_DEL\n"); */
|
|
||||||
/* ecore_event_add(E_EVENT_SLIPSHELF_DEL, ev, */
|
|
||||||
/* _e_slipshelf_event_simple_free, NULL); */
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_border_focus_in(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Focus_In *ev;
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
ess = data;
|
|
||||||
ess->focused_border = ev->border;
|
|
||||||
_e_slipshelf_title_update(ess);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_border_focus_out(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Focus_Out *ev;
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
ess = data;
|
|
||||||
if (ess->focused_border == ev->border)
|
|
||||||
ess->focused_border = NULL;
|
|
||||||
_e_slipshelf_title_update(ess);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipshelf_cb_border_property(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Border_Property *ev;
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
ess = data;
|
|
||||||
if (ess->focused_border == ev->border)
|
|
||||||
_e_slipshelf_title_update(ess);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_title_update(E_Slipshelf *ess)
|
|
||||||
{
|
|
||||||
if (ess->focused_border)
|
|
||||||
{
|
|
||||||
if (ess->focused_border->client.netwm.name)
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.text.label",
|
|
||||||
ess->focused_border->client.netwm.name);
|
|
||||||
else if (ess->focused_border->client.icccm.title)
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.text.label",
|
|
||||||
ess->focused_border->client.icccm.title);
|
|
||||||
else
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.text.label",
|
|
||||||
ess->default_title);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
edje_object_part_text_set(ess->base_obj, "e.text.label",
|
|
||||||
ess->default_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipshelf_cb_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
Evas_Coord x, y, mw, mh, vx, vy, vw, vh;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
if (ess->animator) ecore_animator_del(ess->animator);
|
|
||||||
ess->animator = NULL;
|
|
||||||
ess->out = 0;
|
|
||||||
|
|
||||||
if (gc == ess->gadcon)
|
|
||||||
{
|
|
||||||
if (h < ess->main_size) h = ess->main_size;
|
|
||||||
edje_extern_object_min_size_set(ess->gadcon->o_container, w, h);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.content", ess->gadcon->o_container);
|
|
||||||
}
|
|
||||||
else if (gc == ess->gadcon_extra)
|
|
||||||
{
|
|
||||||
if (h < ess->extra_size) h = ess->extra_size;
|
|
||||||
edje_extern_object_min_size_set(ess->gadcon_extra->o_container, w, h);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.extra", ess->gadcon_extra->o_container);
|
|
||||||
}
|
|
||||||
edje_extern_object_min_size_set(ess->control_obj, ess->control.w, ess->control.h);
|
|
||||||
edje_object_part_swallow(ess->base_obj, "e.swallow.controls",
|
|
||||||
ess->control_obj);
|
|
||||||
edje_object_size_min_calc(ess->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
evas_object_resize(ess->base_obj, mw, mh);
|
|
||||||
edje_object_part_geometry_get(ess->base_obj, "e.swallow.visible", &vx, &vy, &vw, &vh);
|
|
||||||
ess->hidden = vy;
|
|
||||||
x = ess->zone->x;
|
|
||||||
y = ess->zone->y - ess->hidden;
|
|
||||||
mw = ess->zone->w;
|
|
||||||
e_popup_move_resize(ess->popup, x, y, mw, mh);
|
|
||||||
evas_object_resize(ess->base_obj, ess->popup->w, ess->popup->h);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_e_slipshelf_cb_gadcon_frame_request(void *data __UNUSED__, E_Gadcon_Client *gcc __UNUSED__, const char *style __UNUSED__)
|
|
||||||
{
|
|
||||||
/* FIXME: provide an inset look edje thing */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_winilist_cb_item_sel(void *data, void *data2)
|
|
||||||
{
|
|
||||||
E_Slipshelf *ess;
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
ess = data;
|
|
||||||
bd = data2;
|
|
||||||
ess->bsel = bd;
|
|
||||||
if (bd)
|
|
||||||
{
|
|
||||||
if (e_border_focused_get() == bd)
|
|
||||||
{
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ess->callback_border_select.func)
|
|
||||||
ess->callback_border_select.func(ess->callback_border_select.data, ess, bd);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ess->callback_border_home.func)
|
|
||||||
ess->callback_border_home.func(ess->callback_border_home.data, ess, bd);
|
|
||||||
if (ess->slide_down_timer) ecore_timer_del(ess->slide_down_timer);
|
|
||||||
ess->slide_down_timer = ecore_timer_add(0.5, _e_slipshelf_cb_slide_down_delay, ess);
|
|
||||||
// _e_slipshelf_slide(ess, 0, (double)illume_cfg->sliding.slipshelf.duration / 1000.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
#ifndef E_SLIPSHELF_H
|
|
||||||
#define E_SLIPSHELF_H
|
|
||||||
|
|
||||||
typedef struct _E_Slipshelf E_Slipshelf;
|
|
||||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Add;
|
|
||||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Del;
|
|
||||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Change;
|
|
||||||
|
|
||||||
#define E_SLIPSHELF_TYPE 0xE1b0771
|
|
||||||
|
|
||||||
typedef enum _E_Slipshelf_Action
|
|
||||||
{
|
|
||||||
E_SLIPSHELF_ACTION_HOME,
|
|
||||||
E_SLIPSHELF_ACTION_CLOSE,
|
|
||||||
E_SLIPSHELF_ACTION_APPS,
|
|
||||||
E_SLIPSHELF_ACTION_KEYBOARD,
|
|
||||||
E_SLIPSHELF_ACTION_APP_NEXT,
|
|
||||||
E_SLIPSHELF_ACTION_APP_PREV
|
|
||||||
} E_Slipshelf_Action;
|
|
||||||
|
|
||||||
struct _E_Slipshelf
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
E_Popup *popup;
|
|
||||||
Ecore_X_Window clickwin;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Evas_Object *control_obj;
|
|
||||||
Evas_Object *scrollframe_obj;
|
|
||||||
E_Border *bsel;
|
|
||||||
Evas_Object *vis_obj;
|
|
||||||
Evas_Object *swallow1_obj;
|
|
||||||
Evas_Object *swallow2_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
E_Border *focused_border;
|
|
||||||
E_Gadcon *gadcon;
|
|
||||||
E_Gadcon *gadcon_extra;
|
|
||||||
Ecore_Timer *slide_down_timer;
|
|
||||||
const char *themedir;
|
|
||||||
const char *default_title;
|
|
||||||
struct {
|
|
||||||
struct {
|
|
||||||
void (*func) (const void *data, E_Slipshelf *ess, E_Slipshelf_Action action);
|
|
||||||
const void *data;
|
|
||||||
unsigned char enabled : 1;
|
|
||||||
} home, close, apps, keyboard, app_next, app_prev;
|
|
||||||
} action;
|
|
||||||
int main_size;
|
|
||||||
int extra_size;
|
|
||||||
int hidden;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
int adjust_start;
|
|
||||||
int adjust_target;
|
|
||||||
int adjust;
|
|
||||||
struct {
|
|
||||||
int w, h;
|
|
||||||
} control;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data, E_Slipshelf *ess, E_Border *bd);
|
|
||||||
void *data;
|
|
||||||
} callback_border_select, callback_border_home;
|
|
||||||
|
|
||||||
double start;
|
|
||||||
double len;
|
|
||||||
unsigned char out : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Slipshelf_Simple
|
|
||||||
{
|
|
||||||
E_Slipshelf *slipshelf;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_slipshelf_init(void);
|
|
||||||
EAPI int e_slipshelf_shutdown(void);
|
|
||||||
EAPI E_Slipshelf *e_slipshelf_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI void e_slipshelf_action_enabled_set(E_Slipshelf *ess, E_Slipshelf_Action action, Eina_Bool enabled);
|
|
||||||
EAPI Eina_Bool e_slipshelf_action_enabled_get(E_Slipshelf *ess, E_Slipshelf_Action action);
|
|
||||||
EAPI void e_slipshelf_action_callback_set(E_Slipshelf *ess, E_Slipshelf_Action action, void (*func) (const void *data, E_Slipshelf *ess, E_Slipshelf_Action action), const void *data);
|
|
||||||
EAPI void e_slipshelf_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
|
||||||
EAPI void e_slipshelf_default_title_set(E_Slipshelf *ess, const char *title);
|
|
||||||
|
|
||||||
EAPI void e_slipshelf_border_select_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), void *data);
|
|
||||||
EAPI void e_slipshelf_border_home_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), void *data);
|
|
||||||
|
|
||||||
extern EAPI int E_EVENT_SLIPSHELF_ADD;
|
|
||||||
extern EAPI int E_EVENT_SLIPSHELF_DEL;
|
|
||||||
extern EAPI int E_EVENT_SLIPSHELF_CHANGE;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,415 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_slipwin.h"
|
|
||||||
|
|
||||||
typedef struct _Win_Entry Win_Entry;
|
|
||||||
|
|
||||||
struct _Win_Entry
|
|
||||||
{
|
|
||||||
E_Slipwin *slipwin;
|
|
||||||
E_Border *border;
|
|
||||||
Evas_Object *icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int E_EVENT_SLIPWIN_DEL = 0;
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Slipwin *_e_slipwin_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_slipwin_free(E_Slipwin *ess);
|
|
||||||
static Eina_Bool _e_slipwin_cb_animate(void *data);
|
|
||||||
static void _e_slipwin_slide(E_Slipwin *ess, int out, double len);
|
|
||||||
static Eina_Bool _e_slipwin_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_slipwin_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_slipwin_cb_zone_del(void *data, int type, void *event);
|
|
||||||
//static void _e_slipwin_event_simple_free(void *data, void *ev);
|
|
||||||
static void _e_slipwin_object_del_attach(void *o);
|
|
||||||
static void _e_slipwin_cb_item_sel(void *data);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *slipwins = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_slipwin_init(void)
|
|
||||||
{
|
|
||||||
E_EVENT_SLIPWIN_DEL = ecore_event_type_new();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_slipwin_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Slipwin *
|
|
||||||
e_slipwin_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Slipwin *esw;
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
int x, y;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
esw = E_OBJECT_ALLOC(E_Slipwin, E_SLIPWIN_TYPE, _e_slipwin_free);
|
|
||||||
if (!esw) return NULL;
|
|
||||||
|
|
||||||
esw->zone = zone;
|
|
||||||
if (themedir) esw->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y, zone->w, zone->h);
|
|
||||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
e_popup_layer_set(esw->popup, 220);
|
|
||||||
|
|
||||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
|
||||||
esw->themedir,
|
|
||||||
"e/modules/slipwin/base/default");
|
|
||||||
|
|
||||||
esw->focused_border = e_border_focused_get();
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
o = e_widget_ilist_add(esw->popup->evas, 32 * e_scale, 32 * e_scale, NULL);
|
|
||||||
esw->ilist_obj = o;
|
|
||||||
e_widget_ilist_selector_set(o, 1);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
x = zone->x;
|
|
||||||
y = zone->y + zone->h;
|
|
||||||
mw = zone->w;
|
|
||||||
|
|
||||||
mh = 300;
|
|
||||||
|
|
||||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
|
||||||
evas_object_show(esw->base_obj);
|
|
||||||
|
|
||||||
e_popup_show(esw->popup);
|
|
||||||
|
|
||||||
slipwins = eina_list_append(slipwins, esw);
|
|
||||||
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_e_slipwin_cb_mouse_up, esw));
|
|
||||||
|
|
||||||
e_object_del_attach_func_set(E_OBJECT(esw), _e_slipwin_object_del_attach);
|
|
||||||
|
|
||||||
return esw;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipwin_show(E_Slipwin *esw)
|
|
||||||
{
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
Eina_List *borders, *l;
|
|
||||||
Win_Entry *ent;
|
|
||||||
int i, selnum;
|
|
||||||
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
|
||||||
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
borders = e_border_client_list();
|
|
||||||
selnum = -1;
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
for (i = 0, l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
Evas_Object *ic;
|
|
||||||
const char *title;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
if ((!bd->client.icccm.accepts_focus) &&
|
|
||||||
(!bd->client.icccm.take_focus)) continue;
|
|
||||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
||||||
if (bd->user_skip_winlist) continue;
|
|
||||||
|
|
||||||
e_object_ref(E_OBJECT(bd));
|
|
||||||
title = "???";
|
|
||||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
|
||||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
|
||||||
ic = e_border_icon_add(bd, esw->popup->evas);
|
|
||||||
ent = calloc(1, sizeof(Win_Entry));
|
|
||||||
ent->slipwin = esw;
|
|
||||||
ent->border = bd;
|
|
||||||
ent->icon = ic;
|
|
||||||
esw->borders = eina_list_append(esw->borders, ent);
|
|
||||||
e_widget_ilist_append(esw->ilist_obj, ic, title, _e_slipwin_cb_item_sel, ent, NULL);
|
|
||||||
if (bd == e_border_focused_get()) selnum = i;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
if (selnum >= 0) e_widget_ilist_selected_set(esw->ilist_obj, selnum);
|
|
||||||
|
|
||||||
e_widget_ilist_go(esw->ilist_obj);
|
|
||||||
|
|
||||||
e_widget_ilist_preferred_size_get(esw->ilist_obj, &mw, &mh);
|
|
||||||
if (mh < (120 *e_scale)) mh = 120 * e_scale;
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, mw, mh);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, 0, 0);
|
|
||||||
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
mw = esw->zone->w;
|
|
||||||
if (mh > esw->zone->h) mh = esw->zone->h;
|
|
||||||
e_popup_resize(esw->popup, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
|
|
||||||
_e_slipwin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipwin_hide(E_Slipwin *esw)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
|
||||||
|
|
||||||
_e_slipwin_slide(esw, 0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_slipwin_border_select_callback_set(E_Slipwin *esw, void (*func) (void *data, E_Slipwin *ess, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
|
||||||
esw->callback.func = func;
|
|
||||||
esw->callback.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_slipwin_free(E_Slipwin *esw)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
slipwins = eina_list_remove(slipwins, esw);
|
|
||||||
EINA_LIST_FREE(esw->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
if (esw->animator) ecore_animator_del(esw->animator);
|
|
||||||
if (esw->themedir) eina_stringshare_del(esw->themedir);
|
|
||||||
ecore_x_window_free(esw->clickwin);
|
|
||||||
e_object_del(E_OBJECT(esw->popup));
|
|
||||||
free(esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipwin_cb_animate(void *data)
|
|
||||||
{
|
|
||||||
E_Slipwin *esw;
|
|
||||||
double t, v;
|
|
||||||
|
|
||||||
esw = data;
|
|
||||||
t = ecore_loop_time_get() - esw->start;
|
|
||||||
if (t > esw->len) t = esw->len;
|
|
||||||
v = t / esw->len;
|
|
||||||
v = 1.0 - v;
|
|
||||||
v = v * v * v * v;
|
|
||||||
v = 1.0 - v;
|
|
||||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
|
||||||
e_popup_move(esw->popup,
|
|
||||||
esw->zone->x,
|
|
||||||
esw->zone->y + esw->zone->h - esw->adjust);
|
|
||||||
if (t == esw->len)
|
|
||||||
{
|
|
||||||
esw->animator = NULL;
|
|
||||||
if (esw->out)
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipwin_slide(E_Slipwin *esw, int out, double len)
|
|
||||||
{
|
|
||||||
if (out == esw->out) return;
|
|
||||||
if (len == 0.0) len = 0.000001; /* FIXME: handle len = 0.0 case */
|
|
||||||
|
|
||||||
if (!esw->animator)
|
|
||||||
esw->animator = ecore_animator_add(_e_slipwin_cb_animate, esw);
|
|
||||||
esw->start = ecore_loop_time_get();
|
|
||||||
esw->len = len;
|
|
||||||
esw->out = out;
|
|
||||||
esw->adjust_start = esw->adjust;
|
|
||||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
|
||||||
else esw->adjust_target = 0;
|
|
||||||
if (esw->out)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
ecore_x_window_show(esw->clickwin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
|
||||||
ecore_x_window_hide(esw->clickwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipwin_cb_mouse_up(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
E_Slipwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (ev->window == esw->clickwin)
|
|
||||||
{
|
|
||||||
if (esw->out) _e_slipwin_slide(esw, 0, 1.0);
|
|
||||||
else _e_slipwin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipwin_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Slipwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
// FIXME: handle new size pants
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_slipwin_cb_zone_del(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Del *ev;
|
|
||||||
E_Slipwin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
e_object_del(E_OBJECT(esw));
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipwin_event_simple_free(void *data __UNUSED__, void *ev)
|
|
||||||
{
|
|
||||||
struct _E_Event_Slipwin_Simple *e;
|
|
||||||
|
|
||||||
e = ev;
|
|
||||||
e_object_unref(E_OBJECT(e->slipwin));
|
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipwin_object_del_attach(void *o)
|
|
||||||
{
|
|
||||||
E_Slipwin *esw;
|
|
||||||
// E_Event_Slipwin_Del *ev;
|
|
||||||
|
|
||||||
if (e_object_is_del(E_OBJECT(o))) return;
|
|
||||||
esw = o;
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
/* ev = calloc(1, sizeof(E_Event_Slipwin_Del)); */
|
|
||||||
/* ev->slipwin = esw; */
|
|
||||||
/* e_object_ref(E_OBJECT(esw)); */
|
|
||||||
/* fprintf(stderr, "event add E_EVENT_SLIPWIN_DEL\n"); */
|
|
||||||
/* ecore_event_add(E_EVENT_SLIPWIN_DEL, ev, */
|
|
||||||
/* _e_slipwin_event_simple_free, NULL); */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_slipwin_cb_item_sel(void *data)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = data;
|
|
||||||
if (ent->slipwin->callback.func)
|
|
||||||
ent->slipwin->callback.func(ent->slipwin->callback.data, ent->slipwin, ent->border);
|
|
||||||
e_slipwin_hide(ent->slipwin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#ifndef E_SLIPWIN_H
|
|
||||||
#define E_SLIPWIN_H
|
|
||||||
|
|
||||||
typedef struct _E_Slipwin E_Slipwin;
|
|
||||||
typedef struct _E_Event_Slipwin_Simple E_Event_Slipwin_Del;
|
|
||||||
|
|
||||||
#define E_SLIPWIN_TYPE 0xE1b0971
|
|
||||||
|
|
||||||
struct _E_Slipwin
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
E_Popup *popup;
|
|
||||||
Ecore_X_Window clickwin;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Evas_Object *ilist_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
E_Border *focused_border;
|
|
||||||
Eina_List *borders;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data, E_Slipwin *ess, E_Border *bd);
|
|
||||||
void *data;
|
|
||||||
} callback;
|
|
||||||
const char *themedir;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
int adjust_start;
|
|
||||||
int adjust_target;
|
|
||||||
int adjust;
|
|
||||||
double start;
|
|
||||||
double len;
|
|
||||||
unsigned char out : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Slipwin_Simple
|
|
||||||
{
|
|
||||||
E_Slipwin *slipwin;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_slipwin_init(void);
|
|
||||||
EAPI int e_slipwin_shutdown(void);
|
|
||||||
EAPI E_Slipwin *e_slipwin_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI void e_slipwin_show(E_Slipwin *esw);
|
|
||||||
EAPI void e_slipwin_hide(E_Slipwin *esw);
|
|
||||||
EAPI void e_slipwin_border_select_callback_set(E_Slipwin *esw, void (*func) (void *data, E_Slipwin *ess, E_Border *bd), void *data);
|
|
||||||
|
|
||||||
extern EAPI int E_EVENT_SLIPWIN_DEL;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,421 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_syswin.h"
|
|
||||||
|
|
||||||
typedef struct _Win_Entry Win_Entry;
|
|
||||||
|
|
||||||
struct _Win_Entry
|
|
||||||
{
|
|
||||||
E_Syswin *syswin;
|
|
||||||
E_Border *border;
|
|
||||||
Evas_Object *icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int E_EVENT_SYSWIN_DEL = 0;
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
|
|
||||||
E_Syswin *_e_syswin_new(E_Zone *zone, const char *themedir);
|
|
||||||
static void _e_syswin_free(E_Syswin *ess);
|
|
||||||
static Eina_Bool _e_syswin_cb_animate(void *data);
|
|
||||||
static void _e_syswin_slide(E_Syswin *ess, int out, double len);
|
|
||||||
static Eina_Bool _e_syswin_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_syswin_cb_zone_move_resize(void *data, int type, void *event);
|
|
||||||
//static Eina_Bool _e_syswin_cb_zone_del(void *data, int type, void *event);
|
|
||||||
//static void _e_syswin_event_simple_free(void *data, void *ev);
|
|
||||||
static void _e_syswin_object_del_attach(void *o);
|
|
||||||
static void _e_syswin_cb_item_sel(void *data);
|
|
||||||
|
|
||||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *syswins = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_syswin_init(void)
|
|
||||||
{
|
|
||||||
E_EVENT_SYSWIN_DEL = ecore_event_type_new();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_syswin_shutdown(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI E_Syswin *
|
|
||||||
e_syswin_new(E_Zone *zone, const char *themedir)
|
|
||||||
{
|
|
||||||
E_Syswin *esw;
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
int x, y;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
esw = E_OBJECT_ALLOC(E_Syswin, E_SYSWIN_TYPE, _e_syswin_free);
|
|
||||||
if (!esw) return NULL;
|
|
||||||
|
|
||||||
esw->zone = zone;
|
|
||||||
if (themedir) esw->themedir = eina_stringshare_add(themedir);
|
|
||||||
|
|
||||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
|
||||||
zone->x, zone->y, zone->w, zone->h);
|
|
||||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
e_popup_layer_set(esw->popup, 220);
|
|
||||||
|
|
||||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
|
||||||
esw->themedir,
|
|
||||||
"e/modules/syswin/base/default");
|
|
||||||
|
|
||||||
esw->focused_border = e_border_focused_get();
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
o = e_widget_ilist_add(esw->popup->evas, 32 * e_scale, 32 * e_scale, NULL);
|
|
||||||
esw->ilist_obj = o;
|
|
||||||
e_widget_ilist_selector_set(o, 1);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
x = zone->x;
|
|
||||||
y = zone->y + zone->h;
|
|
||||||
mw = zone->w;
|
|
||||||
|
|
||||||
mh = 300;
|
|
||||||
|
|
||||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
|
||||||
evas_object_show(esw->base_obj);
|
|
||||||
|
|
||||||
e_popup_show(esw->popup);
|
|
||||||
|
|
||||||
syswins = eina_list_append(syswins, esw);
|
|
||||||
|
|
||||||
esw->handlers = eina_list_append
|
|
||||||
(esw->handlers,
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_e_syswin_cb_mouse_up, esw));
|
|
||||||
|
|
||||||
e_object_del_attach_func_set(E_OBJECT(esw), _e_syswin_object_del_attach);
|
|
||||||
|
|
||||||
return esw;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_syswin_show(E_Syswin *esw)
|
|
||||||
{
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
Eina_List *borders, *l;
|
|
||||||
Win_Entry *ent;
|
|
||||||
int i, selnum;
|
|
||||||
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SYSWIN_TYPE);
|
|
||||||
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
borders = e_border_client_list();
|
|
||||||
selnum = -1;
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
for (i = 0, l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
Evas_Object *ic;
|
|
||||||
const char *title;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
if ((!bd->client.icccm.accepts_focus) &&
|
|
||||||
(!bd->client.icccm.take_focus)) continue;
|
|
||||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
||||||
if (bd->user_skip_winlist) continue;
|
|
||||||
|
|
||||||
e_object_ref(E_OBJECT(bd));
|
|
||||||
title = "???";
|
|
||||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
|
||||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
|
||||||
ic = e_border_icon_add(bd, esw->popup->evas);
|
|
||||||
ent = calloc(1, sizeof(Win_Entry));
|
|
||||||
ent->syswin = esw;
|
|
||||||
ent->border = bd;
|
|
||||||
ent->icon = ic;
|
|
||||||
esw->borders = eina_list_append(esw->borders, ent);
|
|
||||||
e_widget_ilist_append(esw->ilist_obj, ic, title, _e_syswin_cb_item_sel, ent, NULL);
|
|
||||||
if (bd == e_border_focused_get()) selnum = i;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
|
|
||||||
if (selnum >= 0) e_widget_ilist_selected_set(esw->ilist_obj, selnum);
|
|
||||||
|
|
||||||
e_widget_ilist_go(esw->ilist_obj);
|
|
||||||
|
|
||||||
e_widget_ilist_preferred_size_get(esw->ilist_obj, &mw, &mh);
|
|
||||||
if (mh < (120 *e_scale)) mh = 120 * e_scale;
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, mw, mh);
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
|
||||||
|
|
||||||
edje_extern_object_min_size_set(esw->ilist_obj, 0, 0);
|
|
||||||
|
|
||||||
|
|
||||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->ilist_obj);
|
|
||||||
|
|
||||||
mw = esw->zone->w;
|
|
||||||
if (mh > esw->zone->h) mh = esw->zone->h;
|
|
||||||
e_popup_resize(esw->popup, mw, mh);
|
|
||||||
|
|
||||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
|
||||||
|
|
||||||
_e_syswin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_syswin_hide(E_Syswin *esw)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SYSWIN_TYPE);
|
|
||||||
|
|
||||||
_e_syswin_slide(esw, 0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_syswin_border_select_callback_set(E_Syswin *esw, void (*func) (void *data, E_Syswin *ess, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
E_OBJECT_CHECK(esw);
|
|
||||||
E_OBJECT_TYPE_CHECK(esw, E_SYSWIN_TYPE);
|
|
||||||
esw->callback.func = func;
|
|
||||||
esw->callback.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_e_syswin_free(E_Syswin *esw)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
syswins = eina_list_remove(syswins, esw);
|
|
||||||
EINA_LIST_FREE(esw->handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
if (esw->animator) ecore_animator_del(esw->animator);
|
|
||||||
if (esw->themedir) eina_stringshare_del(esw->themedir);
|
|
||||||
ecore_x_window_free(esw->clickwin);
|
|
||||||
e_object_del(E_OBJECT(esw->popup));
|
|
||||||
free(esw);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_syswin_cb_animate(void *data)
|
|
||||||
{
|
|
||||||
E_Syswin *esw;
|
|
||||||
double t, v;
|
|
||||||
|
|
||||||
esw = data;
|
|
||||||
t = ecore_loop_time_get() - esw->start;
|
|
||||||
if (t > esw->len) t = esw->len;
|
|
||||||
v = t / esw->len;
|
|
||||||
v = 1.0 - v;
|
|
||||||
v = v * v * v * v;
|
|
||||||
v = 1.0 - v;
|
|
||||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
|
||||||
e_popup_move(esw->popup,
|
|
||||||
esw->zone->x,
|
|
||||||
esw->zone->y + esw->zone->h - esw->adjust);
|
|
||||||
if (t == esw->len)
|
|
||||||
{
|
|
||||||
esw->animator = NULL;
|
|
||||||
if (esw->out)
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
e_widget_ilist_freeze(esw->ilist_obj);
|
|
||||||
e_widget_ilist_clear(esw->ilist_obj);
|
|
||||||
e_widget_ilist_thaw(esw->ilist_obj);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_syswin_slide(E_Syswin *esw, int out, double len)
|
|
||||||
{
|
|
||||||
if (out == esw->out) return;
|
|
||||||
if (len == 0.0) len = 0.000001; /* FIXME: handle len = 0.0 case */
|
|
||||||
|
|
||||||
if (!esw->animator)
|
|
||||||
esw->animator = ecore_animator_add(_e_syswin_cb_animate, esw);
|
|
||||||
esw->start = ecore_loop_time_get();
|
|
||||||
esw->len = len;
|
|
||||||
esw->out = out;
|
|
||||||
esw->adjust_start = esw->adjust;
|
|
||||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
|
||||||
else esw->adjust_target = 0;
|
|
||||||
if (esw->out)
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
|
||||||
ecore_x_window_configure(esw->clickwin,
|
|
||||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
esw->popup->evas_win,
|
|
||||||
ECORE_X_WINDOW_STACK_BELOW);
|
|
||||||
ecore_x_window_show(esw->clickwin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
|
||||||
ecore_x_window_hide(esw->clickwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_syswin_cb_mouse_up(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
E_Syswin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (ev->window == esw->clickwin)
|
|
||||||
{
|
|
||||||
if (esw->out) _e_syswin_slide(esw, 0, 1.0);
|
|
||||||
else _e_syswin_slide(esw, 1, 1.0);
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static Eina_Bool
|
|
||||||
_e_syswin_cb_zone_move_resize(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Move_Resize *ev;
|
|
||||||
E_Syswin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
// FIXME: handle new size pants
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_e_syswin_cb_zone_del(void *data, int type __UNUSED__, void *event)
|
|
||||||
{
|
|
||||||
E_Event_Zone_Del *ev;
|
|
||||||
E_Syswin *esw;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
esw = data;
|
|
||||||
if (esw->zone == ev->zone)
|
|
||||||
{
|
|
||||||
e_object_del(E_OBJECT(esw));
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_syswin_event_simple_free(void *data __UNUSED__, void *ev)
|
|
||||||
{
|
|
||||||
struct _E_Event_Syswin_Simple *e;
|
|
||||||
|
|
||||||
e = ev;
|
|
||||||
e_object_unref(E_OBJECT(e->syswin));
|
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_syswin_object_del_attach(void *o)
|
|
||||||
{
|
|
||||||
E_Syswin *esw;
|
|
||||||
// E_Event_Syswin_Del *ev;
|
|
||||||
|
|
||||||
if (e_object_is_del(E_OBJECT(o))) return;
|
|
||||||
esw = o;
|
|
||||||
while (esw->borders)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = esw->borders->data;
|
|
||||||
evas_object_del(ent->icon);
|
|
||||||
e_object_unref(E_OBJECT(ent->border));
|
|
||||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
|
||||||
free(ent);
|
|
||||||
}
|
|
||||||
/* ev = calloc(1, sizeof(E_Event_Syswin_Del)); */
|
|
||||||
/* ev->syswin = esw; */
|
|
||||||
/* e_object_ref(E_OBJECT(esw)); */
|
|
||||||
/* fprintf(stderr, "event add E_EVENT_SYSWIN_DEL\n"); */
|
|
||||||
/* ecore_event_add(E_EVENT_SYSWIN_DEL, ev, */
|
|
||||||
/* _e_syswin_event_simple_free, NULL); */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_syswin_cb_item_sel(void *data)
|
|
||||||
{
|
|
||||||
Win_Entry *ent;
|
|
||||||
|
|
||||||
ent = data;
|
|
||||||
if (ent->syswin->callback.func)
|
|
||||||
ent->syswin->callback.func(ent->syswin->callback.data, ent->syswin, ent->border);
|
|
||||||
e_syswin_hide(ent->syswin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
|
||||||
{
|
|
||||||
if (custom_dir)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
|
||||||
if (edje_object_file_set(o, buf, group))
|
|
||||||
{
|
|
||||||
printf("OK FALLBACK %s\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#ifndef E_SYSWIN_H
|
|
||||||
#define E_SYSWIN_H
|
|
||||||
|
|
||||||
typedef struct _E_Syswin E_Syswin;
|
|
||||||
typedef struct _E_Event_Syswin_Simple E_Event_Syswin_Del;
|
|
||||||
|
|
||||||
#define E_SYSWIN_TYPE 0xE1b0993
|
|
||||||
|
|
||||||
struct _E_Syswin
|
|
||||||
{
|
|
||||||
E_Object e_obj_inherit;
|
|
||||||
E_Zone *zone;
|
|
||||||
E_Popup *popup;
|
|
||||||
Ecore_X_Window clickwin;
|
|
||||||
Evas_Object *base_obj;
|
|
||||||
Evas_Object *ilist_obj;
|
|
||||||
Eina_List *handlers;
|
|
||||||
E_Border *focused_border;
|
|
||||||
Eina_List *borders;
|
|
||||||
struct {
|
|
||||||
void (*func) (void *data, E_Syswin *ess, E_Border *bd);
|
|
||||||
void *data;
|
|
||||||
} callback;
|
|
||||||
const char *themedir;
|
|
||||||
Ecore_Animator *animator;
|
|
||||||
int adjust_start;
|
|
||||||
int adjust_target;
|
|
||||||
int adjust;
|
|
||||||
double start;
|
|
||||||
double len;
|
|
||||||
unsigned char out : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Event_Syswin_Simple
|
|
||||||
{
|
|
||||||
E_Syswin *syswin;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_syswin_init(void);
|
|
||||||
EAPI int e_syswin_shutdown(void);
|
|
||||||
EAPI E_Syswin *e_syswin_new(E_Zone *zone, const char *themedir);
|
|
||||||
EAPI void e_syswin_show(E_Syswin *esw);
|
|
||||||
EAPI void e_syswin_hide(E_Syswin *esw);
|
|
||||||
EAPI void e_syswin_border_select_callback_set(E_Syswin *esw, void (*func) (void *data, E_Syswin *ess, E_Border *bd), void *data);
|
|
||||||
|
|
||||||
extern EAPI int E_EVENT_SYSWIN_DEL;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,493 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_winilist.h"
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
typedef struct _Data Data;
|
|
||||||
typedef struct _Special Special;
|
|
||||||
|
|
||||||
struct _Data
|
|
||||||
{
|
|
||||||
Evas_Object *o_frame;
|
|
||||||
Evas_Object *o_ilist;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
void (*func) (void *data, E_Border *bd);
|
|
||||||
void *data;
|
|
||||||
} select;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
Eina_List *prepend;
|
|
||||||
Eina_List *append;
|
|
||||||
unsigned char changed : 1;
|
|
||||||
} special;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
Evas_Coord w, h;
|
|
||||||
} optimal_size;
|
|
||||||
Eina_List *borders;
|
|
||||||
Eina_List *labels;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _Special
|
|
||||||
{
|
|
||||||
Evas_Object *icon;
|
|
||||||
const char *label;
|
|
||||||
void (*func) (void *data1, void *data2);
|
|
||||||
void *data1;
|
|
||||||
void *data2;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void _cb_item_sel(void *data, void *data2);
|
|
||||||
static void _cb_special_sel(void *data, void *data2);
|
|
||||||
|
|
||||||
static void _cb_object_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
||||||
static void _cb_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
||||||
|
|
||||||
static void _refill(Data *d);
|
|
||||||
|
|
||||||
static Eina_Bool _cb_border_add(void *data, int ev_type, void *ev);
|
|
||||||
static Eina_Bool _cb_border_remove(void *data, int ev_type, void *ev);
|
|
||||||
static Eina_Bool _cb_border_show(void *data, int ev_type, void *ev);
|
|
||||||
static Eina_Bool _cb_border_hide(void *data, int ev_type, void *ev);
|
|
||||||
static Eina_Bool _cb_border_property(void *data, int ev_type, void *ev);
|
|
||||||
static Eina_Bool _cb_desk_show(void *data, int ev_type, void *event);
|
|
||||||
|
|
||||||
/* state */
|
|
||||||
static Eina_List *handlers = NULL;
|
|
||||||
static Eina_List *winilists = NULL;
|
|
||||||
|
|
||||||
/* called from the module core */
|
|
||||||
EAPI int
|
|
||||||
e_winilist_init(void)
|
|
||||||
{
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_ADD,
|
|
||||||
_cb_border_add, NULL));
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
|
|
||||||
_cb_border_remove, NULL));
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_SHOW,
|
|
||||||
_cb_border_show, NULL));
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_HIDE,
|
|
||||||
_cb_border_hide, NULL));
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_PROPERTY,
|
|
||||||
_cb_border_property, NULL));
|
|
||||||
handlers =
|
|
||||||
eina_list_append(handlers,
|
|
||||||
ecore_event_handler_add(E_EVENT_DESK_SHOW,
|
|
||||||
_cb_desk_show, NULL));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
e_winilist_shutdown(void)
|
|
||||||
{
|
|
||||||
Ecore_Event_Handler *handle;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(handlers, handle)
|
|
||||||
ecore_event_handler_del(handle);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Evas_Object *
|
|
||||||
e_winilist_add(Evas *e)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = E_NEW(Data, 1);
|
|
||||||
d->o_frame = e_scrollframe_add(e);
|
|
||||||
d->o_ilist = e_ilist_add(e);
|
|
||||||
evas_object_data_set(d->o_frame, "..[winilist]", d);
|
|
||||||
e_ilist_selector_set(d->o_ilist, 1);
|
|
||||||
|
|
||||||
e_scrollframe_child_set(d->o_frame, d->o_ilist);
|
|
||||||
evas_object_show(d->o_ilist);
|
|
||||||
|
|
||||||
winilists = eina_list_append(winilists, d);
|
|
||||||
evas_object_event_callback_add(d->o_frame, EVAS_CALLBACK_DEL,
|
|
||||||
_cb_object_del, NULL);
|
|
||||||
evas_object_event_callback_add(d->o_frame, EVAS_CALLBACK_RESIZE,
|
|
||||||
_cb_object_resize, NULL);
|
|
||||||
|
|
||||||
_refill(d);
|
|
||||||
|
|
||||||
return d->o_frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_winilist_border_select_callback_set(Evas_Object *obj, void (*func) (void *data, E_Border *bd), void *data)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
d->select.func = func;
|
|
||||||
d->select.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_winilist_special_append(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = E_NEW(Special, 1);
|
|
||||||
d->special.prepend = eina_list_prepend(d->special.prepend, s);
|
|
||||||
s->icon = icon;
|
|
||||||
if (label) s->label = eina_stringshare_add(label);
|
|
||||||
s->func = func;
|
|
||||||
s->data1 = data1;
|
|
||||||
s->data2 = data2;
|
|
||||||
d->special.changed = 1;
|
|
||||||
}
|
|
||||||
_refill(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_winilist_special_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = E_NEW(Special, 1);
|
|
||||||
d->special.append = eina_list_append(d->special.append, s);
|
|
||||||
s->icon = icon;
|
|
||||||
if (label) s->label = eina_stringshare_add(label);
|
|
||||||
s->func = func;
|
|
||||||
s->data1 = data1;
|
|
||||||
s->data2 = data2;
|
|
||||||
d->special.changed = 1;
|
|
||||||
}
|
|
||||||
_refill(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
e_winilist_optimial_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
if (w) *w = 0;
|
|
||||||
if (h) *h = 0;
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
if (w) *w = d->optimal_size.w;
|
|
||||||
if (h) *h = d->optimal_size.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/* internal calls */
|
|
||||||
static void
|
|
||||||
_cb_item_sel(void *data, void *data2)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = data;
|
|
||||||
if (d->select.func)
|
|
||||||
{
|
|
||||||
d->select.func(d->select.data, data2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_special_sel(void *data, void *data2 __UNUSED__)
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = data;
|
|
||||||
if (s->func)
|
|
||||||
{
|
|
||||||
s->func(s->data1, s->data2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_object_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
evas_object_del(d->o_ilist);
|
|
||||||
winilists = eina_list_remove(winilists, d);
|
|
||||||
|
|
||||||
while (d->borders)
|
|
||||||
{
|
|
||||||
e_object_unref(E_OBJECT(d->borders->data));
|
|
||||||
d->borders = eina_list_remove_list(d->borders, d->borders);
|
|
||||||
}
|
|
||||||
while (d->labels)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(d->labels->data);
|
|
||||||
d->labels = eina_list_remove_list(d->labels, d->labels);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (d->special.prepend)
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = d->special.prepend->data;
|
|
||||||
if (s->icon)
|
|
||||||
{
|
|
||||||
evas_object_del(s->icon);
|
|
||||||
s->icon = NULL;
|
|
||||||
}
|
|
||||||
if (s->label)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(s->label);
|
|
||||||
s->label = NULL;
|
|
||||||
}
|
|
||||||
free(s);
|
|
||||||
d->special.prepend = eina_list_remove_list(d->special.prepend, d->special.prepend);
|
|
||||||
}
|
|
||||||
while (d->special.append)
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = d->special.append->data;
|
|
||||||
if (s->icon)
|
|
||||||
{
|
|
||||||
evas_object_del(s->icon);
|
|
||||||
s->icon = NULL;
|
|
||||||
}
|
|
||||||
if (s->label)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(s->label);
|
|
||||||
s->label = NULL;
|
|
||||||
}
|
|
||||||
free(s);
|
|
||||||
d->special.append = eina_list_remove_list(d->special.append, d->special.append);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_object_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
|
||||||
{
|
|
||||||
Data *d;
|
|
||||||
Evas_Coord lw, lh, vw, vh;
|
|
||||||
|
|
||||||
d = evas_object_data_get(obj, "..[winilist]");
|
|
||||||
if (!d) return;
|
|
||||||
e_ilist_size_min_get(d->o_ilist, &lw, &lh);
|
|
||||||
if (lh < (120 * e_scale)) lh = 120 * e_scale;
|
|
||||||
printf("%i\n", lh);
|
|
||||||
e_scrollframe_child_viewport_size_get(d->o_frame, &vw, &vh);
|
|
||||||
evas_object_resize(d->o_ilist, vw, lh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_refill(Data *d)
|
|
||||||
{
|
|
||||||
Evas_Coord w, h, lw, lh, vw, vh;
|
|
||||||
Eina_List *borders, *l, *l2, *l3;
|
|
||||||
|
|
||||||
borders = e_border_client_list();
|
|
||||||
if (!d->special.changed)
|
|
||||||
{
|
|
||||||
int changed = 0;
|
|
||||||
|
|
||||||
if ((borders) && (d->borders))
|
|
||||||
{
|
|
||||||
Eina_List *tmp = NULL;
|
|
||||||
|
|
||||||
changed = 0;
|
|
||||||
for (l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
if ((!bd->client.icccm.accepts_focus) &&
|
|
||||||
(!bd->client.icccm.take_focus)) continue;
|
|
||||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
||||||
if (bd->user_skip_winlist) continue;
|
|
||||||
if ((!bd->sticky) &&
|
|
||||||
(bd->desk != e_desk_current_get(bd->zone))) continue;
|
|
||||||
tmp = eina_list_append(tmp, bd);
|
|
||||||
}
|
|
||||||
if (!(tmp && d->borders))
|
|
||||||
{
|
|
||||||
changed = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (eina_list_count(tmp) !=
|
|
||||||
eina_list_count(d->borders))
|
|
||||||
{
|
|
||||||
changed = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (l = tmp, l2 = d->borders, l3 = d->labels;
|
|
||||||
l && l2 && l3;
|
|
||||||
l = l->next, l2 = l2->next, l3 = l3->next)
|
|
||||||
{
|
|
||||||
E_Border *bd, *bd2;
|
|
||||||
const char *title;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
bd2 = l2->data;
|
|
||||||
if (bd != bd2)
|
|
||||||
{
|
|
||||||
changed = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
title = "???";
|
|
||||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
|
||||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
|
||||||
if (strcmp(title, l3->data))
|
|
||||||
{
|
|
||||||
changed = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp) eina_list_free(tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
changed = 1;
|
|
||||||
if (!changed) return;
|
|
||||||
}
|
|
||||||
d->special.changed = 0;
|
|
||||||
while (d->borders)
|
|
||||||
{
|
|
||||||
e_object_unref(E_OBJECT(d->borders->data));
|
|
||||||
d->borders = eina_list_remove_list(d->borders, d->borders);
|
|
||||||
}
|
|
||||||
while (d->labels)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(d->labels->data);
|
|
||||||
d->labels = eina_list_remove_list(d->labels, d->labels);
|
|
||||||
}
|
|
||||||
|
|
||||||
e_ilist_freeze(d->o_ilist);
|
|
||||||
e_ilist_clear(d->o_ilist);
|
|
||||||
for (l = d->special.prepend; l; l = l->next)
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = l->data;
|
|
||||||
e_ilist_append(d->o_ilist, s->icon, NULL, s->label, 0, _cb_special_sel, NULL,
|
|
||||||
s, NULL);
|
|
||||||
}
|
|
||||||
for (l = borders; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Border *bd;
|
|
||||||
const char *title;
|
|
||||||
|
|
||||||
bd = l->data;
|
|
||||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
|
||||||
if ((!bd->client.icccm.accepts_focus) &&
|
|
||||||
(!bd->client.icccm.take_focus)) continue;
|
|
||||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
||||||
if (bd->user_skip_winlist) continue;
|
|
||||||
if ((!bd->sticky) &&
|
|
||||||
(bd->desk != e_desk_current_get(bd->zone))) continue;
|
|
||||||
|
|
||||||
title = "???";
|
|
||||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
|
||||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
|
||||||
e_object_ref(E_OBJECT(bd));
|
|
||||||
d->borders = eina_list_append(d->borders, bd);
|
|
||||||
d->labels = eina_list_append(d->labels, eina_stringshare_add(title));
|
|
||||||
e_ilist_append(d->o_ilist, NULL/*icon*/, NULL, title, 0,
|
|
||||||
_cb_item_sel,
|
|
||||||
NULL, d, bd);
|
|
||||||
}
|
|
||||||
for (l = d->special.append; l; l = l->next)
|
|
||||||
{
|
|
||||||
Special *s;
|
|
||||||
|
|
||||||
s = l->data;
|
|
||||||
e_ilist_append(d->o_ilist, s->icon, NULL, s->label, 0, _cb_special_sel, NULL,
|
|
||||||
s, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
e_ilist_thaw(d->o_ilist);
|
|
||||||
|
|
||||||
/* FIXME: figure out optimal size */
|
|
||||||
e_ilist_size_min_get(d->o_ilist, &lw, &lh);
|
|
||||||
if (lh < (120 * e_scale)) lh = 120 * e_scale;
|
|
||||||
// printf("%i\n", lh);
|
|
||||||
e_scrollframe_child_viewport_size_get(d->o_frame, &vw, &vh);
|
|
||||||
evas_object_geometry_get(d->o_frame, NULL, NULL, &w, &h);
|
|
||||||
evas_object_resize(d->o_ilist, vw, lh);
|
|
||||||
|
|
||||||
d->optimal_size.w = lw + (w - vw);
|
|
||||||
d->optimal_size.h = lh + (h - vh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_border_add(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_border_remove(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_border_show(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_border_hide(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_border_property(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_desk_show(void *data __UNUSED__, int ev_type __UNUSED__, void *event __UNUSED__)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef E_WINILIST_H
|
|
||||||
#define E_WINILIST_H
|
|
||||||
|
|
||||||
EAPI int e_winilist_init(void);
|
|
||||||
EAPI int e_winilist_shutdown(void);
|
|
||||||
|
|
||||||
EAPI Evas_Object *e_winilist_add(Evas *e);
|
|
||||||
EAPI void e_winilist_border_select_callback_set(Evas_Object *obj, void (*func) (void *data, E_Border *bd), void *data);
|
|
||||||
EAPI void e_winilist_special_append(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2);
|
|
||||||
EAPI void e_winilist_special_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2);
|
|
||||||
EAPI void e_winilist_optimial_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,106 +0,0 @@
|
||||||
##KBDCONF-1.0
|
|
||||||
kbd 130 45
|
|
||||||
fuzz 20
|
|
||||||
|
|
||||||
# keyboard type
|
|
||||||
type ALPHA
|
|
||||||
# an icon for the keyboard so you know which one you have
|
|
||||||
icon alpha.png
|
|
||||||
|
|
||||||
# if the key out is in quotes - "q" for example, then this key is used for
|
|
||||||
# typing words and can be part of a dictionary match, any other key when
|
|
||||||
# pressed will end the dictionary match (u can disable dictionary matching in
|
|
||||||
# a layout by not having any outputs in quotes)
|
|
||||||
key 5 5 10 10
|
|
||||||
normal q "q"
|
|
||||||
shift Q "Q"
|
|
||||||
key 15 5 10 10
|
|
||||||
normal w "w"
|
|
||||||
shift W "W"
|
|
||||||
key 25 5 10 10
|
|
||||||
normal e "e"
|
|
||||||
shift E "E"
|
|
||||||
key 35 5 10 10
|
|
||||||
normal r "r"
|
|
||||||
shift R "R"
|
|
||||||
key 45 5 10 10
|
|
||||||
normal t "t"
|
|
||||||
shift T "T"
|
|
||||||
key 55 5 10 10
|
|
||||||
normal y "y"
|
|
||||||
shift Y "Y"
|
|
||||||
key 65 5 10 10
|
|
||||||
normal u "u"
|
|
||||||
shift U "U"
|
|
||||||
key 75 5 10 10
|
|
||||||
normal i "i"
|
|
||||||
shift I "I"
|
|
||||||
key 85 5 10 10
|
|
||||||
normal o "o"
|
|
||||||
shift O "O"
|
|
||||||
key 95 5 10 10
|
|
||||||
normal p "p"
|
|
||||||
shift P "P"
|
|
||||||
|
|
||||||
key 10 15 10 10
|
|
||||||
normal a "a"
|
|
||||||
shift A "A"
|
|
||||||
key 20 15 10 10
|
|
||||||
normal s "s"
|
|
||||||
shift S "S"
|
|
||||||
key 30 15 10 10
|
|
||||||
normal d "d"
|
|
||||||
shift D "D"
|
|
||||||
key 40 15 10 10
|
|
||||||
normal f "f"
|
|
||||||
shift F "F"
|
|
||||||
key 50 15 10 10
|
|
||||||
normal g "g"
|
|
||||||
shift G "G"
|
|
||||||
key 60 15 10 10
|
|
||||||
normal h "h"
|
|
||||||
shift H "H"
|
|
||||||
key 70 15 10 10
|
|
||||||
normal j "j"
|
|
||||||
shift J "J"
|
|
||||||
key 80 15 10 10
|
|
||||||
normal k "k"
|
|
||||||
shift K "K"
|
|
||||||
key 90 15 10 10
|
|
||||||
normal l "l"
|
|
||||||
shift L "L"
|
|
||||||
|
|
||||||
key 15 25 10 10
|
|
||||||
normal z "z"
|
|
||||||
shift Z "Z"
|
|
||||||
key 25 25 10 10
|
|
||||||
normal x "x"
|
|
||||||
shift X "X"
|
|
||||||
key 35 25 10 10
|
|
||||||
normal c "c"
|
|
||||||
shift C "C"
|
|
||||||
key 45 25 10 10
|
|
||||||
normal v "v"
|
|
||||||
shift V "V"
|
|
||||||
key 55 25 10 10
|
|
||||||
normal b "b"
|
|
||||||
shift B "B"
|
|
||||||
key 65 25 10 10
|
|
||||||
normal n "n"
|
|
||||||
shift N "N"
|
|
||||||
key 75 25 10 10
|
|
||||||
normal m "m"
|
|
||||||
shift M "M"
|
|
||||||
key 105 25 10 10
|
|
||||||
normal shift.png
|
|
||||||
is_shift
|
|
||||||
|
|
||||||
key 115 5 10 10
|
|
||||||
normal . period
|
|
||||||
shift , comma
|
|
||||||
key 115 15 10 10
|
|
||||||
normal ? question
|
|
||||||
shift ! exclam
|
|
||||||
key 115 25 10 10
|
|
||||||
normal ' "'"
|
|
||||||
shift / slash
|
|
|
@ -1,22 +0,0 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MODULE = illume
|
|
||||||
|
|
||||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)/keyboards
|
|
||||||
files_DATA = \
|
|
||||||
ignore_built_in_keyboards \
|
|
||||||
Default.kbd \
|
|
||||||
alpha.png \
|
|
||||||
Numbers.kbd \
|
|
||||||
numeric.png \
|
|
||||||
Terminal.kbd \
|
|
||||||
qwerty.png \
|
|
||||||
up.png \
|
|
||||||
down.png \
|
|
||||||
left.png \
|
|
||||||
right.png \
|
|
||||||
shift.png \
|
|
||||||
tab.png \
|
|
||||||
enter.png \
|
|
||||||
backspace.png
|
|
||||||
|
|
||||||
EXTRA_DIST = $(files_DATA)
|
|
|
@ -1,120 +0,0 @@
|
||||||
##KBDCONF-1.0
|
|
||||||
kbd 130 45
|
|
||||||
fuzz 20
|
|
||||||
|
|
||||||
# keyboard type
|
|
||||||
type NUMERIC
|
|
||||||
# an icon for the keyboard so you know which one you have
|
|
||||||
icon numeric.png
|
|
||||||
|
|
||||||
key 5 5 10 10
|
|
||||||
normal 1 1
|
|
||||||
shift ! exclam
|
|
||||||
key 15 5 10 10
|
|
||||||
normal 2 2
|
|
||||||
shift @ at
|
|
||||||
key 25 5 10 10
|
|
||||||
normal 3 3
|
|
||||||
shift # numbersign
|
|
||||||
key 35 5 10 10
|
|
||||||
normal 4 4
|
|
||||||
shift $ dollar
|
|
||||||
key 45 5 10 10
|
|
||||||
normal 5 5
|
|
||||||
shift % percent
|
|
||||||
key 55 5 10 10
|
|
||||||
normal 6 6
|
|
||||||
shift ^ asciicircum
|
|
||||||
key 65 5 10 10
|
|
||||||
normal 7 7
|
|
||||||
shift & ampersand
|
|
||||||
key 75 5 10 10
|
|
||||||
normal 8 8
|
|
||||||
shift * asterisk
|
|
||||||
key 85 5 10 10
|
|
||||||
normal 9 9
|
|
||||||
shift ( parenleft
|
|
||||||
key 95 5 10 10
|
|
||||||
normal 0 0
|
|
||||||
shift ) parenright
|
|
||||||
key 105 5 10 10
|
|
||||||
normal [ bracketleft
|
|
||||||
shift { braceleft
|
|
||||||
key 115 5 10 10
|
|
||||||
normal ] bracketright
|
|
||||||
shift } braceright
|
|
||||||
|
|
||||||
|
|
||||||
key 5 15 10 10
|
|
||||||
normal tab.png Tab
|
|
||||||
shift tab.png ISO_Left_Tab
|
|
||||||
key 15 15 10 10
|
|
||||||
normal ` grave
|
|
||||||
shift ~ asciitilde
|
|
||||||
key 25 15 10 10
|
|
||||||
normal - "-"
|
|
||||||
shift _ underscore
|
|
||||||
key 35 15 10 10
|
|
||||||
normal = equal
|
|
||||||
shift + plus
|
|
||||||
key 45 15 10 10
|
|
||||||
normal \ backslash
|
|
||||||
shift | bar
|
|
||||||
key 55 15 10 10
|
|
||||||
normal ; semicolon
|
|
||||||
shift : colon
|
|
||||||
key 65 15 10 10
|
|
||||||
normal ' apostrophe
|
|
||||||
shift " quotedbl
|
|
||||||
key 75 15 10 10
|
|
||||||
normal / slash
|
|
||||||
shift ? question
|
|
||||||
key 85 15 10 10
|
|
||||||
normal , comma
|
|
||||||
shift < less
|
|
||||||
key 95 15 10 10
|
|
||||||
normal ß "ß"
|
|
||||||
shift ¢ "¢"
|
|
||||||
key 105 15 10 10
|
|
||||||
normal € "€"
|
|
||||||
shift £ "£"
|
|
||||||
key 115 15 10 10
|
|
||||||
normal ø "ø"
|
|
||||||
shift Ø "Ø"
|
|
||||||
|
|
||||||
key 5 25 10 10
|
|
||||||
normal ä "ä"
|
|
||||||
shift Ä "Ä"
|
|
||||||
key 15 25 10 10
|
|
||||||
normal ö "ö"
|
|
||||||
shift Ö "Ö"
|
|
||||||
key 25 25 10 10
|
|
||||||
normal ü "ü"
|
|
||||||
shift Ü "Ü"
|
|
||||||
key 35 25 10 10
|
|
||||||
normal é "é"
|
|
||||||
shift É "É"
|
|
||||||
key 45 25 10 10
|
|
||||||
normal è "è"
|
|
||||||
shift È "È"
|
|
||||||
key 55 25 10 10
|
|
||||||
normal ô "ô"
|
|
||||||
shift Ô "Ô"
|
|
||||||
key 65 25 10 10
|
|
||||||
normal ç "ç"
|
|
||||||
shift Ç "Ç"
|
|
||||||
key 75 25 10 10
|
|
||||||
normal à "à"
|
|
||||||
shift À "À"
|
|
||||||
key 85 25 10 10
|
|
||||||
normal ò "ò"
|
|
||||||
shift Ò "Ò"
|
|
||||||
key 95 25 10 10
|
|
||||||
normal ó "ó"
|
|
||||||
shift Ó "Ó"
|
|
||||||
key 105 25 10 10
|
|
||||||
normal ñ "ñ"
|
|
||||||
shift Ñ "Ñ"
|
|
||||||
key 115 25 10 10
|
|
||||||
normal shift.png
|
|
||||||
is_shift
|
|
|
@ -1,244 +0,0 @@
|
||||||
##KBDCONF-1.0
|
|
||||||
kbd 450 150
|
|
||||||
|
|
||||||
# keyboard type
|
|
||||||
type TERMINAL
|
|
||||||
# an icon for the keyboard so you know which one you have
|
|
||||||
icon qwerty.png
|
|
||||||
|
|
||||||
key 0 0 30 30
|
|
||||||
normal ` grave
|
|
||||||
shift ~ asciitilde
|
|
||||||
capslock ` grave
|
|
||||||
key 30 0 30 30
|
|
||||||
normal 1 1
|
|
||||||
shift ! exclam
|
|
||||||
capslock 1 1
|
|
||||||
key 60 0 30 30
|
|
||||||
normal 2 2
|
|
||||||
shift @ at
|
|
||||||
capslock 2 2
|
|
||||||
key 90 0 30 30
|
|
||||||
normal 3 3
|
|
||||||
shift # numbersign
|
|
||||||
capslock 3 3
|
|
||||||
key 120 0 30 30
|
|
||||||
normal 4 4
|
|
||||||
shift $ dollar
|
|
||||||
capslock 4 4
|
|
||||||
key 150 0 30 30
|
|
||||||
normal 5 5
|
|
||||||
shift % percent
|
|
||||||
capslock 5 5
|
|
||||||
key 180 0 30 30
|
|
||||||
normal 6 6
|
|
||||||
shift ^ asciicircum
|
|
||||||
capslock 6 6
|
|
||||||
key 210 0 30 30
|
|
||||||
normal 7 7
|
|
||||||
shift & ampersand
|
|
||||||
capslock 7 7
|
|
||||||
key 240 0 30 30
|
|
||||||
normal 8 8
|
|
||||||
shift * asterisk
|
|
||||||
capslock 8 8
|
|
||||||
key 270 0 30 30
|
|
||||||
normal 9 9
|
|
||||||
shift ( parenleft
|
|
||||||
capslock 9 9
|
|
||||||
key 300 0 30 30
|
|
||||||
normal 0 0
|
|
||||||
shift ) parenright
|
|
||||||
capslock 0 0
|
|
||||||
key 330 0 30 30
|
|
||||||
normal - minus
|
|
||||||
shift _ underscore
|
|
||||||
capslock - minus
|
|
||||||
key 360 0 30 30
|
|
||||||
normal = equal
|
|
||||||
shift + plus
|
|
||||||
capslock = equal
|
|
||||||
key 390 0 60 30
|
|
||||||
normal backspace.png BackSpace
|
|
||||||
|
|
||||||
key 0 30 45 30
|
|
||||||
normal tab.png Tab
|
|
||||||
shift tab.png ISO_Left_Tab
|
|
||||||
key 45 30 30 30
|
|
||||||
normal q q
|
|
||||||
shift Q Q
|
|
||||||
capslock Q Q
|
|
||||||
key 75 30 30 30
|
|
||||||
normal w w
|
|
||||||
shift W W
|
|
||||||
capslock W W
|
|
||||||
key 105 30 30 30
|
|
||||||
normal e e
|
|
||||||
shift E E
|
|
||||||
capslock E E
|
|
||||||
key 135 30 30 30
|
|
||||||
normal r r
|
|
||||||
shift R R
|
|
||||||
capslock R R
|
|
||||||
key 165 30 30 30
|
|
||||||
normal t t
|
|
||||||
shift T T
|
|
||||||
capslock T T
|
|
||||||
key 195 30 30 30
|
|
||||||
normal y y
|
|
||||||
shift Y Y
|
|
||||||
capslock Y Y
|
|
||||||
key 225 30 30 30
|
|
||||||
normal u u
|
|
||||||
shift U U
|
|
||||||
capslock U U
|
|
||||||
key 255 30 30 30
|
|
||||||
normal i i
|
|
||||||
shift I I
|
|
||||||
capslock I I
|
|
||||||
key 285 30 30 30
|
|
||||||
normal o o
|
|
||||||
shift O O
|
|
||||||
capslock O O
|
|
||||||
key 315 30 30 30
|
|
||||||
normal p p
|
|
||||||
shift P P
|
|
||||||
capslock P P
|
|
||||||
key 345 30 30 30
|
|
||||||
normal [ bracketleft
|
|
||||||
shift { braceleft
|
|
||||||
capslock [ bracketleft
|
|
||||||
key 375 30 30 30
|
|
||||||
normal ] bracketright
|
|
||||||
shift } braceright
|
|
||||||
capslock ] bracketright
|
|
||||||
key 405 30 45 30
|
|
||||||
normal \ backslash
|
|
||||||
shift | bar
|
|
||||||
capslock \ backslash
|
|
||||||
|
|
||||||
key 0 60 60 30
|
|
||||||
normal caps
|
|
||||||
capslock CAPS
|
|
||||||
is_capslock
|
|
||||||
key 60 60 30 30
|
|
||||||
normal a a
|
|
||||||
shift A A
|
|
||||||
capslock A A
|
|
||||||
key 90 60 30 30
|
|
||||||
normal s s
|
|
||||||
shift S S
|
|
||||||
capslock S S
|
|
||||||
key 120 60 30 30
|
|
||||||
normal d d
|
|
||||||
shift D D
|
|
||||||
capslock D D
|
|
||||||
key 150 60 30 30
|
|
||||||
normal f f
|
|
||||||
shift F F
|
|
||||||
capslock F F
|
|
||||||
key 180 60 30 30
|
|
||||||
normal g g
|
|
||||||
shift G G
|
|
||||||
capslock G G
|
|
||||||
key 210 60 30 30
|
|
||||||
normal h h
|
|
||||||
shift H H
|
|
||||||
capslock H H
|
|
||||||
key 240 60 30 30
|
|
||||||
normal j j
|
|
||||||
shift J J
|
|
||||||
capslock J J
|
|
||||||
key 270 60 30 30
|
|
||||||
normal k k
|
|
||||||
shift K K
|
|
||||||
capslock K K
|
|
||||||
key 300 60 30 30
|
|
||||||
normal l l
|
|
||||||
shift L L
|
|
||||||
capslock L L
|
|
||||||
key 330 60 30 30
|
|
||||||
normal ; semicolon
|
|
||||||
shift : colon
|
|
||||||
capslock ; semicolon
|
|
||||||
key 360 60 30 30
|
|
||||||
normal ' apostrophe
|
|
||||||
shift " quotedbl
|
|
||||||
capslock ' apostrophe
|
|
||||||
key 390 60 60 30
|
|
||||||
normal enter.png Return
|
|
||||||
|
|
||||||
key 0 90 75 30
|
|
||||||
normal shift.png
|
|
||||||
is_shift
|
|
||||||
key 75 90 30 30
|
|
||||||
normal z z
|
|
||||||
shift Z Z
|
|
||||||
capslock Z Z
|
|
||||||
key 105 90 30 30
|
|
||||||
normal x x
|
|
||||||
shift X X
|
|
||||||
capslock X X
|
|
||||||
key 135 90 30 30
|
|
||||||
normal c c
|
|
||||||
shift C C
|
|
||||||
capslock C C
|
|
||||||
key 165 90 30 30
|
|
||||||
normal v v
|
|
||||||
shift V V
|
|
||||||
capslock V V
|
|
||||||
key 195 90 30 30
|
|
||||||
normal b b
|
|
||||||
shift B B
|
|
||||||
capslock B B
|
|
||||||
key 225 90 30 30
|
|
||||||
normal n n
|
|
||||||
shift N N
|
|
||||||
capslock N N
|
|
||||||
key 255 90 30 30
|
|
||||||
normal m m
|
|
||||||
shift M M
|
|
||||||
capslock M M
|
|
||||||
key 285 90 30 30
|
|
||||||
normal , comma
|
|
||||||
shift < less
|
|
||||||
capslock , comma
|
|
||||||
key 315 90 30 30
|
|
||||||
normal . period
|
|
||||||
shift > greater
|
|
||||||
capslock . period
|
|
||||||
key 345 90 30 30
|
|
||||||
normal / slash
|
|
||||||
shift ? question
|
|
||||||
capslock / slash
|
|
||||||
key 375 90 30 30
|
|
||||||
normal ins Insert
|
|
||||||
key 405 90 35 30
|
|
||||||
normal del Delete
|
|
||||||
|
|
||||||
key 0 120 30 30
|
|
||||||
normal ctrl
|
|
||||||
is_ctrl
|
|
||||||
key 30 120 30 30
|
|
||||||
normal alt
|
|
||||||
is_alt
|
|
||||||
key 60 120 120 30
|
|
||||||
normal space space
|
|
||||||
key 180 120 30 30
|
|
||||||
normal left.png Left
|
|
||||||
key 210 120 30 30
|
|
||||||
normal right.png Right
|
|
||||||
key 240 120 30 30
|
|
||||||
normal up.png Up
|
|
||||||
key 270 120 30 30
|
|
||||||
normal down.png Down
|
|
||||||
key 300 120 30 30
|
|
||||||
normal pu Prior
|
|
||||||
key 330 120 30 30
|
|
||||||
normal pd Next
|
|
||||||
key 360 120 30 30
|
|
||||||
normal hm Home
|
|
||||||
key 390 120 30 30
|
|
||||||
normal en End
|
|
||||||
key 420 120 30 30
|
|
||||||
normal es Escape
|
|
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 286 B |
|
@ -1 +0,0 @@
|
||||||
/org/freedesktop/Hal/devices/platform_*
|
|
Before Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 262 B |
|
@ -1,17 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Link
|
|
||||||
Name=Illume
|
|
||||||
Name[ru]=Illume
|
|
||||||
Name[eo]=Illume
|
|
||||||
Name[hu]=Érintő
|
|
||||||
Name[tr]=Illume
|
|
||||||
Icon=e-module-illume
|
|
||||||
X-Enlightenment-ModuleType=mobile
|
|
||||||
Comment=This is a module to make Enlightenment tuned for embedded touchscreen<br>displays such as on phones and web-pads with windows always<br>being fullscreen and having a simplified application<br>launcher and manager.
|
|
||||||
Comment[ru]=Этот модуль позволяет Enlightenment подстраиваться под встроенные<br>сенсорные экраны типа телефон и планшет, всегда разворачивая окна в полный экран, и предоставляет упрощенный менеджер<br>и запуск приложений.
|
|
||||||
Comment[cs]=Modul, který přemění UI Enlightenmentu pro dotykové<br>displeje na zařízeních jako telefony, PDA, kde jsou okna<br>vždy celoobrazovková, a také zjednodušený<br>spouštěč a správce.
|
|
||||||
Comment[it]=Questo è un modulo per rendere Enlightenment adatto ai display touchscreen<br>embedded, come sui cellulari e i web-pad, con finestre sempre<br>a tutto schermo e con gestori e lanciatori di applicazioni semplificati.
|
|
||||||
Comment[hu]=Ez a modul lehetővé teszi az Enlightenment finomhangolását a különböző érintőképernyő típusokhoz,<br> például telefonokhoz, web-padokhoz,<br> hogy elérhető legyen egy egyszerű alkamazásindító hozzájuk.
|
|
||||||
Comment[fr]=Permet d'adapter Enlightenment à l'affichage<br>plein écran des téléphones et tablettes<br>tactiles qui disposent d'une gestion<br>simplifiée des applications.
|
|
||||||
Comment[eo]=Modulo por adapti Enlightenment en la tuŝekranoj<br>kiel la telefonoj kaj ttt-tabletoj kun fenestroj<br>ĉiam plenekranaj kaj simpligita administrado de<br>aplikaĵoj.
|
|
||||||
Comment[pt]=Este é o módulo que permite ajustar o Enlightenment para telemóveis e "web-pads"<br>que funcionam sempre em ecrã completo e que possuem um gestor de aplicações simplifcado
|
|
|
@ -1,187 +0,0 @@
|
||||||
/* for complex link stuff */
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <net/ethernet.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <net/if_arp.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/if.h>
|
|
||||||
#include <linux/wireless.h>
|
|
||||||
#include <netinet/if_ether.h>
|
|
||||||
|
|
||||||
/* the complex way - thanks to simple being broken on gta02 */
|
|
||||||
static int
|
|
||||||
link_ext_get(int fd, const char *name, int req, struct iwreq *rq)
|
|
||||||
{
|
|
||||||
strncpy(rq->ifr_name, name, sizeof(rq->ifr_name) - 1);
|
|
||||||
rq->ifr_name[sizeof(rq->ifr_name) - 1] = 0;
|
|
||||||
return (ioctl(fd, req, rq));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int link_fd = -1;
|
|
||||||
static char link_ifname[1024];
|
|
||||||
static struct iw_range link_range;
|
|
||||||
static int link_has_range;
|
|
||||||
|
|
||||||
static int
|
|
||||||
link_setup(const char *name)
|
|
||||||
{
|
|
||||||
struct iwreq rq;
|
|
||||||
|
|
||||||
link_ifname[0] = 0;
|
|
||||||
if (!name)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
link_ifname[0] = 0;
|
|
||||||
f = fopen("/proc/net/wireless", "r");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), f))
|
|
||||||
{
|
|
||||||
if (strchr(buf, ':'))
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
sscanf(buf, "%s", link_ifname);
|
|
||||||
p = strchr(link_ifname, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
strcpy(link_ifname, name);
|
|
||||||
|
|
||||||
if (!link_ifname[0]) return -1;
|
|
||||||
|
|
||||||
link_fd = socket(AF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (link_fd < 0) return -1;
|
|
||||||
|
|
||||||
link_has_range = 0;
|
|
||||||
rq.u.data.pointer = (caddr_t)(&link_range);
|
|
||||||
rq.u.data.length = sizeof(link_range);
|
|
||||||
rq.u.data.flags = 1;
|
|
||||||
|
|
||||||
if (link_ext_get(link_fd, link_ifname, SIOCGIWRANGE, &rq) >= 0)
|
|
||||||
{
|
|
||||||
link_has_range = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
close(link_fd);
|
|
||||||
link_fd = -1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static double
|
|
||||||
link_quality(void)
|
|
||||||
{
|
|
||||||
struct iwreq rq;
|
|
||||||
struct iw_statistics stats;
|
|
||||||
|
|
||||||
if (link_fd < 0) return -1;
|
|
||||||
|
|
||||||
rq.u.data.pointer = (caddr_t)(&stats);
|
|
||||||
rq.u.data.length = sizeof(stats);
|
|
||||||
rq.u.data.flags = 1;
|
|
||||||
if (link_ext_get(link_fd, link_ifname, SIOCGIWSTATS, &rq) >= 0)
|
|
||||||
return (double)stats.qual.qual / (double)link_range.max_qual.qual;
|
|
||||||
close(link_fd);
|
|
||||||
link_fd = -1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void
|
|
||||||
link_end(void)
|
|
||||||
{
|
|
||||||
if (link_fd < 0) return;
|
|
||||||
close(link_fd);
|
|
||||||
link_fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_wifi_signal_get(void)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
int strength = -1;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
f = fopen("/proc/net/wireless", "r");
|
|
||||||
if (!f) return -1;
|
|
||||||
|
|
||||||
while (fgets(buf, 256, f))
|
|
||||||
{
|
|
||||||
int dummy;
|
|
||||||
int count;
|
|
||||||
int found_dev = 0;
|
|
||||||
int wlan_status = 0;
|
|
||||||
int wlan_link = 0;
|
|
||||||
int wlan_level = 0;
|
|
||||||
int wlan_noise = 0;
|
|
||||||
char iface[64];
|
|
||||||
|
|
||||||
count = sscanf(buf, "%s %i %i %i %i %i %i %i %i %i %i\n",
|
|
||||||
iface, &wlan_status, &wlan_link, &wlan_level,
|
|
||||||
&wlan_noise, &dummy, &dummy, &dummy, &dummy, &dummy,
|
|
||||||
&dummy);
|
|
||||||
if (count != 3) continue;
|
|
||||||
fclose(f);
|
|
||||||
return wlan_link;
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int pstrength = -2;
|
|
||||||
int strength = -1;
|
|
||||||
int sleeptime = 8;
|
|
||||||
const char *devname = NULL;
|
|
||||||
|
|
||||||
if (argc > 1) sleeptime = atoi(argv[1]);
|
|
||||||
if (argc > 2) devname = argv[2];
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
pstrength = strength;
|
|
||||||
if (link_fd < 0)
|
|
||||||
{
|
|
||||||
if (link_setup(devname) >= 0)
|
|
||||||
strength = link_quality() * 100.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
strength = link_quality() * 100.0;
|
|
||||||
if (pstrength != strength)
|
|
||||||
{
|
|
||||||
if (strength < 0) printf("ERROR\n");
|
|
||||||
else printf("%i\n", strength);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
sleep(sleeptime);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|