Remove all old illume2 code. New code coming in mass.
SVN revision: 45067
|
@ -1,33 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-home
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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_busycover.c \
|
||||
e_busycover.h \
|
||||
e_mod_config.c \
|
||||
e_mod_config.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,155 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_busycover.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_busycover_add_object(E_Busycover *esw);
|
||||
static void _e_busycover_cb_free(E_Busycover *esw);
|
||||
static int _e_busycover_zone_cb_move_resize(void *data, int type, void *event);
|
||||
static Evas_Object *_theme_obj_new(Evas *evas, const char *custom_dir, const char *group);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *busycovers = NULL;
|
||||
|
||||
/* public functions */
|
||||
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_cb_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_zone_cb_move_resize,
|
||||
esw));
|
||||
return esw;
|
||||
}
|
||||
|
||||
EAPI E_Busycover_Handle *
|
||||
e_busycover_push(E_Busycover *esw, const char *msg, const char *icon)
|
||||
{
|
||||
E_Busycover_Handle *h;
|
||||
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYCOVER_TYPE, NULL);
|
||||
if (!esw->o_base) _e_busycover_add_object(esw);
|
||||
h = E_NEW(E_Busycover_Handle, 1);
|
||||
h->busycover = esw;
|
||||
if (msg) h->msg = eina_stringshare_add(msg);
|
||||
if (icon) h->icon = eina_stringshare_add(icon);
|
||||
esw->handles = eina_list_prepend(esw->handles, h);
|
||||
edje_object_part_text_set(esw->o_base, "e.text.label", h->msg);
|
||||
/* FIXME: handle icon */
|
||||
evas_object_show(esw->o_base);
|
||||
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->msg) eina_stringshare_del(handle->msg);
|
||||
if (handle->icon) eina_stringshare_del(handle->icon);
|
||||
free(handle);
|
||||
if (esw->handles)
|
||||
{
|
||||
handle = esw->handles->data;
|
||||
edje_object_part_text_set(esw->o_base, "e.text.label", handle->msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_del(esw->o_base);
|
||||
esw->o_base = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_busycover_add_object(E_Busycover *esw)
|
||||
{
|
||||
Evas_Object *o;
|
||||
int x, y, w, h;
|
||||
|
||||
esw->o_base = _theme_obj_new(esw->zone->container->bg_evas, esw->themedir,
|
||||
"modules/illume-home/busycover/default");
|
||||
edje_object_part_text_set(esw->o_base, "e.text.title", "LOADING");
|
||||
e_zone_useful_geometry_get(esw->zone, &x, &y, &w, &h);
|
||||
evas_object_move(esw->o_base, x, y);
|
||||
evas_object_resize(esw->o_base, w, h);
|
||||
evas_object_layer_set(esw->o_base, 100);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_busycover_cb_free(E_Busycover *esw)
|
||||
{
|
||||
Ecore_Event_Handler *handle;
|
||||
|
||||
if (esw->o_base) evas_object_del(esw->o_base);
|
||||
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);
|
||||
E_FREE(esw);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_busycover_zone_cb_move_resize(void *data, int type, 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_zone_useful_geometry_get(esw->zone, &x, &y, &w, &h);
|
||||
evas_object_move(esw->o_base, x, y);
|
||||
evas_object_resize(esw->o_base, w, h);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *evas, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(evas);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume-home", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buff, group))
|
||||
printf("OK FALLBACK %s\n", buff);
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef E_BUSYCOVER_H
|
||||
#define E_BUSYCOVER_H
|
||||
|
||||
#define E_BUSYCOVER_TYPE 0xE1b0782
|
||||
|
||||
typedef struct _E_Busycover E_Busycover;
|
||||
typedef struct _E_Busycover_Handle E_Busycover_Handle;
|
||||
|
||||
struct _E_Busycover
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Zone *zone;
|
||||
Evas_Object *o_base;
|
||||
Eina_List *handlers, *handles;
|
||||
const char *themedir;
|
||||
};
|
||||
|
||||
struct _E_Busycover_Handle
|
||||
{
|
||||
E_Busycover *busycover;
|
||||
const char *msg, *icon;
|
||||
};
|
||||
|
||||
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 *msg, const char *icon);
|
||||
EAPI void e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle);
|
||||
|
||||
#endif
|
|
@ -1,200 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_home_config_create(E_Config_Dialog *cfd);
|
||||
static void _il_home_config_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_home_config_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_home_config_changed(void *data, Evas_Object *obj, void *event);
|
||||
static void _il_home_config_click_changed(void *data, Evas_Object *obj, void *event);
|
||||
static int _il_home_config_change_timeout(void *data);
|
||||
|
||||
/* local variables */
|
||||
EAPI Il_Home_Config *il_home_cfg = NULL;
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
Ecore_Timer *_il_home_config_change_timer = NULL;
|
||||
Evas_Object *delay_label, *delay_slider;
|
||||
|
||||
/* public functions */
|
||||
int
|
||||
il_home_config_init(E_Module *m)
|
||||
{
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume-Home_Cfg", Il_Home_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Il_Home_Config
|
||||
#define D conf_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
E_CONFIG_VAL(D, T, icon_size, INT);
|
||||
E_CONFIG_VAL(D, T, single_click, INT);
|
||||
E_CONFIG_VAL(D, T, single_click_delay, INT);
|
||||
|
||||
il_home_cfg = e_config_domain_load("module.illume-home", conf_edd);
|
||||
if ((il_home_cfg) &&
|
||||
((il_home_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
{
|
||||
E_FREE(il_home_cfg);
|
||||
il_home_cfg = NULL;
|
||||
}
|
||||
if (!il_home_cfg)
|
||||
{
|
||||
il_home_cfg = E_NEW(Il_Home_Config, 1);
|
||||
il_home_cfg->version = 0;
|
||||
il_home_cfg->icon_size = 120;
|
||||
il_home_cfg->single_click = 1;
|
||||
il_home_cfg->single_click_delay = 50;
|
||||
}
|
||||
if (il_home_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
/* if ((il_home_cfg->version & 0xffff) < 1) */
|
||||
il_home_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||
}
|
||||
|
||||
il_home_cfg->mod_dir = eina_stringshare_add(m->dir);
|
||||
|
||||
e_configure_registry_category_add("illume", 0, _("Illume"), NULL,
|
||||
"enlightenment/display");
|
||||
e_configure_registry_generic_item_add("illume/home", 0, _("Home"),
|
||||
NULL, "enlightenment/launcher",
|
||||
il_home_config_show);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_home_config_shutdown(void)
|
||||
{
|
||||
il_home_cfg->cfd = NULL;
|
||||
|
||||
e_configure_registry_item_del("illume/home");
|
||||
e_configure_registry_category_del("illume");
|
||||
|
||||
if (il_home_cfg->mod_dir) eina_stringshare_del(il_home_cfg->mod_dir);
|
||||
|
||||
E_FREE(il_home_cfg);
|
||||
il_home_cfg = NULL;
|
||||
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_home_config_save(void)
|
||||
{
|
||||
e_config_domain_save("module.illume-home", conf_edd, il_home_cfg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
il_home_config_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v = NULL;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_home_settings")) return;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_home_config_create;
|
||||
v->free_cfdata = _il_home_config_free;
|
||||
v->basic.create_widgets = _il_home_config_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Home Settings"), "E",
|
||||
"_config_illume_home_settings",
|
||||
"enlightenment/launcher_settings", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
il_home_cfg->cfd = cfd;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void *
|
||||
_il_home_config_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_config_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
il_home_cfg->cfd = NULL;
|
||||
il_home_win_cfg_update();
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_home_config_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *o;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Icon Size"), 0);
|
||||
rg = e_widget_radio_group_new(&(il_home_cfg->icon_size));
|
||||
o = e_widget_radio_add(evas, _("Small"), 60, rg);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed", _il_home_config_changed, NULL);
|
||||
o = e_widget_radio_add(evas, _("Medium"), 80, rg);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed", _il_home_config_changed, NULL);
|
||||
o = e_widget_radio_add(evas, _("Large"), 120, rg);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed", _il_home_config_changed, NULL);
|
||||
o = e_widget_radio_add(evas, _("Very Large"), 160, rg);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed", _il_home_config_changed, NULL);
|
||||
o = e_widget_radio_add(evas, _("Massive"), 240, rg);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed", _il_home_config_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Launch Action"), 0);
|
||||
o = e_widget_check_add(evas, _("Single press"),
|
||||
&(il_home_cfg->single_click));
|
||||
e_widget_framelist_object_append(of, o);
|
||||
evas_object_smart_callback_add(o, "changed",
|
||||
_il_home_config_click_changed, NULL);
|
||||
o = e_widget_label_add(evas, _("Press Delay"));
|
||||
delay_label = o;
|
||||
e_widget_disabled_set(o, !(il_home_cfg->single_click));
|
||||
e_widget_framelist_object_append(of, o);
|
||||
o = e_widget_slider_add(evas, 1, 0, "%1.0f ms", 0, 350, 1, 0, NULL,
|
||||
&(il_home_cfg->single_click_delay), 150);
|
||||
delay_slider = o;
|
||||
/* Slider does not emit a changed signal */
|
||||
// evas_object_smart_callback_add(o, "changed",
|
||||
// _il_home_config_changed, NULL);
|
||||
e_widget_disabled_set(o, !(il_home_cfg->single_click));
|
||||
e_widget_framelist_object_append(of, o);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_config_changed(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
if (_il_home_config_change_timer)
|
||||
ecore_timer_del(_il_home_config_change_timer);
|
||||
_il_home_config_change_timer =
|
||||
ecore_timer_add(0.5, _il_home_config_change_timeout, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_config_click_changed(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
e_widget_disabled_set(delay_label, !il_home_cfg->single_click);
|
||||
e_widget_disabled_set(delay_slider, !il_home_cfg->single_click);
|
||||
_il_home_config_changed(data, obj, event);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_config_change_timeout(void *data)
|
||||
{
|
||||
il_home_win_cfg_update();
|
||||
e_config_save_queue();
|
||||
_il_home_config_change_timer = NULL;
|
||||
return 0;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
#define E_MOD_CONFIG_H
|
||||
|
||||
#define IL_CONFIG_MIN 0
|
||||
#define IL_CONFIG_MAJ 0
|
||||
|
||||
typedef struct _Il_Home_Config Il_Home_Config;
|
||||
|
||||
struct _Il_Home_Config
|
||||
{
|
||||
int version;
|
||||
int mode, icon_size;
|
||||
int single_click, single_click_delay;
|
||||
|
||||
// Not User Configurable. Placeholders
|
||||
const char *mod_dir;
|
||||
E_Config_Dialog *cfd;
|
||||
};
|
||||
|
||||
int il_home_config_init(E_Module *m);
|
||||
int il_home_config_shutdown(void);
|
||||
int il_home_config_save(void);
|
||||
void il_home_config_show(E_Container *con, const char *params);
|
||||
|
||||
extern EAPI Il_Home_Config *il_home_cfg;
|
||||
|
||||
#endif
|
|
@ -1,833 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_busycover.h"
|
||||
|
||||
#define IL_HOME_WIN_TYPE 0xE0b0102f
|
||||
|
||||
/* local structures */
|
||||
typedef struct _Instance Instance;
|
||||
typedef struct _Il_Home_Win Il_Home_Win;
|
||||
typedef struct _Il_Home_Exec Il_Home_Exec;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *o_btn;
|
||||
Eina_List *wins;
|
||||
Ecore_Event_Handler *hdl;
|
||||
};
|
||||
struct _Il_Home_Win
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
E_Win *win;
|
||||
Evas_Object *o_bg, *o_sf, *o_fm;
|
||||
};
|
||||
struct _Il_Home_Exec
|
||||
{
|
||||
Efreet_Desktop *desktop;
|
||||
Ecore_Exe *exec;
|
||||
E_Border *border;
|
||||
Ecore_Timer *timeout;
|
||||
int startup_id;
|
||||
pid_t pid;
|
||||
void *handle;
|
||||
};
|
||||
|
||||
static Eina_List *exes = NULL;
|
||||
static Ecore_Event_Handler *exit_hdl = NULL;
|
||||
|
||||
/* local function prototypes */
|
||||
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 *cc);
|
||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas);
|
||||
static const char *_gc_id_new(E_Gadcon_Client_Class *cc);
|
||||
static void _il_home_btn_cb_click(void *data, void *data2);
|
||||
static void _il_home_win_new(Instance *inst);
|
||||
static void _il_home_win_cb_free(Il_Home_Win *hwin);
|
||||
static void _il_home_win_cb_resize(E_Win *win);
|
||||
static void _il_home_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _il_home_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
static void _il_home_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
static void _il_home_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
|
||||
static void _il_home_cb_selected(void *data, Evas_Object *obj, void *event);
|
||||
static void _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop);
|
||||
static void _il_home_apps_populate(void);
|
||||
static void _il_home_apps_unpopulate(void);
|
||||
static void _il_home_fmc_set(Evas_Object *obj);
|
||||
static void _il_home_desks_populate(void);
|
||||
static int _il_home_desktop_list_change(void *data, int type, void *event);
|
||||
static int _il_home_desktop_change(void *data, int type, void *event);
|
||||
static int _il_home_update_deferred(void *data);
|
||||
static int _il_home_win_cb_exe_del(void *data, int type, void *event);
|
||||
static E_Border *_il_home_desktop_find_border(Efreet_Desktop *desktop);
|
||||
static int _il_home_win_cb_timeout(void *data);
|
||||
static int _il_home_border_add(void *data, int type, void *event);
|
||||
static int _il_home_border_remove(void *data, int type, void *event);
|
||||
static int _il_home_cb_client_message(void *data, int type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *instances = NULL;
|
||||
static Eina_List *desks = NULL;
|
||||
static Eina_List *sels = NULL;
|
||||
static Eina_List *handlers = NULL;
|
||||
static E_Busycover *busycover = NULL;
|
||||
static Ecore_Timer *defer = NULL;
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "illume-home",
|
||||
{ _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
|
||||
};
|
||||
|
||||
/* public functions */
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Home" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
if (!il_home_config_init(m)) return NULL;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
|
||||
_il_home_apps_unpopulate();
|
||||
_il_home_apps_populate();
|
||||
|
||||
e_busycover_init();
|
||||
busycover = e_busycover_new(zone, m->dir);
|
||||
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(EFREET_EVENT_DESKTOP_LIST_CHANGE,
|
||||
_il_home_desktop_list_change,
|
||||
NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(EFREET_EVENT_DESKTOP_CHANGE,
|
||||
_il_home_desktop_change, NULL));
|
||||
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_ADD,
|
||||
_il_home_border_add, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
|
||||
_il_home_border_remove, NULL));
|
||||
|
||||
exit_hdl =
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_il_home_win_cb_exe_del, NULL);
|
||||
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
Ecore_Event_Handler *handle;
|
||||
Il_Home_Exec *exe;
|
||||
|
||||
EINA_LIST_FREE(exes, exe)
|
||||
{
|
||||
if (exe->exec)
|
||||
{
|
||||
ecore_exe_terminate(exe->exec);
|
||||
ecore_exe_free(exe->exec);
|
||||
exe->exec = NULL;
|
||||
}
|
||||
if (exe->handle)
|
||||
{
|
||||
e_busycover_pop(busycover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
if (exe->timeout) ecore_timer_del(exe->timeout);
|
||||
E_FREE(exe);
|
||||
}
|
||||
|
||||
if (exit_hdl) ecore_event_handler_del(exit_hdl);
|
||||
exit_hdl = NULL;
|
||||
|
||||
_il_home_apps_unpopulate();
|
||||
|
||||
if (busycover)
|
||||
{
|
||||
e_object_del(E_OBJECT(busycover));
|
||||
busycover = NULL;
|
||||
}
|
||||
e_busycover_shutdown();
|
||||
|
||||
EINA_LIST_FREE(handlers, handle)
|
||||
ecore_event_handler_del(handle);
|
||||
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
|
||||
il_home_config_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return il_home_config_save();
|
||||
}
|
||||
|
||||
void
|
||||
il_home_win_cfg_update(void)
|
||||
{
|
||||
_il_home_apps_unpopulate();
|
||||
_il_home_apps_populate();
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Object *icon;
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj",
|
||||
il_home_cfg->mod_dir);
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL,
|
||||
_il_home_btn_cb_click, inst, NULL);
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
e_icon_file_edje_set(icon, buff, "btn_icon");
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn);
|
||||
inst->gcc->data = inst;
|
||||
|
||||
_il_home_win_new(inst);
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
mode = ecore_x_e_illume_mode_get(xwin);
|
||||
if (mode > ECORE_X_ILLUME_MODE_SINGLE)
|
||||
_il_home_win_new(inst);
|
||||
|
||||
inst->hdl = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_il_home_cb_client_message, inst);
|
||||
|
||||
instances = eina_list_append(instances, inst);
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Il_Home_Win *hwin;
|
||||
|
||||
if (!(inst = gcc->data)) return;
|
||||
instances = eina_list_remove(instances, inst);
|
||||
if (inst->o_btn) evas_object_del(inst->o_btn);
|
||||
if (inst->hdl) ecore_event_handler_del(inst->hdl);
|
||||
EINA_LIST_FREE(inst->wins, hwin)
|
||||
e_object_del(E_OBJECT(hwin));
|
||||
|
||||
E_FREE(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
return _("Illume-Home");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj",
|
||||
il_home_cfg->mod_dir);
|
||||
o = edje_object_add(evas);
|
||||
edje_object_file_set(o, buff, "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.%d", _gc_class.name,
|
||||
eina_list_count(instances));
|
||||
return strdup(buff);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_btn_cb_click(void *data, void *data2)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
if (!(inst = data)) return;
|
||||
_il_home_win_new(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_win_new(Instance *inst)
|
||||
{
|
||||
Il_Home_Win *hwin;
|
||||
E_Container *con;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
hwin = E_OBJECT_ALLOC(Il_Home_Win, IL_HOME_WIN_TYPE,
|
||||
_il_home_win_cb_free);
|
||||
if (!hwin) return;
|
||||
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
|
||||
hwin->win = e_win_new(con);
|
||||
if (!hwin->win)
|
||||
{
|
||||
e_object_del(E_OBJECT(hwin));
|
||||
return;
|
||||
}
|
||||
|
||||
inst->wins = eina_list_append(inst->wins, hwin);
|
||||
|
||||
e_win_resize_callback_set(hwin->win, _il_home_win_cb_resize);
|
||||
hwin->win->data = inst;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj",
|
||||
il_home_cfg->mod_dir);
|
||||
hwin->o_bg = edje_object_add(e_win_evas_get(hwin->win));
|
||||
if (!e_theme_edje_object_set(hwin->o_bg,
|
||||
"base/theme/modules/illume-home",
|
||||
"modules/illume-home/window"))
|
||||
edje_object_file_set(hwin->o_bg, buff, "modules/illume-home/window");
|
||||
evas_object_move(hwin->o_bg, 0, 0);
|
||||
evas_object_resize(hwin->o_bg, hwin->win->w, hwin->win->h);
|
||||
evas_object_show(hwin->o_bg);
|
||||
|
||||
hwin->o_sf = e_scrollframe_add(e_win_evas_get(hwin->win));
|
||||
e_scrollframe_single_dir_set(hwin->o_sf, 1);
|
||||
evas_object_move(hwin->o_sf, 0, 0);
|
||||
evas_object_resize(hwin->o_sf, hwin->win->w, hwin->win->h);
|
||||
evas_object_show(hwin->o_sf);
|
||||
|
||||
e_scrollframe_custom_edje_file_set(hwin->o_sf, buff,
|
||||
"modules/illume-home/launcher/scrollview");
|
||||
|
||||
hwin->o_fm = e_fm2_add(e_win_evas_get(hwin->win));
|
||||
_il_home_fmc_set(hwin->o_fm);
|
||||
evas_object_show(hwin->o_fm);
|
||||
e_user_dir_concat_static(buff, "appshadow");
|
||||
e_fm2_path_set(hwin->o_fm, NULL, buff);
|
||||
|
||||
e_fm2_window_object_set(hwin->o_fm, E_OBJECT(hwin->win));
|
||||
|
||||
e_scrollframe_extern_pan_set(hwin->o_sf, hwin->o_fm,
|
||||
_il_home_pan_set,
|
||||
_il_home_pan_get,
|
||||
_il_home_pan_max_get,
|
||||
_il_home_pan_child_size_get);
|
||||
evas_object_propagate_events_set(hwin->o_fm, 0);
|
||||
evas_object_smart_callback_add(hwin->o_fm, "selected",
|
||||
_il_home_cb_selected, hwin);
|
||||
|
||||
e_win_title_set(hwin->win, _("Illume Home"));
|
||||
e_win_name_class_set(hwin->win, "Illume-Home", "Illume-Home");
|
||||
e_win_size_min_set(hwin->win, 48, 48);
|
||||
e_win_show(hwin->win);
|
||||
e_border_focus_set(hwin->win->border, 1, 1);
|
||||
|
||||
if (hwin->win->evas_win)
|
||||
e_drop_xdnd_register_set(hwin->win->evas_win, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_win_cb_free(Il_Home_Win *hwin)
|
||||
{
|
||||
if (hwin->win->evas_win)
|
||||
e_drop_xdnd_register_set(hwin->win->evas_win, 0);
|
||||
if (hwin->o_bg) evas_object_del(hwin->o_bg);
|
||||
hwin->o_bg = NULL;
|
||||
if (hwin->o_sf) evas_object_del(hwin->o_sf);
|
||||
hwin->o_sf = NULL;
|
||||
if (hwin->o_fm) evas_object_del(hwin->o_fm);
|
||||
hwin->o_fm = NULL;
|
||||
if (hwin->win) e_object_del(E_OBJECT(hwin->win));
|
||||
hwin->win = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_win_cb_resize(E_Win *win)
|
||||
{
|
||||
Instance *inst;
|
||||
Il_Home_Win *hwin;
|
||||
Eina_List *l;
|
||||
|
||||
if (!(inst = win->data)) return;
|
||||
EINA_LIST_FOREACH(inst->wins, l, hwin)
|
||||
{
|
||||
if (hwin->win != win)
|
||||
{
|
||||
hwin = NULL;
|
||||
continue;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (!hwin) return;
|
||||
|
||||
if (hwin->o_bg)
|
||||
{
|
||||
if (hwin->win)
|
||||
evas_object_resize(hwin->o_bg, hwin->win->w, hwin->win->h);
|
||||
}
|
||||
if (hwin->o_sf)
|
||||
{
|
||||
if (hwin->win)
|
||||
evas_object_resize(hwin->o_sf, hwin->win->w, hwin->win->h);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
e_fm2_pan_set(obj, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
|
||||
{
|
||||
e_fm2_pan_get(obj, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
|
||||
{
|
||||
e_fm2_pan_max_get(obj, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
e_fm2_pan_child_size_get(obj, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_cb_selected(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Home_Win *hwin;
|
||||
Eina_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
|
||||
if (!(hwin = data)) return;
|
||||
selected = e_fm2_selected_list_get(hwin->o_fm);
|
||||
if (!selected) return;
|
||||
EINA_LIST_FREE(selected, ici)
|
||||
{
|
||||
Efreet_Desktop *desktop;
|
||||
|
||||
if (ici)
|
||||
{
|
||||
if (ici->real_link)
|
||||
{
|
||||
desktop = efreet_desktop_get(ici->real_link);
|
||||
if (desktop)
|
||||
_il_home_desktop_run(hwin, desktop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop)
|
||||
{
|
||||
E_Exec_Instance *eins;
|
||||
Il_Home_Exec *exe;
|
||||
Eina_List *l;
|
||||
E_Border *b;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if ((!desktop) || (!desktop->exec)) return;
|
||||
|
||||
EINA_LIST_FOREACH(exes, l, exe)
|
||||
{
|
||||
if (exe->desktop == desktop)
|
||||
{
|
||||
if (exe->border)
|
||||
{
|
||||
e_border_uniconify(exe->border);
|
||||
e_border_show(exe->border);
|
||||
e_border_raise(exe->border);
|
||||
e_border_focus_set(exe->border, 1, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b = _il_home_desktop_find_border(desktop);
|
||||
if (b)
|
||||
{
|
||||
e_border_uniconify(b);
|
||||
e_border_show(b);
|
||||
e_border_raise(b);
|
||||
e_border_focus_set(b, 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
exe = E_NEW(Il_Home_Exec, 1);
|
||||
if (!exe) return;
|
||||
|
||||
eins = e_exec(e_util_zone_current_get(e_manager_current_get()),
|
||||
desktop, NULL, NULL, "illume-home");
|
||||
exe->desktop = desktop;
|
||||
if (eins)
|
||||
{
|
||||
exe->exec = eins->exe;
|
||||
exe->startup_id = eins->startup_id;
|
||||
exe->pid = ecore_exe_pid_get(eins->exe);
|
||||
}
|
||||
|
||||
exe->timeout = ecore_timer_add(20.0, _il_home_win_cb_timeout, exe);
|
||||
|
||||
snprintf(buff, sizeof(buff), "Starting %s", desktop->name);
|
||||
exe->handle = e_busycover_push(busycover, buff, NULL);
|
||||
|
||||
exes = eina_list_append(exes, exe);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_apps_populate(void)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
Instance *inst;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
e_user_dir_concat_static(buff, "appshadow");
|
||||
ecore_file_mkpath(buff);
|
||||
|
||||
_il_home_desks_populate();
|
||||
|
||||
EINA_LIST_FOREACH(instances, l, inst)
|
||||
{
|
||||
Il_Home_Win *hwin;
|
||||
|
||||
EINA_LIST_FOREACH(inst->wins, ll, hwin)
|
||||
{
|
||||
if (!hwin) continue;
|
||||
_il_home_fmc_set(hwin->o_fm);
|
||||
e_fm2_path_set(hwin->o_fm, NULL, buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_apps_unpopulate(void)
|
||||
{
|
||||
Efreet_Desktop *desktop;
|
||||
Eina_List *files;
|
||||
char buff[PATH_MAX], *file;
|
||||
size_t len;
|
||||
|
||||
EINA_LIST_FREE(desks, desktop)
|
||||
efreet_desktop_free(desktop);
|
||||
|
||||
len = e_user_dir_concat_static(buff, "appshadow");
|
||||
if ((len + 2) >= sizeof(buff)) return;
|
||||
|
||||
files = ecore_file_ls(buff);
|
||||
buff[len] = '/';
|
||||
len++;
|
||||
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
if (ecore_strlcpy(buff + len, file, sizeof(buff) - len) >= sizeof(buff) - len)
|
||||
continue;
|
||||
ecore_file_unlink(buff);
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_fmc_set(Evas_Object *obj)
|
||||
{
|
||||
E_Fm2_Config fmc;
|
||||
|
||||
if (!obj) return;
|
||||
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||
fmc.view.mode = E_FM2_VIEW_MODE_GRID_ICONS;
|
||||
fmc.view.open_dirs_in_place = 1;
|
||||
fmc.view.selector = 0;
|
||||
fmc.view.single_click = il_home_cfg->single_click;
|
||||
fmc.view.single_click_delay = il_home_cfg->single_click_delay;
|
||||
fmc.view.no_subdir_jump = 1;
|
||||
fmc.icon.extension.show = 0;
|
||||
fmc.icon.icon.w = il_home_cfg->icon_size * e_scale / 2.0;
|
||||
fmc.icon.icon.h = il_home_cfg->icon_size * e_scale / 2.0;
|
||||
fmc.icon.fixed.w = il_home_cfg->icon_size * e_scale / 2.0;
|
||||
fmc.icon.fixed.h = il_home_cfg->icon_size * e_scale / 2.0;
|
||||
fmc.list.sort.no_case = 0;
|
||||
fmc.list.sort.dirs.first = 1;
|
||||
fmc.list.sort.dirs.last = 0;
|
||||
fmc.selection.single = 1;
|
||||
fmc.selection.windows_modifiers = 0;
|
||||
e_fm2_config_set(obj, &fmc);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_home_desks_populate(void)
|
||||
{
|
||||
Efreet_Menu *menu;
|
||||
|
||||
menu = efreet_menu_get();
|
||||
if (menu)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
Efreet_Desktop *desktop;
|
||||
char buff[PATH_MAX];
|
||||
Efreet_Menu *entry, *subentry;
|
||||
Eina_List *settings, *sys, *kbd;
|
||||
int num = 0;
|
||||
|
||||
settings = efreet_util_desktop_category_list("Settings");
|
||||
sys = efreet_util_desktop_category_list("System");
|
||||
kbd = efreet_util_desktop_category_list("Keyboard");
|
||||
EINA_LIST_FOREACH(menu->entries, l, entry)
|
||||
{
|
||||
if (entry->type != EFREET_MENU_ENTRY_MENU) continue;
|
||||
desktop = entry->desktop;
|
||||
EINA_LIST_FOREACH(entry->entries, ll, subentry)
|
||||
{
|
||||
if (subentry->type != EFREET_MENU_ENTRY_DESKTOP) continue;
|
||||
if (!(desktop = subentry->desktop)) continue;
|
||||
if ((settings) && (sys) &&
|
||||
(eina_list_data_find(settings, desktop)) &&
|
||||
(eina_list_data_find(sys, desktop))) continue;
|
||||
if ((kbd) && (eina_list_data_find(kbd, desktop)))
|
||||
continue;
|
||||
if (!desktop) continue;
|
||||
desks = eina_list_append(desks, desktop);
|
||||
efreet_desktop_ref(desktop);
|
||||
if (desktop)
|
||||
{
|
||||
e_user_dir_snprintf(buff, sizeof(buff),
|
||||
"appshadow/%04x.desktop", num);
|
||||
ecore_file_symlink(desktop->orig_path, buff);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_desktop_list_change(void *data, int type, void *event)
|
||||
{
|
||||
if (defer) ecore_timer_del(defer);
|
||||
defer = ecore_timer_add(1.0, _il_home_update_deferred, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_desktop_change(void *data, int type, void *event)
|
||||
{
|
||||
if (defer) ecore_timer_del(defer);
|
||||
defer = ecore_timer_add(1.0, _il_home_update_deferred, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_update_deferred(void *data)
|
||||
{
|
||||
_il_home_apps_unpopulate();
|
||||
_il_home_apps_populate();
|
||||
defer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_win_cb_exe_del(void *data, int type, void *event)
|
||||
{
|
||||
Il_Home_Exec *exe;
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
Eina_List *l;
|
||||
|
||||
ev = event;
|
||||
EINA_LIST_FOREACH(exes, l, exe)
|
||||
{
|
||||
if (exe->pid == ev->pid)
|
||||
{
|
||||
if (exe->handle)
|
||||
{
|
||||
e_busycover_pop(busycover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
exes = eina_list_remove_list(exes, l);
|
||||
if (exe->timeout) ecore_timer_del(exe->timeout);
|
||||
E_FREE(exe);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static E_Border *
|
||||
_il_home_desktop_find_border(Efreet_Desktop *desktop)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
char *exe = NULL, *p;
|
||||
|
||||
if (!desktop) return NULL;
|
||||
if (!desktop->exec) return NULL;
|
||||
p = strchr(desktop->exec, ' ');
|
||||
if (!p)
|
||||
exe = strdup(desktop->exec);
|
||||
else
|
||||
{
|
||||
exe = malloc(p - desktop->exec + 1);
|
||||
if (exe) ecore_strlcpy(exe, desktop->exec, p - desktop->exec + 1);
|
||||
}
|
||||
if (exe)
|
||||
{
|
||||
p = strrchr(exe, '/');
|
||||
if (p) strcpy(exe, p + 1);
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(e_border_client_list(), l, bd)
|
||||
{
|
||||
if (e_exec_startup_id_pid_find(bd->client.netwm.pid,
|
||||
bd->client.netwm.startup_id) == desktop)
|
||||
{
|
||||
if (exe) free(exe);
|
||||
return bd;
|
||||
}
|
||||
if (exe)
|
||||
{
|
||||
if (bd->client.icccm.command.argv)
|
||||
{
|
||||
char *pp;
|
||||
|
||||
pp = strrchr(bd->client.icccm.command.argv[0], '/');
|
||||
if (!pp) pp = bd->client.icccm.command.argv[0];
|
||||
if (!strcmp(exe, pp))
|
||||
{
|
||||
if (exe) free(exe);
|
||||
return bd;
|
||||
}
|
||||
}
|
||||
if ((bd->client.icccm.name) &&
|
||||
(!strcasecmp(bd->client.icccm.name, exe)))
|
||||
{
|
||||
if (exe) free(exe);
|
||||
return bd;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exe) free(exe);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_win_cb_timeout(void *data)
|
||||
{
|
||||
Il_Home_Exec *exe;
|
||||
|
||||
if (!(exe = data)) return 1;
|
||||
if (exe->handle) e_busycover_pop(busycover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
if (!exe->border)
|
||||
{
|
||||
exes = eina_list_remove(exes, exe);
|
||||
E_FREE(exe);
|
||||
return 0;
|
||||
}
|
||||
exe->timeout = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_border_add(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
Il_Home_Exec *exe;
|
||||
Eina_List *l;
|
||||
|
||||
ev = event;
|
||||
EINA_LIST_FOREACH(exes, l, exe)
|
||||
{
|
||||
if (!exe->border)
|
||||
{
|
||||
if ((exe->startup_id == ev->border->client.netwm.startup_id) ||
|
||||
(exe->pid == ev->border->client.netwm.pid))
|
||||
{
|
||||
exe->border = ev->border;
|
||||
if (exe->handle)
|
||||
{
|
||||
e_busycover_pop(busycover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
if (exe->timeout) ecore_timer_del(exe->timeout);
|
||||
exe->timeout = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_border_remove(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
Il_Home_Exec *exe;
|
||||
Eina_List *l;
|
||||
|
||||
ev = event;
|
||||
EINA_LIST_FOREACH(exes, l, exe)
|
||||
{
|
||||
if (exe->border == ev->border)
|
||||
{
|
||||
if (exe->exec)
|
||||
{
|
||||
ecore_exe_free(exe->exec);
|
||||
exe->exec = NULL;
|
||||
}
|
||||
if (exe->handle)
|
||||
{
|
||||
e_busycover_pop(busycover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
exe->border = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_home_cb_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
Instance *inst;
|
||||
|
||||
ev = event;
|
||||
if (ev->message_type != ECORE_X_ATOM_E_ILLUME_HOME) return 1;
|
||||
if (!(inst = data)) return 1;
|
||||
_il_home_win_new(inst);
|
||||
return 1;
|
||||
}
|
|
@ -1,12 +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);
|
||||
|
||||
void il_home_win_cfg_update(void);
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Home
|
||||
Icon=e-module-illume-home
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Home for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Home</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Home</title>
|
|
@ -1,33 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-indicator
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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_config.c \
|
||||
e_mod_config.h \
|
||||
e_mod_win.c \
|
||||
e_mod_win.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,60 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local variables */
|
||||
EAPI Il_Ind_Config *il_ind_cfg = NULL;
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
|
||||
int
|
||||
il_ind_config_init(E_Module *m)
|
||||
{
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume-Ind_Cfg", Il_Ind_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Il_Ind_Config
|
||||
#define D conf_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
|
||||
il_ind_cfg = e_config_domain_load("module.illume-indicator", conf_edd);
|
||||
if ((il_ind_cfg) &&
|
||||
((il_ind_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
{
|
||||
E_FREE(il_ind_cfg);
|
||||
il_ind_cfg = NULL;
|
||||
}
|
||||
if (!il_ind_cfg)
|
||||
{
|
||||
il_ind_cfg = E_NEW(Il_Ind_Config, 1);
|
||||
il_ind_cfg->version = 0;
|
||||
}
|
||||
if (il_ind_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
/* if ((il_ind_cfg->version & 0xffff) < 1) */
|
||||
il_ind_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||
}
|
||||
|
||||
il_ind_cfg->mod_dir = eina_stringshare_add(m->dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_ind_config_shutdown(void)
|
||||
{
|
||||
if (il_ind_cfg->mod_dir) eina_stringshare_del(il_ind_cfg->mod_dir);
|
||||
il_ind_cfg->mod_dir = NULL;
|
||||
|
||||
E_FREE(il_ind_cfg);
|
||||
il_ind_cfg = NULL;
|
||||
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_ind_config_save(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
#define E_MOD_CONFIG_H
|
||||
|
||||
#define IL_CONFIG_MIN 0
|
||||
#define IL_CONFIG_MAJ 0
|
||||
|
||||
typedef struct _Il_Ind_Config Il_Ind_Config;
|
||||
|
||||
struct _Il_Ind_Config
|
||||
{
|
||||
int version;
|
||||
|
||||
// Placeholders
|
||||
const char *mod_dir;
|
||||
};
|
||||
|
||||
int il_ind_config_init(E_Module *m);
|
||||
int il_ind_config_shutdown(void);
|
||||
int il_ind_config_save(void);
|
||||
|
||||
extern EAPI Il_Ind_Config *il_ind_cfg;
|
||||
|
||||
#endif
|
|
@ -1,53 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_win.h"
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *iwins = NULL;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Indicator" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Screen *screen;
|
||||
const Eina_List *l;
|
||||
|
||||
if (!il_ind_config_init(m)) return NULL;
|
||||
|
||||
e_mod_ind_win_init();
|
||||
|
||||
EINA_LIST_FOREACH(e_xinerama_screens_get(), l, screen)
|
||||
{
|
||||
Il_Ind_Win *iwin = NULL;
|
||||
|
||||
if (!(iwin = e_mod_ind_win_new(screen))) continue;
|
||||
iwins = eina_list_append(iwins, iwin);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
EINA_LIST_FREE(iwins, iwin)
|
||||
{
|
||||
e_object_del(E_OBJECT(iwin));
|
||||
iwin = NULL;
|
||||
}
|
||||
|
||||
e_mod_ind_win_shutdown();
|
||||
il_ind_config_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return il_ind_config_save();
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#define IL_IND_WIN_TYPE 0xE1b0886
|
||||
|
||||
typedef struct _Il_Ind_Win Il_Ind_Win;
|
||||
|
||||
struct _Il_Ind_Win
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
E_Win *win;
|
||||
E_Menu *menu;
|
||||
E_Gadcon *gadcon;
|
||||
Evas_Object *o_base, *o_event;
|
||||
};
|
||||
|
||||
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,370 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_win.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _il_ind_win_cb_free(Il_Ind_Win *iwin);
|
||||
static void _il_ind_win_cb_resize(E_Win *ewin);
|
||||
static void _il_ind_win_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _il_ind_win_cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _il_ind_win_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _il_ind_win_cb_mouse_wheel(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static int _il_ind_win_gadcon_client_add(void *data, const E_Gadcon_Client_Class *cc);
|
||||
static void _il_ind_win_gadcon_client_del(void *data, E_Gadcon_Client *gcc);
|
||||
static void _il_ind_win_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
|
||||
static void _il_ind_win_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
|
||||
static Evas_Object *_il_ind_win_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
|
||||
static void _il_ind_win_cb_menu_post(void *data, E_Menu *m);
|
||||
static void _il_ind_win_menu_append(Il_Ind_Win *iwin, E_Menu *mn);
|
||||
static void _il_ind_win_cb_menu_pre(void *data, E_Menu *mn);
|
||||
static void _il_ind_win_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn);
|
||||
static void _il_ind_win_cb_menu_contents(void *data, E_Menu *mn, E_Menu_Item *mi);
|
||||
static int _il_ind_win_is_locked(void);
|
||||
|
||||
static int my = 0;
|
||||
|
||||
int
|
||||
e_mod_ind_win_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_ind_win_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Il_Ind_Win *
|
||||
e_mod_ind_win_new(E_Screen *screen)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
E_Container *con;
|
||||
E_Zone *zone;
|
||||
Evas *evas;
|
||||
Eina_List *l;
|
||||
E_Config_Gadcon *cg;
|
||||
Ecore_X_Window_State states[2];
|
||||
char buff[PATH_MAX];
|
||||
|
||||
iwin = E_OBJECT_ALLOC(Il_Ind_Win, IL_IND_WIN_TYPE, _il_ind_win_cb_free);
|
||||
if (!iwin) return NULL;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-indicator.edj",
|
||||
il_ind_cfg->mod_dir);
|
||||
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
zone = e_util_container_zone_id_get(con->num, screen->escreen);
|
||||
|
||||
iwin->win = e_win_new(con);
|
||||
states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
|
||||
states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
|
||||
ecore_x_netwm_window_state_set(iwin->win->evas_win, states, 2);
|
||||
ecore_x_icccm_hints_set(iwin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);
|
||||
ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);
|
||||
|
||||
e_win_no_remember_set(iwin->win, 1);
|
||||
e_win_resize_callback_set(iwin->win, _il_ind_win_cb_resize);
|
||||
iwin->win->data = iwin;
|
||||
e_win_title_set(iwin->win, _("Illume Indicator"));
|
||||
e_win_name_class_set(iwin->win, "Illume-Indicator", "Illume-Indicator");
|
||||
|
||||
evas = e_win_evas_get(iwin->win);
|
||||
|
||||
iwin->o_event = evas_object_rectangle_add(evas);
|
||||
evas_object_color_set(iwin->o_event, 0, 0, 0, 0);
|
||||
evas_object_move(iwin->o_event, 0, 0);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_il_ind_win_cb_mouse_down, iwin);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_MOVE,
|
||||
_il_ind_win_cb_mouse_move, iwin);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_UP,
|
||||
_il_ind_win_cb_mouse_up, iwin);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||
_il_ind_win_cb_mouse_wheel, iwin);
|
||||
evas_object_show(iwin->o_event);
|
||||
|
||||
iwin->o_base = edje_object_add(evas);
|
||||
if (!e_theme_edje_object_set(iwin->o_base,
|
||||
"base/theme/modules/illume-indicator",
|
||||
"modules/illume-indicator/shelf"))
|
||||
edje_object_file_set(iwin->o_base, buff, "modules/illume-indicator/shelf");
|
||||
evas_object_move(iwin->o_base, 0, 0);
|
||||
evas_object_show(iwin->o_base);
|
||||
|
||||
iwin->gadcon = e_gadcon_swallowed_new("illume-indicator", 1, iwin->o_base,
|
||||
"e.swallow.content");
|
||||
// iwin->gadcon->instant_edit = 1;
|
||||
edje_extern_object_min_size_set(iwin->gadcon->o_container, zone->w, 32);
|
||||
edje_object_part_swallow(iwin->o_base, "e.swallow.content",
|
||||
iwin->gadcon->o_container);
|
||||
e_gadcon_min_size_request_callback_set(iwin->gadcon,
|
||||
_il_ind_win_gadcon_min_size_request,
|
||||
iwin);
|
||||
e_gadcon_size_request_callback_set(iwin->gadcon,
|
||||
_il_ind_win_gadcon_size_request, iwin);
|
||||
e_gadcon_frame_request_callback_set(iwin->gadcon,
|
||||
_il_ind_win_gadcon_frame_request, iwin);
|
||||
e_gadcon_orient(iwin->gadcon, E_GADCON_ORIENT_FLOAT);
|
||||
e_gadcon_zone_set(iwin->gadcon, zone);
|
||||
e_gadcon_ecore_evas_set(iwin->gadcon, iwin->win->ecore_evas);
|
||||
e_gadcon_util_menu_attach_func_set(iwin->gadcon,
|
||||
_il_ind_win_cb_menu_items_append, iwin);
|
||||
e_gadcon_populate(iwin->gadcon);
|
||||
|
||||
e_win_size_min_set(iwin->win, zone->w, 32);
|
||||
e_win_show(iwin->win);
|
||||
e_win_move(iwin->win, zone->x, zone->y);
|
||||
|
||||
if (_il_ind_win_is_locked())
|
||||
ecore_x_e_illume_drag_locked_set(iwin->win->border->client.win, 1);
|
||||
else
|
||||
ecore_x_e_illume_drag_locked_set(iwin->win->border->client.win, 0);
|
||||
|
||||
return iwin;
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void
|
||||
_il_ind_win_cb_free(Il_Ind_Win *iwin)
|
||||
{
|
||||
if (iwin->menu)
|
||||
{
|
||||
e_menu_post_deactivate_callback_set(iwin->menu, NULL, NULL);
|
||||
e_object_del(E_OBJECT(iwin->menu));
|
||||
iwin->menu = NULL;
|
||||
}
|
||||
|
||||
if (iwin->o_event) evas_object_del(iwin->o_event);
|
||||
if (iwin->o_base) evas_object_del(iwin->o_base);
|
||||
|
||||
e_object_del(E_OBJECT(iwin->gadcon));
|
||||
iwin->gadcon = NULL;
|
||||
|
||||
e_object_del(E_OBJECT(iwin->win));
|
||||
E_FREE(iwin);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_resize(E_Win *ewin)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = ewin->data)) return;
|
||||
evas_object_resize(iwin->o_event, iwin->win->w, iwin->win->h);
|
||||
evas_object_resize(iwin->o_base, iwin->win->w, iwin->win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
ev = event;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (iwin->win->border->client.illume.drag.locked) return;
|
||||
ecore_x_e_illume_drag_set(iwin->win->border->client.win, 1);
|
||||
ecore_x_e_illume_drag_start_send(iwin->win->border->client.win);
|
||||
ecore_x_pointer_last_xy_get(NULL, &my);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
E_Menu *mn;
|
||||
E_Zone *zone;
|
||||
int x, y, w, h;
|
||||
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _il_ind_win_cb_menu_post, iwin);
|
||||
iwin->menu = mn;
|
||||
|
||||
_il_ind_win_menu_append(iwin, mn);
|
||||
|
||||
zone = e_util_container_zone_number_get(0, 0);
|
||||
e_gadcon_canvas_zone_geometry_get(iwin->gadcon, &x, &y, NULL, NULL);
|
||||
e_menu_activate_mouse(mn, zone, x + ev->output.x, y + ev->output.y,
|
||||
1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
Evas_Event_Mouse_Move *ev;
|
||||
E_Border *bd;
|
||||
int dy, ny, py;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
ev = event;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
bd = iwin->win->border;
|
||||
if (bd->client.illume.drag.locked) return;
|
||||
if (!bd->client.illume.drag.drag) return;
|
||||
if ((bd->y + bd->h + ev->cur.output.y) >= (bd->zone->h)) return;
|
||||
|
||||
ecore_x_pointer_last_xy_get(NULL, &py);
|
||||
dy = ((bd->zone->h - bd->h) / 8);
|
||||
|
||||
if ((ev->cur.output.y > ev->prev.output.y))
|
||||
{
|
||||
if ((py - my) < dy) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((my - py) < dy) return;
|
||||
}
|
||||
|
||||
if (py > my)
|
||||
ny = bd->y + dy;
|
||||
else if (py <= my)
|
||||
ny = bd->y - dy;
|
||||
else return;
|
||||
|
||||
if (bd->y != ny)
|
||||
{
|
||||
e_border_move(bd, bd->zone->x, ny);
|
||||
my = py;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
Evas_Event_Mouse_Up *ev;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
ev = event;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 1) return;
|
||||
bd = iwin->win->border;
|
||||
if (bd->client.illume.drag.locked) return;
|
||||
if (!bd->client.illume.drag.drag) return;
|
||||
ecore_x_e_illume_drag_end_send(bd->client.win);
|
||||
my = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_mouse_wheel(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
Evas_Event_Mouse_Wheel *ev;
|
||||
Ecore_X_Illume_Quickpanel_State state;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
ev = event;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->direction != 0) return;
|
||||
if (ev->z > 0)
|
||||
state = ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
|
||||
else if (ev->z < 0)
|
||||
state = ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
|
||||
ecore_x_e_illume_quickpanel_state_send(ecore_x_window_root_first_get(), state);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_menu_post(void *data, E_Menu *m)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
if (!iwin->menu) return;
|
||||
e_object_del(E_OBJECT(iwin->menu));
|
||||
iwin->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
_il_ind_win_menu_append(iwin, mn);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_menu_append(Il_Ind_Win *iwin, E_Menu *mn)
|
||||
{
|
||||
E_Menu *sm;
|
||||
E_Menu_Item *mi;
|
||||
|
||||
sm = e_menu_new();
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Illume Indicator"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-desktop-shelf");
|
||||
e_menu_pre_activate_callback_set(sm, _il_ind_win_cb_menu_pre, iwin);
|
||||
e_object_data_set(E_OBJECT(mi), iwin);
|
||||
e_menu_item_submenu_set(mi, sm);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_menu_pre(void *data, E_Menu *mn)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
E_Menu_Item *mi;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
e_menu_pre_activate_callback_set(mn, NULL, NULL);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Set Contents"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-desktop-shelf");
|
||||
e_menu_item_callback_set(mi, _il_ind_win_cb_menu_contents, iwin);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
if (gc == iwin->gadcon)
|
||||
{
|
||||
if (h < 32) h = 32;
|
||||
edje_extern_object_min_size_set(iwin->gadcon->o_container, w, h);
|
||||
edje_object_part_swallow(iwin->o_base, "e.swallow.content",
|
||||
iwin->gadcon->o_container);
|
||||
}
|
||||
evas_object_resize(iwin->o_base, iwin->win->w, iwin->win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_ind_win_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_ind_win_cb_menu_contents(void *data, E_Menu *mn, E_Menu_Item *mi)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
if (!iwin->gadcon->config_dialog)
|
||||
e_int_gadcon_config_shelf(iwin->gadcon);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_ind_win_is_locked(void)
|
||||
{
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
mode = ecore_x_e_illume_mode_get(xwin);
|
||||
if (mode == ECORE_X_ILLUME_MODE_DUAL_TOP)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef E_MOD_WIN_H
|
||||
#define E_MOD_WIN_H
|
||||
|
||||
int e_mod_ind_win_init(void);
|
||||
int e_mod_ind_win_shutdown(void);
|
||||
Il_Ind_Win *e_mod_ind_win_new(E_Screen *screen);
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Indicator
|
||||
Icon=e-module-illume-indicator
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Indicator for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Indicator</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Indicator</title>
|
|
@ -1,29 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-kbd-toggle
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,217 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
/* local structures */
|
||||
typedef struct _Instance Instance;
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *o_btn;
|
||||
Eina_List *handlers;
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
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 *cc);
|
||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas);
|
||||
static const char *_gc_id_new(E_Gadcon_Client_Class *cc);
|
||||
static void _cb_btn_click(void *data, void *data2);
|
||||
static int _cb_border_focus_in(void *data, int type, void *event);
|
||||
static int _cb_border_remove(void *data, int type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *instances = NULL;
|
||||
static const char *mod_dir = NULL;
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "illume-kbd-toggle",
|
||||
{ _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
|
||||
};
|
||||
|
||||
/* public functions */
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard Toggle" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
mod_dir = eina_stringshare_add(m->dir);
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
if (mod_dir) eina_stringshare_del(mod_dir);
|
||||
mod_dir = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Object *icon;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
||||
inst = E_NEW(Instance, 1);
|
||||
inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL,
|
||||
_cb_btn_click, inst, NULL);
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
e_icon_file_edje_set(icon, buff, "btn_icon");
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn);
|
||||
inst->gcc->data = inst;
|
||||
|
||||
inst->handlers =
|
||||
eina_list_append(inst->handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
||||
_cb_border_focus_in, inst));
|
||||
inst->handlers =
|
||||
eina_list_append(inst->handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
|
||||
_cb_border_remove, inst));
|
||||
|
||||
instances = eina_list_append(instances, inst);
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Ecore_Event_Handler *handler;
|
||||
|
||||
if (!(inst = gcc->data)) return;
|
||||
instances = eina_list_remove(instances, inst);
|
||||
if (inst->o_btn) evas_object_del(inst->o_btn);
|
||||
EINA_LIST_FREE(inst->handlers, handler)
|
||||
ecore_event_handler_del(handler);
|
||||
E_FREE(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
return _("Illume-Keyboard-Toggle");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
||||
o = edje_object_add(evas);
|
||||
edje_object_file_set(o, buff, "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.%d", _gc_class.name,
|
||||
eina_list_count(instances));
|
||||
return strdup(buff);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_btn_click(void *data, void *data2)
|
||||
{
|
||||
Ecore_X_Virtual_Keyboard_State state;
|
||||
Instance *inst;
|
||||
E_Border *bd;
|
||||
Evas_Object *icon;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if (!(inst = data)) return;
|
||||
if (!(bd = e_border_focused_get())) return;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
||||
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
state = bd->client.vkbd.state;
|
||||
if ((state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) ||
|
||||
(state == ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN))
|
||||
{
|
||||
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
||||
ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
|
||||
e_icon_file_edje_set(icon, buff, "btn_icon");
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
||||
ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
||||
e_icon_file_edje_set(icon, buff, "icon");
|
||||
}
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_focus_in(void *data, int type, void *event)
|
||||
{
|
||||
Instance *inst;
|
||||
E_Event_Border_Focus_In *ev;
|
||||
E_Border *bd;
|
||||
Evas_Object *icon;
|
||||
Ecore_X_Virtual_Keyboard_State state;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if (!(inst = data)) return 1;
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if (!(bd = ev->border)) return 1;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
||||
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
state = bd->client.vkbd.state;
|
||||
if ((state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) ||
|
||||
(state == ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN))
|
||||
e_icon_file_edje_set(icon, buff, "icon");
|
||||
else
|
||||
e_icon_file_edje_set(icon, buff, "btn_icon");
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_remove(void *data, int type, void *event)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Object *icon;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if (!(inst = data)) return 1;
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
e_icon_file_edje_set(icon, buff, "icon");
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
return 1;
|
||||
}
|
|
@ -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,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Keyboard-Toggle
|
||||
Icon=e-module-illume-kbd-toggle
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Keyboard Toggle for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Keyboard Toggle</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Keyboard-toggle</title>
|
|
@ -1,40 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
SUBDIRS = keyboards dicts
|
||||
MODULE = illume-keyboard
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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_kbd_int.c \
|
||||
e_kbd_int.h \
|
||||
e_kbd_dict.c \
|
||||
e_kbd_dict.h \
|
||||
e_kbd_buf.c \
|
||||
e_kbd_buf.h \
|
||||
e_kbd_send.c \
|
||||
e_kbd_send.h \
|
||||
e_mod_config.c \
|
||||
e_mod_config.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,9 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-keyboard
|
||||
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)/dicts
|
||||
files_DATA = \
|
||||
English_(US).dic \
|
||||
English_(US)_Small.dic
|
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
|
@ -1,573 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_kbd_buf.h"
|
||||
#include "e_kbd_dict.h"
|
||||
|
||||
#include <math.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, 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, 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, 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 = realloc(actual, actual_size);
|
||||
}
|
||||
strcpy(actual + actual_len, 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)
|
||||
{
|
||||
Eina_List *matches = NULL;
|
||||
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 int
|
||||
_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 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_cb_data_dict_change(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path)
|
||||
{
|
||||
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;
|
||||
if (key) 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, fuzz;
|
||||
|
||||
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 int
|
||||
_e_kbd_buf_cb_faket(void *data)
|
||||
{
|
||||
E_Kbd_Buf *kb;
|
||||
|
||||
kb = data;
|
||||
kb->lookup.faket = NULL;
|
||||
kb->lookup.func((void *)kb->lookup.data);
|
||||
kb->lookup.func = NULL;
|
||||
kb->lookup.data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_lookup(E_Kbd_Buf *kb, void (*func) (void *data), const 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);
|
||||
const 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), const 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,861 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_kbd_dict.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.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, 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_lookup_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, 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, 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))
|
||||
p2 = 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 == NULL))
|
||||
{
|
||||
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) return;
|
||||
wd = _e_kbd_dict_line_parse(kd, p, &usage);
|
||||
if ((wd) && (strlen(wd) > 0))
|
||||
{
|
||||
if (kd->changed.writes)
|
||||
{
|
||||
int 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);
|
||||
writeline = 1;
|
||||
eina_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
||||
}
|
||||
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 int
|
||||
_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 1;
|
||||
kd->changed.flush_timer = NULL;
|
||||
e_kbd_dict_save(kd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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, *l2, *list;
|
||||
const char *p, *pn;
|
||||
char *base, *buf, *wd, *bufapp;
|
||||
E_Kbd_Dict_Letter *kl;
|
||||
int len = 0, dist = 0, d, baselen, maxdist = 0, md;
|
||||
static int level = 0, lv;
|
||||
|
||||
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, upper;
|
||||
|
||||
// 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 useage. 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 teh 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_lookup_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,115 +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;
|
||||
|
||||
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;
|
||||
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, ok;
|
||||
|
||||
/* utf8 -> glyph id (unicode - ucs4) */
|
||||
glyph = 0;
|
||||
ok = 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,249 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_kbd_config_create(E_Config_Dialog *cfd);
|
||||
static void _il_kbd_config_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_kbd_config_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_kbd_config_changed(void *data, Evas_Object *obj, void *event);
|
||||
static int _il_kbd_config_change_timeout(void *data);
|
||||
|
||||
EAPI Il_Kbd_Config *il_kbd_cfg = NULL;
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
Ecore_Timer *_il_kbd_config_change_timer = NULL;
|
||||
int external = 0;
|
||||
|
||||
/* public functions */
|
||||
EAPI int
|
||||
il_kbd_config_init(E_Module *m)
|
||||
{
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume_Kbd_Cfg", Il_Kbd_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Il_Kbd_Config
|
||||
#define D conf_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
E_CONFIG_VAL(D, T, use_internal, INT);
|
||||
E_CONFIG_VAL(D, T, run_keyboard, STR);
|
||||
E_CONFIG_VAL(D, T, dict, STR);
|
||||
|
||||
il_kbd_cfg = e_config_domain_load("module.illume-keyboard", conf_edd);
|
||||
if ((il_kbd_cfg) &&
|
||||
((il_kbd_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
{
|
||||
E_FREE(il_kbd_cfg);
|
||||
il_kbd_cfg = NULL;
|
||||
}
|
||||
if (!il_kbd_cfg)
|
||||
{
|
||||
il_kbd_cfg = E_NEW(Il_Kbd_Config, 1);
|
||||
il_kbd_cfg->version = 0;
|
||||
il_kbd_cfg->use_internal = 1;
|
||||
il_kbd_cfg->run_keyboard = NULL;
|
||||
il_kbd_cfg->dict = eina_stringshare_add("English_(US).dic");
|
||||
}
|
||||
if (il_kbd_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
/* if ((il_kbd_cfg->version & 0xffff) < 1) */
|
||||
il_kbd_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||
}
|
||||
|
||||
il_kbd_cfg->mod_dir = eina_stringshare_add(m->dir);
|
||||
|
||||
e_configure_registry_category_add("illume", 0, _("Illume"), NULL,
|
||||
"enlightenment/display");
|
||||
e_configure_registry_generic_item_add("illume/keyboard", 0, _("Keyboard"),
|
||||
NULL, "enlightenment/keyboard",
|
||||
il_kbd_config_show);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
il_kbd_config_shutdown(void)
|
||||
{
|
||||
il_kbd_cfg->cfd = NULL;
|
||||
|
||||
e_configure_registry_item_del("illume/keyboard");
|
||||
e_configure_registry_category_del("illume");
|
||||
|
||||
if (il_kbd_cfg->mod_dir) eina_stringshare_del(il_kbd_cfg->mod_dir);
|
||||
if (il_kbd_cfg->run_keyboard) eina_stringshare_del(il_kbd_cfg->run_keyboard);
|
||||
if (il_kbd_cfg->dict) eina_stringshare_del(il_kbd_cfg->dict);
|
||||
|
||||
E_FREE(il_kbd_cfg);
|
||||
il_kbd_cfg = NULL;
|
||||
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
il_kbd_config_save(void)
|
||||
{
|
||||
e_config_domain_save("module.illume-keyboard", conf_edd, il_kbd_cfg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
il_kbd_config_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_keyboard_settings")) return;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_kbd_config_create;
|
||||
v->free_cfdata = _il_kbd_config_free;
|
||||
v->basic.create_widgets = _il_kbd_config_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Keyboard Settings"), "E",
|
||||
"_config_illume_keyboard_settings",
|
||||
"enlightenment/keyboard_settings", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
il_kbd_cfg->cfd = cfd;
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void *
|
||||
_il_kbd_config_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_kbd_config_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
il_kbd_cfg->cfd = NULL;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_kbd_config_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *ow;
|
||||
E_Radio_Group *rg;
|
||||
Eina_List *l;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
if (!il_kbd_cfg->run_keyboard)
|
||||
{
|
||||
if (il_kbd_cfg->use_internal) external = 1;
|
||||
else external = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Eina_List *kbds;
|
||||
Efreet_Desktop *desktop;
|
||||
int nn = 0;
|
||||
|
||||
external = 0;
|
||||
kbds = efreet_util_desktop_category_list("Keyboard");
|
||||
if (kbds)
|
||||
{
|
||||
nn = 2;
|
||||
EINA_LIST_FOREACH(kbds, l, desktop)
|
||||
{
|
||||
const char *dname;
|
||||
|
||||
dname = ecore_file_file_get(desktop->orig_path);
|
||||
if (dname)
|
||||
{
|
||||
if (!strcmp(il_kbd_cfg->run_keyboard, dname))
|
||||
{
|
||||
external = nn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
nn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Keyboards"), 0);
|
||||
rg = e_widget_radio_group_new(&(external));
|
||||
ow = e_widget_radio_add(evas, _("None"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed", _il_kbd_config_changed, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Default"), 1, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed", _il_kbd_config_changed, NULL);
|
||||
{
|
||||
Eina_List *kbds;
|
||||
Efreet_Desktop *desktop;
|
||||
int nn = 2;
|
||||
|
||||
kbds = efreet_util_desktop_category_list("Keyboard");
|
||||
EINA_LIST_FOREACH(kbds, l, desktop)
|
||||
{
|
||||
const char *dname;
|
||||
|
||||
dname = ecore_file_file_get(desktop->orig_path);
|
||||
ow = e_widget_radio_add(evas, desktop->name, nn, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_kbd_config_changed, NULL);
|
||||
nn++;
|
||||
}
|
||||
}
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_kbd_config_changed(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
if (_il_kbd_config_change_timer)
|
||||
ecore_timer_del(_il_kbd_config_change_timer);
|
||||
_il_kbd_config_change_timer =
|
||||
ecore_timer_add(0.5, _il_kbd_config_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_kbd_config_change_timeout(void *data)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
il_kbd_cfg->use_internal = 0;
|
||||
if (il_kbd_cfg->run_keyboard)
|
||||
eina_stringshare_del(il_kbd_cfg->run_keyboard);
|
||||
il_kbd_cfg->run_keyboard = NULL;
|
||||
if (external == 0)
|
||||
il_kbd_cfg->use_internal = 0;
|
||||
else if (external == 1)
|
||||
il_kbd_cfg->use_internal = 1;
|
||||
else
|
||||
{
|
||||
Eina_List *kbds;
|
||||
Efreet_Desktop *desktop;
|
||||
int nn;
|
||||
|
||||
kbds = efreet_util_desktop_category_list("Keyboard");
|
||||
if (kbds)
|
||||
{
|
||||
nn = 2;
|
||||
EINA_LIST_FOREACH(kbds, l, desktop)
|
||||
{
|
||||
const char *dname;
|
||||
|
||||
dname = ecore_file_file_get(desktop->orig_path);
|
||||
if (nn == external)
|
||||
{
|
||||
if (dname)
|
||||
il_kbd_cfg->run_keyboard = eina_stringshare_add(dname);
|
||||
break;
|
||||
}
|
||||
nn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
il_kbd_cfg_update();
|
||||
e_config_save_queue();
|
||||
_il_kbd_config_change_timer = NULL;
|
||||
return 0;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
#define E_MOD_CONFIG_H
|
||||
|
||||
#define IL_CONFIG_MIN 0
|
||||
#define IL_CONFIG_MAJ 0
|
||||
|
||||
typedef struct _Il_Kbd_Config Il_Kbd_Config;
|
||||
|
||||
struct _Il_Kbd_Config
|
||||
{
|
||||
int version;
|
||||
|
||||
int use_internal;
|
||||
const char *dict, *run_keyboard;
|
||||
|
||||
// Not User Configurable. Placeholders
|
||||
const char *mod_dir;
|
||||
E_Config_Dialog *cfd;
|
||||
};
|
||||
|
||||
EAPI int il_kbd_config_init(E_Module *m);
|
||||
EAPI int il_kbd_config_shutdown(void);
|
||||
EAPI int il_kbd_config_save(void);
|
||||
|
||||
EAPI void il_kbd_config_show(E_Container *con, const char *params);
|
||||
|
||||
extern EAPI Il_Kbd_Config *il_kbd_cfg;
|
||||
|
||||
#endif
|
|
@ -1,117 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_kbd_int.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _il_kbd_stop(void);
|
||||
static void _il_kbd_start(void);
|
||||
static int _il_kbd_cb_exit(void *data, int type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static E_Kbd_Int *ki = NULL;
|
||||
static Ecore_Exe *_kbd_exe = NULL;
|
||||
static Ecore_Event_Handler *_kbd_exe_exit_handler = NULL;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
if (!il_kbd_config_init(m)) return NULL;
|
||||
_il_kbd_start();
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
_il_kbd_stop();
|
||||
il_kbd_config_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return il_kbd_config_save();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
il_kbd_cfg_update(void)
|
||||
{
|
||||
_il_kbd_stop();
|
||||
_il_kbd_start();
|
||||
}
|
||||
|
||||
static void
|
||||
_il_kbd_stop(void)
|
||||
{
|
||||
if (ki) e_kbd_int_free(ki);
|
||||
ki = NULL;
|
||||
if (_kbd_exe) ecore_exe_interrupt(_kbd_exe);
|
||||
_kbd_exe = NULL;
|
||||
if (_kbd_exe_exit_handler) ecore_event_handler_del(_kbd_exe_exit_handler);
|
||||
_kbd_exe_exit_handler = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_kbd_start(void)
|
||||
{
|
||||
if (il_kbd_cfg->use_internal)
|
||||
{
|
||||
ki = e_kbd_int_new(il_kbd_cfg->mod_dir,
|
||||
il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir);
|
||||
}
|
||||
else if (il_kbd_cfg->run_keyboard)
|
||||
{
|
||||
E_Exec_Instance *inst;
|
||||
Efreet_Desktop *desktop;
|
||||
|
||||
desktop = efreet_util_desktop_file_id_find(il_kbd_cfg->run_keyboard);
|
||||
if (!desktop)
|
||||
{
|
||||
Eina_List *kbds, *l;
|
||||
|
||||
kbds = efreet_util_desktop_category_list("Keyboard");
|
||||
if (kbds)
|
||||
{
|
||||
EINA_LIST_FOREACH(kbds, l, desktop)
|
||||
{
|
||||
const char *dname;
|
||||
|
||||
dname = ecore_file_file_get(desktop->orig_path);
|
||||
if (dname)
|
||||
{
|
||||
if (!strcmp(dname, il_kbd_cfg->run_keyboard))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (desktop)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
inst = e_exec(zone, desktop, NULL, NULL, "illume-keyboard");
|
||||
if (inst)
|
||||
{
|
||||
_kbd_exe = inst->exe;
|
||||
_kbd_exe_exit_handler =
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_il_kbd_cb_exit, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_il_kbd_cb_exit(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->exe == _kbd_exe) _kbd_exe = NULL;
|
||||
return 1;
|
||||
}
|
|
@ -1,12 +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);
|
||||
|
||||
EAPI void il_kbd_cfg_update(void);
|
||||
|
||||
#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-keyboard
|
||||
|
||||
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.5 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.7 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,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Keyboard
|
||||
Icon=e-module-illume-keyboard
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Keyboard for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Keyboard</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Keyboard</title>
|
|
@ -1,29 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-mode-toggle
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,181 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
/* local structures */
|
||||
typedef struct _Instance Instance;
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *o_btn;
|
||||
Ecore_Event_Handler *hdl;
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
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 *cc);
|
||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas);
|
||||
static const char *_gc_id_new(E_Gadcon_Client_Class *cc);
|
||||
static void _cb_btn_click(void *data, void *data2);
|
||||
static int _cb_event_client_message(void *data, int type, void *event);
|
||||
static void _set_icon(Instance *inst);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *instances = NULL;
|
||||
static const char *mod_dir = NULL;
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "illume-mode-toggle",
|
||||
{ _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
|
||||
};
|
||||
|
||||
/* public functions */
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Mode Toggle" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
mod_dir = eina_stringshare_add(m->dir);
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
if (mod_dir) eina_stringshare_del(mod_dir);
|
||||
mod_dir = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
|
||||
inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL,
|
||||
_cb_btn_click, inst, NULL);
|
||||
_set_icon(inst);
|
||||
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn);
|
||||
inst->gcc->data = inst;
|
||||
|
||||
inst->hdl = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_cb_event_client_message, inst);
|
||||
|
||||
instances = eina_list_append(instances, inst);
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
if (!(inst = gcc->data)) return;
|
||||
instances = eina_list_remove(instances, inst);
|
||||
if (inst->o_btn) evas_object_del(inst->o_btn);
|
||||
if (inst->hdl) ecore_event_handler_del(inst->hdl);
|
||||
inst->hdl = NULL;
|
||||
E_FREE(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
return _("Illume-Mode-Toggle");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-mode-toggle.edj", mod_dir);
|
||||
o = edje_object_add(evas);
|
||||
edje_object_file_set(o, buff, "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.%d", _gc_class.name,
|
||||
eina_list_count(instances));
|
||||
return strdup(buff);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_btn_click(void *data, void *data2)
|
||||
{
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
mode = ecore_x_e_illume_mode_get(xwin);
|
||||
mode += 1;
|
||||
if (mode > ECORE_X_ILLUME_MODE_DUAL_LEFT)
|
||||
mode = ECORE_X_ILLUME_MODE_SINGLE;
|
||||
ecore_x_e_illume_mode_set(xwin, mode);
|
||||
ecore_x_e_illume_mode_send(xwin, mode);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
Instance *inst;
|
||||
|
||||
ev = event;
|
||||
if (ev->message_type != ECORE_X_ATOM_E_ILLUME_MODE) return 1;
|
||||
if (!(inst = data)) return 1;
|
||||
_set_icon(inst);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_set_icon(Instance *inst)
|
||||
{
|
||||
Evas_Object *icon;
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-mode-toggle.edj", mod_dir);
|
||||
icon = e_icon_add(evas_object_evas_get(inst->o_btn));
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
mode = ecore_x_e_illume_mode_get(xwin);
|
||||
if (mode == ECORE_X_ILLUME_MODE_SINGLE)
|
||||
e_icon_file_edje_set(icon, buff, "single");
|
||||
else if (mode == ECORE_X_ILLUME_MODE_DUAL_TOP)
|
||||
e_icon_file_edje_set(icon, buff, "dual_top");
|
||||
else if (mode == ECORE_X_ILLUME_MODE_DUAL_LEFT)
|
||||
e_icon_file_edje_set(icon, buff, "dual_left");
|
||||
|
||||
e_widget_button_icon_set(inst->o_btn, icon);
|
||||
}
|
|
@ -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,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Mode-Toggle
|
||||
Icon=e-module-illume-mode-toggle
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Mode Toggle for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Mode Toggle</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Mode-toggle</title>
|
|
@ -1,33 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-softkey
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-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_config.c \
|
||||
e_mod_config.h \
|
||||
e_mod_win.c \
|
||||
e_mod_win.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,65 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
EAPI Il_Sk_Config *il_sk_cfg = NULL;
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
|
||||
/* public functions */
|
||||
int
|
||||
il_sk_config_init(E_Module *m)
|
||||
{
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume-Softkey_Cfg", Il_Sk_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Il_Sk_Config
|
||||
#define D conf_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
|
||||
il_sk_cfg = e_config_domain_load("module.illume-softkey", conf_edd);
|
||||
if ((il_sk_cfg) &&
|
||||
((il_sk_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
{
|
||||
E_FREE(il_sk_cfg);
|
||||
il_sk_cfg = NULL;
|
||||
}
|
||||
if (!il_sk_cfg)
|
||||
{
|
||||
il_sk_cfg = E_NEW(Il_Sk_Config, 1);
|
||||
il_sk_cfg->version = 0;
|
||||
}
|
||||
if (il_sk_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
/* if ((il_sk_cfg->version & 0xffff) < 1) */
|
||||
il_sk_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||
}
|
||||
il_sk_cfg->mod_dir = eina_stringshare_add(m->dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_sk_config_shutdown(void)
|
||||
{
|
||||
if (il_sk_cfg->mod_dir) eina_stringshare_del(il_sk_cfg->mod_dir);
|
||||
il_sk_cfg->mod_dir = NULL;
|
||||
|
||||
E_FREE(il_sk_cfg);
|
||||
il_sk_cfg = NULL;
|
||||
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
il_sk_config_save(void)
|
||||
{
|
||||
e_config_domain_save("module.illume-softkey", conf_edd, il_sk_cfg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
il_sk_config_show(E_Container *con, const char *params)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
#define E_MOD_CONFIG_H
|
||||
|
||||
#define IL_CONFIG_MIN 0
|
||||
#define IL_CONFIG_MAJ 0
|
||||
|
||||
typedef struct _Il_Sk_Config Il_Sk_Config;
|
||||
struct _Il_Sk_Config
|
||||
{
|
||||
int version;
|
||||
|
||||
const char *mod_dir;
|
||||
};
|
||||
|
||||
int il_sk_config_init(E_Module *m);
|
||||
int il_sk_config_shutdown(void);
|
||||
int il_sk_config_save(void);
|
||||
void il_sk_config_show(E_Container *con, const char *params);
|
||||
|
||||
extern EAPI Il_Sk_Config *il_sk_cfg;
|
||||
|
||||
#endif
|
|
@ -1,55 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_win.h"
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *swins = NULL;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Softkey" };
|
||||
|
||||
/* public functions */
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Screen *screen;
|
||||
const Eina_List *l;
|
||||
|
||||
if (!il_sk_config_init(m)) return NULL;
|
||||
|
||||
e_mod_sk_win_init();
|
||||
|
||||
EINA_LIST_FOREACH(e_xinerama_screens_get(), l, screen)
|
||||
{
|
||||
Il_Sk_Win *swin = NULL;
|
||||
|
||||
if (!(swin = e_mod_sk_win_new(screen))) continue;
|
||||
swins = eina_list_append(swins, swin);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
Il_Sk_Win *swin;
|
||||
|
||||
EINA_LIST_FREE(swins, swin)
|
||||
{
|
||||
e_object_del(E_OBJECT(swin));
|
||||
swin = NULL;
|
||||
}
|
||||
|
||||
e_mod_sk_win_shutdown();
|
||||
|
||||
il_sk_config_shutdown();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return il_sk_config_save();
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#define IL_SK_WIN_TYPE 0xE1b0784
|
||||
|
||||
typedef struct _Il_Sk_Win Il_Sk_Win;
|
||||
|
||||
struct _Il_Sk_Win
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
E_Win *win;
|
||||
Evas_Object *o_base, *o_box;
|
||||
Evas_Object *b_close, *b_back;
|
||||
};
|
||||
|
||||
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,147 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_win.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _il_sk_win_cb_free(Il_Sk_Win *win);
|
||||
static void _il_sk_win_cb_resize(E_Win *win);
|
||||
static void _il_sk_win_cb_back_click(void *data, void *data2);
|
||||
static void _il_sk_win_cb_close_click(void *data, void *data2);
|
||||
|
||||
int
|
||||
e_mod_sk_win_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_sk_win_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Il_Sk_Win *
|
||||
e_mod_sk_win_new(E_Screen *screen)
|
||||
{
|
||||
Il_Sk_Win *swin;
|
||||
E_Container *con;
|
||||
E_Zone *zone;
|
||||
Evas *evas;
|
||||
Ecore_X_Window_State states[2];
|
||||
char buff[PATH_MAX];
|
||||
|
||||
swin = E_OBJECT_ALLOC(Il_Sk_Win, IL_SK_WIN_TYPE, _il_sk_win_cb_free);
|
||||
if (!swin) return NULL;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-softkey.edj",
|
||||
il_sk_cfg->mod_dir);
|
||||
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
zone = e_util_container_zone_id_get(con->num, screen->escreen);
|
||||
|
||||
swin->win = e_win_new(con);
|
||||
states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
|
||||
states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
|
||||
ecore_x_netwm_window_state_set(swin->win->evas_win, states, 2);
|
||||
ecore_x_icccm_hints_set(swin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);
|
||||
ecore_x_netwm_window_type_set(swin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);
|
||||
|
||||
e_win_no_remember_set(swin->win, 1);
|
||||
e_win_resize_callback_set(swin->win, _il_sk_win_cb_resize);
|
||||
e_win_borderless_set(swin->win, 1);
|
||||
swin->win->data = swin;
|
||||
e_win_title_set(swin->win, _("Illume Softkey"));
|
||||
e_win_name_class_set(swin->win, "Illume-Softkey", "Illume-Softkey");
|
||||
|
||||
evas = e_win_evas_get(swin->win);
|
||||
|
||||
swin->o_base = edje_object_add(evas);
|
||||
if (!e_theme_edje_object_set(swin->o_base, "base/theme/modules/illume-softkey",
|
||||
"modules/illume-softkey/window"))
|
||||
edje_object_file_set(swin->o_base, buff, "modules/illume-softkey/window");
|
||||
evas_object_move(swin->o_base, 0, 0);
|
||||
evas_object_resize(swin->o_base, zone->w, 32);
|
||||
evas_object_show(swin->o_base);
|
||||
|
||||
swin->o_box = e_widget_list_add(evas, 1, 1);
|
||||
edje_object_part_swallow(swin->o_base, "e.swallow.buttons", swin->o_box);
|
||||
|
||||
swin->b_back = e_widget_button_add(evas, NULL, "go-previous",
|
||||
_il_sk_win_cb_back_click, swin, NULL);
|
||||
e_widget_list_object_append(swin->o_box, swin->b_back, 1, 0, 0.5);
|
||||
|
||||
swin->b_close = e_widget_button_add(evas, NULL, "window-close",
|
||||
_il_sk_win_cb_close_click, swin, NULL);
|
||||
e_widget_list_object_append(swin->o_box, swin->b_close, 1, 0, 0.5);
|
||||
|
||||
e_win_size_min_set(swin->win, zone->w, 32);
|
||||
e_win_show(swin->win);
|
||||
e_win_move_resize(swin->win, zone->x, (zone->h - 32), zone->w, 32);
|
||||
|
||||
return swin;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_il_sk_win_cb_free(Il_Sk_Win *win)
|
||||
{
|
||||
if (win->b_close) evas_object_del(win->b_close);
|
||||
if (win->b_back) evas_object_del(win->b_back);
|
||||
if (win->o_box) evas_object_del(win->o_box);
|
||||
if (win->o_base) evas_object_del(win->o_base);
|
||||
e_object_del(E_OBJECT(win->win));
|
||||
E_FREE(win);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_sk_win_cb_resize(E_Win *win)
|
||||
{
|
||||
Il_Sk_Win *swin;
|
||||
|
||||
if (!(swin = win->data)) return;
|
||||
evas_object_resize(swin->o_base, swin->win->w, swin->win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_sk_win_cb_back_click(void *data, void *data2)
|
||||
{
|
||||
Il_Sk_Win *swin;
|
||||
E_Border *bd, *fbd;
|
||||
Eina_List *focused, *l;
|
||||
|
||||
if (!(swin = data)) return;
|
||||
if (!(bd = e_border_focused_get())) return;
|
||||
focused = e_border_focus_stack_get();
|
||||
EINA_LIST_REVERSE_FOREACH(focused, l, fbd)
|
||||
{
|
||||
E_Border *fb;
|
||||
|
||||
if (e_object_is_del(E_OBJECT(fbd))) continue;
|
||||
if ((!fbd->client.icccm.accepts_focus) &&
|
||||
(!fbd->client.icccm.take_focus)) continue;
|
||||
if (fbd->client.netwm.state.skip_taskbar) continue;
|
||||
if (fbd == bd)
|
||||
{
|
||||
if (!(fb = focused->next->data)) continue;
|
||||
if (e_object_is_del(E_OBJECT(fb))) continue;
|
||||
if ((!fb->client.icccm.accepts_focus) &&
|
||||
(!fb->client.icccm.take_focus)) continue;
|
||||
if (fb->client.netwm.state.skip_taskbar) continue;
|
||||
e_border_raise(fb);
|
||||
e_border_focus_set(fb, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_il_sk_win_cb_close_click(void *data, void *data2)
|
||||
{
|
||||
Il_Sk_Win *swin;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(swin = data)) return;
|
||||
if (!(bd = e_border_focused_get())) return;
|
||||
e_border_act_close_begin(bd);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef E_MOD_WIN_H
|
||||
#define E_MOD_WIN_H
|
||||
|
||||
int e_mod_sk_win_init(void);
|
||||
int e_mod_sk_win_shutdown(void);
|
||||
Il_Sk_Win *e_mod_sk_win_new(E_Screen *screen);
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume-Softkey
|
||||
Icon=e-module-illume-softkey
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume Softkey for Embedded</title>
|
||||
Comment[fr]=<title>Illume pour l'embarqué – Softkey</title>
|
||||
Comment[it]=<title>Illume per sistemi embedded – modulo Softkey</title>
|
|
@ -1,132 +0,0 @@
|
|||
#ifndef E_ILLUME_H
|
||||
# define E_ILLUME_H
|
||||
|
||||
# include "e.h"
|
||||
|
||||
# define E_ILLUME_LAYOUT_API_VERSION 1
|
||||
# define E_ILLUME_LAYOUT_TYPE 0xE0b200b
|
||||
|
||||
typedef enum _E_Illume_Animation_Class
|
||||
{
|
||||
E_ILLUME_ANIM_APP,
|
||||
E_ILLUME_ANIM_KEYBOARD,
|
||||
E_ILLUME_ANIM_TOP_SHELF,
|
||||
E_ILLUME_ANIM_BOTTOM_PANEL,
|
||||
E_ILLUME_ANIM_DIALOG,
|
||||
E_ILLUME_ANIM_QUICKPANEL,
|
||||
E_ILLUME_ANIM_OTHER
|
||||
} E_Illume_Animation_Class;
|
||||
|
||||
typedef struct _E_Illume_Layout_Api E_Illume_Layout_Api;
|
||||
typedef struct _E_Illume_Layout_Policy E_Illume_Layout_Policy;
|
||||
typedef struct _E_Illume_Config E_Illume_Config;
|
||||
|
||||
struct _E_Illume_Layout_Api
|
||||
{
|
||||
int version;
|
||||
const char *label, *name;
|
||||
};
|
||||
|
||||
struct _E_Illume_Layout_Policy
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
E_Illume_Layout_Api *api;
|
||||
|
||||
void *handle;
|
||||
|
||||
struct
|
||||
{
|
||||
void *(*init) (E_Illume_Layout_Policy *p);
|
||||
int (*shutdown) (E_Illume_Layout_Policy *p);
|
||||
void (*config) (E_Container *con, const char *params);
|
||||
|
||||
void (*border_add) (E_Border *bd);
|
||||
void (*border_del) (E_Border *bd);
|
||||
void (*border_focus_in) (E_Border *bd);
|
||||
void (*border_focus_out) (E_Border *bd);
|
||||
void (*border_activate) (E_Border *bd);
|
||||
void (*zone_layout) (E_Zone *zone);
|
||||
void (*zone_move_resize) (E_Zone *zone);
|
||||
void (*drag_start) (E_Border *bd);
|
||||
void (*drag_end) (E_Border *bd);
|
||||
} funcs;
|
||||
};
|
||||
|
||||
struct _E_Illume_Config
|
||||
{
|
||||
int version;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
int duration;
|
||||
} kbd, softkey, quickpanel;
|
||||
} sliding;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *name;
|
||||
struct
|
||||
{
|
||||
const char *class;
|
||||
const char *name;
|
||||
const char *title;
|
||||
int win_type;
|
||||
struct
|
||||
{
|
||||
int class, name, title, win_type;
|
||||
} match;
|
||||
} vkbd, softkey, home, indicator;
|
||||
struct
|
||||
{
|
||||
int dual, side;
|
||||
} mode;
|
||||
} policy;
|
||||
|
||||
// Not User Configurable. Placeholders
|
||||
const char *mod_dir;
|
||||
E_Config_Dialog *cfd;
|
||||
};
|
||||
|
||||
EAPI Eina_List *e_illume_layout_policies_get(void);
|
||||
|
||||
EAPI int e_illume_border_is_dialog(E_Border *bd);
|
||||
EAPI int e_illume_border_is_keyboard(E_Border *bd);
|
||||
EAPI int e_illume_border_is_bottom_panel(E_Border *bd);
|
||||
EAPI int e_illume_border_is_top_shelf(E_Border *bd);
|
||||
EAPI int e_illume_border_is_home(E_Border *bd);
|
||||
EAPI int e_illume_border_is_conformant(E_Border *bd);
|
||||
EAPI int e_illume_border_is_quickpanel(E_Border *bd);
|
||||
EAPI int e_illume_border_is_valid(E_Border *bd);
|
||||
|
||||
EAPI Eina_List *e_illume_border_valid_borders_get(E_Zone *zone);
|
||||
EAPI E_Border *e_illume_border_valid_border_get(E_Zone *zone);
|
||||
EAPI int e_illume_border_valid_count_get(E_Zone *zone);
|
||||
EAPI Eina_List *e_illume_border_quickpanel_borders_get(E_Zone *zone);
|
||||
EAPI int e_illume_border_quickpanel_count_get(E_Zone *zone);
|
||||
|
||||
EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y);
|
||||
EAPI E_Border *e_illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h);
|
||||
EAPI E_Border *e_illume_border_keyboard_get(E_Zone *zone);
|
||||
EAPI E_Border *e_illume_border_top_shelf_get(E_Zone *zone);
|
||||
EAPI E_Border *e_illume_border_bottom_panel_get(E_Zone *zone);
|
||||
|
||||
EAPI void e_illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y);
|
||||
EAPI void e_illume_border_top_shelf_size_get(E_Zone *zone, int *x, int *y);
|
||||
EAPI void e_illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y);
|
||||
EAPI void e_illume_border_bottom_panel_size_get(E_Zone *zone, int *x, int *y);
|
||||
|
||||
EAPI void e_illume_border_slide_to(E_Border *bd, int x, int y, E_Illume_Animation_Class aclass);
|
||||
EAPI void e_illume_border_min_get(E_Border *bd, int *mw, int *mh);
|
||||
EAPI void e_illume_border_max_get(E_Border *bd, int *mw, int *mh);
|
||||
|
||||
EAPI void e_illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_illume_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
||||
|
||||
extern EAPI E_Illume_Config *il_cfg;
|
||||
extern EAPI int E_ILLUME_EVENT_POLICY_CHANGE;
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: e17-illume2
|
||||
Description: Illume2 Module for E17
|
||||
Requires: enlightenment
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir}
|
||||
Libs.private:
|
||||
Cflags: -I${includedir}
|
|
@ -1,62 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in E_Illume.pc
|
||||
MODULE = illume2
|
||||
SUBDIRS = keyboards policies
|
||||
|
||||
# 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_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
|
||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
|
||||
EILLUMEHEADERS = E_Illume.h
|
||||
|
||||
module_la_SOURCES = $(EILLUMEHEADERS) \
|
||||
e_mod_border.c \
|
||||
e_mod_main.h \
|
||||
e_mod_main.c \
|
||||
e_mod_config.h \
|
||||
e_mod_config.c \
|
||||
e_mod_animation.h \
|
||||
e_mod_animation.c \
|
||||
e_kbd.h \
|
||||
e_kbd.c \
|
||||
e_kbd_dbus.h \
|
||||
e_kbd_dbus.c \
|
||||
e_quickpanel.h \
|
||||
e_quickpanel.c \
|
||||
e_mod_layout.h \
|
||||
e_mod_layout.c \
|
||||
e_mod_policy.h \
|
||||
e_mod_policy.c \
|
||||
e_mod_policy_settings.h \
|
||||
e_mod_policy_settings.c \
|
||||
e_mod_windows.h \
|
||||
e_mod_windows.c \
|
||||
e_mod_select_window.h \
|
||||
e_mod_select_window.c
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
installed_headersdir = $(prefix)/include/@PACKAGE@
|
||||
installed_headers_DATA = $(EILLUMEHEADERS)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = E_Illume.pc
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)/policies/
|
|
@ -1,652 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_kbd_dbus.h"
|
||||
|
||||
#define ICONIFY_TO_HIDE 0
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_kbd_cb_free(E_Kbd *kbd);
|
||||
static int _e_kbd_cb_delayed_hide(void *data);
|
||||
static int _e_kbd_cb_animate(void *data);
|
||||
static E_Kbd *_e_kbd_by_border_get(E_Border *bd);
|
||||
static void _e_kbd_layout_send(E_Kbd *kbd);
|
||||
static void _e_kbd_border_show(E_Border *bd);
|
||||
static void _e_kbd_border_hide(E_Border *bd);
|
||||
static void _e_kbd_border_adopt(E_Kbd *kbd, E_Border *bd);
|
||||
static int _e_kbd_border_is_keyboard(E_Border *bd);
|
||||
static void _e_kbd_hide(E_Kbd *kbd);
|
||||
static void _e_kbd_slide(E_Kbd *kbd, int visible, double len);
|
||||
static void _e_kbd_all_show(void);
|
||||
static void _e_kbd_all_hide(void);
|
||||
static void _e_kbd_all_toggle(void);
|
||||
static void _e_kbd_all_layout_set(E_Kbd_Layout layout);
|
||||
|
||||
/* handlers */
|
||||
static int _e_kbd_cb_client_message(void *data, int type, void *event);
|
||||
static int _e_kbd_cb_border_remove(void *data, int type, void *event);
|
||||
static int _e_kbd_cb_border_focus_in(void *data, int type, void *event);
|
||||
static int _e_kbd_cb_border_focus_out(void *data, int type, void *event);
|
||||
static int _e_kbd_cb_border_property(void *data, int type, void *event);
|
||||
|
||||
/* hooks */
|
||||
static void _e_kbd_cb_border_pre_post_fetch(void *data, void *data2);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *kbds = NULL, *handlers = NULL, *hooks = NULL;
|
||||
static E_Border *focused_border = NULL;
|
||||
static Ecore_X_Atom focused_vkbd_state = 0;
|
||||
|
||||
/* public functions */
|
||||
int
|
||||
e_kbd_init(void)
|
||||
{
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_e_kbd_cb_client_message, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
|
||||
_e_kbd_cb_border_remove, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
||||
_e_kbd_cb_border_focus_in, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
|
||||
_e_kbd_cb_border_focus_out, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_PROPERTY,
|
||||
_e_kbd_cb_border_property, NULL));
|
||||
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
|
||||
_e_kbd_cb_border_pre_post_fetch, NULL));
|
||||
|
||||
e_kbd_dbus_init();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_kbd_shutdown(void)
|
||||
{
|
||||
E_Kbd *kbd;
|
||||
Ecore_Event_Handler *handler;
|
||||
E_Border_Hook *hook;
|
||||
|
||||
e_kbd_dbus_shutdown();
|
||||
|
||||
EINA_LIST_FREE(handlers, handler)
|
||||
ecore_event_handler_del(handler);
|
||||
|
||||
EINA_LIST_FREE(hooks, hook)
|
||||
e_border_hook_del(hook);
|
||||
|
||||
EINA_LIST_FREE(kbds, kbd)
|
||||
e_object_del(E_OBJECT(kbd));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
E_Kbd *
|
||||
e_kbd_new(void)
|
||||
{
|
||||
E_Kbd *kbd;
|
||||
|
||||
kbd = E_OBJECT_ALLOC(E_Kbd, E_KBD_TYPE, _e_kbd_cb_free);
|
||||
if (!kbd) return NULL;
|
||||
kbds = eina_list_append(kbds, kbd);
|
||||
kbd->layout = E_KBD_LAYOUT_ALPHA;
|
||||
return kbd;
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_all_enable(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
e_kbd_enable(kbd);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_all_disable(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
e_kbd_disable(kbd);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_show(E_Kbd *kbd)
|
||||
{
|
||||
if (kbd->timer) ecore_timer_del(kbd->timer);
|
||||
kbd->timer = NULL;
|
||||
if ((kbd->visible) || (kbd->disabled)) return;
|
||||
_e_kbd_layout_send(kbd);
|
||||
if (il_cfg->sliding.kbd.duration <= 0)
|
||||
{
|
||||
if (kbd->border)
|
||||
{
|
||||
e_border_fx_offset(kbd->border, 0, 0);
|
||||
_e_kbd_border_show(kbd->border);
|
||||
}
|
||||
kbd->visible = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kbd->border) _e_kbd_border_show(kbd->border);
|
||||
_e_kbd_slide(kbd, 1, (double)il_cfg->sliding.kbd.duration / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_hide(E_Kbd *kbd)
|
||||
{
|
||||
if (!kbd->visible) return;
|
||||
if (!kbd->timer)
|
||||
kbd->timer = ecore_timer_add(0.2, _e_kbd_cb_delayed_hide, kbd);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_enable(E_Kbd *kbd)
|
||||
{
|
||||
if (!kbd->disabled) return;
|
||||
kbd->disabled = 0;
|
||||
if (!kbd->visible) e_kbd_show(kbd);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_disable(E_Kbd *kbd)
|
||||
{
|
||||
if (kbd->disabled) return;
|
||||
if (kbd->visible) e_kbd_hide(kbd);
|
||||
kbd->disabled = 1;
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_layout_set(E_Kbd *kbd, E_Kbd_Layout layout)
|
||||
{
|
||||
kbd->layout = layout;
|
||||
_e_kbd_layout_send(kbd);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_fullscreen_set(E_Zone *zone, int fullscreen)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
if ((!!fullscreen) != kbd->fullscreen)
|
||||
{
|
||||
kbd->fullscreen = fullscreen;
|
||||
if (kbd->fullscreen)
|
||||
e_border_layer_set(kbd->border, 250);
|
||||
else
|
||||
e_border_layer_set(kbd->border, 100);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
if (x) *x = zone->x;
|
||||
if (y) *y = zone->y;
|
||||
if (w) *w = zone->w;
|
||||
if (h) *h = zone->h;
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
{
|
||||
if (!kbd->border) continue;
|
||||
if (kbd->border->zone != zone) continue;
|
||||
if ((kbd->visible) && (!kbd->animator) && (!kbd->disabled))
|
||||
{
|
||||
if (h)
|
||||
{
|
||||
*h -= kbd->border->h;
|
||||
if (*h < 0) *h = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_kbd_cb_free(E_Kbd *kbd)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (kbd->animator) ecore_animator_del(kbd->animator);
|
||||
kbd->animator = NULL;
|
||||
if (kbd->timer) ecore_timer_del(kbd->timer);
|
||||
kbd->timer = NULL;
|
||||
EINA_LIST_FREE(kbd->waiting_borders, bd)
|
||||
bd->stolen = 0;
|
||||
E_FREE(kbd);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_delayed_hide(void *data)
|
||||
{
|
||||
E_Kbd *kbd;
|
||||
|
||||
if (!(kbd = data)) return 0;
|
||||
_e_kbd_hide(kbd);
|
||||
kbd->timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_animate(void *data)
|
||||
{
|
||||
E_Kbd *kbd;
|
||||
double t, v;
|
||||
|
||||
kbd = data;
|
||||
t = ecore_loop_time_get() - kbd->start;
|
||||
if (t > kbd->len) t = kbd->len;
|
||||
if (kbd->len > 0.0)
|
||||
{
|
||||
v = t / kbd->len;
|
||||
v = 1.0 - v;
|
||||
v = v * v * v * v;
|
||||
v = 1.0 - v;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = kbd->len;
|
||||
v = 1.0;
|
||||
}
|
||||
kbd->adjust = (kbd->adjust_end * v) + (kbd->adjust_start * (1.0 - v));
|
||||
if (kbd->border)
|
||||
e_border_fx_offset(kbd->border, 0, kbd->border->h - kbd->adjust);
|
||||
if (t == kbd->len)
|
||||
{
|
||||
kbd->animator = NULL;
|
||||
if (kbd->visible)
|
||||
{
|
||||
_e_kbd_border_hide(kbd->border);
|
||||
kbd->visible = 0;
|
||||
}
|
||||
else
|
||||
kbd->visible = 1;
|
||||
_e_kbd_layout_send(kbd);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static E_Kbd *
|
||||
_e_kbd_by_border_get(E_Border *bd)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
E_Border *over;
|
||||
E_Kbd *kbd;
|
||||
|
||||
if (!bd->stolen) return NULL;
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
{
|
||||
if (kbd->border == bd) return kbd;
|
||||
EINA_LIST_FOREACH(kbd->waiting_borders, ll, over)
|
||||
if (over == bd) return kbd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_layout_send(E_Kbd *kbd)
|
||||
{
|
||||
Ecore_X_Virtual_Keyboard_State type;
|
||||
|
||||
if ((kbd->visible) && (!kbd->disabled))
|
||||
{
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
|
||||
if (kbd->layout == E_KBD_LAYOUT_DEFAULT)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_ALPHA)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_NUMERIC)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_PIN)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_PHONE_NUMBER)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_HEX)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_TERMINAL)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_PASSWORD)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
|
||||
else if (kbd->layout == E_KBD_LAYOUT_NONE)
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
|
||||
}
|
||||
else
|
||||
type = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
|
||||
if (kbd->border)
|
||||
ecore_x_e_virtual_keyboard_state_send(kbd->border->client.win, type);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_border_show(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
e_border_uniconify(bd);
|
||||
e_border_show(bd);
|
||||
e_border_raise(bd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_border_hide(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
#ifdef ICONIFY_TO_HIDE
|
||||
e_border_iconify(bd);
|
||||
#else
|
||||
e_border_hide(bd, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_border_adopt(E_Kbd *kbd, E_Border *bd)
|
||||
{
|
||||
kbd->border = bd;
|
||||
bd->sticky = 1;
|
||||
if (kbd->fullscreen)
|
||||
e_border_layer_set(kbd->border, 250);
|
||||
else
|
||||
e_border_layer_set(kbd->border, 100);
|
||||
if (!kbd->visible)
|
||||
{
|
||||
e_border_fx_offset(kbd->border, 0, kbd->border->h);
|
||||
_e_kbd_layout_send(kbd);
|
||||
}
|
||||
kbd->h = kbd->border->h;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_border_is_keyboard(E_Border *bd)
|
||||
{
|
||||
if ((bd->client.vkbd.vkbd) || /* explicit hint that its a virtual keyboard */
|
||||
/* legacy */
|
||||
( /* trap the matchbox qwerty and multitap kbd's */
|
||||
(((bd->client.icccm.title) && (!strcmp(bd->client.icccm.title, "Keyboard"))) ||
|
||||
((bd->client.icccm.name) && ((!strcmp(bd->client.icccm.name, "multitap-pad")))))
|
||||
&& (bd->client.netwm.state.skip_taskbar)
|
||||
&& (bd->client.netwm.state.skip_pager)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_hide(E_Kbd *kbd)
|
||||
{
|
||||
if (kbd->timer) ecore_timer_del(kbd->timer);
|
||||
kbd->timer = NULL;
|
||||
if ((!kbd->visible) || (kbd->disabled)) return;
|
||||
_e_kbd_layout_send(kbd);
|
||||
if (il_cfg->sliding.kbd.duration <= 0)
|
||||
{
|
||||
if (kbd->border)
|
||||
{
|
||||
e_border_fx_offset(kbd->border, 0, kbd->border->h);
|
||||
_e_kbd_border_hide(kbd->border);
|
||||
}
|
||||
kbd->visible = 0;
|
||||
}
|
||||
else
|
||||
_e_kbd_slide(kbd, 0, (double)il_cfg->sliding.kbd.duration / 1000.0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_slide(E_Kbd *kbd, int visible, double len)
|
||||
{
|
||||
kbd->start = ecore_loop_time_get();
|
||||
kbd->len = len;
|
||||
kbd->adjust_start = kbd->adjust;
|
||||
kbd->adjust_end = 0;
|
||||
if ((visible) && (kbd->border))
|
||||
kbd->adjust_end = kbd->border->h;
|
||||
if (!kbd->animator)
|
||||
kbd->animator = ecore_animator_add(_e_kbd_cb_animate, kbd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_all_show(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
e_kbd_show(kbd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_all_hide(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
e_kbd_hide(kbd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_all_toggle(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
{
|
||||
if (kbd->visible) e_kbd_hide(kbd);
|
||||
else e_kbd_show(kbd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_all_layout_set(E_Kbd_Layout layout)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
e_kbd_layout_set(kbd, layout);
|
||||
}
|
||||
|
||||
/* handlers */
|
||||
static int
|
||||
_e_kbd_cb_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->win != ecore_x_window_root_first_get()) return 1;
|
||||
if ((ev->message_type == ecore_x_atom_get("_MB_IM_INVOKER_COMMAND")) ||
|
||||
(ev->message_type == ecore_x_atom_get("_MTP_IM_INVOKER_COMMAND")))
|
||||
{
|
||||
if (ev->data.l[0] == 1) _e_kbd_all_show();
|
||||
else if (ev->data.l[0] == 2) _e_kbd_all_hide();
|
||||
else if (ev->data.l[0] == 3) _e_kbd_all_toggle();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_border_remove(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
E_Kbd *kbd;
|
||||
|
||||
ev = event;
|
||||
if (ev->border == focused_border)
|
||||
{
|
||||
focused_border = NULL;
|
||||
focused_vkbd_state = 0;
|
||||
return 1;
|
||||
}
|
||||
if (!(kbd = _e_kbd_by_border_get(ev->border))) return 1;
|
||||
if (kbd->border == ev->border)
|
||||
{
|
||||
kbd->border = NULL;
|
||||
if (kbd->waiting_borders)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = kbd->waiting_borders->data;
|
||||
kbd->waiting_borders =
|
||||
eina_list_remove_list(kbd->waiting_borders, kbd->waiting_borders);
|
||||
_e_kbd_border_adopt(kbd, bd);
|
||||
}
|
||||
if (kbd->visible)
|
||||
{
|
||||
_e_kbd_border_hide(ev->border);
|
||||
e_kbd_hide(kbd);
|
||||
}
|
||||
}
|
||||
else
|
||||
kbd->waiting_borders = eina_list_remove(kbd->waiting_borders, ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_border_focus_in(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_In *ev;
|
||||
|
||||
ev = event;
|
||||
if (_e_kbd_by_border_get(ev->border)) return 1;
|
||||
focused_border = ev->border;
|
||||
focused_vkbd_state = ev->border->client.vkbd.state;
|
||||
if (focused_vkbd_state == 0) return 1;
|
||||
if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
{
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NONE);
|
||||
_e_kbd_all_hide();
|
||||
return 1;
|
||||
}
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PASSWORD);
|
||||
else
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_DEFAULT);
|
||||
_e_kbd_all_show();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_border_focus_out(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_Out *ev;
|
||||
|
||||
ev = event;
|
||||
if (_e_kbd_by_border_get(ev->border)) return 1;
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NONE);
|
||||
_e_kbd_all_hide();
|
||||
focused_border = NULL;
|
||||
focused_vkbd_state = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_cb_border_property(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Property *ev;
|
||||
|
||||
ev = event;
|
||||
if (_e_kbd_by_border_get(ev->border)) return 1;
|
||||
if (!ev->border->focused) return 1;
|
||||
if ((ev->border == focused_border) &&
|
||||
(ev->border->client.vkbd.state == focused_vkbd_state)) return 1;
|
||||
focused_vkbd_state = ev->border->client.vkbd.state;
|
||||
if ((ev->border->need_fullscreen) || (ev->border->fullscreen))
|
||||
e_kbd_fullscreen_set(ev->border->zone, 1);
|
||||
else
|
||||
e_kbd_fullscreen_set(ev->border->zone, 0);
|
||||
if (ev->border->client.vkbd.state == 0) return 1;
|
||||
/* app wants kbd off - then kbd off it is */
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
_e_kbd_all_hide();
|
||||
/* app wants something else than off... */
|
||||
else
|
||||
{
|
||||
if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
|
||||
else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PASSWORD);
|
||||
else
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_DEFAULT);
|
||||
_e_kbd_all_show();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* hooks */
|
||||
static void
|
||||
_e_kbd_cb_border_pre_post_fetch(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if (!bd->new_client) return;
|
||||
if (_e_kbd_by_border_get(bd)) return;
|
||||
if (_e_kbd_border_is_keyboard(bd))
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd *kbd;
|
||||
|
||||
EINA_LIST_FOREACH(kbds, l, kbd)
|
||||
{
|
||||
if (!kbd->border)
|
||||
_e_kbd_border_adopt(kbd, bd);
|
||||
else
|
||||
kbd->waiting_borders = eina_list_append(kbd->waiting_borders, bd);
|
||||
bd->stolen = 1;
|
||||
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;
|
||||
}
|
||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
||||
bd->client.border.changed = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
#ifndef E_KBD_H
|
||||
#define E_KBD_H
|
||||
|
||||
#define E_KBD_TYPE 0xE1b0988
|
||||
|
||||
typedef enum _E_Kbd_Layout E_Kbd_Layout;
|
||||
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_IP,
|
||||
E_KBD_LAYOUT_HOST,
|
||||
E_KBD_LAYOUT_FILE,
|
||||
E_KBD_LAYOUT_URL,
|
||||
E_KBD_LAYOUT_KEYPAD,
|
||||
E_KBD_LAYOUT_J2ME
|
||||
};
|
||||
|
||||
typedef struct _E_Kbd E_Kbd;
|
||||
struct _E_Kbd
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Border *border;
|
||||
Ecore_Timer *timer;
|
||||
Ecore_Animator *animator;
|
||||
E_Kbd_Layout layout;
|
||||
Eina_List *waiting_borders;
|
||||
|
||||
double start, len;
|
||||
int h, adjust, adjust_start, adjust_end;
|
||||
unsigned char visible : 1;
|
||||
unsigned char disabled : 1;
|
||||
unsigned char fullscreen : 1;
|
||||
};
|
||||
|
||||
int e_kbd_init(void);
|
||||
int e_kbd_shutdown(void);
|
||||
|
||||
E_Kbd *e_kbd_new(void);
|
||||
void e_kbd_all_enable(void);
|
||||
void e_kbd_all_disable(void);
|
||||
void e_kbd_show(E_Kbd *kbd);
|
||||
void e_kbd_hide(E_Kbd *kbd);
|
||||
void e_kbd_enable(E_Kbd *kbd);
|
||||
void e_kbd_disable(E_Kbd *kbd);
|
||||
void e_kbd_layout_set(E_Kbd *kbd, E_Kbd_Layout layout);
|
||||
void e_kbd_fullscreen_set(E_Zone *zone, int fullscreen);
|
||||
|
||||
#endif
|
|
@ -1,269 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_kbd_dbus.h"
|
||||
|
||||
/* local variables */
|
||||
static int have_real_kbd = 0;
|
||||
static E_DBus_Connection *dbus_conn = NULL;
|
||||
static E_DBus_Signal_Handler *dbus_dev_add = NULL;
|
||||
static E_DBus_Signal_Handler *dbus_dev_del = NULL;
|
||||
static E_DBus_Signal_Handler *dbus_dev_chg = NULL;
|
||||
static Eina_List *dbus_kbds = NULL, *ignore_kbds = NULL;
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_kbd_dbus_cb_input_kbd(void *data, void *reply, DBusError *err);
|
||||
static void _e_kbd_dbus_cb_input_kbd_is(void *data, void *reply, DBusError *err);
|
||||
static void _e_kbd_dbus_ignore_kbds_load(void);
|
||||
static void _e_kbd_dbus_ignore_kbds_file_load(const char *file);
|
||||
static void _e_kbd_dbus_kbd_add(const char *udi);
|
||||
static void _e_kbd_dbus_kbd_del(const char *udi);
|
||||
static void _e_kbd_dbus_kbd_eval(void);
|
||||
static void _e_kbd_dbus_dev_add(void *data, DBusMessage *msg);
|
||||
static void _e_kbd_dbus_dev_del(void *data, DBusMessage *msg);
|
||||
static void _e_kbd_dbus_dev_chg(void *data, DBusMessage *msg);
|
||||
|
||||
/* public functions */
|
||||
void
|
||||
e_kbd_dbus_init(void)
|
||||
{
|
||||
/* load the 'ignore' keyboard files */
|
||||
_e_kbd_dbus_ignore_kbds_load();
|
||||
|
||||
/* attempt to connect to the system dbus */
|
||||
if (!(dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM))) return;
|
||||
|
||||
/* ask HAL for any input keyboards */
|
||||
e_hal_manager_find_device_by_capability(dbus_conn, "input.keyboard",
|
||||
_e_kbd_dbus_cb_input_kbd, NULL);
|
||||
|
||||
/* setup dbus signal handlers for when a device gets added/removed/changed */
|
||||
dbus_dev_add =
|
||||
e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
|
||||
"/org/freedesktop/Hal/Manager",
|
||||
"org.freedesktop.Hal.Manager",
|
||||
"DeviceAdded", _e_kbd_dbus_dev_add, NULL);
|
||||
dbus_dev_del =
|
||||
e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
|
||||
"/org/freedesktop/Hal/Manager",
|
||||
"org.freedesktop.Hal.Manager",
|
||||
"DeviceRemoved", _e_kbd_dbus_dev_del, NULL);
|
||||
dbus_dev_chg =
|
||||
e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
|
||||
"/org/freedesktop/Hal/Manager",
|
||||
"org.freedesktop.Hal.Manager",
|
||||
"NewCapability", _e_kbd_dbus_dev_chg, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
e_kbd_dbus_shutdown(void)
|
||||
{
|
||||
char *str;
|
||||
|
||||
/* remove the dbus signal handlers if we can */
|
||||
if (dbus_conn)
|
||||
{
|
||||
e_dbus_signal_handler_del(dbus_conn, dbus_dev_add);
|
||||
e_dbus_signal_handler_del(dbus_conn, dbus_dev_del);
|
||||
e_dbus_signal_handler_del(dbus_conn, dbus_dev_chg);
|
||||
}
|
||||
|
||||
/* free the list of ignored keyboards */
|
||||
EINA_LIST_FREE(ignore_kbds, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
/* free the list of keyboards */
|
||||
EINA_LIST_FREE(dbus_kbds, str)
|
||||
eina_stringshare_del(str);
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_kbd_dbus_cb_input_kbd(void *data, void *reply, DBusError *err)
|
||||
{
|
||||
E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply;
|
||||
Eina_List *l;
|
||||
char *dev;
|
||||
|
||||
if ((!ret) || (!ret->strings)) return;
|
||||
|
||||
/* if dbus errored then cleanup and get out */
|
||||
if (dbus_error_is_set(err))
|
||||
{
|
||||
dbus_error_free(err);
|
||||
return;
|
||||
}
|
||||
|
||||
/* for each returned keyboard, add it and evaluate it */
|
||||
EINA_LIST_FOREACH(ret->strings, l, dev)
|
||||
{
|
||||
_e_kbd_dbus_kbd_add(dev);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_cb_input_kbd_is(void *data, void *reply, DBusError *err)
|
||||
{
|
||||
E_Hal_Device_Query_Capability_Return *ret = reply;
|
||||
char *udi = data;
|
||||
|
||||
/* if dbus errored then cleanup and get out */
|
||||
if (dbus_error_is_set(err))
|
||||
{
|
||||
dbus_error_free(err);
|
||||
if (udi) free(udi);
|
||||
return;
|
||||
}
|
||||
|
||||
/* if it's an input keyboard, than add it and eval */
|
||||
if ((ret) && (ret->boolean))
|
||||
{
|
||||
_e_kbd_dbus_kbd_add(udi);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_ignore_kbds_load(void)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
/* load the 'ignore' file from the user's home dir */
|
||||
e_user_dir_concat_static(buff, "keyboards/ignore_built_in_keyboards");
|
||||
_e_kbd_dbus_ignore_kbds_file_load(buff);
|
||||
|
||||
/* load the 'ignore' file from the system/module dir */
|
||||
snprintf(buff, sizeof(buff),
|
||||
"%s/keyboards/ignore_built_in_keyboards", il_cfg->mod_dir);
|
||||
_e_kbd_dbus_ignore_kbds_file_load(buff);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_ignore_kbds_file_load(const char *file)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
FILE *f;
|
||||
|
||||
/* can this file be opened */
|
||||
if (!(f = fopen(file, "r"))) return;
|
||||
|
||||
/* parse out the info in the ignore file */
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
char *p;
|
||||
int len;
|
||||
|
||||
if (buf[0] == '#') continue;
|
||||
len = strlen(buf);
|
||||
if (len > 0)
|
||||
{
|
||||
if (buf[len - 1] == '\n') buf[len - 1] = 0;
|
||||
}
|
||||
p = buf;
|
||||
while (isspace(*p)) p++;
|
||||
|
||||
/* append this kbd to the ignore list */
|
||||
if (*p)
|
||||
ignore_kbds = eina_list_append(ignore_kbds, eina_stringshare_add(p));
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_kbd_add(const char *udi)
|
||||
{
|
||||
const char *str;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(dbus_kbds, l, str)
|
||||
if (!strcmp(str, udi)) return;
|
||||
dbus_kbds = eina_list_append(dbus_kbds, eina_stringshare_add(udi));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_kbd_del(const char *udi)
|
||||
{
|
||||
const char *str;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(dbus_kbds, l, str)
|
||||
if (!strcmp(str, udi))
|
||||
{
|
||||
eina_stringshare_del(str);
|
||||
dbus_kbds = eina_list_remove_list(dbus_kbds, l);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_kbd_eval(void)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
const char *g, *gg;
|
||||
int have_real = 0;
|
||||
|
||||
have_real = eina_list_count(dbus_kbds);
|
||||
EINA_LIST_FOREACH(dbus_kbds, l, g)
|
||||
EINA_LIST_FOREACH(ignore_kbds, ll, gg)
|
||||
if (e_util_glob_match(g, gg))
|
||||
{
|
||||
have_real--;
|
||||
break;
|
||||
}
|
||||
if (have_real != have_real_kbd)
|
||||
{
|
||||
have_real_kbd = have_real;
|
||||
#if 0
|
||||
if (have_real_kbd) e_kbd_all_disable();
|
||||
else
|
||||
#endif
|
||||
e_kbd_all_enable();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_dev_add(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
char *udi;
|
||||
int ret;
|
||||
|
||||
dbus_error_init(&err);
|
||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
||||
ret = e_hal_device_query_capability(dbus_conn, udi, "input.keyboard",
|
||||
_e_kbd_dbus_cb_input_kbd_is, udi);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_dev_del(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
char *udi;
|
||||
|
||||
dbus_error_init(&err);
|
||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
||||
if (udi)
|
||||
{
|
||||
_e_kbd_dbus_kbd_del(udi);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
free(udi);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dbus_dev_chg(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
char *udi, *cap;
|
||||
|
||||
dbus_error_init(&err);
|
||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi,
|
||||
DBUS_TYPE_STRING, &cap, DBUS_TYPE_INVALID);
|
||||
if (!strcmp(cap, "input.keyboard"))
|
||||
{
|
||||
_e_kbd_dbus_kbd_add(udi);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
}
|
||||
if (cap) free(cap);
|
||||
if (udi) free(udi);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef E_KBD_DBUS_H
|
||||
#define E_KBD_DBUS_H
|
||||
|
||||
void e_kbd_dbus_init(void);
|
||||
void e_kbd_dbus_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -1,121 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_animation.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_config_animation_create(E_Config_Dialog *cfd);
|
||||
static void _il_config_animation_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_config_animation_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_config_animation_change(void *data, Evas_Object *obj, void *event);
|
||||
static int _il_config_animation_change_timeout(void *data);
|
||||
|
||||
/* local variables */
|
||||
Ecore_Timer *_anim_change_timer = NULL;
|
||||
|
||||
/* public functions */
|
||||
void
|
||||
il_config_animation_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_animation_settings")) return;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_config_animation_create;
|
||||
v->free_cfdata = _il_config_animation_free;
|
||||
v->basic.create_widgets = _il_config_animation_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
cfd = e_config_dialog_new(con, _("Animation Settings"), "E",
|
||||
"_config_illume_animation_settings",
|
||||
"enlightenment/animation_settings", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void *
|
||||
_il_config_animation_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_animation_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_config_animation_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *ow;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Keyboard"), 0);
|
||||
rg = e_widget_radio_group_new(&(il_cfg->sliding.kbd.duration));
|
||||
ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Off"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Quickpanel"), 0);
|
||||
rg = e_widget_radio_group_new(&(il_cfg->sliding.quickpanel.duration));
|
||||
ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Off"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_animation_change, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_animation_change(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
|
||||
_anim_change_timer =
|
||||
ecore_timer_add(0.5, _il_config_animation_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_animation_change_timeout(void *data)
|
||||
{
|
||||
e_config_save_queue();
|
||||
_anim_change_timer = NULL;
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef E_MOD_ANIM_H
|
||||
#define E_MOD_ANIM_H
|
||||
|
||||
void il_config_animation_show(E_Container *con, const char *params);
|
||||
|
||||
#endif
|
|
@ -1,476 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_kbd.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// :: Convenience routines to make it easy to write layout logic code ::
|
||||
|
||||
// activate a window - meant for main app and home app windows
|
||||
void
|
||||
e_illume_border_activate(E_Border *bd)
|
||||
{
|
||||
e_desk_show(bd->desk);
|
||||
e_border_uniconify(bd);
|
||||
e_border_raise(bd);
|
||||
e_border_show(bd);
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
}
|
||||
|
||||
// activate a window that isnt meant to get the focus - like panels, kbd etc.
|
||||
void
|
||||
e_illume_border_show(E_Border *bd)
|
||||
{
|
||||
e_desk_show(bd->desk);
|
||||
e_border_uniconify(bd);
|
||||
e_border_raise(bd);
|
||||
e_border_show(bd);
|
||||
}
|
||||
|
||||
// get a window away from being visile (but maintain it)
|
||||
void
|
||||
e_illume_border_deactivate(E_Border *bd)
|
||||
{
|
||||
e_border_iconify(bd);
|
||||
}
|
||||
|
||||
// get window info - is this one a dialog?
|
||||
EAPI int
|
||||
e_illume_border_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;
|
||||
}
|
||||
|
||||
// get window info - is this a vkbd window
|
||||
EAPI int
|
||||
e_illume_border_is_keyboard(E_Border *bd)
|
||||
{
|
||||
if (bd->client.vkbd.vkbd) return 1;
|
||||
if (il_cfg->policy.vkbd.match.title)
|
||||
{
|
||||
if ((bd->client.icccm.title) &&
|
||||
(!strcmp(bd->client.icccm.title, il_cfg->policy.vkbd.title)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.vkbd.match.name)
|
||||
{
|
||||
if ((bd->client.icccm.name) &&
|
||||
(!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.vkbd.match.class)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
|
||||
return 1;
|
||||
}
|
||||
if ((bd->client.icccm.name) &&
|
||||
((!strcmp(bd->client.icccm.name, "multitap-pad")))
|
||||
&& (bd->client.netwm.state.skip_taskbar)
|
||||
&& (bd->client.netwm.state.skip_pager))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get window info - is it a bottom app panel window (eg qtopia softmenu)
|
||||
EAPI int
|
||||
e_illume_border_is_bottom_panel(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.softkey.match.title)
|
||||
{
|
||||
if ((bd->client.icccm.title) &&
|
||||
(!strcmp(bd->client.icccm.title, il_cfg->policy.softkey.title)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.softkey.match.name)
|
||||
{
|
||||
if ((bd->client.icccm.name) &&
|
||||
(!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.softkey.match.class)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
|
||||
return 1;
|
||||
}
|
||||
if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
|
||||
(bd->client.qtopia.soft_menu)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get window info - is it a top shelf window
|
||||
EAPI int
|
||||
e_illume_border_is_top_shelf(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.indicator.match.title)
|
||||
{
|
||||
if ((bd->client.icccm.title) &&
|
||||
(!strcmp(bd->client.icccm.title, il_cfg->policy.indicator.title)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.indicator.match.name)
|
||||
{
|
||||
if ((bd->client.icccm.name) &&
|
||||
(!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.indicator.match.class)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get window info - is it a home window
|
||||
EAPI int
|
||||
e_illume_border_is_home(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.home.match.title)
|
||||
{
|
||||
if ((bd->client.icccm.title) &&
|
||||
(!strcmp(bd->client.icccm.title, il_cfg->policy.home.title)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.home.match.name)
|
||||
{
|
||||
if ((bd->client.icccm.name) &&
|
||||
(!strcmp(bd->client.icccm.name, il_cfg->policy.home.name)))
|
||||
return 1;
|
||||
}
|
||||
if (il_cfg->policy.home.match.class)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(!strcmp(bd->client.icccm.class, il_cfg->policy.home.class)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_conformant(E_Border *bd)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(strstr(bd->client.icccm.class, "config"))) return EINA_FALSE;
|
||||
return bd->client.illume.conformant.conformant;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_quickpanel(E_Border *bd)
|
||||
{
|
||||
if ((bd->client.icccm.class) &&
|
||||
(strstr(bd->client.icccm.class, "config"))) return EINA_FALSE;
|
||||
return bd->client.illume.quickpanel.quickpanel;
|
||||
// return ecore_x_e_illume_quickpanel_get(bd->client.win);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_valid(E_Border *bd)
|
||||
{
|
||||
if (!bd) return EINA_FALSE;
|
||||
if (e_illume_border_is_dialog(bd)) return EINA_FALSE;
|
||||
if (e_illume_border_is_keyboard(bd)) return EINA_FALSE;
|
||||
if (e_illume_border_is_bottom_panel(bd)) return EINA_FALSE;
|
||||
if (e_illume_border_is_top_shelf(bd)) return EINA_FALSE;
|
||||
if (e_illume_border_is_quickpanel(bd)) return EINA_FALSE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_illume_border_valid_borders_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l, *ret = NULL;
|
||||
E_Border *bd;
|
||||
|
||||
bds = e_border_client_list();
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (!bd) continue;
|
||||
if (bd->zone != zone) continue;
|
||||
if (e_illume_border_is_top_shelf(bd)) continue;
|
||||
if (e_illume_border_is_bottom_panel(bd)) continue;
|
||||
if (e_illume_border_is_keyboard(bd)) continue;
|
||||
if (e_illume_border_is_dialog(bd)) continue;
|
||||
if (e_illume_border_is_quickpanel(bd)) continue;
|
||||
ret = eina_list_append(ret, bd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_valid_border_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd, *ret = NULL;
|
||||
|
||||
bds = e_border_client_list();
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (!bd) continue;
|
||||
if (bd->zone != zone) continue;
|
||||
if (e_illume_border_is_top_shelf(bd)) continue;
|
||||
if (e_illume_border_is_bottom_panel(bd)) continue;
|
||||
if (e_illume_border_is_keyboard(bd)) continue;
|
||||
if (e_illume_border_is_dialog(bd)) continue;
|
||||
if (e_illume_border_is_quickpanel(bd)) continue;
|
||||
ret = bd;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_valid_count_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *l;
|
||||
int count;
|
||||
|
||||
l = e_illume_border_valid_borders_get(zone);
|
||||
count = eina_list_count(l);
|
||||
eina_list_free(l);
|
||||
return count;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_illume_border_quickpanel_borders_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l, *ret = NULL;
|
||||
E_Border *bd;
|
||||
|
||||
bds = e_border_client_list();
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (!bd) continue;
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_quickpanel(bd)) continue;
|
||||
ret = eina_list_append(ret, bd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_quickpanel_count_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *l;
|
||||
int count;
|
||||
|
||||
l = e_illume_border_quickpanel_borders_get(zone);
|
||||
count = eina_list_count(l);
|
||||
eina_list_free(l);
|
||||
return count;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_at_xy_get(E_Zone *zone, int x, int y)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd, *b = NULL;
|
||||
|
||||
bds = e_illume_border_valid_borders_get(zone);
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (((bd->fx.x == x) && (bd->fx.y == y)) ||
|
||||
((bd->x == x) && (bd->y == y)))
|
||||
{
|
||||
b = bd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
eina_list_free(bds);
|
||||
return b;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd, *b = NULL;
|
||||
|
||||
bds = e_illume_border_valid_borders_get(zone);
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (E_INSIDE(bd->x, bd->fx.y, x, y, w, h))
|
||||
{
|
||||
b = bd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
eina_list_free(bds);
|
||||
return b;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_top_shelf_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd, *b = NULL;
|
||||
|
||||
bds = e_border_client_list();
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_top_shelf(bd)) continue;
|
||||
b = bd;
|
||||
break;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_bottom_panel_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd, *b = NULL;
|
||||
|
||||
bds = e_border_client_list();
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_bottom_panel(bd)) continue;
|
||||
b = bd;
|
||||
break;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = e_illume_border_top_shelf_get(zone))) return;
|
||||
if (x) *x = bd->x;
|
||||
if (y) *y = bd->y;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_top_shelf_size_get(E_Zone *zone, int *w, int *h)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = e_illume_border_top_shelf_get(zone))) return;
|
||||
if (w) *w = bd->w;
|
||||
if (h) *h = bd->h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = e_illume_border_bottom_panel_get(zone))) return;
|
||||
if (x) *x = bd->x;
|
||||
if (y) *y = bd->y;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = e_illume_border_bottom_panel_get(zone))) return;
|
||||
if (w) *w = bd->w;
|
||||
if (h) *h = bd->h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_slide_to(E_Border *bd, int x, int y, E_Illume_Animation_Class aclass)
|
||||
{
|
||||
// FIXME: do
|
||||
// 1. if an existing slide exists, use is current offset x,y as current border pos, new x,y as new pos and start slide again
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_min_get(E_Border *bd, int *mw, int *mh)
|
||||
{
|
||||
if (mw)
|
||||
{
|
||||
if (bd->client.icccm.base_w > bd->client.icccm.min_w)
|
||||
*mw = bd->client.icccm.base_w;
|
||||
else
|
||||
*mw = bd->client.icccm.min_w;
|
||||
}
|
||||
if (mh)
|
||||
{
|
||||
if (bd->client.icccm.base_h > bd->client.icccm.min_h)
|
||||
*mh = bd->client.icccm.base_h;
|
||||
else
|
||||
*mh = bd->client.icccm.min_h;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_max_get(E_Border *bd, int *mw, int *mh)
|
||||
{
|
||||
if (mw)
|
||||
{
|
||||
if (bd->client.icccm.base_w > bd->client.icccm.max_w)
|
||||
*mw = bd->client.icccm.base_w;
|
||||
else
|
||||
*mw = bd->client.icccm.max_w;
|
||||
}
|
||||
if (mh)
|
||||
{
|
||||
if (bd->client.icccm.base_h > bd->client.icccm.max_h)
|
||||
*mh = bd->client.icccm.base_h;
|
||||
else
|
||||
*mh = bd->client.icccm.max_h;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
int ty, nx, ny, nw, nh;
|
||||
|
||||
if (!zone) return;
|
||||
e_illume_kbd_safe_app_region_get(zone, &nx, &ny, &nw, &nh);
|
||||
e_illume_border_top_shelf_pos_get(zone, NULL, &ty);
|
||||
if (nh >= zone->h) nh = (ny + ty);
|
||||
if (x) *x = nx;
|
||||
if (y) *y = ny;
|
||||
if (w) *w = nw;
|
||||
if (h) *h = nh;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
int ty, th, bh;
|
||||
int nx, ny, nw, nh;
|
||||
|
||||
if (!zone) return;
|
||||
e_illume_kbd_safe_app_region_get(zone, &nx, NULL, &nw, &nh);
|
||||
e_illume_border_top_shelf_pos_get(zone, NULL, &ty);
|
||||
e_illume_border_top_shelf_size_get(zone, NULL, &th);
|
||||
e_illume_border_bottom_panel_size_get(zone, NULL, &bh);
|
||||
ny = (ty + th);
|
||||
nh = (nh - ny - bh);
|
||||
if (x) *x = nx;
|
||||
if (y) *y = ny;
|
||||
if (w) *w = nw;
|
||||
if (h) *h = nh;
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
//#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_animation.h"
|
||||
#include "e_mod_policy.h"
|
||||
#include "e_mod_policy_settings.h"
|
||||
#include "e_mod_windows.h"
|
||||
|
||||
/* local variables */
|
||||
EAPI E_Illume_Config *il_cfg = NULL;
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
|
||||
/* public functions */
|
||||
int
|
||||
e_mod_config_init(E_Module *m)
|
||||
{
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume_Cfg", E_Illume_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T E_Illume_Config
|
||||
#define D conf_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
E_CONFIG_VAL(D, T, sliding.kbd.duration, INT);
|
||||
E_CONFIG_VAL(D, T, sliding.softkey.duration, INT);
|
||||
E_CONFIG_VAL(D, T, sliding.quickpanel.duration, INT);
|
||||
E_CONFIG_VAL(D, T, policy.name, STR);
|
||||
E_CONFIG_VAL(D, T, policy.mode.dual, INT);
|
||||
E_CONFIG_VAL(D, T, policy.mode.side, INT);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.class, STR);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.name, STR);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.title, STR);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.match.class, INT);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.match.name, INT);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.match.title, INT);
|
||||
E_CONFIG_VAL(D, T, policy.vkbd.match.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.class, STR);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.name, STR);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.title, STR);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.match.class, INT);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.match.name, INT);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.match.title, INT);
|
||||
E_CONFIG_VAL(D, T, policy.softkey.match.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.home.class, STR);
|
||||
E_CONFIG_VAL(D, T, policy.home.name, STR);
|
||||
E_CONFIG_VAL(D, T, policy.home.title, STR);
|
||||
E_CONFIG_VAL(D, T, policy.home.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.home.match.class, INT);
|
||||
E_CONFIG_VAL(D, T, policy.home.match.name, INT);
|
||||
E_CONFIG_VAL(D, T, policy.home.match.title, INT);
|
||||
E_CONFIG_VAL(D, T, policy.home.match.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.class, STR);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.name, STR);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.title, STR);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.win_type, INT);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.match.class, INT);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.match.name, INT);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.match.title, INT);
|
||||
E_CONFIG_VAL(D, T, policy.indicator.match.win_type, INT);
|
||||
|
||||
il_cfg = e_config_domain_load("module.illume2", conf_edd);
|
||||
if ((il_cfg) &&
|
||||
((il_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
{
|
||||
E_FREE(il_cfg);
|
||||
il_cfg = NULL;
|
||||
}
|
||||
if (!il_cfg)
|
||||
{
|
||||
il_cfg = E_NEW(E_Illume_Config, 1);
|
||||
il_cfg->version = 0;
|
||||
il_cfg->sliding.kbd.duration = 1000;
|
||||
il_cfg->sliding.softkey.duration = 1000;
|
||||
}
|
||||
if (il_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
if ((il_cfg->version & 0xffff) < 1)
|
||||
{
|
||||
il_cfg->policy.name = eina_stringshare_add("Illume");
|
||||
il_cfg->policy.vkbd.class =
|
||||
eina_stringshare_add("Virtual-Keyboard");
|
||||
il_cfg->policy.vkbd.name =
|
||||
eina_stringshare_add("Virtual-Keyboard");
|
||||
il_cfg->policy.vkbd.title =
|
||||
eina_stringshare_add("Virtual Keyboard");
|
||||
il_cfg->policy.vkbd.win_type = ECORE_X_WINDOW_TYPE_NORMAL;
|
||||
il_cfg->policy.vkbd.match.class = 0;
|
||||
il_cfg->policy.vkbd.match.name = 1;
|
||||
il_cfg->policy.vkbd.match.title = 1;
|
||||
il_cfg->policy.vkbd.match.win_type = 0;
|
||||
il_cfg->policy.softkey.class =
|
||||
eina_stringshare_add("Illume-Softkey");
|
||||
il_cfg->policy.softkey.name =
|
||||
eina_stringshare_add("Illume-Softkey");
|
||||
il_cfg->policy.softkey.title =
|
||||
eina_stringshare_add("Illume Softkey");
|
||||
il_cfg->policy.softkey.win_type = ECORE_X_WINDOW_TYPE_DOCK;
|
||||
il_cfg->policy.softkey.match.class = 0;
|
||||
il_cfg->policy.softkey.match.name = 1;
|
||||
il_cfg->policy.softkey.match.title = 1;
|
||||
il_cfg->policy.softkey.match.win_type = 0;
|
||||
il_cfg->policy.home.class =
|
||||
eina_stringshare_add("Illume-Home");
|
||||
il_cfg->policy.home.name =
|
||||
eina_stringshare_add("Illume-Home");
|
||||
il_cfg->policy.home.title =
|
||||
eina_stringshare_add("Illume Home");
|
||||
il_cfg->policy.home.win_type = ECORE_X_WINDOW_TYPE_NORMAL;
|
||||
il_cfg->policy.home.match.class = 0;
|
||||
il_cfg->policy.home.match.name = 1;
|
||||
il_cfg->policy.home.match.title = 1;
|
||||
il_cfg->policy.home.match.win_type = 0;
|
||||
il_cfg->policy.indicator.class =
|
||||
eina_stringshare_add("Illume-Indicator");
|
||||
il_cfg->policy.indicator.name =
|
||||
eina_stringshare_add("Illume-Indicator");
|
||||
il_cfg->policy.indicator.title =
|
||||
eina_stringshare_add("Illume Indicator");
|
||||
il_cfg->policy.indicator.win_type = ECORE_X_WINDOW_TYPE_DOCK;
|
||||
il_cfg->policy.indicator.match.class = 0;
|
||||
il_cfg->policy.indicator.match.name = 1;
|
||||
il_cfg->policy.indicator.match.title = 1;
|
||||
il_cfg->policy.indicator.match.win_type = 0;
|
||||
}
|
||||
if ((il_cfg->version & 0xffff) < 2)
|
||||
{
|
||||
il_cfg->policy.mode.dual = 0;
|
||||
il_cfg->policy.mode.side = 0;
|
||||
}
|
||||
if ((il_cfg->version & 0xffff) < 3)
|
||||
{
|
||||
il_cfg->sliding.quickpanel.duration = 1000;
|
||||
}
|
||||
il_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||
}
|
||||
il_cfg->mod_dir = eina_stringshare_add(m->dir);
|
||||
|
||||
e_configure_registry_category_add("illume", 0, _("Illume"), NULL,
|
||||
"enlightenment/display");
|
||||
e_configure_registry_generic_item_add("illume/animation", 0, _("Animation"),
|
||||
NULL, "enlightenment/animation",
|
||||
il_config_animation_show);
|
||||
e_configure_registry_generic_item_add("illume/windows", 0, _("Windows"),
|
||||
NULL, "enlightenment/windows",
|
||||
il_config_windows_show);
|
||||
e_configure_registry_generic_item_add("illume/policy", 0, _("Policy"),
|
||||
NULL, "enlightenment/policy",
|
||||
il_config_policy_show);
|
||||
e_configure_registry_generic_item_add("illume/policy_settings", 0,
|
||||
_("Policy Settings"),
|
||||
NULL, "enlightenment/policy",
|
||||
il_config_policy_settings_show);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_config_shutdown(void)
|
||||
{
|
||||
e_configure_registry_item_del("illume/policy_settings");
|
||||
e_configure_registry_item_del("illume/policy");
|
||||
e_configure_registry_item_del("illume/windows");
|
||||
e_configure_registry_item_del("illume/animation");
|
||||
e_configure_registry_category_del("illume");
|
||||
|
||||
if (il_cfg->policy.name) eina_stringshare_del(il_cfg->policy.name);
|
||||
|
||||
if (il_cfg->policy.vkbd.class)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.class);
|
||||
if (il_cfg->policy.vkbd.name)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.name);
|
||||
if (il_cfg->policy.vkbd.title)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.title);
|
||||
|
||||
if (il_cfg->policy.softkey.class)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.class);
|
||||
if (il_cfg->policy.softkey.name)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.name);
|
||||
if (il_cfg->policy.softkey.title)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.title);
|
||||
|
||||
if (il_cfg->policy.home.class)
|
||||
eina_stringshare_del(il_cfg->policy.home.class);
|
||||
if (il_cfg->policy.home.name)
|
||||
eina_stringshare_del(il_cfg->policy.home.name);
|
||||
if (il_cfg->policy.home.title)
|
||||
eina_stringshare_del(il_cfg->policy.home.title);
|
||||
|
||||
if (il_cfg->policy.indicator.class)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.class);
|
||||
if (il_cfg->policy.indicator.name)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.name);
|
||||
if (il_cfg->policy.indicator.title)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.title);
|
||||
|
||||
if (il_cfg->mod_dir) eina_stringshare_del(il_cfg->mod_dir);
|
||||
il_cfg->mod_dir = NULL;
|
||||
|
||||
E_FREE(il_cfg);
|
||||
il_cfg = NULL;
|
||||
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_config_save(void)
|
||||
{
|
||||
e_config_domain_save("module.illume2", conf_edd, il_cfg);
|
||||
return 1;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
# define E_MOD_CONFIG_H
|
||||
|
||||
# define IL_CONFIG_MIN 3
|
||||
# define IL_CONFIG_MAJ 0
|
||||
|
||||
int e_mod_config_init(E_Module *m);
|
||||
int e_mod_config_shutdown(void);
|
||||
int e_mod_config_save(void);
|
||||
|
||||
#endif
|
|
@ -1,537 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_layout.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_mod_layout_free(E_Illume_Layout_Policy *p);
|
||||
static int _e_mod_layout_policy_load(const char *file);
|
||||
static void _e_mod_layout_handlers_add(void);
|
||||
static void _e_mod_layout_handlers_del(void);
|
||||
static void _e_mod_layout_hooks_add(void);
|
||||
static void _e_mod_layout_hooks_del(void);
|
||||
static void _e_mod_layout_cb_hook_container_layout(void *data, void *data2);
|
||||
static void _e_mod_layout_cb_hook_post_fetch(void *data, void *data2);
|
||||
static void _e_mod_layout_cb_hook_post_border_assign(void *data, void *data2);
|
||||
static int _e_mod_layout_cb_border_add(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_border_del(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_border_focus_in(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_border_focus_out(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_zone_move_resize(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_client_message(void *data, int type, void *event);
|
||||
static int _e_mod_layout_cb_policy_change(void *data, int type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *hooks = NULL, *handlers = NULL;
|
||||
static E_Illume_Layout_Policy *policy = NULL;
|
||||
EAPI int E_ILLUME_EVENT_POLICY_CHANGE = 0;
|
||||
|
||||
int
|
||||
e_mod_layout_init(void)
|
||||
{
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
Eina_List *files;
|
||||
char buff[PATH_MAX], dir[PATH_MAX], *file;
|
||||
int ret = 0;
|
||||
|
||||
E_ILLUME_EVENT_POLICY_CHANGE = ecore_event_type_new();
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name);
|
||||
snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
|
||||
e_prefix_lib_get());
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
if (strcmp(file, buff))
|
||||
{
|
||||
free(file);
|
||||
continue;
|
||||
}
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/%s",
|
||||
e_prefix_lib_get(), file);
|
||||
break;
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/illume.so",
|
||||
e_prefix_lib_get());
|
||||
}
|
||||
else
|
||||
free(file);
|
||||
|
||||
ret = _e_mod_layout_policy_load(dir);
|
||||
if (!ret) return ret;
|
||||
|
||||
_e_mod_layout_hooks_add();
|
||||
_e_mod_layout_handlers_add();
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
if (il_cfg->policy.mode.dual == 0)
|
||||
mode = ECORE_X_ILLUME_MODE_SINGLE;
|
||||
else
|
||||
{
|
||||
if (il_cfg->policy.mode.side == 0)
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
|
||||
else
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
|
||||
}
|
||||
ecore_x_e_illume_mode_set(xwin, mode);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
e_mod_layout_shutdown(void)
|
||||
{
|
||||
_e_mod_layout_handlers_del();
|
||||
_e_mod_layout_hooks_del();
|
||||
if (policy) e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_illume_layout_policies_get(void)
|
||||
{
|
||||
Eina_List *l = NULL, *files;
|
||||
char dir[PATH_MAX], *file;
|
||||
|
||||
snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
|
||||
e_prefix_lib_get());
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
E_Illume_Layout_Policy *p;
|
||||
|
||||
if (!strstr(file, ".so")) continue;
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/%s",
|
||||
e_prefix_lib_get(), file);
|
||||
p = E_OBJECT_ALLOC(E_Illume_Layout_Policy, E_ILLUME_LAYOUT_TYPE,
|
||||
_e_mod_layout_free);
|
||||
p->handle = dlopen(dir, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!p->handle)
|
||||
{
|
||||
E_ILLUME_ERR("Error opening policy: %s", file);
|
||||
e_object_del(E_OBJECT(p));
|
||||
p = NULL;
|
||||
continue;
|
||||
}
|
||||
p->api = dlsym(p->handle, "e_layapi");
|
||||
if (!p->api)
|
||||
{
|
||||
E_ILLUME_ERR("Policy does not support needed functions: %s", file);
|
||||
e_object_del(E_OBJECT(p));
|
||||
p = NULL;
|
||||
continue;
|
||||
}
|
||||
if (p->api->version < E_ILLUME_LAYOUT_API_VERSION)
|
||||
{
|
||||
E_ILLUME_ERR("Policy is too old: %s", file);
|
||||
e_object_del(E_OBJECT(p));
|
||||
p = NULL;
|
||||
continue;
|
||||
}
|
||||
l = eina_list_append(l, p);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_mod_layout_free(E_Illume_Layout_Policy *p)
|
||||
{
|
||||
if (p->funcs.shutdown) p->funcs.shutdown(p);
|
||||
p->funcs.shutdown = NULL;
|
||||
p->api = NULL;
|
||||
p->funcs.init = NULL;
|
||||
if (p->handle) dlclose(p->handle);
|
||||
p->handle = NULL;
|
||||
E_FREE(p);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_policy_load(const char *file)
|
||||
{
|
||||
if (!file) return 0;
|
||||
policy = E_OBJECT_ALLOC(E_Illume_Layout_Policy, E_ILLUME_LAYOUT_TYPE,
|
||||
_e_mod_layout_free);
|
||||
policy->handle = dlopen(file, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!policy->handle)
|
||||
{
|
||||
E_ILLUME_ERR("Error opening policy: %s", file);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
policy->api = dlsym(policy->handle, "e_layapi");
|
||||
policy->funcs.init = dlsym(policy->handle, "e_layapi_init");
|
||||
policy->funcs.shutdown = dlsym(policy->handle, "e_layapi_shutdown");
|
||||
if ((!policy->funcs.init) || (!policy->funcs.shutdown) || (!policy->api))
|
||||
{
|
||||
E_ILLUME_ERR("Policy does not support needed functions: %s", file);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (policy->api->version < E_ILLUME_LAYOUT_API_VERSION)
|
||||
{
|
||||
E_ILLUME_ERR("Policy is too old: %s", file);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
policy->funcs.init(policy);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_handlers_add(void)
|
||||
{
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_ILLUME_EVENT_POLICY_CHANGE,
|
||||
_e_mod_layout_cb_policy_change, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_ADD,
|
||||
_e_mod_layout_cb_border_add, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
|
||||
_e_mod_layout_cb_border_del, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
||||
_e_mod_layout_cb_border_focus_in,
|
||||
NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
|
||||
_e_mod_layout_cb_border_focus_out,
|
||||
NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
||||
_e_mod_layout_cb_zone_move_resize,
|
||||
NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_e_mod_layout_cb_client_message,
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_handlers_del(void)
|
||||
{
|
||||
Ecore_Event_Handler *handler;
|
||||
|
||||
EINA_LIST_FREE(handlers, handler)
|
||||
ecore_event_handler_del(handler);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_hooks_add(void)
|
||||
{
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH,
|
||||
_e_mod_layout_cb_hook_post_fetch, NULL));
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
|
||||
_e_mod_layout_cb_hook_post_border_assign, NULL));
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
|
||||
_e_mod_layout_cb_hook_container_layout, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_hooks_del(void)
|
||||
{
|
||||
E_Border_Hook *hook;
|
||||
|
||||
EINA_LIST_FREE(hooks, hook)
|
||||
e_border_hook_del(hook);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_container_layout(void *data, void *data2)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Zone *zone;
|
||||
E_Container *con;
|
||||
|
||||
if (!(con = data2)) return;
|
||||
EINA_LIST_FOREACH(con->zones, l, zone)
|
||||
{
|
||||
if ((policy) && (policy->funcs.zone_layout))
|
||||
policy->funcs.zone_layout(zone);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_fetch(void *data, 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;
|
||||
}
|
||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
||||
bd->client.border.changed = 1;
|
||||
bd->client.e.state.centered = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_border_assign(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if (bd->stolen) return;
|
||||
bd->placed = 1;
|
||||
bd->client.e.state.centered = 0;
|
||||
if (bd->remember)
|
||||
{
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
bd->lock_border = 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_size = 1;
|
||||
bd->lock_user_sticky = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_border_add(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if ((policy) && (policy->funcs.border_add))
|
||||
policy->funcs.border_add(ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_border_del(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if ((policy) && (policy->funcs.border_del))
|
||||
policy->funcs.border_del(ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_border_focus_in(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_In *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if ((policy) && (policy->funcs.border_focus_in))
|
||||
policy->funcs.border_focus_in(ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_border_focus_out(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_Out *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if ((policy) && (policy->funcs.border_focus_out))
|
||||
policy->funcs.border_focus_out(ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
|
||||
ev = event;
|
||||
if ((policy) && (policy->funcs.zone_move_resize))
|
||||
policy->funcs.zone_move_resize(ev->zone);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = e_border_find_by_client_window(ev->win);
|
||||
if ((!bd) || (bd->stolen)) return 1;
|
||||
if ((policy) && (policy->funcs.border_activate))
|
||||
policy->funcs.border_activate(bd);
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_MODE)
|
||||
{
|
||||
E_Border *bd;
|
||||
E_Zone *zone;
|
||||
int lock = 1;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
|
||||
if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
|
||||
il_cfg->policy.mode.dual = 0;
|
||||
else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
|
||||
{
|
||||
if (e_illume_border_valid_count_get(zone) < 2)
|
||||
ecore_x_e_illume_home_send(ecore_x_window_root_first_get());
|
||||
il_cfg->policy.mode.dual = 1;
|
||||
il_cfg->policy.mode.side = 0;
|
||||
lock = 0;
|
||||
}
|
||||
else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
|
||||
{
|
||||
if (e_illume_border_valid_count_get(zone) < 2)
|
||||
ecore_x_e_illume_home_send(ecore_x_window_root_first_get());
|
||||
il_cfg->policy.mode.dual = 1;
|
||||
il_cfg->policy.mode.side = 1;
|
||||
}
|
||||
else /* unknown */
|
||||
il_cfg->policy.mode.dual = 0;
|
||||
e_config_save_queue();
|
||||
|
||||
bd = e_illume_border_top_shelf_get(zone);
|
||||
if (bd)
|
||||
ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
|
||||
bd = e_illume_border_bottom_panel_get(zone);
|
||||
if (bd)
|
||||
ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_BACK)
|
||||
{
|
||||
E_Border *bd, *fbd;
|
||||
Eina_List *focused, *l;
|
||||
|
||||
if (!(bd = e_border_focused_get())) return 1;
|
||||
focused = e_border_focus_stack_get();
|
||||
EINA_LIST_REVERSE_FOREACH(focused, l, fbd)
|
||||
{
|
||||
E_Border *fb;
|
||||
|
||||
if (e_object_is_del(E_OBJECT(fbd))) continue;
|
||||
if ((!fbd->client.icccm.accepts_focus) &&
|
||||
(!fbd->client.icccm.take_focus)) continue;
|
||||
if (fbd->client.netwm.state.skip_taskbar) continue;
|
||||
if (fbd == bd)
|
||||
{
|
||||
if (!(fb = focused->next->data)) continue;
|
||||
if (e_object_is_del(E_OBJECT(fb))) continue;
|
||||
if ((!fb->client.icccm.accepts_focus) &&
|
||||
(!fb->client.icccm.take_focus)) continue;
|
||||
if (fb->client.netwm.state.skip_taskbar) continue;
|
||||
e_border_raise(fb);
|
||||
e_border_focus_set(fb, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_CLOSE)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = e_border_focused_get())) return 1;
|
||||
e_border_act_close_begin(bd);
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_START)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = e_border_find_by_client_window(ev->win);
|
||||
if ((!bd) || (bd->stolen)) return 1;
|
||||
if ((policy) && (policy->funcs.drag_start))
|
||||
policy->funcs.drag_start(bd);
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_END)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = e_border_find_by_client_window(ev->win);
|
||||
if ((!bd) || (bd->stolen)) return 1;
|
||||
if ((policy) && (policy->funcs.drag_end))
|
||||
policy->funcs.drag_end(bd);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_policy_change(void *data, int type, void *event)
|
||||
{
|
||||
Eina_List *files;
|
||||
char buff[PATH_MAX], dir[PATH_MAX], *file;
|
||||
|
||||
if (type != E_ILLUME_EVENT_POLICY_CHANGE) return 1;
|
||||
if (policy)
|
||||
{
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
}
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name);
|
||||
snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
|
||||
e_prefix_lib_get());
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
if (strcmp(file, buff))
|
||||
{
|
||||
free(file);
|
||||
continue;
|
||||
}
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/%s",
|
||||
e_prefix_lib_get(), file);
|
||||
break;
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/illume.so",
|
||||
e_prefix_lib_get());
|
||||
}
|
||||
else
|
||||
free(file);
|
||||
|
||||
_e_mod_layout_policy_load(dir);
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef E_MOD_LAYOUT_H
|
||||
# define E_MOD_LAYOUT_H
|
||||
|
||||
int e_mod_layout_init(void);
|
||||
void e_mod_layout_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -1,121 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_quickpanel.h"
|
||||
#include "e_mod_layout.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local variables */
|
||||
static E_Kbd *kbd = NULL;
|
||||
static E_Quickpanel *qp = NULL;
|
||||
int _e_illume_log_dom = -1;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
/* set eina logging for error reporting/debugging */
|
||||
if (_e_illume_log_dom < 0)
|
||||
{
|
||||
_e_illume_log_dom =
|
||||
eina_log_domain_register("illume2", E_ILLUME_DEFAULT_LOG_COLOR);
|
||||
if (_e_illume_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_CRIT("Could not register log domain for illume2");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* set module priority very high so it loads before other illume modules */
|
||||
e_module_priority_set(m, 100);
|
||||
|
||||
/* init the config subsystem */
|
||||
if (!e_mod_config_init(m))
|
||||
{
|
||||
/* cleanup eina log domain */
|
||||
if (_e_illume_log_dom >= 0)
|
||||
{
|
||||
eina_log_domain_unregister(_e_illume_log_dom);
|
||||
_e_illume_log_dom = -1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* init the keyboard subsystem */
|
||||
e_kbd_init();
|
||||
|
||||
/* init the quickpanel subsystem */
|
||||
e_quickpanel_init();
|
||||
|
||||
/* init the layout subsystem */
|
||||
if (!e_mod_layout_init())
|
||||
{
|
||||
/* shutdown the quickpanel subsystem */
|
||||
e_quickpanel_shutdown();
|
||||
|
||||
/* shutdown kbd subsystem */
|
||||
e_kbd_shutdown();
|
||||
|
||||
/* shutdown config subsystem */
|
||||
e_mod_config_shutdown();
|
||||
|
||||
/* cleanup eina log domain */
|
||||
if (_e_illume_log_dom >= 0)
|
||||
{
|
||||
eina_log_domain_unregister(_e_illume_log_dom);
|
||||
_e_illume_log_dom = -1;
|
||||
}
|
||||
|
||||
/* report error to user */
|
||||
e_error_message_show("There was an error loading Policy\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create a new keyboard */
|
||||
kbd = e_kbd_new();
|
||||
|
||||
/* create a new quickpanel */
|
||||
qp = e_quickpanel_new(e_util_zone_current_get(e_manager_current_get()));
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
/* cleanup the quickpanel */
|
||||
e_object_del(E_OBJECT(qp));
|
||||
qp = NULL;
|
||||
|
||||
/* cleanup the keyboard */
|
||||
e_object_del(E_OBJECT(kbd));
|
||||
kbd = NULL;
|
||||
|
||||
/* shutdown the layout subsystem */
|
||||
e_mod_layout_shutdown();
|
||||
|
||||
/* shutdown the quickpanel subsystem */
|
||||
e_quickpanel_shutdown();
|
||||
|
||||
/* shutdown the keyboard subsystem */
|
||||
e_kbd_shutdown();
|
||||
|
||||
/* shutdown the config subsystem */
|
||||
e_mod_config_shutdown();
|
||||
|
||||
/* cleanup eina log domain */
|
||||
if (_e_illume_log_dom >= 0)
|
||||
{
|
||||
eina_log_domain_unregister(_e_illume_log_dom);
|
||||
_e_illume_log_dom = -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return e_mod_config_save();
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
# define E_MOD_MAIN_H
|
||||
|
||||
# ifdef E_ILLUME_DEFAULT_LOG_COLOR
|
||||
# undef E_ILLUME_DEFAULT_LOG_COLOR
|
||||
# endif
|
||||
# define E_ILLUME_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
|
||||
|
||||
extern int _e_illume_log_dom;
|
||||
# ifdef E_ILLUME_ERR
|
||||
# undef E_ILLUME_ERR
|
||||
# endif
|
||||
# define E_ILLUME_ERR(...) EINA_LOG_DOM_ERR(_e_illume_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef E_ILLUME_INF
|
||||
# undef E_ILLUME_INF
|
||||
# endif
|
||||
# define E_ILLUME_INF(...) EINA_LOG_DOM_INFO(_e_illume_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef E_ILLUME_CRIT
|
||||
# undef E_ILLUME_CRIT
|
||||
# endif
|
||||
# define E_ILLUME_CRIT(...) EINA_LOG_DOM_INFO(_e_illume_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef E_ILLUME_WARN
|
||||
# undef E_ILLUME_WARN
|
||||
# endif
|
||||
# define E_ILLUME_WARN(...) EINA_LOG_DOM_WARN(_e_illume_log_dom, __VA_ARGS__)
|
||||
|
||||
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,113 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_policy.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_config_policy_create(E_Config_Dialog *cfd);
|
||||
static void _il_config_policy_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_config_policy_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_config_policy_list_changed(void *data);
|
||||
static int _il_config_policy_change_timeout(void *data);
|
||||
static Evas_Object *_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
/* local variables */
|
||||
Ecore_Timer *_policy_change_timer = NULL;
|
||||
const char *policy_name = NULL;
|
||||
|
||||
void
|
||||
il_config_policy_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_policy")) return;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_config_policy_create;
|
||||
v->free_cfdata = _il_config_policy_free;
|
||||
v->basic.create_widgets = _il_config_policy_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
cfd = e_config_dialog_new(con, _("Policy"), "E",
|
||||
"_config_illume_policy",
|
||||
"enlightenment/policy", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void *
|
||||
_il_config_policy_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_policy_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_policy_change_timer) ecore_timer_del(_policy_change_timer);
|
||||
_policy_change_timer = NULL;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_config_policy_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *ow;
|
||||
Eina_List *policies;
|
||||
E_Illume_Layout_Policy *p;
|
||||
int i = 0, sel = 0;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
ow = e_widget_ilist_add(evas, 24, 24, &(policy_name));
|
||||
e_widget_ilist_selector_set(ow, 1);
|
||||
evas_event_freeze(evas);
|
||||
edje_freeze();
|
||||
e_widget_ilist_freeze(ow);
|
||||
e_widget_ilist_clear(ow);
|
||||
e_widget_ilist_go(ow);
|
||||
|
||||
policies = e_illume_layout_policies_get();
|
||||
EINA_LIST_FREE(policies, p)
|
||||
{
|
||||
e_widget_ilist_append(ow, NULL, strdup(p->api->label),
|
||||
_il_config_policy_list_changed, NULL,
|
||||
strdup(p->api->name));
|
||||
|
||||
if ((p) && (il_cfg->policy.name) &&
|
||||
(!strcmp(il_cfg->policy.name, p->api->name)))
|
||||
sel = i;
|
||||
|
||||
if (p)
|
||||
{
|
||||
e_object_del(E_OBJECT(p));
|
||||
p = NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
e_widget_size_min_set(ow, 100, 200);
|
||||
e_widget_ilist_go(ow);
|
||||
e_widget_ilist_selected_set(ow, sel);
|
||||
e_widget_ilist_thaw(ow);
|
||||
edje_thaw();
|
||||
evas_event_thaw(evas);
|
||||
e_widget_list_object_append(list, ow, 1, 0, 0.0);
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_policy_list_changed(void *data)
|
||||
{
|
||||
if (il_cfg->policy.name) eina_stringshare_del(il_cfg->policy.name);
|
||||
if (policy_name) il_cfg->policy.name = eina_stringshare_add(policy_name);
|
||||
if (_policy_change_timer) ecore_timer_del(_policy_change_timer);
|
||||
_policy_change_timer =
|
||||
ecore_timer_add(0.5, _il_config_policy_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_policy_change_timeout(void *data)
|
||||
{
|
||||
e_config_save_queue();
|
||||
_policy_change_timer = NULL;
|
||||
ecore_event_add(E_ILLUME_EVENT_POLICY_CHANGE, NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef E_MOD_POLICY_H
|
||||
#define E_MOD_POLICY_H
|
||||
|
||||
void il_config_policy_show(E_Container *con, const char *params);
|
||||
|
||||
#endif
|
|
@ -1,120 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_policy_settings.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_config_policy_settings_create(E_Config_Dialog *cfd);
|
||||
static void _il_config_policy_settings_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_config_policy_settings_changed(void *data, Evas_Object *obj, void *event);
|
||||
static int _il_config_policy_settings_change_timeout(void *data);
|
||||
|
||||
/* local variables */
|
||||
Ecore_Timer *_ps_change_timer = NULL;
|
||||
Evas_Object *o_top, *o_left;
|
||||
|
||||
void
|
||||
il_config_policy_settings_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_policy_settings")) return;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_config_policy_settings_create;
|
||||
v->free_cfdata = _il_config_policy_settings_free;
|
||||
v->basic.create_widgets = _il_config_policy_settings_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
cfd = e_config_dialog_new(con, _("Policy Settings"), "E",
|
||||
"_config_illume_policy_settings",
|
||||
"enlightenment/policy_settings", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void *
|
||||
_il_config_policy_settings_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_policy_settings_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_ps_change_timer) ecore_timer_del(_ps_change_timer);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *ow;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
of = e_widget_framelist_add(evas, _("Mode"), 0);
|
||||
rg = e_widget_radio_group_new(&(il_cfg->policy.mode.dual));
|
||||
ow = e_widget_radio_add(evas, _("Single App Mode"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_policy_settings_changed, NULL);
|
||||
ow = e_widget_radio_add(evas, _("Dual App Mode"), 1, rg);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_policy_settings_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Window Layout"), 0);
|
||||
rg = e_widget_radio_group_new(&(il_cfg->policy.mode.side));
|
||||
o_top = e_widget_radio_add(evas, _("Top/Bottom"), 0, rg);
|
||||
e_widget_framelist_object_append(of, o_top);
|
||||
evas_object_smart_callback_add(o_top, "changed",
|
||||
_il_config_policy_settings_changed, NULL);
|
||||
o_left = e_widget_radio_add(evas, _("Left/Right"), 1, rg);
|
||||
e_widget_framelist_object_append(of, o_left);
|
||||
evas_object_smart_callback_add(o_left, "changed",
|
||||
_il_config_policy_settings_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
|
||||
e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_policy_settings_changed(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
|
||||
e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
|
||||
|
||||
if (_ps_change_timer) ecore_timer_del(_ps_change_timer);
|
||||
_ps_change_timer =
|
||||
ecore_timer_add(0.5, _il_config_policy_settings_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_policy_settings_change_timeout(void *data)
|
||||
{
|
||||
Ecore_X_Window xwin;
|
||||
Ecore_X_Illume_Mode mode;
|
||||
|
||||
e_config_save_queue();
|
||||
_ps_change_timer = NULL;
|
||||
|
||||
if (il_cfg->policy.mode.dual)
|
||||
{
|
||||
if (il_cfg->policy.mode.side == 0)
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
|
||||
else
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
|
||||
}
|
||||
else
|
||||
mode = ECORE_X_ILLUME_MODE_SINGLE;
|
||||
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
ecore_x_e_illume_mode_set(xwin, mode);
|
||||
ecore_x_e_illume_mode_send(xwin, mode);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef E_MOD_POLICY_SETTINGS_H
|
||||
# define E_MOD_POLICY_SETTINGS_H
|
||||
|
||||
void il_config_policy_settings_show(E_Container *con, const char *params);
|
||||
|
||||
#endif
|
|
@ -1,269 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_select_window.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_config_select_window_create_data(E_Config_Dialog *cfd);
|
||||
static void _il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_config_select_window_list_changed(void *data);
|
||||
static int _il_config_select_window_change_timeout(void *data);
|
||||
static int _il_config_select_window_match(E_Border *bd);
|
||||
|
||||
/* local variables */
|
||||
Il_Select_Window_Type stype;
|
||||
Ecore_Timer *_sw_change_timer = NULL;
|
||||
|
||||
/* public functions */
|
||||
void
|
||||
il_config_select_window(Il_Select_Window_Type type)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||
stype = type;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_config_select_window_create_data;
|
||||
v->free_cfdata = _il_config_select_window_free_data;
|
||||
v->basic.create_widgets = _il_config_select_window_create;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Select Home Window"), "E",
|
||||
"_config_illume_select_window",
|
||||
"enlightenment/windows", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
}
|
||||
|
||||
static void *
|
||||
_il_config_select_window_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *ow;
|
||||
Eina_List *bds, *l;
|
||||
int i = 0, sel = -1;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
ow = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
e_widget_ilist_selector_set(ow, 1);
|
||||
evas_event_freeze(evas);
|
||||
edje_freeze();
|
||||
e_widget_ilist_freeze(ow);
|
||||
e_widget_ilist_clear(ow);
|
||||
e_widget_ilist_go(ow);
|
||||
|
||||
bds = e_border_client_list();
|
||||
for (i = 0, l = bds; l; l = l->next, i++)
|
||||
{
|
||||
E_Border *bd;
|
||||
const char *name;
|
||||
|
||||
if (!(bd = l->data)) continue;
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
if (_il_config_select_window_match(bd)) sel = i;
|
||||
name = e_border_name_get(bd);
|
||||
e_widget_ilist_append(ow, NULL, name,
|
||||
_il_config_select_window_list_changed,
|
||||
bd, name);
|
||||
}
|
||||
e_widget_size_min_set(ow, 100, 200);
|
||||
e_widget_ilist_go(ow);
|
||||
if (sel >= 0) e_widget_ilist_selected_set(ow, sel);
|
||||
e_widget_ilist_thaw(ow);
|
||||
edje_thaw();
|
||||
evas_event_thaw(evas);
|
||||
e_widget_list_object_append(list, ow, 1, 0, 0.0);
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_select_window_list_changed(void *data)
|
||||
{
|
||||
E_Border *bd;
|
||||
Ecore_X_Window_Type wtype;
|
||||
char *title, *name, *class;
|
||||
|
||||
if (!(bd = data)) return;
|
||||
title = ecore_x_icccm_title_get(bd->client.win);
|
||||
ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
|
||||
ecore_x_netwm_window_type_get(bd->client.win, &wtype);
|
||||
|
||||
switch (stype)
|
||||
{
|
||||
case IL_SELECT_WINDOW_TYPE_HOME:
|
||||
if (il_cfg->policy.home.title)
|
||||
eina_stringshare_del(il_cfg->policy.home.title);
|
||||
if (title) il_cfg->policy.home.title = eina_stringshare_add(title);
|
||||
if (il_cfg->policy.home.class)
|
||||
eina_stringshare_del(il_cfg->policy.home.class);
|
||||
if (class) il_cfg->policy.home.class = eina_stringshare_add(class);
|
||||
if (il_cfg->policy.home.name)
|
||||
eina_stringshare_del(il_cfg->policy.home.name);
|
||||
if (name) il_cfg->policy.home.name = eina_stringshare_add(name);
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_VKBD:
|
||||
if (il_cfg->policy.vkbd.title)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.title);
|
||||
if (title) il_cfg->policy.vkbd.title = eina_stringshare_add(title);
|
||||
if (il_cfg->policy.vkbd.class)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.class);
|
||||
if (class) il_cfg->policy.vkbd.class = eina_stringshare_add(class);
|
||||
if (il_cfg->policy.vkbd.name)
|
||||
eina_stringshare_del(il_cfg->policy.vkbd.name);
|
||||
if (name) il_cfg->policy.vkbd.name = eina_stringshare_add(name);
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_SOFTKEY:
|
||||
if (il_cfg->policy.softkey.title)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.title);
|
||||
if (title) il_cfg->policy.softkey.title = eina_stringshare_add(title);
|
||||
if (il_cfg->policy.softkey.class)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.class);
|
||||
if (class) il_cfg->policy.softkey.class = eina_stringshare_add(class);
|
||||
if (il_cfg->policy.softkey.name)
|
||||
eina_stringshare_del(il_cfg->policy.softkey.name);
|
||||
if (name) il_cfg->policy.softkey.name = eina_stringshare_add(name);
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_INDICATOR:
|
||||
if (il_cfg->policy.indicator.title)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.title);
|
||||
if (title) il_cfg->policy.indicator.title = eina_stringshare_add(title);
|
||||
if (il_cfg->policy.indicator.class)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.class);
|
||||
if (class) il_cfg->policy.indicator.class = eina_stringshare_add(class);
|
||||
if (il_cfg->policy.indicator.name)
|
||||
eina_stringshare_del(il_cfg->policy.indicator.name);
|
||||
if (name) il_cfg->policy.indicator.name = eina_stringshare_add(name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (title) free(title);
|
||||
if (name) free(name);
|
||||
if (class) free(class);
|
||||
|
||||
if (_sw_change_timer) ecore_timer_del(_sw_change_timer);
|
||||
_sw_change_timer =
|
||||
ecore_timer_add(0.5, _il_config_select_window_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_select_window_change_timeout(void *data)
|
||||
{
|
||||
e_config_save_queue();
|
||||
_sw_change_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_select_window_match(E_Border *bd)
|
||||
{
|
||||
Ecore_X_Window_Type wtype;
|
||||
char *title, *name, *class;
|
||||
int match = 0;
|
||||
|
||||
if (!bd) return 0;
|
||||
title = ecore_x_icccm_title_get(bd->client.win);
|
||||
ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
|
||||
ecore_x_netwm_window_type_get(bd->client.win, &wtype);
|
||||
|
||||
switch (stype)
|
||||
{
|
||||
case IL_SELECT_WINDOW_TYPE_HOME:
|
||||
if (il_cfg->policy.home.match.title)
|
||||
{
|
||||
if ((title) && (!strcmp(title, il_cfg->policy.home.title)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.home.match.name)
|
||||
{
|
||||
if ((name) && (!strcmp(name, il_cfg->policy.home.name)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.home.match.class)
|
||||
{
|
||||
if ((class) && (!strcmp(class, il_cfg->policy.home.class)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_VKBD:
|
||||
if (il_cfg->policy.vkbd.match.title)
|
||||
{
|
||||
if ((title) && (!strcmp(title, il_cfg->policy.vkbd.title)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.vkbd.match.name)
|
||||
{
|
||||
if ((name) && (!strcmp(name, il_cfg->policy.vkbd.name)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.vkbd.match.class)
|
||||
{
|
||||
if ((class) && (!strcmp(class, il_cfg->policy.vkbd.class)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_SOFTKEY:
|
||||
if (il_cfg->policy.softkey.match.title)
|
||||
{
|
||||
if ((title) && (!strcmp(title, il_cfg->policy.softkey.title)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.softkey.match.name)
|
||||
{
|
||||
if ((name) && (!strcmp(name, il_cfg->policy.softkey.name)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.softkey.match.class)
|
||||
{
|
||||
if ((class) && (!strcmp(class, il_cfg->policy.softkey.class)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IL_SELECT_WINDOW_TYPE_INDICATOR:
|
||||
if (il_cfg->policy.indicator.match.title)
|
||||
{
|
||||
if ((title) && (!strcmp(title, il_cfg->policy.indicator.title)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.indicator.match.name)
|
||||
{
|
||||
if ((name) && (!strcmp(name, il_cfg->policy.indicator.name)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
if (il_cfg->policy.indicator.match.class)
|
||||
{
|
||||
if ((class) && (!strcmp(class, il_cfg->policy.indicator.class)))
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (title) free(title);
|
||||
if (name) free(name);
|
||||
if (class) free(class);
|
||||
|
||||
return match;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef E_MOD_SELECT_WINDOW_H
|
||||
#define E_MOD_SELECT_WINDOW_H
|
||||
|
||||
typedef enum _Il_Select_Window_Type Il_Select_Window_Type;
|
||||
enum _Il_Select_Window_Type
|
||||
{
|
||||
IL_SELECT_WINDOW_TYPE_HOME,
|
||||
IL_SELECT_WINDOW_TYPE_VKBD,
|
||||
IL_SELECT_WINDOW_TYPE_SOFTKEY,
|
||||
IL_SELECT_WINDOW_TYPE_INDICATOR
|
||||
};
|
||||
|
||||
void il_config_select_window(Il_Select_Window_Type type);
|
||||
|
||||
#endif
|
|
@ -1,217 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_windows.h"
|
||||
#include "e_mod_select_window.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_il_config_windows_create(E_Config_Dialog *cfd);
|
||||
static void _il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _il_config_windows_check_changed(void *data, Evas_Object *obj, void *event);
|
||||
static void _il_config_windows_change(void *data, Evas_Object *obj, void *event);
|
||||
static int _il_config_windows_change_timeout(void *data);
|
||||
static void _il_config_windows_select_home(void *data, void *data2);
|
||||
static void _il_config_windows_select_vkbd(void *data, void *data2);
|
||||
static void _il_config_windows_select_softkey(void *data, void *data2);
|
||||
static void _il_config_windows_select_indicator(void *data, void *data2);
|
||||
|
||||
/* local variables */
|
||||
Ecore_Timer *_windows_change_timer = NULL;
|
||||
|
||||
/* public functions */
|
||||
void
|
||||
il_config_windows_show(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_illume_windows_settings")) return;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _il_config_windows_create;
|
||||
v->free_cfdata = _il_config_windows_free;
|
||||
v->basic.create_widgets = _il_config_windows_ui;
|
||||
v->basic_only = 1;
|
||||
v->normal_win = 1;
|
||||
v->scroll = 1;
|
||||
cfd = e_config_dialog_new(con, _("Window Settings"), "E",
|
||||
"_config_illume_windows_settings",
|
||||
"preferences-system-windows", 0, v, NULL);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void *
|
||||
_il_config_windows_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *ow;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Home"), 0);
|
||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||
_il_config_windows_select_home, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||
&il_cfg->policy.home.match.class);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Name"),
|
||||
&il_cfg->policy.home.match.name);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Title"),
|
||||
&il_cfg->policy.home.match.title);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Type"),
|
||||
&il_cfg->policy.home.match.win_type);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Indicator"), 0);
|
||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||
_il_config_windows_select_indicator, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||
&il_cfg->policy.indicator.match.class);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Name"),
|
||||
&il_cfg->policy.indicator.match.name);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Title"),
|
||||
&il_cfg->policy.indicator.match.title);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Type"),
|
||||
&il_cfg->policy.indicator.match.win_type);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Keyboard"), 0);
|
||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||
_il_config_windows_select_vkbd, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||
&il_cfg->policy.vkbd.match.class);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Name"),
|
||||
&il_cfg->policy.vkbd.match.name);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Title"),
|
||||
&il_cfg->policy.vkbd.match.title);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Type"),
|
||||
&il_cfg->policy.vkbd.match.win_type);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Softkey"), 0);
|
||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||
_il_config_windows_select_softkey, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||
&il_cfg->policy.softkey.match.class);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Name"),
|
||||
&il_cfg->policy.softkey.match.name);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Title"),
|
||||
&il_cfg->policy.softkey.match.title);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
ow = e_widget_check_add(evas, _("Match Window Type"),
|
||||
&il_cfg->policy.softkey.match.win_type);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
evas_object_smart_callback_add(ow, "changed",
|
||||
_il_config_windows_check_changed, NULL);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_check_changed(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
_il_config_windows_change(data, obj, event);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_change(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
|
||||
_windows_change_timer =
|
||||
ecore_timer_add(0.5, _il_config_windows_change_timeout, data);
|
||||
}
|
||||
|
||||
static int
|
||||
_il_config_windows_change_timeout(void *data)
|
||||
{
|
||||
e_config_save_queue();
|
||||
_windows_change_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_select_home(void *data, void *data2)
|
||||
{
|
||||
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||
il_config_select_window(IL_SELECT_WINDOW_TYPE_HOME);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_select_vkbd(void *data, void *data2)
|
||||
{
|
||||
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||
il_config_select_window(IL_SELECT_WINDOW_TYPE_VKBD);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_select_softkey(void *data, void *data2)
|
||||
{
|
||||
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||
il_config_select_window(IL_SELECT_WINDOW_TYPE_SOFTKEY);
|
||||
}
|
||||
|
||||
static void
|
||||
_il_config_windows_select_indicator(void *data, void *data2)
|
||||
{
|
||||
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||
il_config_select_window(IL_SELECT_WINDOW_TYPE_INDICATOR);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef E_MOD_WINDOWS_H
|
||||
#define E_MOD_WINDOWS_H
|
||||
|
||||
void il_config_windows_show(E_Container *con, const char *params);
|
||||
|
||||
#endif
|
|
@ -1,421 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_quickpanel.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_quickpanel_cb_free(E_Quickpanel *qp);
|
||||
static int _e_quickpanel_cb_client_message(void *data, int type, void *event);
|
||||
static void _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2);
|
||||
static E_Quickpanel *_e_quickpanel_by_border_get(E_Border *bd);
|
||||
static int _e_quickpanel_border_is_quickpanel(E_Border *bd);
|
||||
static void _e_quickpanel_slide(E_Quickpanel *qp, int visible, double len);
|
||||
static int _e_quickpanel_cb_animate(void *data);
|
||||
static int _e_quickpanel_cb_delay_hide(void *data);
|
||||
static void _e_quickpanel_hide(E_Quickpanel *qp);
|
||||
static int _e_quickpanel_cb_sort(const void *b1, const void *b2);
|
||||
static int _e_quickpanel_cb_mouse_down(void *data, int type, void *event);
|
||||
static int _e_quickpanel_cb_mouse_wheel(void *data, int type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *qps = NULL, *handlers = NULL, *hooks = NULL;
|
||||
static Ecore_X_Window input_win = 0;
|
||||
|
||||
/* public functions */
|
||||
int
|
||||
e_quickpanel_init(void)
|
||||
{
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_e_quickpanel_cb_client_message, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
_e_quickpanel_cb_mouse_down, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
|
||||
_e_quickpanel_cb_mouse_wheel, NULL));
|
||||
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
|
||||
_e_quickpanel_cb_border_pre_post_fetch,
|
||||
NULL));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_quickpanel_shutdown(void)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
Ecore_Event_Handler *handler;
|
||||
E_Border_Hook *hook;
|
||||
|
||||
EINA_LIST_FREE(handlers, handler)
|
||||
ecore_event_handler_del(handler);
|
||||
EINA_LIST_FREE(hooks, hook)
|
||||
e_border_hook_del(hook);
|
||||
EINA_LIST_FREE(qps, qp)
|
||||
e_object_del(E_OBJECT(qp));
|
||||
return 1;
|
||||
}
|
||||
|
||||
E_Quickpanel *
|
||||
e_quickpanel_new(E_Zone *zone)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
qp = E_OBJECT_ALLOC(E_Quickpanel, E_QUICKPANEL_TYPE, _e_quickpanel_cb_free);
|
||||
if (!qp) return NULL;
|
||||
qp->zone = zone;
|
||||
qps = eina_list_append(qps, qp);
|
||||
return qp;
|
||||
}
|
||||
|
||||
void
|
||||
e_quickpanel_show(E_Quickpanel *qp)
|
||||
{
|
||||
if (qp->timer) ecore_timer_del(qp->timer);
|
||||
qp->timer = NULL;
|
||||
if (qp->visible) return;
|
||||
if (!qp->borders) return;
|
||||
qp->borders = eina_list_sort(qp->borders, 0, _e_quickpanel_cb_sort);
|
||||
if (!input_win)
|
||||
{
|
||||
input_win =
|
||||
ecore_x_window_input_new(qp->zone->container->win,
|
||||
qp->zone->x, qp->zone->y,
|
||||
qp->zone->w, qp->zone->h);
|
||||
ecore_x_window_show(input_win);
|
||||
if (!e_grabinput_get(input_win, 1, input_win))
|
||||
{
|
||||
ecore_x_window_free(input_win);
|
||||
input_win = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (il_cfg->sliding.quickpanel.duration <= 0)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
int ny = 0;
|
||||
|
||||
e_illume_border_top_shelf_size_get(qp->zone, NULL, &ny);
|
||||
EINA_LIST_REVERSE_FOREACH(qp->borders, l, bd)
|
||||
ny += bd->h;
|
||||
|
||||
EINA_LIST_REVERSE_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
e_border_lower(bd);
|
||||
e_border_fx_offset(bd, 0, ny);
|
||||
}
|
||||
qp->visible = 1;
|
||||
}
|
||||
else
|
||||
_e_quickpanel_slide(qp, 1,
|
||||
(double)il_cfg->sliding.quickpanel.duration / 1000.0);
|
||||
}
|
||||
|
||||
void
|
||||
e_quickpanel_hide(E_Quickpanel *qp)
|
||||
{
|
||||
if (!qp->visible) return;
|
||||
if (!qp->timer)
|
||||
qp->timer = ecore_timer_add(0.2, _e_quickpanel_cb_delay_hide, qp);
|
||||
}
|
||||
|
||||
E_Quickpanel *
|
||||
e_quickpanel_by_zone_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (!zone) return NULL;
|
||||
EINA_LIST_FOREACH(qps, l, qp)
|
||||
if (qp->zone == zone) return qp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
e_quickpanel_position_update(E_Quickpanel *qp)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
int ty;
|
||||
|
||||
if (!qp) return;
|
||||
e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
bd->x = qp->zone->x;
|
||||
bd->y = (ty - qp->h);
|
||||
bd->changed = 1;
|
||||
bd->changes.pos = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_quickpanel_cb_free(E_Quickpanel *qp)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (qp->animator) ecore_animator_del(qp->animator);
|
||||
qp->animator = NULL;
|
||||
if (qp->timer) ecore_timer_del(qp->timer);
|
||||
qp->timer = NULL;
|
||||
EINA_LIST_FREE(qp->borders, bd)
|
||||
bd->stolen = 0;
|
||||
E_FREE(qp);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
E_Zone *zone;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
ev = event;
|
||||
if (ev->win != ecore_x_window_root_first_get()) return 1;
|
||||
if (ev->message_type != ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) return 1;
|
||||
zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
|
||||
if (!(qp = e_quickpanel_by_zone_get(zone))) return 1;
|
||||
if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
|
||||
e_quickpanel_hide(qp);
|
||||
else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
|
||||
e_quickpanel_show(qp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
E_Quickpanel *qp;
|
||||
int ty;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if (!bd->new_client) return;
|
||||
if (!_e_quickpanel_border_is_quickpanel(bd)) return;
|
||||
if (_e_quickpanel_by_border_get(bd)) return;
|
||||
if (!(qp = e_quickpanel_by_zone_get(bd->zone))) return;
|
||||
|
||||
printf("Appending: %s\n", bd->client.icccm.name);
|
||||
qp->borders = eina_list_append(qp->borders, bd);
|
||||
// qp->borders = eina_list_sorted_insert(qp->borders, _e_quickpanel_cb_sort, bd);
|
||||
|
||||
e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
|
||||
bd->stolen = 1;
|
||||
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;
|
||||
}
|
||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
||||
bd->client.border.changed = 1;
|
||||
qp->h += bd->h;
|
||||
e_border_move(bd, qp->zone->x, (ty - qp->h));
|
||||
/*
|
||||
if (qp->visible)
|
||||
{
|
||||
int th;
|
||||
|
||||
e_illume_border_top_shelf_size_get(qp->zone, NULL, &th);
|
||||
e_border_fx_offset(bd, 0, (bd->h - th));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static E_Quickpanel *
|
||||
_e_quickpanel_by_border_get(E_Border *bd)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
E_Border *b;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (!bd->stolen) return NULL;
|
||||
EINA_LIST_FOREACH(qps, l, qp)
|
||||
EINA_LIST_FOREACH(qp->borders, ll, b)
|
||||
if (b == bd) return qp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_border_is_quickpanel(E_Border *bd)
|
||||
{
|
||||
return bd->client.illume.quickpanel.quickpanel;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_slide(E_Quickpanel *qp, int visible, double len)
|
||||
{
|
||||
qp->start = ecore_loop_time_get();
|
||||
qp->len = len;
|
||||
qp->adjust_start = qp->adjust;
|
||||
qp->adjust_end = 0;
|
||||
if (visible)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
qp->adjust_end += bd->h;
|
||||
}
|
||||
else
|
||||
{
|
||||
int th;
|
||||
|
||||
e_illume_border_top_shelf_size_get(qp->zone, NULL, &th);
|
||||
qp->adjust_end = -th;
|
||||
}
|
||||
if (!qp->animator)
|
||||
qp->animator = ecore_animator_add(_e_quickpanel_cb_animate, qp);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_animate(void *data)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
double t, v;
|
||||
|
||||
if (!(qp = data)) return 0;
|
||||
t = ecore_loop_time_get() - qp->start;
|
||||
if (t > qp->len) t = qp->len;
|
||||
if (qp->len > 0.0)
|
||||
{
|
||||
v = t / qp->len;
|
||||
v = 1.0 - v;
|
||||
v = v * v * v * v;
|
||||
v = 1.0 - v;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = qp->len;
|
||||
v = 1.0;
|
||||
}
|
||||
qp->adjust = (qp->adjust_end * v) + (qp->adjust_start * (1.0 - v));
|
||||
|
||||
EINA_LIST_REVERSE_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
e_border_lower(bd);
|
||||
e_border_fx_offset(bd, 0, (bd->h + qp->adjust));
|
||||
}
|
||||
|
||||
if (t == qp->len)
|
||||
{
|
||||
qp->animator = NULL;
|
||||
if (qp->visible)
|
||||
qp->visible = 0;
|
||||
else
|
||||
qp->visible = 1;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_delay_hide(void *data)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (!(qp = data)) return 0;
|
||||
_e_quickpanel_hide(qp);
|
||||
qp->timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_hide(E_Quickpanel *qp)
|
||||
{
|
||||
if (qp->timer) ecore_timer_del(qp->timer);
|
||||
qp->timer = NULL;
|
||||
if (!qp->visible) return;
|
||||
if (input_win)
|
||||
{
|
||||
ecore_x_window_free(input_win);
|
||||
e_grabinput_release(input_win, input_win);
|
||||
input_win = 0;
|
||||
}
|
||||
if (il_cfg->sliding.quickpanel.duration <= 0)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
e_border_lower(bd);
|
||||
e_border_fx_offset(bd, 0, 0);
|
||||
}
|
||||
qp->visible = 0;
|
||||
}
|
||||
else
|
||||
_e_quickpanel_slide(qp, 0,
|
||||
(double)il_cfg->sliding.quickpanel.duration / 1000.0);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_sort(const void *b1, const void *b2)
|
||||
{
|
||||
const E_Border *bd1, *bd2;
|
||||
int major1, major2, ret;
|
||||
|
||||
if (!(bd1 = b1)) return -1;
|
||||
if (!(bd2 = b2)) return 1;
|
||||
printf("Checking: %s against %s\n", bd2->client.icccm.name, bd1->client.icccm.name);
|
||||
major1 = bd1->client.illume.quickpanel.priority.major;
|
||||
major2 = bd2->client.illume.quickpanel.priority.major;
|
||||
if (major1 < major2) ret = -1;
|
||||
else if (major1 > major2) ret = 1;
|
||||
else
|
||||
{
|
||||
int minor1, minor2;
|
||||
|
||||
minor1 = bd1->client.illume.quickpanel.priority.minor;
|
||||
// ecore_x_e_illume_quickpanel_priority_minor_get(bd1->client.win);
|
||||
minor2 = bd2->client.illume.quickpanel.priority.minor;
|
||||
// ecore_x_e_illume_quickpanel_priority_minor_get(bd2->client.win);
|
||||
if (minor1 < minor2) ret = -1;
|
||||
else if (minor1 > minor2) ret = 1;
|
||||
else ret = 0;
|
||||
}
|
||||
printf("Return: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_mouse_down(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Event_Mouse_Button *ev;
|
||||
Ecore_X_Window xwin;
|
||||
|
||||
ev = event;
|
||||
if (ev->event_window != input_win) return 1;
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
ecore_x_e_illume_quickpanel_state_set(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
|
||||
ecore_x_e_illume_quickpanel_state_send(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_mouse_wheel(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Event_Mouse_Wheel *ev;
|
||||
Ecore_X_Window xwin;
|
||||
|
||||
ev = event;
|
||||
if (ev->event_window != input_win) return 1;
|
||||
if (ev->z > 0) return 1;
|
||||
xwin = ecore_x_window_root_first_get();
|
||||
ecore_x_e_illume_quickpanel_state_set(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
|
||||
ecore_x_e_illume_quickpanel_state_send(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
|
||||
return 1;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef E_QUICKPANEL_H
|
||||
#define E_QUICKPANEL_H
|
||||
|
||||
#define E_QUICKPANEL_TYPE 0xE1b0990
|
||||
|
||||
typedef struct _E_Quickpanel E_Quickpanel;
|
||||
struct _E_Quickpanel
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
E_Zone *zone;
|
||||
Eina_List *borders;
|
||||
Ecore_Timer *timer;
|
||||
Ecore_Animator *animator;
|
||||
double start, len;
|
||||
int h, adjust, adjust_start, adjust_end;
|
||||
unsigned char visible : 1;
|
||||
};
|
||||
|
||||
int e_quickpanel_init(void);
|
||||
int e_quickpanel_shutdown(void);
|
||||
|
||||
E_Quickpanel *e_quickpanel_new(E_Zone *zone);
|
||||
void e_quickpanel_show(E_Quickpanel *qp);
|
||||
void e_quickpanel_hide(E_Quickpanel *qp);
|
||||
E_Quickpanel *e_quickpanel_by_zone_get(E_Zone *zone);
|
||||
void e_quickpanel_position_update(E_Quickpanel *qp);
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume2
|
||||
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)/keyboards
|
||||
files_DATA = ignore_built_in_keyboards
|
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)/keyboards
|
||||
|
|
@ -1 +0,0 @@
|
|||
/org/freedesktop/Hal/devices/platform_*
|