Convert borders to efreet.

SVN revision: 29131
devs/princeamd/enlightenment-0.17-elive
Sebastian Dransfeld 16 years ago
parent 6d5df6ae4e
commit 47ad22217e
  1. 41
      src/bin/e_border.c
  2. 2
      src/bin/e_border.h
  3. 49
      src/bin/e_exec.c
  4. 2
      src/bin/e_exec.h
  5. 2
      src/bin/e_fm.c
  6. 78
      src/bin/e_int_border_menu.c
  7. 4
      src/bin/e_int_menus.c
  8. 27
      src/bin/e_utils.c
  9. 1
      src/bin/e_utils.h
  10. 15
      src/modules/ibar/e_mod_main.c

@ -169,7 +169,9 @@ e_border_init(void)
handlers = evas_list_append(handlers, ecore_event_handler_add(E_EVENT_POINTER_WARP, _e_border_cb_pointer_warp, NULL));
#if 0
e_app_change_callback_add(_e_border_app_change, NULL);
#endif
E_EVENT_BORDER_ADD = ecore_event_type_new();
E_EVENT_BORDER_REMOVE = ecore_event_type_new();
@ -205,7 +207,9 @@ e_border_shutdown(void)
ecore_event_handler_del(h);
}
#if 0
e_app_change_callback_del(_e_border_app_change, NULL);
#endif
return 1;
}
@ -2572,15 +2576,9 @@ EAPI Evas_Object *
e_border_icon_add(E_Border *bd, Evas *evas)
{
Evas_Object *o;
E_App *a = NULL;
E_OBJECT_CHECK_RETURN(bd, NULL);
E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
if (bd->app)
{
e_object_unref(E_OBJECT(bd->app));
bd->app = NULL;
}
o = NULL;
if (bd->internal)
@ -2620,20 +2618,9 @@ e_border_icon_add(E_Border *bd, Evas *evas)
}
if (!o)
{
if ((bd->client.icccm.name) && (bd->client.icccm.class))
{
a = e_app_border_find(bd);
}
if (!a)
{
a = e_app_launch_id_pid_find(bd->client.netwm.startup_id,
bd->client.netwm.pid);
}
if (a)
if (bd->desktop)
{
o = e_app_icon_add(a, evas);
bd->app = a;
e_object_ref(E_OBJECT(bd->app));
o = e_util_desktop_icon_add(bd->desktop, "24x24", evas);
}
else if (bd->client.netwm.icons)
{
@ -3062,12 +3049,7 @@ _e_border_free(E_Border *bd)
e_object_unref(E_OBJECT(bd->cur_mouse_action));
bd->cur_mouse_action = NULL;
}
if (bd->app)
{
e_object_unref(E_OBJECT(bd->app));
bd->app = NULL;
}
E_FREE(bd->shape_rects);
bd->shape_rects_num = 0;
/*
@ -6403,6 +6385,11 @@ _e_border_eval(E_Border *bd)
evas_object_del(bd->icon_object);
bd->icon_object = NULL;
}
bd->desktop = efreet_util_desktop_wm_class_find(bd->client.icccm.name,
bd->client.icccm.class);
if (!bd->desktop)
bd->desktop = e_exec_startup_id_pid_find(bd->client.netwm.startup_id,
bd->client.netwm.pid);
bd->icon_object = e_border_icon_add(bd, bd->bg_evas);
if ((bd->focused) && (bd->icon_object))
edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
@ -7187,6 +7174,7 @@ _e_border_winid_str_get(Ecore_X_Window win)
return id;
}
#if 0
static void
_e_border_app_change(void *data, E_App *app, E_App_Change change)
{
@ -7223,6 +7211,7 @@ _e_border_app_change(void *data, E_App *app, E_App_Change change)
break;
}
}
#endif
static void
_e_border_pointer_resize_begin(E_Border *bd)

@ -454,7 +454,7 @@ struct _E_Border
E_Border *parent;
Evas_List *transients;
E_App *app;
Efreet_Desktop *desktop;
E_Pointer *pointer;
};

@ -14,6 +14,7 @@
typedef struct _E_Exec_Launch E_Exec_Launch;
typedef struct _E_Exec_Instance E_Exec_Instance;
typedef struct _E_Exec_Search E_Exec_Search;
struct _E_Exec_Launch
{
@ -25,11 +26,18 @@ struct _E_Exec_Instance
{
Efreet_Desktop *desktop;
Ecore_Exe *exe;
int launch_id;
int startup_id;
double launch_time;
Ecore_Timer *expire_timer;
};
struct _E_Exec_Search
{
Efreet_Desktop *desktop;
int startup_id;
pid_t pid;
};
struct _E_Config_Dialog_Data
{
Efreet_Desktop *desktop;
@ -49,6 +57,8 @@ static void _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int
static int _e_exec_cb_expire_timer(void *data);
static int _e_exec_cb_exit(void *data, int type, void *event);
static Evas_Bool _e_exec_startup_id_pid_find(Evas_Hash *hash, const char *key, void *value, void *data);
static void _e_exec_error_dialog(Efreet_Desktop *desktop, const char *exec, Ecore_Exe_Event_Del *event, Ecore_Exe_Event_Data *error, Ecore_Exe_Event_Data *read);
static void _fill_data(E_Config_Dialog_Data *cfdata);
static void *_create_data(E_Config_Dialog *cfd);
@ -122,6 +132,18 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
return 1;
}
EAPI Efreet_Desktop *
e_exec_startup_id_pid_find(int startup_id, pid_t pid)
{
E_Exec_Search search;
search.desktop = NULL;
search.startup_id = startup_id;
search.pid = pid;
evas_hash_foreach(e_exec_instances, _e_exec_startup_id_pid_find, &search);
return search.desktop;
}
/* local subsystem functions */
static void
_e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining)
@ -218,7 +240,7 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining)
inst->desktop = desktop;
inst->exe = exe;
inst->launch_id = startup_id;
inst->startup_id = startup_id;
inst->launch_time = ecore_time_get();
inst->expire_timer = ecore_timer_add(10.0, _e_exec_cb_expire_timer, inst);
@ -306,6 +328,29 @@ _e_exec_cb_exit(void *data, int type, void *event)
return 1;
}
static Evas_Bool
_e_exec_startup_id_pid_find(Evas_Hash *hash, const char *key, void *value, void *data)
{
E_Exec_Search *search;
Evas_List *instances, *l;
search = data;
instances = value;
for (l = instances; l; l = l->next)
{
E_Exec_Instance *inst;
inst = l->data;
if (((search->startup_id > 0) && (search->startup_id == inst->startup_id)) ||
((search->pid > 1) && (search->pid == ecore_exe_pid_get(inst->exe))))
{
search->desktop = inst->desktop;
return 0;
}
}
return 1;
}
static void
_e_exec_error_dialog(Efreet_Desktop *desktop, const char *exec, Ecore_Exe_Event_Del *event,
Ecore_Exe_Event_Data *error, Ecore_Exe_Event_Data *read)

@ -11,5 +11,7 @@ EAPI int e_exec_init(void);
EAPI int e_exec_shutdown(void);
EAPI int e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Ecore_List *files, const char *launch_method);
EAPI Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid);
#endif
#endif

@ -769,7 +769,7 @@ EAPI void
e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj)
{
E_Fm2_Smart_Data *sd;
const char *drop[] = { "enlightenment/eapp", "enlightenment/border", "text/uri-list" };
const char *drop[] = { "enlightenment/desktop", "enlightenment/border", "text/uri-list" };
sd = evas_object_smart_data_get(obj);
if (!sd) return; // safety

@ -16,8 +16,6 @@ static void _e_border_menu_cb_maximize_horizontally(void *data, E_Menu *m, E_Men
static void _e_border_menu_cb_unmaximize(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_shade(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_icon_add(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_icon_add_pre(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_prop(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_stick(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_on_top(void *data, E_Menu *m, E_Menu_Item *mi);
@ -254,6 +252,7 @@ e_int_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key, Ecore_
"e/widgets/border/default/skip_winlist");
}
#if 0
if (!bd->internal)
{
mi = e_menu_item_new(m);
@ -272,11 +271,8 @@ e_int_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key, Ecore_
e_menu_item_label_set(mi, _("Create Icon"));
e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, bd);
}
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Add App To Launcher"));
e_menu_item_submenu_pre_callback_set(mi, _e_border_menu_cb_icon_add_pre, bd);
e_util_menu_item_edje_icon_set(mi, "enlightenment/applications");
}
#endif
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
@ -535,6 +531,7 @@ _e_border_menu_cb_shade(void *data, E_Menu *m, E_Menu_Item *mi)
}
}
#if 0
static void
_e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi)
{
@ -621,74 +618,7 @@ _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi)
"change."));
}
}
static void
_e_border_menu_cb_icon_add(void *data, E_Menu *m, E_Menu_Item *mi)
{
E_App *a, *bar_apps;
E_Border *bd;
Evas_List *l;
char buf[4096];
int found = 0;
bd = e_object_data_get(E_OBJECT(m));
a = bd->app;
if (!a)
return;
snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s", e_user_homedir_get(), (char *)data);
bar_apps = e_app_new(buf, 0);
if (bar_apps)
e_app_subdir_scan(bar_apps, 0);
for (l = bar_apps->subapps; l; l = l->next)
{
E_App *ap;
ap = l->data;
if (!ap) continue;
if (!e_app_valid_exe_get(ap)) continue;
if (!strcmp(ap->name, a->name))
{
found = 1;
break;
}
}
if (!found)
e_app_list_append(a, bar_apps);
}
static void
_e_border_menu_cb_icon_add_pre(void *data, E_Menu *m, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
E_Border *bd;
Ecore_List *dirs;
char buf[4096], *file;
bd = data;
snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar", e_user_homedir_get());
dirs = ecore_file_ls(buf);
if (!dirs) return;
subm = e_menu_new();
while ((file = ecore_list_next(dirs)))
{
if (file[0] == '.') continue;
snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s",
e_user_homedir_get(), file);
if (ecore_file_is_dir(buf))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, file);
e_menu_item_callback_set(submi, _e_border_menu_cb_icon_add, file);
}
}
e_object_data_set(E_OBJECT(subm), bd);
e_menu_item_submenu_set(mi, subm);
}
#endif
static void
_e_border_menu_cb_prop(void *data, E_Menu *m, E_Menu_Item *mi)

@ -1368,7 +1368,6 @@ _e_int_menus_lost_clients_pre_cb(void *data, E_Menu *m)
for (l = borders; l; l = l->next)
{
E_Border *bd = l->data;
E_App *a;
const char *title = "";
title = e_border_name_get(bd);
@ -1381,8 +1380,7 @@ _e_int_menus_lost_clients_pre_cb(void *data, E_Menu *m)
e_object_ref(E_OBJECT(bd));
// e_object_breadcrumb_add(E_OBJECT(bd), "lost_clients_menu");
e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
a = bd->app;
if (a) e_app_icon_add_to_menu_item(a, mi);
if (bd->desktop) e_util_desktop_menu_item_icon_add(bd->desktop, "24x24", mi);
}
e_object_free_attach_func_set(E_OBJECT(m),
_e_int_menus_lost_clients_free_hook);

@ -861,6 +861,33 @@ e_util_desktop_icon_add(Efreet_Desktop *desktop, const char *size, Evas *evas)
return NULL;
}
EAPI void
e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, const char *size, E_Menu_Item *mi)
{
const char *path = NULL;
if ((!desktop) || (!desktop->icon)) return;
if (desktop->icon[0] == '/') path = desktop->icon;
else path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, size);
if (path)
{
const char *ext;
ext = strrchr(path, '.');
if (ext)
{
if (strcmp(ext, ".edj") == 0)
e_menu_item_icon_edje_set(mi, path, "icon");
else
e_menu_item_icon_file_set(mi, path);
}
else
e_menu_item_icon_file_set(mi, path);
}
}
/* local subsystem functions */
static void
_e_util_container_fake_mouse_up_cb(void *data)

@ -51,6 +51,7 @@ EAPI void e_util_library_path_strip(void);
EAPI void e_util_library_path_restore(void);
EAPI Evas_Object *e_util_icon_add(const char *path, Evas *evas);
EAPI Evas_Object *e_util_desktop_icon_add(Efreet_Desktop *desktop, const char *size, Evas *evas);
EAPI void e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, const char *size, E_Menu_Item *mi);
#endif
#endif

@ -1083,23 +1083,14 @@ _ibar_inst_cb_drop(void *data, const char *type, void *event_info)
{
app = ev->data;
}
#if 0
else if (!strcmp(type, "enlightenment/border"))
{
E_Border *bd;
bd = ev->data;
app = bd->app;
app = bd->desktop;
if (!app)
{
app = e_app_border_find(bd);
}
if (!app)
{
app = e_app_launch_id_pid_find(bd->client.netwm.startup_id,
bd->client.netwm.pid);
}
#if 0
if (!app)
{
char *bname = NULL, *bclass = NULL;
@ -1147,8 +1138,8 @@ _ibar_inst_cb_drop(void *data, const char *type, void *event_info)
e_eap_edit_show(e_container_current_get(e_manager_current_get()), app);
}
}
}
#endif
}
else if (!strcmp(type, "text/uri-list"))
{
fl = ev->data;

Loading…
Cancel
Save