illume moves to e's tree - why? the new wizard and config profiles make it
now a breeze to set up and use - unlike before. so now it's a wizard or profile option out-of-the-box. it's a good example of a radical change in profiel for a radical change in gui. SVN revision: 37195
|
@ -1,5 +1,5 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
SUBDIRS = default standard minimalist scaleable netbook
|
||||
SUBDIRS = default standard minimalist scaleable netbook illume
|
||||
|
||||
EET_EET = @eet_eet@
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EET_EET = @eet_eet@
|
||||
|
||||
EXTRA_DIST = \
|
||||
e.src \
|
||||
module.battery.src \
|
||||
module.dropshadow.src \
|
||||
module.illume.src \
|
||||
module.mixer.src \
|
||||
module.pager.src
|
||||
|
||||
filesdir = $(datadir)/enlightenment/data/config/illume
|
||||
files_DATA = \
|
||||
profile.desktop \
|
||||
icon.png \
|
||||
e.cfg \
|
||||
module.battery.cfg \
|
||||
module.dropshadow.cfg \
|
||||
module.illume.cfg \
|
||||
module.mixer.cfg \
|
||||
module.pager.cfg
|
||||
|
||||
%.cfg: %.src
|
||||
$(EET_EET) -e \
|
||||
$(top_builddir)/config/illume/$@ config \
|
||||
$< 1
|
||||
|
||||
clean-local:
|
||||
rm -rf *.cfg *~
|
||||
|
|
@ -0,0 +1,789 @@
|
|||
group "E_Config" struct {
|
||||
value "config_version" int: 65833;
|
||||
value "show_splash" int: 1;
|
||||
value "init_default_theme" string: "default.edj";
|
||||
value "desktop_default_name" string: "Desktop %i, %i";
|
||||
value "menus_scroll_speed" double: 1000.0000000000000000000000000;
|
||||
value "menus_fast_mouse_move_threshhold" double: 300.0000000000000000000000000;
|
||||
value "menus_click_drag_timeout" double: 0.2500000000000000000000000;
|
||||
value "border_shade_animate" int: 1;
|
||||
value "border_shade_transition" int: 3;
|
||||
value "border_shade_speed" double: 3000.0000000000000000000000000;
|
||||
value "framerate" double: 30.0000000000000000000000000;
|
||||
value "image_cache" int: 2048;
|
||||
value "font_cache" int: 512;
|
||||
value "edje_cache" int: 8;
|
||||
value "edje_collection_cache" int: 24;
|
||||
value "zone_desks_x_count" int: 4;
|
||||
value "zone_desks_y_count" int: 1;
|
||||
value "use_virtual_roots" int: 0;
|
||||
value "show_desktop_icons" int: 0;
|
||||
value "edge_flip_dragging" int: 0;
|
||||
value "edge_flip_moving" int: 0;
|
||||
value "edge_flip_timeout" double: 0.2500000000000000000000000;
|
||||
value "evas_engine_default" int: 4;
|
||||
value "evas_engine_container" int: 0;
|
||||
value "evas_engine_init" int: 0;
|
||||
value "evas_engine_menus" int: 0;
|
||||
value "evas_engine_borders" int: 0;
|
||||
value "evas_engine_errors" int: 0;
|
||||
value "evas_engine_popups" int: 0;
|
||||
value "evas_engine_drag" int: 0;
|
||||
value "evas_engine_win" int: 0;
|
||||
value "evas_engine_zone" int: 0;
|
||||
value "use_composite" int: 0;
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "illume";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 0;
|
||||
value "priority" int: 1;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "start";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 0;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_desk";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_dialogs";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_imc";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_keybindings";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_intl";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_mouse_cursor";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_transitions";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "battery";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "mixer";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "clock";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "pager";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "connman";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_display";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_profiles";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_performance";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_fonts";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_engine";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_startup";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_theme";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_wallpaper";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "dropshadow";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_desks";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "conf_scale";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: 0;
|
||||
}
|
||||
}
|
||||
group "modules" list {
|
||||
group "E_Config_Module" struct {
|
||||
value "name" string: "gadman";
|
||||
value "enabled" uchar: 1;
|
||||
value "delayed" uchar: 1;
|
||||
value "priority" int: -100;
|
||||
}
|
||||
}
|
||||
group "font_defaults" list {
|
||||
group "E_Font_Default" struct {
|
||||
value "text_class" string: "default";
|
||||
value "font" string: "Vera";
|
||||
value "size" int: 10;
|
||||
}
|
||||
}
|
||||
group "themes" list {
|
||||
group "E_Config_Theme" struct {
|
||||
value "category" string: "theme";
|
||||
value "file" string: "illume.edj";
|
||||
}
|
||||
}
|
||||
group "key_bindings" list {
|
||||
group "E_Config_Binding_Key" struct {
|
||||
value "context" int: 9;
|
||||
value "modifiers" int: 0;
|
||||
value "key" string: "Keycode-177";
|
||||
value "action" string: "simple_lock";
|
||||
value "params" string: "";
|
||||
value "any_mod" uchar: 1;
|
||||
}
|
||||
}
|
||||
group "key_bindings" list {
|
||||
group "E_Config_Binding_Key" struct {
|
||||
value "context" int: 9;
|
||||
value "modifiers" int: 0;
|
||||
value "key" string: "Execute";
|
||||
value "action" string: "delayed_action";
|
||||
value "params" string: "[0.0 exec dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RequestResourceState string:cpu string:illume-cmdline string:off] [2.0 halt_now]";
|
||||
value "any_mod" uchar: 1;
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,clicked,[12]";
|
||||
value "source" string: "e.event.close";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_close";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.titlebar";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_move";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,up,1";
|
||||
value "source" string: "e.event.titlebar";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_move";
|
||||
value "params" string: "end";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.tl";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "tl";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.t";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "t";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.tr";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "tr";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.r";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "r";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.br";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "br";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.b";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "b";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.bl";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "bl";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,1";
|
||||
value "source" string: "e.event.resize.l";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "l";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,up,1";
|
||||
value "source" string: "e.event.resize.*";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_resize";
|
||||
value "params" string: "end";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,down,3";
|
||||
value "source" string: "e.event.resize.*";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_move";
|
||||
}
|
||||
}
|
||||
group "signal_bindings" list {
|
||||
group "E_Config_Binding_Signal" struct {
|
||||
value "context" int: 2;
|
||||
value "signal" string: "mouse,up,3";
|
||||
value "source" string: "e.event.resize.*";
|
||||
value "modifiers" int: 0;
|
||||
value "any_mod" uchar: 1;
|
||||
value "action" string: "window_move";
|
||||
value "params" string: "end";
|
||||
}
|
||||
}
|
||||
value "window_placement_policy" int: 0;
|
||||
value "focus_policy" int: 0;
|
||||
value "focus_setting" int: 1;
|
||||
value "pass_click_on" int: 1;
|
||||
value "always_click_to_raise" int: 0;
|
||||
value "always_click_to_focus" int: 0;
|
||||
value "use_auto_raise" int: 0;
|
||||
value "auto_raise_delay" double: 0.5000000000000000000000000;
|
||||
value "use_resist" int: 1;
|
||||
value "drag_resist" int: 16;
|
||||
value "desk_resist" int: 32;
|
||||
value "window_resist" int: 12;
|
||||
value "gadget_resist" int: 32;
|
||||
value "winlist_warp_while_selecting" int: 1;
|
||||
value "winlist_warp_at_end" int: 1;
|
||||
value "winlist_warp_speed" double: 0.1000000000000000055511151;
|
||||
value "winlist_scroll_animate" int: 1;
|
||||
value "winlist_scroll_speed" double: 0.1000000000000000055511151;
|
||||
value "winlist_list_show_iconified" int: 1;
|
||||
value "winlist_list_show_other_desk_iconified" int: 1;
|
||||
value "winlist_list_show_other_screen_iconified" int: 0;
|
||||
value "winlist_list_show_other_desk_windows" int: 0;
|
||||
value "winlist_list_show_other_screen_windows" int: 0;
|
||||
value "winlist_list_uncover_while_selecting" int: 0;
|
||||
value "winlist_list_jump_desk_while_selecting" int: 0;
|
||||
value "winlist_list_focus_while_selecting" int: 1;
|
||||
value "winlist_list_raise_while_selecting" int: 1;
|
||||
value "winlist_pos_align_x" double: 0.5000000000000000000000000;
|
||||
value "winlist_pos_align_y" double: 0.5000000000000000000000000;
|
||||
value "winlist_pos_size_w" double: 0.5000000000000000000000000;
|
||||
value "winlist_pos_size_h" double: 0.5000000000000000000000000;
|
||||
value "winlist_pos_min_w" int: 0;
|
||||
value "winlist_pos_min_h" int: 0;
|
||||
value "winlist_pos_max_w" int: 320;
|
||||
value "winlist_pos_max_h" int: 320;
|
||||
value "maximize_policy" int: 50;
|
||||
value "allow_manip" int: 0;
|
||||
value "border_fix_on_shelf_toggle" int: 0;
|
||||
value "allow_above_fullscreen" int: 0;
|
||||
value "kill_if_close_not_possible" int: 1;
|
||||
value "kill_process" int: 1;
|
||||
value "kill_timer_wait" double: 10.0000000000000000000000000;
|
||||
value "ping_clients" int: 1;
|
||||
value "transition_desk" string: "vswipe";
|
||||
value "transition_change" string: "crossfade";
|
||||
value "remember_internal_windows" int: 0;
|
||||
value "move_info_follows" int: 1;
|
||||
value "resize_info_follows" int: 1;
|
||||
value "move_info_visible" int: 1;
|
||||
value "resize_info_visible" int: 1;
|
||||
value "focus_last_focused_per_desktop" int: 1;
|
||||
value "focus_revert_on_hide_or_close" int: 1;
|
||||
value "pointer_slide" int: 0;
|
||||
value "use_e_cursor" int: 1;
|
||||
value "cursor_size" int: 32;
|
||||
value "menu_autoscroll_margin" int: 0;
|
||||
value "menu_autoscroll_cursor_margin" int: 1;
|
||||
value "transient.move" int: 1;
|
||||
value "transient.resize" int: 0;
|
||||
value "transient.raise" int: 1;
|
||||
value "transient.lower" int: 1;
|
||||
value "transient.layer" int: 1;
|
||||
value "transient.desktop" int: 1;
|
||||
value "transient.iconify" int: 1;
|
||||
value "modal_windows" int: 1;
|
||||
value "menu_eap_name_show" int: 1;
|
||||
value "menu_eap_generic_show" int: 1;
|
||||
value "menu_eap_comment_show" int: 0;
|
||||
value "fullscreen_policy" int: 0;
|
||||
value "exebuf_max_exe_list" int: 20;
|
||||
value "exebuf_max_eap_list" int: 20;
|
||||
value "exebuf_max_hist_list" int: 20;
|
||||
value "exebuf_scroll_animate" int: 1;
|
||||
value "exebuf_scroll_speed" double: 0.1000000000000000055511151;
|
||||
value "exebuf_pos_align_x" double: 0.5000000000000000000000000;
|
||||
value "exebuf_pos_align_y" double: 0.5000000000000000000000000;
|
||||
value "exebuf_pos_size_w" double: 0.7500000000000000000000000;
|
||||
value "exebuf_pos_size_h" double: 0.2500000000000000000000000;
|
||||
value "exebuf_pos_min_w" int: 200;
|
||||
value "exebuf_pos_min_h" int: 160;
|
||||
value "exebuf_pos_max_w" int: 400;
|
||||
value "exebuf_pos_max_h" int: 320;
|
||||
value "exebuf_term_cmd" string: "xterm -hold -e";
|
||||
value "use_app_icon" int: 0;
|
||||
value "cnfmdlg_disabled" int: 0;
|
||||
value "cfgdlg_auto_apply" int: 0;
|
||||
value "cfgdlg_default_mode" int: 0;
|
||||
group "gadcons" list {
|
||||
group "E_Config_Gadcon" struct {
|
||||
value "name" string: "slipshelf";
|
||||
value "id" int: 0;
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "clock";
|
||||
value "id" string: "clock";
|
||||
value "geom.pos" int: 720;
|
||||
value "geom.size" int: 42;
|
||||
value "geom.res" int: 138;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 1;
|
||||
value "state_info.flags" int: 1;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "battery";
|
||||
value "id" string: "battery";
|
||||
value "geom.pos" int: 720;
|
||||
value "geom.size" int: 52;
|
||||
value "geom.res" int: 142;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 4;
|
||||
value "state_info.flags" int: 1;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "illume-gsm";
|
||||
value "id" string: "illume-gsm";
|
||||
value "geom.pos" int: 720;
|
||||
value "geom.size" int: 29;
|
||||
value "geom.res" int: 142;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 3;
|
||||
value "state_info.flags" int: 1;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "illume-wifi";
|
||||
value "id" string: "illume-wifi";
|
||||
value "geom.pos" int: 720;
|
||||
value "geom.size" int: 19;
|
||||
value "geom.res" int: 138;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 2;
|
||||
value "state_info.flags" int: 1;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group "gadcons" list {
|
||||
group "E_Config_Gadcon" struct {
|
||||
value "name" string: "slipshelf_extra";
|
||||
value "id" int: 0;
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "illume-bluetooth";
|
||||
value "id" string: "illume-bluetooth";
|
||||
value "geom.pos" int: 440;
|
||||
value "geom.size" int: 32;
|
||||
value "geom.res" int: 472;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 3;
|
||||
value "state_info.flags" int: 3;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "illume-cfg";
|
||||
value "id" string: "illume-cfg";
|
||||
value "geom.pos" int: 0;
|
||||
value "geom.size" int: 32;
|
||||
value "geom.res" int: 472;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 1;
|
||||
value "state_info.flags" int: 1;
|
||||
value "style" string: "plain";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
group "clients" list {
|
||||
group "E_Config_Gadcon_Client" struct {
|
||||
value "name" string: "pager";
|
||||
value "id" string: "pager";
|
||||
value "geom.pos" int: 376;
|
||||
value "geom.size" int: 96;
|
||||
value "geom.res" int: 472;
|
||||
value "geom.pos_x" double: 0.0000000000000000000000000;
|
||||
value "geom.pos_y" double: 0.0000000000000000000000000;
|
||||
value "geom.size_w" double: 0.0000000000000000000000000;
|
||||
value "geom.size_h" double: 0.0000000000000000000000000;
|
||||
value "state_info.seq" int: 4;
|
||||
value "state_info.flags" int: 0;
|
||||
value "style" string: "inset";
|
||||
value "autoscroll" uchar: 0;
|
||||
value "resizable" uchar: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group "gadcons" list {
|
||||
group "E_Config_Gadcon" struct {
|
||||
value "name" string: "gadman";
|
||||
value "id" int: 114;
|
||||
}
|
||||
}
|
||||
group "gadcons" list {
|
||||
group "E_Config_Gadcon" struct {
|
||||
value "name" string: "gadman_top";
|
||||
value "id" int: 115;
|
||||
}
|
||||
}
|
||||
value "font_hinting" int: 0;
|
||||
value "desklock_auth_method" int: 0;
|
||||
value "desklock_login_box_zone" int: -1;
|
||||
value "desklock_autolock_screensaver" int: 0;
|
||||
value "desklock_autolock_idle" int: 0;
|
||||
value "desklock_autolock_idle_timeout" double: 300.0000000000000000000000000;
|
||||
value "desklock_use_custom_desklock" int: 0;
|
||||
value "display_res_restore" int: 0;
|
||||
value "display_res_width" int: 1;
|
||||
value "display_res_height" int: 1;
|
||||
value "display_res_hz" int: 0;
|
||||
value "display_res_rotation" int: 0;
|
||||
value "screensaver_enable" int: 1;
|
||||
value "screensaver_timeout" int: 30;
|
||||
value "screensaver_interval" int: 5;
|
||||
value "screensaver_blanking" int: 2;
|
||||
value "screensaver_expose" int: 2;
|
||||
value "dpms_enable" int: 0;
|
||||
value "dpms_standby_enable" int: 0;
|
||||
value "dpms_suspend_enable" int: 0;
|
||||
value "dpms_off_enable" int: 0;
|
||||
value "dpms_standby_timeout" int: 0;
|
||||
value "dpms_suspend_timeout" int: 0;
|
||||
value "dpms_off_timeout" int: 0;
|
||||
value "clientlist_group_by" int: 0;
|
||||
value "clientlist_include_all_zones" int: 0;
|
||||
value "clientlist_separate_with" int: 0;
|
||||
value "clientlist_sort_by" int: 0;
|
||||
value "clientlist_separate_iconified_apps" int: 0;
|
||||
value "clientlist_warp_to_iconified_desktop" int: 0;
|
||||
value "clientlist_limit_caption_len" int: 0;
|
||||
value "clientlist_max_caption_len" int: 2;
|
||||
value "mouse_hand" int: 1;
|
||||
value "mouse_accel_numerator" int: 2;
|
||||
value "mouse_accel_denominator" int: 1;
|
||||
value "mouse_accel_threshold" int: 4;
|
||||
value "border_raise_on_mouse_action" int: 1;
|
||||
value "border_raise_on_focus" int: 1;
|
||||
value "desk_flip_wrap" int: 0;
|
||||
value "icon_theme" string: "openmoko-standard";
|
||||
value "desk_flip_animate_mode" int: 0;
|
||||
value "desk_flip_animate_interpolation" int: 0;
|
||||
value "desk_flip_animate_time" double: 0.2000000000000000111022302;
|
||||
value "wallpaper_import_last_dev" string: "~/";
|
||||
value "wallpaper_import_last_path" string: "/";
|
||||
value "wallpaper_grad_c1_r" int: 0;
|
||||
value "wallpaper_grad_c1_g" int: 0;
|
||||
value "wallpaper_grad_c1_b" int: 0;
|
||||
value "wallpaper_grad_c2_r" int: 255;
|
||||
value "wallpaper_grad_c2_g" int: 255;
|
||||
value "wallpaper_grad_c2_b" int: 255;
|
||||
value "theme_default_border_style" string: "default";
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/jpeg";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/png";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/x-pixmap";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/x-xpixmap";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/svg+xml";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/gif";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "image/tiff";
|
||||
value "icon" string: "THUMB";
|
||||
}
|
||||
}
|
||||
group "mime_icons" list {
|
||||
group "E_Config_Mime_Icon" struct {
|
||||
value "mime" string: "application/x-desktop";
|
||||
value "icon" string: "DESKTOP";
|
||||
}
|
||||
}
|
||||
value "desk_auto_switch" int: 0;
|
||||
value "thumb_nice" int: 0;
|
||||
value "menu_favorites_show" int: 1;
|
||||
value "menu_apps_show" int: 1;
|
||||
value "ping_clients_interval" int: 128;
|
||||
value "cache_flush_poll_interval" int: 512;
|
||||
value "thumbscroll_enable" int: 1;
|
||||
value "thumbscroll_threshhold" int: 36;
|
||||
value "thumbscroll_momentum_threshhold" double: 100.0000000000000000000000000;
|
||||
value "thumbscroll_friction" double: 1.0000000000000000000000000;
|
||||
value "hal_desktop" int: 0;
|
||||
value "border_keyboard.timeout" double: 5.0000000000000000000000000;
|
||||
value "border_keyboard.move.dx" uchar: 5;
|
||||
value "border_keyboard.move.dy" uchar: 5;
|
||||
value "border_keyboard.resize.dx" uchar: 5;
|
||||
value "border_keyboard.resize.dy" uchar: 5;
|
||||
value "scale.min" double: 1.0000000000000000000000000;
|
||||
value "scale.max" double: 3.0000000000000000000000000;
|
||||
value "scale.factor" double: 1.0000000000000000000000000;
|
||||
value "scale.base_dpi" int: 142;
|
||||
value "scale.use_dpi" uchar: 1;
|
||||
value "scale.use_custom" uchar: 0;
|
||||
value "show_cursor" uchar: 0;
|
||||
value "idle_cursor" uchar: 0;
|
||||
value "default_system_menu" string: "";
|
||||
}
|
After Width: | Height: | Size: 7.4 KiB |
|
@ -0,0 +1,6 @@
|
|||
group "Battery_Config" struct {
|
||||
value "poll_interval" int: 32;
|
||||
value "alert" int: 10;
|
||||
value "alert_p" int: 10;
|
||||
value "alert_timeout" int: 0;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
group "Dropshadow_Config" struct {
|
||||
value "shadow_x" int: 0;
|
||||
value "shadow_y" int: 0;
|
||||
value "blur_size" int: 10;
|
||||
value "quality" int: 4;
|
||||
value "shadow_darkness" double: 0.5000000000000000000000000;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
group "Illume_Cfg" struct {
|
||||
value "config_version" int: 3;
|
||||
value "launcher.mode" int: 1;
|
||||
value "launcher.icon_size" int: 120;
|
||||
value "launcher.single_click" int: 1;
|
||||
value "power.auto_suspend" int: 1;
|
||||
value "power.auto_suspend_delay" int: 1;
|
||||
value "performance.cache_level" int: 3;
|
||||
value "performance.fps" int: 30;
|
||||
value "slipshelf.main_gadget_size" int: 56;
|
||||
value "slipshelf.extra_gagdet_size" int: 48;
|
||||
value "slipshelf.style" int: 1;
|
||||
value "sliding.slipshelf.duration" int: 1000;
|
||||
value "sliding.kbd.duration" int: 1000;
|
||||
value "sliding.busywin.duration" int: 1000;
|
||||
value "sliding.layout.duration" int: 0;
|
||||
value "kbd.use_internal" int: 1;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
group "Mixer_Module_Config" struct {
|
||||
value "version" int: 3;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
group "Pager_Config" struct {
|
||||
value "popup" uint: 1;
|
||||
value "popup_speed" double: 1.0000000000000000000000000;
|
||||
value "popup_urgent" uint: 0;
|
||||
value "popup_urgent_stick" uint: 0;
|
||||
value "popup_urgent_speed" double: 1.5000000000000000000000000;
|
||||
value "show_desk_names" uint: 0;
|
||||
value "popup_height" int: 60;
|
||||
value "popup_act_height" int: 60;
|
||||
value "drag_resist" uint: 3;
|
||||
value "btn_drag" uchar: 1;
|
||||
value "btn_noplace" uchar: 2;
|
||||
value "btn_desk" uchar: 0;
|
||||
value "flip_desk" uchar: 0;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Illume
|
||||
Icon=icon.png
|
||||
Comment=Illume profile for<br>embedded systems like<br>phones and web<br>tablets with tiny<br>touchscreen displays.<br>Only use this if<br>you really have<br>such a device.
|
|
@ -458,5 +458,6 @@ config/standard/Makefile
|
|||
config/minimalist/Makefile
|
||||
config/scaleable/Makefile
|
||||
config/netbook/Makefile
|
||||
config/illume/Makefile
|
||||
po/Makefile.in
|
||||
])
|
||||
|
|
|
@ -10,15 +10,22 @@ EDJE_FLAGS = \
|
|||
|
||||
filesdir = $(datadir)/enlightenment/data/themes
|
||||
files_DATA = \
|
||||
default.edj
|
||||
default.edj \
|
||||
illume.edj
|
||||
|
||||
EXTRA_DIST = \
|
||||
default.edc
|
||||
default.edc \
|
||||
illume.edc
|
||||
|
||||
default.edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
$(top_srcdir)/data/themes/default.edc \
|
||||
$(top_builddir)/data/themes/default.edj
|
||||
|
||||
illume.edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
$(top_srcdir)/data/themes/illume.edc \
|
||||
$(top_builddir)/data/themes/illume.edj
|
||||
|
||||
clean-local:
|
||||
rm -f *.edj
|
||||
|
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 582 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 910 B |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 458 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 278 B |
After Width: | Height: | Size: 569 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 416 B |
|
@ -0,0 +1,7 @@
|
|||
module.la
|
||||
*.lo
|
||||
Makefile.in
|
||||
Makefile
|
||||
.libs
|
||||
.deps
|
||||
module.desktop
|
|
@ -0,0 +1,100 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = illume
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj module.desktop
|
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
||||
|
||||
# the module .so file
|
||||
INCLUDES = -I. \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h
|
||||
e_mod_layout.h \
|
||||
e_mod_layout.c \
|
||||
e_mod_win.h \
|
||||
e_mod_win.c \
|
||||
e_kbd.h \
|
||||
e_kbd.c \
|
||||
e_slipshelf.h \
|
||||
e_slipshelf.c \
|
||||
e_slipwin.h \
|
||||
e_slipwin.c \
|
||||
e_mod_gad_wifi.c \
|
||||
e_mod_gad_wifi.h \
|
||||
e_mod_gad_gsm.c \
|
||||
e_mod_gad_gsm.h \
|
||||
e_mod_gad_usb.c \
|
||||
e_mod_gad_usb.h \
|
||||
e_mod_gad_bluetooth.c \
|
||||
e_mod_gad_bluetooth.h \
|
||||
e_pwr.c \
|
||||
e_pwr.h \
|
||||
e_busywin.h \
|
||||
e_busywin.c \
|
||||
e_cfg.h \
|
||||
e_cfg.c \
|
||||
e_mod_gad_cfg.c \
|
||||
e_mod_gad_cfg.h \
|
||||
e_winilist.c \
|
||||
e_winilist.h \
|
||||
e_simplelock.c \
|
||||
e_simplelock.h \
|
||||
e_kbd_send.c \
|
||||
e_kbd_send.h \
|
||||
e_kbd_int.c \
|
||||
e_kbd_int.h \
|
||||
e_kbd_buf.c \
|
||||
e_kbd_buf.h \
|
||||
e_kbd_dict.c \
|
||||
e_kbd_dict.h \
|
||||
e_flaunch.c \
|
||||
e_flaunch.h \
|
||||
e_busycover.c \
|
||||
e_busycover.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
wifigetdir = $(pkgdir)
|
||||
|
||||
wifiget_PROGRAMS = wifiget
|
||||
wifiget_SOURCES = wifiget.c
|
||||
wifiget_LDFLAGS =
|
||||
|
||||
kbdsdir = $(datadir)/keyboards
|
||||
kbds_DATA = \
|
||||
keyboards/ignore_built_in_keyboards \
|
||||
keyboards/Default.kbd \
|
||||
keyboards/alpha.png \
|
||||
keyboards/Numbers.kbd \
|
||||
keyboards/numeric.png \
|
||||
keyboards/Terminal.kbd \
|
||||
keyboards/qwerty.png \
|
||||
keyboards/up.png \
|
||||
keyboards/down.png \
|
||||
keyboards/left.png \
|
||||
keyboards/right.png \
|
||||
keyboards/shift.png \
|
||||
keyboards/tab.png \
|
||||
keyboards/enter.png \
|
||||
keyboards/backspace.png
|
||||
|
||||
dictsdir = $(datadir)/dicts
|
||||
dicts_DATA = \
|
||||
dicts/English_(US).dic \
|
||||
dicts/English_(US)_Small.dic
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
|
@ -0,0 +1,174 @@
|
|||
#include <e.h>
|
||||
#include "e_busycover.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
// FIXME: make code work - place busycover in safe area
|
||||
// FIXME: make theme for it
|
||||
|
||||
/* internal calls */
|
||||
|
||||
E_Busycover *_e_busycover_new(E_Zone *zone, const char *themedir);
|
||||
static void _e_busycover_free(E_Busycover *esw);
|
||||
static int _e_busycover_cb_zone_move_resize(void *data, int type, void *event);
|
||||
static void _e_busycover_cb_item_sel(void *data, void *data2);
|
||||
|
||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
||||
|
||||
/* state */
|
||||
static Eina_List *busycovers = NULL;
|
||||
|
||||
static void
|
||||
_e_busycover_add_object(E_Busycover *esw)
|
||||
{
|
||||
int x, y, w, h;
|
||||
Evas_Object *o;
|
||||
|
||||
esw->base_obj = _theme_obj_new(esw->zone->container->bg_evas,
|
||||
esw->themedir,
|
||||
"e/modules/busycover/default");
|
||||
edje_object_part_text_set(esw->base_obj, "e.text.title", "LOADING");
|
||||
e_slipshelf_safe_app_region_get(esw->zone, &x, &y, &w, &h);
|
||||
evas_object_move(esw->base_obj, x, y);
|
||||
evas_object_resize(esw->base_obj, w, h);
|
||||
evas_object_layer_set(esw->base_obj, 100);
|
||||
}
|
||||
|
||||
/* called from the module core */
|
||||
EAPI int
|
||||
e_busycover_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_busycover_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI E_Busycover *
|
||||
e_busycover_new(E_Zone *zone, const char *themedir)
|
||||
{
|
||||
E_Busycover *esw;
|
||||
|
||||
esw = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_free);
|
||||
if (!esw) return NULL;
|
||||
|
||||
esw->zone = zone;
|
||||
if (themedir) esw->themedir = evas_stringshare_add(themedir);
|
||||
|
||||
busycovers = eina_list_append(busycovers, esw);
|
||||
|
||||
esw->handlers = eina_list_append
|
||||
(esw->handlers,
|
||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
||||
_e_busycover_cb_zone_move_resize, esw));
|
||||
|
||||
return esw;
|
||||
}
|
||||
|
||||
EAPI E_Busycover_Handle *
|
||||
e_busycover_push(E_Busycover *esw, const char *message, const char *icon)
|
||||
{
|
||||
E_Busycover_Handle *h;
|
||||
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYCOVER_TYPE, NULL);
|
||||
if (!esw->base_obj) _e_busycover_add_object(esw);
|
||||
h = calloc(1, sizeof(E_Busycover_Handle));
|
||||
h->busycover = esw;
|
||||
if (message) h->message = evas_stringshare_add(message);
|
||||
if (icon) h->icon = evas_stringshare_add(icon);
|
||||
esw->handles = eina_list_prepend(esw->handles, h);
|
||||
edje_object_part_text_set(esw->base_obj, "e.text.label", h->message);
|
||||
/* FIXME: handle icon... */
|
||||
evas_object_show(esw->base_obj);
|
||||
return h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle)
|
||||
{
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK(esw, E_BUSYCOVER_TYPE);
|
||||
if (!eina_list_data_find(esw->handles, handle)) return;
|
||||
esw->handles = eina_list_remove(esw->handles, handle);
|
||||
if (handle->message) evas_stringshare_del(handle->message);
|
||||
if (handle->icon) evas_stringshare_del(handle->icon);
|
||||
free(handle);
|
||||
if (esw->handles)
|
||||
{
|
||||
handle = esw->handles->data;
|
||||
edje_object_part_text_set(esw->base_obj, "e.text.label",
|
||||
handle->message);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_del(esw->base_obj);
|
||||
esw->base_obj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* internal calls */
|
||||
static void
|
||||
_e_busycover_free(E_Busycover *esw)
|
||||
{
|
||||
if (esw->base_obj) evas_object_del(esw->base_obj);
|
||||
busycovers = eina_list_remove(busycovers, esw);
|
||||
while (esw->handlers)
|
||||
{
|
||||
if (esw->handlers->data)
|
||||
ecore_event_handler_del(esw->handlers->data);
|
||||
esw->handlers = eina_list_remove_list(esw->handlers, esw->handlers);
|
||||
}
|
||||
if (esw->themedir) evas_stringshare_del(esw->themedir);
|
||||
free(esw);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_busycover_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
E_Busycover *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (esw->zone == ev->zone)
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
e_slipshelf_safe_app_region_get(esw->zone, &x, &y, &w, &h);
|
||||
evas_object_move(esw->base_obj, x, y);
|
||||
evas_object_resize(esw->base_obj, w, h);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef E_BUSYCOVER_H
|
||||
#define E_BUSYCOVER_H
|
||||
|
||||
typedef struct _E_Busycover E_Busycover;
|
||||
typedef struct _E_Busycover_Handle E_Busycover_Handle;
|
||||
typedef struct _E_Event_Busycover_Simple E_Event_Busycover_Del;
|
||||
|
||||
#define E_BUSYCOVER_TYPE 0xE1b0782
|
||||
|
||||
struct _E_Busycover
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Zone *zone;
|
||||
Evas_Object *base_obj;
|
||||
Eina_List *handlers;
|
||||
const char *themedir;
|
||||
Eina_List *handles;
|
||||
};
|
||||
|
||||
struct _E_Busycover_Handle
|
||||
{
|
||||
E_Busycover *busycover;
|
||||
const char *message;
|
||||
const char *icon;
|
||||
};
|
||||
|
||||
struct _E_Event_Busycover_Simple
|
||||
{
|
||||
E_Busycover *busycover;
|
||||
};
|
||||
|
||||
EAPI int e_busycover_init(void);
|
||||
EAPI int e_busycover_shutdown(void);
|
||||
EAPI E_Busycover *e_busycover_new(E_Zone *zone, const char *themedir);
|
||||
EAPI E_Busycover_Handle *e_busycover_push(E_Busycover *esw, const char *message, const char *icon);
|
||||
EAPI void e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,280 @@
|
|||
#include <e.h>
|
||||
#include "e_busywin.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
/* internal calls */
|
||||
|
||||
E_Busywin *_e_busywin_new(E_Zone *zone, const char *themedir);
|
||||
static void _e_busywin_free(E_Busywin *esw);
|
||||
static int _e_busywin_cb_animate(void *data);
|
||||
static void _e_busywin_slide(E_Busywin *esw, int out, double len);
|
||||
static int _e_busywin_cb_mouse_up(void *data, int type, void *event);
|
||||
static int _e_busywin_cb_zone_move_resize(void *data, int type, void *event);
|
||||
static void _e_busywin_cb_item_sel(void *data, void *data2);
|
||||
|
||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
||||
|
||||
/* state */
|
||||
static Eina_List *busywins = NULL;
|
||||
|
||||
/* called from the module core */
|
||||
EAPI int
|
||||
e_busywin_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_busywin_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI E_Busywin *
|
||||
e_busywin_new(E_Zone *zone, const char *themedir)
|
||||
{
|
||||
E_Busywin *esw;
|
||||
Evas_Coord mw, mh;
|
||||
int x, y;
|
||||
Evas_Object *o;
|
||||
|
||||
esw = E_OBJECT_ALLOC(E_Busywin, E_BUSYWIN_TYPE, _e_busywin_free);
|
||||
if (!esw) return NULL;
|
||||
|
||||
esw->zone = zone;
|
||||
if (themedir) esw->themedir = evas_stringshare_add(themedir);
|
||||
|
||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
||||
zone->x, zone->y, zone->w, zone->h);
|
||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
||||
ecore_x_window_configure(esw->clickwin,
|
||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
||||
0, 0, 0, 0, 0,
|
||||
esw->popup->evas_win,
|
||||
ECORE_X_WINDOW_STACK_BELOW);
|
||||
e_popup_layer_set(esw->popup, 250);
|
||||
|
||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
||||
esw->themedir,
|
||||
"e/modules/busywin/base/default");
|
||||
|
||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
||||
|
||||
x = zone->x;
|
||||
y = zone->y + zone->h;
|
||||
mw = zone->w;
|
||||
|
||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
||||
|
||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
||||
evas_object_show(esw->base_obj);
|
||||
|
||||
e_popup_show(esw->popup);
|
||||
|
||||
busywins = eina_list_append(busywins, esw);
|
||||
|
||||
esw->handlers = eina_list_append
|
||||
(esw->handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
|
||||
_e_busywin_cb_mouse_up, esw));
|
||||
esw->handlers = eina_list_append
|
||||
(esw->handlers,
|
||||
ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
|
||||
_e_busywin_cb_zone_move_resize, esw));
|
||||
|
||||
return esw;
|
||||
}
|
||||
|
||||
EAPI E_Busywin_Handle *
|
||||
e_busywin_push(E_Busywin *esw, const char *message, const char *icon)
|
||||
{
|
||||
E_Busywin_Handle *h;
|
||||
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYWIN_TYPE, NULL);
|
||||
h = calloc(1, sizeof(E_Busywin_Handle));
|
||||
h->busywin = esw;
|
||||
if (message) h->message = evas_stringshare_add(message);
|
||||
if (icon) h->icon = evas_stringshare_add(icon);
|
||||
esw->handles = eina_list_prepend(esw->handles, h);
|
||||
edje_object_part_text_set(esw->base_obj, "e.text.label", h->message);
|
||||
/* FIXME: handle icon... */
|
||||
_e_busywin_slide(esw, 1, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
||||
return h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_busywin_pop(E_Busywin *esw, E_Busywin_Handle *handle)
|
||||
{
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK(esw, E_BUSYWIN_TYPE);
|
||||
if (!eina_list_data_find(esw->handles, handle)) return;
|
||||
esw->handles = eina_list_remove(esw->handles, handle);
|
||||
if (handle->message) evas_stringshare_del(handle->message);
|
||||
if (handle->icon) evas_stringshare_del(handle->icon);
|
||||
free(handle);
|
||||
if (esw->handles)
|
||||
{
|
||||
handle = esw->handles->data;
|
||||
edje_object_part_text_set(esw->base_obj, "e.text.label",
|
||||
handle->message);
|
||||
}
|
||||
else
|
||||
{
|
||||
_e_busywin_slide(esw, 0, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* internal calls */
|
||||
static void
|
||||
_e_busywin_free(E_Busywin *esw)
|
||||
{
|
||||
busywins = eina_list_remove(busywins, esw);
|
||||
while (esw->handlers)
|
||||
{
|
||||
if (esw->handlers->data)
|
||||
ecore_event_handler_del(esw->handlers->data);
|
||||
esw->handlers = eina_list_remove_list(esw->handlers, esw->handlers);
|
||||
}
|
||||
if (esw->animator) ecore_animator_del(esw->animator);
|
||||
if (esw->themedir) evas_stringshare_del(esw->themedir);
|
||||
ecore_x_window_del(esw->clickwin);
|
||||
e_object_del(E_OBJECT(esw->popup));
|
||||
free(esw);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_busywin_cb_animate(void *data)
|
||||
{
|
||||
E_Busywin *esw;
|
||||
double t, v;
|
||||
|
||||
esw = data;
|
||||
t = ecore_time_get() - esw->start;
|
||||
if (t > esw->len) t = esw->len;
|
||||
if (esw->len > 0.0)
|
||||
{
|
||||
v = t / esw->len;
|
||||
v = 1.0 - v;
|
||||
v = v * v * v * v;
|
||||
v = 1.0 - v;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = esw->len;
|
||||
v = 1.0;
|
||||
}
|
||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
||||
e_popup_move(esw->popup,
|
||||
esw->zone->x,
|
||||
esw->zone->y + esw->zone->h - esw->adjust);
|
||||
if (t == esw->len)
|
||||
{
|
||||
esw->animator = NULL;
|
||||
if (esw->out)
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
||||
else
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_busywin_slide(E_Busywin *esw, int out, double len)
|
||||
{
|
||||
if (out == esw->out) return;
|
||||
esw->start = ecore_time_get();
|
||||
esw->len = len;
|
||||
esw->out = out;
|
||||
esw->adjust_start = esw->adjust;
|
||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
||||
else esw->adjust_target = 0;
|
||||
if (esw->out)
|
||||
{
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
||||
ecore_x_window_configure(esw->clickwin,
|
||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
||||
0, 0, 0, 0, 0,
|
||||
esw->popup->evas_win,
|
||||
ECORE_X_WINDOW_STACK_BELOW);
|
||||
// ecore_x_window_show(esw->clickwin);
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
||||
// ecore_x_window_hide(esw->clickwin);
|
||||
}
|
||||
if (len <= 0.0)
|
||||
{
|
||||
_e_busywin_cb_animate(esw);
|
||||
return;
|
||||
}
|
||||
if (!esw->animator)
|
||||
esw->animator = ecore_animator_add(_e_busywin_cb_animate, esw);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_busywin_cb_mouse_up(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Mouse_Button_Up *ev;
|
||||
E_Busywin *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (ev->win == esw->clickwin)
|
||||
{
|
||||
if (esw->out) _e_busywin_slide(esw, 0, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
||||
else _e_busywin_slide(esw, 1, (double)illume_cfg->sliding.busywin.duration / 1000.0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_busywin_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
E_Busywin *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (esw->zone == ev->zone)
|
||||
{
|
||||
e_popup_move_resize(esw->popup,
|
||||
esw->zone->x,
|
||||
esw->zone->y + esw->zone->h - esw->adjust,
|
||||
esw->zone->w, esw->popup->h);
|
||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef E_BUSYWIN_H
|
||||
#define E_BUSYWIN_H
|
||||
|
||||
typedef struct _E_Busywin E_Busywin;
|
||||
typedef struct _E_Busywin_Handle E_Busywin_Handle;
|
||||
typedef struct _E_Event_Busywin_Simple E_Event_Busywin_Del;
|
||||
|
||||
#define E_BUSYWIN_TYPE 0xE1b0976
|
||||
|
||||
struct _E_Busywin
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Zone *zone;
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj;
|
||||
Eina_List *handlers;
|
||||
const char *themedir;
|
||||
Ecore_Animator *animator;
|
||||
Eina_List *handles;
|
||||
Ecore_X_Window clickwin;
|
||||
int adjust_start;
|
||||
int adjust_target;
|
||||
int adjust;
|
||||
double start;
|
||||
double len;
|
||||
unsigned char out : 1;
|
||||
};
|
||||
|
||||
struct _E_Busywin_Handle
|
||||
{
|
||||
E_Busywin *busywin;
|
||||
const char *message;
|
||||
const char *icon;
|
||||
};
|
||||
|
||||
struct _E_Event_Busywin_Simple
|
||||
{
|
||||
E_Busywin *busywin;
|
||||
};
|
||||
|
||||
EAPI int e_busywin_init(void);
|
||||
EAPI int e_busywin_shutdown(void);
|
||||
EAPI E_Busywin *e_busywin_new(E_Zone *zone, const char *themedir);
|
||||
EAPI E_Busywin_Handle *e_busywin_push(E_Busywin *esw, const char *message, const char *icon);
|
||||
EAPI void e_busywin_pop(E_Busywin *esw, E_Busywin_Handle *handle);
|
||||
|
||||
extern EAPI int E_EVENT_BUSYWIN_DEL;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,72 @@
|
|||
#ifndef E_CFG_H
|
||||
#define E_CFG_H
|
||||
|
||||
#define ILLUME_CONFIG_MIN 3
|
||||
#define ILLUME_CONFIG_MAJ 0
|
||||
|
||||
typedef struct _Illume_Cfg Illume_Cfg;
|
||||
|
||||
struct _Illume_Cfg
|
||||
{
|
||||
int config_version;
|
||||
|
||||
struct {
|
||||
int mode;
|
||||
int icon_size;
|
||||
int single_click;
|
||||
} launcher;
|
||||
|
||||
struct {
|
||||
int auto_suspend;
|
||||
int auto_suspend_delay;
|
||||
} power;
|
||||
|
||||
struct {
|
||||
int cache_level; // DOME?
|
||||
int fps;
|
||||
} performance;
|
||||
|
||||
struct {
|
||||
int main_gadget_size;
|
||||
int extra_gagdet_size;
|
||||
int style;
|
||||
} slipshelf;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
int duration;
|
||||
} slipshelf, kbd, busywin, layout;
|
||||
} sliding;
|
||||
|
||||
// FIXME: save/load these up minor version for this and init...
|
||||
struct {
|
||||
int use_internal;
|
||||
const char *run_keyboard;
|
||||
const char *dict;
|
||||
double fuzz_mul; // NEW
|
||||
int ignore_auto_kbd; // NEW
|
||||
int ignore_auto_type; // NEW
|
||||
int ignore_auto_lang; // NEW
|
||||
int ignore_hardware_keyboards; // NEW
|
||||
int force_no_dict; // NEW
|
||||
const char *layout; // NEW
|
||||
} kbd;
|
||||
};
|
||||
|
||||
EAPI int e_cfg_init(E_Module *m);
|
||||
EAPI int e_cfg_shutdown(void);
|
||||
|
||||
EAPI int e_cfg_save(void);
|
||||
|
||||
EAPI void e_cfg_launcher(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_power(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_animation(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_slipshelf(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_thumbscroll(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_fps(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_gadgets(E_Container *con, const char *params);
|
||||
EAPI void e_cfg_keyboard(E_Container *con, const char *params);
|
||||
|
||||
extern EAPI Illume_Cfg *illume_cfg;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,310 @@
|
|||
#include <e.h>
|
||||
#include "e_flaunch.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
||||
|
||||
static void
|
||||
_e_flaunch_cb_button_select(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
E_Flaunch_App *fla;
|
||||
|
||||
fla = data;
|
||||
if (fla->callback.func) fla->callback.func((void *)fla->callback.data);
|
||||
}
|
||||
|
||||
static E_Flaunch_App *
|
||||
_e_fluanch_button_add(E_Flaunch *fl, const char *label, int expander, void (*func) (void *data), const void *data)
|
||||
{
|
||||
E_Flaunch_App *fla;
|
||||
Evas_Object *o;
|
||||
|
||||
fla = E_NEW(E_Flaunch_App, 1);
|
||||
if (!fla) return NULL;
|
||||
if (expander)
|
||||
o = _theme_obj_new(fl->zone->container->bg_evas,
|
||||
fl->themedir,
|
||||
"e/modules/flaunch/button/default");
|
||||
else
|
||||
o = _theme_obj_new(fl->zone->container->bg_evas,
|
||||
fl->themedir,
|
||||
"e/modules/flaunch/button/start");
|
||||
edje_object_part_text_set(o, "e.text.label", label);
|
||||
fla->flaunch = fl;
|
||||
fla->obj = o;
|
||||
fla->callback.func = func;
|
||||
if (!data) data = fla;
|
||||
fla->callback.data = data;
|
||||
edje_object_signal_callback_add(o, "e,action,do,select", "",
|
||||
_e_flaunch_cb_button_select, fla);
|
||||
return fla;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_flaunch_button_del(E_Flaunch_App *fla)
|
||||
{
|
||||
evas_object_del(fla->obj);
|
||||
if (fla->desktop) evas_stringshare_del(fla->desktop);
|
||||
free(fla);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fluanch_cb_app_button(void *data)
|
||||
{
|
||||
E_Flaunch_App *fla;
|
||||
Efreet_Desktop *desktop;
|
||||
|
||||
fla = data;
|
||||
if (!fla->desktop) return;
|
||||
desktop = efreet_util_desktop_file_id_find(fla->desktop);
|
||||
if (!desktop) return;
|
||||
if (fla->flaunch->desktop_run_func) fla->flaunch->desktop_run_func(desktop);
|
||||
}
|
||||
|
||||
static E_Flaunch_App *
|
||||
_e_flaunch_app_add(E_Flaunch *fl, const char *deskfile)
|
||||
{
|
||||
E_Flaunch_App *fla;
|
||||
Efreet_Desktop *desktop;
|
||||
const char *label = "";
|
||||
|
||||
desktop = efreet_util_desktop_file_id_find(deskfile);
|
||||
if (desktop) label = desktop->name;
|
||||
fla = _e_fluanch_button_add(fl, label, 1, _e_fluanch_cb_app_button, NULL);
|
||||
if (deskfile) fla->desktop = evas_stringshare_add(deskfile);
|
||||
fl->apps = eina_list_append(fl->apps, fla);
|
||||
e_box_pack_end(fl->app_box_obj, fla->obj);
|
||||
e_box_pack_options_set(fla->obj, 1, 1, 1, 1, 0.5, 0.5, 0, 0, 9999, 9999);
|
||||
evas_object_show(fla->obj);
|
||||
return fla;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_flaunch_apps_clear(E_Flaunch *fl)
|
||||
{
|
||||
while (fl->apps)
|
||||
{
|
||||
_e_flaunch_button_del(fl->apps->data);
|
||||
fl->apps = eina_list_remove_list(fl->apps, fl->apps);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_flaunch_apps_populate(E_Flaunch *fl)
|
||||
{
|
||||
E_Flaunch_App *fla;
|
||||
Ecore_List *bar_desktops;
|
||||
int num = 0, max, count;
|
||||
|
||||
// FIXME: 3 should become config here
|
||||
max = 3;
|
||||
// for now just look for any apps in "category" 'Bar' and add the first 3
|
||||
// FIXME: category should be configurable...
|
||||
bar_desktops = efreet_util_desktop_category_list("Bar");
|
||||
if (bar_desktops)
|
||||
{
|
||||
Efreet_Desktop *desktop;
|
||||
|
||||
count = ecore_list_count(bar_desktops);
|
||||
if (count < max)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (max - count) / 2; i++)
|
||||
{
|
||||
_e_flaunch_app_add(fl, "");
|
||||
num++;
|
||||
}
|
||||
}
|
||||
ecore_list_first_goto(bar_desktops);
|
||||
while ((desktop = ecore_list_next(bar_desktops)))
|
||||
{
|
||||
if (desktop->orig_path)
|
||||
{
|
||||
const char *dname;
|
||||
|
||||
dname = ecore_file_file_get(desktop->orig_path);
|
||||
if (dname)
|
||||
{
|
||||
_e_flaunch_app_add(fl, dname);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (num >= max) break;
|
||||
}
|
||||
}
|
||||
while (num < max)
|
||||
{
|
||||
_e_flaunch_app_add(fl, "");
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fluanch_cb_home_button(void *data)
|
||||
{
|
||||
printf("FIXME: this 'start' button has no defined behavior\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_e_flaunch_free(E_Flaunch *fl)
|
||||
{
|
||||
if (fl->repopulate_timer) ecore_timer_del(fl->repopulate_timer);
|
||||
_e_flaunch_apps_clear(fl);
|
||||
_e_flaunch_button_del(fl->start_button);
|
||||
evas_stringshare_del(fl->themedir);
|
||||
evas_object_del(fl->app_box_obj);
|
||||
evas_object_del(fl->box_obj);
|
||||
while (fl->handlers)
|
||||
{
|
||||
ecore_event_handler_del(fl->handlers->data);
|
||||
fl->handlers = eina_list_remove_list(fl->handlers, fl->handlers);
|
||||
}
|
||||
free(fl);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_flaunch_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
E_Flaunch *fl;
|
||||
|
||||
ev = event;
|
||||
fl = data;
|
||||
if (fl->zone == ev->zone)
|
||||
{
|
||||
evas_object_move(fl->box_obj, fl->zone->x, fl->zone->y + fl->zone->h - fl->height);
|
||||
evas_object_resize(fl->box_obj, fl->zone->w, fl->height);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_flaunch_cb_delayed_repopulate(void *data)
|
||||
{
|
||||
E_Flaunch *fl;
|
||||
|
||||
fl = data;
|
||||
_e_flaunch_apps_clear(fl);
|
||||
_e_flaunch_apps_populate(fl);
|
||||
fl->repopulate_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_flaunch_cb_desktop_list_change(void *data, int type, void *event)
|
||||
{
|
||||
E_Flaunch *fl;
|
||||
|
||||
fl = data;
|
||||
if (fl->repopulate_timer) ecore_timer_del(fl->repopulate_timer);
|
||||
fl->repopulate_timer = ecore_timer_add(0.5, _e_flaunch_cb_delayed_repopulate, fl);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_flaunch_cb_desktop_change(void *data, int type, void *event)
|
||||
{
|
||||
E_Flaunch *fl;
|
||||
|
||||
fl = data;
|
||||
if (fl->repopulate_timer) ecore_timer_del(fl->repopulate_timer);
|
||||
fl->repopulate_timer = ecore_timer_add(0.5, _e_flaunch_cb_delayed_repopulate, fl);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_flaunch_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_flaunch_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI E_Flaunch *
|
||||
e_flaunch_new(E_Zone *zone, const char *themedir)
|
||||
{
|
||||
E_Flaunch *fl;
|
||||
Evas_Object *o;
|
||||
|
||||
fl = E_OBJECT_ALLOC(E_Flaunch, E_FLAUNCH_TYPE, _e_flaunch_free);
|
||||
if (!fl) return NULL;
|
||||
fl->zone = zone;
|
||||
|
||||
fl->themedir = evas_stringshare_add(themedir);
|
||||
|
||||
// FIXME: height should become config
|
||||
fl->height = 30 * e_scale;
|
||||
|
||||
o = e_box_add(fl->zone->container->bg_evas);
|
||||
e_box_orientation_set(o, 1);
|
||||
e_box_homogenous_set(o, 0);
|
||||
fl->box_obj = o;
|
||||
|
||||
fl->start_button = _e_fluanch_button_add(fl, "*", 0,
|
||||
_e_fluanch_cb_home_button, fl);
|
||||
e_box_pack_end(fl->box_obj, fl->start_button->obj);
|
||||
e_box_pack_options_set(fl->start_button->obj, 1, 1, 0, 1, 0.5, 0.5, fl->height, 0, fl->height, 9999);
|
||||
evas_object_show(fl->start_button->obj);
|
||||
|
||||
o = e_box_add(fl->zone->container->bg_evas);
|
||||
e_box_orientation_set(o, 1);
|
||||
e_box_homogenous_set(o, 1);
|
||||
fl->app_box_obj = o;
|
||||
|
||||
e_box_pack_end(fl->box_obj, fl->app_box_obj);
|
||||
e_box_pack_options_set(fl->app_box_obj, 1, 1, 1, 1, 0.5, 0.5, 0, 0, 9999, 9999);
|
||||
|
||||
_e_flaunch_apps_populate(fl);
|
||||
|
||||
evas_object_move(fl->box_obj, fl->zone->x, fl->zone->y + fl->zone->h - fl->height);
|
||||
evas_object_resize(fl->box_obj, fl->zone->w, fl->height);
|
||||
evas_object_show(fl->app_box_obj);
|
||||
evas_object_layer_set(fl->box_obj, 10);
|
||||
evas_object_show(fl->box_obj);
|
||||
|
||||
fl->handlers = eina_list_append
|
||||
(fl->handlers, ecore_event_handler_add
|
||||
(E_EVENT_ZONE_MOVE_RESIZE, _e_flaunch_cb_zone_move_resize, fl));
|
||||
fl->handlers = eina_list_append
|
||||
(fl->handlers, ecore_event_handler_add
|
||||
(EFREET_EVENT_DESKTOP_LIST_CHANGE, _e_flaunch_cb_desktop_list_change, fl));
|
||||
fl->handlers = eina_list_append
|
||||
(fl->handlers, ecore_event_handler_add
|
||||
(EFREET_EVENT_DESKTOP_CHANGE, _e_flaunch_cb_desktop_change, fl));
|
||||
|
||||
return fl;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_flaunch_desktop_exec_callabck_set(E_Flaunch *fl, void (*func) (Efreet_Desktop *desktop))
|
||||
{
|
||||
fl->desktop_run_func = func;
|
||||
}
|
||||
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef E_FLAUNCH_H
|
||||
#define E_FLAUNCH_H
|
||||
|
||||
typedef struct _E_Flaunch E_Flaunch;
|
||||
typedef struct _E_Flaunch_App E_Flaunch_App;
|
||||
|
||||
#define E_FLAUNCH_TYPE 0xE1b7274
|
||||
|
||||
struct _E_Flaunch
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
int height;
|
||||
const char *themedir;
|
||||
Evas_Object *box_obj, *app_box_obj;
|
||||
Eina_List *apps;
|
||||
E_Flaunch_App *start_button;
|
||||
E_Zone *zone;
|
||||
void (*desktop_run_func) (Efreet_Desktop *desktop);
|
||||
Ecore_Event_Handler *zone_resize_handler;
|
||||
Eina_List *handlers;
|
||||
Ecore_Timer *repopulate_timer;
|
||||
};
|
||||
|
||||
struct _E_Flaunch_App
|
||||
{
|
||||
E_Flaunch *flaunch;
|
||||
Evas_Object *obj;
|
||||
struct {
|
||||
void (*func) (void *data);
|
||||
const void *data;
|
||||
} callback;
|
||||
const char *desktop;
|
||||
};
|
||||
|
||||
EAPI int e_flaunch_init(void);
|
||||
EAPI int e_flaunch_shutdown(void);
|
||||
EAPI E_Flaunch *e_flaunch_new(E_Zone *zone, const char *themedir);
|
||||
EAPI void e_flaunch_desktop_exec_cb_set(E_Flaunch *fl, void (*func) (Efreet_Desktop *desktop));
|
||||
|
||||
#endif
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef E_KBD_H
|
||||
#define E_KBD_H
|
||||
|
||||
typedef struct _E_Kbd E_Kbd;
|
||||
|
||||
#define E_KBD_TYPE 0xE1b0988
|
||||
|
||||
typedef enum _E_Kbd_Layout
|
||||
{
|
||||
E_KBD_LAYOUT_NONE,
|
||||
E_KBD_LAYOUT_DEFAULT,
|
||||
E_KBD_LAYOUT_ALPHA,
|
||||
E_KBD_LAYOUT_NUMERIC,
|
||||
E_KBD_LAYOUT_PIN,
|
||||
E_KBD_LAYOUT_PHONE_NUMBER,
|
||||
E_KBD_LAYOUT_HEX,
|
||||
E_KBD_LAYOUT_TERMINAL,
|
||||
E_KBD_LAYOUT_PASSWORD
|
||||
} E_Kbd_Layout;
|
||||
|
||||
struct _E_Kbd
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Win *win;
|
||||
E_Border *border;
|
||||
Ecore_Timer *delay_hide;
|
||||
Ecore_Animator *animator;
|
||||
Eina_List *waiting_borders;
|
||||
E_Kbd_Layout layout;
|
||||
double start, len;
|
||||
|
||||
int h;
|
||||
int adjust_start, adjust, adjust_end;
|
||||
|
||||
unsigned char visible : 1;
|
||||
unsigned char actually_visible : 1;
|
||||
unsigned char disabled : 1; // if we have a real kbd plugged in
|
||||
unsigned char fullscreen : 1;
|
||||
};
|
||||
|
||||
EAPI int e_kbd_init(E_Module *m);
|
||||
EAPI int e_kbd_shutdown(void);
|
||||
|
||||
EAPI E_Kbd *e_kbd_new(E_Zone *zone, const char *themedir, const char *syskbds, const char *sysdicts);
|
||||
EAPI void e_kbd_enable(E_Kbd *kbd);
|
||||
EAPI void e_kbd_disable(E_Kbd *kbd);
|
||||
EAPI void e_kbd_show(E_Kbd *kbd);
|
||||
EAPI void e_kbd_layout_set(E_Kbd *kbd, E_Kbd_Layout layout);
|
||||
EAPI void e_kbd_hide(E_Kbd *kbd);
|
||||
EAPI void e_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_kbd_fullscreen_set(E_Zone *zone, int fullscreen);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,580 @@
|
|||
#include <e.h>
|
||||
#include "e_kbd_buf.h"
|
||||
#include "e_kbd_dict.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static E_Kbd_Buf_Layout *
|
||||
_e_kbd_buf_new(void)
|
||||
{
|
||||
E_Kbd_Buf_Layout *kbl;
|
||||
|
||||
kbl = E_NEW(E_Kbd_Buf_Layout, 1);
|
||||
kbl->ref =1;
|
||||
return kbl;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_layout_ref(E_Kbd_Buf_Layout *kbl)
|
||||
{
|
||||
kbl->ref++;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_layout_unref(E_Kbd_Buf_Layout *kbl)
|
||||
{
|
||||
kbl->ref--;
|
||||
if (kbl->ref > 0) return;
|
||||
while (kbl->keys)
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
|
||||
ky = kbl->keys->data;
|
||||
if (ky->key) evas_stringshare_del(ky->key);
|
||||
if (ky->key_shift) evas_stringshare_del(ky->key_shift);
|
||||
if (ky->key_capslock) evas_stringshare_del(ky->key_capslock);
|
||||
free(ky);
|
||||
kbl->keys = eina_list_remove_list(kbl->keys, kbl->keys);
|
||||
}
|
||||
free(kbl);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_string_matches_clear(E_Kbd_Buf *kb)
|
||||
{
|
||||
while (kb->string_matches)
|
||||
{
|
||||
if (kb->string_matches->data)
|
||||
evas_stringshare_del(kb->string_matches->data);
|
||||
kb->string_matches = eina_list_remove_list(kb->string_matches, kb->string_matches);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_actual_string_clear(E_Kbd_Buf *kb)
|
||||
{
|
||||
if (kb->actual_string) evas_stringshare_del(kb->actual_string);
|
||||
kb->actual_string = NULL;
|
||||
}
|
||||
|
||||
static E_Kbd_Buf_Key *
|
||||
_e_kbd_buf_at_coord_get(E_Kbd_Buf *kb, E_Kbd_Buf_Layout *kbl, int x, int y)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = kbl->keys; l; l = l->next)
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
|
||||
ky = l->data;
|
||||
if (ky->key)
|
||||
{
|
||||
if ((x >= ky->x) && (y >= ky->y) &&
|
||||
(x < (ky->x + ky->w)) && (y < (ky->y + ky->h)))
|
||||
return ky;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static E_Kbd_Buf_Key *
|
||||
_e_kbd_buf_closest_get(E_Kbd_Buf *kb, E_Kbd_Buf_Layout *kbl, int x, int y)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Kbd_Buf_Key *ky_closest = NULL;
|
||||
int dist_closest = 0x7fffffff;
|
||||
|
||||
for (l = kbl->keys; l; l = l->next)
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
int dist, dx, dy;
|
||||
|
||||
ky = l->data;
|
||||
if (ky->key)
|
||||
{
|
||||
dx = x - (ky->x + (ky->w / 2));
|
||||
dy = y - (ky->y + (ky->h / 2));
|
||||
dist = (dx * dx) + (dy * dy);
|
||||
if (dist < dist_closest)
|
||||
{
|
||||
ky_closest = ky;
|
||||
dist_closest = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ky_closest;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_buf_keystroke_key_string_get(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks, E_Kbd_Buf_Key *ky)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
if ((ky) && (ky->key))
|
||||
{
|
||||
if (ks->shift)
|
||||
{
|
||||
if (ky->key_shift) str = ky->key_shift;
|
||||
else str = ky->key;
|
||||
}
|
||||
else if (ks->capslock)
|
||||
{
|
||||
if (ky->key_capslock) str = ky->key_capslock;
|
||||
else str = ky->key;
|
||||
}
|
||||
else str = ky->key;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_buf_keystroke_string_get(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
if (ks->key) str = ks->key;
|
||||
else
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
|
||||
ky = _e_kbd_buf_at_coord_get(kb, ks->layout, ks->x, ks->y);
|
||||
if (!ky) ky = _e_kbd_buf_closest_get(kb, ks->layout, ks->x, ks->y);
|
||||
str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_actual_string_update(E_Kbd_Buf *kb)
|
||||
{
|
||||
Eina_List *l;
|
||||
char *actual = NULL;
|
||||
int actual_len = 0;
|
||||
int actual_size = 0;
|
||||
|
||||
_e_kbd_buf_actual_string_clear(kb);
|
||||
for (l = kb->keystrokes; l; l = l->next)
|
||||
{
|
||||
E_Kbd_Buf_Keystroke *ks;
|
||||
const char *str;
|
||||
|
||||
ks = l->data;
|
||||
str = _e_kbd_buf_keystroke_string_get(kb, ks);
|
||||
if (str)
|
||||
{
|
||||
if ((actual_len + strlen(str) + 1) > actual_size)
|
||||
{
|
||||
actual_size += 64;
|
||||
actual = realloc(actual, actual_size);
|
||||
}
|
||||
strcpy(actual + actual_len, str);
|
||||
actual_len += strlen(str);
|
||||
}
|
||||
}
|
||||
if (actual)
|
||||
{
|
||||
kb->actual_string = evas_stringshare_add(actual);
|
||||
if (actual) free(actual);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_buf_matches_find(Eina_List *matches, const char *s)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = matches; l; l = l->next)
|
||||
{
|
||||
if (!strcmp(l->data, s)) return s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_matches_update(E_Kbd_Buf *kb)
|
||||
{
|
||||
Eina_List *matches = NULL;
|
||||
const char *word;
|
||||
int pri, i;
|
||||
E_Kbd_Dict *dicts[3];
|
||||
|
||||
_e_kbd_buf_string_matches_clear(kb);
|
||||
dicts[0] = kb->dict.personal;
|
||||
dicts[1] = kb->dict.sys;
|
||||
dicts[2] = kb->dict.data;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (!dicts[i]) continue;
|
||||
e_kbd_dict_matches_lookup(dicts[i]);
|
||||
e_kbd_dict_matches_first(dicts[i]);
|
||||
for (;;)
|
||||
{
|
||||
word = e_kbd_dict_matches_match_get(dicts[i], &pri);
|
||||
if (!word) break;
|
||||
if (!_e_kbd_buf_matches_find(kb->string_matches, word))
|
||||
kb->string_matches = eina_list_append(kb->string_matches,
|
||||
evas_stringshare_add(word));
|
||||
e_kbd_dict_matches_next(dicts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_buf_cb_data_dict_reload(void *data)
|
||||
{
|
||||
E_Kbd_Buf *kb;
|
||||
char buf[PATH_MAX];
|
||||
const char *homedir;
|
||||
|
||||
kb = data;
|
||||
kb->dict.data_reload_delay = NULL;
|
||||
e_kbd_buf_clear(kb);
|
||||
if (kb->dict.data) e_kbd_dict_free(kb->dict.data);
|
||||
homedir = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts-dynamic/data.dic", homedir);
|
||||
kb->dict.data = e_kbd_dict_new(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_cb_data_dict_change(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path)
|
||||
{
|
||||
E_Kbd_Buf *kb;
|
||||
|
||||
kb = data;
|
||||
if (kb->dict.data_reload_delay) ecore_timer_del(kb->dict.data_reload_delay);
|
||||
kb->dict.data_reload_delay = ecore_timer_add(2.0, _e_kbd_buf_cb_data_dict_reload, kb);
|
||||
}
|
||||
|
||||
EAPI E_Kbd_Buf *
|
||||
e_kbd_buf_new(const char *sysdicts, const char *dict)
|
||||
{
|
||||
E_Kbd_Buf *kb;
|
||||
char buf[PATH_MAX];
|
||||
const char *homedir;
|
||||
|
||||
kb = E_NEW(E_Kbd_Buf, 1);
|
||||
if (!kb) return NULL;
|
||||
kb->sysdicts = evas_stringshare_add(sysdicts);
|
||||
|
||||
homedir = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts", homedir);
|
||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts/%s", homedir, dict);
|
||||
kb->dict.sys = e_kbd_dict_new(buf);
|
||||
if (!kb->dict.sys)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict);
|
||||
kb->dict.sys = e_kbd_dict_new(buf);
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts-dynamic", homedir);
|
||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts-dynamic/personal.dic", homedir);
|
||||
kb->dict.personal = e_kbd_dict_new(buf);
|
||||
if (!kb->dict.personal)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
f = fopen(buf, "w");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "\n");
|
||||
fclose(f);
|
||||
}
|
||||
kb->dict.personal = e_kbd_dict_new(buf);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts-dynamic/data.dic", homedir);
|
||||
kb->dict.data = e_kbd_dict_new(buf);
|
||||
kb->dict.data_monitor =
|
||||
ecore_file_monitor_add(buf, _e_kbd_buf_cb_data_dict_change, kb);
|
||||
return kb;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_free(E_Kbd_Buf *kb)
|
||||
{
|
||||
e_kbd_buf_clear(kb);
|
||||
e_kbd_buf_layout_clear(kb);
|
||||
e_kbd_buf_lookup_cancel(kb);
|
||||
evas_stringshare_del(kb->sysdicts);
|
||||
if (kb->dict.sys) e_kbd_dict_free(kb->dict.sys);
|
||||
if (kb->dict.personal) e_kbd_dict_free(kb->dict.personal);
|
||||
if (kb->dict.data) e_kbd_dict_free(kb->dict.data);
|
||||
if (kb->dict.data_monitor) ecore_file_monitor_del(kb->dict.data_monitor);
|
||||
if (kb->dict.data_reload_delay) ecore_timer_del(kb->dict.data_reload_delay);
|
||||
free(kb);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_dict_set(E_Kbd_Buf *kb, const char *dict)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
const char *homedir;
|
||||
|
||||
e_kbd_buf_clear(kb);
|
||||
|
||||
if (kb->dict.sys) e_kbd_dict_free(kb->dict.sys);
|
||||
|
||||
homedir = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts", homedir);
|
||||
if (!ecore_file_exists(buf)) ecore_file_mkpath(buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/dicts/%s", homedir, dict);
|
||||
kb->dict.sys = e_kbd_dict_new(buf);
|
||||
if (!kb->dict.sys)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict);
|
||||
kb->dict.sys = e_kbd_dict_new(buf);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_clear(E_Kbd_Buf *kb)
|
||||
{
|
||||
e_kbd_buf_lookup_cancel(kb);
|
||||
while (kb->keystrokes)
|
||||
{
|
||||
E_Kbd_Buf_Keystroke *ks;
|
||||
|
||||
ks = kb->keystrokes->data;
|
||||
if (ks->key) evas_stringshare_del(ks->key);
|
||||
_e_kbd_buf_layout_unref(ks->layout);
|
||||
free(ks);
|
||||
kb->keystrokes = eina_list_remove_list(kb->keystrokes, kb->keystrokes);
|
||||
}
|
||||
_e_kbd_buf_string_matches_clear(kb);
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_clear(kb->dict.sys);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_clear(kb->dict.personal);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_clear(kb->dict.data);
|
||||
_e_kbd_buf_actual_string_clear(kb);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_layout_clear(E_Kbd_Buf *kb)
|
||||
{
|
||||
if (kb->layout)
|
||||
{
|
||||
_e_kbd_buf_layout_unref(kb->layout);
|
||||
kb->layout = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_layout_size_set(E_Kbd_Buf *kb, int w, int h)
|
||||
{
|
||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
||||
if (!kb->layout) return;
|
||||
kb->layout->w = w;
|
||||
kb->layout->h = h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_layout_fuzz_set(E_Kbd_Buf *kb, int fuzz)
|
||||
{
|
||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
||||
if (!kb->layout) return;
|
||||
kb->layout->fuzz = fuzz;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_layout_key_add(E_Kbd_Buf *kb, const char *key, const char *key_shift, const char *key_capslock, int x, int y, int w, int h)
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
|
||||
if (!key) return;
|
||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
||||
if (!kb->layout) return;
|
||||
ky = E_NEW(E_Kbd_Buf_Key, 1);
|
||||
if (!ky) return;
|
||||
if (key) ky->key = evas_stringshare_add(key);
|
||||
if (key_shift) ky->key_shift = evas_stringshare_add(key_shift);
|
||||
if (key_capslock) ky->key_capslock = evas_stringshare_add(key_capslock);
|
||||
ky->x = x;
|
||||
ky->y = y;
|
||||
ky->w = w;
|
||||
ky->h = h;
|
||||
kb->layout->keys = eina_list_append(kb->layout->keys, ky);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_keystroke_add(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
str = _e_kbd_buf_keystroke_string_get(kb, ks);
|
||||
if (str)
|
||||
{
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, 0);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, 0);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, 0);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_pressed_key_add(E_Kbd_Buf *kb, const char *key, int shift, int capslock)
|
||||
{
|
||||
E_Kbd_Buf_Keystroke *ks;
|
||||
|
||||
e_kbd_buf_lookup_cancel(kb);
|
||||
if (!key) return;
|
||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
||||
if (!kb->layout) return;
|
||||
ks = E_NEW(E_Kbd_Buf_Keystroke, 1);
|
||||
if (!ks) return;
|
||||
ks->key = evas_stringshare_add(key);
|
||||
if (shift) ks->shift = 1;
|
||||
if (capslock) ks->capslock = 1;
|
||||
ks->layout = kb->layout;
|
||||
_e_kbd_buf_layout_ref(ks->layout);
|
||||
kb->keystrokes = eina_list_append(kb->keystrokes, ks);
|
||||
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_advance(kb->dict.sys);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_advance(kb->dict.personal);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_advance(kb->dict.data);
|
||||
_e_kbd_buf_keystroke_add(kb, ks);
|
||||
|
||||
_e_kbd_buf_actual_string_update(kb);
|
||||
_e_kbd_buf_matches_update(kb);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_buf_keystroke_point_add(E_Kbd_Buf *kb, E_Kbd_Buf_Keystroke *ks)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = ks->layout->keys; l; l = l->next)
|
||||
{
|
||||
E_Kbd_Buf_Key *ky;
|
||||
const char *str;
|
||||
int px, py, dx, dy, d, fuzz;
|
||||
|
||||
ky = l->data;
|
||||
px = ky->x + (ky->w / 2);
|
||||
py = ky->y + (ky->h / 2);
|
||||
dx = ks->x - px;
|
||||
dy = ks->y - py;
|
||||
d = sqrt((dx * dx) + (dy * dy));
|
||||
if (d <= ks->layout->fuzz)
|
||||
{
|
||||
str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky);
|
||||
if (str)
|
||||
{
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, d);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, d);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_pressed_point_add(E_Kbd_Buf *kb, int x, int y, int shift, int capslock)
|
||||
{
|
||||
E_Kbd_Buf_Keystroke *ks;
|
||||
|
||||
e_kbd_buf_lookup_cancel(kb);
|
||||
if (!kb->layout) kb->layout = _e_kbd_buf_new();
|
||||
if (!kb->layout) return;
|
||||
ks = E_NEW(E_Kbd_Buf_Keystroke, 1);
|
||||
if (!ks) return;
|
||||
ks->x = x;
|
||||
ks->y = y;
|
||||
if (shift) ks->shift = 1;
|
||||
if (capslock) ks->capslock = 1;
|
||||
ks->layout = kb->layout;
|
||||
_e_kbd_buf_layout_ref(ks->layout);
|
||||
kb->keystrokes = eina_list_append(kb->keystrokes, ks);
|
||||
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_advance(kb->dict.sys);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_advance(kb->dict.personal);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_advance(kb->dict.data);
|
||||
|
||||
_e_kbd_buf_keystroke_point_add(kb, ks);
|
||||
|
||||
_e_kbd_buf_actual_string_update(kb);
|
||||
_e_kbd_buf_matches_update(kb);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_kbd_buf_actual_string_get(E_Kbd_Buf *kb)
|
||||
{
|
||||
return kb->actual_string;
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
e_kbd_buf_string_matches_get(E_Kbd_Buf *kb)
|
||||
{
|
||||
return kb->string_matches;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_backspace(E_Kbd_Buf *kb)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
l = eina_list_last(kb->keystrokes);
|
||||
if (l)
|
||||
{
|
||||
E_Kbd_Buf_Keystroke *ks;
|
||||
|
||||
ks = l->data;
|
||||
if (ks->key) evas_stringshare_del(ks->key);
|
||||
_e_kbd_buf_layout_unref(ks->layout);
|
||||
free(ks);
|
||||
kb->keystrokes = eina_list_remove_list(kb->keystrokes, l);
|
||||
if (kb->dict.sys) e_kbd_dict_word_letter_delete(kb->dict.sys);
|
||||
if (kb->dict.personal) e_kbd_dict_word_letter_delete(kb->dict.personal);
|
||||
if (kb->dict.data) e_kbd_dict_word_letter_delete(kb->dict.data);
|
||||
_e_kbd_buf_actual_string_update(kb);
|
||||
_e_kbd_buf_matches_update(kb);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_word_use(E_Kbd_Buf *kb, const char *word)
|
||||
{
|
||||
if (kb->dict.personal)
|
||||
e_kbd_dict_word_usage_adjust(kb->dict.personal, word, 1);
|
||||
}
|
||||
|
||||
// FIXME: just faking delayed lookup with timer
|
||||
static int
|
||||
_e_kbd_buf_cb_faket(void *data)
|
||||
{
|
||||
E_Kbd_Buf *kb;
|
||||
|
||||
kb = data;
|
||||
kb->lookup.faket = NULL;
|
||||
kb->lookup.func(kb->lookup.data);
|
||||
kb->lookup.func = NULL;
|
||||
kb->lookup.data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_lookup(E_Kbd_Buf *kb, void (*func) (void *data), const void *data)
|
||||
{
|
||||
e_kbd_buf_lookup_cancel(kb);
|
||||
|
||||
kb->lookup.func = func;
|
||||
kb->lookup.data = data;
|
||||
|
||||
// FIXME: just faking delayed lookup with timer
|
||||
kb->lookup.faket = ecore_timer_add(0.1, _e_kbd_buf_cb_faket, kb);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_buf_lookup_cancel(E_Kbd_Buf *kb)
|
||||
{
|
||||
// FIXME: just faking delayed lookup with timer
|
||||
if (!kb->lookup.faket) return;
|
||||
ecore_timer_del(kb->lookup.faket);
|
||||
kb->lookup.faket = NULL;
|
||||
|
||||
kb->lookup.func = NULL;
|
||||
kb->lookup.data = NULL;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
#ifndef E_KBD_BUF_H
|
||||
#define E_KBD_BUF_H
|
||||
|
||||
#include "e_kbd_dict.h"
|
||||
|
||||
typedef struct _E_Kbd_Buf E_Kbd_Buf;
|
||||
typedef struct _E_Kbd_Buf_Key E_Kbd_Buf_Key;
|
||||
typedef struct _E_Kbd_Buf_Keystroke E_Kbd_Buf_Keystroke;
|
||||
typedef struct _E_Kbd_Buf_Layout E_Kbd_Buf_Layout;
|
||||
|
||||
struct _E_Kbd_Buf
|
||||
{
|
||||
const char *sysdicts;
|
||||
Eina_List *keystrokes;
|
||||
Eina_List *string_matches;
|
||||
const char *actual_string;
|
||||
E_Kbd_Buf_Layout *layout;
|
||||
struct {
|
||||
void (*func) (void *data);
|
||||
const void *data;
|
||||
// FIXME: just faking delayed lookup with timer
|
||||
Ecore_Timer *faket;
|
||||
} lookup;
|
||||
struct {
|
||||
E_Kbd_Dict *sys;
|
||||
E_Kbd_Dict *personal;
|
||||
E_Kbd_Dict *data;
|
||||
Ecore_File_Monitor *data_monitor;
|
||||
Ecore_Timer *data_reload_delay;
|
||||
} dict;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Buf_Key
|
||||
{
|
||||
int x, y, w, h;
|
||||
const char *key, *key_shift, *key_capslock;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Buf_Keystroke
|
||||
{
|
||||
const char *key;
|
||||
int x, y;
|
||||
E_Kbd_Buf_Layout *layout;
|
||||
unsigned char shift : 1;
|
||||
unsigned char capslock : 1;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Buf_Layout {
|
||||
int ref;
|
||||
int w, h;
|
||||
int fuzz;
|
||||
Eina_List *keys;
|
||||
};
|
||||
|
||||
EAPI E_Kbd_Buf *e_kbd_buf_new(const char *sysdicts, const char *dicts);
|
||||
EAPI void e_kbd_buf_free(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_dict_set(E_Kbd_Buf *kb, const char *dict);
|
||||
EAPI void e_kbd_buf_clear(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_layout_clear(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_layout_size_set(E_Kbd_Buf *kb, int w, int h);
|
||||
EAPI void e_kbd_buf_layout_fuzz_set(E_Kbd_Buf *kb, int fuzz);
|
||||
EAPI void e_kbd_buf_layout_key_add(E_Kbd_Buf *kb, const char *key, const char *key_shift, const char *key_capslock, int x, int y, int w, int h);
|
||||
EAPI void e_kbd_buf_pressed_key_add(E_Kbd_Buf *kb, const char *key, int shift, int capslock);
|
||||
EAPI void e_kbd_buf_pressed_point_add(E_Kbd_Buf *kb, int x, int y, int shift, int capslock);
|
||||
EAPI const char *e_kbd_buf_actual_string_get(E_Kbd_Buf *kb);
|
||||
EAPI const Eina_List *e_kbd_buf_string_matches_get(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_backspace(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_lookup(E_Kbd_Buf *kb, void (*func) (void *data), const void *data);
|
||||
EAPI void e_kbd_buf_lookup_cancel(E_Kbd_Buf *kb);
|
||||
EAPI void e_kbd_buf_word_use(E_Kbd_Buf *kb, const char *word);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,872 @@
|
|||
#include <e.h>
|
||||
#include "e_kbd_dict.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
||||
#define MAXLATIN 0x100
|
||||
static unsigned char _e_kbd_normalise_base[MAXLATIN];
|
||||
static unsigned char _e_kbd_normalise_ready = 0;
|
||||
|
||||
static void
|
||||
_e_kbd_normalise_init(void)
|
||||
{
|
||||
int i;
|
||||
const char *table[][2] =
|
||||
{
|
||||
{"À", "a"},
|
||||
{"Á", "a"},
|
||||
{"Â", "a"},
|
||||
{"Ã", "a"},
|
||||
{"Ä", "a"},
|
||||
{"Å", "a"},
|
||||
{"Æ", "a"},
|
||||
{"Ç", "c"},
|
||||
{"È", "e"},
|
||||
{"É", "e"},
|
||||
{"Ê", "e"},
|
||||
{"Ë", "e"},
|
||||
{"Ì", "i"},
|
||||
{"Í", "i"},
|
||||
{"Î", "i"},
|
||||
{"Ï", "i"},
|
||||
{"Ð", "d"},
|
||||
{"Ñ", "n"},
|
||||
{"Ò", "o"},
|
||||
{"Ó", "o"},
|
||||
{"Ô", "o"},
|
||||
{"Õ", "o"},
|
||||
{"Ö", "o"},
|
||||
{"×", "x"},
|
||||
{"Ø", "o"},
|
||||
{"Ù", "u"},
|
||||
{"Ú", "u"},
|
||||
{"Û", "u"},
|
||||
{"Ü", "u"},
|
||||
{"Ý", "y"},
|
||||
{"Þ", "p"},
|
||||
{"ß", "s"},
|
||||
{"à", "a"},
|
||||
{"á", "a"},
|
||||
{"â", "a"},
|
||||
{"ã", "a"},
|
||||
{"ä", "a"},
|
||||
{"å", "a"},
|
||||
{"æ", "a"},
|
||||
{"ç", "c"},
|
||||
{"è", "e"},
|
||||
{"é", "e"},
|
||||
{"ê", "e"},
|
||||
{"ë", "e"},
|
||||
{"ì", "i"},
|
||||
{"í", "i"},
|
||||
{"î", "i"},
|
||||
{"ï", "i"},
|
||||
{"ð", "o"},
|
||||
{"ñ", "n"},
|
||||
{"ò", "o"},
|
||||
{"ó", "o"},
|
||||
{"ô", "o"},
|
||||
{"õ", "o"},
|
||||
{"ö", "o"},
|
||||
{"ø", "o"},
|
||||
{"ù", "u"},
|
||||
{"ú", "u"},
|
||||
{"û", "u"},
|
||||
{"ü", "u"},
|
||||
{"ý", "y"},
|
||||
{"þ", "p"},
|
||||
{"ÿ", "y"}
|
||||
}; // 63 items
|
||||
|
||||
if (_e_kbd_normalise_ready) return;
|
||||
_e_kbd_normalise_ready = 1;
|
||||
for (i = 0; i < 128; i++)
|
||||
_e_kbd_normalise_base[i] = tolower(i);
|
||||
for (;i < MAXLATIN; i++)
|
||||
{
|
||||
int glyph;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 63; j++)
|
||||
{
|
||||
evas_string_char_next_get(table[j][0], 0, &glyph);
|
||||
if (glyph == i)
|
||||
{
|
||||
_e_kbd_normalise_base[i] = *table[j][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_letter_normalise(int glyph)
|
||||
{
|
||||
// FIXME: ö -> o, ä -> a, Ó -> o etc. - ie normalise to latin-1
|
||||
if (glyph < MAXLATIN) return _e_kbd_normalise_base[glyph];
|
||||
return tolower(glyph) & 0x7f;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_normalized_strncmp(const char *a, const char *b, int len)
|
||||
{
|
||||
// FIXME: normalise 2 strings and then compare
|
||||
if (len < 0) return strcasecmp(a, b);
|
||||
return strncasecmp(a, b, len);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_normalized_strcmp(const char *a, const char *b)
|
||||
{
|
||||
return _e_kbd_dict_normalized_strncmp(a, b, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_normalized_strcpy(char *dst, const char *src)
|
||||
{
|
||||
const char *p;
|
||||
char *d;
|
||||
|
||||
for (p = src, d = dst; *p; p++, d++)
|
||||
{
|
||||
*d = _e_kbd_dict_letter_normalise(*p);
|
||||
}
|
||||
*d = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_matches_loolup_cb_sort(void *d1, void *d2)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw1, *kw2;
|
||||
|
||||
kw1 = d1;
|
||||
kw2 = d2;
|
||||
if (kw1->usage < kw2->usage) return 1;
|
||||
else if (kw1->usage > kw2->usage) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_writes_cb_sort(void *d1, void *d2)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw1, *kw2;
|
||||
|
||||
kw1 = d1;
|
||||
kw2 = d2;
|
||||
return _e_kbd_dict_normalized_strcmp(kw1->word, kw2->word);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_dict_line_next(E_Kbd_Dict *kd, const char *p)
|
||||
{
|
||||
const char *e, *pp;
|
||||
|
||||
e = kd->file.dict + kd->file.size;
|
||||
for (pp = p; pp < e; pp++)
|
||||
{
|
||||
if (*pp == '\n')
|
||||
return pp + 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_e_kbd_dict_line_parse(E_Kbd_Dict *kd, const char *p, int *usage)
|
||||
{
|
||||
const char *ps;
|
||||
char *wd = NULL;
|
||||
|
||||
for (ps = p; !isspace(*ps); ps++);
|
||||
wd = malloc(ps - p + 1);
|
||||
if (!wd) return NULL;
|
||||
strncpy(wd, p, ps - p);
|
||||
wd[ps - p] = 0;
|
||||
if (*ps == '\n') *usage = 0;
|
||||
else
|
||||
{
|
||||
ps++;
|
||||
*usage = atoi(ps);
|
||||
}
|
||||
return wd;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_lookup_build_line(E_Kbd_Dict *kd, const char *p, const char *eol,
|
||||
int *glyphs)
|
||||
{
|
||||
char *s;
|
||||
int p2;
|
||||
|
||||
s = alloca(eol - p + 1);
|
||||
strncpy(s, p, eol - p);
|
||||
s[eol - p] = 0;
|
||||
p2 = evas_string_char_next_get(s, 0, &(glyphs[0]));
|
||||
if ((p2 > 0) && (glyphs[0] > 0))
|
||||
p2 = evas_string_char_next_get(s, p2, &(glyphs[1]));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_lookup_build(E_Kbd_Dict *kd)
|
||||
{
|
||||
const char *p, *e, *eol;
|
||||
int glyphs[2], pglyphs[2];
|
||||
|
||||
p = kd->file.dict;
|
||||
e = p + kd->file.size;
|
||||
pglyphs[0] = pglyphs[1] = 0;
|
||||
while (p < e)
|
||||
{
|
||||
eol = strchr(p, '\n');
|
||||
if (!eol) break;
|
||||
if (eol > p)
|
||||
{
|
||||
glyphs[0] = glyphs[1] = 0;
|
||||
_e_kbd_dict_lookup_build_line(kd, p, eol, glyphs);
|
||||
if ((glyphs[1] != pglyphs[1]) ||
|
||||
(glyphs[0] != pglyphs[0]))
|
||||
{
|
||||
int v1, v2;
|
||||
|
||||
if (isspace(glyphs[0]))
|
||||
{
|
||||
glyphs[0] = 0;
|
||||
glyphs[1] = 0;
|
||||
}
|
||||
else if (isspace(glyphs[1]))
|
||||
glyphs[1] = 0;
|
||||
if (glyphs[0] == 0)
|
||||
{
|
||||
pglyphs[0] = pglyphs[1] = 0;
|
||||
p = eol + 1;
|
||||
continue;
|
||||
}
|
||||
v1 = _e_kbd_dict_letter_normalise(glyphs[0]);
|
||||
v2 = _e_kbd_dict_letter_normalise(glyphs[1]);
|
||||
if (!kd->lookup.tuples[v1][v2])
|
||||
kd->lookup.tuples[v1][v2] = p;
|
||||
pglyphs[0] = v1;
|
||||
pglyphs[1] = v2;
|
||||
}
|
||||
}
|
||||
p = eol + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_open(E_Kbd_Dict *kd)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
kd->file.fd = open(kd->file.file, O_RDONLY);
|
||||
if (kd->file.fd < 0)
|
||||
return 0;
|
||||
if (fstat(kd->file.fd, &st) < 0)
|
||||
{
|
||||
close(kd->file.fd);
|
||||
return 0;
|
||||
}
|
||||
kd->file.size = st.st_size;
|
||||
kd->file.dict = mmap(NULL, kd->file.size, PROT_READ, MAP_SHARED,
|
||||
kd->file.fd, 0);
|
||||
if ((kd->file.dict== MAP_FAILED) || (kd->file.dict == NULL))
|
||||
{
|
||||
close(kd->file.fd);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_close(E_Kbd_Dict *kd)
|
||||
{
|
||||
if (kd->file.fd < 0) return;
|
||||
memset(kd->lookup.tuples, 0, sizeof(kd->lookup.tuples));
|
||||
munmap((void *)kd->file.dict, kd->file.size);
|
||||
close(kd->file.fd);
|
||||
kd->file.fd = -1;
|
||||
kd->file.dict = NULL;
|
||||
kd->file.size = 0;
|
||||
}
|
||||
|
||||
EAPI E_Kbd_Dict *
|
||||
e_kbd_dict_new(const char *file)
|
||||
{
|
||||
// alloc and load new dict - build quick-lookup table. words MUST be sorted
|
||||
E_Kbd_Dict *kd;
|
||||
|
||||
_e_kbd_normalise_init();
|
||||
kd = E_NEW(E_Kbd_Dict, 1);
|
||||
if (!kd) return NULL;
|
||||
kd->file.file = evas_stringshare_add(file);
|
||||
if (!kd->file.file)
|
||||
{
|
||||
free(kd);
|
||||
return NULL;
|
||||
}
|
||||
kd->file.fd = -1;
|
||||
if (!_e_kbd_dict_open(kd))
|
||||
{
|
||||
evas_stringshare_del(kd->file.file);
|
||||
free(kd);
|
||||
return NULL;
|
||||
}
|
||||
_e_kbd_dict_lookup_build(kd);
|
||||
return kd;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_free(E_Kbd_Dict *kd)
|
||||
{
|
||||
// free dict and anything in it
|
||||
e_kbd_dict_word_letter_clear(kd);
|
||||
e_kbd_dict_save(kd);
|
||||
_e_kbd_dict_close(kd);
|
||||
free(kd);
|
||||
}
|
||||
|
||||
static E_Kbd_Dict_Word *
|
||||
_e_kbd_dict_changed_write_find(E_Kbd_Dict *kd, const char *word)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = kd->changed.writes; l; l = l->next)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = l->data;
|
||||
if (!strcmp(kw->word, word)) return kw;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_save(E_Kbd_Dict *kd)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
// save any changes (new words added, usage adjustments).
|
||||
// all words MUST be sorted
|
||||
if (!kd->changed.writes) return;
|
||||
if (kd->changed.flush_timer)
|
||||
{
|
||||
ecore_timer_del(kd->changed.flush_timer);
|
||||
kd->changed.flush_timer = NULL;
|
||||
}
|
||||
ecore_file_unlink(kd->file.file);
|
||||
f = fopen(kd->file.file, "w");
|
||||
kd->changed.writes = eina_list_sort(kd->changed.writes,
|
||||
eina_list_count(kd->changed.writes),
|
||||
_e_kbd_dict_writes_cb_sort);
|
||||
if (f)
|
||||
{
|
||||
const char *p, *pn;
|
||||
|
||||
p = kd->file.dict;
|
||||
while (p)
|
||||
{
|
||||
char *wd;
|
||||
int usage = 0;
|
||||
|
||||
pn = _e_kbd_dict_line_next(kd, p);
|
||||
if (!pn) return;
|
||||
wd = _e_kbd_dict_line_parse(kd, p, &usage);
|
||||
if ((wd) && (strlen(wd) > 0))
|
||||
{
|
||||
if (kd->changed.writes)
|
||||
{
|
||||
int writeline;
|
||||
|
||||
writeline = 0;
|
||||
while (kd->changed.writes)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
int cmp;
|
||||
|
||||
kw = kd->changed.writes->data;
|
||||
cmp = _e_kbd_dict_normalized_strcmp(kw->word, wd);
|
||||
if (cmp < 0)
|
||||
{
|
||||
fprintf(f, "%s %i\n", kw->word, kw->usage);
|
||||
writeline = 1;
|
||||
evas_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
||||
writeline = 1;
|
||||
}
|
||||
else if (cmp == 0)
|
||||
{
|
||||
fprintf(f, "%s %i\n", wd, kw->usage);
|
||||
if (!strcmp(kw->word, wd))
|
||||
writeline = 0;
|
||||
else
|
||||
writeline = 1;
|
||||
evas_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
||||
break;
|
||||
}
|
||||
else if (cmp > 0)
|
||||
{
|
||||
writeline = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (writeline)
|
||||
fprintf(f, "%s %i\n", wd, usage);
|
||||
}
|
||||
else
|
||||
fprintf(f, "%s %i\n", wd, usage);
|
||||
}
|
||||
if (wd) free(wd);
|
||||
p = pn;
|
||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
||||
}
|
||||
while (kd->changed.writes)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = kd->changed.writes->data;
|
||||
fprintf(f, "%s %i\n", kw->word, kw->usage);
|
||||
evas_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
_e_kbd_dict_close(kd);
|
||||
if (_e_kbd_dict_open(kd))
|
||||
_e_kbd_dict_lookup_build(kd);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_kbd_dict_cb_save_flush(void *data)
|
||||
{
|
||||
E_Kbd_Dict *kd;
|
||||
|
||||
kd = data;
|
||||
if ((kd->matches.list) ||
|
||||
(kd->word.letters) ||
|
||||
(kd->matches.deadends) ||
|
||||
(kd->matches.leads))
|
||||
return 1;
|
||||
kd->changed.flush_timer = NULL;
|
||||
e_kbd_dict_save(kd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_changed_write_add(E_Kbd_Dict *kd, const char *word, int usage)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = E_NEW(E_Kbd_Dict_Word, 1);
|
||||
kw->word = evas_stringshare_add(word);
|
||||
kw->usage = usage;
|
||||
kd->changed.writes = eina_list_prepend(kd->changed.writes, kw);
|
||||
if (eina_list_count(kd->changed.writes) > 64)
|
||||
{
|
||||
e_kbd_dict_save(kd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kd->changed.flush_timer)
|
||||
ecore_timer_del(kd->changed.flush_timer);
|
||||
kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_dict_find_pointer(E_Kbd_Dict *kd, const char *p, int baselen, const char *word)
|
||||
{
|
||||
const char *pn;
|
||||
int len;
|
||||
|
||||
if (!p) return NULL;
|
||||
len = strlen(word);
|
||||
while (p)
|
||||
{
|
||||
pn = _e_kbd_dict_line_next(kd, p);
|
||||
if (!pn) return NULL;
|
||||
if ((pn - p) > len)
|
||||
{
|
||||
if (!_e_kbd_dict_normalized_strncmp(p, word, len))
|
||||
return p;
|
||||
}
|
||||
if (_e_kbd_dict_normalized_strncmp(p, word, baselen))
|
||||
return NULL;
|
||||
p = pn;
|
||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_dict_find(E_Kbd_Dict *kd, const char *word)
|
||||
{
|
||||
const char *p;
|
||||
char *tword;
|
||||
int glyphs[2], p2, v1, v2, i;
|
||||
|
||||
/* work backwards in leads. i.e.:
|
||||
* going
|
||||
* goin
|
||||
* goi
|
||||
* go
|
||||
* g
|
||||
*/
|
||||
tword = alloca(strlen(word) + 1);
|
||||
_e_kbd_dict_normalized_strcpy(tword, word);
|
||||
p = evas_hash_find(kd->matches.leads, tword);
|
||||
if (p) return p;
|
||||
p2 = strlen(tword);
|
||||
while (tword[0])
|
||||
{
|
||||
p2 = evas_string_char_prev_get(tword, p2, &i);
|
||||
if (p2 < 0) break;
|
||||
tword[p2] = 0;
|
||||
p = evas_hash_find(kd->matches.leads, tword);
|
||||
if (p)
|
||||
return _e_kbd_dict_find_pointer(kd, p, p2, word);
|
||||
}
|
||||
/* looking at leads going back letters didn't work */
|
||||
p = kd->file.dict;
|
||||
if ((p[0] == '\n') && (kd->file.size <= 1)) return NULL;
|
||||
glyphs[0] = glyphs[1] = 0;
|
||||
p2 = evas_string_char_next_get(word, 0, &(glyphs[0]));
|
||||
if ((p2 > 0) && (glyphs[0] > 0))
|
||||
p2 = evas_string_char_next_get(word, p2, &(glyphs[1]));
|
||||
v1 = _e_kbd_dict_letter_normalise(glyphs[0]);
|
||||
if (glyphs[1] != 0)
|
||||
{
|
||||
v2 = _e_kbd_dict_letter_normalise(glyphs[1]);
|
||||
p = kd->lookup.tuples[v1][v2];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
p = kd->lookup.tuples[v1][i];
|
||||
if (p) break;
|
||||
}
|
||||
}
|
||||
return _e_kbd_dict_find_pointer(kd, p, p2, word);
|
||||
}
|
||||
|
||||
static const char *
|
||||
_e_kbd_dict_find_full(E_Kbd_Dict *kd, const char *word)
|
||||
{
|
||||
const char *p;
|
||||
int len;
|
||||
|
||||
p = _e_kbd_dict_find(kd, word);
|
||||
if (!p) return NULL;
|
||||
len = strlen(word);
|
||||
if (isspace(p[len])) return p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_usage_adjust(E_Kbd_Dict *kd, const char *word, int adjust)
|
||||
{
|
||||
// add "adjust" to word usage count
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = _e_kbd_dict_changed_write_find(kd, word);
|
||||
if (kw)
|
||||
{
|
||||
kw->usage += adjust;
|
||||
if (kd->changed.flush_timer)
|
||||
ecore_timer_del(kd->changed.flush_timer);
|
||||
kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *line;
|
||||
int usage = 0;
|
||||
|
||||
line = _e_kbd_dict_find_full(kd, word);
|
||||
if (line)
|
||||
{
|
||||
char *wd;
|
||||
|
||||
// FIXME: we need to find an EXACT line match - case and all
|
||||
wd = _e_kbd_dict_line_parse(kd, line, &usage);
|
||||
if (wd) free(wd);
|
||||
}
|
||||
usage += adjust;
|
||||
_e_kbd_dict_changed_write_add(kd, word, usage);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_delete(E_Kbd_Dict *kd, const char *word)
|
||||
{
|
||||
// delete a word from the dictionary
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = _e_kbd_dict_changed_write_find(kd, word);
|
||||
if (kw)
|
||||
kw->usage = -1;
|
||||
else
|
||||
{
|
||||
if (_e_kbd_dict_find_full(kd, word))
|
||||
_e_kbd_dict_changed_write_add(kd, word, -1);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_letter_clear(E_Kbd_Dict *kd)
|
||||
{
|
||||
// clear the current word buffer
|
||||
while (kd->word.letters)
|
||||
e_kbd_dict_word_letter_delete(kd);
|
||||
if (kd->matches.deadends)
|
||||
{
|
||||
evas_hash_free(kd->matches.deadends);
|
||||
kd->matches.deadends = NULL;
|
||||
}
|
||||
if (kd->matches.leads)
|
||||
{
|
||||
evas_hash_free(kd->matches.leads);
|
||||
kd->matches.leads = NULL;
|
||||
}
|
||||
while (kd->matches.list)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = kd->matches.list->data;
|
||||
evas_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_letter_add(E_Kbd_Dict *kd, const char *letter, int dist)
|
||||
{
|
||||
// add a letter with a distance (0 == closest) as an option for the current
|
||||
// letter position - advance starts a new letter position
|
||||
Eina_List *l, *list;
|
||||
E_Kbd_Dict_Letter *kl;
|
||||
|
||||
l = eina_list_last(kd->word.letters);
|
||||
if (!l) return;
|
||||
list = l->data;
|
||||
kl = E_NEW(E_Kbd_Dict_Letter, 1);
|
||||
if (!kl) return;
|
||||
kl->letter = evas_stringshare_add(letter);
|
||||
kl->dist = dist;
|
||||
list = eina_list_append(list, kl);
|
||||
l->data = list;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_letter_advance(E_Kbd_Dict *kd)
|
||||
{
|
||||
// start a new letter in the word
|
||||
kd->word.letters = eina_list_append(kd->word.letters, NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_word_letter_delete(E_Kbd_Dict *kd)
|
||||
{
|
||||
// delete the current letter completely
|
||||
Eina_List *l, *list;
|
||||
|
||||
l = eina_list_last(kd->word.letters);
|
||||
if (!l) return;
|
||||
list = l->data;
|
||||
while (list)
|
||||
{
|
||||
E_Kbd_Dict_Letter *kl;
|
||||
|
||||
kl = list->data;
|
||||
evas_stringshare_del(kl->letter);
|
||||
free(kl);
|
||||
list = eina_list_remove_list(list, list);
|
||||
}
|
||||
kd->word.letters = eina_list_remove_list(kd->word.letters, l);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_kbd_dict_matches_lookup_iter(E_Kbd_Dict *kd, Eina_List *word,
|
||||
Eina_List *more)
|
||||
{
|
||||
Eina_List *l, *l2, *list;
|
||||
const char *p, *pn;
|
||||
char *base, *buf, *wd, *bufapp;
|
||||
E_Kbd_Dict_Letter *kl;
|
||||
int len, dist = 0, d, baselen, maxdist = 0, md;
|
||||
|
||||
static int level = 0, lv;
|
||||
|
||||
len = 0;
|
||||
level++;
|
||||
for (l = word; l; l = l->next)
|
||||
{
|
||||
kl = l->data;
|
||||
len += strlen(kl->letter);
|
||||
dist += kl->dist;
|
||||
if (kl->dist > maxdist) maxdist = kl->dist;
|
||||
}
|
||||
if (maxdist < 1) maxdist = 1;
|
||||
buf = alloca(len + 20); // 20 - just padding enough for 1 more utf8 char
|
||||
base = alloca(len + 20);
|
||||
base[0] = 0;
|
||||
for (l = word; l; l = l->next)
|
||||
{
|
||||
kl = l->data;
|
||||
strcat(base, kl->letter);
|
||||
}
|
||||
baselen = strlen(base);
|
||||
strcpy(buf, base);
|
||||
bufapp = buf + baselen;
|
||||
list = more->data;
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
kl = l->data;
|
||||
if (kl->dist > maxdist) maxdist = kl->dist;
|
||||
}
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
kl = l->data;
|
||||
strcpy(bufapp, kl->letter);
|
||||
if ((kd->matches.deadends) && evas_hash_find(kd->matches.deadends, buf))
|
||||
continue;
|
||||
p = evas_hash_find(kd->matches.leads, buf);
|
||||
if (p) p = _e_kbd_dict_find_pointer(kd, p, baselen, buf);
|
||||
else p = _e_kbd_dict_find(kd, buf);
|
||||
if (!p)
|
||||
{
|
||||
kd->matches.deadends = evas_hash_add(kd->matches.deadends, buf, kd);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
kd->matches.leads = evas_hash_add(kd->matches.leads, buf, p);
|
||||
if ((!more->next) || (!more->next->data))
|
||||
{
|
||||
d = dist + kl->dist;
|
||||
md = maxdist;
|
||||
for (;;)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
int usage = 0;
|
||||
|
||||
wd = _e_kbd_dict_line_parse(kd, p, &usage);
|
||||
if (!wd) break;
|
||||
if (_e_kbd_dict_normalized_strcmp(wd, buf))
|
||||
{
|
||||
free(wd);
|
||||
break;
|
||||
}
|
||||
kw = E_NEW(E_Kbd_Dict_Word, 1);
|
||||
if (kw)
|
||||
{
|
||||
int accuracy;
|
||||
int w, b, w2, b2, wc, bc, upper;
|
||||
|
||||
// match any capitalisation
|
||||
for (w = 0, b = 0; wd[w] && buf[b];)
|
||||
{
|
||||
b2 = evas_string_char_next_get(buf, b, &bc);
|
||||
w2 = evas_string_char_next_get(wd, w, &wc);
|
||||
if (isupper(bc)) wd[w] = toupper(wc);
|
||||
w = w2;
|
||||
b = b2;
|
||||
}
|
||||
kw->word = evas_stringshare_add(wd);
|
||||
// FIXME: magic combination of distance metric and
|
||||
// frequency of useage. this is simple now, but could
|
||||
// be tweaked
|
||||
wc = eina_list_count(word);
|
||||
if (md < 1) md = 1;
|
||||
|
||||
// basically a metric to see how far away teh keys that
|
||||
// were actually pressed are away from the letters of
|
||||
// this word in a physical on-screen sense
|
||||
accuracy = md - (d / (wc + 1));
|
||||
// usage is the frequency of usage in the dictionary.
|
||||
// it its < 1 time, it's assumed to be 1.
|
||||
if (usage < 1) usage = 1;
|
||||
// multiply usage by a factor of 100 for better detailed
|
||||
// sorting. 10 == 1/10th factor
|
||||
usage = 100 + ((usage - 1) * 10);
|
||||
// and well just multiply and lets see. maybe this can
|
||||
// do with multiplication factors etc. but simple for
|
||||
// now.
|
||||
kw->usage = (usage * accuracy) / md;
|
||||
kd->matches.list = eina_list_append(kd->matches.list, kw);
|
||||
}
|
||||
free(wd);
|
||||
p = _e_kbd_dict_line_next(kd, p);
|
||||
if (p >= (kd->file.dict + kd->file.size)) break;
|
||||
if (!p) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
word = eina_list_append(word, kl);
|
||||
_e_kbd_dict_matches_lookup_iter(kd, word, more->next);
|
||||
word = eina_list_remove_list(word, eina_list_last(word));
|
||||
}
|
||||
}
|
||||
level--;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_matches_lookup(E_Kbd_Dict *kd)
|
||||
{
|
||||
// find all matches and sort them
|
||||
while (kd->matches.list)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = kd->matches.list->data;
|
||||
evas_stringshare_del(kw->word);
|
||||
free(kw);
|
||||
kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list);
|
||||
}
|
||||
if (kd->word.letters)
|
||||
_e_kbd_dict_matches_lookup_iter(kd, NULL, kd->word.letters);
|
||||
kd->matches.list = eina_list_sort(kd->matches.list,
|
||||
eina_list_count(kd->matches.list),
|
||||
_e_kbd_dict_matches_loolup_cb_sort);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_matches_first(E_Kbd_Dict *kd)
|
||||
{
|
||||
// jump to first match
|
||||
kd->matches.list_ptr = kd->matches.list;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_dict_matches_next(E_Kbd_Dict *kd)
|
||||
{
|
||||
// jump to next match
|
||||
kd->matches.list_ptr = kd->matches.list_ptr->next;
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_kbd_dict_matches_match_get(E_Kbd_Dict *kd, int *pri_ret)
|
||||
{
|
||||
// return the word (string utf-8) for the current match
|
||||
if (kd->matches.list_ptr)
|
||||
{
|
||||
E_Kbd_Dict_Word *kw;
|
||||
|
||||
kw = kd->matches.list_ptr->data;
|
||||
if (kw)
|
||||
{
|
||||
*pri_ret = kw->usage;
|
||||
return kw->word;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef E_KBD_DICT_H
|
||||
#define E_KBD_DICT_H
|
||||
|
||||
typedef struct _E_Kbd_Dict E_Kbd_Dict;
|
||||
typedef struct _E_Kbd_Dict_Word E_Kbd_Dict_Word;
|
||||
typedef struct _E_Kbd_Dict_Letter E_Kbd_Dict_Letter;
|
||||
|
||||
struct _E_Kbd_Dict_Word
|
||||
{
|
||||
const char *word;
|
||||
int usage;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Dict_Letter
|
||||
{
|
||||
const char *letter;
|
||||
int dist;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Dict
|
||||
{
|
||||
struct {
|
||||
const char *file;
|
||||
int fd;
|
||||
const char *dict;
|
||||
int size;
|
||||
} file;
|
||||
struct {
|
||||
const char *tuples[128][128];
|
||||
} lookup;
|
||||
struct {
|
||||
Ecore_Timer *flush_timer;
|
||||
Eina_List *writes;
|
||||
} changed;
|
||||
struct {
|
||||
Eina_List *letters;
|
||||
} word;
|
||||
struct {
|
||||
Evas_Hash *deadends;
|
||||
Evas_Hash *leads;
|
||||
Eina_List *list;
|
||||
Eina_List *list_ptr;
|
||||
} matches;
|
||||
};
|
||||
|
||||
|
||||
EAPI E_Kbd_Dict *e_kbd_dict_new(const char *file);
|
||||
EAPI void e_kbd_dict_free(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_save(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_word_usage_adjust(E_Kbd_Dict *kd, const char *word, int adjust);
|
||||
EAPI void e_kbd_dict_word_delete(E_Kbd_Dict *kd, const char *word);
|
||||
EAPI void e_kbd_dict_word_letter_clear(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_word_letter_add(E_Kbd_Dict *kd, const char *letter, int dist);
|
||||
EAPI void e_kbd_dict_word_letter_advance(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_word_letter_delete(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_matches_lookup(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_matches_first(E_Kbd_Dict *kd);
|
||||
EAPI void e_kbd_dict_matches_next(E_Kbd_Dict *kd);
|
||||
EAPI const char *e_kbd_dict_matches_match_get(E_Kbd_Dict *kd, int *pri_ret);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
#ifndef E_KBD_INT_H
|
||||
#define E_KBD_INT_H
|
||||
|
||||
#include "e_kbd_buf.h"
|
||||
|
||||
typedef enum _E_Kbd_Int_Type
|
||||
{
|
||||
E_KBD_INT_TYPE_UNKNOWN = 0,
|
||||
E_KBD_INT_TYPE_ALPHA = (1 << 0),
|
||||
E_KBD_INT_TYPE_NUMERIC = (1 << 1),
|
||||
E_KBD_INT_TYPE_PIN = (1 << 2),
|
||||
E_KBD_INT_TYPE_PHONE_NUMBER = (1 << 3),
|
||||
E_KBD_INT_TYPE_HEX = (1 << 4),
|
||||
E_KBD_INT_TYPE_TERMINAL = (1 << 5),
|
||||
E_KBD_INT_TYPE_PASSWORD = (1 << 6)
|
||||
} E_Kbd_Int_Type;
|
||||
|
||||
typedef struct _E_Kbd_Int E_Kbd_Int;
|
||||
typedef struct _E_Kbd_Int_Key E_Kbd_Int_Key;
|
||||
typedef struct _E_Kbd_Int_Key_State E_Kbd_Int_Key_State;
|
||||
typedef struct _E_Kbd_Int_Layout E_Kbd_Int_Layout;
|
||||
typedef struct _E_Kbd_Int_Match E_Kbd_Int_Match;
|
||||
|
||||
struct _E_Kbd_Int
|
||||
{
|
||||
E_Win *win;
|
||||
const char *themedir, *syskbds, *sysdicts;
|
||||
Evas_Object *base_obj, *layout_obj, *event_obj, *icon_obj, *box_obj;
|
||||
Eina_List *layouts;
|
||||
Eina_List *matches;
|
||||
Ecore_Event_Handler *client_message_handler;
|
||||
struct {
|
||||
char *directory;
|
||||
const char *file;
|
||||
int w, h;
|
||||
int fuzz;
|
||||
E_Kbd_Int_Type type;
|
||||
Eina_List *keys;
|
||||
E_Kbd_Int_Key *pressed;
|
||||
int state;
|
||||
} layout;
|
||||
struct {
|
||||
Evas_Coord x, y, cx, cy;
|
||||
int lx, ly, clx, cly;
|
||||
Ecore_Timer *hold_timer;
|
||||
unsigned char down : 1;
|
||||
unsigned char stroke : 1;
|
||||
unsigned char zoom : 1;
|
||||
} down;
|
||||
struct {
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj, *scrollframe_obj, *ilist_obj;
|
||||
} layoutlist;
|
||||
struct {
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj, *scrollframe_obj, *ilist_obj;
|
||||
Eina_List *matches;
|
||||
} matchlist;
|
||||
struct {
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj, *scrollframe_obj, *ilist_obj;
|
||||
Eina_List *matches;
|
||||
} dictlist;
|
||||
struct {
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj, *layout_obj, *sublayout_obj;
|
||||
E_Kbd_Int_Key *pressed;
|
||||
} zoomkey;
|
||||
|
||||
E_Kbd_Buf *kbuf;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Int_Key
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
Eina_List *states;
|
||||
Evas_Object *obj, *zoom_obj, *icon_obj, *zoom_icon_obj;
|
||||
|
||||
unsigned char pressed : 1;
|
||||
unsigned char selected : 1;
|
||||
|
||||
unsigned char is_shift : 1;
|
||||
unsigned char is_ctrl : 1;
|
||||
unsigned char is_alt : 1;
|
||||
unsigned char is_capslock : 1;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Int_Key_State
|
||||
{
|
||||
int state;
|
||||
const char *label, *icon;
|
||||
const char *out;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Int_Layout
|
||||
{
|
||||
const char *path;
|
||||
const char *dir;
|
||||
const char *icon;
|
||||
const char *name;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct _E_Kbd_Int_Match
|
||||
{
|
||||
E_Kbd_Int *ki;
|
||||
const char *str;
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
EAPI E_Kbd_Int *e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts);
|
||||
EAPI void e_kbd_int_free(E_Kbd_Int *ki);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,38 @@
|
|||
#include <e.h>
|
||||
#include "e_kbd_send.h"
|
||||
|
||||
static const char *
|
||||
_string_to_keysym(const char *str)
|
||||
{
|
||||
int glyph, ok;
|
||||
|
||||
/* utf8 -> glyph id (unicode - ucs4) */
|
||||
glyph = 0;
|
||||
ok = evas_string_char_next_get(str, 0, &glyph);
|
||||
if (glyph <= 0) return NULL;
|
||||
/* glyph id -> keysym */
|
||||
if (glyph > 0xff) glyph |= 0x1000000;
|
||||
return ecore_x_keysym_string_get(glyph);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_send_string_press(const char *str, Kbd_Mod mod)
|
||||
{
|
||||
const char *key = NULL;
|
||||
|
||||
key = _string_to_keysym(str);
|
||||
if (!key) return;
|
||||
e_kbd_send_keysym_press(key, mod);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_kbd_send_keysym_press(const char *key, Kbd_Mod mod)
|
||||
{
|
||||
if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_down("Control_L");
|
||||
if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_down("Alt_L");
|
||||
if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_down("Super_L");
|
||||
ecore_x_test_fake_key_press(key);
|
||||
if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_up("Super_L");
|
||||
if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_up("Alt_L");
|
||||
if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_up("Control_L");
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef E_KBD_SEND_H
|
||||
#define E_KBD_SEND_H
|
||||
|
||||
typedef enum _Kbd_Mod
|
||||
{
|
||||
KBD_MOD_SHIFT = (1 << 0),
|
||||
KBD_MOD_CTRL = (1 << 1),
|
||||
KBD_MOD_ALT = (1 << 2),
|
||||
KBD_MOD_WIN = (1 << 3)
|
||||
} Kbd_Mod;
|
||||
|
||||
EAPI void e_kbd_send_string_press(const char *str, Kbd_Mod mod);
|
||||
EAPI void e_kbd_send_keysym_press(const char *key, Kbd_Mod mod);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,216 @@
|
|||
#include <e.h>
|
||||
|
||||
/***************************************************************************/
|
||||
typedef struct _Instance Instance;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
Ecore_Poller *poller;
|
||||
int on;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"illume-bluetooth",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
static E_Module *mod = NULL;
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
static int _cb_poll(void *data);
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_gad_bluetooth_init(E_Module *m)
|
||||
{
|
||||
mod = m;
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_gad_bluetooth_shutdown(void)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gadcon_class);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
||||
"e/modules/illume/gadget/bluetooth");
|
||||
evas_object_show(o);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->obj = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
|
||||
inst->on = -1;
|
||||
inst->poller = ecore_poller_add(ECORE_POLLER_CORE, 16, _cb_poll, inst);
|
||||
|
||||
return gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = gcc->data;
|
||||
ecore_poller_del(inst->poller);
|
||||
evas_object_del(inst->obj);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Coord mw, mh, mxw, mxh;
|
||||
|
||||
inst = gcc->data;
|
||||
mw = 0, mh = 0;
|
||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
||||
if ((mw < 1) || (mh < 1))
|
||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
||||
if (mw < 4) mw = 4;
|
||||
if (mh < 4) mh = 4;
|
||||
if ((mxw > 0) && (mxh > 0))
|
||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return "Bluetooth (Illume)";
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
/* FIXME: need icon
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
||||
e_module_dir_get(clock_module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
return _gadcon_class.name;
|
||||
}
|
||||
|
||||
static int
|
||||
_find_interface_class(int iclass)
|
||||
{
|
||||
Ecore_List *devs;
|
||||
|
||||
devs = ecore_file_ls("/sys/bus/usb/devices");
|
||||
if (devs)
|
||||
{
|
||||
char *name;
|
||||
|
||||
while ((name = ecore_list_next(devs)))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
FILE *f;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
"/sys/bus/usb/devices", name, "bInterfaceClass");
|
||||
f = fopen(buf, "r");
|
||||
if (f)
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
sscanf(buf, "%x", &id);
|
||||
if (iclass == id)
|
||||
{
|
||||
ecore_list_destroy(devs);
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
ecore_list_destroy(devs);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_poll(void *data)
|
||||
{
|
||||
Instance *inst;
|
||||
int pon;
|
||||
|
||||
inst = data;
|
||||
/* FIXME: get bt status and emit signal */
|
||||
pon = inst->on;
|
||||
inst->on = _find_interface_class(0xe0);
|
||||
if (inst->on != pon)
|
||||
{
|
||||
if (inst->on)
|
||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
||||
else
|
||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_GAD_BLUETOOTH_H
|
||||
#define E_MOD_GAD_BLUETOOTH_H
|
||||
|
||||
void _e_mod_gad_bluetooth_init(E_Module *m);
|
||||
void _e_mod_gad_bluetooth_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,297 @@
|
|||
#include <e.h>
|
||||
|
||||
/***************************************************************************/
|
||||
typedef struct _Instance Instance;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
static void _cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"illume-cfg",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
static E_Module *mod = NULL;
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_gad_cfg_init(E_Module *m)
|
||||
{
|
||||
mod = m;
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_gad_cfg_shutdown(void)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gadcon_class);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
||||
"e/modules/illume/gadget/cfg");
|
||||
evas_object_show(o);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->obj = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
|
||||
_cb_mouse_up, inst);
|
||||
|
||||
return gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = gcc->data;
|
||||
evas_object_del(inst->obj);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Coord mw, mh;
|
||||
|
||||
inst = gcc->data;
|
||||
mw = 0, mh = 0;
|
||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
||||
if ((mw < 1) || (mh < 1))
|
||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
||||
if (mw < 4) mw = 4;
|
||||
if (mh < 4) mh = 4;
|
||||
e_gadcon_client_aspect_set(gcc, mw, mh);
|
||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return "Configuration (Illume)";
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
/* FIXME: need icon
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
||||
e_module_dir_get(clock_module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
return _gadcon_class.name;
|
||||
}
|
||||
|
||||
static void _cfg(void);
|
||||
|
||||
static void
|
||||
_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Event_Mouse_Up *ev;
|
||||
Instance *inst;
|
||||
|
||||
ev = event_info;
|
||||
inst = data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
_cfg();
|
||||
}
|
||||
|
||||
static void _cb_signal_ok(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _cb_delete(E_Win *win);
|
||||
static void _cb_resize(E_Win *win);
|
||||
static void _cb_cfg_item(void *data);
|
||||
|
||||
static E_Win *win = NULL;
|
||||
static Eina_List *cfgstr = NULL;
|
||||
static Evas_Object *o_cfg;
|
||||
|
||||
static void
|
||||
_cfg(void)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Evas_Object *o, *il;
|
||||
Eina_List *l, *ll;
|
||||
|
||||
if (win)
|
||||
{
|
||||
e_win_show(win);
|
||||
e_win_raise(win);
|
||||
return;
|
||||
}
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
win = e_win_new(zone->container);
|
||||
e_win_delete_callback_set(win, _cb_delete);
|
||||
e_win_resize_callback_set(win, _cb_resize);
|
||||
e_win_name_class_set(win, "E", "configuration");
|
||||
e_win_title_set(win, "Configuration");
|
||||
|
||||
o = _theme_obj_new(e_win_evas_get(win), e_module_dir_get(mod),
|
||||
"e/modules/illume/config/dialog");
|
||||
o_cfg = o;
|
||||
edje_object_part_text_set(o, "e.text.label", "Close");
|
||||
edje_object_signal_callback_add(o, "e,action,do,ok", "", _cb_signal_ok, win);
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_show(o);
|
||||
|
||||
il = e_widget_ilist_add(e_win_evas_get(win), 64, 64, NULL);
|
||||
e_widget_ilist_selector_set(il, 1);
|
||||
evas_event_freeze(evas_object_evas_get(il));
|
||||
e_widget_ilist_freeze(il);
|
||||
edje_freeze();
|
||||
|
||||
for (l = e_configure_registry; l; l = l->next)
|
||||
{
|
||||
E_Configure_Cat *ecat;
|
||||
|
||||
ecat = l->data;
|
||||
if ((ecat->pri >= 0) && (ecat->items))
|
||||
{
|
||||
for (ll = ecat->items; ll; ll = ll->next)
|
||||
{
|
||||
E_Configure_It *eci;
|
||||
char buf[1024];
|
||||
|
||||
eci = ll->data;
|
||||
if (eci->pri >= 0)
|
||||
{
|
||||
char *s;
|
||||
Evas_Object *oi;
|
||||
|
||||
if (e_util_edje_icon_check(eci->icon))
|
||||
{
|
||||
oi = edje_object_add(e_win_evas_get(win));
|
||||
e_util_edje_icon_set(oi, eci->icon);
|
||||
}
|
||||
else
|
||||
oi = e_util_icon_add(eci->icon, e_win_evas_get(win));
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ecat->cat, eci->item);
|
||||
s = evas_stringshare_add(buf);
|
||||
cfgstr = eina_list_append(cfgstr, s);
|
||||
e_widget_ilist_append(il, oi, eci->label, _cb_cfg_item,
|
||||
s, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e_widget_ilist_go(il);
|
||||
edje_thaw();
|
||||
e_widget_ilist_thaw(il);
|
||||
evas_event_thaw(evas_object_evas_get(il));
|
||||
|
||||
e_widget_focus_set(il, 1);
|
||||
evas_object_focus_set(il, 1);
|
||||
|
||||
edje_object_part_swallow(o, "e.swallow.content", il);
|
||||
|
||||
e_win_show(win);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_signal_ok(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
e_object_del(E_OBJECT(win));
|
||||
win = NULL;
|
||||
while (cfgstr)
|
||||
{
|
||||
evas_stringshare_del(cfgstr->data);
|
||||
cfgstr = eina_list_remove_list(cfgstr, cfgstr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_delete(E_Win *w)
|
||||
{
|
||||
e_object_del(E_OBJECT(win));
|
||||
win = NULL;
|
||||
while (cfgstr)
|
||||
{
|
||||
evas_stringshare_del(cfgstr->data);
|
||||
cfgstr = eina_list_remove_list(cfgstr, cfgstr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_resize(E_Win *w)
|
||||
{
|
||||
evas_object_resize(o_cfg, win->w, win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_cfg_item(void *data)
|
||||
{
|
||||
e_configure_registry_call(data,
|
||||
e_util_zone_current_get(e_manager_current_get())->container,
|
||||
NULL);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_GAD_CFG_H
|
||||
#define E_MOD_GAD_CFG_H
|
||||
|
||||
void _e_mod_gad_cfg_init(E_Module *m);
|
||||
void _e_mod_gad_cfg_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,704 @@
|
|||
#include <e.h>
|
||||
/* for complex link stuff */
|
||||
#include "config.h"
|
||||
#include <Ecore.h>
|
||||
#include <E_DBus.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
static E_DBus_Connection *conn = NULL;
|
||||
static E_DBus_Connection *conn_system = NULL;
|
||||
static E_DBus_Signal_Handler *changed_h = NULL;
|
||||
static E_DBus_Signal_Handler *changed_fso_h = NULL;
|
||||
static E_DBus_Signal_Handler *operatorch_h = NULL;
|
||||
static E_DBus_Signal_Handler *operatorch_fso_h = NULL;
|
||||
static E_DBus_Signal_Handler *namech_h = NULL;
|
||||
static E_DBus_Signal_Handler *namech_system_h = NULL;
|
||||
|
||||
static Ecore_Timer *try_again_timer = NULL;
|
||||
|
||||
typedef enum _Phone_Sys
|
||||
{
|
||||
PH_SYS_UNKNOWN,
|
||||
PH_SYS_QTOPIA,
|
||||
PH_SYS_FSO
|
||||
} Phone_Sys;
|
||||
|
||||
static Phone_Sys detected_system = PH_SYS_UNKNOWN;
|
||||
|
||||
/***************************************************************************/
|
||||
typedef struct _Instance Instance;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
int strength;
|
||||
char *oper;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"illume-gsm",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
static E_Module *mod = NULL;
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
static int try_again(void *data);
|
||||
static void *signal_unmarhsall(DBusMessage *msg, DBusError *err);
|
||||
static void *operator_unmarhsall(DBusMessage *msg, DBusError *err);
|
||||
static void signal_callback_qtopia(void *data, void *ret, DBusError *err);
|
||||
static void signal_callback_fso(void *data, void *ret, DBusError *err);
|
||||
static void operator_callback_qtopia(void *data, void *ret, DBusError *err);
|
||||
static void operator_callback_fso(void *data, void *ret, DBusError *err);
|
||||
static void signal_result_free(void *data);
|
||||
static void operator_result_free(void *data);
|
||||
static void get_signal(void *data);
|
||||
static void get_operator(void *data);
|
||||
static void signal_changed(void *data, DBusMessage *msg);
|
||||
static void operator_changed(void *data, DBusMessage *msg);
|
||||
static void fso_operator_changed(void *data, DBusMessage *msg);
|
||||
static void name_changed(void *data, DBusMessage *msg);
|
||||
|
||||
static int
|
||||
try_again(void *data)
|
||||
{
|
||||
// printf("GSM-gadget: Try again called\n");
|
||||
get_signal(data);
|
||||
get_operator(data);
|
||||
try_again_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_gad_gsm_init(E_Module *m)
|
||||
{
|
||||
mod = m;
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_gad_gsm_shutdown(void)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gadcon_class);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
||||
"e/modules/illume/gadget/gsm");
|
||||
evas_object_show(o);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->obj = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
|
||||
inst->strength = -1;
|
||||
inst->oper = NULL;
|
||||
|
||||
ecore_init();
|
||||
ecore_string_init();
|
||||
e_dbus_init();
|
||||
|
||||
conn = e_dbus_bus_get(DBUS_BUS_SESSION);
|
||||
conn_system = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
||||
|
||||
if (conn)
|
||||
{
|
||||
namech_h = e_dbus_signal_handler_add(conn,
|
||||
"org.freedesktop.DBus",
|
||||
"/org/freedesktop/DBus",
|
||||
"org.freedesktop.DBus",
|
||||
"NameOwnerChanged",
|
||||
name_changed, inst);
|
||||
changed_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"signalStrengthChanged",
|
||||
signal_changed, inst);
|
||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"networkOperatorChanged",
|
||||
operator_changed, inst);
|
||||
}
|
||||
if (conn_system)
|
||||
{
|
||||
namech_system_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freedesktop.DBus",
|
||||
"/org/freedesktop/DBus",
|
||||
"org.freedesktop.DBus",
|
||||
"NameOwnerChanged",
|
||||
name_changed, inst);
|
||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"SignalStrength",
|
||||
signal_changed, inst);
|
||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"Status",
|
||||
fso_operator_changed, inst);
|
||||
}
|
||||
get_signal(inst);
|
||||
get_operator(inst);
|
||||
|
||||
return gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
if (conn) e_dbus_connection_close(conn);
|
||||
if (conn_system) e_dbus_connection_close(conn_system);
|
||||
e_dbus_shutdown();
|
||||
ecore_string_shutdown();
|
||||
ecore_shutdown();
|
||||
|
||||
inst = gcc->data;
|
||||
evas_object_del(inst->obj);
|
||||
if (inst->oper) free(inst->oper);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Coord mw, mh, mxw, mxh;
|
||||
|
||||
inst = gcc->data;
|
||||
mw = 0, mh = 0;
|
||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
||||
if ((mw < 1) || (mh < 1))
|
||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
||||
if (mw < 4) mw = 4;
|
||||
if (mh < 4) mh = 4;
|
||||
if ((mxw > 0) && (mxh > 0))
|
||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return "GSM (Illume)";
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
/* FIXME: need icon
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
||||
e_module_dir_get(clock_module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
return _gadcon_class.name;
|
||||
}
|
||||
|
||||
static void
|
||||
update_operator(char *op, void *data)
|
||||
{
|
||||
Instance *inst = data;
|
||||
char *poper;
|
||||
|
||||
poper = inst->oper;
|
||||
if ((poper) && (op) && (!strcmp(op, poper))) return;
|
||||
if (op) inst->oper = strdup(op);
|
||||
else inst->oper = NULL;
|
||||
if (inst->oper != poper)
|
||||
{
|
||||
Edje_Message_String msg;
|
||||
|
||||
if (inst->oper) msg.str = inst->oper;
|
||||
else msg.str = "";
|
||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_STRING, 1, &msg);
|
||||
}
|
||||
if (poper) free(poper);
|
||||
}
|
||||
|
||||
static void
|
||||
update_signal(int sig, void *data)
|
||||
{
|
||||
Instance *inst = data;
|
||||
int pstrength;
|
||||
|
||||
pstrength = inst->strength;
|
||||
inst->strength = sig;
|
||||
|
||||
if (inst->strength != pstrength)
|
||||
{
|
||||
Edje_Message_Float msg;
|
||||
double level;
|
||||
|
||||
level = (double)inst->strength / 100.0;
|
||||
if (level < 0.0) level = 0.0;
|
||||
else if (level > 1.0) level = 1.0;
|
||||
msg.val = level;
|
||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_FLOAT, 1, &msg);
|
||||
if ((pstrength == -1) && (inst->strength >= 0))
|
||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
||||
else if ((pstrength >= 0) && (inst->strength == -1))
|
||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
signal_unmarhsall(DBusMessage *msg, DBusError *err)
|
||||
{
|
||||
dbus_int32_t val = -1;
|
||||
|
||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID))
|
||||
{
|
||||
int *val_ret;
|
||||
|
||||
val_ret = malloc(sizeof(int));
|
||||
if (val_ret)
|
||||
{
|
||||
*val_ret = val;
|
||||
return val_ret;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
operator_unmarhsall(DBusMessage *msg, DBusError *err)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
|
||||
{
|
||||
char *str_ret;
|
||||
|
||||
str_ret = malloc(strlen(str)+1);
|
||||
if (str_ret)
|
||||
{
|
||||
strcpy(str_ret, str);
|
||||
return str_ret;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
_fso_operator_unmarhsall(DBusMessage *msg)
|
||||
{
|
||||
/* We care only about the provider name right now. All the other status
|
||||
* informations get ingnored for the gadget for now */
|
||||
const char *provider, *name, *reg_stat;
|
||||
DBusMessageIter iter, a_iter, s_iter, v_iter;
|
||||
|
||||
if (!dbus_message_has_signature(msg, "a{sv}")) return NULL;
|
||||
|
||||
dbus_message_iter_init(msg, &iter);
|
||||
dbus_message_iter_recurse(&iter, &a_iter);
|
||||
while (dbus_message_iter_get_arg_type(&a_iter) != DBUS_TYPE_INVALID)
|
||||
{
|
||||
dbus_message_iter_recurse(&a_iter, &s_iter);
|
||||
dbus_message_iter_get_basic(&s_iter, &name);
|
||||
|
||||
if (strcmp(name, "registration") == 0)
|
||||
{
|
||||
dbus_message_iter_next(&s_iter);
|
||||
dbus_message_iter_recurse(&s_iter, &v_iter);
|
||||
dbus_message_iter_get_basic(&v_iter, ®_stat);
|
||||
}
|
||||
if (strcmp(name, "provider") == 0)
|
||||
{
|
||||
dbus_message_iter_next(&s_iter);
|
||||
dbus_message_iter_recurse(&s_iter, &v_iter);
|
||||
dbus_message_iter_get_basic(&v_iter, &provider);
|
||||
}
|
||||
dbus_message_iter_next(&a_iter);
|
||||
}
|
||||
|
||||
if (strcmp(reg_stat, "unregistered") == 0) provider = "No Service";
|
||||
else if (strcmp(reg_stat, "busy") == 0) provider = "Searching...";
|
||||
else if (strcmp(reg_stat, "denied") == 0) provider = "SOS only";
|
||||
|
||||
return strdup(provider);
|
||||
}
|
||||
|
||||
static void *
|
||||
fso_operator_unmarhsall(DBusMessage *msg, DBusError *err)
|
||||
{
|
||||
return _fso_operator_unmarhsall(msg);
|
||||
}
|
||||
|
||||
static void
|
||||
signal_callback_qtopia(void *data, void *ret, DBusError *err)
|
||||
{
|
||||
// printf("GSM-gadget: Qtopia signal callback called\n");
|
||||
if (ret)
|
||||
{
|
||||
int *val_ret;
|
||||
|
||||
if ((detected_system == PH_SYS_UNKNOWN) && (changed_h) && (conn))
|
||||
{
|
||||
e_dbus_signal_handler_del(conn, changed_h);
|
||||
changed_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"signalStrengthChanged",
|
||||
signal_changed, data);
|
||||
detected_system = PH_SYS_QTOPIA;
|
||||
}
|
||||
val_ret = ret;
|
||||
update_signal(*val_ret, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("GSM-gadget: Qtopia signal callback else part called\n");
|
||||
detected_system = PH_SYS_UNKNOWN;
|
||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
||||
try_again_timer = ecore_timer_add(1.0, try_again, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
signal_callback_fso(void *data, void *ret, DBusError *err)
|
||||
{
|
||||
// printf("GSM-gadget: FSO signal callback called\n");
|
||||
if (ret)
|
||||
{
|
||||
int *val_ret;
|
||||
|
||||
if ((detected_system == PH_SYS_UNKNOWN) && (changed_fso_h) && (conn_system))
|
||||
{
|
||||
e_dbus_signal_handler_del(conn_system, changed_fso_h);
|
||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"SignalStrength",
|
||||
signal_changed, data);
|
||||
detected_system = PH_SYS_FSO;
|
||||
}
|
||||
val_ret = ret;
|
||||
update_signal(*val_ret, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("GSM-gadget: FSO signal callback else part called\n");
|
||||
detected_system = PH_SYS_UNKNOWN;
|
||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
||||
try_again_timer = ecore_timer_add(1.0, try_again, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
operator_callback_qtopia(void *data, void *ret, DBusError *err)
|
||||
{
|
||||
// printf("GSM-gadget: Qtopia operator callback called\n");
|
||||
if (ret)
|
||||
{
|
||||
if ((detected_system == PH_SYS_UNKNOWN) && (operatorch_h) && (conn))
|
||||
{
|
||||
e_dbus_signal_handler_del(conn, operatorch_h);
|
||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"networkOperatorChanged",
|
||||
operator_changed, data);
|
||||
detected_system = PH_SYS_QTOPIA;
|
||||
}
|
||||
update_operator(ret, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("GSM-gadget: Qtopia operator callback else part called\n");
|
||||
detected_system = PH_SYS_UNKNOWN;
|
||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
||||
try_again_timer = ecore_timer_add(1.0, try_again, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
operator_callback_fso(void *data, void *ret, DBusError *err)
|
||||
{
|
||||
// printf("GSM-gadget: FSO operator callback called\n");
|
||||
if (ret)
|
||||
{
|
||||
if ((detected_system == PH_SYS_UNKNOWN) && (operatorch_fso_h) && (conn_system))
|
||||
{
|
||||
e_dbus_signal_handler_del(conn_system, operatorch_fso_h);
|
||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"Status",
|
||||
fso_operator_changed, data);
|
||||
detected_system = PH_SYS_FSO;
|
||||
}
|
||||
update_operator(ret, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("GSM-gadget: FSO operator callback else part called\n");
|
||||
detected_system = PH_SYS_UNKNOWN;
|
||||
if (try_again_timer) ecore_timer_del(try_again_timer);
|
||||
try_again_timer = ecore_timer_add(1.0, try_again, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
signal_result_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
operator_result_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
get_signal(void *data)
|
||||
{
|
||||
DBusMessage *msg;
|
||||
|
||||
// printf("GSM-gadget: Get signal called\n");
|
||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_QTOPIA)) && (conn))
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"signalStrength");
|
||||
if (msg)
|
||||
{
|
||||
e_dbus_method_call_send(conn, msg,
|
||||
signal_unmarhsall,
|
||||
signal_callback_qtopia,
|
||||
signal_result_free, -1, data);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_FSO)) && (conn_system))
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"GetSignalStrength");
|
||||
if (msg)
|
||||
{
|
||||
e_dbus_method_call_send(conn_system, msg,
|
||||
signal_unmarhsall,
|
||||
signal_callback_fso,
|
||||
signal_result_free, -1, data);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_operator(void *data)
|
||||
{
|
||||
DBusMessage *msg;
|
||||
|
||||
// printf("GSM-gadget: Get operator called\n");
|
||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_QTOPIA)) && (conn))
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"networkOperator");
|
||||
if (msg)
|
||||
{
|
||||
e_dbus_method_call_send(conn, msg,
|
||||
operator_unmarhsall,
|
||||
operator_callback_qtopia,
|
||||
operator_result_free, -1, data);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
if (((detected_system == PH_SYS_UNKNOWN) || (detected_system == PH_SYS_FSO)) && (conn_system))
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"GetStatus");
|
||||
if (msg)
|
||||
{
|
||||
e_dbus_method_call_send(conn_system, msg,
|
||||
fso_operator_unmarhsall,
|
||||
operator_callback_fso,
|
||||
operator_result_free, -1, data);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
signal_changed(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
dbus_int32_t val = -1;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID))
|
||||
return;
|
||||
update_signal(val, data);
|
||||
}
|
||||
|
||||
static void
|
||||
operator_changed(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
char *str = NULL;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
|
||||
return;
|
||||
update_operator(str, data);
|
||||
}
|
||||
|
||||
static void
|
||||
fso_operator_changed(void *data, DBusMessage *msg)
|
||||
{
|
||||
char *provider;
|
||||
provider = _fso_operator_unmarhsall(msg);
|
||||
update_operator(provider, data);
|
||||
}
|
||||
|
||||
static void
|
||||
name_changed(void *data, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
const char *s1, *s2, *s3;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(msg, &err,
|
||||
DBUS_TYPE_STRING, &s1,
|
||||
DBUS_TYPE_STRING, &s2,
|
||||
DBUS_TYPE_STRING, &s3,
|
||||
DBUS_TYPE_INVALID))
|
||||
return;
|
||||
if ((!strcmp(s1, "org.openmoko.qtopia.Phonestatus")) && (conn))
|
||||
{
|
||||
// printf("GSM-gadget: Qtopia name owner changed\n");
|
||||
if (changed_h)
|
||||
{
|
||||
e_dbus_signal_handler_del(conn, changed_h);
|
||||
changed_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"signalStrengthChanged",
|
||||
signal_changed, data);
|
||||
get_signal(data);
|
||||
}
|
||||
if (operatorch_h)
|
||||
{
|
||||
e_dbus_signal_handler_del(conn, operatorch_h);
|
||||
operatorch_h = e_dbus_signal_handler_add(conn,
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"/Status",
|
||||
"org.openmoko.qtopia.Phonestatus",
|
||||
"networkOperatorChanged",
|
||||
operator_changed, data);
|
||||
get_operator(data);
|
||||
}
|
||||
}
|
||||
else if ((!strcmp(s1, "org.freesmartphone.ogsmd")) && (conn_system))
|
||||
{
|
||||
// printf("GSM-gadget: FSO name owner changed\n");
|
||||
if (changed_fso_h)
|
||||
{
|
||||
e_dbus_signal_handler_del(conn_system, changed_fso_h);
|
||||
changed_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"SignalStrength",
|
||||
signal_changed, data);
|
||||
get_signal(data);
|
||||
}
|
||||
if (operatorch_fso_h)
|
||||
{
|
||||
e_dbus_signal_handler_del(conn_system, operatorch_fso_h);
|
||||
operatorch_fso_h = e_dbus_signal_handler_add(conn_system,
|
||||
"org.freesmartphone.ogsmd",
|
||||
"/org/freesmartphone/GSM/Device",
|
||||
"org.freesmartphone.GSM.Network",
|
||||
"Status",
|
||||
fso_operator_changed, data);
|
||||
get_operator(data);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_GAD_GSM_H
|
||||
#define E_MOD_GAD_GSM_H
|
||||
|
||||
void _e_mod_gad_gsm_init(E_Module *m);
|
||||
void _e_mod_gad_gsm_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,216 @@
|
|||
#include <e.h>
|
||||
|
||||
/***************************************************************************/
|
||||
typedef struct _Instance Instance;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
Ecore_Poller *poller;
|
||||
int on;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"illume-usb",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
static E_Module *mod = NULL;
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
static int _cb_poll(void *data);
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_gad_usb_init(E_Module *m)
|
||||
{
|
||||
mod = m;
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_gad_usb_shutdown(void)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gadcon_class);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
||||
"e/modules/illume/gadget/usb");
|
||||
evas_object_show(o);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->obj = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
|
||||
inst->on = -1;
|
||||
inst->poller = ecore_poller_add(ECORE_POLLER_CORE, 16, _cb_poll, inst);
|
||||
|
||||
return gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = gcc->data;
|
||||
ecore_poller_del(inst->poller);
|
||||
evas_object_del(inst->obj);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Coord mw, mh, mxw, mxh;
|
||||
|
||||
inst = gcc->data;
|
||||
mw = 0, mh = 0;
|
||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
||||
if ((mw < 1) || (mh < 1))
|
||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
||||
if (mw < 4) mw = 4;
|
||||
if (mh < 4) mh = 4;
|
||||
if ((mxw > 0) && (mxh > 0))
|
||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return "USB (Illume)";
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
/* FIXME: need icon
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
||||
e_module_dir_get(clock_module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
return _gadcon_class.name;
|
||||
}
|
||||
|
||||
static int
|
||||
_find_interface_class(int iclass)
|
||||
{
|
||||
Ecore_List *devs;
|
||||
|
||||
devs = ecore_file_ls("/sys/bus/usb/devices");
|
||||
if (devs)
|
||||
{
|
||||
char *name;
|
||||
|
||||
while ((name = ecore_list_next(devs)))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
FILE *f;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
"/sys/bus/usb/devices", name, "bInterfaceClass");
|
||||
f = fopen(buf, "r");
|
||||
if (f)
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
sscanf(buf, "%x", &id);
|
||||
if (iclass == id)
|
||||
{
|
||||
ecore_list_destroy(devs);
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
ecore_list_destroy(devs);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_poll(void *data)
|
||||
{
|
||||
Instance *inst;
|
||||
int pon;
|
||||
|
||||
inst = data;
|
||||
/* FIXME: get bt status and emit signal */
|
||||
pon = inst->on;
|
||||
inst->on = _find_interface_class(0x09);
|
||||
if (inst->on != pon)
|
||||
{
|
||||
if (inst->on)
|
||||
edje_object_signal_emit(inst->obj, "e,state,active", "e");
|
||||
else
|
||||
edje_object_signal_emit(inst->obj, "e,state,passive", "e");
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_GAD_USB_H
|
||||
#define E_MOD_GAD_USB_H
|
||||
|
||||
void _e_mod_gad_usb_init(E_Module *m);
|
||||
void _e_mod_gad_usb_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,250 @@
|
|||
#include <e.h>
|
||||
|
||||
/***************************************************************************/
|
||||
typedef struct _Instance Instance;
|
||||
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
Ecore_Exe *wifiget_exe;
|
||||
Ecore_Event_Handler *wifiget_data_handler;
|
||||
Ecore_Event_Handler *wifiget_del_handler;
|
||||
int strength;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc);
|
||||
static char *_gc_label(void);
|
||||
static Evas_Object *_gc_icon(Evas *evas);
|
||||
static const char *_gc_id_new(void);
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"illume-wifi",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
static E_Module *mod = NULL;
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
static void _wifiget_spawn(Instance *inst);
|
||||
static void _wifiget_kill(Instance *inst);
|
||||
static int _wifiget_cb_exe_data(void *data, int type, void *event);
|
||||
static int _wifiget_cb_exe_del(void *data, int type, void *event);
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_gad_wifi_init(E_Module *m)
|
||||
{
|
||||
mod = m;
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_gad_wifi_shutdown(void)
|
||||
{
|
||||
e_gadcon_provider_unregister(&_gadcon_class);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
inst = E_NEW(Instance, 1);
|
||||
o = _theme_obj_new(gc->evas, e_module_dir_get(mod),
|
||||
"e/modules/illume/gadget/wifi");
|
||||
evas_object_show(o);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = inst;
|
||||
inst->gcc = gcc;
|
||||
inst->obj = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
|
||||
inst->strength = -1;
|
||||
_wifiget_spawn(inst);
|
||||
|
||||
return gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
|
||||
inst = gcc->data;
|
||||
_wifiget_kill(inst);
|
||||
evas_object_del(inst->obj);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Instance *inst;
|
||||
Evas_Coord mw, mh, mxw, mxh;
|
||||
|
||||
inst = gcc->data;
|
||||
mw = 0, mh = 0;
|
||||
edje_object_size_min_get(inst->obj, &mw, &mh);
|
||||
edje_object_size_max_get(inst->obj, &mxw, &mxh);
|
||||
if ((mw < 1) || (mh < 1))
|
||||
edje_object_size_min_calc(inst->obj, &mw, &mh);
|
||||
if (mw < 4) mw = 4;
|
||||
if (mh < 4) mh = 4;
|
||||
if ((mxw > 0) && (mxh > 0))
|
||||
e_gadcon_client_aspect_set(gcc, mxw, mxh);
|
||||
e_gadcon_client_min_size_set(gcc, mw, mh);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return "Wifi (Illume)";
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
/* FIXME: need icon
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-clock.edj",
|
||||
e_module_dir_get(clock_module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(void)
|
||||
{
|
||||
return _gadcon_class.name;
|
||||
}
|
||||
|
||||
static void
|
||||
_wifiget_spawn(Instance *inst)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (inst->wifiget_exe) return;
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%s/%s/wifiget %i",
|
||||
e_module_dir_get(mod), MODULE_ARCH,
|
||||
8);
|
||||
inst->wifiget_exe = ecore_exe_pipe_run(buf,
|
||||
ECORE_EXE_PIPE_READ |
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
|
||||
ECORE_EXE_NOT_LEADER,
|
||||
inst);
|
||||
inst->wifiget_data_handler =
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _wifiget_cb_exe_data,
|
||||
inst);
|
||||
inst->wifiget_del_handler =
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_wifiget_cb_exe_del,
|
||||
inst);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_wifiget_kill(Instance *inst)
|
||||
{
|
||||
if (!inst->wifiget_exe) return;
|
||||
ecore_exe_terminate(inst->wifiget_exe);
|
||||
ecore_exe_free(inst->wifiget_exe);
|
||||
inst->wifiget_exe = NULL;
|
||||
ecore_event_handler_del(inst->wifiget_data_handler);
|
||||
inst->wifiget_data_handler = NULL;
|
||||
ecore_event_handler_del(inst->wifiget_del_handler);
|
||||
inst->wifiget_del_handler = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
_wifiget_cb_exe_data(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Data *ev;
|
||||
Instance *inst;
|
||||
int pstrength;
|
||||
|
||||
inst = data;
|
||||
ev = event;
|
||||
if (ev->exe != inst->wifiget_exe) return 1;
|
||||
pstrength = inst->strength;
|
||||
if ((ev->lines) && (ev->lines[0].line))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; ev->lines[i].line; i++)
|
||||
{
|
||||
if (!strcmp(ev->lines[i].line, "ERROR"))
|
||||
inst->strength = -999;
|
||||
else
|
||||
inst->strength = atoi(ev->lines[i].line);
|
||||
}
|
||||
}
|
||||
|
||||
if (inst->strength != pstrength)
|
||||
{
|
||||
Edje_Message_Float msg;
|
||||
double level;
|
||||
|
||||
level = (double)inst->strength / 100.0;
|
||||
if (level < 0.0) level = 0.0;
|
||||
else if (level > 1.0) level = 1.0;
|
||||
msg.val = level;
|
||||
edje_object_message_send(inst->obj, EDJE_MESSAGE_FLOAT, 1, &msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_wifiget_cb_exe_del(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
Instance *inst;
|
||||
|
||||
inst = data;
|
||||
ev = event;
|
||||
if (ev->exe != inst->wifiget_exe) return 1;
|
||||
inst->wifiget_exe = NULL;
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_GAD_WIFI_H
|
||||
#define E_MOD_GAD_WIFI_H
|
||||
|
||||
void _e_mod_gad_wifi_init(E_Module *m);
|
||||
void _e_mod_gad_wifi_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,813 @@
|
|||
#include <e.h>
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_layout.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
/* FIXME: THIS CODE IS UGLY. MUST FIX!!!!! */
|
||||
|
||||
#define POST_NONE 0
|
||||
#define POST_HIDE 1
|
||||
#define POST_CLOSE 2
|
||||
|
||||
typedef struct _Effect Effect;
|
||||
|
||||
struct _Effect
|
||||
{
|
||||
E_Border *border;
|
||||
Ecore_Animator *animator;
|
||||
double time_start, in;
|
||||
int direction;
|
||||
int post;
|
||||
};
|
||||
|
||||
/* internal calls */
|
||||
static int _e_mod_layout_cb_effect_animator(void *data);
|
||||
static void _e_mod_layout_effect_slide_out(E_Border *bd, double in, int post);
|
||||
static void _e_mod_layout_effect_slide_in(E_Border *bd, double in, int post);
|
||||
static void _e_mod_layout_cb_hook_post_fetch(void *data, E_Border *bd);
|
||||
static void _e_mod_layout_post_border_assign(E_Border *bd, int not_new);
|
||||
static void _e_mod_layout_cb_hook_post_border_assign(void *data, E_Border *bd);
|
||||
static void _e_mod_layout_cb_hook_end(void *data, E_Border *bd);
|
||||
static int _cb_event_border_add(void *data, int type, void *event);
|
||||
static int _cb_event_border_remove(void *data, int type, void *event);
|
||||
static int _cb_event_border_focus_in(void *data, int type, void *event);
|
||||
static int _cb_event_border_focus_out(void *data, int type, void *event);
|
||||
static int _cb_event_border_show(void *data, int type, void *event);
|
||||
static int _cb_event_border_hide(void *data, int type, void *event);
|
||||
static int _cb_event_zone_move_resize(void *data, int type, void *event);
|
||||
|
||||
/* state */
|
||||
static E_Border_Hook *hook1 = NULL;
|
||||
static E_Border_Hook *hook2 = NULL;
|
||||
static E_Border_Hook *hook3 = NULL;
|
||||
static Eina_List *handlers = NULL;
|
||||
static Eina_List *effects = NULL;
|
||||
|
||||
/* mainwin is the main big window currently focused/visible */
|
||||
static E_Border *mainwin = NULL;
|
||||
static E_Border *focuswin = NULL;
|
||||
static E_Border *dockwin = NULL;
|
||||
static int dockwin_use = 0;
|
||||
|
||||
/* called from the module core */
|
||||
void
|
||||
_e_mod_layout_init(E_Module *m)
|
||||
{
|
||||
hook1 = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH,
|
||||
_e_mod_layout_cb_hook_post_fetch, NULL);
|
||||
hook2 = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
|
||||
_e_mod_layout_cb_hook_post_border_assign, NULL);
|
||||
hook3 = e_border_hook_add(E_BORDER_HOOK_EVAL_END,
|
||||
_e_mod_layout_cb_hook_end, NULL);
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_ADD, _cb_event_border_add, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_REMOVE, _cb_event_border_remove, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_FOCUS_IN, _cb_event_border_focus_in, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_FOCUS_OUT, _cb_event_border_focus_out, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_SHOW, _cb_event_border_show, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_HIDE, _cb_event_border_hide, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_ZONE_MOVE_RESIZE, _cb_event_zone_move_resize, NULL));
|
||||
|
||||
{
|
||||
E_Zone *zone;
|
||||
unsigned int area[4];
|
||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
||||
Ecore_X_Atom *supported, *supported_new;
|
||||
int i, supported_num;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
e_slipshelf_safe_app_region_get(zone, &wx, &wy, &ww, &wh);
|
||||
e_kbd_safe_app_region_get(zone, &wx2, &wy2, &ww2, &wh2);
|
||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
||||
area[0] = wx;
|
||||
area[1] = wy;
|
||||
area[2] = ww;
|
||||
area[3] = wh;
|
||||
ecore_x_netwm_desk_workareas_set(zone->container->manager->root,
|
||||
area, 1);
|
||||
|
||||
if (ecore_x_netwm_supported_get(zone->container->manager->root,
|
||||
&supported, &supported_num))
|
||||
{
|
||||
int have_it = 0;
|
||||
|
||||
for (i = 0; i < supported_num; i++)
|
||||
{
|
||||
if (supported[i] == ECORE_X_ATOM_NET_WORKAREA)
|
||||
{
|
||||
have_it = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!have_it)
|
||||
{
|
||||
supported_new = malloc(sizeof(Ecore_X_Atom) * (supported_num + 1));
|
||||
if (supported_new)
|
||||
{
|
||||
memcpy(supported_new, supported, sizeof(Ecore_X_Atom) * supported_num);
|
||||
supported_new[supported_num] = ECORE_X_ATOM_NET_WORKAREA;
|
||||
supported_num++;
|
||||
ecore_x_netwm_supported_set(zone->container->manager->root,
|
||||
supported_new, supported_num);
|
||||
free(supported_new);
|
||||
}
|
||||
}
|
||||
free(supported);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ecore_X_Atom atom;
|
||||
|
||||
atom = ECORE_X_ATOM_NET_WORKAREA;
|
||||
ecore_x_netwm_supported_set(zone->container->manager->root,
|
||||
&atom, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_layout_shutdown(void)
|
||||
{
|
||||
if (hook1)
|
||||
{
|
||||
e_border_hook_del(hook1);
|
||||
hook1 = NULL;
|
||||
}
|
||||
if (hook2)
|
||||
{
|
||||
e_border_hook_del(hook2);
|
||||
hook2 = NULL;
|
||||
}
|
||||
if (hook3)
|
||||
{
|
||||
e_border_hook_del(hook3);
|
||||
hook3 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_layout_border_hide(E_Border *bd)
|
||||
{
|
||||
_e_mod_layout_effect_slide_out(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_HIDE);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_layout_border_close(E_Border *bd)
|
||||
{
|
||||
_e_mod_layout_effect_slide_out(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_CLOSE);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_layout_border_show(E_Border *bd)
|
||||
{
|
||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
||||
e_desk_show(bd->desk);
|
||||
e_border_uniconify(bd);
|
||||
e_border_show(bd);
|
||||
e_border_raise(bd);
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_e_mod_layout_apply_all(void)
|
||||
{
|
||||
Eina_List *l, *borders;
|
||||
|
||||
borders = e_border_client_list();
|
||||
for (l = borders; l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = l->data;
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
_e_mod_layout_post_border_assign(bd, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static int
|
||||
_e_mod_layout_cb_effect_animator(void *data)
|
||||
{
|
||||
Effect *ef;
|
||||
double t, p;
|
||||
|
||||
ef = data;
|
||||
t = ecore_time_get() - ef->time_start;
|
||||
if (ef->in > 0.0)
|
||||
{
|
||||
t /= ef->in;
|
||||
if (t > 1.0) t = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = 1.0;
|
||||
}
|
||||
|
||||
p = 1.0 - t;
|
||||
p = 1.0 - (p * p * p * p);
|
||||
|
||||
if (ef->direction == 1)
|
||||
e_border_fx_offset(ef->border, 0, (-ef->border->zone->h * (1.0 - p)));
|
||||
else
|
||||
e_border_fx_offset(ef->border, 0, (-ef->border->zone->h * p));
|
||||
|
||||
if (t >= 1.0)
|
||||
{
|
||||
if (ef->post == POST_HIDE)
|
||||
{
|
||||
e_border_iconify(ef->border);
|
||||
// e_border_focus_set(ef->border, 0, 1);
|
||||
// printf("hide - focus out\n");
|
||||
}
|
||||
else if (ef->post == POST_CLOSE)
|
||||
{
|
||||
// e_border_focus_set(ef->border, 0, 1);
|
||||
// printf("close - focus out\n");
|
||||
// e_border_iconify(ef->border);
|
||||
e_border_act_close_begin(ef->border);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("show - focus in\n");
|
||||
// e_border_focus_set(ef->border, 1, 1);
|
||||
}
|
||||
e_border_fx_offset(ef->border, 0, 0);
|
||||
effects = eina_list_remove(effects, ef);
|
||||
free(ef);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_effect_slide_out(E_Border *bd, double in, int post)
|
||||
{
|
||||
Effect *ef;
|
||||
|
||||
ef = E_NEW(Effect, 1);
|
||||
ef->border = bd;
|
||||
ef->animator = ecore_animator_add(_e_mod_layout_cb_effect_animator, ef);
|
||||
ef->time_start = ecore_time_get();
|
||||
ef->in = in;
|
||||
ef->direction = 0;
|
||||
ef->post = post;
|
||||
effects = eina_list_append(effects, ef);
|
||||
|
||||
e_border_fx_offset(ef->border, 0, 0);
|
||||
if (in <= 0.0)
|
||||
{
|
||||
ef->animator = ecore_animator_del(ef->animator);
|
||||
ef->animator = NULL;
|
||||
_e_mod_layout_cb_effect_animator(ef);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_effect_slide_in(E_Border *bd, double in, int post)
|
||||
{
|
||||
Effect *ef;
|
||||
|
||||
ef = E_NEW(Effect, 1);
|
||||
ef->border = bd;
|
||||
ef->animator = ecore_animator_add(_e_mod_layout_cb_effect_animator, ef);
|
||||
ef->time_start = ecore_time_get();
|
||||
ef->in = in;
|
||||
ef->direction = 1;
|
||||
ef->post = post;
|
||||
effects = eina_list_append(effects, ef);
|
||||
|
||||
if (ef->border->iconic)
|
||||
e_border_uniconify(ef->border);
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
e_border_fx_offset(ef->border, 0, -ef->border->zone->h);
|
||||
if (in <= 0.0)
|
||||
{
|
||||
ef->animator = ecore_animator_del(ef->animator);
|
||||
ef->animator = NULL;
|
||||
_e_mod_layout_cb_effect_animator(ef);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static Ecore_Timer *_dockwin_hide_timer = NULL;
|
||||
|
||||
static int
|
||||
_e_mod_layout_cb_docwin_hide(void *data)
|
||||
{
|
||||
_dockwin_hide_timer = NULL;
|
||||
if (!dockwin) return 0;
|
||||
e_border_hide(dockwin, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_dockwin_show(void)
|
||||
{
|
||||
// if (dockwin_use) return;
|
||||
dockwin_use = 1;
|
||||
if (_dockwin_hide_timer)
|
||||
{
|
||||
ecore_timer_del(_dockwin_hide_timer);
|
||||
_dockwin_hide_timer = NULL;
|
||||
}
|
||||
if (!dockwin) return;
|
||||
e_border_show(dockwin);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_dockwin_hide(void)
|
||||
{
|
||||
// if (!dockwin_use) return;
|
||||
dockwin_use = 0;
|
||||
if (_dockwin_hide_timer) ecore_timer_del(_dockwin_hide_timer);
|
||||
_dockwin_hide_timer = ecore_timer_add(0.2, _e_mod_layout_cb_docwin_hide, NULL);
|
||||
/*
|
||||
if (!dockwin) return;
|
||||
e_border_hide(dockwin, 2);
|
||||
*/
|
||||
}
|
||||
|
||||
static int
|
||||
_is_dialog(E_Border *bd)
|
||||
{
|
||||
int isdialog = 0, i;
|
||||
|
||||
if (bd->client.icccm.transient_for != 0)
|
||||
isdialog = 1;
|
||||
if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
|
||||
{
|
||||
isdialog = 1;
|
||||
if (bd->client.netwm.extra_types)
|
||||
{
|
||||
for (i = 0; i < bd->client.netwm.extra_types_num; i++)
|
||||
{
|
||||
if (bd->client.netwm.extra_types[i] ==
|
||||
ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
|
||||
if ((bd->client.netwm.extra_types[i] !=
|
||||
ECORE_X_WINDOW_TYPE_DIALOG) &&
|
||||
(bd->client.netwm.extra_types[i] !=
|
||||
ECORE_X_WINDOW_TYPE_SPLASH))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isdialog;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_fetch(void *data, E_Border *bd)
|
||||
{
|
||||
if (bd->stolen) return;
|
||||
if (bd->new_client)
|
||||
{
|
||||
if (bd->remember)
|
||||
{
|
||||
if (bd->bordername)
|
||||
{
|
||||
evas_stringshare_del(bd->bordername);
|
||||
bd->bordername = NULL;
|
||||
bd->client.border.changed = 1;
|
||||
}
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
if (!_is_dialog(bd))
|
||||
{
|
||||
if (bd->bordername) evas_stringshare_del(bd->bordername);
|
||||
bd->bordername = evas_stringshare_add("borderless");
|
||||
bd->client.border.changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_post_border_assign(E_Border *bd, int not_new)
|
||||
{
|
||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
||||
int center = 0;
|
||||
int isdialog = 0;
|
||||
int pbx, pby, pbw, pbh;
|
||||
|
||||
if (bd->stolen) return;
|
||||
/* FIXME: make some modification based on policy */
|
||||
if ((bd->new_client) && (not_new)) return;
|
||||
pbx = bd->x;
|
||||
pby = bd->y;
|
||||
pbw = bd->w;
|
||||
pbh = bd->h;
|
||||
isdialog = _is_dialog(bd);
|
||||
e_slipshelf_safe_app_region_get(bd->zone, &wx, &wy, &ww, &wh);
|
||||
e_kbd_safe_app_region_get(bd->zone, &wx2, &wy2, &ww2, &wh2);
|
||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
||||
if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
|
||||
(bd->client.qtopia.soft_menu))
|
||||
{
|
||||
{
|
||||
unsigned int area[4];
|
||||
|
||||
dockwin = bd;
|
||||
dockwin->lock_focus_out = 1;
|
||||
area[0] = wx;
|
||||
area[1] = wy;
|
||||
area[2] = ww;
|
||||
area[3] = wh - bd->h;
|
||||
ecore_x_netwm_desk_workareas_set(bd->zone->container->manager->root,
|
||||
area, 1);
|
||||
// wy = wy + wh - bd->h;
|
||||
// wh = bd->h;
|
||||
if (bd->new_client)
|
||||
{
|
||||
_e_mod_layout_dockwin_show();
|
||||
_e_mod_layout_dockwin_hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isdialog)
|
||||
{
|
||||
if (dockwin)
|
||||
{
|
||||
wh -= dockwin->h;
|
||||
}
|
||||
// if (ww > (bd->client.icccm.min_w + bd->client_inset.l + bd->client_inset.r))
|
||||
// ww = bd->client.icccm.min_w + bd->client_inset.l + bd->client_inset.r;
|
||||
bd->w = ww;
|
||||
if (bd->client.h < bd->client.icccm.min_h)
|
||||
bd->h = bd->client.icccm.min_h +
|
||||
bd->client_inset.t + bd->client_inset.b;
|
||||
if (bd->h > wh) bd->h = wh;
|
||||
bd->client.w = bd->w - bd->client_inset.l - bd->client_inset.r;
|
||||
bd->client.h = bd->h - bd->client_inset.t - bd->client_inset.b;
|
||||
bd->changes.size = 1;
|
||||
// if (bd->client.icccm.max_w < bd->client.w)
|
||||
// bd->client.icccm.max_w = bd->client.w;
|
||||
// if (bd->client.icccm.base_w > bd->client.w)
|
||||
// bd->client.icccm.base_w = bd->client.w;
|
||||
// if (bd->client.icccm.base_h > (wh - bd->client_inset.t - bd->client_inset.b))
|
||||
// bd->client.icccm.base_h = wh - bd->client_inset.t - bd->client_inset.b;
|
||||
// if (bd->client.icccm.min_w > bd->client.w)
|
||||
// bd->client.icccm.min_w = bd->client.w;
|
||||
// if (bd->client.icccm.min_h > (wh - bd->client_inset.t - bd->client_inset.b))
|
||||
// bd->client.icccm.min_h = wh - bd->client_inset.t - bd->client_inset.b;
|
||||
if (bd->new_client)
|
||||
{
|
||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((dockwin) && (dockwin->client.qtopia.soft_menu) &&
|
||||
(bd->client.qtopia.soft_menus))
|
||||
{
|
||||
wh -= dockwin->h;
|
||||
}
|
||||
if (bd->new_client)
|
||||
{
|
||||
_e_mod_layout_effect_slide_in(bd, (double)illume_cfg->sliding.layout.duration / 1000.0, POST_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (bd == dockwin)
|
||||
{
|
||||
bd->x = 0;
|
||||
bd->y = wy + wh - bd->h;
|
||||
bd->w = ww;
|
||||
bd->h = bd->h;
|
||||
|
||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
||||
(pbw != bd->w) || (pbh != bd->h))
|
||||
{
|
||||
if (bd->internal_ecore_evas)
|
||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t);
|
||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t,
|
||||
bd->client.w,
|
||||
bd->client.h);
|
||||
bd->changed = 1;
|
||||
bd->changes.pos = 1;
|
||||
bd->changes.size = 1;
|
||||
}
|
||||
|
||||
bd->lock_border = 1;
|
||||
|
||||
bd->lock_client_location = 1;
|
||||
bd->lock_client_size = 1;
|
||||
// bd->lock_client_stacking = 1;
|
||||
bd->lock_client_desk = 1;
|
||||
bd->lock_client_sticky = 1;
|
||||
bd->lock_client_shade = 1;
|
||||
bd->lock_client_maximize = 1;
|
||||
|
||||
bd->lock_user_location = 1;
|
||||
bd->lock_user_size = 1;
|
||||
// bd->lock_user_stacking = 1;
|
||||
bd->lock_user_desk = 1;
|
||||
bd->lock_user_sticky = 1;
|
||||
bd->lock_user_shade = 1;
|
||||
bd->lock_user_maximize = 1;
|
||||
}
|
||||
else if (isdialog)
|
||||
{
|
||||
// if (bd->new_client)
|
||||
{
|
||||
bd->client.e.state.centered = 0;
|
||||
if (bd->new_client)
|
||||
{
|
||||
bd->x = wx + ((ww - bd->w) / 2);
|
||||
bd->y = wy + ((wh - bd->h) / 2);
|
||||
}
|
||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
||||
(pbw != bd->w) || (pbh != bd->h))
|
||||
{
|
||||
if (bd->internal_ecore_evas)
|
||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t);
|
||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t,
|
||||
bd->client.w,
|
||||
bd->client.h);
|
||||
bd->changed = 1;
|
||||
bd->changes.pos = 1;
|
||||
}
|
||||
if (bd->remember)
|
||||
{
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
}
|
||||
bd->placed = 1;
|
||||
|
||||
bd->lock_border = 1;
|
||||
|
||||
bd->lock_client_location = 1;
|
||||
// bd->lock_client_size = 1;
|
||||
bd->lock_client_desk = 1;
|
||||
bd->lock_client_sticky = 1;
|
||||
bd->lock_client_shade = 1;
|
||||
bd->lock_client_maximize = 1;
|
||||
|
||||
bd->lock_user_location = 1;
|
||||
bd->lock_user_size = 1;
|
||||
// bd->lock_user_desk = 1;
|
||||
// bd->lock_user_sticky = 1;
|
||||
bd->lock_user_shade = 1;
|
||||
bd->lock_user_maximize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bd->placed = 1;
|
||||
if (bd->focused)
|
||||
{
|
||||
if ((bd->need_fullscreen) || (bd->fullscreen)) e_kbd_fullscreen_set(bd->zone, 1);
|
||||
else e_kbd_fullscreen_set(bd->zone, 0);
|
||||
}
|
||||
if (!((bd->need_fullscreen) || (bd->fullscreen)))
|
||||
{
|
||||
e_kbd_fullscreen_set(bd->zone, 0);
|
||||
bd->x = wx;
|
||||
bd->y = wy;
|
||||
bd->w = ww;
|
||||
bd->h = wh;
|
||||
bd->client.w = bd->w;
|
||||
bd->client.h = bd->h;
|
||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
||||
(pbw != bd->w) || (pbh != bd->h))
|
||||
{
|
||||
if (bd->internal_ecore_evas)
|
||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t);
|
||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t,
|
||||
bd->client.w,
|
||||
bd->client.h);
|
||||
bd->changed = 1;
|
||||
bd->changes.pos = 1;
|
||||
bd->changes.size = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bd->x = wx2;
|
||||
bd->y = wy2;
|
||||
bd->w = ww2;
|
||||
bd->h = wh2;
|
||||
bd->client.w = bd->w;
|
||||
bd->client.h = bd->h;
|
||||
if ((pbx != bd->x) || (pby != bd->y) ||
|
||||
(pbw != bd->w) || (pbh != bd->h))
|
||||
{
|
||||
if (bd->internal_ecore_evas)
|
||||
ecore_evas_managed_move(bd->internal_ecore_evas,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t);
|
||||
ecore_x_icccm_move_resize_send(bd->client.win,
|
||||
bd->x + bd->fx.x + bd->client_inset.l,
|
||||
bd->y + bd->fx.y + bd->client_inset.t,
|
||||
bd->client.w,
|
||||
bd->client.h);
|
||||
bd->changed = 1;
|
||||
bd->changes.pos = 1;
|
||||
bd->changes.size = 1;
|
||||
}
|
||||
}
|
||||
if (bd->remember)
|
||||
{
|
||||
e_remember_unuse(bd->remember);
|
||||
bd->remember = NULL;
|
||||
}
|
||||
bd->lock_border = 1;
|
||||
|
||||
bd->lock_client_location = 1;
|
||||
bd->lock_client_size = 1;
|
||||
// bd->lock_client_stacking = 1;
|
||||
bd->lock_client_desk = 1;
|
||||
bd->lock_client_sticky = 1;
|
||||
bd->lock_client_shade = 1;
|
||||
bd->lock_client_maximize = 1;
|
||||
|
||||
bd->lock_user_location = 1;
|
||||
bd->lock_user_size = 1;
|
||||
// bd->lock_user_stacking = 1;
|
||||
// bd->lock_user_desk = 1;
|
||||
bd->lock_user_sticky = 1;
|
||||
// bd->lock_user_shade = 1;
|
||||
// bd->lock_user_maximize = 1;
|
||||
|
||||
bd->client.icccm.base_w = 1;
|
||||
bd->client.icccm.base_h = 1;
|
||||
bd->client.icccm.min_w = 1;
|
||||
bd->client.icccm.min_h = 1;
|
||||
bd->client.icccm.max_w = 32767;
|
||||
bd->client.icccm.max_h = 32767;
|
||||
bd->client.icccm.min_aspect = 0.0;
|
||||
bd->client.icccm.max_aspect = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_post_border_assign(void *data, E_Border *bd)
|
||||
{
|
||||
_e_mod_layout_post_border_assign(bd, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_layout_cb_hook_end(void *data, E_Border *bd)
|
||||
{
|
||||
if (bd->stolen) return;
|
||||
if ((bd == dockwin) && (!dockwin_use) && (dockwin->visible))
|
||||
_e_mod_layout_dockwin_hide();
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_add(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_remove(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
Eina_List *l, *pl;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
if (ev->border == dockwin)
|
||||
{
|
||||
unsigned int area[4];
|
||||
int wx = 0, wy = 0, ww = 0, wh = 0;
|
||||
int wx2 = 0, wy2 = 0, ww2 = 0, wh2 = 0;
|
||||
|
||||
dockwin = NULL;
|
||||
dockwin_use = 0;
|
||||
e_slipshelf_safe_app_region_get(ev->border->zone, &wx, &wy, &ww, &wh);
|
||||
e_kbd_safe_app_region_get(ev->border->zone, &wx2, &wy2, &ww2, &wh2);
|
||||
E_RECTS_CLIP_TO_RECT(wx, wy, ww, wh, wx2, wy2, ww2, wh2);
|
||||
area[0] = wx;
|
||||
area[1] = wy;
|
||||
area[2] = ww;
|
||||
area[3] = wh;
|
||||
ecore_x_netwm_desk_workareas_set(ev->border->zone->container->manager->root,
|
||||
area, 1);
|
||||
}
|
||||
for (l = effects; l;)
|
||||
{
|
||||
Effect *ef;
|
||||
|
||||
ef = l->data;
|
||||
pl = l;
|
||||
l = l->next;
|
||||
if (ef->border == ev->border)
|
||||
{
|
||||
effects = eina_list_remove_list(effects, pl);
|
||||
ecore_animator_del(ef->animator);
|
||||
free(ef);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_focus_in(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_In *ev;
|
||||
E_Border *bd;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
bd = ev->border;
|
||||
if (bd != dockwin)
|
||||
{
|
||||
if (bd->client.qtopia.soft_menus)
|
||||
{
|
||||
if ((dockwin) && (!dockwin_use) && (dockwin->client.qtopia.soft_menu))
|
||||
_e_mod_layout_dockwin_show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((dockwin) && (dockwin_use) && (dockwin->client.qtopia.soft_menu))
|
||||
_e_mod_layout_dockwin_hide();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_focus_out(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Focus_Out *ev;
|
||||
E_Border *bd;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
bd = ev->border;
|
||||
if (bd != dockwin)
|
||||
{
|
||||
if (bd->client.qtopia.soft_menus)
|
||||
{
|
||||
if ((dockwin) && (dockwin_use) && (dockwin->client.qtopia.soft_menu))
|
||||
_e_mod_layout_dockwin_hide();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_show(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Show *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_border_hide(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Hide *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->border->stolen) return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
|
||||
ev = event;
|
||||
_e_mod_layout_apply_all();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef E_MOD_LAYOUT_H
|
||||
#define E_MOD_LAYOUT_H
|
||||
|
||||
void _e_mod_layout_init(E_Module *m);
|
||||
void _e_mod_layout_shutdown(void);
|
||||
void _e_mod_layout_border_hide(E_Border *bd);
|
||||
void _e_mod_layout_border_close(E_Border *bd);
|
||||
void _e_mod_layout_border_show(E_Border *bd);
|
||||
|
||||
void _e_mod_layout_apply_all(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,90 @@
|
|||
#include <e.h>
|
||||
|
||||
#include "e_cfg.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_slipshelf.h"
|
||||
#include "e_slipwin.h"
|
||||
#include "e_pwr.h"
|
||||
#include "e_busywin.h"
|
||||
#include "e_simplelock.h"
|
||||
#include "e_flaunch.h"
|
||||
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_layout.h"
|
||||
#include "e_mod_win.h"
|
||||
|
||||
#include "e_mod_gad_wifi.h"
|
||||
#include "e_mod_gad_gsm.h"
|
||||
#include "e_mod_gad_usb.h"
|
||||
#include "e_mod_gad_bluetooth.h"
|
||||
|
||||
/* this is needed to advertise a label for the module IN the code (not just
|
||||
* the .desktop file) but more specifically the api version it was compiled
|
||||
* for so E can skip modules that are compiled for an incorrect API version
|
||||
* safely) */
|
||||
EAPI E_Module_Api e_modapi =
|
||||
{
|
||||
E_MODULE_API_VERSION, "Illume"
|
||||
};
|
||||
|
||||
/* called first thing when E inits the module */
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
|
||||
bindtextdomain(PACKAGE, buf);
|
||||
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
||||
|
||||
/* set up the virtual keyboard */
|
||||
e_cfg_init(m);
|
||||
e_kbd_init(m);
|
||||
e_busywin_init();
|
||||
e_slipshelf_init();
|
||||
e_slipwin_init();
|
||||
e_pwr_init();
|
||||
e_flaunch_init();
|
||||
e_simplelock_init(m);
|
||||
_e_mod_layout_init(m);
|
||||
_e_mod_win_init(m);
|
||||
|
||||
_e_mod_gad_wifi_init(m);
|
||||
_e_mod_gad_gsm_init(m);
|
||||
_e_mod_gad_usb_init(m);
|
||||
_e_mod_gad_bluetooth_init(m);
|
||||
_e_mod_gad_cfg_init(m);
|
||||
|
||||
return m; /* return NULL on failure, anything else on success. the pointer
|
||||
* returned will be set as m->data for convenience tracking */
|
||||
}
|
||||
|
||||
/* called on module shutdown - should clean up EVERYTHING or we leak */
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
_e_mod_gad_cfg_shutdown();
|
||||
_e_mod_gad_bluetooth_shutdown();
|
||||
_e_mod_gad_usb_shutdown();
|
||||
_e_mod_gad_gsm_shutdown();
|
||||
_e_mod_gad_wifi_shutdown();
|
||||
|
||||
_e_mod_win_shutdown();
|
||||
_e_mod_layout_shutdown();
|
||||
e_simplelock_shutdown();
|
||||
e_flaunch_shutdown();
|
||||
e_pwr_shutdown();
|
||||
e_slipwin_shutdown();
|
||||
e_slipshelf_shutdown();
|
||||
e_busywin_shutdown();
|
||||
e_kbd_shutdown();
|
||||
e_cfg_shutdown();
|
||||
return 1; /* 1 for success, 0 for failure */
|
||||
}
|
||||
|
||||
/* called by E when it thinks this module shoudl go save any config it has */
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return e_cfg_save(); /* 1 for success, 0 for failure */
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#define D_(str) dgettext(PACKAGE, str)
|
||||
|
||||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
EAPI void *e_modapi_init(E_Module *m);
|
||||
EAPI int e_modapi_shutdown(E_Module *m);
|
||||
EAPI int e_modapi_save(E_Module *m);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef E_MOD_WIN_H
|
||||
#define E_MOD_WIN_H
|
||||
|
||||
#include "e_slipshelf.h"
|
||||
|
||||
void _e_mod_win_init(E_Module *m);
|
||||
void _e_mod_win_shutdown(void);
|
||||
|
||||
void _e_mod_win_cfg_update(void);
|
||||
void _e_mod_win_slipshelf_cfg_update(void);
|
||||
|
||||
void e_mod_win_cfg_kbd_start(void);
|
||||
void e_mod_win_cfg_kbd_stop(void);
|
||||
void e_mod_win_cfg_kbd_update(void);
|
||||
|
||||
extern E_Slipshelf *slipshelf;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,197 @@
|
|||
#include <e.h>
|
||||
#include "e_pwr.h"
|
||||
#include "e_cfg.h"
|
||||
|
||||
/* internal calls */
|
||||
static void _system_req_state(const char *state);
|
||||
static void _system_unreq_state(void);
|
||||
static int _cb_saver(void *data, int ev_type, void *ev);
|
||||
|
||||
/* state */
|
||||
static Ecore_Event_Handler *save_handler = NULL;
|
||||
static Ecore_Timer *suspend_timer = NULL;
|
||||
static Ecore_X_Window coverwin = 0;
|
||||
static int suspended = 0;
|
||||
static int init_going = 0;
|
||||
|
||||
static E_DBus_Connection *conn = NULL;
|
||||
|
||||
/* called from the module core */
|
||||
EAPI int
|
||||
e_pwr_init(void)
|
||||
{
|
||||
save_handler = ecore_event_handler_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY,
|
||||
_cb_saver, NULL);
|
||||
|
||||
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
||||
_system_req_state("on");
|
||||
e_pwr_cfg_update();
|
||||
init_going = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_pwr_shutdown(void)
|
||||
{
|
||||
ecore_event_handler_del(save_handler);
|
||||
save_handler = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_pwr_cfg_update(void)
|
||||
{
|
||||
if (suspend_timer)
|
||||
{
|
||||
ecore_timer_del(suspend_timer);
|
||||
suspend_timer = NULL;
|
||||
}
|
||||
e_screensaver_init();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_pwr_init_done(void)
|
||||
{
|
||||
if (!init_going) return;
|
||||
|
||||
ecore_x_test_fake_key_down("Shift_L"); // fake a key to keep screensaver up
|
||||
ecore_x_test_fake_key_up("Shift_L"); // fake a key to keep screensaver up
|
||||
_system_unreq_state();
|
||||
init_going = 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void
|
||||
_system_req_state(const char *state)
|
||||
{
|
||||
DBusMessage *msg;
|
||||
|
||||
if (!conn) printf("@@ NO SYSTEM DBUS FOR OMPOWER\n");
|
||||
else
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.openmoko.Power",
|
||||
"/",
|
||||
"org.openmoko.Power.Core",
|
||||
"RequestResourceState");
|
||||
if (msg)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
const char *str;
|
||||
|
||||
dbus_message_iter_init_append(msg, &iter);
|
||||
str = "cpu";
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
||||
str = "illume";
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
||||
str = state;
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
||||
e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_system_unreq_state(void)
|
||||
{
|
||||
DBusMessage *msg;
|
||||
|
||||
if (!conn) printf("@@ NO SYSTEM DBUS FOR OMPOWER\n");
|
||||
else
|
||||
{
|
||||
msg = dbus_message_new_method_call("org.openmoko.Power",
|
||||
"/",
|
||||
"org.openmoko.Power.Core",
|
||||
"RemoveRequestedResourceState");
|
||||
if (msg)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
const char *str;
|
||||
|
||||
dbus_message_iter_init_append(msg, &iter);
|
||||
str = "cpu";
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
||||
str = "illume";
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str);
|
||||
e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static int
|
||||
_cb_suspend(void *data)
|
||||
{
|
||||
suspended = 1;
|
||||
|
||||
/* FIXME: should be config */
|
||||
if (illume_cfg->power.auto_suspend)
|
||||
{
|
||||
printf("@@ SUSPEND NOW!\n");
|
||||
_system_req_state("off");
|
||||
// ecore_exe_run("apm -s", NULL);
|
||||
}
|
||||
suspend_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_saver(void *data, int ev_type, void *ev)
|
||||
{
|
||||
Ecore_X_Event_Screensaver_Notify *event;
|
||||
|
||||
event = ev;
|
||||
if (event->on)
|
||||
{
|
||||
if (init_going)
|
||||
{
|
||||
ecore_x_test_fake_key_down("Shift_L"); // fake a key to keep screensaver up
|
||||
ecore_x_test_fake_key_up("Shift_L"); // fake a key to keep screensaver up
|
||||
return 1;
|
||||
}
|
||||
if (!coverwin)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
zone = e_util_container_zone_number_get(0, 0);
|
||||
if (zone)
|
||||
{
|
||||
coverwin = ecore_x_window_input_new(zone->container->win,
|
||||
zone->x, zone->y,
|
||||
zone->w, zone->h);
|
||||
ecore_x_window_show(coverwin);
|
||||
}
|
||||
}
|
||||
if (suspend_timer)
|
||||
{
|
||||
ecore_timer_del(suspend_timer);
|
||||
suspend_timer = NULL;
|
||||
}
|
||||
if (illume_cfg->power.auto_suspend)
|
||||
{
|
||||
suspend_timer = ecore_timer_add(illume_cfg->power.auto_suspend_delay, _cb_suspend, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_system_unreq_state();
|
||||
if (coverwin)
|
||||
{
|
||||
ecore_x_window_del(coverwin);
|
||||
coverwin = 0;
|
||||
}
|
||||
if (suspend_timer)
|
||||
{
|
||||
ecore_timer_del(suspend_timer);
|
||||
suspend_timer = NULL;
|
||||
}
|
||||
if (suspended)
|
||||
{
|
||||
printf("@@ UNSUSPEND\n");
|
||||
suspended = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef E_PWR_H
|
||||
#define E_PWR_H
|
||||
|
||||
EAPI int e_pwr_init(void);
|
||||
EAPI int e_pwr_shutdown(void);
|
||||
|
||||
EAPI void e_pwr_cfg_update(void);
|
||||
EAPI void e_pwr_init_done(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,262 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
#include "e_simplelock.h"
|
||||
|
||||
/**************************** private data ******************************/
|
||||
typedef struct _E_Simplelock_Data E_Simplelock_Data;
|
||||
|
||||
struct _E_Simplelock_Data
|
||||
{
|
||||
E_Popup *popup;
|
||||
Evas_Object *base_obj;
|
||||
Ecore_X_Window win;
|
||||
E_Zone *zone;
|
||||
};
|
||||
|
||||
static void _e_action_simplelock_cb(E_Object *obj, const char *params);
|
||||
static int _e_simplelock_cb_key_down(void *data, int type, void *event);
|
||||
static int _e_simplelock_cb_key_up(void *data, int type, void *event);
|
||||
|
||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
||||
|
||||
static E_Module *mod = NULL;
|
||||
|
||||
static Eina_List *locks = NULL;
|
||||
static Ecore_X_Window grab_win;
|
||||
static Eina_List *handlers = NULL;
|
||||
|
||||
/***********************************************************************/
|
||||
static void
|
||||
_e_action_simplelock_cb(E_Object *obj, const char *params)
|
||||
{
|
||||
if (locks)
|
||||
e_simplelock_hide();
|
||||
else
|
||||
e_simplelock_show();
|
||||
}
|
||||
|
||||
static int
|
||||
_e_simplelock_cb_key_down(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Key_Down *ev;
|
||||
E_Action *act;
|
||||
Eina_List *l;
|
||||
E_Config_Binding_Key *bind;
|
||||
E_Binding_Modifier mod;
|
||||
|
||||
ev = event;
|
||||
if (ev->event_win != grab_win) return 1;
|
||||
for (l = e_config->key_bindings; l; l = l->next)
|
||||
{
|
||||
bind = l->data;
|
||||
|
||||
if (bind->action && strcmp(bind->action,"simple_lock")) continue;
|
||||
|
||||
mod = 0;
|
||||
|
||||
if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
|
||||
if (ev->modifiers & ECORE_X_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
|
||||
if (ev->modifiers & ECORE_X_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
|
||||
if (ev->modifiers & ECORE_X_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
|
||||
|
||||
if (bind->key && (!strcmp(bind->key, ev->keyname)) &&
|
||||
((bind->modifiers == mod) || (bind->any_mod)))
|
||||
{
|
||||
act = e_action_find(bind->action);
|
||||
|
||||
if (!act) continue;
|
||||
e_simplelock_hide();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_simplelock_cb_key_up(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Key_Up *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->event_win != grab_win) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_simplelock_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
Eina_List *l;
|
||||
|
||||
ev = event;
|
||||
for (l = locks; l; l = l->next)
|
||||
{
|
||||
E_Simplelock_Data *esl;
|
||||
|
||||
esl = l->data;
|
||||
if (esl->zone == ev->zone)
|
||||
{
|
||||
Evas_Coord minw, minh, mw, mh, ww, hh;
|
||||
|
||||
edje_object_size_min_get(esl->base_obj, &minw, &minh);
|
||||
edje_object_size_min_calc(esl->base_obj, &mw, &mh);
|
||||
ww = esl->zone->w;
|
||||
if (minw == 1) ww = mw;
|
||||
hh = esl->zone->h;
|
||||
if (minh == 1) hh = mh;
|
||||
e_popup_move_resize(esl->popup,
|
||||
esl->zone->x + ((esl->zone->w - ww) / 2),
|
||||
esl->zone->y + ((esl->zone->h - hh) / 2),
|
||||
ww, hh);
|
||||
evas_object_resize(esl->base_obj, esl->popup->w, esl->popup->h);
|
||||
ecore_x_window_move_resize(esl->win,
|
||||
esl->zone->x, esl->zone->y,
|
||||
esl->zone->w, esl->zone->h);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
EAPI int
|
||||
e_simplelock_init(E_Module *m)
|
||||
{
|
||||
E_Action *act;
|
||||
|
||||
mod = m;
|
||||
|
||||
act = e_action_add("simple_lock");
|
||||
if (act)
|
||||
{
|
||||
act->func.go = _e_action_simplelock_cb;
|
||||
e_action_predef_name_set("Desktop", "Desktop Simple Lock",
|
||||
"simple_lock", NULL, NULL, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_simplelock_shutdown(void)
|
||||
{
|
||||
e_simplelock_hide();
|
||||
e_action_predef_name_del("Desktop", "Simple Lock");
|
||||
e_action_del("simple_lock");
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_simplelock_show(void)
|
||||
{
|
||||
Eina_List *managers, *l, *l2, *l3;
|
||||
|
||||
if (locks) return;
|
||||
for (l = e_manager_list(); l; l = l->next)
|
||||
{
|
||||
E_Manager *man;
|
||||
|
||||
man = l->data;
|
||||
for (l2 = man->containers; l2; l2 = l2->next)
|
||||
{
|
||||
E_Container *con;
|
||||
|
||||
con = l2->data;
|
||||
for (l3 = con->zones; l3; l3 = l3->next)
|
||||
{
|
||||
E_Simplelock_Data *esl;
|
||||
E_Zone *zone;
|
||||
Evas_Coord mw, mh, minw = 0, minh = 0;
|
||||
int ww, hh;
|
||||
|
||||
zone = l3->data;
|
||||
esl = E_NEW(E_Simplelock_Data, 1);
|
||||
esl->zone = zone;
|
||||
esl->win = ecore_x_window_input_new(zone->container->win,
|
||||
zone->x, zone->y,
|
||||
zone->w, zone->h);
|
||||
ecore_x_window_show(esl->win);
|
||||
if (!grab_win) grab_win = esl->win;
|
||||
esl->popup = e_popup_new(zone, -1, -1, 1, 1);
|
||||
e_popup_layer_set(esl->popup, 250);
|
||||
esl->base_obj = _theme_obj_new(esl->popup->evas,
|
||||
e_module_dir_get(mod),
|
||||
"e/modules/simplelock/base/default");
|
||||
edje_object_size_min_get(esl->base_obj, &minw, &minh);
|
||||
edje_object_part_text_set(esl->base_obj,
|
||||
"e.text.label", "LOCKED");
|
||||
edje_object_size_min_calc(esl->base_obj, &mw, &mh);
|
||||
ww = zone->w;
|
||||
if (minw == 1) ww = mw;
|
||||
hh = zone->h;
|
||||
if (minh == 1) hh = mh;
|
||||
e_popup_move_resize(esl->popup,
|
||||
zone->x + ((zone->w - ww) / 2),
|
||||
zone->y + ((zone->h - hh) / 2),
|
||||
ww, hh);
|
||||
evas_object_resize(esl->base_obj, esl->popup->w, esl->popup->h);
|
||||
e_popup_edje_bg_object_set(esl->popup, esl->base_obj);
|
||||
evas_object_show(esl->base_obj);
|
||||
|
||||
e_popup_show(esl->popup);
|
||||
|
||||
locks = eina_list_append(locks, esl);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!e_grabinput_get(grab_win, 0, grab_win))
|
||||
{
|
||||
e_simplelock_hide();
|
||||
return 0;
|
||||
}
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(ECORE_X_EVENT_KEY_DOWN, _e_simplelock_cb_key_down, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(ECORE_X_EVENT_KEY_UP, _e_simplelock_cb_key_up, NULL));
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_ZONE_MOVE_RESIZE, _e_simplelock_cb_zone_move_resize, NULL));
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_simplelock_hide(void)
|
||||
{
|
||||
if (!locks) return;
|
||||
e_grabinput_release(grab_win, grab_win);
|
||||
while (locks)
|
||||
{
|
||||
E_Simplelock_Data *esl;
|
||||
|
||||
esl = locks->data;
|
||||
e_object_del(E_OBJECT(esl->popup));
|
||||
ecore_x_window_del(esl->win);
|
||||
free(esl);
|
||||
locks = eina_list_remove_list(locks, locks);
|
||||
}
|
||||
grab_win = 0;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
|
||||
#else
|
||||
#ifndef E_SIMPLELOCK_H
|
||||
#define E_SIMPLELOCK_H
|
||||
|
||||
EAPI int e_simplelock_init(E_Module *m);
|
||||
EAPI int e_simplelock_shutdown(void);
|
||||
|
||||
EAPI int e_simplelock_show(void);
|
||||
EAPI void e_simplelock_hide(void);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,90 @@
|
|||
#ifndef E_SLIPSHELF_H
|
||||
#define E_SLIPSHELF_H
|
||||
|
||||
typedef struct _E_Slipshelf E_Slipshelf;
|
||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Add;
|
||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Del;
|
||||
typedef struct _E_Event_Slipshelf_Simple E_Event_Slipshelf_Change;
|
||||
|
||||
#define E_SLIPSHELF_TYPE 0xE1b0771
|
||||
|
||||
typedef enum _E_Slipshelf_Action
|
||||
{
|
||||
E_SLIPSHELF_ACTION_HOME,
|
||||
E_SLIPSHELF_ACTION_CLOSE,
|
||||
E_SLIPSHELF_ACTION_APPS,
|
||||
E_SLIPSHELF_ACTION_KEYBOARD
|
||||
} E_Slipshelf_Action;
|
||||
|
||||
struct _E_Slipshelf
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Zone *zone;
|
||||
E_Popup *popup;
|
||||
Ecore_X_Window clickwin;
|
||||
Evas_Object *base_obj;
|
||||
Evas_Object *control_obj;
|
||||
Evas_Object *scrollframe_obj;
|
||||
E_Border *bsel;
|
||||
Evas_Object *vis_obj;
|
||||
Evas_Object *swallow1_obj;
|
||||
Evas_Object *swallow2_obj;
|
||||
Eina_List *handlers;
|
||||
E_Border *focused_border;
|
||||
E_Gadcon *gadcon;
|
||||
E_Gadcon *gadcon_extra;
|
||||
Ecore_Timer *slide_down_timer;
|
||||
const char *themedir;
|
||||
const char *default_title;
|
||||
struct {
|
||||
struct {
|
||||
void (*func) (const void *data, E_Slipshelf *ess, E_Slipshelf_Action action);
|
||||
const void *data;
|
||||
unsigned char enabled : 1;
|
||||
} home, close, apps, keyboard;
|
||||
} action;
|
||||
int main_size;
|
||||
int extra_size;
|
||||
int hidden;
|
||||
Ecore_Animator *animator;
|
||||
int adjust_start;
|
||||
int adjust_target;
|
||||
int adjust;
|
||||
struct {
|
||||
int w, h;
|
||||
} control;
|
||||
struct {
|
||||
void (*func) (void *data, E_Slipshelf *ess, E_Border *bd);
|
||||
const void *data;
|
||||
} callback_border_select, callback_border_add, callback_border_del, callback_border_home;
|
||||
|
||||
double start;
|
||||
double len;
|
||||
unsigned char out : 1;
|
||||
};
|
||||
|
||||
struct _E_Event_Slipshelf_Simple
|
||||
{
|
||||
E_Slipshelf *slipshelf;
|
||||
};
|
||||
|
||||
EAPI int e_slipshelf_init(void);
|
||||
EAPI int e_slipshelf_shutdown(void);
|
||||
EAPI E_Slipshelf *e_slipshelf_new(E_Zone *zone, const char *themedir);
|
||||
EAPI void e_slipshelf_action_enabled_set(E_Slipshelf *ess, E_Slipshelf_Action action, Evas_Bool enabled);
|
||||
EAPI Evas_Bool e_slipshelf_action_enabled_get(E_Slipshelf *ess, E_Slipshelf_Action action);
|
||||
EAPI void e_slipshelf_action_callback_set(E_Slipshelf *ess, E_Slipshelf_Action action, void (*func) (const void *data, E_Slipshelf *ess, E_Slipshelf_Action action), const void *data);
|
||||
EAPI void e_slipshelf_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_slipshelf_default_title_set(E_Slipshelf *ess, const char *title);
|
||||
|
||||
EAPI void e_slipshelf_border_select_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), const void *data);
|
||||
EAPI void e_slipshelf_border_add_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), const void *data);
|
||||
EAPI void e_slipshelf_border_del_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), const void *data);
|
||||
EAPI void e_slipshelf_border_home_callback_set(E_Slipshelf *ess, void (*func) (void *data, E_Slipshelf *ess, E_Border *bd), const void *data);
|
||||
|
||||
|
||||
extern EAPI int E_EVENT_SLIPSHELF_ADD;
|
||||
extern EAPI int E_EVENT_SLIPSHELF_DEL;
|
||||
extern EAPI int E_EVENT_SLIPSHELF_CHANGE;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,405 @@
|
|||
#include <e.h>
|
||||
#include "e_slipwin.h"
|
||||
|
||||
EAPI int E_EVENT_SLIPWIN_DEL = 0;
|
||||
|
||||
/* internal calls */
|
||||
|
||||
E_Slipwin *_e_slipwin_new(E_Zone *zone, const char *themedir);
|
||||
static void _e_slipwin_free(E_Slipwin *ess);
|
||||
static int _e_slipwin_cb_animate(void *data);
|
||||
static void _e_slipwin_slide(E_Slipwin *ess, int out, double len);
|
||||
static int _e_slipwin_cb_mouse_up(void *data, int type, void *event);
|
||||
static int _e_slipwin_cb_zone_move_resize(void *data, int type, void *event);
|
||||
static int _e_slipwin_cb_zone_del(void *data, int type, void *event);
|
||||
static void _e_slipwin_event_simple_free(void *data, void *ev);
|
||||
static void _e_slipwin_object_del_attach(void *o);
|
||||
static void _e_slipwin_cb_item_sel(void *data, void *data2);
|
||||
|
||||
static Evas_Object *_theme_obj_new(Evas *e, const char *custom_dir, const char *group);
|
||||
|
||||
/* state */
|
||||
static Eina_List *slipwins = NULL;
|
||||
|
||||
/* called from the module core */
|
||||
EAPI int
|
||||
e_slipwin_init(void)
|
||||
{
|
||||
E_EVENT_SLIPWIN_DEL = ecore_event_type_new();
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_slipwin_shutdown(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI E_Slipwin *
|
||||
e_slipwin_new(E_Zone *zone, const char *themedir)
|
||||
{
|
||||
E_Slipwin *esw;
|
||||
Evas_Coord mw, mh;
|
||||
int x, y;
|
||||
Evas_Object *o;
|
||||
|
||||
esw = E_OBJECT_ALLOC(E_Slipwin, E_SLIPWIN_TYPE, _e_slipwin_free);
|
||||
if (!esw) return NULL;
|
||||
|
||||
esw->zone = zone;
|
||||
if (themedir) esw->themedir = evas_stringshare_add(themedir);
|
||||
|
||||
esw->clickwin = ecore_x_window_input_new(zone->container->win,
|
||||
zone->x, zone->y, zone->w, zone->h);
|
||||
esw->popup = e_popup_new(esw->zone, -1, -1, 1, 1);
|
||||
ecore_x_window_configure(esw->clickwin,
|
||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
||||
0, 0, 0, 0, 0,
|
||||
esw->popup->evas_win,
|
||||
ECORE_X_WINDOW_STACK_BELOW);
|
||||
e_popup_layer_set(esw->popup, 220);
|
||||
|
||||
esw->base_obj = _theme_obj_new(esw->popup->evas,
|
||||
esw->themedir,
|
||||
"e/modules/slipwin/base/default");
|
||||
|
||||
esw->focused_border = e_border_focused_get();
|
||||
|
||||
o = e_scrollframe_add(esw->popup->evas);
|
||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", o);
|
||||
evas_object_show(o);
|
||||
esw->scrollframe_obj = o;
|
||||
|
||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
||||
|
||||
x = zone->x;
|
||||
y = zone->y + zone->h;
|
||||
mw = zone->w;
|
||||
|
||||
mh = 300;
|
||||
|
||||
e_popup_move_resize(esw->popup, x, y, mw, mh);
|
||||
|
||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
||||
e_popup_edje_bg_object_set(esw->popup, esw->base_obj);
|
||||
evas_object_show(esw->base_obj);
|
||||
|
||||
e_popup_show(esw->popup);
|
||||
|
||||
slipwins = eina_list_append(slipwins, esw);
|
||||
|
||||
esw->handlers = eina_list_append
|
||||
(esw->handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
|
||||
_e_slipwin_cb_mouse_up, esw));
|
||||
|
||||
e_object_del_attach_func_set(E_OBJECT(esw), _e_slipwin_object_del_attach);
|
||||
|
||||
return esw;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_slipwin_show(E_Slipwin *esw)
|
||||
{
|
||||
Evas_Object *o;
|
||||
Evas_Coord mw, mh, vw, vh, w, h;
|
||||
Eina_List *borders, *l;
|
||||
int i, selnum;
|
||||
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
||||
|
||||
/* FIXME: build window list and free old onw if needed */
|
||||
if (esw->ilist_obj)
|
||||
{
|
||||
evas_object_del(esw->ilist_obj);
|
||||
esw->ilist_obj = NULL;
|
||||
}
|
||||
while (esw->borders)
|
||||
{
|
||||
e_object_unref(E_OBJECT(esw->borders->data));
|
||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
||||
}
|
||||
|
||||
o = e_ilist_add(esw->popup->evas);
|
||||
e_ilist_selector_set(o, 1);
|
||||
e_ilist_freeze(o);
|
||||
|
||||
borders = e_border_client_list();
|
||||
i = 0;
|
||||
selnum = -1;
|
||||
for (l = borders; l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
const char *title;
|
||||
|
||||
bd = l->data;
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
if ((!bd->client.icccm.accepts_focus) &&
|
||||
(!bd->client.icccm.take_focus)) continue;
|
||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
||||
if (bd->user_skip_winlist) continue;
|
||||
|
||||
e_object_ref(E_OBJECT(bd));
|
||||
title = "???";
|
||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
||||
e_ilist_append(o, NULL/*icon*/, title, 0, _e_slipwin_cb_item_sel,
|
||||
NULL, esw, bd);
|
||||
esw->borders = eina_list_append(esw->borders, bd);
|
||||
if (bd == e_border_focused_get()) selnum = i;
|
||||
i++;
|
||||
}
|
||||
e_ilist_thaw(o);
|
||||
|
||||
e_ilist_min_size_get(o, &mw, &mh);
|
||||
|
||||
evas_object_resize(o, mw, mh);
|
||||
e_scrollframe_child_set(esw->scrollframe_obj, o);
|
||||
|
||||
e_scrollframe_child_viewport_size_get(esw->scrollframe_obj, &vw, &vh);
|
||||
edje_object_part_geometry_get(esw->scrollframe_obj, "e.swallow.content", NULL, NULL, &vw, &vh);
|
||||
// evas_object_geometry_get(esw->scrollframe_obj, NULL, NULL, &w, &h);
|
||||
if (mw > vw) mw = mw + (w - vw);
|
||||
else if (mw < vw) evas_object_resize(o, vw, mh);
|
||||
|
||||
if (selnum >= 0) e_ilist_selected_set(o, selnum);
|
||||
|
||||
evas_object_show(o);
|
||||
esw->ilist_obj = o;
|
||||
|
||||
edje_extern_object_min_size_set(esw->scrollframe_obj, mw, mh);
|
||||
printf("min size %ix%i\n", mw, mh);
|
||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->scrollframe_obj);
|
||||
edje_object_size_min_calc(esw->base_obj, &mw, &mh);
|
||||
|
||||
edje_extern_object_min_size_set(esw->scrollframe_obj, 0, 0);
|
||||
edje_object_part_swallow(esw->base_obj, "e.swallow.content", esw->scrollframe_obj);
|
||||
|
||||
mw = esw->zone->w;
|
||||
if (mh > esw->zone->h) mh = esw->zone->h;
|
||||
e_popup_resize(esw->popup, mw, mh);
|
||||
|
||||
evas_object_resize(esw->base_obj, esw->popup->w, esw->popup->h);
|
||||
|
||||
printf("sw: %ix%i\n", esw->popup->w, esw->popup->h);
|
||||
|
||||
_e_slipwin_slide(esw, 1, 1.0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_slipwin_hide(E_Slipwin *esw)
|
||||
{
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
||||
|
||||
_e_slipwin_slide(esw, 0, 1.0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_slipwin_border_select_callback_set(E_Slipwin *esw, void (*func) (void *data, E_Slipwin *ess, E_Border *bd), const void *data)
|
||||
{
|
||||
E_OBJECT_CHECK(esw);
|
||||
E_OBJECT_TYPE_CHECK(esw, E_SLIPWIN_TYPE);
|
||||
esw->callback.func = func;
|
||||
esw->callback.data = data;
|
||||
}
|
||||
|
||||
/* internal calls */
|
||||
static void
|
||||
_e_slipwin_free(E_Slipwin *esw)
|
||||
{
|
||||
slipwins = eina_list_remove(slipwins, esw);
|
||||
while (esw->handlers)
|
||||
{
|
||||
if (esw->handlers->data)
|
||||
ecore_event_handler_del(esw->handlers->data);
|
||||
esw->handlers = eina_list_remove_list(esw->handlers, esw->handlers);
|
||||
}
|
||||
if (esw->animator) ecore_animator_del(esw->animator);
|
||||
if (esw->themedir) evas_stringshare_del(esw->themedir);
|
||||
ecore_x_window_del(esw->clickwin);
|
||||
e_object_del(E_OBJECT(esw->popup));
|
||||
free(esw);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_slipwin_cb_animate(void *data)
|
||||
{
|
||||
E_Slipwin *esw;
|
||||
double t, v;
|
||||
|
||||
esw = data;
|
||||
t = ecore_time_get() - esw->start;
|
||||
if (t > esw->len) t = esw->len;
|
||||
v = t / esw->len;
|
||||
v = 1.0 - v;
|
||||
v = v * v * v * v;
|
||||
v = 1.0 - v;
|
||||
esw->adjust = (esw->adjust_target * v) + (esw->adjust_start * (1.0 - v));
|
||||
e_popup_move(esw->popup,
|
||||
esw->zone->x,
|
||||
esw->zone->y + esw->zone->h - esw->adjust);
|
||||
if (t == esw->len)
|
||||
{
|
||||
esw->animator = NULL;
|
||||
if (esw->out)
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,out,end", "e");
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,in,end", "e");
|
||||
if (esw->ilist_obj)
|
||||
{
|
||||
evas_object_del(esw->ilist_obj);
|
||||
esw->ilist_obj = NULL;
|
||||
}
|
||||
while (esw->borders)
|
||||
{
|
||||
e_object_unref(E_OBJECT(esw->borders->data));
|
||||
esw->borders = eina_list_remove_list(esw->borders, esw->borders);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_slipwin_slide(E_Slipwin *esw, int out, double len)
|
||||
{
|
||||
if (out == esw->out) return;
|
||||
if (len == 0.0) len = 0.000001; /* FIXME: handle len = 0.0 case */
|
||||
|
||||
if (!esw->animator)
|
||||
esw->animator = ecore_animator_add(_e_slipwin_cb_animate, esw);
|
||||
esw->start = ecore_time_get();
|
||||
esw->len = len;
|
||||
esw->out = out;
|
||||
esw->adjust_start = esw->adjust;
|
||||
if (esw->out) esw->adjust_target = esw->popup->h;
|
||||
else esw->adjust_target = 0;
|
||||
if (esw->out)
|
||||
{
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,out,begin", "e");
|
||||
ecore_x_window_configure(esw->clickwin,
|
||||
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING|ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
|
||||
0, 0, 0, 0, 0,
|
||||
esw->popup->evas_win,
|
||||
ECORE_X_WINDOW_STACK_BELOW);
|
||||
ecore_x_window_show(esw->clickwin);
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(esw->base_obj, "e,state,in,begin", "e");
|
||||
ecore_x_window_hide(esw->clickwin);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_slipwin_cb_mouse_up(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Mouse_Button_Up *ev;
|
||||
E_Slipwin *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (ev->win == esw->clickwin)
|
||||
{
|
||||
if (esw->out) _e_slipwin_slide(esw, 0, 1.0);
|
||||
else _e_slipwin_slide(esw, 1, 1.0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_slipwin_cb_zone_move_resize(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Move_Resize *ev;
|
||||
E_Slipwin *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (esw->zone == ev->zone)
|
||||
{
|
||||
/* FIXME: handle new size pants */
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_slipwin_cb_zone_del(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Zone_Del *ev;
|
||||
E_Slipwin *esw;
|
||||
|
||||
ev = event;
|
||||
esw = data;
|
||||
if (esw->zone == ev->zone)
|
||||
{
|
||||
e_object_del(E_OBJECT(esw));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_slipwin_event_simple_free(void *data, void *ev)
|
||||
{
|
||||
struct _E_Event_Slipwin_Simple *e;
|
||||
|
||||
e = ev;
|
||||
e_object_unref(E_OBJECT(e->slipwin));
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_slipwin_object_del_attach(void *o)
|
||||
{
|
||||
E_Slipwin *esw;
|
||||
E_Event_Slipwin_Del *ev;
|
||||
|
||||
if (e_object_is_del(E_OBJECT(o))) return;
|
||||
esw = o;
|
||||
ev = calloc(1, sizeof(E_Event_Slipwin_Del));
|
||||
ev->slipwin = esw;
|
||||
e_object_ref(E_OBJECT(esw));
|
||||
ecore_event_add(E_EVENT_SLIPWIN_DEL, ev,
|
||||
_e_slipwin_event_simple_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_slipwin_cb_item_sel(void *data, void *data2)
|
||||
{
|
||||
E_Slipwin *esw;
|
||||
|
||||
esw = data;
|
||||
if (esw->callback.func) esw->callback.func(esw->callback.data, esw, data2);
|
||||
e_slipwin_hide(esw);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static Evas_Object *
|
||||
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = edje_object_add(e);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
|
||||
{
|
||||
if (custom_dir)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
|
||||
if (edje_object_file_set(o, buf, group))
|
||||
{
|
||||
printf("OK FALLBACK %s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef E_SLIPWIN_H
|
||||
#define E_SLIPWIN_H
|
||||
|
||||
typedef struct _E_Slipwin E_Slipwin;
|
||||
typedef struct _E_Event_Slipwin_Simple E_Event_Slipwin_Del;
|
||||
|
||||
#define E_SLIPWIN_TYPE 0xE1b0971
|
||||
|
||||
struct _E_Slipwin
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
E_Zone *zone;
|
||||
E_Popup *popup;
|
||||
Ecore_X_Window clickwin;
|
||||
Evas_Object *base_obj;
|
||||
Evas_Object *scrollframe_obj;
|
||||
Evas_Object *ilist_obj;
|
||||
Eina_List *handlers;
|
||||
E_Border *focused_border;
|
||||
Eina_List *borders;
|
||||
struct {
|
||||
void (*func) (void *data, E_Slipwin *ess, E_Border *bd);
|
||||
const void *data;
|
||||
} callback;
|
||||
const char *themedir;
|
||||
Ecore_Animator *animator;
|
||||
int adjust_start;
|
||||
int adjust_target;
|
||||
int adjust;
|
||||
double start;
|
||||
double len;
|
||||
unsigned char out : 1;
|
||||
};
|
||||
|
||||
struct _E_Event_Slipwin_Simple
|
||||
{
|
||||
E_Slipwin *slipwin;
|
||||
};
|
||||
|
||||
EAPI int e_slipwin_init(void);
|
||||
EAPI int e_slipwin_shutdown(void);
|
||||
EAPI E_Slipwin *e_slipwin_new(E_Zone *zone, const char *themedir);
|
||||
EAPI void e_slipwin_show(E_Slipwin *esw);
|
||||
EAPI void e_slipwin_hide(E_Slipwin *esw);
|
||||
EAPI void e_slipwin_border_select_callback_set(E_Slipwin *esw, void (*func) (void *data, E_Slipwin *ess, E_Border *bd), const void *data);
|
||||
|
||||
extern EAPI int E_EVENT_SLIPWIN_DEL;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,499 @@
|
|||
#include <e.h>
|
||||
#include "e_winilist.h"
|
||||
|
||||
/* internal calls */
|
||||
typedef struct _Data Data;
|
||||
typedef struct _Special Special;
|
||||
|
||||
struct _Data
|
||||
{
|
||||
Evas_Object *o_frame;
|
||||
Evas_Object *o_ilist;
|
||||
struct {
|
||||
void (*func) (void *data, E_Border *bd);
|
||||
void *data;
|
||||
} select;
|
||||
struct {
|
||||
Eina_List *prepend;
|
||||
Eina_List *append;
|
||||
unsigned char changed : 1;
|
||||
} special;
|
||||
struct {
|
||||
Evas_Coord w, h;
|
||||
} optimal_size;
|
||||
Eina_List *borders;
|
||||
Eina_List *labels;
|
||||
};
|
||||
|
||||
struct _Special
|
||||
{
|
||||
Evas_Object *icon;
|
||||
const char *label;
|
||||
void (*func) (void *data1, void *data2);
|
||||
void *data1;
|
||||
void *data2;
|
||||
};
|
||||
|
||||
static void _cb_item_sel(void *data, void *data2);
|
||||
static void _cb_special_sel(void *data, void *data2);
|
||||
|
||||
static void _cb_object_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cb_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
||||
static void _refill(Data *d);
|
||||
|
||||
static int _cb_border_add(void *data, int ev_type, void *ev);
|
||||
static int _cb_border_remove(void *data, int ev_type, void *ev);
|
||||
static int _cb_border_show(void *data, int ev_type, void *ev);
|
||||
static int _cb_border_hide(void *data, int ev_type, void *ev);
|
||||
static int _cb_border_property(void *data, int ev_type, void *ev);
|
||||
static int _cb_desk_show(void *data, int ev_type, void *event);
|
||||
|
||||
/* state */
|
||||
static Eina_List *handlers = NULL;
|
||||
static Eina_List *winilists = NULL;
|
||||
|
||||
/* called from the module core */
|
||||
EAPI int
|
||||
e_winilist_init(void)
|
||||
{
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_ADD, _cb_border_add, NULL));
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_REMOVE, _cb_border_remove, NULL));
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_SHOW, _cb_border_show, NULL));
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_HIDE, _cb_border_hide, NULL));
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_PROPERTY, _cb_border_property, NULL));
|
||||
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_DESK_SHOW, _cb_desk_show, NULL));
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_winilist_shutdown(void)
|
||||
{
|
||||
while (handlers)
|
||||
{
|
||||
ecore_event_handler_del(handlers->data);
|
||||
handlers = eina_list_remove_list(handlers, handlers);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
e_winilist_add(Evas *e)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = E_NEW(Data, 1);
|
||||
d->o_frame = e_scrollframe_add(e);
|
||||
d->o_ilist = e_ilist_add(e);
|
||||
evas_object_data_set(d->o_frame, "..[winilist]", d);
|
||||
e_ilist_selector_set(d->o_ilist, 1);
|
||||
|
||||
e_scrollframe_child_set(d->o_frame, d->o_ilist);
|
||||
evas_object_show(d->o_ilist);
|
||||
|
||||
winilists = eina_list_append(winilists, d);
|
||||
evas_object_event_callback_add(d->o_frame, EVAS_CALLBACK_DEL, _cb_object_del, NULL);
|
||||
evas_object_event_callback_add(d->o_frame, EVAS_CALLBACK_RESIZE, _cb_object_resize, NULL);
|
||||
|
||||
_refill(d);
|
||||
|
||||
return d->o_frame;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_winilist_border_select_callback_set(Evas_Object *obj, void (*func) (void *data, E_Border *bd), void *data)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
d->select.func = func;
|
||||
d->select.data = data;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_winilist_special_append(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = E_NEW(Special, 1);
|
||||
d->special.prepend = eina_list_prepend(d->special.prepend, s);
|
||||
s->icon = icon;
|
||||
if (label) s->label = evas_stringshare_add(label);
|
||||
s->func = func;
|
||||
s->data1 = data1;
|
||||
s->data2 = data2;
|
||||
d->special.changed = 1;
|
||||
}
|
||||
_refill(d);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_winilist_special_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = E_NEW(Special, 1);
|
||||
d->special.append = eina_list_append(d->special.append, s);
|
||||
s->icon = icon;
|
||||
if (label) s->label = evas_stringshare_add(label);
|
||||
s->func = func;
|
||||
s->data1 = data1;
|
||||
s->data2 = data2;
|
||||
d->special.changed = 1;
|
||||
}
|
||||
_refill(d);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_winilist_optimial_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
if (w) *w = 0;
|
||||
if (h) *h = 0;
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
if (w) *w = d->optimal_size.w;
|
||||
if (h) *h = d->optimal_size.h;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* internal calls */
|
||||
static void
|
||||
_cb_item_sel(void *data, void *data2)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = data;
|
||||
if (d->select.func)
|
||||
{
|
||||
d->select.func(d->select.data, data2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_special_sel(void *data, void *data2)
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = data;
|
||||
if (s->func)
|
||||
{
|
||||
s->func(s->data1, s->data2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_object_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Data *d;
|
||||
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
evas_object_del(d->o_ilist);
|
||||
winilists = eina_list_remove(winilists, d);
|
||||
|
||||
while (d->borders)
|
||||
{
|
||||
e_object_unref(E_OBJECT(d->borders->data));
|
||||
d->borders = eina_list_remove_list(d->borders, d->borders);
|
||||
}
|
||||
while (d->labels)
|
||||
{
|
||||
evas_stringshare_del(d->labels->data);
|
||||
d->labels = eina_list_remove_list(d->labels, d->labels);
|
||||
}
|
||||
|
||||
while (d->special.prepend)
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = d->special.prepend->data;
|
||||
if (s->icon)
|
||||
{
|
||||
evas_object_del(s->icon);
|
||||
s->icon = NULL;
|
||||
}
|
||||
if (s->label)
|
||||
{
|
||||
evas_stringshare_del(s->label);
|
||||
s->label = NULL;
|
||||
}
|
||||
free(s);
|
||||
d->special.prepend = eina_list_remove_list(d->special.prepend, d->special.prepend);
|
||||
}
|
||||
while (d->special.append)
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = d->special.append->data;
|
||||
if (s->icon)
|
||||
{
|
||||
evas_object_del(s->icon);
|
||||
s->icon = NULL;
|
||||
}
|
||||
if (s->label)
|
||||
{
|
||||
evas_stringshare_del(s->label);
|
||||
s->label = NULL;
|
||||
}
|
||||
free(s);
|
||||
d->special.append = eina_list_remove_list(d->special.append, d->special.append);
|
||||
}
|
||||
|
||||
free(d);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Data *d;
|
||||
Evas_Coord lw, lh, vw, vh;
|
||||
|
||||
d = evas_object_data_get(obj, "..[winilist]");
|
||||
if (!d) return;
|
||||
e_ilist_min_size_get(d->o_ilist, &lw, &lh);
|
||||
e_scrollframe_child_viewport_size_get(d->o_frame, &vw, &vh);
|
||||
evas_object_resize(d->o_ilist, vw, lh);
|
||||
}
|
||||
|
||||
static void
|
||||
_refill(Data *d)
|
||||
{
|
||||
Evas_Coord w, h, lw, lh, vw, vh;
|
||||
Eina_List *borders, *l, *l2, *l3;
|
||||
|
||||
borders = e_border_client_list();
|
||||
if (!d->special.changed)
|
||||
{
|
||||
int changed = 0;
|
||||
|
||||
if ((borders) && (d->borders))
|
||||
{
|
||||
Eina_List *tmp = NULL;
|
||||
|
||||
changed = 0;
|
||||
for (l = borders; l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = l->data;
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
if ((!bd->client.icccm.accepts_focus) &&
|
||||
(!bd->client.icccm.take_focus)) continue;
|
||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
||||
if (bd->user_skip_winlist) continue;
|
||||
if ((!bd->sticky) &&
|
||||
(bd->desk != e_desk_current_get(bd->zone))) continue;
|
||||
tmp = eina_list_append(tmp, bd);
|
||||
}
|
||||
if (!(tmp && d->borders))
|
||||
{
|
||||
changed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eina_list_count(tmp) !=
|
||||
eina_list_count(d->borders))
|
||||
{
|
||||
changed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (l = tmp, l2 = d->borders, l3 = d->labels;
|
||||
l && l2 && l3;
|
||||
l = l->next, l2 = l2->next, l3 = l3->next)
|
||||
{
|
||||
E_Border *bd, *bd2;
|
||||
const char *title;
|
||||
|
||||
bd = l->data;
|
||||
bd2 = l2->data;
|
||||
if (bd != bd2)
|
||||
{
|
||||
changed = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
title = "???";
|
||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
||||
if (strcmp(title, l3->data))
|
||||
{
|
||||
changed = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp) eina_list_free(tmp);
|
||||
}
|
||||
else
|
||||
changed = 1;
|
||||
if (!changed) return;
|
||||
}
|
||||
d->special.changed = 0;
|
||||
while (d->borders)
|
||||
{
|
||||
e_object_unref(E_OBJECT(d->borders->data));
|
||||
d->borders = eina_list_remove_list(d->borders, d->borders);
|
||||
}
|
||||
while (d->labels)
|
||||
{
|
||||
evas_stringshare_del(d->labels->data);
|
||||
d->labels = eina_list_remove_list(d->labels, d->labels);
|
||||
}
|
||||
|
||||
e_ilist_freeze(d->o_ilist);
|
||||
e_ilist_clear(d->o_ilist);
|
||||
for (l = d->special.prepend; l; l = l->next)
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = l->data;
|
||||
e_ilist_append(d->o_ilist, s->icon, s->label, 0, _cb_special_sel, NULL,
|
||||
s, NULL);
|
||||
}
|
||||
for (l = borders; l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
const char *title;
|
||||
|
||||
bd = l->data;
|
||||
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||
if ((!bd->client.icccm.accepts_focus) &&
|
||||
(!bd->client.icccm.take_focus)) continue;
|
||||
if (bd->client.netwm.state.skip_taskbar) continue;
|
||||
if (bd->user_skip_winlist) continue;
|
||||
if ((!bd->sticky) &&
|
||||
(bd->desk != e_desk_current_get(bd->zone))) continue;
|
||||
|
||||
title = "???";
|
||||
if (bd->client.netwm.name) title = bd->client.netwm.name;
|
||||
else if (bd->client.icccm.title) title = bd->client.icccm.title;
|
||||
e_object_ref(E_OBJECT(bd));
|
||||
d->borders = eina_list_append(d->borders, bd);
|
||||
d->labels = eina_list_append(d->labels, evas_stringshare_add(title));
|
||||
e_ilist_append(d->o_ilist, NULL/*icon*/, title, 0,
|
||||
_cb_item_sel,
|
||||
NULL, d, bd);
|
||||
}
|
||||
for (l = d->special.append; l; l = l->next)
|
||||
{
|
||||
Special *s;
|
||||
|
||||
s = l->data;
|
||||
e_ilist_append(d->o_ilist, s->icon, s->label, 0, _cb_special_sel, NULL,
|
||||
s, NULL);
|
||||
}
|
||||
|
||||
e_ilist_thaw(d->o_ilist);
|
||||
|
||||
/* FIXME: figure out optimal size */
|
||||
e_ilist_min_size_get(d->o_ilist, &lw, &lh);
|
||||
e_scrollframe_child_viewport_size_get(d->o_frame, &vw, &vh);
|
||||
evas_object_geometry_get(d->o_frame, NULL, NULL, &w, &h);
|
||||
evas_object_resize(d->o_ilist, vw, lh);
|
||||
|
||||
d->optimal_size.w = lw + (w - vw);
|
||||
d->optimal_size.h = lh + (h - vh);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_add(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
|
||||
ev = event;
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_remove(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
|
||||
ev = event;
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_show(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Border_Show *ev;
|
||||
|
||||
ev = event;
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_hide(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Border_Hide *ev;
|
||||
|
||||
ev = event;
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_border_property(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Border_Property *ev;
|
||||
|
||||
ev = event;
|
||||
/* FIXME: should really be optimal on what properties warrant a refill */
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_desk_show(void *data, int ev_type, void *event)
|
||||
{
|
||||
E_Event_Desk_Show *ev;
|
||||
|
||||
ev = event;
|
||||
/* FIXME: should really be optimal on what properties warrant a refill */
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = winilists; l; l = l->next) _refill(l->data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef E_WINILIST_H
|
||||
#define E_WINILIST_H
|
||||
|
||||
EAPI int e_winilist_init(void);
|
||||
EAPI int e_winilist_shutdown(void);
|
||||
|
||||
EAPI Evas_Object *e_winilist_add(Evas *e);
|
||||
EAPI void e_winilist_border_select_callback_set(Evas_Object *obj, void (*func) (void *data, E_Border *bd), void *data);
|
||||
EAPI void e_winilist_special_append(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2);
|
||||
EAPI void e_winilist_special_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data1, void *data2), void *data1, void *data2);
|
||||
EAPI void e_winilist_optimial_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,106 @@
|
|||
##KBDCONF-1.0
|
||||
kbd 130 45
|
||||
fuzz 20
|
||||
|
||||
# keyboard type
|
||||
type ALPHA
|
||||
# an icon for the keyboard so you know which one you have
|
||||
icon alpha.png
|
||||
|
||||
# if the key out is in quotes - "q" for example, then this key is used for
|
||||
# typing words and can be part of a dictionary match, any other key when
|
||||
# pressed will end the dictionary match (u can disable dictionary matching in
|
||||
# a layout by not having any outputs in quotes)
|
||||
key 5 5 10 10
|
||||
normal q "q"
|
||||
shift Q "Q"
|
||||
key 15 5 10 10
|
||||
normal w "w"
|
||||
shift W "W"
|
||||
key 25 5 10 10
|
||||
normal e "e"
|
||||
shift E "E"
|
||||
key 35 5 10 10
|
||||
normal r "r"
|
||||
shift R "R"
|
||||
key 45 5 10 10
|
||||
normal t "t"
|
||||
shift T "T"
|
||||
key 55 5 10 10
|
||||
normal y "y"
|
||||
shift Y "Y"
|
||||
key 65 5 10 10
|
||||
normal u "u"
|
||||
shift U "U"
|
||||
key 75 5 10 10
|
||||
normal i "i"
|
||||
shift I "I"
|
||||
key 85 5 10 10
|
||||
normal o "o"
|
||||
shift O "O"
|
||||
key 95 5 10 10
|
||||
normal p "p"
|
||||
shift P "P"
|
||||
|
||||
key 10 15 10 10
|
||||
normal a "a"
|
||||
shift A "A"
|
||||
key 20 15 10 10
|
||||
normal s "s"
|
||||
shift S "S"
|
||||
key 30 15 10 10
|
||||
normal d "d"
|
||||
shift D "D"
|
||||
key 40 15 10 10
|
||||
normal f "f"
|
||||
shift F "F"
|
||||
key 50 15 10 10
|
||||
normal g "g"
|
||||
shift G "G"
|
||||
key 60 15 10 10
|
||||
normal h "h"
|
||||
shift H "H"
|
||||
key 70 15 10 10
|
||||
normal j "j"
|
||||
shift J "J"
|
||||
key 80 15 10 10
|
||||
normal k "k"
|
||||
shift K "K"
|
||||
key 90 15 10 10
|
||||
normal l "l"
|
||||
shift L "L"
|
||||
|
||||
key 15 25 10 10
|
||||
normal z "z"
|
||||
shift Z "Z"
|
||||
key 25 25 10 10
|
||||
normal x "x"
|
||||
shift X "X"
|
||||
key 35 25 10 10
|
||||
normal c "c"
|
||||
shift C "C"
|
||||
key 45 25 10 10
|
||||
normal v "v"
|
||||
shift V "V"
|
||||
key 55 25 10 10
|
||||
normal b "b"
|
||||
shift B "B"
|
||||
key 65 25 10 10
|
||||
normal n "n"
|
||||
shift N "N"
|
||||
key 75 25 10 10
|
||||
normal m "m"
|
||||
shift M "M"
|
||||
key 105 25 10 10
|
||||
normal shift.png
|
||||
is_shift
|
||||
|
||||
key 115 5 10 10
|
||||
normal . period
|
||||
shift , comma
|
||||
key 115 15 10 10
|
||||
normal ? question
|
||||
shift ! exclam
|
||||
key 115 25 10 10
|
||||
normal ' "'"
|
||||
shift / slash
|
|
@ -0,0 +1,120 @@
|
|||
##KBDCONF-1.0
|
||||
kbd 130 45
|
||||
fuzz 20
|
||||
|
||||
# keyboard type
|
||||
type NUMERIC
|
||||
# an icon for the keyboard so you know which one you have
|
||||
icon numeric.png
|
||||
|
||||
key 5 5 10 10
|
||||
normal 1 1
|
||||
shift ! exclam
|
||||
key 15 5 10 10
|
||||
normal 2 2
|
||||
shift @ at
|
||||
key 25 5 10 10
|
||||
normal 3 3
|
||||
shift # numbersign
|
||||
key 35 5 10 10
|
||||
normal 4 4
|
||||
shift $ dollar
|
||||
key 45 5 10 10
|
||||
normal 5 5
|
||||
shift % percent
|
||||
key 55 5 10 10
|
||||
normal 6 6
|
||||
shift ^ asciicircum
|
||||
key 65 5 10 10
|
||||
normal 7 7
|
||||
shift & ampersand
|
||||
key 75 5 10 10
|
||||
normal 8 8
|
||||
shift * asterisk
|
||||
key 85 5 10 10
|
||||
normal 9 9
|
||||
shift ( parenleft
|
||||
key 95 5 10 10
|
||||
normal 0 0
|
||||
shift ) parenright
|
||||
key 105 5 10 10
|
||||
normal [ bracketleft
|
||||
shift { braceleft
|
||||
key 115 5 10 10
|
||||
normal ] bracketright
|
||||
shift } braceright
|
||||
|
||||
|
||||
key 5 15 10 10
|
||||
normal tab.png Tab
|
||||
shift tab.png ISO_Left_Tab
|
||||
key 15 15 10 10
|
||||
normal ` grave
|
||||
shift ~ asciitilde
|
||||
key 25 15 10 10
|
||||
normal - "-"
|
||||
shift _ underscore
|
||||
key 35 15 10 10
|
||||
normal = equal
|
||||
shift + plus
|
||||
key 45 15 10 10
|
||||
normal \ backslash
|
||||
shift | bar
|
||||
key 55 15 10 10
|
||||
normal ; semicolon
|
||||
shift : colon
|
||||
key 65 15 10 10
|
||||
normal ' apostrophe
|
||||
shift " quotedbl
|
||||
key 75 15 10 10
|
||||
normal / slash
|
||||
shift ? question
|
||||
key 85 15 10 10
|
||||
normal , comma
|
||||
shift < less
|
||||
key 95 15 10 10
|
||||
normal ß "ß"
|
||||
shift ¢ "¢"
|
||||
key 105 15 10 10
|
||||
normal € "€"
|
||||
shift £ "£"
|
||||
key 115 15 10 10
|
||||
normal ø "ø"
|
||||
shift Ø "Ø"
|
||||
|
||||
key 5 25 10 10
|
||||
normal ä "ä"
|
||||
shift Ä "Ä"
|
||||
key 15 25 10 10
|
||||
normal ö "ö"
|
||||
shift Ö "Ó"
|
||||
key 25 25 10 10
|
||||
normal ü "ü"
|
||||
shift Ü "Ü"
|
||||
key 35 25 10 10
|
||||
normal é "é"
|
||||
shift É "É"
|
||||
key 45 25 10 10
|
||||
normal è "è"
|
||||
shift È "È"
|
||||
key 55 25 10 10
|
||||
normal ô "ô"
|
||||
shift Ô "Ô"
|
||||
key 65 25 10 10
|
||||
normal ç "ç"
|
||||
shift Ç "Ç"
|
||||
key 75 25 10 10
|
||||
normal à "à"
|
||||
shift À "À"
|
||||
key 85 25 10 10
|
||||
normal ò "ò"
|
||||
shift Ò "Ò"
|
||||
key 95 25 10 10
|
||||
normal ó "ó"
|
||||
shift Ó "Ó"
|
||||
key 105 25 10 10
|
||||
normal ñ "ñ"
|
||||
shift Ñ "Ñ"
|
||||
key 115 25 10 10
|
||||
normal shift.png
|
||||
is_shift
|
|
@ -0,0 +1,244 @@
|
|||
##KBDCONF-1.0
|
||||
kbd 450 150
|
||||
|
||||
# keyboard type
|
||||
type TERMINAL
|
||||
# an icon for the keyboard so you know which one you have
|
||||
icon qwerty.png
|
||||
|
||||
key 0 0 30 30
|
||||
normal ` grave
|
||||
shift ~ asciitilde
|
||||
capslock ` grave
|
||||
key 30 0 30 30
|
||||
normal 1 1
|
||||
shift ! exclam
|
||||
capslock 1 1
|
||||
key 60 0 30 30
|
||||
normal 2 2
|
||||
shift @ at
|
||||
capslock 2 2
|
||||
key 90 0 30 30
|
||||
normal 3 3
|
||||
shift # numbersign
|
||||
capslock 3 3
|
||||
key 120 0 30 30
|
||||
normal 4 4
|
||||
shift $ dollar
|
||||
capslock 4 4
|
||||
key 150 0 30 30
|
||||
normal 5 5
|
||||
shift % percent
|
||||
capslock 5 5
|
||||
key 180 0 30 30
|
||||
normal 6 6
|
||||
shift ^ asciicircum
|
||||
capslock 6 6
|
||||
key 210 0 30 30
|
||||
normal 7 7
|
||||
shift & ampersand
|
||||
capslock 7 7
|
||||
key 240 0 30 30
|
||||
normal 8 8
|
||||
shift * asterisk
|
||||
capslock 8 8
|
||||
key 270 0 30 30
|
||||
normal 9 9
|
||||
shift ( parenleft
|
||||
capslock 9 9
|
||||
key 300 0 30 30
|
||||
normal 0 0
|
||||
shift ) parenright
|
||||
capslock 0 0
|
||||
key 330 0 30 30
|
||||
normal - minus
|
||||
shift _ underscore
|
||||
capslock - minus
|
||||
key 360 0 30 30
|
||||
normal = equal
|
||||
shift + plus
|
||||
capslock = equal
|
||||
key 390 0 60 30
|
||||
normal backspace.png BackSpace
|
||||
|
||||
key 0 30 45 30
|
||||
normal tab.png Tab
|
||||
shift tab.png ISO_Left_Tab
|
||||
key 45 30 30 30
|
||||
normal q q
|
||||
shift Q Q
|
||||
capslock Q Q
|
||||
key 75 30 30 30
|
||||
normal w w
|
||||
shift W W
|
||||
capslock W W
|
||||
key 105 30 30 30
|
||||
normal e e
|
||||
shift E E
|
||||
capslock E E
|
||||
key 135 30 30 30
|
||||
normal r r
|
||||
shift R R
|
||||
capslock R R
|
||||
key 165 30 30 30
|
||||
normal t t
|
||||
shift T T
|
||||
capslock T T
|
||||
key 195 30 30 30
|
||||
normal y y
|
||||
shift Y Y
|
||||
capslock Y Y
|
||||
key 225 30 30 30
|
||||
normal u u
|
||||
shift U U
|
||||
capslock U U
|
||||
key 255 30 30 30
|
||||
normal i i
|
||||
shift I I
|
||||
capslock I I
|
||||
key 285 30 30 30
|
||||
normal o o
|
||||
shift O O
|
||||
capslock O O
|
||||
key 315 30 30 30
|
||||
normal p p
|
||||
shift P P
|
||||
capslock P P
|
||||
key 345 30 30 30
|
||||
normal [ bracketleft
|
||||
shift { braceleft
|
||||
capslock [ bracketleft
|
||||
key 375 30 30 30
|
||||
normal ] bracketright
|
||||
shift } braceright
|
||||
capslock ] bracketright
|
||||
key 405 30 45 30
|
||||
normal \ backslash
|
||||
shift | bar
|
||||
capslock \ backslash
|
||||
|
||||
key 0 60 60 30
|
||||
normal caps
|
||||
capslock CAPS
|
||||
is_capslock
|
||||
key 60 60 30 30
|
||||
normal a a
|
||||
shift A A
|
||||
capslock A A
|
||||
key 90 60 30 30
|
||||
normal s s
|
||||
shift S S
|
||||
capslock S S
|
||||
key 120 60 30 30
|
||||
normal d d
|
||||
shift D D
|
||||
capslock D D
|
||||
key 150 60 30 30
|
||||
normal f f
|
||||
shift F F
|
||||
capslock F F
|
||||
key 180 60 30 30
|
||||
normal g g
|
||||
shift G G
|
||||
capslock G G
|
||||
key 210 60 30 30
|
||||
normal h h
|
||||
shift H H
|
||||
capslock H H
|
||||
key 240 60 30 30
|
||||
normal j j
|
||||
shift J J
|
||||
capslock J J
|
||||
key 270 60 30 30
|
||||
normal k k
|
||||
shift K K
|
||||
capslock K K
|
||||
key 300 60 30 30
|
||||
normal l l
|
||||
shift L L
|
||||
capslock L L
|
||||
key 330 60 30 30
|
||||
normal ; semicolon
|
||||
shift : colon
|
||||
capslock ; semicolon
|
||||
key 360 60 30 30
|
||||
normal ' apostrophe
|
||||
shift " quotedbl
|
||||
capslock ' apostrophe
|
||||
key 390 60 60 30
|
||||
normal enter.png Return
|
||||
|
||||
key 0 90 75 30
|
||||
normal shift.png
|
||||
is_shift
|
||||
key 75 90 30 30
|
||||
normal z z
|
||||
shift Z Z
|
||||
capslock Z Z
|
||||
key 105 90 30 30
|
||||
normal x x
|
||||
shift X X
|
||||
capslock X X
|
||||
key 135 90 30 30
|
||||
normal c c
|
||||
shift C C
|
||||
capslock C C
|
||||
key 165 90 30 30
|
||||
normal v v
|
||||
shift V V
|
||||
capslock V V
|
||||
key 195 90 30 30
|
||||
normal b b
|
||||
shift B B
|
||||
capslock B B
|
||||
key 225 90 30 30
|
||||
normal n n
|
||||
shift N N
|
||||
capslock N N
|
||||
key 255 90 30 30
|
||||
normal m m
|
||||
shift M M
|
||||
capslock M M
|
||||
key 285 90 30 30
|
||||
normal , comma
|
||||
shift < less
|
||||
capslock , comma
|
||||
key 315 90 30 30
|
||||
normal . period
|
||||
shift > greater
|
||||
capslock . period
|
||||
key 345 90 30 30
|
||||
normal / slash
|
||||
shift ? question
|
||||
capslock / slash
|
||||
key 375 90 30 30
|
||||
normal ins Insert
|
||||
key 405 90 35 30
|
||||
normal del Delete
|
||||
|
||||
key 0 120 30 30
|
||||
normal ctrl
|
||||
is_ctrl
|
||||
key 30 120 30 30
|
||||
normal alt
|
||||
is_alt
|
||||
key 60 120 120 30
|
||||
normal space space
|
||||
key 180 120 30 30
|
||||
normal left.png Left
|
||||
key 210 120 30 30
|
||||
normal right.png Right
|
||||
key 240 120 30 30
|
||||
normal up.png Up
|
||||
key 270 120 30 30
|
||||
normal down.png Down
|
||||
key 300 120 30 30
|
||||
normal pu Prior
|
||||
key 330 120 30 30
|
||||
normal pd Next
|
||||
key 360 120 30 30
|
||||
normal hm Home
|
||||
key 390 120 30 30
|
||||
normal en End
|
||||
key 420 120 30 30
|
||||
normal es Escape
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 289 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 286 B |
|
@ -0,0 +1 @@
|
|||
/org/freedesktop/Hal/devices/platform_*
|
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 1.5 KiB |