--- /dev/null
+#ifndef E_ILLUME_H
+# define E_ILLUME_H
+
+# include "e.h"
+
+# define E_ILLUME_LAYOUT_API_VERSION 1
+# define E_ILLUME_LAYOUT_TYPE 0xE0b200b
+
+typedef enum _E_Illume_Animation_Class
+{
+ E_ILLUME_ANIM_APP,
+ E_ILLUME_ANIM_KEYBOARD,
+ E_ILLUME_ANIM_TOP_SHELF,
+ E_ILLUME_ANIM_BOTTOM_PANEL,
+ E_ILLUME_ANIM_DIALOG,
+ E_ILLUME_ANIM_QUICKPANEL,
+ E_ILLUME_ANIM_OTHER
+} E_Illume_Animation_Class;
+
+typedef struct _E_Illume_Layout_Api E_Illume_Layout_Api;
+typedef struct _E_Illume_Layout_Policy E_Illume_Layout_Policy;
+typedef struct _E_Illume_Config E_Illume_Config;
+
+struct _E_Illume_Layout_Api
+{
+ int version;
+ const char *label, *name;
+};
+
+struct _E_Illume_Layout_Policy
+{
+ E_Object e_obj_inherit;
+
+ E_Illume_Layout_Api *api;
+
+ void *handle;
+
+ struct
+ {
+ void *(*init) (E_Illume_Layout_Policy *p);
+ int (*shutdown) (E_Illume_Layout_Policy *p);
+ void (*config) (E_Container *con, const char *params);
+
+ void (*border_add) (E_Border *bd);
+ void (*border_del) (E_Border *bd);
+ void (*border_focus_in) (E_Border *bd);
+ void (*border_focus_out) (E_Border *bd);
+ void (*border_activate) (E_Border *bd);
+ void (*zone_layout) (E_Zone *zone);
+ void (*zone_move_resize) (E_Zone *zone);
+ void (*drag_start) (E_Border *bd);
+ void (*drag_end) (E_Border *bd);
+ } funcs;
+};
+
+struct _E_Illume_Config
+{
+ int version;
+
+ struct
+ {
+ struct
+ {
+ int duration;
+ } kbd, softkey, quickpanel;
+ } sliding;
+
+ struct
+ {
+ const char *name;
+ struct
+ {
+ const char *class;
+ const char *name;
+ const char *title;
+ int win_type;
+ struct
+ {
+ int class, name, title, win_type;
+ } match;
+ } vkbd, softkey, home, indicator;
+ struct
+ {
+ int dual, side;
+ } mode;
+ } policy;
+
+ // Not User Configurable. Placeholders
+ const char *mod_dir;
+ E_Config_Dialog *cfd;
+};
+
+EAPI Eina_List *e_illume_layout_policies_get(void);
+
+EAPI int e_illume_border_is_dialog(E_Border *bd);
+EAPI int e_illume_border_is_keyboard(E_Border *bd);
+EAPI int e_illume_border_is_bottom_panel(E_Border *bd);
+EAPI int e_illume_border_is_top_shelf(E_Border *bd);
+EAPI int e_illume_border_is_home(E_Border *bd);
+EAPI int e_illume_border_is_conformant(E_Border *bd);
+EAPI int e_illume_border_is_quickpanel(E_Border *bd);
+EAPI int e_illume_border_is_valid(E_Border *bd);
+
+EAPI Eina_List *e_illume_border_valid_borders_get(E_Zone *zone);
+EAPI E_Border *e_illume_border_valid_border_get(E_Zone *zone);
+EAPI int e_illume_border_valid_count_get(E_Zone *zone);
+EAPI Eina_List *e_illume_border_quickpanel_borders_get(E_Zone *zone);
+EAPI int e_illume_border_quickpanel_count_get(E_Zone *zone);
+
+EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y);
+EAPI E_Border *e_illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h);
+EAPI E_Border *e_illume_border_keyboard_get(E_Zone *zone);
+EAPI E_Border *e_illume_border_top_shelf_get(E_Zone *zone);
+EAPI E_Border *e_illume_border_bottom_panel_get(E_Zone *zone);
+
+EAPI void e_illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y);
+EAPI void e_illume_border_top_shelf_size_get(E_Zone *zone, int *x, int *y);
+EAPI void e_illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y);
+EAPI void e_illume_border_bottom_panel_size_get(E_Zone *zone, int *x, int *y);
+
+EAPI void e_illume_border_slide_to(E_Border *bd, int x, int y, E_Illume_Animation_Class aclass);
+EAPI void e_illume_border_min_get(E_Border *bd, int *mw, int *mh);
+EAPI void e_illume_border_max_get(E_Border *bd, int *mw, int *mh);
+
+EAPI void e_illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
+EAPI void e_illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
+EAPI void e_illume_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
+
+extern EAPI E_Illume_Config *il_cfg;
+
+#endif
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/@PACKAGE@
+
+Name: e17-illume2
+Description: Illume2 Module for E17
+Requires: enlightenment
+Version: @VERSION@
+Libs: -L${libdir}
+Libs.private:
+Cflags: -I${includedir}
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in E_Illume.pc
+MODULE = illume2
+SUBDIRS = keyboards policies
+
+# data files for the module
+filesdir = $(libdir)/enlightenment/modules/$(MODULE)
+files_DATA = e-module-$(MODULE).edj module.desktop
+
+EXTRA_DIST = $(files_DATA)
+
+# the module .so file
+INCLUDES = -I. \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src/modules/$(MODULE) \
+ -I$(top_srcdir)/src/bin \
+ -I$(top_srcdir)/src/lib \
+ -I$(top_srcdir)/src/modules \
+ @e_cflags@
+
+pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
+pkg_LTLIBRARIES = module.la
+
+EILLUMEHEADERS = E_Illume.h
+
+module_la_SOURCES = $(EILLUMEHEADERS) \
+ e_mod_border.c \
+ e_mod_main.h \
+ e_mod_main.c \
+ e_mod_config.h \
+ e_mod_config.c \
+ e_mod_animation.h \
+ e_mod_animation.c \
+ e_kbd.h \
+ e_kbd.c \
+ e_kbd_dbus.h \
+ e_kbd_dbus.c \
+ e_quickpanel.h \
+ e_quickpanel.c \
+ e_mod_layout.h \
+ e_mod_layout.c \
+ e_mod_policy.h \
+ e_mod_policy.c \
+ e_mod_policy_settings.h \
+ e_mod_policy_settings.c \
+ e_mod_windows.h \
+ e_mod_windows.c \
+ e_mod_select_window.h \
+ e_mod_select_window.c
+
+module_la_LIBADD = @e_libs@ @dlopen_libs@
+module_la_LDFLAGS = -module -avoid-version
+module_la_DEPENDENCIES = $(top_builddir)/config.h
+
+installed_headersdir = $(prefix)/include/@PACKAGE@
+installed_headers_DATA = $(EILLUMEHEADERS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = E_Illume.pc
+
+uninstall:
+ rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
+ rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)/policies/
--- /dev/null
+#include "E_Illume.h"
+#include "e_kbd.h"
+#include "e_kbd_dbus.h"
+
+#define ICONIFY_TO_HIDE 0
+
+/* local function prototypes */
+static void _e_kbd_cb_free(E_Kbd *kbd);
+static int _e_kbd_cb_delayed_hide(void *data);
+static int _e_kbd_cb_animate(void *data);
+static E_Kbd *_e_kbd_by_border_get(E_Border *bd);
+static void _e_kbd_layout_send(E_Kbd *kbd);
+static void _e_kbd_border_show(E_Border *bd);
+static void _e_kbd_border_hide(E_Border *bd);
+static void _e_kbd_border_adopt(E_Kbd *kbd, E_Border *bd);
+static int _e_kbd_border_is_keyboard(E_Border *bd);
+static void _e_kbd_hide(E_Kbd *kbd);
+static void _e_kbd_slide(E_Kbd *kbd, int visible, double len);
+static void _e_kbd_all_show(void);
+static void _e_kbd_all_hide(void);
+static void _e_kbd_all_toggle(void);
+static void _e_kbd_all_layout_set(E_Kbd_Layout layout);
+
+/* handlers */
+static int _e_kbd_cb_client_message(void *data, int type, void *event);
+static int _e_kbd_cb_border_remove(void *data, int type, void *event);
+static int _e_kbd_cb_border_focus_in(void *data, int type, void *event);
+static int _e_kbd_cb_border_focus_out(void *data, int type, void *event);
+static int _e_kbd_cb_border_property(void *data, int type, void *event);
+
+/* hooks */
+static void _e_kbd_cb_border_pre_post_fetch(void *data, void *data2);
+
+/* local variables */
+static Eina_List *kbds = NULL, *handlers = NULL, *hooks = NULL;
+static E_Border *focused_border = NULL;
+static Ecore_X_Atom focused_vkbd_state = 0;
+
+/* public functions */
+int
+e_kbd_init(void)
+{
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+ _e_kbd_cb_client_message, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
+ _e_kbd_cb_border_remove, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
+ _e_kbd_cb_border_focus_in, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
+ _e_kbd_cb_border_focus_out, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_PROPERTY,
+ _e_kbd_cb_border_property, NULL));
+
+ hooks =
+ eina_list_append(hooks,
+ e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
+ _e_kbd_cb_border_pre_post_fetch, NULL));
+
+ e_kbd_dbus_init();
+
+ return 1;
+}
+
+int
+e_kbd_shutdown(void)
+{
+ E_Kbd *kbd;
+ Ecore_Event_Handler *handler;
+ E_Border_Hook *hook;
+
+ e_kbd_dbus_shutdown();
+
+ EINA_LIST_FREE(handlers, handler)
+ ecore_event_handler_del(handler);
+
+ EINA_LIST_FREE(hooks, hook)
+ e_border_hook_del(hook);
+
+ EINA_LIST_FREE(kbds, kbd)
+ e_object_del(E_OBJECT(kbd));
+
+ return 1;
+}
+
+E_Kbd *
+e_kbd_new(void)
+{
+ E_Kbd *kbd;
+
+ kbd = E_OBJECT_ALLOC(E_Kbd, E_KBD_TYPE, _e_kbd_cb_free);
+ if (!kbd) return NULL;
+ kbds = eina_list_append(kbds, kbd);
+ kbd->layout = E_KBD_LAYOUT_ALPHA;
+ return kbd;
+}
+
+void
+e_kbd_all_enable(void)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ e_kbd_enable(kbd);
+}
+
+void
+e_kbd_all_disable(void)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ e_kbd_disable(kbd);
+}
+
+void
+e_kbd_show(E_Kbd *kbd)
+{
+ if (kbd->timer) ecore_timer_del(kbd->timer);
+ kbd->timer = NULL;
+ if ((kbd->visible) || (kbd->disabled)) return;
+ _e_kbd_layout_send(kbd);
+ if (il_cfg->sliding.kbd.duration <= 0)
+ {
+ if (kbd->border)
+ {
+ e_border_fx_offset(kbd->border, 0, 0);
+ _e_kbd_border_show(kbd->border);
+ }
+ kbd->visible = 1;
+ }
+ else
+ {
+ if (kbd->border) _e_kbd_border_show(kbd->border);
+ _e_kbd_slide(kbd, 1, (double)il_cfg->sliding.kbd.duration / 1000.0);
+ }
+}
+
+void
+e_kbd_hide(E_Kbd *kbd)
+{
+ if (!kbd->visible) return;
+ if (!kbd->timer)
+ kbd->timer = ecore_timer_add(0.2, _e_kbd_cb_delayed_hide, kbd);
+}
+
+void
+e_kbd_enable(E_Kbd *kbd)
+{
+ if (!kbd->disabled) return;
+ kbd->disabled = 0;
+ if (!kbd->visible) e_kbd_show(kbd);
+}
+
+void
+e_kbd_disable(E_Kbd *kbd)
+{
+ if (kbd->disabled) return;
+ if (kbd->visible) e_kbd_hide(kbd);
+ kbd->disabled = 1;
+}
+
+void
+e_kbd_layout_set(E_Kbd *kbd, E_Kbd_Layout layout)
+{
+ kbd->layout = layout;
+ _e_kbd_layout_send(kbd);
+}
+
+void
+e_kbd_fullscreen_set(E_Zone *zone, int fullscreen)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ if ((!!fullscreen) != kbd->fullscreen)
+ {
+ kbd->fullscreen = fullscreen;
+ if (kbd->fullscreen)
+ e_border_layer_set(kbd->border, 250);
+ else
+ e_border_layer_set(kbd->border, 100);
+ }
+}
+
+EAPI void
+e_illume_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ if (x) *x = zone->x;
+ if (y) *y = zone->y;
+ if (w) *w = zone->w;
+ if (h) *h = zone->h;
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ {
+ if (!kbd->border) continue;
+ if (kbd->border->zone != zone) continue;
+ if ((kbd->visible) && (!kbd->animator) && (!kbd->disabled))
+ {
+ if (h)
+ {
+ *h -= kbd->border->h;
+ if (*h < 0) *h = 0;
+ }
+ }
+ return;
+ }
+}
+
+/* local functions */
+static void
+_e_kbd_cb_free(E_Kbd *kbd)
+{
+ E_Border *bd;
+
+ if (kbd->animator) ecore_animator_del(kbd->animator);
+ kbd->animator = NULL;
+ if (kbd->timer) ecore_timer_del(kbd->timer);
+ kbd->timer = NULL;
+ EINA_LIST_FREE(kbd->waiting_borders, bd)
+ bd->stolen = 0;
+ E_FREE(kbd);
+}
+
+static int
+_e_kbd_cb_delayed_hide(void *data)
+{
+ E_Kbd *kbd;
+
+ if (!(kbd = data)) return 0;
+ _e_kbd_hide(kbd);
+ kbd->timer = NULL;
+ return 0;
+}
+
+static int
+_e_kbd_cb_animate(void *data)
+{
+ E_Kbd *kbd;
+ double t, v;
+
+ kbd = data;
+ t = ecore_loop_time_get() - kbd->start;
+ if (t > kbd->len) t = kbd->len;
+ if (kbd->len > 0.0)
+ {
+ v = t / kbd->len;
+ v = 1.0 - v;
+ v = v * v * v * v;
+ v = 1.0 - v;
+ }
+ else
+ {
+ t = kbd->len;
+ v = 1.0;
+ }
+ kbd->adjust = (kbd->adjust_end * v) + (kbd->adjust_start * (1.0 - v));
+ if (kbd->border)
+ e_border_fx_offset(kbd->border, 0, kbd->border->h - kbd->adjust);
+ if (t == kbd->len)
+ {
+ kbd->animator = NULL;
+ if (kbd->visible)
+ {
+ _e_kbd_border_hide(kbd->border);
+ kbd->visible = 0;
+ }
+ else
+ kbd->visible = 1;
+ _e_kbd_layout_send(kbd);
+ return 0;
+ }
+ return 1;
+}
+
+static E_Kbd *
+_e_kbd_by_border_get(E_Border *bd)
+{
+ Eina_List *l, *ll;
+ E_Border *over;
+ E_Kbd *kbd;
+
+ if (!bd->stolen) return NULL;
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ {
+ if (kbd->border == bd) return kbd;
+ EINA_LIST_FOREACH(kbd->waiting_borders, ll, over)
+ if (over == bd) return kbd;
+ }
+ return NULL;
+}
+
+static void
+_e_kbd_layout_send(E_Kbd *kbd)
+{
+ Ecore_X_Virtual_Keyboard_State type;
+
+ if ((kbd->visible) && (!kbd->disabled))
+ {
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
+ if (kbd->layout == E_KBD_LAYOUT_DEFAULT)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
+ else if (kbd->layout == E_KBD_LAYOUT_ALPHA)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
+ else if (kbd->layout == E_KBD_LAYOUT_NUMERIC)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
+ else if (kbd->layout == E_KBD_LAYOUT_PIN)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
+ else if (kbd->layout == E_KBD_LAYOUT_PHONE_NUMBER)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
+ else if (kbd->layout == E_KBD_LAYOUT_HEX)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
+ else if (kbd->layout == E_KBD_LAYOUT_TERMINAL)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
+ else if (kbd->layout == E_KBD_LAYOUT_PASSWORD)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
+ else if (kbd->layout == E_KBD_LAYOUT_NONE)
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
+ }
+ else
+ type = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
+ if (kbd->border)
+ ecore_x_e_virtual_keyboard_state_send(kbd->border->client.win, type);
+}
+
+static void
+_e_kbd_border_show(E_Border *bd)
+{
+ if (!bd) return;
+ e_border_uniconify(bd);
+ e_border_show(bd);
+ e_border_raise(bd);
+}
+
+static void
+_e_kbd_border_hide(E_Border *bd)
+{
+ if (!bd) return;
+#ifdef ICONIFY_TO_HIDE
+ e_border_iconify(bd);
+#else
+ e_border_hide(bd, 2);
+#endif
+}
+
+static void
+_e_kbd_border_adopt(E_Kbd *kbd, E_Border *bd)
+{
+ kbd->border = bd;
+ bd->sticky = 1;
+ if (kbd->fullscreen)
+ e_border_layer_set(kbd->border, 250);
+ else
+ e_border_layer_set(kbd->border, 100);
+ if (!kbd->visible)
+ {
+ e_border_fx_offset(kbd->border, 0, kbd->border->h);
+ _e_kbd_layout_send(kbd);
+ }
+ kbd->h = kbd->border->h;
+}
+
+static int
+_e_kbd_border_is_keyboard(E_Border *bd)
+{
+ if ((bd->client.vkbd.vkbd) || /* explicit hint that its a virtual keyboard */
+ /* legacy */
+ ( /* trap the matchbox qwerty and multitap kbd's */
+ (((bd->client.icccm.title) && (!strcmp(bd->client.icccm.title, "Keyboard"))) ||
+ ((bd->client.icccm.name) && ((!strcmp(bd->client.icccm.name, "multitap-pad")))))
+ && (bd->client.netwm.state.skip_taskbar)
+ && (bd->client.netwm.state.skip_pager)))
+ return 1;
+ return 0;
+}
+
+static void
+_e_kbd_hide(E_Kbd *kbd)
+{
+ if (kbd->timer) ecore_timer_del(kbd->timer);
+ kbd->timer = NULL;
+ if ((!kbd->visible) || (kbd->disabled)) return;
+ _e_kbd_layout_send(kbd);
+ if (il_cfg->sliding.kbd.duration <= 0)
+ {
+ if (kbd->border)
+ {
+ e_border_fx_offset(kbd->border, 0, kbd->border->h);
+ _e_kbd_border_hide(kbd->border);
+ }
+ kbd->visible = 0;
+ }
+ else
+ _e_kbd_slide(kbd, 0, (double)il_cfg->sliding.kbd.duration / 1000.0);
+}
+
+static void
+_e_kbd_slide(E_Kbd *kbd, int visible, double len)
+{
+ kbd->start = ecore_loop_time_get();
+ kbd->len = len;
+ kbd->adjust_start = kbd->adjust;
+ kbd->adjust_end = 0;
+ if ((visible) && (kbd->border))
+ kbd->adjust_end = kbd->border->h;
+ if (!kbd->animator)
+ kbd->animator = ecore_animator_add(_e_kbd_cb_animate, kbd);
+}
+
+static void
+_e_kbd_all_show(void)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ e_kbd_show(kbd);
+}
+
+static void
+_e_kbd_all_hide(void)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ e_kbd_hide(kbd);
+}
+
+static void
+_e_kbd_all_toggle(void)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ {
+ if (kbd->visible) e_kbd_hide(kbd);
+ else e_kbd_show(kbd);
+ }
+}
+
+static void
+_e_kbd_all_layout_set(E_Kbd_Layout layout)
+{
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ e_kbd_layout_set(kbd, layout);
+}
+
+/* handlers */
+static int
+_e_kbd_cb_client_message(void *data, int type, void *event)
+{
+ Ecore_X_Event_Client_Message *ev;
+
+ ev = event;
+ if (ev->win != ecore_x_window_root_first_get()) return 1;
+ if ((ev->message_type == ecore_x_atom_get("_MB_IM_INVOKER_COMMAND")) ||
+ (ev->message_type == ecore_x_atom_get("_MTP_IM_INVOKER_COMMAND")))
+ {
+ if (ev->data.l[0] == 1) _e_kbd_all_show();
+ else if (ev->data.l[0] == 2) _e_kbd_all_hide();
+ else if (ev->data.l[0] == 3) _e_kbd_all_toggle();
+ }
+ return 1;
+}
+
+static int
+_e_kbd_cb_border_remove(void *data, int type, void *event)
+{
+ E_Event_Border_Remove *ev;
+ E_Kbd *kbd;
+
+ ev = event;
+ if (ev->border == focused_border)
+ {
+ focused_border = NULL;
+ focused_vkbd_state = 0;
+ return 1;
+ }
+ if (!(kbd = _e_kbd_by_border_get(ev->border))) return 1;
+ if (kbd->border == ev->border)
+ {
+ kbd->border = NULL;
+ if (kbd->waiting_borders)
+ {
+ E_Border *bd;
+
+ bd = kbd->waiting_borders->data;
+ kbd->waiting_borders =
+ eina_list_remove_list(kbd->waiting_borders, kbd->waiting_borders);
+ _e_kbd_border_adopt(kbd, bd);
+ }
+ if (kbd->visible)
+ {
+ _e_kbd_border_hide(ev->border);
+ e_kbd_hide(kbd);
+ }
+ }
+ else
+ kbd->waiting_borders = eina_list_remove(kbd->waiting_borders, ev->border);
+ return 1;
+}
+
+static int
+_e_kbd_cb_border_focus_in(void *data, int type, void *event)
+{
+ E_Event_Border_Focus_In *ev;
+
+ ev = event;
+ if (_e_kbd_by_border_get(ev->border)) return 1;
+ focused_border = ev->border;
+ focused_vkbd_state = ev->border->client.vkbd.state;
+ if (focused_vkbd_state == 0) return 1;
+ if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_NONE);
+ _e_kbd_all_hide();
+ return 1;
+ }
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PASSWORD);
+ else
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_DEFAULT);
+ _e_kbd_all_show();
+ return 1;
+}
+
+static int
+_e_kbd_cb_border_focus_out(void *data, int type, void *event)
+{
+ E_Event_Border_Focus_Out *ev;
+
+ ev = event;
+ if (_e_kbd_by_border_get(ev->border)) return 1;
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_NONE);
+ _e_kbd_all_hide();
+ focused_border = NULL;
+ focused_vkbd_state = 0;
+ return 1;
+}
+
+static int
+_e_kbd_cb_border_property(void *data, int type, void *event)
+{
+ E_Event_Border_Property *ev;
+
+ ev = event;
+ if (_e_kbd_by_border_get(ev->border)) return 1;
+ if (!ev->border->focused) return 1;
+ if ((ev->border == focused_border) &&
+ (ev->border->client.vkbd.state == focused_vkbd_state)) return 1;
+ focused_vkbd_state = ev->border->client.vkbd.state;
+ if ((ev->border->need_fullscreen) || (ev->border->fullscreen))
+ e_kbd_fullscreen_set(ev->border->zone, 1);
+ else
+ e_kbd_fullscreen_set(ev->border->zone, 0);
+ if (ev->border->client.vkbd.state == 0) return 1;
+ /* app wants kbd off - then kbd off it is */
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ _e_kbd_all_hide();
+ /* app wants something else than off... */
+ else
+ {
+ if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_ALPHA);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_NUMERIC);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PIN);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PHONE_NUMBER);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_HEX);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_TERMINAL);
+ else if (ev->border->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD)
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_PASSWORD);
+ else
+ _e_kbd_all_layout_set(E_KBD_LAYOUT_DEFAULT);
+ _e_kbd_all_show();
+ }
+ return 1;
+}
+
+/* hooks */
+static void
+_e_kbd_cb_border_pre_post_fetch(void *data, void *data2)
+{
+ E_Border *bd;
+
+ if (!(bd = data2)) return;
+ if (!bd->new_client) return;
+ if (_e_kbd_by_border_get(bd)) return;
+ if (_e_kbd_border_is_keyboard(bd))
+ {
+ Eina_List *l;
+ E_Kbd *kbd;
+
+ EINA_LIST_FOREACH(kbds, l, kbd)
+ {
+ if (!kbd->border)
+ _e_kbd_border_adopt(kbd, bd);
+ else
+ kbd->waiting_borders = eina_list_append(kbd->waiting_borders, bd);
+ bd->stolen = 1;
+ if (bd->remember)
+ {
+ if (bd->bordername)
+ {
+ eina_stringshare_del(bd->bordername);
+ bd->bordername = NULL;
+ bd->client.border.changed = 1;
+ }
+ e_remember_unuse(bd->remember);
+ bd->remember = NULL;
+ }
+ eina_stringshare_replace(&bd->bordername, "borderless");
+ bd->client.border.changed = 1;
+ return;
+ }
+ }
+}
--- /dev/null
+#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
--- /dev/null
+#include "E_Illume.h"
+#include "e_kbd.h"
+#include "e_kbd_dbus.h"
+
+/* local variables */
+static int have_real_kbd = 0;
+static E_DBus_Connection *dbus_conn = NULL;
+static E_DBus_Signal_Handler *dbus_dev_add = NULL;
+static E_DBus_Signal_Handler *dbus_dev_del = NULL;
+static E_DBus_Signal_Handler *dbus_dev_chg = NULL;
+static Eina_List *dbus_kbds = NULL, *ignore_kbds = NULL;
+
+/* local function prototypes */
+static void _e_kbd_dbus_cb_input_kbd(void *data, void *reply, DBusError *err);
+static void _e_kbd_dbus_cb_input_kbd_is(void *data, void *reply, DBusError *err);
+static void _e_kbd_dbus_ignore_kbds_load(void);
+static void _e_kbd_dbus_ignore_kbds_file_load(const char *file);
+static void _e_kbd_dbus_kbd_add(const char *udi);
+static void _e_kbd_dbus_kbd_del(const char *udi);
+static void _e_kbd_dbus_kbd_eval(void);
+static void _e_kbd_dbus_dev_add(void *data, DBusMessage *msg);
+static void _e_kbd_dbus_dev_del(void *data, DBusMessage *msg);
+static void _e_kbd_dbus_dev_chg(void *data, DBusMessage *msg);
+
+/* public functions */
+void
+e_kbd_dbus_init(void)
+{
+ /* load the 'ignore' keyboard files */
+ _e_kbd_dbus_ignore_kbds_load();
+
+ /* attempt to connect to the system dbus */
+ if (!(dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM))) return;
+
+ /* ask HAL for any input keyboards */
+ e_hal_manager_find_device_by_capability(dbus_conn, "input.keyboard",
+ _e_kbd_dbus_cb_input_kbd, NULL);
+
+ /* setup dbus signal handlers for when a device gets added/removed/changed */
+ dbus_dev_add =
+ e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/Manager",
+ "org.freedesktop.Hal.Manager",
+ "DeviceAdded", _e_kbd_dbus_dev_add, NULL);
+ dbus_dev_del =
+ e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/Manager",
+ "org.freedesktop.Hal.Manager",
+ "DeviceRemoved", _e_kbd_dbus_dev_del, NULL);
+ dbus_dev_chg =
+ e_dbus_signal_handler_add(dbus_conn, "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/Manager",
+ "org.freedesktop.Hal.Manager",
+ "NewCapability", _e_kbd_dbus_dev_chg, NULL);
+}
+
+void
+e_kbd_dbus_shutdown(void)
+{
+ char *str;
+
+ /* remove the dbus signal handlers if we can */
+ if (dbus_conn)
+ {
+ e_dbus_signal_handler_del(dbus_conn, dbus_dev_add);
+ e_dbus_signal_handler_del(dbus_conn, dbus_dev_del);
+ e_dbus_signal_handler_del(dbus_conn, dbus_dev_chg);
+ }
+
+ /* free the list of ignored keyboards */
+ EINA_LIST_FREE(ignore_kbds, str)
+ eina_stringshare_del(str);
+
+ /* free the list of keyboards */
+ EINA_LIST_FREE(dbus_kbds, str)
+ eina_stringshare_del(str);
+}
+
+/* local functions */
+static void
+_e_kbd_dbus_cb_input_kbd(void *data, void *reply, DBusError *err)
+{
+ E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply;
+ Eina_List *l;
+ char *dev;
+
+ if ((!ret) || (!ret->strings)) return;
+
+ /* if dbus errored then cleanup and get out */
+ if (dbus_error_is_set(err))
+ {
+ dbus_error_free(err);
+ return;
+ }
+
+ /* for each returned keyboard, add it and evaluate it */
+ EINA_LIST_FOREACH(ret->strings, l, dev)
+ {
+ _e_kbd_dbus_kbd_add(dev);
+ _e_kbd_dbus_kbd_eval();
+ }
+}
+
+static void
+_e_kbd_dbus_cb_input_kbd_is(void *data, void *reply, DBusError *err)
+{
+ E_Hal_Device_Query_Capability_Return *ret = reply;
+ char *udi = data;
+
+ /* if dbus errored then cleanup and get out */
+ if (dbus_error_is_set(err))
+ {
+ dbus_error_free(err);
+ if (udi) free(udi);
+ return;
+ }
+
+ /* if it's an input keyboard, than add it and eval */
+ if ((ret) && (ret->boolean))
+ {
+ _e_kbd_dbus_kbd_add(udi);
+ _e_kbd_dbus_kbd_eval();
+ }
+}
+
+static void
+_e_kbd_dbus_ignore_kbds_load(void)
+{
+ char buff[PATH_MAX];
+
+ /* load the 'ignore' file from the user's home dir */
+ e_user_dir_concat_static(buff, "keyboards/ignore_built_in_keyboards");
+ _e_kbd_dbus_ignore_kbds_file_load(buff);
+
+ /* load the 'ignore' file from the system/module dir */
+ snprintf(buff, sizeof(buff),
+ "%s/keyboards/ignore_built_in_keyboards", il_cfg->mod_dir);
+ _e_kbd_dbus_ignore_kbds_file_load(buff);
+}
+
+static void
+_e_kbd_dbus_ignore_kbds_file_load(const char *file)
+{
+ char buf[PATH_MAX];
+ FILE *f;
+
+ /* can this file be opened */
+ if (!(f = fopen(file, "r"))) return;
+
+ /* parse out the info in the ignore file */
+ while (fgets(buf, sizeof(buf), f))
+ {
+ char *p;
+ int len;
+
+ if (buf[0] == '#') continue;
+ len = strlen(buf);
+ if (len > 0)
+ {
+ if (buf[len - 1] == '\n') buf[len - 1] = 0;
+ }
+ p = buf;
+ while (isspace(*p)) p++;
+
+ /* append this kbd to the ignore list */
+ if (*p)
+ ignore_kbds = eina_list_append(ignore_kbds, eina_stringshare_add(p));
+ }
+ fclose(f);
+}
+
+static void
+_e_kbd_dbus_kbd_add(const char *udi)
+{
+ const char *str;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(dbus_kbds, l, str)
+ if (!strcmp(str, udi)) return;
+ dbus_kbds = eina_list_append(dbus_kbds, eina_stringshare_add(udi));
+}
+
+static void
+_e_kbd_dbus_kbd_del(const char *udi)
+{
+ const char *str;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(dbus_kbds, l, str)
+ if (!strcmp(str, udi))
+ {
+ eina_stringshare_del(str);
+ dbus_kbds = eina_list_remove_list(dbus_kbds, l);
+ return;
+ }
+}
+
+static void
+_e_kbd_dbus_kbd_eval(void)
+{
+ Eina_List *l, *ll;
+ const char *g, *gg;
+ int have_real = 0;
+
+ have_real = eina_list_count(dbus_kbds);
+ EINA_LIST_FOREACH(dbus_kbds, l, g)
+ EINA_LIST_FOREACH(ignore_kbds, ll, gg)
+ if (e_util_glob_match(g, gg))
+ {
+ have_real--;
+ break;
+ }
+ if (have_real != have_real_kbd)
+ {
+ have_real_kbd = have_real;
+#if 0
+ if (have_real_kbd) e_kbd_all_disable();
+ else
+#endif
+ e_kbd_all_enable();
+ }
+}
+
+static void
+_e_kbd_dbus_dev_add(void *data, DBusMessage *msg)
+{
+ DBusError err;
+ char *udi;
+ int ret;
+
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
+ ret = e_hal_device_query_capability(dbus_conn, udi, "input.keyboard",
+ _e_kbd_dbus_cb_input_kbd_is, udi);
+}
+
+static void
+_e_kbd_dbus_dev_del(void *data, DBusMessage *msg)
+{
+ DBusError err;
+ char *udi;
+
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
+ if (udi)
+ {
+ _e_kbd_dbus_kbd_del(udi);
+ _e_kbd_dbus_kbd_eval();
+ free(udi);
+ }
+}
+
+static void
+_e_kbd_dbus_dev_chg(void *data, DBusMessage *msg)
+{
+ DBusError err;
+ char *udi, *cap;
+
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi,
+ DBUS_TYPE_STRING, &cap, DBUS_TYPE_INVALID);
+ if (!strcmp(cap, "input.keyboard"))
+ {
+ _e_kbd_dbus_kbd_add(udi);
+ _e_kbd_dbus_kbd_eval();
+ }
+ if (cap) free(cap);
+ if (udi) free(udi);
+}
--- /dev/null
+#ifndef E_KBD_DBUS_H
+#define E_KBD_DBUS_H
+
+void e_kbd_dbus_init(void);
+void e_kbd_dbus_shutdown(void);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_animation.h"
+
+/* local function prototypes */
+static void *_il_config_animation_create(E_Config_Dialog *cfd);
+static void _il_config_animation_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_il_config_animation_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+static void _il_config_animation_change(void *data, Evas_Object *obj, void *event);
+static int _il_config_animation_change_timeout(void *data);
+
+/* local variables */
+Ecore_Timer *_anim_change_timer = NULL;
+
+/* public functions */
+void
+il_config_animation_show(E_Container *con, const char *params)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+
+ if (e_config_dialog_find("E", "_config_illume_animation_settings")) return;
+ v = E_NEW(E_Config_Dialog_View, 1);
+ v->create_cfdata = _il_config_animation_create;
+ v->free_cfdata = _il_config_animation_free;
+ v->basic.create_widgets = _il_config_animation_ui;
+ v->basic_only = 1;
+ v->normal_win = 1;
+ v->scroll = 1;
+ cfd = e_config_dialog_new(con, _("Animation Settings"), "E",
+ "_config_illume_animation_settings",
+ "enlightenment/animation_settings", 0, v, NULL);
+ e_dialog_resizable_set(cfd->dia, 1);
+}
+
+/* local function prototypes */
+static void *
+_il_config_animation_create(E_Config_Dialog *cfd)
+{
+ return NULL;
+}
+
+static void
+_il_config_animation_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
+}
+
+static Evas_Object *
+_il_config_animation_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *list, *of, *ow;
+ E_Radio_Group *rg;
+
+ list = e_widget_list_add(evas, 0, 0);
+
+ of = e_widget_framelist_add(evas, _("Keyboard"), 0);
+ rg = e_widget_radio_group_new(&(il_cfg->sliding.kbd.duration));
+ ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Off"), 0, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ of = e_widget_framelist_add(evas, _("Quickpanel"), 0);
+ rg = e_widget_radio_group_new(&(il_cfg->sliding.quickpanel.duration));
+ ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ ow = e_widget_radio_add(evas, _("Off"), 0, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_animation_change, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ return list;
+}
+
+static void
+_il_config_animation_change(void *data, Evas_Object *obj, void *event)
+{
+ if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
+ _anim_change_timer =
+ ecore_timer_add(0.5, _il_config_animation_change_timeout, data);
+}
+
+static int
+_il_config_animation_change_timeout(void *data)
+{
+ e_config_save_queue();
+ _anim_change_timer = NULL;
+ return 0;
+}
--- /dev/null
+#ifndef E_MOD_ANIM_H
+#define E_MOD_ANIM_H
+
+void il_config_animation_show(E_Container *con, const char *params);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_kbd.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// :: Convenience routines to make it easy to write layout logic code ::
+
+// activate a window - meant for main app and home app windows
+void
+e_illume_border_activate(E_Border *bd)
+{
+ e_desk_show(bd->desk);
+ e_border_uniconify(bd);
+ e_border_raise(bd);
+ e_border_show(bd);
+ e_border_focus_set(bd, 1, 1);
+}
+
+// activate a window that isnt meant to get the focus - like panels, kbd etc.
+void
+e_illume_border_show(E_Border *bd)
+{
+ e_desk_show(bd->desk);
+ e_border_uniconify(bd);
+ e_border_raise(bd);
+ e_border_show(bd);
+}
+
+// get a window away from being visile (but maintain it)
+void
+e_illume_border_deactivate(E_Border *bd)
+{
+ e_border_iconify(bd);
+}
+
+// get window info - is this one a dialog?
+EAPI int
+e_illume_border_is_dialog(E_Border *bd)
+{
+ int isdialog = 0, i;
+
+ if (bd->client.icccm.transient_for != 0) isdialog = 1;
+ if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
+ {
+ isdialog = 1;
+ if (bd->client.netwm.extra_types)
+ {
+ for (i = 0; i < bd->client.netwm.extra_types_num; i++)
+ {
+ if (bd->client.netwm.extra_types[i] ==
+ ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
+ if ((bd->client.netwm.extra_types[i] !=
+ ECORE_X_WINDOW_TYPE_DIALOG) &&
+ (bd->client.netwm.extra_types[i] !=
+ ECORE_X_WINDOW_TYPE_SPLASH))
+ {
+ return 0;
+ }
+ }
+ }
+ }
+ return isdialog;
+}
+
+// get window info - is this a vkbd window
+EAPI int
+e_illume_border_is_keyboard(E_Border *bd)
+{
+ if (bd->client.vkbd.vkbd) return 1;
+ if (il_cfg->policy.vkbd.match.title)
+ {
+ if ((bd->client.icccm.title) &&
+ (!strcmp(bd->client.icccm.title, il_cfg->policy.vkbd.title)))
+ return 1;
+ }
+ if (il_cfg->policy.vkbd.match.name)
+ {
+ if ((bd->client.icccm.name) &&
+ (!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
+ return 1;
+ }
+ if (il_cfg->policy.vkbd.match.class)
+ {
+ if ((bd->client.icccm.class) &&
+ (!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
+ return 1;
+ }
+ if ((bd->client.icccm.name) &&
+ ((!strcmp(bd->client.icccm.name, "multitap-pad")))
+ && (bd->client.netwm.state.skip_taskbar)
+ && (bd->client.netwm.state.skip_pager))
+ return 1;
+ return 0;
+}
+
+// get window info - is it a bottom app panel window (eg qtopia softmenu)
+EAPI int
+e_illume_border_is_bottom_panel(E_Border *bd)
+{
+ if (il_cfg->policy.softkey.match.title)
+ {
+ if ((bd->client.icccm.title) &&
+ (!strcmp(bd->client.icccm.title, il_cfg->policy.softkey.title)))
+ return 1;
+ }
+ if (il_cfg->policy.softkey.match.name)
+ {
+ if ((bd->client.icccm.name) &&
+ (!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
+ return 1;
+ }
+ if (il_cfg->policy.softkey.match.class)
+ {
+ if ((bd->client.icccm.class) &&
+ (!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
+ return 1;
+ }
+ if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
+ (bd->client.qtopia.soft_menu)))
+ return 1;
+ return 0;
+}
+
+// get window info - is it a top shelf window
+EAPI int
+e_illume_border_is_top_shelf(E_Border *bd)
+{
+ if (il_cfg->policy.indicator.match.title)
+ {
+ if ((bd->client.icccm.title) &&
+ (!strcmp(bd->client.icccm.title, il_cfg->policy.indicator.title)))
+ return 1;
+ }
+ if (il_cfg->policy.indicator.match.name)
+ {
+ if ((bd->client.icccm.name) &&
+ (!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
+ return 1;
+ }
+ if (il_cfg->policy.indicator.match.class)
+ {
+ if ((bd->client.icccm.class) &&
+ (!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
+ return 1;
+ }
+ return 0;
+}
+
+// get window info - is it a home window
+EAPI int
+e_illume_border_is_home(E_Border *bd)
+{
+ if (il_cfg->policy.home.match.title)
+ {
+ if ((bd->client.icccm.title) &&
+ (!strcmp(bd->client.icccm.title, il_cfg->policy.home.title)))
+ return 1;
+ }
+ if (il_cfg->policy.home.match.name)
+ {
+ if ((bd->client.icccm.name) &&
+ (!strcmp(bd->client.icccm.name, il_cfg->policy.home.name)))
+ return 1;
+ }
+ if (il_cfg->policy.home.match.class)
+ {
+ if ((bd->client.icccm.class) &&
+ (!strcmp(bd->client.icccm.class, il_cfg->policy.home.class)))
+ return 1;
+ }
+ return 0;
+}
+
+EAPI int
+e_illume_border_is_conformant(E_Border *bd)
+{
+ if (strstr(bd->client.icccm.class, "config")) return EINA_FALSE;
+ return ecore_x_e_illume_conformant_get(bd->client.win);
+}
+
+EAPI int
+e_illume_border_is_quickpanel(E_Border *bd)
+{
+ if (strstr(bd->client.icccm.class, "config")) return EINA_FALSE;
+ return ecore_x_e_illume_quickpanel_get(bd->client.win);
+}
+
+EAPI int
+e_illume_border_is_valid(E_Border *bd)
+{
+ if (!bd) return EINA_FALSE;
+ if (e_illume_border_is_dialog(bd)) return EINA_FALSE;
+ if (e_illume_border_is_keyboard(bd)) return EINA_FALSE;
+ if (e_illume_border_is_bottom_panel(bd)) return EINA_FALSE;
+ if (e_illume_border_is_top_shelf(bd)) return EINA_FALSE;
+ if (e_illume_border_is_quickpanel(bd)) return EINA_FALSE;
+ return EINA_TRUE;
+}
+
+EAPI Eina_List *
+e_illume_border_valid_borders_get(E_Zone *zone)
+{
+ Eina_List *bds, *l, *ret = NULL;
+ E_Border *bd;
+
+ bds = e_border_client_list();
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (!bd) continue;
+ if (bd->zone != zone) continue;
+ if (e_illume_border_is_top_shelf(bd)) continue;
+ if (e_illume_border_is_bottom_panel(bd)) continue;
+ if (e_illume_border_is_keyboard(bd)) continue;
+ if (e_illume_border_is_dialog(bd)) continue;
+ if (e_illume_border_is_quickpanel(bd)) continue;
+ ret = eina_list_append(ret, bd);
+ }
+ return ret;
+}
+
+EAPI E_Border *
+e_illume_border_valid_border_get(E_Zone *zone)
+{
+ Eina_List *bds, *l;
+ E_Border *bd, *ret = NULL;
+
+ bds = e_border_client_list();
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (!bd) continue;
+ if (bd->zone != zone) continue;
+ if (e_illume_border_is_top_shelf(bd)) continue;
+ if (e_illume_border_is_bottom_panel(bd)) continue;
+ if (e_illume_border_is_keyboard(bd)) continue;
+ if (e_illume_border_is_dialog(bd)) continue;
+ if (e_illume_border_is_quickpanel(bd)) continue;
+ ret = bd;
+ break;
+ }
+ return ret;
+}
+
+EAPI int
+e_illume_border_valid_count_get(E_Zone *zone)
+{
+ Eina_List *l;
+ int count;
+
+ l = e_illume_border_valid_borders_get(zone);
+ count = eina_list_count(l);
+ eina_list_free(l);
+ return count;
+}
+
+EAPI Eina_List *
+e_illume_border_quickpanel_borders_get(E_Zone *zone)
+{
+ Eina_List *bds, *l, *ret = NULL;
+ E_Border *bd;
+
+ bds = e_border_client_list();
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (!bd) continue;
+ if (bd->zone != zone) continue;
+ if (!e_illume_border_is_quickpanel(bd)) continue;
+ ret = eina_list_append(ret, bd);
+ }
+ return ret;
+}
+
+EAPI int
+e_illume_border_quickpanel_count_get(E_Zone *zone)
+{
+ Eina_List *l;
+ int count;
+
+ l = e_illume_border_quickpanel_borders_get(zone);
+ count = eina_list_count(l);
+ eina_list_free(l);
+ return count;
+}
+
+EAPI E_Border *
+e_illume_border_at_xy_get(E_Zone *zone, int x, int y)
+{
+ Eina_List *bds, *l;
+ E_Border *bd, *b = NULL;
+
+ bds = e_illume_border_valid_borders_get(zone);
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (((bd->fx.x == x) && (bd->fx.y == y)) ||
+ ((bd->x == x) && (bd->y == y)))
+ {
+ b = bd;
+ break;
+ }
+ }
+ eina_list_free(bds);
+ return b;
+}
+
+EAPI E_Border *
+e_illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h)
+{
+ Eina_List *bds, *l;
+ E_Border *bd, *b = NULL;
+
+ bds = e_illume_border_valid_borders_get(zone);
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (E_INSIDE(bd->x, bd->fx.y, x, y, w, h))
+ {
+ b = bd;
+ break;
+ }
+ }
+ eina_list_free(bds);
+ return b;
+}
+
+EAPI E_Border *
+e_illume_border_top_shelf_get(E_Zone *zone)
+{
+ Eina_List *bds, *l;
+ E_Border *bd, *b = NULL;
+
+ bds = e_border_client_list();
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (bd->zone != zone) continue;
+ if (!e_illume_border_is_top_shelf(bd)) continue;
+ b = bd;
+ break;
+ }
+ return b;
+}
+
+EAPI E_Border *
+e_illume_border_bottom_panel_get(E_Zone *zone)
+{
+ Eina_List *bds, *l;
+ E_Border *bd, *b = NULL;
+
+ bds = e_border_client_list();
+ EINA_LIST_FOREACH(bds, l, bd)
+ {
+ if (bd->zone != zone) continue;
+ if (!e_illume_border_is_bottom_panel(bd)) continue;
+ b = bd;
+ break;
+ }
+ return b;
+}
+
+EAPI void
+e_illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y)
+{
+ E_Border *bd;
+
+ if (!(bd = e_illume_border_top_shelf_get(zone))) return;
+ if (x) *x = bd->x;
+ if (y) *y = bd->y;
+}
+
+EAPI void
+e_illume_border_top_shelf_size_get(E_Zone *zone, int *w, int *h)
+{
+ E_Border *bd;
+
+ if (!(bd = e_illume_border_top_shelf_get(zone))) return;
+ if (w) *w = bd->w;
+ if (h) *h = bd->h;
+}
+
+EAPI void
+e_illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y)
+{
+ E_Border *bd;
+
+ if (!(bd = e_illume_border_bottom_panel_get(zone))) return;
+ if (x) *x = bd->x;
+ if (y) *y = bd->y;
+}
+
+EAPI void
+e_illume_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h)
+{
+ E_Border *bd;
+
+ if (!(bd = e_illume_border_bottom_panel_get(zone))) return;
+ if (w) *w = bd->w;
+ if (h) *h = bd->h;
+}
+
+EAPI void
+e_illume_border_slide_to(E_Border *bd, int x, int y, E_Illume_Animation_Class aclass)
+{
+ // FIXME: do
+ // 1. if an existing slide exists, use is current offset x,y as current border pos, new x,y as new pos and start slide again
+}
+
+EAPI void
+e_illume_border_min_get(E_Border *bd, int *mw, int *mh)
+{
+ if (mw)
+ {
+ if (bd->client.icccm.base_w > bd->client.icccm.min_w)
+ *mw = bd->client.icccm.base_w;
+ else
+ *mw = bd->client.icccm.min_w;
+ }
+ if (mh)
+ {
+ if (bd->client.icccm.base_h > bd->client.icccm.min_h)
+ *mh = bd->client.icccm.base_h;
+ else
+ *mh = bd->client.icccm.min_h;
+ }
+}
+
+EAPI void
+e_illume_border_max_get(E_Border *bd, int *mw, int *mh)
+{
+ if (mw)
+ {
+ if (bd->client.icccm.base_w > bd->client.icccm.max_w)
+ *mw = bd->client.icccm.base_w;
+ else
+ *mw = bd->client.icccm.max_w;
+ }
+ if (mh)
+ {
+ if (bd->client.icccm.base_h > bd->client.icccm.max_h)
+ *mh = bd->client.icccm.base_h;
+ else
+ *mh = bd->client.icccm.max_h;
+ }
+}
+
+EAPI void
+e_illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
+{
+ int ty, nx, ny, nw, nh;
+
+ if (!zone) return;
+ e_illume_kbd_safe_app_region_get(zone, &nx, &ny, &nw, &nh);
+ e_illume_border_top_shelf_pos_get(zone, NULL, &ty);
+ if (nh >= zone->h) nh = (ny + ty);
+ if (x) *x = nx;
+ if (y) *y = ny;
+ if (w) *w = nw;
+ if (h) *h = nh;
+}
+
+EAPI void
+e_illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
+{
+ int ty, th, bh;
+ int nx, ny, nw, nh;
+
+ if (!zone) return;
+ e_illume_kbd_safe_app_region_get(zone, &nx, NULL, &nw, &nh);
+ e_illume_border_top_shelf_pos_get(zone, NULL, &ty);
+ e_illume_border_top_shelf_size_get(zone, NULL, &th);
+ e_illume_border_bottom_panel_size_get(zone, NULL, &bh);
+ ny = (ty + th);
+ nh = (nh - ny - bh);
+ if (x) *x = nx;
+ if (y) *y = ny;
+ if (w) *w = nw;
+ if (h) *h = nh;
+}
--- /dev/null
+#include "E_Illume.h"
+//#include "e_mod_main.h"
+#include "e_mod_config.h"
+#include "e_mod_animation.h"
+#include "e_mod_policy.h"
+#include "e_mod_policy_settings.h"
+#include "e_mod_windows.h"
+
+/* local variables */
+EAPI E_Illume_Config *il_cfg = NULL;
+static E_Config_DD *conf_edd = NULL;
+
+/* public functions */
+int
+e_mod_config_init(E_Module *m)
+{
+ conf_edd = E_CONFIG_DD_NEW("Illume_Cfg", E_Illume_Config);
+ #undef T
+ #undef D
+ #define T E_Illume_Config
+ #define D conf_edd
+ E_CONFIG_VAL(D, T, version, INT);
+ E_CONFIG_VAL(D, T, sliding.kbd.duration, INT);
+ E_CONFIG_VAL(D, T, sliding.softkey.duration, INT);
+ E_CONFIG_VAL(D, T, sliding.quickpanel.duration, INT);
+ E_CONFIG_VAL(D, T, policy.name, STR);
+ E_CONFIG_VAL(D, T, policy.mode.dual, INT);
+ E_CONFIG_VAL(D, T, policy.mode.side, INT);
+ E_CONFIG_VAL(D, T, policy.vkbd.class, STR);
+ E_CONFIG_VAL(D, T, policy.vkbd.name, STR);
+ E_CONFIG_VAL(D, T, policy.vkbd.title, STR);
+ E_CONFIG_VAL(D, T, policy.vkbd.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.vkbd.match.class, INT);
+ E_CONFIG_VAL(D, T, policy.vkbd.match.name, INT);
+ E_CONFIG_VAL(D, T, policy.vkbd.match.title, INT);
+ E_CONFIG_VAL(D, T, policy.vkbd.match.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.softkey.class, STR);
+ E_CONFIG_VAL(D, T, policy.softkey.name, STR);
+ E_CONFIG_VAL(D, T, policy.softkey.title, STR);
+ E_CONFIG_VAL(D, T, policy.softkey.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.softkey.match.class, INT);
+ E_CONFIG_VAL(D, T, policy.softkey.match.name, INT);
+ E_CONFIG_VAL(D, T, policy.softkey.match.title, INT);
+ E_CONFIG_VAL(D, T, policy.softkey.match.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.home.class, STR);
+ E_CONFIG_VAL(D, T, policy.home.name, STR);
+ E_CONFIG_VAL(D, T, policy.home.title, STR);
+ E_CONFIG_VAL(D, T, policy.home.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.home.match.class, INT);
+ E_CONFIG_VAL(D, T, policy.home.match.name, INT);
+ E_CONFIG_VAL(D, T, policy.home.match.title, INT);
+ E_CONFIG_VAL(D, T, policy.home.match.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.indicator.class, STR);
+ E_CONFIG_VAL(D, T, policy.indicator.name, STR);
+ E_CONFIG_VAL(D, T, policy.indicator.title, STR);
+ E_CONFIG_VAL(D, T, policy.indicator.win_type, INT);
+ E_CONFIG_VAL(D, T, policy.indicator.match.class, INT);
+ E_CONFIG_VAL(D, T, policy.indicator.match.name, INT);
+ E_CONFIG_VAL(D, T, policy.indicator.match.title, INT);
+ E_CONFIG_VAL(D, T, policy.indicator.match.win_type, INT);
+
+ il_cfg = e_config_domain_load("module.illume2", conf_edd);
+ if ((il_cfg) &&
+ ((il_cfg->version >> 16) < IL_CONFIG_MAJ))
+ {
+ E_FREE(il_cfg);
+ il_cfg = NULL;
+ }
+ if (!il_cfg)
+ {
+ il_cfg = E_NEW(E_Illume_Config, 1);
+ il_cfg->version = 0;
+ il_cfg->sliding.kbd.duration = 1000;
+ il_cfg->sliding.softkey.duration = 1000;
+ }
+ if (il_cfg)
+ {
+ /* Add new config variables here */
+ if ((il_cfg->version & 0xffff) < 1)
+ {
+ il_cfg->policy.name = eina_stringshare_add("Illume");
+ il_cfg->policy.vkbd.class =
+ eina_stringshare_add("Virtual-Keyboard");
+ il_cfg->policy.vkbd.name =
+ eina_stringshare_add("Virtual-Keyboard");
+ il_cfg->policy.vkbd.title =
+ eina_stringshare_add("Virtual Keyboard");
+ il_cfg->policy.vkbd.win_type = ECORE_X_WINDOW_TYPE_NORMAL;
+ il_cfg->policy.vkbd.match.class = 0;
+ il_cfg->policy.vkbd.match.name = 1;
+ il_cfg->policy.vkbd.match.title = 1;
+ il_cfg->policy.vkbd.match.win_type = 0;
+ il_cfg->policy.softkey.class =
+ eina_stringshare_add("Illume-Softkey");
+ il_cfg->policy.softkey.name =
+ eina_stringshare_add("Illume-Softkey");
+ il_cfg->policy.softkey.title =
+ eina_stringshare_add("Illume Softkey");
+ il_cfg->policy.softkey.win_type = ECORE_X_WINDOW_TYPE_DOCK;
+ il_cfg->policy.softkey.match.class = 0;
+ il_cfg->policy.softkey.match.name = 1;
+ il_cfg->policy.softkey.match.title = 1;
+ il_cfg->policy.softkey.match.win_type = 0;
+ il_cfg->policy.home.class =
+ eina_stringshare_add("Illume-Home");
+ il_cfg->policy.home.name =
+ eina_stringshare_add("Illume-Home");
+ il_cfg->policy.home.title =
+ eina_stringshare_add("Illume Home");
+ il_cfg->policy.home.win_type = ECORE_X_WINDOW_TYPE_NORMAL;
+ il_cfg->policy.home.match.class = 0;
+ il_cfg->policy.home.match.name = 1;
+ il_cfg->policy.home.match.title = 1;
+ il_cfg->policy.home.match.win_type = 0;
+ il_cfg->policy.indicator.class =
+ eina_stringshare_add("Illume-Indicator");
+ il_cfg->policy.indicator.name =
+ eina_stringshare_add("Illume-Indicator");
+ il_cfg->policy.indicator.title =
+ eina_stringshare_add("Illume Indicator");
+ il_cfg->policy.indicator.win_type = ECORE_X_WINDOW_TYPE_DOCK;
+ il_cfg->policy.indicator.match.class = 0;
+ il_cfg->policy.indicator.match.name = 1;
+ il_cfg->policy.indicator.match.title = 1;
+ il_cfg->policy.indicator.match.win_type = 0;
+ }
+ if ((il_cfg->version & 0xffff) < 2)
+ {
+ il_cfg->policy.mode.dual = 0;
+ il_cfg->policy.mode.side = 0;
+ }
+ if ((il_cfg->version & 0xffff) < 3)
+ {
+ il_cfg->sliding.quickpanel.duration = 1000;
+ }
+ il_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
+ }
+ il_cfg->mod_dir = eina_stringshare_add(m->dir);
+
+ e_configure_registry_category_add("illume", 0, _("Illume"), NULL,
+ "enlightenment/display");
+ e_configure_registry_generic_item_add("illume/animation", 0, _("Animation"),
+ NULL, "enlightenment/animation",
+ il_config_animation_show);
+ e_configure_registry_generic_item_add("illume/windows", 0, _("Windows"),
+ NULL, "enlightenment/windows",
+ il_config_windows_show);
+ e_configure_registry_generic_item_add("illume/policy", 0, _("Policy"),
+ NULL, "enlightenment/policy",
+ il_config_policy_show);
+ e_configure_registry_generic_item_add("illume/policy_settings", 0,
+ _("Policy Settings"),
+ NULL, "enlightenment/policy",
+ il_config_policy_settings_show);
+ return 1;
+}
+
+int
+e_mod_config_shutdown(void)
+{
+ e_configure_registry_item_del("illume/policy_settings");
+ e_configure_registry_item_del("illume/policy");
+ e_configure_registry_item_del("illume/windows");
+ e_configure_registry_item_del("illume/animation");
+ e_configure_registry_category_del("illume");
+
+ if (il_cfg->policy.name) eina_stringshare_del(il_cfg->policy.name);
+
+ if (il_cfg->policy.vkbd.class)
+ eina_stringshare_del(il_cfg->policy.vkbd.class);
+ if (il_cfg->policy.vkbd.name)
+ eina_stringshare_del(il_cfg->policy.vkbd.name);
+ if (il_cfg->policy.vkbd.title)
+ eina_stringshare_del(il_cfg->policy.vkbd.title);
+
+ if (il_cfg->policy.softkey.class)
+ eina_stringshare_del(il_cfg->policy.softkey.class);
+ if (il_cfg->policy.softkey.name)
+ eina_stringshare_del(il_cfg->policy.softkey.name);
+ if (il_cfg->policy.softkey.title)
+ eina_stringshare_del(il_cfg->policy.softkey.title);
+
+ if (il_cfg->policy.home.class)
+ eina_stringshare_del(il_cfg->policy.home.class);
+ if (il_cfg->policy.home.name)
+ eina_stringshare_del(il_cfg->policy.home.name);
+ if (il_cfg->policy.home.title)
+ eina_stringshare_del(il_cfg->policy.home.title);
+
+ if (il_cfg->policy.indicator.class)
+ eina_stringshare_del(il_cfg->policy.indicator.class);
+ if (il_cfg->policy.indicator.name)
+ eina_stringshare_del(il_cfg->policy.indicator.name);
+ if (il_cfg->policy.indicator.title)
+ eina_stringshare_del(il_cfg->policy.indicator.title);
+
+ if (il_cfg->mod_dir) eina_stringshare_del(il_cfg->mod_dir);
+ il_cfg->mod_dir = NULL;
+
+ E_FREE(il_cfg);
+ il_cfg = NULL;
+
+ E_CONFIG_DD_FREE(conf_edd);
+ return 1;
+}
+
+int
+e_mod_config_save(void)
+{
+ e_config_domain_save("module.illume2", conf_edd, il_cfg);
+ return 1;
+}
--- /dev/null
+#ifndef E_MOD_CONFIG_H
+# define E_MOD_CONFIG_H
+
+# define IL_CONFIG_MIN 3
+# define IL_CONFIG_MAJ 0
+
+int e_mod_config_init(E_Module *m);
+int e_mod_config_shutdown(void);
+int e_mod_config_save(void);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_main.h"
+#include "e_mod_layout.h"
+
+/* local function prototypes */
+static void _e_mod_layout_free(E_Illume_Layout_Policy *p);
+static int _e_mod_layout_policy_load(const char *file);
+static void _e_mod_layout_handlers_add(void);
+static void _e_mod_layout_handlers_del(void);
+static void _e_mod_layout_hooks_add(void);
+static void _e_mod_layout_hooks_del(void);
+static void _e_mod_layout_cb_hook_container_layout(void *data, void *data2);
+static void _e_mod_layout_cb_hook_post_fetch(void *data, void *data2);
+static void _e_mod_layout_cb_hook_post_border_assign(void *data, void *data2);
+static int _e_mod_layout_cb_border_add(void *data, int type, void *event);
+static int _e_mod_layout_cb_border_del(void *data, int type, void *event);
+static int _e_mod_layout_cb_border_focus_in(void *data, int type, void *event);
+static int _e_mod_layout_cb_border_focus_out(void *data, int type, void *event);
+static int _e_mod_layout_cb_zone_move_resize(void *data, int type, void *event);
+static int _e_mod_layout_cb_client_message(void *data, int type, void *event);
+
+/* local variables */
+static Eina_List *hooks = NULL, *handlers = NULL;
+static E_Illume_Layout_Policy *policy = NULL;
+
+int
+e_mod_layout_init(void)
+{
+ Ecore_X_Window xwin;
+ Ecore_X_Illume_Mode mode;
+ Eina_List *files;
+ char buff[PATH_MAX], dir[PATH_MAX], *file;
+ int ret = 0;
+
+ snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name);
+ snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
+ e_prefix_lib_get());
+
+ files = ecore_file_ls(dir);
+ EINA_LIST_FREE(files, file)
+ {
+ if (strcmp(file, buff))
+ {
+ free(file);
+ continue;
+ }
+ E_ILLUME_INF("Found Policy: %s", file);
+ snprintf(dir, sizeof(dir),
+ "%s/enlightenment/modules/illume2/policies/%s",
+ e_prefix_lib_get(), file);
+ break;
+ }
+ if (!file)
+ {
+ snprintf(dir, sizeof(dir),
+ "%s/enlightenment/modules/illume2/policies/illume.so",
+ e_prefix_lib_get());
+ }
+ else
+ free(file);
+
+ ret = _e_mod_layout_policy_load(dir);
+ if (!ret) return ret;
+
+ _e_mod_layout_hooks_add();
+ _e_mod_layout_handlers_add();
+
+ xwin = ecore_x_window_root_first_get();
+ if (il_cfg->policy.mode.dual == 0)
+ mode = ECORE_X_ILLUME_MODE_SINGLE;
+ else
+ {
+ if (il_cfg->policy.mode.side == 0)
+ mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
+ else
+ mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
+ }
+ ecore_x_e_illume_mode_set(xwin, mode);
+
+ return ret;
+}
+
+void
+e_mod_layout_shutdown(void)
+{
+ _e_mod_layout_handlers_del();
+ _e_mod_layout_hooks_del();
+ if (policy) e_object_del(E_OBJECT(policy));
+ policy = NULL;
+}
+
+EAPI Eina_List *
+e_illume_layout_policies_get(void)
+{
+ Eina_List *l = NULL, *files;
+ char dir[PATH_MAX], *file;
+
+ snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies",
+ e_prefix_lib_get());
+
+ files = ecore_file_ls(dir);
+ EINA_LIST_FREE(files, file)
+ {
+ E_Illume_Layout_Policy *p;
+
+ if (!strstr(file, ".so")) continue;
+ snprintf(dir, sizeof(dir),
+ "%s/enlightenment/modules/illume2/policies/%s",
+ e_prefix_lib_get(), file);
+ p = E_OBJECT_ALLOC(E_Illume_Layout_Policy, E_ILLUME_LAYOUT_TYPE,
+ _e_mod_layout_free);
+ p->handle = dlopen(dir, RTLD_NOW | RTLD_GLOBAL);
+ if (!p->handle)
+ {
+ E_ILLUME_ERR("Error opening policy: %s", file);
+ e_object_del(E_OBJECT(p));
+ p = NULL;
+ continue;
+ }
+ p->api = dlsym(p->handle, "e_layapi");
+ if (!p->api)
+ {
+ E_ILLUME_ERR("Policy does not support needed functions: %s", file);
+ e_object_del(E_OBJECT(p));
+ p = NULL;
+ continue;
+ }
+ if (p->api->version < E_ILLUME_LAYOUT_API_VERSION)
+ {
+ E_ILLUME_ERR("Policy is too old: %s", file);
+ e_object_del(E_OBJECT(p));
+ p = NULL;
+ continue;
+ }
+ l = eina_list_append(l, p);
+ }
+
+ return l;
+}
+
+/* local functions */
+static void
+_e_mod_layout_free(E_Illume_Layout_Policy *p)
+{
+ if (p->funcs.shutdown) p->funcs.shutdown(p);
+ p->funcs.shutdown = NULL;
+ p->api = NULL;
+ p->funcs.init = NULL;
+ if (p->handle) dlclose(p->handle);
+ p->handle = NULL;
+ E_FREE(p);
+}
+
+static int
+_e_mod_layout_policy_load(const char *file)
+{
+ if (!file) return 0;
+ policy = E_OBJECT_ALLOC(E_Illume_Layout_Policy, E_ILLUME_LAYOUT_TYPE,
+ _e_mod_layout_free);
+ policy->handle = dlopen(file, RTLD_NOW | RTLD_GLOBAL);
+ if (!policy->handle)
+ {
+ E_ILLUME_ERR("Error opening policy: %s", file);
+ e_object_del(E_OBJECT(policy));
+ policy = NULL;
+ return 0;
+ }
+ policy->api = dlsym(policy->handle, "e_layapi");
+ policy->funcs.init = dlsym(policy->handle, "e_layapi_init");
+ policy->funcs.shutdown = dlsym(policy->handle, "e_layapi_shutdown");
+ if ((!policy->funcs.init) || (!policy->funcs.shutdown) || (!policy->api))
+ {
+ E_ILLUME_ERR("Policy does not support needed functions: %s", file);
+ e_object_del(E_OBJECT(policy));
+ policy = NULL;
+ return 0;
+ }
+ if (policy->api->version < E_ILLUME_LAYOUT_API_VERSION)
+ {
+ E_ILLUME_ERR("Policy is too old: %s", file);
+ e_object_del(E_OBJECT(policy));
+ policy = NULL;
+ return 0;
+ }
+ policy->funcs.init(policy);
+ return 1;
+}
+
+static void
+_e_mod_layout_handlers_add(void)
+{
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_ADD,
+ _e_mod_layout_cb_border_add, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
+ _e_mod_layout_cb_border_del, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
+ _e_mod_layout_cb_border_focus_in,
+ NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
+ _e_mod_layout_cb_border_focus_out,
+ NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
+ _e_mod_layout_cb_zone_move_resize,
+ NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+ _e_mod_layout_cb_client_message,
+ NULL));
+}
+
+static void
+_e_mod_layout_handlers_del(void)
+{
+ Ecore_Event_Handler *handler;
+
+ EINA_LIST_FREE(handlers, handler)
+ ecore_event_handler_del(handler);
+}
+
+static void
+_e_mod_layout_hooks_add(void)
+{
+ hooks =
+ eina_list_append(hooks,
+ e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH,
+ _e_mod_layout_cb_hook_post_fetch, NULL));
+ hooks =
+ eina_list_append(hooks,
+ e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
+ _e_mod_layout_cb_hook_post_border_assign, NULL));
+ hooks =
+ eina_list_append(hooks,
+ e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
+ _e_mod_layout_cb_hook_container_layout, NULL));
+}
+
+static void
+_e_mod_layout_hooks_del(void)
+{
+ E_Border_Hook *hook;
+
+ EINA_LIST_FREE(hooks, hook)
+ e_border_hook_del(hook);
+}
+
+static void
+_e_mod_layout_cb_hook_container_layout(void *data, void *data2)
+{
+ Eina_List *l;
+ E_Zone *zone;
+ E_Container *con;
+
+ if (!(con = data2)) return;
+ EINA_LIST_FOREACH(con->zones, l, zone)
+ {
+ if ((policy) && (policy->funcs.zone_layout))
+ policy->funcs.zone_layout(zone);
+ }
+}
+
+static void
+_e_mod_layout_cb_hook_post_fetch(void *data, void *data2)
+{
+ E_Border *bd;
+
+ if (!(bd = data2)) return;
+ if (bd->stolen) return;
+ if (bd->new_client)
+ {
+ if (bd->remember)
+ {
+ if (bd->bordername)
+ {
+ eina_stringshare_del(bd->bordername);
+ bd->bordername = NULL;
+ bd->client.border.changed = 1;
+ }
+ e_remember_unuse(bd->remember);
+ bd->remember = NULL;
+ }
+ eina_stringshare_replace(&bd->bordername, "borderless");
+ bd->client.border.changed = 1;
+ bd->client.e.state.centered = 0;
+ }
+}
+
+static void
+_e_mod_layout_cb_hook_post_border_assign(void *data, void *data2)
+{
+ E_Border *bd;
+
+ if (!(bd = data2)) return;
+ if (bd->stolen) return;
+ bd->placed = 1;
+ bd->client.e.state.centered = 0;
+ if (bd->remember)
+ {
+ e_remember_unuse(bd->remember);
+ bd->remember = NULL;
+ }
+ bd->lock_border = 1;
+ bd->lock_client_location = 1;
+ bd->lock_client_size = 1;
+ bd->lock_client_desk = 1;
+ bd->lock_client_sticky = 1;
+ bd->lock_client_shade = 1;
+ bd->lock_client_maximize = 1;
+ bd->lock_user_location = 1;
+ bd->lock_user_size = 1;
+ bd->lock_user_sticky = 1;
+}
+
+static int
+_e_mod_layout_cb_border_add(void *data, int type, void *event)
+{
+ E_Event_Border_Add *ev;
+
+ ev = event;
+ if (ev->border->stolen) return 1;
+ if ((policy) && (policy->funcs.border_add))
+ policy->funcs.border_add(ev->border);
+ return 1;
+}
+
+static int
+_e_mod_layout_cb_border_del(void *data, int type, void *event)
+{
+ E_Event_Border_Remove *ev;
+
+ ev = event;
+ if (ev->border->stolen) return 1;
+ if ((policy) && (policy->funcs.border_del))
+ policy->funcs.border_del(ev->border);
+ return 1;
+}
+
+static int
+_e_mod_layout_cb_border_focus_in(void *data, int type, void *event)
+{
+ E_Event_Border_Focus_In *ev;
+
+ ev = event;
+ if (ev->border->stolen) return 1;
+ if ((policy) && (policy->funcs.border_focus_in))
+ policy->funcs.border_focus_in(ev->border);
+ return 1;
+}
+
+static int
+_e_mod_layout_cb_border_focus_out(void *data, int type, void *event)
+{
+ E_Event_Border_Focus_Out *ev;
+
+ ev = event;
+ if (ev->border->stolen) return 1;
+ if ((policy) && (policy->funcs.border_focus_out))
+ policy->funcs.border_focus_out(ev->border);
+ return 1;
+}
+
+static int
+_e_mod_layout_cb_zone_move_resize(void *data, int type, void *event)
+{
+ E_Event_Zone_Move_Resize *ev;
+
+ ev = event;
+ if ((policy) && (policy->funcs.zone_move_resize))
+ policy->funcs.zone_move_resize(ev->zone);
+ return 1;
+}
+
+static int
+_e_mod_layout_cb_client_message(void *data, int type, void *event)
+{
+ Ecore_X_Event_Client_Message *ev;
+
+ ev = event;
+ if (ev->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
+ {
+ E_Border *bd;
+
+ bd = e_border_find_by_client_window(ev->win);
+ if ((!bd) || (bd->stolen)) return 1;
+ if ((policy) && (policy->funcs.border_activate))
+ policy->funcs.border_activate(bd);
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_MODE)
+ {
+ E_Border *bd;
+ E_Zone *zone;
+ int lock = 1;
+
+ zone = e_util_zone_current_get(e_manager_current_get());
+
+ if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
+ il_cfg->policy.mode.dual = 0;
+ else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
+ {
+ if (e_illume_border_valid_count_get(zone) < 2)
+ ecore_x_e_illume_home_send(ecore_x_window_root_first_get());
+ il_cfg->policy.mode.dual = 1;
+ il_cfg->policy.mode.side = 0;
+ lock = 0;
+ }
+ else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
+ {
+ if (e_illume_border_valid_count_get(zone) < 2)
+ ecore_x_e_illume_home_send(ecore_x_window_root_first_get());
+ il_cfg->policy.mode.dual = 1;
+ il_cfg->policy.mode.side = 1;
+ }
+ else /* unknown */
+ il_cfg->policy.mode.dual = 0;
+ e_config_save_queue();
+
+ bd = e_illume_border_top_shelf_get(zone);
+ if (bd)
+ ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
+ bd = e_illume_border_bottom_panel_get(zone);
+ if (bd)
+ ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_BACK)
+ {
+ E_Border *bd, *fbd;
+ Eina_List *focused, *l;
+
+ if (!(bd = e_border_focused_get())) return 1;
+ focused = e_border_focus_stack_get();
+ EINA_LIST_REVERSE_FOREACH(focused, l, fbd)
+ {
+ E_Border *fb;
+
+ if (e_object_is_del(E_OBJECT(fbd))) continue;
+ if ((!fbd->client.icccm.accepts_focus) &&
+ (!fbd->client.icccm.take_focus)) continue;
+ if (fbd->client.netwm.state.skip_taskbar) continue;
+ if (fbd == bd)
+ {
+ if (!(fb = focused->next->data)) continue;
+ if (e_object_is_del(E_OBJECT(fb))) continue;
+ if ((!fb->client.icccm.accepts_focus) &&
+ (!fb->client.icccm.take_focus)) continue;
+ if (fb->client.netwm.state.skip_taskbar) continue;
+ e_border_raise(fb);
+ e_border_focus_set(fb, 1, 1);
+ break;
+ }
+ }
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_CLOSE)
+ {
+ E_Border *bd;
+
+ if (!(bd = e_border_focused_get())) return 1;
+ e_border_act_close_begin(bd);
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_START)
+ {
+ E_Border *bd;
+
+ bd = e_border_find_by_client_window(ev->win);
+ if ((!bd) || (bd->stolen)) return 1;
+ if ((policy) && (policy->funcs.drag_start))
+ policy->funcs.drag_start(bd);
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_END)
+ {
+ E_Border *bd;
+
+ bd = e_border_find_by_client_window(ev->win);
+ if ((!bd) || (bd->stolen)) return 1;
+ if ((policy) && (policy->funcs.drag_end))
+ policy->funcs.drag_end(bd);
+ }
+ return 1;
+}
--- /dev/null
+#ifndef E_MOD_LAYOUT_H
+# define E_MOD_LAYOUT_H
+
+int e_mod_layout_init(void);
+void e_mod_layout_shutdown(void);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_main.h"
+#include "e_kbd.h"
+#include "e_quickpanel.h"
+#include "e_mod_layout.h"
+#include "e_mod_config.h"
+
+/* local variables */
+static E_Kbd *kbd = NULL;
+static E_Quickpanel *qp = NULL;
+int _e_illume_log_dom = -1;
+
+EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" };
+
+EAPI void *
+e_modapi_init(E_Module *m)
+{
+ /* set eina logging for error reporting/debugging */
+ if (_e_illume_log_dom < 0)
+ {
+ _e_illume_log_dom =
+ eina_log_domain_register("illume2", E_ILLUME_DEFAULT_LOG_COLOR);
+ if (_e_illume_log_dom < 0)
+ {
+ EINA_LOG_CRIT("Could not register log domain for illume2");
+ return NULL;
+ }
+ }
+
+ /* set module priority very high so it loads before other illume modules */
+ e_module_priority_set(m, 100);
+
+ /* init the config subsystem */
+ if (!e_mod_config_init(m)) return NULL;
+
+ /* init the keyboard subsystem */
+ e_kbd_init();
+
+ /* init the quickpanel subsystem */
+ e_quickpanel_init();
+
+ /* init the layout subsystem */
+ if (!e_mod_layout_init())
+ {
+ /* shutdown the quickpanel subsystem */
+ e_quickpanel_shutdown();
+
+ /* shutdown kbd subsystem */
+ e_kbd_shutdown();
+
+ /* shutdown config subsystem */
+ e_mod_config_shutdown();
+
+ /* cleanup eina log domain */
+ if (_e_illume_log_dom >= 0)
+ {
+ eina_log_domain_unregister(_e_illume_log_dom);
+ _e_illume_log_dom = -1;
+ }
+
+ /* report error to user */
+ e_error_message_show("There was an error loading Policy\n");
+ return NULL;
+ }
+
+ /* create a new keyboard */
+ kbd = e_kbd_new();
+
+ /* create a new quickpanel */
+ qp = e_quickpanel_new(e_util_zone_current_get(e_manager_current_get()));
+
+ return m;
+}
+
+EAPI int
+e_modapi_shutdown(E_Module *m)
+{
+ /* cleanup the quickpanel */
+ e_object_del(E_OBJECT(qp));
+ qp = NULL;
+
+ /* cleanup the keyboard */
+ e_object_del(E_OBJECT(kbd));
+ kbd = NULL;
+
+ /* shutdown the layout subsystem */
+ e_mod_layout_shutdown();
+
+ /* shutdown the quickpanel subsystem */
+ e_quickpanel_shutdown();
+
+ /* shutdown the keyboard subsystem */
+ e_kbd_shutdown();
+
+ /* shutdown the config subsystem */
+ e_mod_config_shutdown();
+
+ /* cleanup eina log domain */
+ if (_e_illume_log_dom >= 0)
+ {
+ eina_log_domain_unregister(_e_illume_log_dom);
+ _e_illume_log_dom = -1;
+ }
+
+ return 1;
+}
+
+EAPI int
+e_modapi_save(E_Module *m)
+{
+ return e_mod_config_save();
+}
--- /dev/null
+#ifndef E_MOD_MAIN_H
+# define E_MOD_MAIN_H
+
+# ifdef E_ILLUME_DEFAULT_LOG_COLOR
+# undef E_ILLUME_DEFAULT_LOG_COLOR
+# endif
+# define E_ILLUME_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
+
+extern int _e_illume_log_dom;
+# ifdef E_ILLUME_ERR
+# undef E_ILLUME_ERR
+# endif
+# define E_ILLUME_ERR(...) EINA_LOG_DOM_ERR(_e_illume_log_dom, __VA_ARGS__)
+
+# ifdef E_ILLUME_INF
+# undef E_ILLUME_INF
+# endif
+# define E_ILLUME_INF(...) EINA_LOG_DOM_INFO(_e_illume_log_dom, __VA_ARGS__)
+
+# ifdef E_ILLUME_CRIT
+# undef E_ILLUME_CRIT
+# endif
+# define E_ILLUME_CRIT(...) EINA_LOG_DOM_INFO(_e_illume_log_dom, __VA_ARGS__)
+
+# ifdef E_ILLUME_WARN
+# undef E_ILLUME_WARN
+# endif
+# define E_ILLUME_WARN(...) EINA_LOG_DOM_WARN(_e_illume_log_dom, __VA_ARGS__)
+
+EAPI extern E_Module_Api e_modapi;
+
+EAPI void *e_modapi_init(E_Module *m);
+EAPI int e_modapi_shutdown(E_Module *m);
+EAPI int e_modapi_save(E_Module *m);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_layout.h"
+#include "e_mod_policy.h"
+#include "e_mod_config.h"
+
+/* local function prototypes */
+static void *_il_config_policy_create(E_Config_Dialog *cfd);
+static void _il_config_policy_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_il_config_policy_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+static void _il_config_policy_list_changed(void *data);
+static int _il_config_policy_change_timeout(void *data);
+static Evas_Object *_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+
+/* local variables */
+Ecore_Timer *_policy_change_timer = NULL;
+const char *policy_name = NULL;
+
+void
+il_config_policy_show(E_Container *con, const char *params)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+
+ if (e_config_dialog_find("E", "_config_illume_policy")) return;
+ v = E_NEW(E_Config_Dialog_View, 1);
+ v->create_cfdata = _il_config_policy_create;
+ v->free_cfdata = _il_config_policy_free;
+ v->basic.create_widgets = _il_config_policy_ui;
+ v->basic_only = 1;
+ v->normal_win = 1;
+ v->scroll = 1;
+ cfd = e_config_dialog_new(con, _("Policy"), "E",
+ "_config_illume_policy",
+ "enlightenment/policy", 0, v, NULL);
+ e_dialog_resizable_set(cfd->dia, 1);
+}
+
+/* local functions */
+static void *
+_il_config_policy_create(E_Config_Dialog *cfd)
+{
+ return NULL;
+}
+
+static void
+_il_config_policy_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ if (_policy_change_timer) ecore_timer_del(_policy_change_timer);
+}
+
+static Evas_Object *
+_il_config_policy_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *list, *ow;
+ Eina_List *policies;
+ E_Illume_Layout_Policy *p;
+ int i = 0, sel = 0;
+
+ list = e_widget_list_add(evas, 0, 0);
+ ow = e_widget_ilist_add(evas, 24, 24, &(policy_name));
+ e_widget_ilist_selector_set(ow, 1);
+ evas_event_freeze(evas);
+ edje_freeze();
+ e_widget_ilist_freeze(ow);
+ e_widget_ilist_clear(ow);
+ e_widget_ilist_go(ow);
+
+ policies = e_illume_layout_policies_get();
+ EINA_LIST_FREE(policies, p)
+ {
+ e_widget_ilist_append(ow, NULL, strdup(p->api->label),
+ _il_config_policy_list_changed, NULL,
+ strdup(p->api->name));
+
+ if ((p) && (il_cfg->policy.name) &&
+ (!strcmp(il_cfg->policy.name, p->api->name)))
+ sel = i;
+
+ if (p)
+ {
+ e_object_del(E_OBJECT(p));
+ p = NULL;
+ }
+ i++;
+ }
+
+ e_widget_size_min_set(ow, 100, 200);
+ e_widget_ilist_go(ow);
+ e_widget_ilist_selected_set(ow, sel);
+ e_widget_ilist_thaw(ow);
+ edje_thaw();
+ evas_event_thaw(evas);
+ e_widget_list_object_append(list, ow, 1, 0, 0.0);
+ return list;
+}
+
+static void
+_il_config_policy_list_changed(void *data)
+{
+ if (il_cfg->policy.name) eina_stringshare_del(il_cfg->policy.name);
+ if (policy_name) il_cfg->policy.name = eina_stringshare_add(policy_name);
+ if (_policy_change_timer) ecore_timer_del(_policy_change_timer);
+ _policy_change_timer =
+ ecore_timer_add(0.5, _il_config_policy_change_timeout, data);
+}
+
+static int
+_il_config_policy_change_timeout(void *data)
+{
+ e_config_save_queue();
+ _policy_change_timer = NULL;
+ return 0;
+}
--- /dev/null
+#ifndef E_MOD_POLICY_H
+#define E_MOD_POLICY_H
+
+void il_config_policy_show(E_Container *con, const char *params);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_policy_settings.h"
+
+/* local function prototypes */
+static void *_il_config_policy_settings_create(E_Config_Dialog *cfd);
+static void _il_config_policy_settings_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+static void _il_config_policy_settings_changed(void *data, Evas_Object *obj, void *event);
+static int _il_config_policy_settings_change_timeout(void *data);
+
+/* local variables */
+Ecore_Timer *_ps_change_timer = NULL;
+Evas_Object *o_top, *o_left;
+
+void
+il_config_policy_settings_show(E_Container *con, const char *params)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+
+ if (e_config_dialog_find("E", "_config_illume_policy_settings")) return;
+ v = E_NEW(E_Config_Dialog_View, 1);
+ v->create_cfdata = _il_config_policy_settings_create;
+ v->free_cfdata = _il_config_policy_settings_free;
+ v->basic.create_widgets = _il_config_policy_settings_ui;
+ v->basic_only = 1;
+ v->normal_win = 1;
+ v->scroll = 1;
+ cfd = e_config_dialog_new(con, _("Policy Settings"), "E",
+ "_config_illume_policy_settings",
+ "enlightenment/policy_settings", 0, v, NULL);
+ e_dialog_resizable_set(cfd->dia, 1);
+}
+
+/* local function prototypes */
+static void *
+_il_config_policy_settings_create(E_Config_Dialog *cfd)
+{
+ return NULL;
+}
+
+static void
+_il_config_policy_settings_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ if (_ps_change_timer) ecore_timer_del(_ps_change_timer);
+}
+
+static Evas_Object *
+_il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *list, *of, *ow;
+ E_Radio_Group *rg;
+
+ list = e_widget_list_add(evas, 0, 0);
+ of = e_widget_framelist_add(evas, _("Mode"), 0);
+ rg = e_widget_radio_group_new(&(il_cfg->policy.mode.dual));
+ ow = e_widget_radio_add(evas, _("Single App Mode"), 0, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_policy_settings_changed, NULL);
+ ow = e_widget_radio_add(evas, _("Dual App Mode"), 1, rg);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_policy_settings_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ of = e_widget_framelist_add(evas, _("Window Layout"), 0);
+ rg = e_widget_radio_group_new(&(il_cfg->policy.mode.side));
+ o_top = e_widget_radio_add(evas, _("Top/Bottom"), 0, rg);
+ e_widget_framelist_object_append(of, o_top);
+ evas_object_smart_callback_add(o_top, "changed",
+ _il_config_policy_settings_changed, NULL);
+ o_left = e_widget_radio_add(evas, _("Left/Right"), 1, rg);
+ e_widget_framelist_object_append(of, o_left);
+ evas_object_smart_callback_add(o_left, "changed",
+ _il_config_policy_settings_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
+ e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
+
+ return list;
+}
+
+static void
+_il_config_policy_settings_changed(void *data, Evas_Object *obj, void *event)
+{
+ e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
+ e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
+
+ if (_ps_change_timer) ecore_timer_del(_ps_change_timer);
+ _ps_change_timer =
+ ecore_timer_add(0.5, _il_config_policy_settings_change_timeout, data);
+}
+
+static int
+_il_config_policy_settings_change_timeout(void *data)
+{
+ Ecore_X_Window xwin;
+ Ecore_X_Illume_Mode mode;
+
+ e_config_save_queue();
+ _ps_change_timer = NULL;
+
+ if (il_cfg->policy.mode.dual)
+ {
+ if (il_cfg->policy.mode.side == 0)
+ mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
+ else
+ mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
+ }
+ else
+ mode = ECORE_X_ILLUME_MODE_SINGLE;
+
+ xwin = ecore_x_window_root_first_get();
+ ecore_x_e_illume_mode_set(xwin, mode);
+ ecore_x_e_illume_mode_send(xwin, mode);
+
+ return 0;
+}
--- /dev/null
+#ifndef E_MOD_POLICY_SETTINGS_H
+# define E_MOD_POLICY_SETTINGS_H
+
+void il_config_policy_settings_show(E_Container *con, const char *params);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_select_window.h"
+
+/* local function prototypes */
+static void *_il_config_select_window_create_data(E_Config_Dialog *cfd);
+static void _il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+static void _il_config_select_window_list_changed(void *data);
+static int _il_config_select_window_change_timeout(void *data);
+static int _il_config_select_window_match(E_Border *bd);
+
+/* local variables */
+Il_Select_Window_Type stype;
+Ecore_Timer *_sw_change_timer = NULL;
+
+/* public functions */
+void
+il_config_select_window(Il_Select_Window_Type type)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+
+ if (e_config_dialog_find("E", "_config_illume_select_window")) return;
+ stype = type;
+ v = E_NEW(E_Config_Dialog_View, 1);
+ v->create_cfdata = _il_config_select_window_create_data;
+ v->free_cfdata = _il_config_select_window_free_data;
+ v->basic.create_widgets = _il_config_select_window_create;
+ v->basic_only = 1;
+ v->normal_win = 1;
+ v->scroll = 1;
+ cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
+ _("Select Home Window"), "E",
+ "_config_illume_select_window",
+ "enlightenment/windows", 0, v, NULL);
+ e_dialog_resizable_set(cfd->dia, 1);
+}
+
+static void *
+_il_config_select_window_create_data(E_Config_Dialog *cfd)
+{
+ return NULL;
+}
+
+static void
+_il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+
+}
+
+static Evas_Object *
+_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *list, *ow;
+ Eina_List *bds, *l;
+ int i = 0, sel = -1;
+
+ list = e_widget_list_add(evas, 0, 0);
+ ow = e_widget_ilist_add(evas, 24, 24, NULL);
+ e_widget_ilist_selector_set(ow, 1);
+ evas_event_freeze(evas);
+ edje_freeze();
+ e_widget_ilist_freeze(ow);
+ e_widget_ilist_clear(ow);
+ e_widget_ilist_go(ow);
+
+ bds = e_border_client_list();
+ for (i = 0, l = bds; l; l = l->next, i++)
+ {
+ E_Border *bd;
+ const char *name;
+
+ if (!(bd = l->data)) continue;
+ if (e_object_is_del(E_OBJECT(bd))) continue;
+ if (_il_config_select_window_match(bd)) sel = i;
+ name = e_border_name_get(bd);
+ e_widget_ilist_append(ow, NULL, name,
+ _il_config_select_window_list_changed,
+ bd, name);
+ }
+ e_widget_size_min_set(ow, 100, 200);
+ e_widget_ilist_go(ow);
+ if (sel >= 0) e_widget_ilist_selected_set(ow, sel);
+ e_widget_ilist_thaw(ow);
+ edje_thaw();
+ evas_event_thaw(evas);
+ e_widget_list_object_append(list, ow, 1, 0, 0.0);
+ return list;
+}
+
+static void
+_il_config_select_window_list_changed(void *data)
+{
+ E_Border *bd;
+ Ecore_X_Window_Type wtype;
+ char *title, *name, *class;
+
+ if (!(bd = data)) return;
+ title = ecore_x_icccm_title_get(bd->client.win);
+ ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
+ ecore_x_netwm_window_type_get(bd->client.win, &wtype);
+
+ switch (stype)
+ {
+ case IL_SELECT_WINDOW_TYPE_HOME:
+ if (il_cfg->policy.home.title)
+ eina_stringshare_del(il_cfg->policy.home.title);
+ if (title) il_cfg->policy.home.title = eina_stringshare_add(title);
+ if (il_cfg->policy.home.class)
+ eina_stringshare_del(il_cfg->policy.home.class);
+ if (class) il_cfg->policy.home.class = eina_stringshare_add(class);
+ if (il_cfg->policy.home.name)
+ eina_stringshare_del(il_cfg->policy.home.name);
+ if (name) il_cfg->policy.home.name = eina_stringshare_add(name);
+ break;
+ case IL_SELECT_WINDOW_TYPE_VKBD:
+ if (il_cfg->policy.vkbd.title)
+ eina_stringshare_del(il_cfg->policy.vkbd.title);
+ if (title) il_cfg->policy.vkbd.title = eina_stringshare_add(title);
+ if (il_cfg->policy.vkbd.class)
+ eina_stringshare_del(il_cfg->policy.vkbd.class);
+ if (class) il_cfg->policy.vkbd.class = eina_stringshare_add(class);
+ if (il_cfg->policy.vkbd.name)
+ eina_stringshare_del(il_cfg->policy.vkbd.name);
+ if (name) il_cfg->policy.vkbd.name = eina_stringshare_add(name);
+ break;
+ case IL_SELECT_WINDOW_TYPE_SOFTKEY:
+ if (il_cfg->policy.softkey.title)
+ eina_stringshare_del(il_cfg->policy.softkey.title);
+ if (title) il_cfg->policy.softkey.title = eina_stringshare_add(title);
+ if (il_cfg->policy.softkey.class)
+ eina_stringshare_del(il_cfg->policy.softkey.class);
+ if (class) il_cfg->policy.softkey.class = eina_stringshare_add(class);
+ if (il_cfg->policy.softkey.name)
+ eina_stringshare_del(il_cfg->policy.softkey.name);
+ if (name) il_cfg->policy.softkey.name = eina_stringshare_add(name);
+ break;
+ case IL_SELECT_WINDOW_TYPE_INDICATOR:
+ if (il_cfg->policy.indicator.title)
+ eina_stringshare_del(il_cfg->policy.indicator.title);
+ if (title) il_cfg->policy.indicator.title = eina_stringshare_add(title);
+ if (il_cfg->policy.indicator.class)
+ eina_stringshare_del(il_cfg->policy.indicator.class);
+ if (class) il_cfg->policy.indicator.class = eina_stringshare_add(class);
+ if (il_cfg->policy.indicator.name)
+ eina_stringshare_del(il_cfg->policy.indicator.name);
+ if (name) il_cfg->policy.indicator.name = eina_stringshare_add(name);
+ break;
+ }
+
+ if (title) free(title);
+ if (name) free(name);
+ if (class) free(class);
+
+ if (_sw_change_timer) ecore_timer_del(_sw_change_timer);
+ _sw_change_timer =
+ ecore_timer_add(0.5, _il_config_select_window_change_timeout, data);
+}
+
+static int
+_il_config_select_window_change_timeout(void *data)
+{
+ e_config_save_queue();
+ _sw_change_timer = NULL;
+ return 0;
+}
+
+static int
+_il_config_select_window_match(E_Border *bd)
+{
+ Ecore_X_Window_Type wtype;
+ char *title, *name, *class;
+ int match = 0;
+
+ if (!bd) return 0;
+ title = ecore_x_icccm_title_get(bd->client.win);
+ ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
+ ecore_x_netwm_window_type_get(bd->client.win, &wtype);
+
+ switch (stype)
+ {
+ case IL_SELECT_WINDOW_TYPE_HOME:
+ if (il_cfg->policy.home.match.title)
+ {
+ if ((title) && (!strcmp(title, il_cfg->policy.home.title)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.home.match.name)
+ {
+ if ((name) && (!strcmp(name, il_cfg->policy.home.name)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.home.match.class)
+ {
+ if ((class) && (!strcmp(class, il_cfg->policy.home.class)))
+ match = 1;
+ break;
+ }
+ break;
+ case IL_SELECT_WINDOW_TYPE_VKBD:
+ if (il_cfg->policy.vkbd.match.title)
+ {
+ if ((title) && (!strcmp(title, il_cfg->policy.vkbd.title)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.vkbd.match.name)
+ {
+ if ((name) && (!strcmp(name, il_cfg->policy.vkbd.name)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.vkbd.match.class)
+ {
+ if ((class) && (!strcmp(class, il_cfg->policy.vkbd.class)))
+ match = 1;
+ break;
+ }
+ break;
+ case IL_SELECT_WINDOW_TYPE_SOFTKEY:
+ if (il_cfg->policy.softkey.match.title)
+ {
+ if ((title) && (!strcmp(title, il_cfg->policy.softkey.title)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.softkey.match.name)
+ {
+ if ((name) && (!strcmp(name, il_cfg->policy.softkey.name)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.softkey.match.class)
+ {
+ if ((class) && (!strcmp(class, il_cfg->policy.softkey.class)))
+ match = 1;
+ break;
+ }
+ break;
+ case IL_SELECT_WINDOW_TYPE_INDICATOR:
+ if (il_cfg->policy.indicator.match.title)
+ {
+ if ((title) && (!strcmp(title, il_cfg->policy.indicator.title)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.indicator.match.name)
+ {
+ if ((name) && (!strcmp(name, il_cfg->policy.indicator.name)))
+ match = 1;
+ break;
+ }
+ if (il_cfg->policy.indicator.match.class)
+ {
+ if ((class) && (!strcmp(class, il_cfg->policy.indicator.class)))
+ match = 1;
+ break;
+ }
+ break;
+ }
+
+ if (title) free(title);
+ if (name) free(name);
+ if (class) free(class);
+
+ return match;
+}
--- /dev/null
+#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
--- /dev/null
+#include "E_Illume.h"
+#include "e_mod_windows.h"
+#include "e_mod_select_window.h"
+
+/* local function prototypes */
+static void *_il_config_windows_create(E_Config_Dialog *cfd);
+static void _il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
+static void _il_config_windows_check_changed(void *data, Evas_Object *obj, void *event);
+static void _il_config_windows_change(void *data, Evas_Object *obj, void *event);
+static int _il_config_windows_change_timeout(void *data);
+static void _il_config_windows_select_home(void *data, void *data2);
+static void _il_config_windows_select_vkbd(void *data, void *data2);
+static void _il_config_windows_select_softkey(void *data, void *data2);
+static void _il_config_windows_select_indicator(void *data, void *data2);
+
+/* local variables */
+Ecore_Timer *_windows_change_timer = NULL;
+
+/* public functions */
+void
+il_config_windows_show(E_Container *con, const char *params)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+
+ if (e_config_dialog_find("E", "_config_illume_windows_settings")) return;
+
+ v = E_NEW(E_Config_Dialog_View, 1);
+ v->create_cfdata = _il_config_windows_create;
+ v->free_cfdata = _il_config_windows_free;
+ v->basic.create_widgets = _il_config_windows_ui;
+ v->basic_only = 1;
+ v->normal_win = 1;
+ v->scroll = 1;
+ cfd = e_config_dialog_new(con, _("Window Settings"), "E",
+ "_config_illume_windows_settings",
+ "preferences-system-windows", 0, v, NULL);
+ e_dialog_resizable_set(cfd->dia, 1);
+}
+
+/* local function prototypes */
+static void *
+_il_config_windows_create(E_Config_Dialog *cfd)
+{
+ return NULL;
+}
+
+static void
+_il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
+}
+
+static Evas_Object *
+_il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *list, *of, *ow;
+
+ list = e_widget_list_add(evas, 0, 0);
+
+ of = e_widget_framelist_add(evas, _("Home"), 0);
+ ow = e_widget_button_add(evas, _("Select Window"), NULL,
+ _il_config_windows_select_home, NULL, NULL);
+ e_widget_framelist_object_append(of, ow);
+ ow = e_widget_check_add(evas, _("Match Window Class"),
+ &il_cfg->policy.home.match.class);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Name"),
+ &il_cfg->policy.home.match.name);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Title"),
+ &il_cfg->policy.home.match.title);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Type"),
+ &il_cfg->policy.home.match.win_type);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ of = e_widget_framelist_add(evas, _("Indicator"), 0);
+ ow = e_widget_button_add(evas, _("Select Window"), NULL,
+ _il_config_windows_select_indicator, NULL, NULL);
+ e_widget_framelist_object_append(of, ow);
+ ow = e_widget_check_add(evas, _("Match Window Class"),
+ &il_cfg->policy.indicator.match.class);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Name"),
+ &il_cfg->policy.indicator.match.name);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Title"),
+ &il_cfg->policy.indicator.match.title);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Type"),
+ &il_cfg->policy.indicator.match.win_type);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ of = e_widget_framelist_add(evas, _("Keyboard"), 0);
+ ow = e_widget_button_add(evas, _("Select Window"), NULL,
+ _il_config_windows_select_vkbd, NULL, NULL);
+ e_widget_framelist_object_append(of, ow);
+ ow = e_widget_check_add(evas, _("Match Window Class"),
+ &il_cfg->policy.vkbd.match.class);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Name"),
+ &il_cfg->policy.vkbd.match.name);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Title"),
+ &il_cfg->policy.vkbd.match.title);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Type"),
+ &il_cfg->policy.vkbd.match.win_type);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ of = e_widget_framelist_add(evas, _("Softkey"), 0);
+ ow = e_widget_button_add(evas, _("Select Window"), NULL,
+ _il_config_windows_select_softkey, NULL, NULL);
+ e_widget_framelist_object_append(of, ow);
+ ow = e_widget_check_add(evas, _("Match Window Class"),
+ &il_cfg->policy.softkey.match.class);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Name"),
+ &il_cfg->policy.softkey.match.name);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Title"),
+ &il_cfg->policy.softkey.match.title);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ ow = e_widget_check_add(evas, _("Match Window Type"),
+ &il_cfg->policy.softkey.match.win_type);
+ e_widget_framelist_object_append(of, ow);
+ evas_object_smart_callback_add(ow, "changed",
+ _il_config_windows_check_changed, NULL);
+ e_widget_list_object_append(list, of, 1, 0, 0.0);
+
+ return list;
+}
+
+static void
+_il_config_windows_check_changed(void *data, Evas_Object *obj, void *event)
+{
+ _il_config_windows_change(data, obj, event);
+}
+
+static void
+_il_config_windows_change(void *data, Evas_Object *obj, void *event)
+{
+ if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
+ _windows_change_timer =
+ ecore_timer_add(0.5, _il_config_windows_change_timeout, data);
+}
+
+static int
+_il_config_windows_change_timeout(void *data)
+{
+ e_config_save_queue();
+ _windows_change_timer = NULL;
+ return 0;
+}
+
+static void
+_il_config_windows_select_home(void *data, void *data2)
+{
+ if (e_config_dialog_find("E", "_config_illume_select_window")) return;
+ il_config_select_window(IL_SELECT_WINDOW_TYPE_HOME);
+}
+
+static void
+_il_config_windows_select_vkbd(void *data, void *data2)
+{
+ if (e_config_dialog_find("E", "_config_illume_select_window")) return;
+ il_config_select_window(IL_SELECT_WINDOW_TYPE_VKBD);
+}
+
+static void
+_il_config_windows_select_softkey(void *data, void *data2)
+{
+ if (e_config_dialog_find("E", "_config_illume_select_window")) return;
+ il_config_select_window(IL_SELECT_WINDOW_TYPE_SOFTKEY);
+}
+
+static void
+_il_config_windows_select_indicator(void *data, void *data2)
+{
+ if (e_config_dialog_find("E", "_config_illume_select_window")) return;
+ il_config_select_window(IL_SELECT_WINDOW_TYPE_INDICATOR);
+}
--- /dev/null
+#ifndef E_MOD_WINDOWS_H
+#define E_MOD_WINDOWS_H
+
+void il_config_windows_show(E_Container *con, const char *params);
+
+#endif
--- /dev/null
+#include "E_Illume.h"
+#include "e_quickpanel.h"
+
+/* local function prototypes */
+static void _e_quickpanel_cb_free(E_Quickpanel *qp);
+static int _e_quickpanel_cb_client_message(void *data, int type, void *event);
+static void _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2);
+static E_Quickpanel *_e_quickpanel_by_border_get(E_Border *bd);
+static int _e_quickpanel_border_is_quickpanel(E_Border *bd);
+static void _e_quickpanel_slide(E_Quickpanel *qp, int visible, double len);
+static int _e_quickpanel_cb_animate(void *data);
+static int _e_quickpanel_cb_delay_hide(void *data);
+static void _e_quickpanel_hide(E_Quickpanel *qp);
+static int _e_quickpanel_cb_sort(const void *b1, const void *b2);
+static int _e_quickpanel_cb_mouse_down(void *data, int type, void *event);
+static int _e_quickpanel_cb_mouse_wheel(void *data, int type, void *event);
+
+/* local variables */
+static Eina_List *qps = NULL, *handlers = NULL, *hooks = NULL;
+static Ecore_X_Window input_win = 0;
+
+/* public functions */
+int
+e_quickpanel_init(void)
+{
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+ _e_quickpanel_cb_client_message, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ _e_quickpanel_cb_mouse_down, NULL));
+ handlers =
+ eina_list_append(handlers,
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
+ _e_quickpanel_cb_mouse_wheel, NULL));
+
+ hooks =
+ eina_list_append(hooks,
+ e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
+ _e_quickpanel_cb_border_pre_post_fetch,
+ NULL));
+ return 1;
+}
+
+int
+e_quickpanel_shutdown(void)
+{
+ E_Quickpanel *qp;
+ Ecore_Event_Handler *handler;
+ E_Border_Hook *hook;
+
+ EINA_LIST_FREE(handlers, handler)
+ ecore_event_handler_del(handler);
+ EINA_LIST_FREE(hooks, hook)
+ e_border_hook_del(hook);
+ EINA_LIST_FREE(qps, qp)
+ e_object_del(E_OBJECT(qp));
+ return 1;
+}
+
+E_Quickpanel *
+e_quickpanel_new(E_Zone *zone)
+{
+ E_Quickpanel *qp;
+
+ qp = E_OBJECT_ALLOC(E_Quickpanel, E_QUICKPANEL_TYPE, _e_quickpanel_cb_free);
+ if (!qp) return NULL;
+ qp->zone = zone;
+ qps = eina_list_append(qps, qp);
+ return qp;
+}
+
+void
+e_quickpanel_show(E_Quickpanel *qp)
+{
+ if (qp->timer) ecore_timer_del(qp->timer);
+ qp->timer = NULL;
+ if (qp->visible) return;
+ if (!qp->borders) return;
+ if (!input_win)
+ {
+ input_win =
+ ecore_x_window_input_new(qp->zone->container->win,
+ qp->zone->x, qp->zone->y,
+ qp->zone->w, qp->zone->h);
+ ecore_x_window_show(input_win);
+ if (!e_grabinput_get(input_win, 1, input_win))
+ {
+ ecore_x_window_free(input_win);
+ input_win = 0;
+ return;
+ }
+ }
+ if (il_cfg->sliding.quickpanel.duration <= 0)
+ {
+ Eina_List *l;
+ E_Border *bd;
+ int ny = 0;
+
+ e_illume_border_top_shelf_size_get(qp->zone, NULL, &ny);
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ ny += bd->h;
+
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ {
+ e_border_lower(bd);
+ e_border_fx_offset(bd, 0, ny);
+ }
+ qp->visible = 1;
+ }
+ else
+ _e_quickpanel_slide(qp, 1,
+ (double)il_cfg->sliding.quickpanel.duration / 1000.0);
+}
+
+void
+e_quickpanel_hide(E_Quickpanel *qp)
+{
+ if (!qp->visible) return;
+ if (!qp->timer)
+ qp->timer = ecore_timer_add(0.2, _e_quickpanel_cb_delay_hide, qp);
+}
+
+E_Quickpanel *
+e_quickpanel_by_zone_get(E_Zone *zone)
+{
+ Eina_List *l;
+ E_Quickpanel *qp;
+
+ if (!zone) return NULL;
+ EINA_LIST_FOREACH(qps, l, qp)
+ if (qp->zone == zone) return qp;
+ return NULL;
+}
+
+void
+e_quickpanel_position_update(E_Quickpanel *qp)
+{
+ Eina_List *l;
+ E_Border *bd;
+ int ty;
+
+ if (!qp) return;
+ e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ {
+ bd->x = qp->zone->x;
+ bd->y = (ty - qp->h);
+ bd->changed = 1;
+ bd->changes.pos = 1;
+ }
+}
+
+/* local functions */
+static void
+_e_quickpanel_cb_free(E_Quickpanel *qp)
+{
+ E_Border *bd;
+
+ if (qp->animator) ecore_animator_del(qp->animator);
+ qp->animator = NULL;
+ if (qp->timer) ecore_timer_del(qp->timer);
+ qp->timer = NULL;
+ EINA_LIST_FREE(qp->borders, bd)
+ bd->stolen = 0;
+ E_FREE(qp);
+}
+
+static int
+_e_quickpanel_cb_client_message(void *data, int type, void *event)
+{
+ Ecore_X_Event_Client_Message *ev;
+ E_Zone *zone;
+ E_Quickpanel *qp;
+
+ ev = event;
+ if (ev->win != ecore_x_window_root_first_get()) return 1;
+ if (ev->message_type != ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) return 1;
+ zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
+ if (!(qp = e_quickpanel_by_zone_get(zone))) return 1;
+ if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
+ e_quickpanel_hide(qp);
+ else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
+ e_quickpanel_show(qp);
+ return 1;
+}
+
+static void
+_e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2)
+{
+ E_Border *bd;
+ E_Quickpanel *qp;
+ int ty;
+
+ if (!(bd = data2)) return;
+ if (!bd->new_client) return;
+ if (!_e_quickpanel_border_is_quickpanel(bd)) return;
+ if (_e_quickpanel_by_border_get(bd)) return;
+ if (!(qp = e_quickpanel_by_zone_get(bd->zone))) return;
+ e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty);
+ bd->stolen = 1;
+ if (bd->remember)
+ {
+ if (bd->bordername)
+ {
+ eina_stringshare_del(bd->bordername);
+ bd->bordername = NULL;
+ bd->client.border.changed = 1;
+ }
+ e_remember_unuse(bd->remember);
+ bd->remember = NULL;
+ }
+ eina_stringshare_replace(&bd->bordername, "borderless");
+ bd->client.border.changed = 1;
+ qp->h += bd->h;
+ e_border_move(bd, qp->zone->x, (ty - qp->h));
+ if (qp->visible)
+ {
+ int th;
+
+ e_illume_border_top_shelf_size_get(qp->zone, NULL, &th);
+ e_border_fx_offset(bd, 0, (bd->h - th));
+ }
+ qp->borders = eina_list_sorted_insert(qp->borders, _e_quickpanel_cb_sort, bd);
+}
+
+static E_Quickpanel *
+_e_quickpanel_by_border_get(E_Border *bd)
+{
+ Eina_List *l, *ll;
+ E_Border *b;
+ E_Quickpanel *qp;
+
+ if (!bd->stolen) return NULL;
+ EINA_LIST_FOREACH(qps, l, qp)
+ EINA_LIST_FOREACH(qp->borders, ll, b)
+ if (b == bd) return qp;
+ return NULL;
+}
+
+static int
+_e_quickpanel_border_is_quickpanel(E_Border *bd)
+{
+ return ecore_x_e_illume_quickpanel_get(bd->client.win);
+}
+
+static void
+_e_quickpanel_slide(E_Quickpanel *qp, int visible, double len)
+{
+ qp->start = ecore_loop_time_get();
+ qp->len = len;
+ qp->adjust_start = qp->adjust;
+ qp->adjust_end = 0;
+ if (visible)
+ {
+ Eina_List *l;
+ E_Border *bd;
+
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ qp->adjust_end += bd->h;
+ }
+ else
+ {
+ int th;
+
+ e_illume_border_top_shelf_size_get(qp->zone, NULL, &th);
+ qp->adjust_end = -th;
+ }
+ if (!qp->animator)
+ qp->animator = ecore_animator_add(_e_quickpanel_cb_animate, qp);
+}
+
+static int
+_e_quickpanel_cb_animate(void *data)
+{
+ E_Quickpanel *qp;
+ Eina_List *l;
+ E_Border *bd;
+ double t, v;
+
+ if (!(qp = data)) return 0;
+ t = ecore_loop_time_get() - qp->start;
+ if (t > qp->len) t = qp->len;
+ if (qp->len > 0.0)
+ {
+ v = t / qp->len;
+ v = 1.0 - v;
+ v = v * v * v * v;
+ v = 1.0 - v;
+ }
+ else
+ {
+ t = qp->len;
+ v = 1.0;
+ }
+ qp->adjust = (qp->adjust_end * v) + (qp->adjust_start * (1.0 - v));
+
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ {
+ e_border_lower(bd);
+ e_border_fx_offset(bd, 0, (bd->h + qp->adjust));
+ }
+
+ if (t == qp->len)
+ {
+ qp->animator = NULL;
+ if (qp->visible)
+ qp->visible = 0;
+ else
+ qp->visible = 1;
+ return 0;
+ }
+ return 1;
+}
+
+static int
+_e_quickpanel_cb_delay_hide(void *data)
+{
+ E_Quickpanel *qp;
+
+ if (!(qp = data)) return 0;
+ _e_quickpanel_hide(qp);
+ qp->timer = NULL;
+ return 0;
+}
+
+static void
+_e_quickpanel_hide(E_Quickpanel *qp)
+{
+ if (qp->timer) ecore_timer_del(qp->timer);
+ qp->timer = NULL;
+ if (!qp->visible) return;
+ if (input_win)
+ {
+ ecore_x_window_free(input_win);
+ e_grabinput_release(input_win, input_win);
+ input_win = 0;
+ }
+ if (il_cfg->sliding.quickpanel.duration <= 0)
+ {
+ Eina_List *l;
+ E_Border *bd;
+
+ EINA_LIST_FOREACH(qp->borders, l, bd)
+ {
+ e_border_lower(bd);
+ e_border_fx_offset(bd, 0, 0);
+ }
+ qp->visible = 0;
+ }
+ else
+ _e_quickpanel_slide(qp, 0,
+ (double)il_cfg->sliding.quickpanel.duration / 1000.0);
+}
+
+static int
+_e_quickpanel_cb_sort(const void *b1, const void *b2)
+{
+ const E_Border *bd1, *bd2;
+ int major1, major2;
+
+ if (!(bd1 = b1)) return 0;
+ if (!(bd2 = b2)) return 1;
+ printf("Checking: %s against %s\n", bd2->client.icccm.name, bd1->client.icccm.name);
+ major1 = ecore_x_e_illume_quickpanel_priority_major_get(bd1->client.win);
+ major2 = ecore_x_e_illume_quickpanel_priority_major_get(bd2->client.win);
+ if (major2 > major1) return 1;
+ else if (major2 < major1) return -1;
+ /*
+ else if (major2 == major1)
+ {
+ int minor1, minor2;
+
+ minor1 =
+ ecore_x_e_illume_quickpanel_priority_minor_get(bd1->client.win);
+ minor2 =
+ ecore_x_e_illume_quickpanel_priority_minor_get(bd2->client.win);
+ printf("Minors: %d %d\n", minor2, minor1);
+ if (minor2 > minor1) return 1;
+ else if (minor2 < minor1) return -1;
+ }
+ */
+ return 0;
+}
+
+static int
+_e_quickpanel_cb_mouse_down(void *data, int type, void *event)
+{
+ Ecore_Event_Mouse_Button *ev;
+ Ecore_X_Window xwin;
+
+ ev = event;
+ if (ev->event_window != input_win) return 1;
+ xwin = ecore_x_window_root_first_get();
+ ecore_x_e_illume_quickpanel_state_set(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
+ ecore_x_e_illume_quickpanel_state_send(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
+ return 1;
+}
+
+static int
+_e_quickpanel_cb_mouse_wheel(void *data, int type, void *event)
+{
+ Ecore_Event_Mouse_Wheel *ev;
+ Ecore_X_Window xwin;
+
+ ev = event;
+ if (ev->event_window != input_win) return 1;
+ if (ev->z > 0) return 1;
+ xwin = ecore_x_window_root_first_get();
+ ecore_x_e_illume_quickpanel_state_set(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
+ ecore_x_e_illume_quickpanel_state_send(xwin, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
+ return 1;
+}
--- /dev/null
+#ifndef E_QUICKPANEL_H
+#define E_QUICKPANEL_H
+
+#define E_QUICKPANEL_TYPE 0xE1b0990
+
+typedef struct _E_Quickpanel E_Quickpanel;
+struct _E_Quickpanel
+{
+ E_Object e_obj_inherit;
+
+ E_Zone *zone;
+ Eina_List *borders;
+ Ecore_Timer *timer;
+ Ecore_Animator *animator;
+ double start, len;
+ int h, adjust, adjust_start, adjust_end;
+ unsigned char visible : 1;
+};
+
+int e_quickpanel_init(void);
+int e_quickpanel_shutdown(void);
+
+E_Quickpanel *e_quickpanel_new(E_Zone *zone);
+void e_quickpanel_show(E_Quickpanel *qp);
+void e_quickpanel_hide(E_Quickpanel *qp);
+E_Quickpanel *e_quickpanel_by_zone_get(E_Zone *zone);
+void e_quickpanel_position_update(E_Quickpanel *qp);
+
+#endif
--- /dev/null
+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
+
--- /dev/null
+/org/freedesktop/Hal/devices/platform_*
--- /dev/null
+[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>
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+SUBDIRS = samsung illume
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+MODULE = illume2
+
+# 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@
+
+plugindir = $(libdir)/enlightenment/modules/$(MODULE)/policies
+
+illumedir = $(plugindir)
+illume_LTLIBRARIES = illume.la
+illume_la_SOURCES = illume.c layout.c
+illume_la_LIBADD = @e_libs@
+illume_la_LDFLAGS = -no-undefined -module -avoid-version
+illume_la_LIBTOOLFLAGS = --tag=disable-static
--- /dev/null
+#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.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.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)
+{
+
+}
--- /dev/null
+#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
--- /dev/null
+#include "E_Illume.h"
+#include "layout.h"
+
+/* local function prototypes */
+static void _border_resize_fx(E_Border *bd, int bx, int by, int bw, int bh);
+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)
+{
+ /* HANDLE A BORDER BEING ADDED */
+
+ int conform;
+
+ /* skip new clients and invisible borders */
+ if ((bd->new_client) || (!bd->visible)) return;
+
+ /* check if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* is this a fullscreen border ? */
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ E_Border *b;
+
+ if (bd->layer != IL_FULLSCREEN_LAYER)
+ e_border_layer_set(bd, IL_FULLSCREEN_LAYER);
+
+ /* we lock stacking so that the keyboard does not get put
+ * under the window (if it's needed) */
+ bd->lock_user_stacking = 1;
+
+ /* conformant fullscreen borders just hide bottom panel */
+ b = e_illume_border_bottom_panel_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, -panelsize);
+
+ /* for non-conformant fullscreen borders,
+ * we hide top shelf and bottom panel in all cases */
+ if (!conform)
+ {
+ b = e_illume_border_top_shelf_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, -shelfsize);
+ }
+ }
+ else if (conform)
+ {
+ if (bd->layer != IL_CONFORM_LAYER)
+ e_border_layer_set(bd, IL_CONFORM_LAYER);
+ bd->lock_user_stacking = 1;
+ }
+
+ /* 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))
+ e_border_focus_set(bd, 1, 1);
+}
+
+void
+_layout_border_del(E_Border *bd)
+{
+ /* HANDLE A BORDER BEING DELETED */
+
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ E_Border *b;
+
+ /* conformant fullscreen borders just get bottom panel shown */
+ b = e_illume_border_bottom_panel_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, 0);
+
+ /* for non-conformant fullscreen borders,
+ * we show top shelf and bottom panel in all cases */
+ if (!e_illume_border_is_conformant(bd))
+ {
+ b = e_illume_border_top_shelf_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, 0);
+ }
+ }
+}
+
+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)
+{
+ /* HANDLE A BORDER BEING ACTIVATED */
+
+ if (bd->stolen) return;
+
+ /* 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_zone_layout(E_Zone *zone)
+{
+ Eina_List *l, *borders;
+ E_Border *bd;
+
+ /* ACTUALLY APPLY THE SIZING, POSITIONING AND LAYERING */
+
+ /* grab list of borders */
+ borders = e_border_client_list();
+ EINA_LIST_FOREACH(borders, l, bd)
+ {
+ int mh;
+
+ /* skip border if: zone not the same, a new client, or invisible */
+ if ((bd->zone != zone) || (bd->new_client) || (!bd->visible)) continue;
+
+ /* check for special windows to get their size(s) */
+ e_illume_border_min_get(bd, NULL, &mh);
+ if (e_illume_border_is_top_shelf(bd))
+ {
+ if (shelfsize < mh) shelfsize = mh;
+ }
+ else if (e_illume_border_is_bottom_panel(bd))
+ {
+ if (panelsize < mh) panelsize = mh;
+ }
+ else if (e_illume_border_is_keyboard(bd))
+ {
+ if (kbdsize < mh) kbdsize = mh;
+ }
+ }
+
+ /* grab list of borders */
+ borders = e_border_client_list();
+ EINA_LIST_FOREACH(borders, l, bd)
+ {
+ /* skip border if: zone not the same, a new client, or invisible */
+ if ((bd->zone != zone) || (bd->new_client) || (!bd->visible)) continue;
+
+ /* trap 'special' windows as they need special treatment */
+ if (e_illume_border_is_top_shelf(bd))
+ {
+ /* make sure we are not dragging the shelf */
+ if (!ecore_x_e_illume_drag_get(bd->client.win))
+ {
+ /* if we are not in dual mode, then set shelf to top */
+ if (!il_cfg->policy.mode.dual)
+ _border_resize_fx(bd, zone->x, zone->y, zone->w, shelfsize);
+ else
+ {
+ /* make sure we are in landscape mode */
+ if (il_cfg->policy.mode.side == 0)
+ _border_resize_fx(bd, zone->x, bd->y, zone->w, shelfsize);
+ else
+ _border_resize_fx(bd, zone->x, zone->y, zone->w, shelfsize);
+ }
+ }
+ e_border_stick(bd);
+ if (bd->layer != IL_TOP_SHELF_LAYER)
+ e_border_layer_set(bd, IL_TOP_SHELF_LAYER);
+ }
+ else if (e_illume_border_is_bottom_panel(bd))
+ {
+ /* make sure we are not dragging the bottom panel */
+ if (!ecore_x_e_illume_drag_get(bd->client.win))
+ _border_resize_fx(bd, zone->x, (zone->y + zone->h - panelsize),
+ zone->w, panelsize);
+ e_border_stick(bd);
+ if (bd->layer != IL_BOTTOM_PANEL_LAYER)
+ e_border_layer_set(bd, IL_BOTTOM_PANEL_LAYER);
+ }
+ else if (e_illume_border_is_keyboard(bd))
+ {
+ if ((bd->h != kbdsize) || (bd->w != zone->w))
+ e_border_resize(bd, zone->w, kbdsize);
+ if ((bd->x != zone->x) || (bd->y != (zone->y + zone->h - kbdsize)) ||
+ (bd->fx.y != (zone->y + zone->h - kbdsize)))
+ e_border_move(bd, zone->x, (zone->y + zone->h - kbdsize));
+ e_border_stick(bd);
+ if (bd->layer != IL_KEYBOARD_LAYER)
+ e_border_layer_set(bd, IL_KEYBOARD_LAYER);
+ }
+ else if (e_illume_border_is_dialog(bd))
+ {
+ int mw, mh;
+
+ e_illume_border_min_get(bd, &mw, &mh);
+ if (mw > zone->w) mw = zone->w;
+ if (mh > zone->h) mh = zone->h;
+ _border_resize_fx(bd, (zone->x + ((zone->w - mw) / 2)),
+ (zone->y + ((zone->h - mh) / 2)), mw, mh);
+ if (bd->layer != IL_DIALOG_LAYER)
+ e_border_layer_set(bd, IL_DIALOG_LAYER);
+ }
+ else if (e_illume_border_is_quickpanel(bd))
+ {
+ int mh;
+
+ e_illume_border_min_get(bd, NULL, &mh);
+ if ((bd->w != bd->zone->w) || (bd->h != mh))
+ e_border_resize(bd, 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->layer != IL_APP_LAYER)
+ e_border_layer_set(bd, IL_APP_LAYER);
+
+ /* normal border, handle layout based on policy mode */
+ if (il_cfg->policy.mode.dual) _zone_layout_dual(bd);
+ else _zone_layout_single(bd);
+ }
+ }
+}
+
+void
+_layout_zone_move_resize(E_Zone *zone)
+{
+ /* the zone was moved or resized - re-configure all windows in this zone */
+ _layout_zone_layout(zone);
+}
+
+void
+_layout_drag_start(E_Border *bd)
+{
+ /* HANDLE A BORDER DRAG BEING STARTED */
+ ecore_x_e_illume_drag_set(bd->client.win, 1);
+}
+
+void
+_layout_drag_end(E_Border *bd)
+{
+ /* HANDLE A BORDER DRAG BEING ENDED */
+ ecore_x_e_illume_drag_set(bd->client.win, 0);
+}
+
+/* local functions */
+static void
+_border_resize_fx(E_Border *bd, int bx, int by, int bw, int bh)
+{
+ /* CONVENIENCE FUNCTION TO REMOVE DUPLICATED CODE */
+
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ if ((bd->w != bw) || (bd->h != bh))
+ {
+ bd->w = bw;
+ bd->h = bh;
+ bd->client.w = bw;
+ bd->client.h = bh;
+ bd->changes.size = 1;
+ bd->changed = 1;
+ }
+ if ((bd->x != bx) || (bd->y != by))
+ {
+ bd->x = bx;
+ bd->y = by;
+ bd->changes.pos = 1;
+ bd->changed = 1;
+ }
+ }
+ else
+ {
+ if ((bd->w != bw) || (bd->h != bh))
+ e_border_resize(bd, bw, bh);
+ if ((bd->x != bx) || (bd->y != by))
+ e_border_fx_offset(bd, bx, by);
+ }
+}
+
+static void
+_zone_layout_single(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+
+ /* 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);
+ if (!e_illume_border_is_conformant(bd))
+ {
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+ else
+ kh = bd->zone->h;
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+}
+
+static void
+_zone_layout_dual(E_Border *bd)
+{
+ if (il_cfg->policy.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 (il_cfg->policy.mode.side == 1)
+ _zone_layout_dual_left(bd);
+}
+
+static void
+_zone_layout_dual_top(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+ int conform;
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* 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);
+ if (!conform)
+ {
+ /* if the border is not conformant and doesn't need fullscreen, then
+ * we account for shelf & panel sizes */
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+
+ /* if there are no other borders, than give this one all available space */
+ if (e_illume_border_valid_count_get(bd->zone) < 2)
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+ else
+ {
+ E_Border *b;
+ int bx, by, bw, bh;
+
+ /* more than one valid border */
+ bx = kx;
+ by = (ky + ss);
+ bw = kw;
+ bh = (kh - ss - ps);
+
+ /* grab the border at this location */
+ b = e_illume_border_at_xy_get(bd->zone, kx, shelfsize);
+
+ if ((b) && (bd != b))
+ {
+ /* we have a border there, and it's not the current one */
+ if (!e_illume_border_is_conformant(b))
+ {
+ /* border in this location is not conformant */
+ bh = ((kh - ss - ps) / 2);
+ by = (b->fx.y + b->h);
+ }
+ else
+ {
+ /* border there is conformant */
+ if (conform)
+ {
+ /* if current border is conformant, divide zone in half */
+ bh = ((bd->zone->h - ss) / 2);
+ by = by + bh;
+ }
+ else
+ {
+ /* current border is not conformant */
+ by = (b->fx.y + b->h);
+ bh = (kh - by - ps);
+ }
+ }
+ }
+ else if (b)
+ {
+ /* border at this location and it's the current border */
+ by = bd->fx.y;
+ bh = ((kh - ss - ps) / 2);
+ }
+ else
+ {
+ /* no border at this location */
+ b = e_illume_border_valid_border_get(bd->zone);
+ by = ky + ss;
+ bh = (ky - b->h);
+ }
+ _border_resize_fx(bd, bx, by, bw, bh);
+ }
+}
+
+static void
+_zone_layout_dual_top_custom(E_Border *bd)
+{
+ int kx, kw;
+ int count, conform;
+ int ax, ay, aw, ah;
+ int zx, zy, zw, zh;
+
+ /* get count of valid borders */
+ count = e_illume_border_valid_count_get(bd->zone);
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* grab the 'safe' region. Safe region is space not occupied by keyboard */
+ e_illume_kbd_safe_app_region_get(bd->zone, &kx, NULL, &kw, NULL);
+
+ 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 (count < 2)
+ {
+ if (ah >= zh)
+ {
+ zx = ax;
+ zy = ax;
+ zw = aw;
+ zh = ah;
+ }
+ if ((bd->w != zw) || (bd->h != zh))
+ e_border_resize(bd, zw, zh);
+ if ((bd->x != zx) || (bd->y != zy) || (bd->fx.y != zy))
+ e_border_fx_offset(bd, zx, zy);
+ }
+ else
+ {
+ E_Border *bt, *bb;
+ int bh, by;
+
+ /* more than one valid border */
+
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) >
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = ah;
+ by = ay;
+ }
+ else
+ {
+ /* grab the border at this location */
+ bt = e_illume_border_at_xy_get(bd->zone, kx, ay);
+
+ if ((bt) && (bd != bt))
+ {
+ /* is there a border in the bottom section */
+ bb = e_illume_border_at_xy_get(bd->zone, kx, zy);
+ if (!bb)
+ {
+ bh = zh;
+ by = zy;
+ }
+ else if ((bb) && (bd != bb))
+ {
+ if (bt == e_border_focused_get())
+ {
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) <=
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = zh;
+ by = zy;
+ }
+ else
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ else if (bb = e_border_focused_get())
+ {
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) <=
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ }
+ else if (bb)
+ {
+ bh = zh;
+ by = zy;
+ }
+ }
+ else
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ if ((bd->w != kw) || (bd->h != bh))
+ e_border_resize(bd, kw, bh);
+ if ((bd->x != kx) || (bd->y != by) || (bd->fx.y != by))
+ e_border_fx_offset(bd, kx, by);
+ }
+}
+
+static void
+_zone_layout_dual_left(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+ int conform;
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* 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);
+ if (!conform)
+ {
+ /* if the border is not conformant and doesn't need fullscreen, then
+ * we account for shelf & panel sizes */
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+
+ /* if there are no other borders, than give this one all available space */
+ if (e_illume_border_valid_count_get(bd->zone) < 2)
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+ else
+ {
+ E_Border *b;
+ int bx, by, bw, bh;
+
+ /* more than one valid border */
+ bx = kx;
+ by = (ky + ss);
+ bw = kw;
+ bh = (kh - ss - ps);
+
+ /* grab the border at this location */
+ b = e_illume_border_at_xy_get(bd->zone, kx, shelfsize);
+
+ if ((b) && (bd != b))
+ {
+ /* we have a border there, and it's not the current one */
+ if (!e_illume_border_is_conformant(b))
+ {
+ /* border in this location is not conformant */
+ bw = (kw / 2);
+ bx = (b->fx.x + b->w);
+ }
+ else
+ {
+ /* border there is conformant */
+ if (conform)
+ {
+ /* if current border is conformant, divide zone in half */
+ bw = (bd->zone->w / 2);
+ bx = bx + bw;
+ }
+ else
+ {
+ /* current border is not conformant */
+ bx = (b->fx.x + b->w);
+ bw = (kw - bx);
+ }
+ }
+ }
+ else if (b)
+ {
+ /* border at this location and it's the current border */
+ bx = bd->fx.x;
+ bw = (kw / 2);
+ }
+ else
+ {
+ /* no border at this location */
+ b = e_illume_border_valid_border_get(bd->zone);
+ bx = kx;
+ bw = (kw - b->w);
+ }
+ _border_resize_fx(bd, bx, by, bw, bh);
+ }
+}
--- /dev/null
+#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 100
+#define IL_KEYBOARD_LAYER 150
+#define IL_DIALOG_LAYER 120
+#define IL_CONFORM_LAYER 140
+#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_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
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+MODULE = illume2
+
+# 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@
+
+plugindir = $(libdir)/enlightenment/modules/$(MODULE)/policies
+
+samsungdir = $(plugindir)
+samsung_LTLIBRARIES = samsung.la
+samsung_la_SOURCES = samsung.c layout.c
+samsung_la_LIBADD = @e_libs@
+samsung_la_LDFLAGS = -no-undefined -module -avoid-version
+samsung_la_LIBTOOLFLAGS = --tag=disable-static
--- /dev/null
+#include "E_Illume.h"
+#include "layout.h"
+
+/* local function prototypes */
+static void _border_resize_fx(E_Border *bd, int bx, int by, int bw, int bh);
+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)
+{
+ /* HANDLE A BORDER BEING ADDED */
+
+ int conform;
+
+ /* skip new clients and invisible borders */
+ if ((bd->new_client) || (!bd->visible)) return;
+
+ /* check if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* is this a fullscreen border ? */
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ E_Border *b;
+
+ if (bd->layer != IL_FULLSCREEN_LAYER)
+ e_border_layer_set(bd, IL_FULLSCREEN_LAYER);
+
+ /* we lock stacking so that the keyboard does not get put
+ * under the window (if it's needed) */
+ bd->lock_user_stacking = 1;
+
+ /* conformant fullscreen borders just hide bottom panel */
+ b = e_illume_border_bottom_panel_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, -panelsize);
+
+ /* for non-conformant fullscreen borders,
+ * we hide top shelf and bottom panel in all cases */
+ if (!conform)
+ {
+ b = e_illume_border_top_shelf_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, -shelfsize);
+ }
+ }
+ else if (conform)
+ {
+ if (bd->layer != IL_CONFORM_LAYER)
+ e_border_layer_set(bd, IL_CONFORM_LAYER);
+ bd->lock_user_stacking = 1;
+ }
+
+ /* 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))
+ e_border_focus_set(bd, 1, 1);
+}
+
+void
+_layout_border_del(E_Border *bd)
+{
+ /* HANDLE A BORDER BEING DELETED */
+
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ E_Border *b;
+
+ /* conformant fullscreen borders just get bottom panel shown */
+ b = e_illume_border_bottom_panel_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, 0);
+
+ /* for non-conformant fullscreen borders,
+ * we show top shelf and bottom panel in all cases */
+ if (!e_illume_border_is_conformant(bd))
+ {
+ b = e_illume_border_top_shelf_get(bd->zone);
+ if (b) e_border_fx_offset(b, 0, 0);
+ }
+ }
+}
+
+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)
+{
+ /* HANDLE A BORDER BEING ACTIVATED */
+
+ if (bd->stolen) return;
+
+ /* 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_zone_layout(E_Zone *zone)
+{
+ Eina_List *l, *borders;
+ E_Border *bd;
+
+ /* ACTUALLY APPLY THE SIZING, POSITIONING AND LAYERING */
+
+ /* grab list of borders */
+ borders = e_border_client_list();
+ EINA_LIST_FOREACH(borders, l, bd)
+ {
+ int mh;
+
+ /* skip border if: zone not the same, a new client, or invisible */
+ if ((bd->zone != zone) || (bd->new_client) || (!bd->visible)) continue;
+
+ /* check for special windows to get their size(s) */
+ e_illume_border_min_get(bd, NULL, &mh);
+ if (e_illume_border_is_top_shelf(bd))
+ {
+ if (shelfsize < mh) shelfsize = mh;
+ }
+ else if (e_illume_border_is_bottom_panel(bd))
+ {
+ if (panelsize < mh) panelsize = mh;
+ }
+ else if (e_illume_border_is_keyboard(bd))
+ {
+ if (kbdsize < mh) kbdsize = mh;
+ }
+ }
+
+ /* grab list of borders */
+ borders = e_border_client_list();
+ EINA_LIST_FOREACH(borders, l, bd)
+ {
+ /* skip border if: zone not the same, a new client, or invisible */
+ if ((bd->zone != zone) || (bd->new_client) || (!bd->visible)) continue;
+
+ /* trap 'special' windows as they need special treatment */
+ if (e_illume_border_is_top_shelf(bd))
+ {
+ /* make sure we are not dragging the shelf */
+ if (!ecore_x_e_illume_drag_get(bd->client.win))
+ {
+ /* if we are not in dual mode, then set shelf to top */
+ if (!il_cfg->policy.mode.dual)
+ _border_resize_fx(bd, zone->x, zone->y, zone->w, shelfsize);
+ else
+ {
+ /* make sure we are in landscape mode */
+ if (il_cfg->policy.mode.side == 0)
+ _border_resize_fx(bd, zone->x, bd->y, zone->w, shelfsize);
+ else
+ _border_resize_fx(bd, zone->x, zone->y, zone->w, shelfsize);
+ }
+ }
+ e_border_stick(bd);
+ if (bd->layer != IL_TOP_SHELF_LAYER)
+ e_border_layer_set(bd, IL_TOP_SHELF_LAYER);
+ }
+ else if (e_illume_border_is_bottom_panel(bd))
+ {
+ /* make sure we are not dragging the bottom panel */
+ if (!ecore_x_e_illume_drag_get(bd->client.win))
+ _border_resize_fx(bd, zone->x, (zone->y + zone->h - panelsize),
+ zone->w, panelsize);
+ e_border_stick(bd);
+ if (bd->layer != IL_BOTTOM_PANEL_LAYER)
+ e_border_layer_set(bd, IL_BOTTOM_PANEL_LAYER);
+ }
+ else if (e_illume_border_is_keyboard(bd))
+ {
+ if ((bd->h != kbdsize) || (bd->w != zone->w))
+ e_border_resize(bd, zone->w, kbdsize);
+ if ((bd->x != zone->x) || (bd->y != (zone->y + zone->h - kbdsize)) ||
+ (bd->fx.y != (zone->y + zone->h - kbdsize)))
+ e_border_move(bd, zone->x, (zone->y + zone->h - kbdsize));
+ e_border_stick(bd);
+ if (bd->layer != IL_KEYBOARD_LAYER)
+ e_border_layer_set(bd, IL_KEYBOARD_LAYER);
+ }
+ else if (e_illume_border_is_dialog(bd))
+ {
+ int mw, mh;
+
+ e_illume_border_min_get(bd, &mw, &mh);
+ if (mw > zone->w) mw = zone->w;
+ if (mh > zone->h) mh = zone->h;
+ _border_resize_fx(bd, (zone->x + ((zone->w - mw) / 2)),
+ (zone->y + ((zone->h - mh) / 2)), mw, mh);
+ if (bd->layer != IL_DIALOG_LAYER)
+ e_border_layer_set(bd, IL_DIALOG_LAYER);
+ }
+ else if (e_illume_border_is_quickpanel(bd))
+ {
+ int mh;
+
+ e_illume_border_min_get(bd, NULL, &mh);
+ if ((bd->w != bd->zone->w) || (bd->h != mh))
+ e_border_resize(bd, 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->layer != IL_APP_LAYER)
+ e_border_layer_set(bd, IL_APP_LAYER);
+
+ /* normal border, handle layout based on policy mode */
+ if (il_cfg->policy.mode.dual) _zone_layout_dual(bd);
+ else _zone_layout_single(bd);
+ }
+ }
+}
+
+void
+_layout_zone_move_resize(E_Zone *zone)
+{
+ /* the zone was moved or resized - re-configure all windows in this zone */
+ _layout_zone_layout(zone);
+}
+
+void
+_layout_drag_start(E_Border *bd)
+{
+ /* HANDLE A BORDER DRAG BEING STARTED */
+ ecore_x_e_illume_drag_set(bd->client.win, 1);
+}
+
+void
+_layout_drag_end(E_Border *bd)
+{
+ /* HANDLE A BORDER DRAG BEING ENDED */
+ ecore_x_e_illume_drag_set(bd->client.win, 0);
+}
+
+/* local functions */
+static void
+_border_resize_fx(E_Border *bd, int bx, int by, int bw, int bh)
+{
+ /* CONVENIENCE FUNCTION TO REMOVE DUPLICATED CODE */
+
+ if ((bd->need_fullscreen) || (bd->fullscreen))
+ {
+ if ((bd->w != bw) || (bd->h != bh))
+ {
+ bd->w = bw;
+ bd->h = bh;
+ bd->client.w = bw;
+ bd->client.h = bh;
+ bd->changes.size = 1;
+ bd->changed = 1;
+ }
+ if ((bd->x != bx) || (bd->y != by))
+ {
+ bd->x = bx;
+ bd->y = by;
+ bd->changes.pos = 1;
+ bd->changed = 1;
+ }
+ }
+ else
+ {
+ if ((bd->w != bw) || (bd->h != bh))
+ e_border_resize(bd, bw, bh);
+ if ((bd->x != bx) || (bd->y != by))
+ e_border_fx_offset(bd, bx, by);
+ }
+}
+
+static void
+_zone_layout_single(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+
+ /* 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);
+ if (!e_illume_border_is_conformant(bd))
+ {
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+ else
+ kh = bd->zone->h;
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+}
+
+static void
+_zone_layout_dual(E_Border *bd)
+{
+ if (il_cfg->policy.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 (il_cfg->policy.mode.side == 1)
+ _zone_layout_dual_left(bd);
+}
+
+static void
+_zone_layout_dual_top(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+ int conform;
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* 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);
+ if (!conform)
+ {
+ /* if the border is not conformant and doesn't need fullscreen, then
+ * we account for shelf & panel sizes */
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+
+ /* if there are no other borders, than give this one all available space */
+ if (e_illume_border_valid_count_get(bd->zone) < 2)
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+ else
+ {
+ E_Border *b;
+ int bx, by, bw, bh;
+
+ /* more than one valid border */
+ bx = kx;
+ by = (ky + ss);
+ bw = kw;
+ bh = (kh - ss - ps);
+
+ /* grab the border at this location */
+ b = e_illume_border_at_xy_get(bd->zone, kx, shelfsize);
+
+ if ((b) && (bd != b))
+ {
+ /* we have a border there, and it's not the current one */
+ if (!e_illume_border_is_conformant(b))
+ {
+ /* border in this location is not conformant */
+ bh = ((kh - ss - ps) / 2);
+ by = (b->fx.y + b->h);
+ }
+ else
+ {
+ /* border there is conformant */
+ if (conform)
+ {
+ /* if current border is conformant, divide zone in half */
+ bh = ((bd->zone->h - ss) / 2);
+ by = by + bh;
+ }
+ else
+ {
+ /* current border is not conformant */
+ by = (b->fx.y + b->h);
+ bh = (kh - by - ps);
+ }
+ }
+ }
+ else if (b)
+ {
+ /* border at this location and it's the current border */
+ by = bd->fx.y;
+ bh = ((kh - ss - ps) / 2);
+ }
+ else
+ {
+ /* no border at this location */
+ b = e_illume_border_valid_border_get(bd->zone);
+ by = ky + ss;
+ bh = (ky - b->h);
+ }
+ _border_resize_fx(bd, bx, by, bw, bh);
+ }
+}
+
+static void
+_zone_layout_dual_top_custom(E_Border *bd)
+{
+ int kx, kw;
+ int count, conform;
+ int ax, ay, aw, ah;
+ int zx, zy, zw, zh;
+
+ /* get count of valid borders */
+ count = e_illume_border_valid_count_get(bd->zone);
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* grab the 'safe' region. Safe region is space not occupied by keyboard */
+ e_illume_kbd_safe_app_region_get(bd->zone, &kx, NULL, &kw, NULL);
+
+ 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 (count < 2)
+ {
+ if (ah >= zh)
+ {
+ zx = ax;
+ zy = ax;
+ zw = aw;
+ zh = ah;
+ }
+ if ((bd->w != zw) || (bd->h != zh))
+ e_border_resize(bd, zw, zh);
+ if ((bd->x != zx) || (bd->y != zy) || (bd->fx.y != zy))
+ e_border_fx_offset(bd, zx, zy);
+ }
+ else
+ {
+ E_Border *bt, *bb;
+ int bh, by;
+
+ /* more than one valid border */
+
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) >
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = ah;
+ by = ay;
+ }
+ else
+ {
+ /* grab the border at this location */
+ bt = e_illume_border_at_xy_get(bd->zone, kx, ay);
+
+ if ((bt) && (bd != bt))
+ {
+ /* is there a border in the bottom section */
+ bb = e_illume_border_at_xy_get(bd->zone, kx, zy);
+ if (!bb)
+ {
+ bh = zh;
+ by = zy;
+ }
+ else if ((bb) && (bd != bb))
+ {
+ if (bt == e_border_focused_get())
+ {
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) <=
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = zh;
+ by = zy;
+ }
+ else
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ else if (bb = e_border_focused_get())
+ {
+ if (ecore_x_e_virtual_keyboard_state_get(bd->client.win) <=
+ ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ }
+ else if (bb)
+ {
+ bh = zh;
+ by = zy;
+ }
+ }
+ else
+ {
+ bh = ah;
+ by = ay;
+ }
+ }
+ if ((bd->w != kw) || (bd->h != bh))
+ e_border_resize(bd, kw, bh);
+ if ((bd->x != kx) || (bd->y != by) || (bd->fx.y != by))
+ e_border_fx_offset(bd, kx, by);
+ }
+}
+
+static void
+_zone_layout_dual_left(E_Border *bd)
+{
+ int kx, ky, kw, kh, ss, ps;
+ int conform;
+
+ /* fetch if this border is conformant */
+ conform = e_illume_border_is_conformant(bd);
+
+ /* 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);
+ if (!conform)
+ {
+ /* if the border is not conformant and doesn't need fullscreen, then
+ * we account for shelf & panel sizes */
+ if (!((bd->need_fullscreen) || (bd->fullscreen)))
+ {
+ if (kh >= bd->zone->h) ps = panelsize;
+ ss = shelfsize;
+ }
+ }
+
+ /* if there are no other borders, than give this one all available space */
+ if (e_illume_border_valid_count_get(bd->zone) < 2)
+ _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps));
+ else
+ {
+ E_Border *b;
+ int bx, by, bw, bh;
+
+ /* more than one valid border */
+ bx = kx;
+ by = (ky + ss);
+ bw = kw;
+ bh = (kh - ss - ps);
+
+ /* grab the border at this location */
+ b = e_illume_border_at_xy_get(bd->zone, kx, shelfsize);
+
+ if ((b) && (bd != b))
+ {
+ /* we have a border there, and it's not the current one */
+ if (!e_illume_border_is_conformant(b))
+ {
+ /* border in this location is not conformant */
+ bw = (kw / 2);
+ bx = (b->fx.x + b->w);
+ }
+ else
+ {
+ /* border there is conformant */
+ if (conform)
+ {
+ /* if current border is conformant, divide zone in half */
+ bw = (bd->zone->w / 2);
+ bx = bx + bw;
+ }
+ else
+ {
+ /* current border is not conformant */
+ bx = (b->fx.x + b->w);
+ bw = (kw - bx);
+ }
+ }
+ }
+ else if (b)
+ {
+ /* border at this location and it's the current border */
+ bx = bd->fx.x;
+ bw = (kw / 2);
+ }
+ else
+ {
+ /* no border at this location */
+ b = e_illume_border_valid_border_get(bd->zone);
+ bx = kx;
+ bw = (kw - b->w);
+ }
+ _border_resize_fx(bd, bx, by, bw, bh);
+ }
+}
--- /dev/null
+#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 100
+#define IL_KEYBOARD_LAYER 150
+#define IL_DIALOG_LAYER 120
+#define IL_CONFORM_LAYER 140
+#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_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
--- /dev/null
+#include "E_Illume.h"
+#include "samsung.h"
+#include "layout.h"
+
+EAPI E_Illume_Layout_Api e_layapi =
+{
+ E_ILLUME_LAYOUT_API_VERSION, "Samsung", "samsung"
+};
+
+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.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.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)
+{
+
+}
--- /dev/null
+#ifndef _SAMSUNG_H
+# define _SAMSUNG_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