forked from enlightenment/enlightenment
parent
0111ad6343
commit
581ada3a3f
|
@ -691,6 +691,7 @@ _e_mod_comp_cb_animator(void *data)
|
|||
static void
|
||||
_e_mod_comp_render_queue(E_Comp *c)
|
||||
{
|
||||
if (!c) return;
|
||||
if (_comp_mod->conf->lock_fps)
|
||||
{
|
||||
if (c->render_animator)
|
||||
|
|
|
@ -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_mod_config.c \
|
||||
e_mod_config.h \
|
||||
e_busycover.c \
|
||||
e_busycover.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)
|
Binary file not shown.
|
@ -1,92 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_busycover.h"
|
||||
#include "e_mod_config.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_busycover_cb_free(E_Busycover *cover);
|
||||
|
||||
EAPI E_Busycover *
|
||||
e_busycover_new(E_Win *win)
|
||||
{
|
||||
E_Busycover *cover;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
cover = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_cb_free);
|
||||
if (!cover) return NULL;
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj",
|
||||
il_home_cfg->mod_dir);
|
||||
|
||||
cover->o_base = edje_object_add(e_win_evas_get(win));
|
||||
if (!e_theme_edje_object_set(cover->o_base,
|
||||
"base/theme/modules/illume-home",
|
||||
"modules/illume-home/busycover"))
|
||||
edje_object_file_set(cover->o_base, buff, "modules/illume-home/busycover");
|
||||
edje_object_part_text_set(cover->o_base, "e.text.title", _("LOADING"));
|
||||
evas_object_move(cover->o_base, win->x, win->y);
|
||||
evas_object_resize(cover->o_base, win->w, win->h);
|
||||
evas_object_layer_set(cover->o_base, 999);
|
||||
return cover;
|
||||
}
|
||||
|
||||
EAPI E_Busycover_Handle *
|
||||
e_busycover_push(E_Busycover *cover, const char *msg, const char *icon)
|
||||
{
|
||||
E_Busycover_Handle *handle;
|
||||
|
||||
E_OBJECT_CHECK(cover);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(cover, E_BUSYCOVER_TYPE, NULL);
|
||||
|
||||
handle = E_NEW(E_Busycover_Handle, 1);
|
||||
handle->cover = cover;
|
||||
if (msg) handle->msg = eina_stringshare_add(msg);
|
||||
if (icon) handle->icon = eina_stringshare_add(icon);
|
||||
cover->handles = eina_list_append(cover->handles, handle);
|
||||
edje_object_part_text_set(cover->o_base, "e.text.title", msg);
|
||||
evas_object_show(cover->o_base);
|
||||
return handle;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_busycover_pop(E_Busycover *cover, E_Busycover_Handle *handle)
|
||||
{
|
||||
E_OBJECT_CHECK(cover);
|
||||
E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
|
||||
if (!eina_list_data_find(cover->handles, handle)) return;
|
||||
cover->handles = eina_list_remove(cover->handles, handle);
|
||||
if (handle->msg) eina_stringshare_del(handle->msg);
|
||||
if (handle->icon) eina_stringshare_del(handle->icon);
|
||||
E_FREE(handle);
|
||||
if (cover->handles)
|
||||
{
|
||||
handle = cover->handles->data;
|
||||
edje_object_part_text_set(cover->o_base, "e.text.title", handle->msg);
|
||||
}
|
||||
else
|
||||
evas_object_hide(cover->o_base);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_busycover_resize(E_Busycover *cover, int w, int h)
|
||||
{
|
||||
E_OBJECT_CHECK(cover);
|
||||
E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
|
||||
evas_object_resize(cover->o_base, w, h);
|
||||
}
|
||||
|
||||
/* local function prototypes */
|
||||
static void
|
||||
_e_busycover_cb_free(E_Busycover *cover)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Busycover_Handle *handle;
|
||||
|
||||
EINA_LIST_FREE(cover->handles, handle)
|
||||
{
|
||||
if (handle->msg) eina_stringshare_del(handle->msg);
|
||||
if (handle->icon) eina_stringshare_del(handle->icon);
|
||||
E_FREE(handle);
|
||||
}
|
||||
|
||||
if (cover->o_base) evas_object_del(cover->o_base);
|
||||
E_FREE(cover);
|
||||
}
|
|
@ -1,26 +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;
|
||||
Evas_Object *o_base;
|
||||
Eina_List *handles;
|
||||
};
|
||||
struct _E_Busycover_Handle
|
||||
{
|
||||
E_Busycover *cover;
|
||||
const char *msg, *icon;
|
||||
};
|
||||
|
||||
EAPI E_Busycover *e_busycover_new(E_Win *win);
|
||||
EAPI E_Busycover_Handle *e_busycover_push(E_Busycover *cover, const char *msg, const char *icon);
|
||||
EAPI void e_busycover_pop(E_Busycover *cover, E_Busycover_Handle *handle);
|
||||
EAPI void e_busycover_resize(E_Busycover *cover, int w, int h);
|
||||
|
||||
#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,856 +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, *o_cover;
|
||||
E_Busycover *cover;
|
||||
};
|
||||
struct _Il_Home_Exec
|
||||
{
|
||||
E_Busycover *cover;
|
||||
Efreet_Desktop *desktop;
|
||||
Ecore_Exe *exec;
|
||||
E_Border *border;
|
||||
E_Zone *zone;
|
||||
Ecore_Timer *timeout;
|
||||
int startup_id;
|
||||
pid_t pid;
|
||||
void *handle;
|
||||
};
|
||||
|
||||
/* 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(E_Zone *zone, 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 *handlers = NULL;
|
||||
static Eina_List *exes = 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)
|
||||
{
|
||||
if (!il_home_config_init(m)) return NULL;
|
||||
|
||||
_il_home_apps_unpopulate();
|
||||
_il_home_apps_populate();
|
||||
|
||||
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));
|
||||
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
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(exe->cover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
if (exe->timeout) ecore_timer_del(exe->timeout);
|
||||
E_FREE(exe);
|
||||
}
|
||||
|
||||
_il_home_apps_unpopulate();
|
||||
|
||||
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, "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 = inst->gcc->gadcon->zone->black_win;
|
||||
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;
|
||||
E_Zone *zone;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if (!inst) return;
|
||||
|
||||
hwin = E_OBJECT_ALLOC(Il_Home_Win, IL_HOME_WIN_TYPE,
|
||||
_il_home_win_cb_free);
|
||||
if (!hwin) return;
|
||||
inst->wins = eina_list_append(inst->wins, hwin);
|
||||
|
||||
con = inst->gcc->gadcon->zone->container;
|
||||
zone = inst->gcc->gadcon->zone;
|
||||
|
||||
hwin->win = e_win_new(con);
|
||||
if (!hwin->win)
|
||||
{
|
||||
e_object_del(E_OBJECT(hwin));
|
||||
return;
|
||||
}
|
||||
hwin->win->data = inst;
|
||||
e_win_title_set(hwin->win, _("Illume Home"));
|
||||
e_win_name_class_set(hwin->win, "Illume-Home", "Illume-Home");
|
||||
e_win_resize_callback_set(hwin->win, _il_home_win_cb_resize);
|
||||
|
||||
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_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_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);
|
||||
|
||||
hwin->cover = e_busycover_new(hwin->win);
|
||||
|
||||
e_win_move_resize(hwin->win, zone->x, zone->y, zone->w, 100);
|
||||
e_win_show(hwin->win);
|
||||
e_border_zone_set(hwin->win->border, zone);
|
||||
hwin->win->border->lock_user_stacking = 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->cover) e_object_del(E_OBJECT(hwin->cover));
|
||||
hwin->cover = NULL;
|
||||
|
||||
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);
|
||||
}
|
||||
if (hwin->cover)
|
||||
{
|
||||
if (hwin->win)
|
||||
e_busycover_resize(hwin->cover, 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;
|
||||
if (!(selected = e_fm2_selected_list_get(hwin->o_fm))) 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);
|
||||
}
|
||||
e_fm2_select_set(hwin->o_fm, ici->file, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) &&
|
||||
(exe->border->zone == hwin->win->border->zone))
|
||||
{
|
||||
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(hwin->win->border->zone, 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;
|
||||
exe->cover = hwin->cover;
|
||||
|
||||
eins = e_exec(hwin->win->border->zone, desktop, NULL, NULL, "illume-home");
|
||||
exe->desktop = desktop;
|
||||
exe->zone = hwin->win->border->zone;
|
||||
if (eins)
|
||||
{
|
||||
exe->exec = eins->exe;
|
||||
exe->startup_id = eins->startup_id;
|
||||
if (eins->exe)
|
||||
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(hwin->cover, 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 (eina_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_Menu *entry, *subentry;
|
||||
Eina_List *settings, *sys, *kbd;
|
||||
char buff[PATH_MAX];
|
||||
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;
|
||||
EINA_LIST_FOREACH(entry->entries, ll, subentry)
|
||||
{
|
||||
Efreet_Desktop *desktop;
|
||||
|
||||
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(exe->cover, 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(E_Zone *zone, 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) eina_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 (bd->zone != zone) continue;
|
||||
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(exe->cover, 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->border->zone != exe->zone)
|
||||
{
|
||||
exe->border->zone = exe->zone;
|
||||
exe->border->x = exe->zone->x;
|
||||
exe->border->y = exe->zone->y;
|
||||
exe->border->changes.pos = 1;
|
||||
exe->border->changed = 1;
|
||||
}
|
||||
if (exe->handle)
|
||||
{
|
||||
e_busycover_pop(exe->cover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
if (exe->timeout) ecore_timer_del(exe->timeout);
|
||||
exe->timeout = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (exe->border->zone != exe->zone)
|
||||
{
|
||||
exe->border->zone = exe->zone;
|
||||
exe->border->x = exe->zone->x;
|
||||
exe->border->y = exe->zone->y;
|
||||
exe->border->changes.pos = 1;
|
||||
exe->border->changed = 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(exe->cover, exe->handle);
|
||||
exe->handle = NULL;
|
||||
}
|
||||
exe->border = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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,52 +0,0 @@
|
|||
SUBDIRS = images
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-indicator
|
||||
|
||||
EDJE_CC = @edje_cc@
|
||||
EDJE_FLAGS = -v \
|
||||
-id $(top_srcdir)/src/modules/$(MODULE)/images \
|
||||
@EDJE_DEF@
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj \
|
||||
module.desktop
|
||||
|
||||
EXTRA_DIST = \
|
||||
e-module-$(MODULE).edc \
|
||||
module.desktop.in
|
||||
|
||||
# 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_ind_win.c \
|
||||
e_mod_ind_win.h \
|
||||
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
|
||||
|
||||
e-module-$(MODULE).edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
$(top_srcdir)/src/modules/$(MODULE)/e-module-$(MODULE).edc \
|
||||
$(top_builddir)/src/modules/$(MODULE)/e-module-$(MODULE).edj
|
||||
|
||||
clean-local:
|
||||
rm -f *.edj
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -1,57 +0,0 @@
|
|||
collections
|
||||
{
|
||||
group
|
||||
{
|
||||
images.image: "module_icon.png" COMP;
|
||||
name: "icon";
|
||||
max: 128 128;
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "base";
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image.normal: "module_icon.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group
|
||||
{
|
||||
images.image: "base_bg.png" COMP;
|
||||
name: "modules/illume-indicator/shelf";
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "base";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color_class: "shelf_base";
|
||||
image.normal: "base_bg.png";
|
||||
image.border: 2 2 2 2;
|
||||
fill.smooth: 0;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "e.swallow.content";
|
||||
type: SWALLOW;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1.offset: 3 3;
|
||||
rel2.offset: -4 -4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,424 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_ind_win.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_mod_ind_win_cb_free(Il_Ind_Win *iwin);
|
||||
static void _e_mod_ind_win_cb_hook_eval_end(void *data, void *data2);
|
||||
static void _e_mod_ind_win_cb_resize(E_Win *win);
|
||||
static void _e_mod_ind_win_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _e_mod_ind_win_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _e_mod_ind_win_cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _e_mod_ind_win_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn);
|
||||
static void _e_mod_ind_win_cb_menu_append(Il_Ind_Win *iwin, E_Menu *mn);
|
||||
static void _e_mod_ind_win_cb_menu_pre(void *data, E_Menu *mn);
|
||||
static void _e_mod_ind_win_cb_menu_contents(void *data, E_Menu *mn, E_Menu_Item *mi);
|
||||
static void _e_mod_ind_win_cb_menu_post(void *data, E_Menu *mn);
|
||||
static void _e_mod_ind_win_cb_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_mod_ind_win_cb_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
|
||||
static Evas_Object *_e_mod_ind_win_cb_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
|
||||
|
||||
Il_Ind_Win *
|
||||
e_mod_ind_win_new(E_Zone *zone)
|
||||
{
|
||||
Evas *evas;
|
||||
Il_Ind_Win *iwin;
|
||||
Ecore_X_Window_State states[2];
|
||||
Ecore_X_Illume_Mode mode;
|
||||
|
||||
/* allocate our new indicator window object */
|
||||
iwin = E_OBJECT_ALLOC(Il_Ind_Win, IL_IND_WIN_TYPE, _e_mod_ind_win_cb_free);
|
||||
if (!iwin) return NULL;
|
||||
iwin->zone = zone;
|
||||
|
||||
/* we hook into eval end so we can set this indicator on the right zone */
|
||||
iwin->hook = e_border_hook_add(E_BORDER_HOOK_EVAL_END,
|
||||
_e_mod_ind_win_cb_hook_eval_end, iwin);
|
||||
|
||||
/* create the new indicator window */
|
||||
iwin->win = e_win_new(zone->container);
|
||||
iwin->win->data = iwin;
|
||||
e_win_title_set(iwin->win, _("Illume Indicator"));
|
||||
e_win_name_class_set(iwin->win, "Illume-Indicator", "Illume-Indicator");
|
||||
e_win_resize_callback_set(iwin->win, _e_mod_ind_win_cb_resize);
|
||||
|
||||
/* set this window to not show in taskbar and pager */
|
||||
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);
|
||||
|
||||
/* set this window to not accept or take focus */
|
||||
ecore_x_icccm_hints_set(iwin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
evas = e_win_evas_get(iwin->win);
|
||||
|
||||
/* create our event rectangle */
|
||||
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,
|
||||
_e_mod_ind_win_cb_mouse_down, iwin);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_UP,
|
||||
_e_mod_ind_win_cb_mouse_up, iwin);
|
||||
evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_MOVE,
|
||||
_e_mod_ind_win_cb_mouse_move, iwin);
|
||||
evas_object_show(iwin->o_event);
|
||||
|
||||
/* create our base object */
|
||||
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"))
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-indicator.edj",
|
||||
_ind_mod_dir);
|
||||
edje_object_file_set(iwin->o_base, buff,
|
||||
"modules/illume-indicator/shelf");
|
||||
memset(buff, 0, sizeof(buff));
|
||||
}
|
||||
evas_object_move(iwin->o_base, 0, 0);
|
||||
evas_object_show(iwin->o_base);
|
||||
|
||||
/* create our gadget container */
|
||||
iwin->gadcon = e_gadcon_swallowed_new("illume-indicator", zone->id,
|
||||
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.container",
|
||||
iwin->gadcon->o_container);
|
||||
e_gadcon_min_size_request_callback_set(iwin->gadcon,
|
||||
_e_mod_ind_win_cb_min_size_request, iwin);
|
||||
e_gadcon_size_request_callback_set(iwin->gadcon,
|
||||
_e_mod_ind_win_cb_size_request, iwin);
|
||||
e_gadcon_frame_request_callback_set(iwin->gadcon,
|
||||
_e_mod_ind_win_cb_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,
|
||||
_e_mod_ind_win_cb_menu_items_append, iwin);
|
||||
e_gadcon_populate(iwin->gadcon);
|
||||
|
||||
/* set minimum size of window */
|
||||
e_win_size_min_set(iwin->win, zone->w, (32 * e_scale));
|
||||
|
||||
/* position and resize the window */
|
||||
e_win_move_resize(iwin->win, zone->x, zone->y, zone->w, (32 * e_scale));
|
||||
|
||||
/* show the window */
|
||||
e_win_show(iwin->win);
|
||||
|
||||
/* set this window to be a 'dock' window */
|
||||
ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);
|
||||
|
||||
/* get the current illume mode and lock dragging if we need to */
|
||||
mode = ecore_x_e_illume_mode_get(zone->black_win);
|
||||
if (mode == ECORE_X_ILLUME_MODE_DUAL_TOP)
|
||||
iwin->win->border->client.illume.drag.locked = 0;
|
||||
else
|
||||
iwin->win->border->client.illume.drag.locked = 1;
|
||||
|
||||
/* tell illume conformant apps our position and size */
|
||||
ecore_x_e_illume_top_shelf_geometry_set(ecore_x_window_root_first_get(),
|
||||
zone->x, zone->y, zone->w,
|
||||
(32 * e_scale));
|
||||
return iwin;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_mod_ind_win_cb_free(Il_Ind_Win *iwin)
|
||||
{
|
||||
/* delete the menu */
|
||||
if (iwin->menu)
|
||||
{
|
||||
e_menu_post_deactivate_callback_set(iwin->menu, NULL, NULL);
|
||||
e_object_del(E_OBJECT(iwin->menu));
|
||||
}
|
||||
iwin->menu = NULL;
|
||||
|
||||
/* delete the border hook */
|
||||
if (iwin->hook) e_border_hook_del(iwin->hook);
|
||||
iwin->hook = NULL;
|
||||
|
||||
/* delete the objects */
|
||||
if (iwin->o_event) evas_object_del(iwin->o_event);
|
||||
if (iwin->o_base) evas_object_del(iwin->o_base);
|
||||
|
||||
/* delete the gadget container */
|
||||
e_object_del(E_OBJECT(iwin->gadcon));
|
||||
iwin->gadcon = NULL;
|
||||
|
||||
/* delete the window */
|
||||
e_object_del(E_OBJECT(iwin->win));
|
||||
iwin->win = NULL;
|
||||
|
||||
/* free the object */
|
||||
E_FREE(iwin);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_hook_eval_end(void *data, void *data2)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
if (!(bd = data2)) return;
|
||||
if (bd != iwin->win->border) return;
|
||||
if (bd->zone != iwin->zone)
|
||||
{
|
||||
bd->x = iwin->zone->x;
|
||||
bd->y = iwin->zone->y;
|
||||
bd->changes.pos = 1;
|
||||
bd->changed = 1;
|
||||
bd->lock_user_location = 1;
|
||||
e_border_zone_set(bd, iwin->zone);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_resize(E_Win *win)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = win->data)) return;
|
||||
evas_object_resize(iwin->o_event, win->w, win->h);
|
||||
evas_object_resize(iwin->o_base, win->w, win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_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->button == 1)
|
||||
{
|
||||
iwin->mouse_down = 1;
|
||||
|
||||
/* make sure we are not drag locked */
|
||||
if (iwin->win->border->client.illume.drag.locked) return;
|
||||
|
||||
iwin->drag.start = 1;
|
||||
iwin->drag.dnd = 0;
|
||||
|
||||
/* grab the mouse position */
|
||||
ecore_x_pointer_last_xy_get(NULL, &iwin->drag.y);
|
||||
|
||||
/* change the pointer to indicate we are dragging */
|
||||
if (iwin->win->border->pointer)
|
||||
e_pointer_type_push(iwin->win->border->pointer,
|
||||
iwin->win->border, "move");
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
E_Menu *mn;
|
||||
int x, y;
|
||||
|
||||
/* create the menu */
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _e_mod_ind_win_cb_menu_post,
|
||||
iwin);
|
||||
iwin->menu = mn;
|
||||
|
||||
/* append menu items and show it */
|
||||
_e_mod_ind_win_cb_menu_append(iwin, mn);
|
||||
e_gadcon_canvas_zone_geometry_get(iwin->gadcon, &x, &y, NULL, NULL);
|
||||
e_menu_activate_mouse(mn, iwin->zone,
|
||||
x + ev->output.x, y + ev->output.y,
|
||||
1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
Evas_Event_Mouse_Up *ev;
|
||||
Ecore_X_Window xwin;
|
||||
|
||||
ev = event;
|
||||
if (ev->button != 1) return;
|
||||
if (!(iwin = data)) return;
|
||||
xwin = iwin->win->border->zone->black_win;
|
||||
if ((!iwin->drag.dnd) && (iwin->mouse_down == 1))
|
||||
{
|
||||
/* show the quickpanel */
|
||||
ecore_x_e_illume_quickpanel_state_send
|
||||
(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_ON);
|
||||
}
|
||||
else if (iwin->drag.dnd)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = iwin->win->border;
|
||||
|
||||
/* reset mouse pointer */
|
||||
if (bd->pointer) e_pointer_type_pop(bd->pointer, bd, "move");
|
||||
|
||||
/* tell edj that we are done moving */
|
||||
edje_object_signal_emit(iwin->o_base, "e,action,move,stop", "e");
|
||||
|
||||
/* send msg that we are done dragging */
|
||||
ecore_x_e_illume_drag_end_send(bd->client.win);
|
||||
|
||||
/* update quickpanel position */
|
||||
ecore_x_e_illume_quickpanel_position_update_send(bd->client.win);
|
||||
}
|
||||
iwin->drag.start = 0;
|
||||
iwin->drag.dnd = 0;
|
||||
iwin->drag.y = 0;
|
||||
iwin->mouse_down = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_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;
|
||||
bd = iwin->win->border;
|
||||
|
||||
if (iwin->drag.start)
|
||||
{
|
||||
iwin->drag.dnd = 1;
|
||||
iwin->drag.start = 0;
|
||||
|
||||
/* tell edj that we are gonna start moving */
|
||||
edje_object_signal_emit(iwin->o_base, "e,action,move,start", "e");
|
||||
|
||||
/* send msg that we are gonna start dragging */
|
||||
ecore_x_e_illume_drag_start_send(bd->client.win);
|
||||
}
|
||||
|
||||
/* if we are not dragging, leave */
|
||||
if (!iwin->drag.dnd) return;
|
||||
|
||||
/* make sure we are not gonna drag past the zone boundary */
|
||||
if ((bd->y + bd->h + ev->cur.output.y) >= bd->zone->h) return;
|
||||
|
||||
/* grab mouse position */
|
||||
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 - iwin->drag.y) < dy) return;
|
||||
}
|
||||
else if (ev->cur.output.y < ev->prev.output.y)
|
||||
{
|
||||
if ((iwin->drag.y - py) < dy) return;
|
||||
}
|
||||
else return;
|
||||
|
||||
if (py > iwin->drag.y)
|
||||
ny = bd->y + dy;
|
||||
else if (py < iwin->drag.y)
|
||||
ny = bd->y - dy;
|
||||
else return;
|
||||
|
||||
if (bd->y != ny)
|
||||
{
|
||||
bd->x = bd->zone->x;
|
||||
bd->y = ny;
|
||||
bd->changes.pos = 1;
|
||||
bd->changed = 1;
|
||||
iwin->drag.y = py;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
_e_mod_ind_win_cb_menu_append(iwin, mn);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_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, _e_mod_ind_win_cb_menu_pre, iwin);
|
||||
e_object_data_set(E_OBJECT(mi), iwin);
|
||||
e_menu_item_submenu_set(mi, sm);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_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, _e_mod_ind_win_cb_menu_contents, iwin);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_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 void
|
||||
_e_mod_ind_win_cb_menu_post(void *data, E_Menu *mn)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
if (!(iwin = data)) return;
|
||||
if (!iwin->menu) return;
|
||||
e_object_del(E_OBJECT(iwin->menu));
|
||||
iwin->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_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) return;
|
||||
if (h < (32 * e_scale)) h = (32 * e_scale);
|
||||
edje_extern_object_min_size_set(iwin->gadcon->o_container, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_ind_win_cb_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_e_mod_ind_win_cb_frame_request(void *data, E_Gadcon_Client *gcc, const char *style)
|
||||
{
|
||||
return NULL;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef E_MOD_IND_WIN_H
|
||||
# define E_MOD_IND_WIN_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_Zone *zone;
|
||||
E_Menu *menu;
|
||||
E_Gadcon *gadcon;
|
||||
E_Border_Hook *hook;
|
||||
Evas_Object *o_base, *o_event;
|
||||
struct
|
||||
{
|
||||
int y, start, dnd;
|
||||
} drag;
|
||||
int mouse_down;
|
||||
};
|
||||
|
||||
Il_Ind_Win *e_mod_ind_win_new(E_Zone *zone);
|
||||
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_ind_win.h"
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *iwins = NULL;
|
||||
|
||||
/* external variables */
|
||||
const char *_ind_mod_dir = NULL;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Indicator" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Manager *man;
|
||||
Eina_List *l;
|
||||
|
||||
e_module_priority_set(m, 90);
|
||||
|
||||
/* setup variable to hold module directory */
|
||||
_ind_mod_dir = eina_stringshare_add(m->dir);
|
||||
|
||||
/* loop through the managers (root windows) */
|
||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||
{
|
||||
E_Container *con;
|
||||
Eina_List *cl;
|
||||
|
||||
/* loop through the containers */
|
||||
EINA_LIST_FOREACH(man->containers, cl, con)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Eina_List *zl;
|
||||
|
||||
/* for each zone in this container, create a indicator window */
|
||||
EINA_LIST_FOREACH(con->zones, zl, zone)
|
||||
{
|
||||
Il_Ind_Win *iwin = NULL;
|
||||
|
||||
if (!(iwin = e_mod_ind_win_new(zone))) continue;
|
||||
iwins = eina_list_append(iwins, iwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
Il_Ind_Win *iwin;
|
||||
|
||||
/* destroy the indicator windows */
|
||||
EINA_LIST_FREE(iwins, iwin)
|
||||
{
|
||||
e_object_del(E_OBJECT(iwin));
|
||||
iwin = NULL;
|
||||
}
|
||||
|
||||
/* clear the module directory variable */
|
||||
if (_ind_mod_dir) eina_stringshare_del(_ind_mod_dir);
|
||||
_ind_mod_dir = NULL;
|
||||
|
||||
/* reset indicator geometry for conformant apps to zero */
|
||||
ecore_x_e_illume_top_shelf_geometry_set(ecore_x_window_root_first_get(),
|
||||
0, 0, 0, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
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);
|
||||
|
||||
extern const char *_ind_mod_dir;
|
||||
|
||||
#endif
|
|
@ -1,4 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = base_bg.png \
|
||||
module_icon.png
|
Binary file not shown.
Before Width: | Height: | Size: 125 B |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
|
@ -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,48 +0,0 @@
|
|||
SUBDIRS = images
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume-softkey
|
||||
|
||||
EDJE_CC = @edje_cc@
|
||||
EDJE_FLAGS = -v \
|
||||
-id $(top_srcdir)/src/modules/$(MODULE)/images \
|
||||
@EDJE_DEF@
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj module.desktop
|
||||
|
||||
EXTRA_DIST = \
|
||||
e-module-$(MODULE).edc \
|
||||
module.desktop.in
|
||||
|
||||
# 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_sft_win.c \
|
||||
e_mod_sft_win.h \
|
||||
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
|
||||
|
||||
e-module-$(MODULE).edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
$(top_srcdir)/src/modules/$(MODULE)/e-module-$(MODULE).edc \
|
||||
$(top_builddir)/src/modules/$(MODULE)/e-module-$(MODULE).edj
|
||||
|
||||
clean-local:
|
||||
rm -f *.edj
|
|
@ -1,115 +0,0 @@
|
|||
collections
|
||||
{
|
||||
group
|
||||
{
|
||||
images.image: "module_icon.png" COMP;
|
||||
name: "icon";
|
||||
max: 128 128;
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "base";
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image.normal: "module_icon.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group
|
||||
{
|
||||
images
|
||||
{
|
||||
image: "shelf_alt_bg.png" COMP;
|
||||
image: "shelf_alt_over.png" COMP;
|
||||
image: "shelf_alt_shine.png" COMP;
|
||||
}
|
||||
name: "modules/illume-softkey/window";
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "base";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color_class: "shelf_base";
|
||||
image.normal: "shelf_alt_bg.png";
|
||||
fill.smooth: 0;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "e.swallow.buttons";
|
||||
type: SWALLOW;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 1.0 0.5;
|
||||
fixed: 0 1;
|
||||
rel1
|
||||
{
|
||||
relative: 1.0 0.0;
|
||||
offset: -96 3;
|
||||
}
|
||||
rel2.offset: -4 -4;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "e.swallow.extra_buttons";
|
||||
type: SWALLOW;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 0.0 0.5;
|
||||
fixed: 0 1;
|
||||
rel1.offset: 3 3;
|
||||
rel2
|
||||
{
|
||||
relative: 0.0 1.0;
|
||||
offset: -1 -4;
|
||||
to_x: "e.swallow.buttons";
|
||||
}
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "shine";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
image.normal: "shelf_alt_shine.png";
|
||||
rel2.relative: 1.0 0.5;
|
||||
fill.smooth: 0;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "over";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
image
|
||||
{
|
||||
normal: "shelf_alt_over.png";
|
||||
border: 5 5 5 5;
|
||||
middle: 0;
|
||||
}
|
||||
fill.smooth: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_sft_win.h"
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *swins = NULL;
|
||||
|
||||
/* external variables */
|
||||
const char *_sft_mod_dir = NULL;
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Softkey" };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Manager *man;
|
||||
Eina_List *l;
|
||||
|
||||
e_module_priority_set(m, 85);
|
||||
|
||||
/* setup variable to hold module directory */
|
||||
_sft_mod_dir = eina_stringshare_add(m->dir);
|
||||
|
||||
/* loop through the managers (root windows) */
|
||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||
{
|
||||
E_Container *con;
|
||||
Eina_List *cl;
|
||||
|
||||
/* loop through the containers */
|
||||
EINA_LIST_FOREACH(man->containers, cl, con)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Eina_List *zl;
|
||||
|
||||
/* for each zone in this container, create a new softkey window */
|
||||
EINA_LIST_FOREACH(con->zones, zl, zone)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
|
||||
if (!(swin = e_mod_sft_win_new(zone))) continue;
|
||||
swins = eina_list_append(swins, swin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
|
||||
/* destroy the softkey windows */
|
||||
EINA_LIST_FREE(swins, swin)
|
||||
{
|
||||
e_object_del(E_OBJECT(swin));
|
||||
swin = NULL;
|
||||
}
|
||||
|
||||
/* clear the module directory variable */
|
||||
if (_sft_mod_dir) eina_stringshare_del(_sft_mod_dir);
|
||||
_sft_mod_dir = NULL;
|
||||
|
||||
/* reset bottom panel geometry to zero for conformant apps */
|
||||
ecore_x_e_illume_bottom_panel_geometry_set(ecore_x_window_root_first_get(),
|
||||
0, 0, 0, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
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);
|
||||
|
||||
extern const char *_sft_mod_dir;
|
||||
|
||||
#endif
|
|
@ -1,166 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_sft_win.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_mod_sft_win_cb_free(Il_Sft_Win *swin);
|
||||
static void _e_mod_sft_win_cb_hook_eval_end(void *data, void *data2);
|
||||
static void _e_mod_sft_win_cb_resize(E_Win *win);
|
||||
static void _e_mod_sft_win_cb_back_click(void *data, void *data2);
|
||||
static void _e_mod_sft_win_cb_close_click(void *data, void *data2);
|
||||
|
||||
Il_Sft_Win *
|
||||
e_mod_sft_win_new(E_Zone *zone)
|
||||
{
|
||||
Evas *evas;
|
||||
Il_Sft_Win *swin;
|
||||
Ecore_X_Window_State states[2];
|
||||
|
||||
/* allocate our new softkey window object */
|
||||
swin = E_OBJECT_ALLOC(Il_Sft_Win, IL_SFT_WIN_TYPE, _e_mod_sft_win_cb_free);
|
||||
if (!swin) return NULL;
|
||||
swin->zone = zone;
|
||||
|
||||
/* hook into eval end so we can set on the correct zone */
|
||||
swin->hook = e_border_hook_add(E_BORDER_HOOK_EVAL_END,
|
||||
_e_mod_sft_win_cb_hook_eval_end, swin);
|
||||
|
||||
/* create the new softkey window */
|
||||
swin->win = e_win_new(zone->container);
|
||||
swin->win->data = swin;
|
||||
e_win_title_set(swin->win, _("Illume Softkey"));
|
||||
e_win_name_class_set(swin->win, "Illume-Softkey", "Illume-Softkey");
|
||||
e_win_resize_callback_set(swin->win, _e_mod_sft_win_cb_resize);
|
||||
|
||||
/* set this window to not show in taskbar or pager */
|
||||
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);
|
||||
|
||||
/* set this window to not accept or take focus */
|
||||
ecore_x_icccm_hints_set(swin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
evas = e_win_evas_get(swin->win);
|
||||
|
||||
/* create our base object */
|
||||
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"))
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-softkey.edj",
|
||||
_sft_mod_dir);
|
||||
edje_object_file_set(swin->o_base, buff,
|
||||
"modules/illume-softkey/window");
|
||||
memset(buff, 0, sizeof(buff));
|
||||
}
|
||||
evas_object_move(swin->o_base, 0, 0);
|
||||
evas_object_show(swin->o_base);
|
||||
|
||||
/* create the box object for packing buttons */
|
||||
swin->o_box = e_widget_list_add(evas, 1, 1);
|
||||
edje_object_part_swallow(swin->o_base, "e.swallow.buttons", swin->o_box);
|
||||
|
||||
/* create the back button */
|
||||
swin->b_back =
|
||||
e_widget_button_add(evas, NULL, "go-previous",
|
||||
_e_mod_sft_win_cb_back_click, swin, NULL);
|
||||
e_widget_list_object_append(swin->o_box, swin->b_back, 1, 0, 0.5);
|
||||
|
||||
/* create the close button */
|
||||
swin->b_close =
|
||||
e_widget_button_add(evas, NULL, "window-close",
|
||||
_e_mod_sft_win_cb_close_click, swin, NULL);
|
||||
e_widget_list_object_append(swin->o_box, swin->b_close, 1, 0, 0.5);
|
||||
|
||||
/* set the minimum window size */
|
||||
e_win_size_min_set(swin->win, zone->w, (32 * e_scale));
|
||||
|
||||
/* position and resize the window */
|
||||
e_win_move_resize(swin->win, zone->x, (zone->y + zone->h - (32 * e_scale)),
|
||||
zone->w, (32 * e_scale));
|
||||
|
||||
/* show the window */
|
||||
e_win_show(swin->win);
|
||||
|
||||
/* set this window to be a 'dock' window */
|
||||
ecore_x_netwm_window_type_set(swin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);
|
||||
|
||||
/* tell illume conformant apps our position and size */
|
||||
ecore_x_e_illume_bottom_panel_geometry_set(ecore_x_window_root_first_get(),
|
||||
zone->x, (zone->y + zone->h - (32 * e_scale)),
|
||||
zone->w, (32 * e_scale));
|
||||
return swin;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_mod_sft_win_cb_free(Il_Sft_Win *swin)
|
||||
{
|
||||
/* delete the border hook */
|
||||
if (swin->hook) e_border_hook_del(swin->hook);
|
||||
swin->hook = NULL;
|
||||
|
||||
/* delete the objects */
|
||||
if (swin->b_close) evas_object_del(swin->b_close);
|
||||
if (swin->b_back) evas_object_del(swin->b_back);
|
||||
if (swin->o_box) evas_object_del(swin->o_box);
|
||||
if (swin->o_base) evas_object_del(swin->o_base);
|
||||
|
||||
/* delete the window */
|
||||
e_object_del(E_OBJECT(swin->win));
|
||||
swin->win = NULL;
|
||||
|
||||
/* free the object */
|
||||
E_FREE(swin);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_sft_win_cb_hook_eval_end(void *data, void *data2)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(swin = data)) return;
|
||||
if (!(bd = data2)) return;
|
||||
if (bd != swin->win->border) return;
|
||||
if (bd->zone != swin->zone)
|
||||
{
|
||||
bd->x = swin->zone->x;
|
||||
bd->y = (swin->zone->h - bd->h);
|
||||
bd->changes.pos = 1;
|
||||
bd->changed = 1;
|
||||
bd->lock_user_location = 1;
|
||||
e_border_zone_set(bd, swin->zone);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_sft_win_cb_resize(E_Win *win)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
|
||||
if (!(swin = win->data)) return;
|
||||
evas_object_resize(swin->o_base, swin->win->w, swin->win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_sft_win_cb_back_click(void *data, void *data2)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
|
||||
if (!(swin = data)) return;
|
||||
ecore_x_e_illume_back_send(swin->zone->black_win);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_sft_win_cb_close_click(void *data, void *data2)
|
||||
{
|
||||
Il_Sft_Win *swin;
|
||||
|
||||
if (!(swin = data)) return;
|
||||
ecore_x_e_illume_close_send(swin->zone->black_win);
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef E_MOD_SFT_WIN_H
|
||||
# define E_MOD_SFT_WIN_H
|
||||
|
||||
# define IL_SFT_WIN_TYPE 0xE1b0784
|
||||
|
||||
typedef struct _Il_Sft_Win Il_Sft_Win;
|
||||
struct _Il_Sft_Win
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Win *win;
|
||||
E_Zone *zone;
|
||||
E_Border_Hook *hook;
|
||||
Evas_Object *o_base, *o_box;
|
||||
Evas_Object *b_close, *b_back;
|
||||
};
|
||||
|
||||
Il_Sft_Win *e_mod_sft_win_new(E_Zone *zone);
|
||||
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = shelf_alt_bg.png \
|
||||
shelf_alt_shine.png \
|
||||
module_icon.png \
|
||||
shelf_alt_over.png
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 502 B |
Binary file not shown.
Before Width: | Height: | Size: 393 B |
|
@ -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,141 +0,0 @@
|
|||
#ifndef E_ILLUME_H
|
||||
# define E_ILLUME_H
|
||||
|
||||
# include "e.h"
|
||||
|
||||
# define E_ILLUME_LAYOUT_API_VERSION 1
|
||||
# define E_ILLUME_LAYOUT_POLICY_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;
|
||||
typedef struct _E_Illume_Config_Zone E_Illume_Config_Zone;
|
||||
|
||||
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 (*border_property_change) (E_Border *bd, Ecore_X_Event_Window_Property *event);
|
||||
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;
|
||||
Eina_List *zones;
|
||||
} policy;
|
||||
|
||||
// Not User Configurable. Placeholders
|
||||
const char *mod_dir;
|
||||
E_Config_Dialog *cfd;
|
||||
};
|
||||
|
||||
struct _E_Illume_Config_Zone
|
||||
{
|
||||
int id;
|
||||
struct
|
||||
{
|
||||
int dual, side;
|
||||
} mode;
|
||||
};
|
||||
|
||||
EAPI Eina_List *e_illume_layout_policies_get(void);
|
||||
EAPI E_Illume_Config_Zone *e_illume_zone_config_get(int id);
|
||||
|
||||
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 *w, int *h);
|
||||
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 *w, int *h);
|
||||
|
||||
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,52 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in module.desktop
|
||||
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
|
||||
|
||||
module_la_SOURCES = E_Illume.h \
|
||||
e_mod_main.h \
|
||||
e_mod_main.c \
|
||||
e_mod_config.h \
|
||||
e_mod_config.c \
|
||||
e_mod_layout.h \
|
||||
e_mod_layout.c \
|
||||
e_mod_policy.h \
|
||||
e_mod_policy.c \
|
||||
e_mod_animation.h \
|
||||
e_mod_animation.c \
|
||||
e_mod_windows.h \
|
||||
e_mod_windows.c \
|
||||
e_mod_select_window.h \
|
||||
e_mod_select_window.c \
|
||||
e_kbd.h \
|
||||
e_kbd.c \
|
||||
e_kbd_dbus.h \
|
||||
e_kbd_dbus.c \
|
||||
e_quickpanel.h \
|
||||
e_quickpanel.c \
|
||||
e_illume_border.c
|
||||
|
||||
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)
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)/policies
|
Binary file not shown.
|
@ -1,449 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_kbd.h"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_keyboard(E_Border *bd)
|
||||
{
|
||||
if (bd->client.vkbd.vkbd) return 1;
|
||||
if (il_cfg->policy.vkbd.match.title)
|
||||
{
|
||||
const char *title;
|
||||
|
||||
title = e_border_name_get(bd);
|
||||
if (!strcmp(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;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_bottom_panel(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.softkey.match.title)
|
||||
{
|
||||
const char *title;
|
||||
|
||||
title = e_border_name_get(bd);
|
||||
if (!strcmp(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;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_top_shelf(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.indicator.match.title)
|
||||
{
|
||||
const char *title;
|
||||
|
||||
title = e_border_name_get(bd);
|
||||
if (!strcmp(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;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_is_home(E_Border *bd)
|
||||
{
|
||||
if (il_cfg->policy.home.match.title)
|
||||
{
|
||||
char *title;
|
||||
|
||||
title = bd->client.netwm.name;
|
||||
if (!title) title = bd->client.icccm.title;
|
||||
if ((title) &&
|
||||
(!strcmp(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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_valid(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;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_valid(bd)) continue;
|
||||
return bd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_illume_border_valid_count_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *l;
|
||||
int count;
|
||||
|
||||
if (!(l = e_illume_border_valid_borders_get(zone))) return 0;
|
||||
count = eina_list_count(l);
|
||||
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;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
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;
|
||||
|
||||
if (!(l = e_illume_border_quickpanel_borders_get(zone))) return 0;
|
||||
count = eina_list_count(l);
|
||||
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;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_REVERSE_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_valid(bd)) continue;
|
||||
if ((bd->x == x) && (bd->y == y)) return bd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (!(bds = e_illume_border_valid_borders_get(zone))) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (E_INSIDE(bd->x, bd->fx.y, x, y, w, h))
|
||||
{
|
||||
b = bd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bds = eina_list_free(bds);
|
||||
return b;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_keyboard_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_keyboard(bd)) continue;
|
||||
return bd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_top_shelf_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_top_shelf(bd)) continue;
|
||||
return bd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI E_Border *
|
||||
e_illume_border_bottom_panel_get(E_Zone *zone)
|
||||
{
|
||||
Eina_List *bds, *l;
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bds = e_border_client_list())) return NULL;
|
||||
EINA_LIST_FOREACH(bds, l, bd)
|
||||
{
|
||||
if (bd->zone != zone) continue;
|
||||
if (!e_illume_border_is_bottom_panel(bd)) continue;
|
||||
return bd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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,681 +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;
|
||||
|
||||
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));
|
||||
|
||||
e_kbd_dbus_shutdown();
|
||||
|
||||
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;
|
||||
kbd->layout = E_KBD_LAYOUT_ALPHA;
|
||||
kbds = eina_list_append(kbds, kbd);
|
||||
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->disabled) return;
|
||||
if (focused_border)
|
||||
{
|
||||
if (kbd->border->zone != focused_border->zone)
|
||||
e_border_zone_set(kbd->border, focused_border->zone);
|
||||
e_border_move(kbd->border, focused_border->zone->x, kbd->border->y);
|
||||
}
|
||||
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 (!kbd->border) continue;
|
||||
if (kbd->border->zone != zone) continue;
|
||||
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;
|
||||
|
||||
if (!(kbd = data)) return 0;
|
||||
|
||||
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) || (!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) return;
|
||||
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;
|
||||
#ifdef ICONIFY_TO_HIDE
|
||||
e_border_uniconify(bd);
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
if ((!kbd) || (!bd)) return;
|
||||
|
||||
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) return 0;
|
||||
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) return;
|
||||
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)
|
||||
{
|
||||
if (!kbd) return;
|
||||
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 (focused_border)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
_e_kbd_all_hide();
|
||||
else
|
||||
{
|
||||
if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
|
||||
else if (focused_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_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 (!ev->border->focused) return 1;
|
||||
if (_e_kbd_by_border_get(ev->border)) return 1;
|
||||
if (focused_border)
|
||||
{
|
||||
if ((ev->border == focused_border) &&
|
||||
(ev->border->client.vkbd.state == focused_vkbd_state)) return 1;
|
||||
}
|
||||
focused_vkbd_state = ev->border->client.vkbd.state;
|
||||
if (focused_vkbd_state == 0) return 1;
|
||||
|
||||
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);
|
||||
|
||||
/* app wants kbd off - then kbd off it is */
|
||||
if (focused_vkbd_state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
_e_kbd_all_hide();
|
||||
/* app wants something other than off... */
|
||||
else
|
||||
{
|
||||
if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
|
||||
else if (focused_vkbd_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
|
||||
_e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
|
||||
else if (focused_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;
|
||||
}
|
||||
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,280 +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_dev_add)
|
||||
e_dbus_signal_handler_del(dbus_conn, dbus_dev_add);
|
||||
if (dbus_dev_del)
|
||||
e_dbus_signal_handler_del(dbus_conn, dbus_dev_del);
|
||||
if (dbus_dev_chg)
|
||||
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))
|
||||
{
|
||||
if (udi)
|
||||
{
|
||||
_e_kbd_dbus_kbd_add(udi);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
free(udi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (!udi) return;
|
||||
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;
|
||||
|
||||
if (!udi) return;
|
||||
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;
|
||||
|
||||
dbus_error_init(&err);
|
||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
||||
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 (cap)
|
||||
{
|
||||
if (!strcmp(cap, "input.keyboard"))
|
||||
{
|
||||
if (udi)
|
||||
{
|
||||
_e_kbd_dbus_kbd_add(udi);
|
||||
_e_kbd_dbus_kbd_eval();
|
||||
free(udi);
|
||||
}
|
||||
}
|
||||
free(cap);
|
||||
}
|
||||
}
|
|
@ -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,124 +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);
|
||||
if (!v) return;
|
||||
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);
|
||||
if (!cfd) return;
|
||||
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);
|
||||
_anim_change_timer = NULL;
|
||||
}
|
||||
|
||||
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,237 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_policy.h"
|
||||
#include "e_mod_animation.h"
|
||||
#include "e_mod_windows.h"
|
||||
|
||||
/* local variables */
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
static E_Config_DD *conf_zone_edd = NULL;
|
||||
|
||||
/* public variables */
|
||||
EAPI E_Illume_Config*il_cfg = NULL;
|
||||
|
||||
int
|
||||
e_mod_config_init(E_Module *m)
|
||||
{
|
||||
conf_zone_edd = E_CONFIG_DD_NEW("Illume_Cfg_Zone", E_Illume_Config_Zone);
|
||||
E_CONFIG_VAL(conf_zone_edd, E_Illume_Config_Zone, id, INT);
|
||||
E_CONFIG_VAL(conf_zone_edd, E_Illume_Config_Zone, mode.dual, INT);
|
||||
E_CONFIG_VAL(conf_zone_edd, E_Illume_Config_Zone, mode.side, INT);
|
||||
|
||||
conf_edd = E_CONFIG_DD_NEW("Illume_Cfg", E_Illume_Config);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, version, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, sliding.kbd.duration, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, sliding.softkey.duration, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, sliding.quickpanel.duration, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.name, STR);
|
||||
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.class, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.name, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.title, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.win_type, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.match.class, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.match.name, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.match.title, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.vkbd.match.win_type, INT);
|
||||
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.class, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.name, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.title, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.win_type, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.match.class, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.match.name, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.match.title, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.softkey.match.win_type, INT);
|
||||
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.class, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.name, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.title, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.win_type, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.match.class, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.match.name, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.match.title, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.home.match.win_type, INT);
|
||||
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.class, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.name, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.title, STR);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.win_type, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.match.class, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.match.name, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.match.title, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Illume_Config, policy.indicator.match.win_type, INT);
|
||||
|
||||
E_CONFIG_LIST(conf_edd, E_Illume_Config, policy.zones, conf_zone_edd);
|
||||
|
||||
/* load the config */
|
||||
il_cfg = e_config_domain_load("module.illume2", conf_edd);
|
||||
if ((il_cfg) && ((il_cfg->version >> 16) < IL_CONFIG_MAJ))
|
||||
E_FREE(il_cfg);
|
||||
|
||||
if (!il_cfg)
|
||||
{
|
||||
E_Illume_Config_Zone *cz;
|
||||
|
||||
cz = E_NEW(E_Illume_Config_Zone, 1);
|
||||
cz->id = 0;
|
||||
cz->mode.dual = 0;
|
||||
cz->mode.side = 0;
|
||||
|
||||
il_cfg = E_NEW(E_Illume_Config, 1);
|
||||
il_cfg->version = 0;
|
||||
il_cfg->sliding.kbd.duration = 1000;
|
||||
il_cfg->sliding.softkey.duration = 1000;
|
||||
il_cfg->sliding.quickpanel.duration = 1000;
|
||||
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;
|
||||
il_cfg->policy.zones = eina_list_append(il_cfg->policy.zones, cz);
|
||||
}
|
||||
if (il_cfg)
|
||||
{
|
||||
/* Add new config variables here */
|
||||
/* if ((il_cfg->version & 0xffff) < 1) */
|
||||
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/policy", 0, _("Policy"),
|
||||
NULL, "enlightenment/policy",
|
||||
il_config_policy_show);
|
||||
e_configure_registry_generic_item_add("illume/windows", 0, _("Windows"),
|
||||
NULL, "enlightenment/windows",
|
||||
il_config_windows_show);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_config_shutdown(void)
|
||||
{
|
||||
E_Illume_Config_Zone *cz;
|
||||
|
||||
e_configure_registry_item_del("illume/windows");
|
||||
e_configure_registry_item_del("illume/policy");
|
||||
e_configure_registry_item_del("illume/animation");
|
||||
e_configure_registry_category_del("illume");
|
||||
|
||||
if (il_cfg->mod_dir) eina_stringshare_del(il_cfg->mod_dir);
|
||||
il_cfg->mod_dir = NULL;
|
||||
|
||||
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);
|
||||
|
||||
EINA_LIST_FREE(il_cfg->policy.zones, cz)
|
||||
E_FREE(cz);
|
||||
|
||||
E_FREE(il_cfg);
|
||||
|
||||
E_CONFIG_DD_FREE(conf_zone_edd);
|
||||
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;
|
||||
}
|
||||
|
||||
EAPI E_Illume_Config_Zone *
|
||||
e_illume_zone_config_get(int id)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Illume_Config_Zone *cz = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(il_cfg->policy.zones, l, cz)
|
||||
{
|
||||
if (cz->id != id) continue;
|
||||
return cz;
|
||||
}
|
||||
|
||||
/* didn't find any existing config. Create new one as fallback */
|
||||
cz = E_NEW(E_Illume_Config_Zone, 1);
|
||||
cz->id = id;
|
||||
cz->mode.dual = 0;
|
||||
cz->mode.side = 0;
|
||||
il_cfg->policy.zones = eina_list_append(il_cfg->policy.zones, cz);
|
||||
e_mod_config_save();
|
||||
return cz;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef E_MOD_CONFIG_H
|
||||
# define E_MOD_CONFIG_H
|
||||
|
||||
# define IL_CONFIG_MIN 1
|
||||
# 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,592 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_layout.h"
|
||||
#include "e_mod_main.h" // For logging functions
|
||||
#include "e_quickpanel.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static const char *_e_mod_layout_policy_find(void);
|
||||
static int _e_mod_layout_policy_load(const char *dir);
|
||||
static void _e_mod_layout_policy_free(E_Illume_Layout_Policy *p);
|
||||
static void _e_mod_layout_hooks_add(void);
|
||||
static void _e_mod_layout_handlers_add(void);
|
||||
static void _e_mod_layout_cb_hook_post_fetch(void *data, void *data2);
|
||||
static void _e_mod_layout_cb_hook_post_assign(void *data, void *data2);
|
||||
static void _e_mod_layout_cb_hook_layout(void *data, void *data2);
|
||||
static int _e_mod_layout_cb_policy_change(void *data, int type, void *event);
|
||||
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_border_property_change(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);
|
||||
|
||||
/* local variables */
|
||||
static E_Illume_Layout_Policy *policy = NULL;
|
||||
static Eina_List *hooks = NULL, *handlers = NULL;
|
||||
|
||||
/* public variables */
|
||||
EAPI int E_ILLUME_EVENT_POLICY_CHANGE = 0;
|
||||
|
||||
int
|
||||
e_mod_layout_init(void)
|
||||
{
|
||||
const char *file;
|
||||
|
||||
/* find the policy specified in config */
|
||||
file = _e_mod_layout_policy_find();
|
||||
if (!file) return 0;
|
||||
|
||||
/* try to load the policy */
|
||||
if (!_e_mod_layout_policy_load(file)) return 0;
|
||||
|
||||
/* add our border hooks */
|
||||
_e_mod_layout_hooks_add();
|
||||
|
||||
/* add event type FIRST */
|
||||
E_ILLUME_EVENT_POLICY_CHANGE = ecore_event_type_new();
|
||||
|
||||
/* add our event handlers */
|
||||
_e_mod_layout_handlers_add();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mod_layout_shutdown(void)
|
||||
{
|
||||
Ecore_Event_Handler *handler;
|
||||
E_Border_Hook *hook;
|
||||
|
||||
E_ILLUME_EVENT_POLICY_CHANGE = 0;
|
||||
|
||||
/* remove the ecore event handlers */
|
||||
EINA_LIST_FREE(handlers, handler)
|
||||
ecore_event_handler_del(handler);
|
||||
|
||||
/* remove the border hooks */
|
||||
EINA_LIST_FREE(hooks, hook)
|
||||
e_border_hook_del(hook);
|
||||
|
||||
/* destroy the policy if it exists */
|
||||
if (policy) e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
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);
|
||||
if (!files) return NULL;
|
||||
|
||||
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_POLICY_TYPE,
|
||||
_e_mod_layout_policy_free);
|
||||
if (!p) continue;
|
||||
|
||||
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;
|
||||
}
|
||||
if (file) free(file);
|
||||
l = eina_list_append(l, p);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static const char *
|
||||
_e_mod_layout_policy_find(void)
|
||||
{
|
||||
Eina_List *files;
|
||||
char buff[PATH_MAX], dir[PATH_MAX], *file;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name);
|
||||
snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
|
||||
e_prefix_lib_get());
|
||||
|
||||
/* get all files in this directory */
|
||||
files = ecore_file_ls(dir);
|
||||
if (!files) return NULL;
|
||||
|
||||
/* loop through the files, searching for this policy */
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
/* compare file with needed .so */
|
||||
if (!strcmp(file, buff))
|
||||
{
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/%s",
|
||||
e_prefix_lib_get(), file);
|
||||
break;
|
||||
}
|
||||
free(file);
|
||||
}
|
||||
if (file) free(file);
|
||||
else
|
||||
{
|
||||
/* if we did not find the policy, use a fallback */
|
||||
snprintf(dir, sizeof(dir),
|
||||
"%s/enlightenment/modules/illume2/policies/illume.so",
|
||||
e_prefix_lib_get());
|
||||
}
|
||||
return strdup(dir);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_policy_load(const char *dir)
|
||||
{
|
||||
if (!dir) return 0;
|
||||
|
||||
/* delete existing policy first */
|
||||
if (policy) e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
|
||||
/* create new policy object */
|
||||
policy =
|
||||
E_OBJECT_ALLOC(E_Illume_Layout_Policy, E_ILLUME_LAYOUT_POLICY_TYPE,
|
||||
_e_mod_layout_policy_free);
|
||||
if (!policy) return 0;
|
||||
|
||||
/* attempt to open .so */
|
||||
policy->handle = dlopen(dir, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!policy->handle)
|
||||
{
|
||||
/* open failed, bail out */
|
||||
E_ILLUME_ERR("Error Opening Policy: %s", dir);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* try to link to the needed policy api functions */
|
||||
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");
|
||||
|
||||
/* check the policy supports needed api functions */
|
||||
if ((!policy->api) || (!policy->funcs.init) || (!policy->funcs.shutdown))
|
||||
{
|
||||
/* policy doesn't support what we need, bail out */
|
||||
E_ILLUME_ERR("Policy does not support needed functions: %s", dir);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check policy api version */
|
||||
if (policy->api->version < E_ILLUME_LAYOUT_API_VERSION)
|
||||
{
|
||||
E_ILLUME_ERR("Policy is too old: %s", dir);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* initialize the policy */
|
||||
if (!policy->funcs.init(policy))
|
||||
{
|
||||
E_ILLUME_ERR("Policy failed to initialize: %s", dir);
|
||||
e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_policy_free(E_Illume_Layout_Policy *p)
|
||||
{
|
||||
/* call the policy shutdown function if we can */
|
||||
if (p->funcs.shutdown) p->funcs.shutdown(p);
|
||||
p->funcs.shutdown = NULL;
|
||||
|
||||
p->funcs.init = NULL;
|
||||
p->api = NULL;
|
||||
|
||||
/* close the linked .so */
|
||||
if (p->handle) dlclose(p->handle);
|
||||
p->handle = NULL;
|
||||
|
||||
E_FREE(p);
|
||||
}
|
||||
|
||||
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_assign, NULL));
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
|
||||
_e_mod_layout_cb_hook_layout, NULL));
|
||||
}
|
||||
|
||||
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));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
|
||||
_e_mod_layout_cb_border_property_change,
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_fetch(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if ((bd->stolen) || (!bd->new_client)) return;
|
||||
if (bd->remember)
|
||||
{
|
||||
if (bd->bordername)
|
||||
{
|
||||
eina_stringshare_del(bd->bordername);
|
||||
bd->bordername = NULL;
|
||||
}
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
||||
bd->client.border.changed = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_assign(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if (bd->stolen) return;
|
||||
bd->lock_client_shade = 1;
|
||||
bd->lock_client_maximize = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_layout(void *data, void *data2)
|
||||
{
|
||||
E_Container *con;
|
||||
E_Zone *zone;
|
||||
Eina_List *l;
|
||||
|
||||
if (!(con = data2)) return;
|
||||
EINA_LIST_FOREACH(con->zones, l, zone)
|
||||
{
|
||||
if ((policy) && (policy->funcs.zone_layout))
|
||||
policy->funcs.zone_layout(zone);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_policy_change(void *data, int type, void *event)
|
||||
{
|
||||
const char *file;
|
||||
|
||||
if (type != E_ILLUME_EVENT_POLICY_CHANGE) return 1;
|
||||
|
||||
if (policy) e_object_del(E_OBJECT(policy));
|
||||
policy = NULL;
|
||||
|
||||
/* find the policy specified in config */
|
||||
file = _e_mod_layout_policy_find();
|
||||
if (!file) return 1;
|
||||
|
||||
/* try to load the policy */
|
||||
if (!_e_mod_layout_policy_load(file)) return 1;
|
||||
|
||||
return 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 (e_illume_border_is_quickpanel(ev->border))
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (qp = e_quickpanel_by_zone_get(ev->border->zone))
|
||||
qp->borders = eina_list_remove(qp->borders, ev->border);
|
||||
}
|
||||
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_border_property_change(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Window_Property *ev;
|
||||
E_Border *bd;
|
||||
|
||||
ev = event;
|
||||
if (!(bd = e_border_find_by_client_window(ev->win))) return 1;
|
||||
if ((policy) && (policy->funcs.border_property_change))
|
||||
policy->funcs.border_property_change(bd, ev);
|
||||
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_Manager *man;
|
||||
E_Container *con;
|
||||
E_Zone *zone;
|
||||
Eina_List *l, *ll, *lll;
|
||||
int lock = 1;
|
||||
|
||||
EINA_LIST_FOREACH(e_manager_list(), lll, man)
|
||||
EINA_LIST_FOREACH(man->containers, ll, con)
|
||||
EINA_LIST_FOREACH(con->zones, l, zone)
|
||||
{
|
||||
if (zone->black_win == ev->win)
|
||||
{
|
||||
E_Illume_Config_Zone *cz;
|
||||
|
||||
cz = e_illume_zone_config_get(zone->id);
|
||||
if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
|
||||
cz->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(zone->black_win);
|
||||
cz->mode.dual = 1;
|
||||
cz->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(zone->black_win);
|
||||
cz->mode.dual = 1;
|
||||
cz->mode.side = 1;
|
||||
}
|
||||
else
|
||||
cz->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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_BACK)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Eina_List *focused, *l, *f2 = NULL;
|
||||
E_Border *fbd;
|
||||
|
||||
zone = e_util_zone_window_find(ev->win);
|
||||
if (!zone) return 1;
|
||||
|
||||
focused = e_border_focus_stack_get();
|
||||
if (!focused) return 1;
|
||||
|
||||
EINA_LIST_FOREACH(focused, l, fbd)
|
||||
{
|
||||
if (fbd->zone != zone) continue;
|
||||
f2 = eina_list_append(f2, fbd);
|
||||
}
|
||||
|
||||
if (!f2) return 1;
|
||||
if (eina_list_count(f2) < 1) return 1;
|
||||
|
||||
EINA_LIST_REVERSE_FOREACH(f2, l, fbd)
|
||||
{
|
||||
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 == e_border_focused_get())
|
||||
{
|
||||
E_Border *fb;
|
||||
|
||||
if (!(fb = f2->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;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef E_MOD_LAYOUT_H
|
||||
# define E_MOD_LAYOUT_H
|
||||
|
||||
int e_mod_layout_init(void);
|
||||
int e_mod_layout_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -1,163 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_config.h"
|
||||
#include "e_mod_layout.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_quickpanel.h"
|
||||
|
||||
/* local variabels */
|
||||
static E_Kbd *kbd = NULL;
|
||||
Eina_List *quickpanels = 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)
|
||||
{
|
||||
E_Manager *man;
|
||||
E_Container *con;
|
||||
E_Zone *zone;
|
||||
Eina_List *l, *ll, *lll;
|
||||
Ecore_X_Window *zones = NULL;
|
||||
unsigned int i = 0, zone_count = 0;
|
||||
|
||||
/* setup eina logging */
|
||||
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 illume2 logging domain");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* set module priority */
|
||||
e_module_priority_set(m, 100);
|
||||
|
||||
/* initialize the config subsystem */
|
||||
if (!e_mod_config_init(m))
|
||||
{
|
||||
/* cleanup eina logging */
|
||||
if (_e_illume_log_dom > 0)
|
||||
{
|
||||
eina_log_domain_unregister(_e_illume_log_dom);
|
||||
_e_illume_log_dom = -1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* initialize the layout subsystem */
|
||||
if (!e_mod_layout_init())
|
||||
{
|
||||
/* shutdown config subsystem */
|
||||
e_mod_config_shutdown();
|
||||
|
||||
/* cleanup eina logging */
|
||||
if (_e_illume_log_dom > 0)
|
||||
{
|
||||
eina_log_domain_unregister(_e_illume_log_dom);
|
||||
_e_illume_log_dom = -1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* initialize the keyboard subsystem */
|
||||
e_kbd_init();
|
||||
|
||||
/* create a new vkbd */
|
||||
kbd = e_kbd_new();
|
||||
|
||||
/* initialize the quickpanel subsystem */
|
||||
e_quickpanel_init();
|
||||
|
||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||
EINA_LIST_FOREACH(man->containers, ll, con)
|
||||
zone_count += eina_list_count(con->zones);
|
||||
|
||||
if (zone_count > 0)
|
||||
{
|
||||
zones = calloc(zone_count, sizeof(Ecore_X_Window));
|
||||
|
||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||
{
|
||||
i = 0;
|
||||
EINA_LIST_FOREACH(man->containers, ll, con)
|
||||
EINA_LIST_FOREACH(con->zones, lll, zone)
|
||||
{
|
||||
Ecore_X_Illume_Mode mode;
|
||||
E_Illume_Config_Zone *cz;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
/* create a new quickpanel */
|
||||
if (!(qp = e_quickpanel_new(zone))) continue;
|
||||
quickpanels = eina_list_append(quickpanels, qp);
|
||||
|
||||
mode = ECORE_X_ILLUME_MODE_SINGLE;
|
||||
cz = e_illume_zone_config_get(zone->id);
|
||||
if (cz)
|
||||
{
|
||||
if (cz->mode.dual == 0)
|
||||
mode = ECORE_X_ILLUME_MODE_SINGLE;
|
||||
else
|
||||
{
|
||||
if (cz->mode.side == 0)
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
|
||||
else
|
||||
mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
|
||||
}
|
||||
}
|
||||
ecore_x_e_illume_mode_set(zone->black_win, mode);
|
||||
zones[i++] = zone->black_win;
|
||||
}
|
||||
if (i > 0)
|
||||
ecore_x_e_illume_zone_list_set(man->root, zones, i);
|
||||
}
|
||||
E_FREE(zones);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
/* cleanup the quickpanels */
|
||||
EINA_LIST_FREE(quickpanels, qp)
|
||||
e_object_del(E_OBJECT(qp));
|
||||
|
||||
/* cleanup the keyboard */
|
||||
e_object_del(E_OBJECT(kbd));
|
||||
kbd = NULL;
|
||||
|
||||
/* shutdown the quickpanel subsystem */
|
||||
e_quickpanel_shutdown();
|
||||
|
||||
/* shutdown the keyboard subsystem */
|
||||
e_kbd_shutdown();
|
||||
|
||||
/* shutdown the layout subsystem */
|
||||
e_mod_layout_shutdown();
|
||||
|
||||
/* shutdown the config subsystem */
|
||||
e_mod_config_shutdown();
|
||||
|
||||
/* cleanup eina logging */
|
||||
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,38 +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);
|
||||
|
||||
extern Eina_List *quickpanels;
|
||||
|
||||
#endif
|
|
@ -1,120 +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);
|
||||
if (!v) return;
|
||||
|
||||
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);
|
||||
if (!cfd) return;
|
||||
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();
|
||||
if (policies)
|
||||
{
|
||||
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,277 +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;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (!v) return;
|
||||
|
||||
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);
|
||||
if (!cfd) return;
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
stype = type;
|
||||
}
|
||||
|
||||
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();
|
||||
if (bds)
|
||||
{
|
||||
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;
|
||||
if (!(name = e_border_name_get(bd))) continue;
|
||||
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,221 +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);
|
||||
if (!v) return;
|
||||
|
||||
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);
|
||||
if (!cfd) return;
|
||||
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);
|
||||
_windows_change_timer = NULL;
|
||||
}
|
||||
|
||||
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,439 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_quickpanel.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_quickpanel_hide(E_Quickpanel *qp);
|
||||
static void _e_quickpanel_slide(E_Quickpanel *qp, int visible, double len);
|
||||
static void _e_quickpanel_border_show(E_Border *bd);
|
||||
static void _e_quickpanel_border_hide(E_Border *bd);
|
||||
static E_Quickpanel *_e_quickpanel_by_border_get(E_Border *bd);
|
||||
static void _e_quickpanel_cb_free(E_Quickpanel *qp);
|
||||
static int _e_quickpanel_cb_delay_hide(void *data);
|
||||
static int _e_quickpanel_cb_animate(void *data);
|
||||
static int _e_quickpanel_cb_border_add(void *data, int type, void *event);
|
||||
static int _e_quickpanel_cb_client_message(void *data, int type, void *event);
|
||||
static int _e_quickpanel_cb_mouse_down(void *data, int type, void *event);
|
||||
static void _e_quickpanel_cb_post_fetch(void *data, void *data2);
|
||||
|
||||
/* local variables */
|
||||
static Eina_List *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(E_EVENT_BORDER_ADD,
|
||||
_e_quickpanel_cb_border_add,
|
||||
NULL));
|
||||
hooks =
|
||||
eina_list_append(hooks,
|
||||
e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
|
||||
_e_quickpanel_cb_post_fetch, NULL));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_quickpanel_shutdown(void)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
return qp;
|
||||
}
|
||||
|
||||
void
|
||||
e_quickpanel_show(E_Quickpanel *qp)
|
||||
{
|
||||
if (qp->timer) ecore_timer_del(qp->timer);
|
||||
qp->timer = NULL;
|
||||
if ((qp->visible) || (!qp->borders)) return;
|
||||
e_illume_border_top_shelf_size_get(qp->zone, NULL, &qp->top_height);
|
||||
|
||||
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;
|
||||
|
||||
ny = qp->top_height;
|
||||
if (qp->borders)
|
||||
{
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
if (!bd->visible) _e_quickpanel_border_show(bd);
|
||||
e_border_fx_offset(bd, 0, ny);
|
||||
ny += bd->h;
|
||||
}
|
||||
}
|
||||
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(quickpanels, 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 = 0;
|
||||
|
||||
if (!qp) return;
|
||||
e_quickpanel_hide(qp);
|
||||
e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
|
||||
if (qp->borders)
|
||||
{
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
e_border_move(bd, qp->zone->x, ty);
|
||||
}
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_quickpanel_hide(E_Quickpanel *qp)
|
||||
{
|
||||
if (!qp) return;
|
||||
if (qp->timer) ecore_timer_del(qp->timer);
|
||||
qp->timer = NULL;
|
||||
if (!qp->visible) return;
|
||||
e_illume_border_top_shelf_size_get(qp->zone, NULL, &qp->top_height);
|
||||
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;
|
||||
|
||||
if (qp->borders)
|
||||
{
|
||||
EINA_LIST_REVERSE_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
e_border_fx_offset(bd, 0, 0);
|
||||
if (bd->visible) _e_quickpanel_border_hide(bd);
|
||||
}
|
||||
}
|
||||
qp->visible = 0;
|
||||
}
|
||||
else
|
||||
_e_quickpanel_slide(qp, 0,
|
||||
(double)il_cfg->sliding.quickpanel.duration / 1000.0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_slide(E_Quickpanel *qp, int visible, double len)
|
||||
{
|
||||
if (!qp) return;
|
||||
qp->start = ecore_loop_time_get();
|
||||
qp->len = len;
|
||||
qp->adjust_start = qp->adjust;
|
||||
qp->adjust_end = 0;
|
||||
if (visible) qp->adjust_end = qp->h;
|
||||
if (!qp->animator)
|
||||
qp->animator = ecore_animator_add(_e_quickpanel_cb_animate, qp);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_border_show(E_Border *bd)
|
||||
{
|
||||
unsigned int visible = 1;
|
||||
|
||||
if (!bd) return;
|
||||
e_container_border_lower(bd);
|
||||
e_container_shape_show(bd->shape);
|
||||
if (!bd->need_reparent) ecore_x_window_show(bd->client.win);
|
||||
e_hints_window_visible_set(bd);
|
||||
bd->visible = 1;
|
||||
bd->changes.visible = 1;
|
||||
ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
|
||||
ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_border_hide(E_Border *bd)
|
||||
{
|
||||
unsigned int visible = 0;
|
||||
|
||||
if (!bd) return;
|
||||
e_container_shape_hide(bd->shape);
|
||||
e_hints_window_hidden_set(bd);
|
||||
bd->visible = 0;
|
||||
bd->changes.visible = 1;
|
||||
ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
|
||||
}
|
||||
|
||||
static E_Quickpanel *
|
||||
_e_quickpanel_by_border_get(E_Border *bd)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
E_Border *b;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if ((!bd) || (!bd->stolen)) return NULL;
|
||||
if (!quickpanels) return NULL;
|
||||
EINA_LIST_FOREACH(quickpanels, l, qp)
|
||||
{
|
||||
if (!qp->borders) continue;
|
||||
EINA_LIST_FOREACH(qp->borders, ll, b)
|
||||
if (b == bd) return qp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_cb_free(E_Quickpanel *qp)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!qp) return;
|
||||
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_delay_hide(void *data)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (!(qp = data)) return 0;
|
||||
_e_quickpanel_hide(qp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_animate(void *data)
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
double t, v = 1.0;
|
||||
|
||||
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;
|
||||
|
||||
qp->adjust = (qp->adjust_end * v) + (qp->adjust_start * (1.0 - v));
|
||||
if (qp->borders)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
int pbh = 0;
|
||||
|
||||
pbh = qp->top_height - qp->h;
|
||||
EINA_LIST_FOREACH(qp->borders, l, bd)
|
||||
{
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
if (bd->fx.y != (qp->adjust + pbh))
|
||||
e_border_fx_offset(bd, 0, (qp->adjust + pbh));
|
||||
pbh += bd->h;
|
||||
if (!qp->visible)
|
||||
{
|
||||
if (bd->fx.y > 0)
|
||||
if (!bd->visible) _e_quickpanel_border_show(bd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bd->fx.y <= 10)
|
||||
if (bd->visible) _e_quickpanel_border_hide(bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
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_border_add(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
E_Quickpanel *qp;
|
||||
int ty;
|
||||
|
||||
ev = event;
|
||||
if (!ev->border->client.illume.quickpanel.quickpanel) return 1;
|
||||
if (!(qp = e_quickpanel_by_zone_get(ev->border->zone))) return 1;
|
||||
_e_quickpanel_border_hide(ev->border);
|
||||
e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
|
||||
if ((ev->border->x != qp->zone->x) || (ev->border->y != ty))
|
||||
e_border_move(ev->border, qp->zone->x, ty);
|
||||
if (ev->border->zone != qp->zone)
|
||||
e_border_zone_set(ev->border, qp->zone);
|
||||
qp->h += ev->border->h;
|
||||
qp->borders = eina_list_append(qp->borders, ev->border);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_client_message(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Client_Message *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
if (zone = e_util_zone_window_find(ev->win))
|
||||
{
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (qp = e_quickpanel_by_zone_get(zone))
|
||||
{
|
||||
if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
|
||||
e_quickpanel_hide(qp);
|
||||
else
|
||||
e_quickpanel_show(qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE)
|
||||
{
|
||||
E_Border *bd;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
if (!(bd = e_border_find_by_client_window(ev->win))) return 1;
|
||||
if (!(qp = e_quickpanel_by_zone_get(bd->zone))) return 1;
|
||||
e_quickpanel_position_update(qp);
|
||||
}
|
||||
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE_REQUEST)
|
||||
{
|
||||
E_Border *bd;
|
||||
E_Zone *zone;
|
||||
Ecore_X_Window z;
|
||||
int ty;
|
||||
|
||||
if (!(bd = e_border_find_by_client_window(ev->data.l[1]))) return 1;
|
||||
z = ecore_x_e_illume_quickpanel_zone_get(bd->client.win);
|
||||
if (!(zone = e_util_zone_window_find(z))) return 1;
|
||||
_e_quickpanel_border_hide(bd);
|
||||
e_illume_border_top_shelf_pos_get(zone, NULL, &ty);
|
||||
e_border_move(bd, zone->x, ty);
|
||||
e_border_zone_set(bd, zone);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_quickpanel_cb_mouse_down(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Event_Mouse_Button *ev;
|
||||
Eina_List *l;
|
||||
E_Quickpanel *qp;
|
||||
|
||||
ev = event;
|
||||
if (ev->event_window != input_win) return 1;
|
||||
if (!quickpanels) return 1;
|
||||
EINA_LIST_FOREACH(quickpanels, l, qp)
|
||||
if (qp->visible)
|
||||
ecore_x_e_illume_quickpanel_state_send(qp->zone->black_win,
|
||||
ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_quickpanel_cb_post_fetch(void *data, void *data2)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
if (!(bd = data2)) return;
|
||||
if ((!bd->new_client) || (!bd->client.illume.quickpanel.quickpanel)) return;
|
||||
if (_e_quickpanel_by_border_get(bd)) return;
|
||||
bd->stolen = 1;
|
||||
if (bd->remember)
|
||||
{
|
||||
if (bd->bordername)
|
||||
{
|
||||
eina_stringshare_del(bd->bordername);
|
||||
bd->bordername = NULL;
|
||||
}
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
eina_stringshare_replace(&bd->bordername, "borderless");
|
||||
bd->client.border.changed = 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, top_height;
|
||||
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_*
|
|
@ -1,8 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume2
|
||||
Icon=e-module-illume2
|
||||
X-Enlightenment-ModuleType=system
|
||||
Comment=<title>Illume2 for Embedded</title>
|
||||
Comment[fr]=<title>Illume2 pour l'embarqué</title>
|
||||
Comment[it]=<title>Illume2 per sistemi embedded</title>
|
|
@ -1,2 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
SUBDIRS = illume
|
|
@ -1,21 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume2
|
||||
|
||||
# the module .so file
|
||||
INCLUDES = -I.. \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE)/policies/illume \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
|
||||
plugindir = $(libdir)/enlightenment/modules/$(MODULE)/policies
|
||||
|
||||
illumedir = $(plugindir)
|
||||
illume_LTLIBRARIES = illume.la
|
||||
illume_la_SOURCES = illume.c illume.h layout.c layout.h
|
||||
illume_la_LIBADD = @e_libs@
|
||||
illume_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
illume_la_LIBTOOLFLAGS = --tag=disable-static
|
|
@ -1,46 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "illume.h"
|
||||
#include "layout.h"
|
||||
|
||||
EAPI E_Illume_Layout_Api e_layapi =
|
||||
{
|
||||
E_ILLUME_LAYOUT_API_VERSION, "Illume", "illume"
|
||||
};
|
||||
|
||||
EAPI void *
|
||||
e_layapi_init(E_Illume_Layout_Policy *p)
|
||||
{
|
||||
p->funcs.border_add = _layout_border_add;
|
||||
p->funcs.border_del = _layout_border_del;
|
||||
p->funcs.border_focus_in = _layout_border_focus_in;
|
||||
p->funcs.border_focus_out = _layout_border_focus_out;
|
||||
p->funcs.border_activate = _layout_border_activate;
|
||||
p->funcs.border_property_change = _layout_border_property_change;
|
||||
p->funcs.zone_layout = _layout_zone_layout;
|
||||
p->funcs.zone_move_resize = _layout_zone_move_resize;
|
||||
p->funcs.drag_start = _layout_drag_start;
|
||||
p->funcs.drag_end = _layout_drag_end;
|
||||
return p;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_layapi_shutdown(E_Illume_Layout_Policy *p)
|
||||
{
|
||||
p->funcs.border_add = NULL;
|
||||
p->funcs.border_del = NULL;
|
||||
p->funcs.border_focus_in = NULL;
|
||||
p->funcs.border_focus_out = NULL;
|
||||
p->funcs.border_activate = NULL;
|
||||
p->funcs.border_property_change = NULL;
|
||||
p->funcs.zone_layout = NULL;
|
||||
p->funcs.zone_move_resize = NULL;
|
||||
p->funcs.drag_start = NULL;
|
||||
p->funcs.drag_end = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_layapi_config(E_Container *con, const char *params)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef _ILLUME_H
|
||||
# define _ILLUME_H
|
||||
|
||||
EAPI extern E_Illume_Layout_Api e_layapi;
|
||||
|
||||
EAPI void *e_layapi_init(E_Illume_Layout_Policy *p);
|
||||
EAPI int e_layapi_shutdown(E_Illume_Layout_Policy *p);
|
||||
EAPI void e_layapi_config(E_Container *con, const char *params);
|
||||
|
||||
#endif
|
|
@ -1,605 +0,0 @@
|
|||
#include "E_Illume.h"
|
||||
#include "layout.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _zone_layout_border_move(E_Border *bd, int x, int y);
|
||||
static void _zone_layout_border_resize(E_Border *bd, int w, int h);
|
||||
static void _zone_layout_single(E_Border *bd);
|
||||
static void _zone_layout_dual(E_Border *bd);
|
||||
static void _zone_layout_dual_top(E_Border *bd);
|
||||
static void _zone_layout_dual_top_custom(E_Border *bd);
|
||||
static void _zone_layout_dual_left(E_Border *bd);
|
||||
|
||||
/* local variables */
|
||||
static int shelfsize = 0;
|
||||
static int kbdsize = 0;
|
||||
static int panelsize = 0;
|
||||
|
||||
void
|
||||
_layout_border_add(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
if ((bd->new_client) || (!bd->visible)) return;
|
||||
if ((bd->need_fullscreen) || (bd->fullscreen))
|
||||
{
|
||||
E_Border *b;
|
||||
|
||||
b = e_illume_border_top_shelf_get(bd->zone);
|
||||
if ((b) && (b->visible)) e_border_hide(b, 2);
|
||||
}
|
||||
if ((bd->client.icccm.accepts_focus) && (bd->client.icccm.take_focus)
|
||||
&& (!bd->lock_focus_out) && (!bd->focused))
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_layout_border_del(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
|
||||
/* Do something if a border gets removed */
|
||||
if ((bd->need_fullscreen) || (bd->fullscreen))
|
||||
{
|
||||
E_Border *b;
|
||||
|
||||
b = e_illume_border_top_shelf_get(bd->zone);
|
||||
if ((b) && (!b->visible)) e_border_show(b);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_layout_border_focus_in(E_Border *bd)
|
||||
{
|
||||
/* Do something if focus enters a window */
|
||||
}
|
||||
|
||||
void
|
||||
_layout_border_focus_out(E_Border *bd)
|
||||
{
|
||||
/* Do something if focus exits a window */
|
||||
}
|
||||
|
||||
void
|
||||
_layout_border_activate(E_Border *bd)
|
||||
{
|
||||
E_Border *b;
|
||||
|
||||
/* HANDLE A BORDER BEING ACTIVATED */
|
||||
|
||||
if ((!bd) || (bd->stolen)) return;
|
||||
b = e_illume_border_bottom_panel_get(bd->zone);
|
||||
if (e_illume_border_is_conformant(bd))
|
||||
{
|
||||
if ((b) && (b->visible)) e_border_hide(b, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((b) && (!b->visible)) e_border_show(b);
|
||||
}
|
||||
|
||||
/* only set focus if border accepts it and it's not locked out */
|
||||
if (((!bd->client.icccm.accepts_focus) && (!bd->client.icccm.take_focus)) ||
|
||||
(bd->lock_focus_out))
|
||||
return;
|
||||
|
||||
/* if the border is not focused, check focus settings */
|
||||
if ((bd) && (!bd->focused))
|
||||
{
|
||||
if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
|
||||
((bd->parent) &&
|
||||
((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
|
||||
((bd->parent->focused) &&
|
||||
(e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))))
|
||||
{
|
||||
if (bd->iconic)
|
||||
{
|
||||
/* if it's iconic, then uniconify */
|
||||
if (!bd->lock_user_iconify) e_border_uniconify(bd);
|
||||
}
|
||||
/* if we can, raise the border */
|
||||
if (!bd->lock_user_stacking) e_border_raise(bd);
|
||||
/* if we can, focus the border */
|
||||
if (!bd->lock_focus_out) e_border_focus_set(bd, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_layout_border_property_change(E_Border *bd, Ecore_X_Event_Window_Property *event)
|
||||
{
|
||||
E_Border *ind;
|
||||
|
||||
if (event->atom != ECORE_X_ATOM_NET_WM_STATE) return;
|
||||
if ((!bd->client.icccm.name) || (!bd->client.icccm.class) ||
|
||||
(bd->stolen) || (!bd->visible)) return;
|
||||
if (!(ind = e_illume_border_top_shelf_get(bd->zone))) return;
|
||||
if ((bd->fullscreen) || (bd->need_fullscreen))
|
||||
e_border_hide(ind, 2);
|
||||
else
|
||||
e_border_show(ind);
|
||||
}
|
||||
|
||||
void
|
||||
_layout_zone_layout(E_Zone *zone)
|
||||
{
|
||||
E_Illume_Config_Zone *cfg_zone;
|
||||
Eina_List *l;
|
||||
E_Border *bd;
|
||||
|
||||
if (!zone) return;
|
||||
|
||||
cfg_zone = e_illume_zone_config_get(zone->id);
|
||||
if (!cfg_zone) return;
|
||||
|
||||
EINA_LIST_FOREACH(e_border_client_list(), l, bd)
|
||||
{
|
||||
int mh;
|
||||
|
||||
if (bd->zone != zone) continue;
|
||||
if (e_illume_border_is_top_shelf(bd))
|
||||
{
|
||||
e_illume_border_min_get(bd, NULL, &mh);
|
||||
if (shelfsize < mh) shelfsize = mh;
|
||||
if (!bd->client.illume.drag.drag)
|
||||
{
|
||||
if ((bd->w != zone->w) || (bd->h != shelfsize))
|
||||
_zone_layout_border_resize(bd, zone->w, shelfsize);
|
||||
if (!cfg_zone->mode.dual)
|
||||
{
|
||||
if ((bd->x != zone->x) || (bd->y != zone->y))
|
||||
{
|
||||
_zone_layout_border_move(bd, zone->x, zone->y);
|
||||
ecore_x_e_illume_quickpanel_position_update_send(bd->client.win);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cfg_zone->mode.side == 0)
|
||||
{
|
||||
if (bd->x != zone->x)
|
||||
_zone_layout_border_move(bd, zone->x, bd->y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((bd->x != zone->x) || (bd->y != zone->y))
|
||||
{
|
||||
_zone_layout_border_move(bd, zone->x, zone->y);
|
||||
ecore_x_e_illume_quickpanel_position_update_send(bd->client.win);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bd->layer != IL_TOP_SHELF_LAYER)
|
||||
e_border_layer_set(bd, IL_TOP_SHELF_LAYER);
|
||||
bd->lock_user_stacking = 1;
|
||||
}
|
||||
else if (e_illume_border_is_bottom_panel(bd))
|
||||
{
|
||||
e_illume_border_min_get(bd, NULL, &mh);
|
||||
if (panelsize < mh) panelsize = mh;
|
||||
if (!bd->client.illume.drag.drag)
|
||||
{
|
||||
if ((bd->w != zone->w) || (bd->h != panelsize))
|
||||
_zone_layout_border_resize(bd, zone->w, panelsize);
|
||||
if ((bd->x != zone->x) ||
|
||||
(bd->y != (zone->y + zone->h - panelsize)))
|
||||
_zone_layout_border_move(bd, zone->x,
|
||||
(zone->y + zone->h - panelsize));
|
||||
}
|
||||
if (bd->layer != IL_BOTTOM_PANEL_LAYER)
|
||||
e_border_layer_set(bd, IL_BOTTOM_PANEL_LAYER);
|
||||
bd->lock_user_stacking = 1;
|
||||
}
|
||||
else if (e_illume_border_is_keyboard(bd))
|
||||
{
|
||||
e_illume_border_min_get(bd, NULL, &mh);
|
||||
if (kbdsize < mh) kbdsize = mh;
|
||||
if ((bd->w != zone->w) || (bd->h != kbdsize))
|
||||
_zone_layout_border_resize(bd, zone->w, kbdsize);
|
||||
if ((bd->x != zone->x) ||
|
||||
(bd->y != (zone->y + zone->h - kbdsize)))
|
||||
_zone_layout_border_move(bd, zone->x,
|
||||
(zone->y + zone->h - kbdsize));
|
||||
if (bd->layer != IL_KEYBOARD_LAYER)
|
||||
e_border_layer_set(bd, IL_KEYBOARD_LAYER);
|
||||
}
|
||||
else if (e_illume_border_is_dialog(bd))
|
||||
{
|
||||
int mw, nx, ny;
|
||||
|
||||
e_illume_border_min_get(bd, &mw, &mh);
|
||||
if (mw > zone->w) mw = zone->w;
|
||||
if (mh > zone->h) mh = zone->h;
|
||||
nx = (zone->x + ((zone->w - mw) / 2));
|
||||
ny = (zone->y + ((zone->h - mh) / 2));
|
||||
if ((bd->w != mw) || (bd->h != mh))
|
||||
_zone_layout_border_resize(bd, mw, mh);
|
||||
if ((bd->x != nx) || (bd->y != ny))
|
||||
_zone_layout_border_move(bd, nx, ny);
|
||||
if (bd->layer != IL_DIALOG_LAYER)
|
||||
e_border_layer_set(bd, IL_DIALOG_LAYER);
|
||||
}
|
||||
else if (e_illume_border_is_quickpanel(bd))
|
||||
{
|
||||
e_illume_border_min_get(bd, NULL, &mh);
|
||||
if ((bd->w != zone->w) || (bd->h != mh))
|
||||
_zone_layout_border_resize(bd, zone->w, mh);
|
||||
if (bd->layer != IL_QUICKPANEL_LAYER)
|
||||
e_border_layer_set(bd, IL_QUICKPANEL_LAYER);
|
||||
bd->lock_user_stacking = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bd->stolen) continue;
|
||||
if (cfg_zone->mode.dual) _zone_layout_dual(bd);
|
||||
else _zone_layout_single(bd);
|
||||
if (e_illume_border_is_conformant(bd))
|
||||
{
|
||||
if (bd->layer != IL_CONFORM_LAYER)
|
||||
e_border_layer_set(bd, IL_CONFORM_LAYER);
|
||||
}
|
||||
else if ((bd->fullscreen) || (bd->need_fullscreen))
|
||||
{
|
||||
if (bd->layer != IL_FULLSCREEN_LAYER)
|
||||
e_border_layer_set(bd, IL_FULLSCREEN_LAYER);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bd->layer != IL_APP_LAYER)
|
||||
e_border_layer_set(bd, IL_APP_LAYER);
|
||||
}
|
||||
bd->lock_user_stacking = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_layout_zone_move_resize(E_Zone *zone)
|
||||
{
|
||||
if (!zone) return;
|
||||
_layout_zone_layout(zone);
|
||||
}
|
||||
|
||||
void
|
||||
_layout_drag_start(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
ecore_x_e_illume_drag_set(bd->client.win, 1);
|
||||
ecore_x_e_illume_drag_set(bd->zone->black_win, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_layout_drag_end(E_Border *bd)
|
||||
{
|
||||
if (!bd) return;
|
||||
ecore_x_e_illume_drag_set(bd->client.win, 0);
|
||||
ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_zone_layout_border_move(E_Border *bd, int x, int y)
|
||||
{
|
||||
if (!bd) return;
|
||||
bd->x = x;
|
||||
bd->y = y;
|
||||
bd->changes.pos = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_border_resize(E_Border *bd, int w, int h)
|
||||
{
|
||||
if (!bd) return;
|
||||
bd->w = w;
|
||||
bd->h = h;
|
||||
bd->client.w = bd->w - (bd->client_inset.l + bd->client_inset.r);
|
||||
bd->client.h = bd->h - (bd->client_inset.t + bd->client_inset.b);
|
||||
bd->changes.size = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_single(E_Border *bd)
|
||||
{
|
||||
int kx, ky, kw, kh;
|
||||
int ss = 0, ps = 0;
|
||||
int nh, ny;
|
||||
|
||||
if (!bd) return;
|
||||
e_illume_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
|
||||
if (!((bd->need_fullscreen) || (bd->fullscreen)))
|
||||
{
|
||||
if (kh >= bd->zone->h) ps = panelsize;
|
||||
ss = shelfsize;
|
||||
}
|
||||
nh = kh - ss - ps;
|
||||
ny = ky + ss;
|
||||
if (e_illume_border_is_conformant(bd))
|
||||
{
|
||||
nh = bd->zone->h;
|
||||
ny = ky;
|
||||
}
|
||||
if ((bd->w != kw) || (bd->h != nh))
|
||||
_zone_layout_border_resize(bd, kw, nh);
|
||||
if ((bd->x != kx) || (bd->y != ny))
|
||||
_zone_layout_border_move(bd, kx, ny);
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_dual(E_Border *bd)
|
||||
{
|
||||
E_Illume_Config_Zone *cz;
|
||||
|
||||
if (!bd) return;
|
||||
cz = e_illume_zone_config_get(bd->zone->id);
|
||||
if (!cz) return;
|
||||
if (cz->mode.side == 0)
|
||||
{
|
||||
int ty;
|
||||
|
||||
e_illume_border_top_shelf_pos_get(bd->zone, NULL, &ty);
|
||||
if (ty <= bd->zone->y)
|
||||
_zone_layout_dual_top(bd);
|
||||
else
|
||||
_zone_layout_dual_top_custom(bd);
|
||||
}
|
||||
else if (cz->mode.side == 1)
|
||||
_zone_layout_dual_left(bd);
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_dual_top(E_Border *bd)
|
||||
{
|
||||
int conform;
|
||||
int kx, ky, kw, kh;
|
||||
int ps = 0, ss = 0;
|
||||
int by, bh;
|
||||
E_Border *b;
|
||||
|
||||
if (!bd) return;
|
||||
conform = e_illume_border_is_conformant(bd);
|
||||
e_illume_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
|
||||
|
||||
if (!((bd->need_fullscreen) || (bd->fullscreen)))
|
||||
{
|
||||
if (kh >= bd->zone->h) ps = panelsize;
|
||||
ss = shelfsize;
|
||||
}
|
||||
|
||||
by = (ky + ss);
|
||||
bh = ((kh - ss - ps) / 2);
|
||||
|
||||
b = e_illume_border_at_xy_get(bd->zone, kx, by);
|
||||
if ((b) && (bd != b))
|
||||
{
|
||||
if (e_illume_border_is_home(b))
|
||||
{
|
||||
if (conform)
|
||||
{
|
||||
by = ky;
|
||||
bh = bd->zone->h / 2;
|
||||
}
|
||||
else if (e_illume_border_is_home(bd))
|
||||
by = (b->y + b->h);
|
||||
}
|
||||
else if (e_illume_border_is_conformant(b))
|
||||
{
|
||||
by = (b->y + b->h);
|
||||
if (conform) bh = bd->zone->h / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
by = (b->y + b->h);
|
||||
if (conform) bh = bd->zone->h / 2;
|
||||
}
|
||||
}
|
||||
else if (b)
|
||||
{
|
||||
if (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
{
|
||||
by = (ky + ss);
|
||||
bh = ((kh - ss - ps) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
if ((bd->need_fullscreen) || (bd->fullscreen))
|
||||
{
|
||||
by = ky;
|
||||
bh = kh;
|
||||
}
|
||||
|
||||
if ((bd->w != kw) || (bd->h != bh))
|
||||
_zone_layout_border_resize(bd, kw, bh);
|
||||
if ((bd->x != kx) || (bd->y != by))
|
||||
_zone_layout_border_move(bd, kx, by);
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_dual_top_custom(E_Border *bd)
|
||||
{
|
||||
int kx, kw, ky, kh;
|
||||
int ax, ay, aw, ah;
|
||||
int zx, zy, zw, zh;
|
||||
|
||||
if (!bd) return;
|
||||
|
||||
/* grab the 'safe' region. Safe region is space not occupied by keyboard */
|
||||
e_illume_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
|
||||
|
||||
e_illume_border_app1_safe_region_get(bd->zone, &ax, &ay, &aw, &ah);
|
||||
e_illume_border_app2_safe_region_get(bd->zone, &zx, &zy, &zw, &zh);
|
||||
|
||||
/* if there are no other borders, than give this one all available space */
|
||||
if (e_illume_border_valid_count_get(bd->zone) < 2)
|
||||
{
|
||||
if (ah >= zh)
|
||||
{
|
||||
zx = ax;
|
||||
zy = ax;
|
||||
zw = aw;
|
||||
zh = ah;
|
||||
}
|
||||
if ((bd->w != zw) || (bd->h != zh))
|
||||
_zone_layout_border_resize(bd, zw, zh);
|
||||
if ((bd->x != zx) || (bd->y != zy))
|
||||
_zone_layout_border_move(bd, zx, zy);
|
||||
}
|
||||
else
|
||||
{
|
||||
int bh, by;
|
||||
|
||||
bh = ah;
|
||||
by = ay;
|
||||
|
||||
if (bd->client.vkbd.state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
{
|
||||
E_Border *bt;
|
||||
|
||||
/* grab the border at the top */
|
||||
bt = e_illume_border_at_xy_get(bd->zone, kx, ay);
|
||||
if ((bt) && (bd != bt))
|
||||
{
|
||||
E_Border *bb;
|
||||
|
||||
/* have border @ top, check for border @ bottom */
|
||||
bb = e_illume_border_at_xy_get(bd->zone, kx, zy);
|
||||
if ((bb) && (bd != bb))
|
||||
{
|
||||
/* have border @ top & bottom; neither is current */
|
||||
|
||||
/* if top border is !home, check bottom */
|
||||
if (!e_illume_border_is_home(bt))
|
||||
{
|
||||
if (e_illume_border_is_home(bb))
|
||||
{
|
||||
bh = zh;
|
||||
by = zy;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* potential hole */
|
||||
bh = ah;
|
||||
by = ay;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bh = ah;
|
||||
by = ay;
|
||||
}
|
||||
}
|
||||
else if (bb)
|
||||
{
|
||||
bh = zh;
|
||||
by = bd->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
bh = zh;
|
||||
by = zy;
|
||||
}
|
||||
}
|
||||
else if (bt)
|
||||
{
|
||||
bh = ah;
|
||||
by = bd->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
bh = ah;
|
||||
by = ay;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bd->fullscreen) || (bd->need_fullscreen))
|
||||
{
|
||||
bh = kh;
|
||||
by = ky;
|
||||
}
|
||||
if ((bd->w != kw) || (bd->h != bh))
|
||||
_zone_layout_border_resize(bd, kw, bh);
|
||||
if ((bd->x != kx) || (bd->y != by))
|
||||
_zone_layout_border_move(bd, kx, by);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_layout_dual_left(E_Border *bd)
|
||||
{
|
||||
int conform;
|
||||
int kx, ky, kw, kh;
|
||||
int ps = 0, ss = 0;
|
||||
int by, bh, bx, bw;
|
||||
E_Border *b;
|
||||
|
||||
if (!bd) return;
|
||||
|
||||
conform = e_illume_border_is_conformant(bd);
|
||||
e_illume_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
|
||||
|
||||
if (!((bd->need_fullscreen) || (bd->fullscreen)))
|
||||
{
|
||||
if (kh >= bd->zone->h) ps = panelsize;
|
||||
ss = shelfsize;
|
||||
}
|
||||
|
||||
bx = kx;
|
||||
by = (ky + ss);
|
||||
bw = (kw / 2);
|
||||
bh = (kh - ss - ps);
|
||||
|
||||
b = e_illume_border_at_xy_get(bd->zone, kx, by);
|
||||
if ((b) && (bd != b))
|
||||
{
|
||||
if (e_illume_border_is_home(b))
|
||||
{
|
||||
if (conform)
|
||||
{
|
||||
by = ky;
|
||||
bh = bd->zone->h;
|
||||
}
|
||||
else if (e_illume_border_is_home(bd))
|
||||
bx = (b->x + b->w);
|
||||
}
|
||||
else if (e_illume_border_is_conformant(b))
|
||||
{
|
||||
bx = (b->x + b->w);
|
||||
if (conform)
|
||||
{
|
||||
by = ky;
|
||||
bh = bd->zone->h;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bx = (b->x + b->w);
|
||||
if (conform)
|
||||
{
|
||||
by = ky;
|
||||
bh = bd->zone->h;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (b)
|
||||
{
|
||||
if (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
||||
{
|
||||
by = (ky + ss);
|
||||
bh = (kh - ss - ps);
|
||||
}
|
||||
}
|
||||
|
||||
if ((bd->need_fullscreen) || (bd->fullscreen))
|
||||
{
|
||||
bx = kx;
|
||||
by = ky;
|
||||
bw = kw;
|
||||
bh = kh;
|
||||
}
|
||||
|
||||
if ((bd->w != bw) || (bd->h != bh))
|
||||
_zone_layout_border_resize(bd, bw, bh);
|
||||
if ((bd->x != bx) || (bd->y != by))
|
||||
_zone_layout_border_move(bd, bx, by);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef _LAYOUT_H
|
||||
# define _LAYOUT_H
|
||||
|
||||
/* define some values here for easily changing layers so we don't have to
|
||||
* grep through code to change layers */
|
||||
#define IL_TOP_SHELF_LAYER 200
|
||||
#define IL_BOTTOM_PANEL_LAYER 110
|
||||
#define IL_KEYBOARD_LAYER 150
|
||||
#define IL_DIALOG_LAYER 120
|
||||
#define IL_CONFORM_LAYER 100
|
||||
#define IL_FULLSCREEN_LAYER 140
|
||||
#define IL_QUICKPANEL_LAYER 160
|
||||
#define IL_APP_LAYER 100
|
||||
|
||||
void _layout_border_add(E_Border *bd);
|
||||
void _layout_border_del(E_Border *bd);
|
||||
void _layout_border_focus_in(E_Border *bd);
|
||||
void _layout_border_focus_out(E_Border *bd);
|
||||
void _layout_border_activate(E_Border *bd);
|
||||
void _layout_border_property_change(E_Border *bd, Ecore_X_Event_Window_Property *event);
|
||||
void _layout_zone_layout(E_Zone *zone);
|
||||
void _layout_zone_move_resize(E_Zone *zone);
|
||||
void _layout_drag_start(E_Border *bd);
|
||||
void _layout_drag_end(E_Border *bd);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue