SVN revision: 15596
This commit is contained in:
Carsten Haitzler 2005-07-01 04:09:30 +00:00
parent 3194e7112c
commit 5c5ae983d7
11 changed files with 120 additions and 52 deletions

7
TODO
View File

@ -80,10 +80,6 @@ Some of the things (in very short form) that need to be done to E17...
* some sort of gui display of a desktop name (in the pager?)
* window icons should be able to be chosen if e eapp icon overrides netwm
icon or the other way around.
* eaps need to provide title matching too as well as name and class
* add locale and encoding fields to eapp files (to launch eapp in that
locale+encoding)
* add input method selector stuff to eapp - same as locale
* transients should have option to always follow parent
(move/resize/raise/lower)
* actions to make current zone different (warp mouse to there)
@ -177,6 +173,9 @@ Some of the things (in very short form) that need to be done to E17...
"NICE TO HAVE" FEATURES
-------------------------------------------------------------------------------
* add locale and encoding fields to eapp files (to launch eapp in that
locale+encoding)
* add input method selector stuff to eapp - same as locale
* "run command" typebuffer thing
* icons should be able to be overidden from the theme (eapp and menu stuff
etc.)

View File

@ -22,6 +22,20 @@ AC_C___ATTRIBUTE__
AC_CHECK_FUNCS(setenv)
AC_CHECK_FUNCS(unsetenv)
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then
AC_CHECK_LIB(fnmatch, fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch])
else
fnmatch_libs="-lfnmatch"
fi
fi
AC_SUBST(fnmatch_libs)
MODULE_ARCH="$host_os-$host_cpu"
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
@ -185,7 +199,7 @@ AC_ARG_WITH(embryo-config,
embryo_cflags=`$EMBRYO_CONFIG --cflags`
embryo_libs=`$EMBRYO_CONFIG --libs`
e_libs=$evas_libs" "$ecore_libs" "$edje_libs" "$eet_libs" "$embryo_libs" "$LIBINTL" "
e_libs=$evas_libs" "$ecore_libs" "$edje_libs" "$eet_libs" "$embryo_libs" "$LIBINTL" "$fnmatch_libs" "
e_cflags=$evas_cflags" "$ecore_cflags" "$edje_cflags" "$eet_cflags" "$embryo_cflags" "
AC_SUBST(e_libs)
AC_SUBST(e_cflags)

View File

@ -16,6 +16,7 @@
#include <sys/param.h>
#include <dlfcn.h>
#include <math.h>
#include <fnmatch.h>
#include <Evas.h>
#include <Ecore.h>

View File

@ -516,7 +516,7 @@ e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch),
}
E_App *
e_app_window_name_class_find(char *name, char *class)
e_app_window_name_class_title_find(char *name, char *class, char *title)
{
Evas_List *l;
@ -526,24 +526,27 @@ e_app_window_name_class_find(char *name, char *class)
for (l = _e_apps_list; l; l = l->next)
{
E_App *a;
int ok;
a = l->data;
if ((a->win_name) || (a->win_class))
ok = 0;
if ((a->win_name) || (a->win_class) || (a->win_title))
{
int ok = 0;
if ((!a->win_name) ||
((a->win_name) && name && (!strcmp(a->win_name, name))))
((a->win_name) && (name) && (!strcmp(a->win_name, name))))
ok++;
if ((!a->win_class) ||
((a->win_class) && class && (!strcmp(a->win_class, class))))
((a->win_class) && (class) && (!strcmp(a->win_class, class))))
ok++;
if (ok >= 2)
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
if ((!a->win_title) ||
((a->win_title) && (title) && (e_util_glob_match(title, a->win_title))))
ok++;
}
if (ok >= 3)
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
}
return NULL;
@ -819,6 +822,15 @@ _e_app_fields_fill(E_App *a, const char *path)
a->win_class = str;
free(v);
}
v = eet_read(ef, "app/window/title", &size);
if (v)
{
str = malloc(size + 1);
memcpy(str, v, size);
str[size] = 0;
a->win_title = str;
free(v);
}
v = eet_read(ef, "app/info/startup_notify", &size);
if (v)
{

View File

@ -37,6 +37,7 @@ struct _E_App
char *win_name; /* window name */
char *win_class; /* window class */
char *win_title; /* window title */
Evas_List *subapps; /* if this a directory, a list of more E_App's */
@ -74,7 +75,7 @@ EAPI void e_app_remove(E_App *remove);
EAPI void e_app_change_callback_add(void (*func) (void *data, E_App *a, E_App_Change ch), void *data);
EAPI void e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch), void *data);
EAPI E_App *e_app_window_name_class_find(char *name, char *class);
EAPI E_App *e_app_window_name_class_title_find(char *name, char *class, char *title);
EAPI E_App *e_app_file_find(char *file);
EAPI E_App *e_app_name_find(char *name);
EAPI E_App *e_app_generic_find(char *generic);

View File

@ -1719,9 +1719,13 @@ e_border_icon_add(E_Border *bd, Evas *evas)
if ((bd->client.icccm.name) && (bd->client.icccm.class))
{
E_App *a;
a = e_app_window_name_class_find(bd->client.icccm.name,
bd->client.icccm.class);
char *title = "";
if (bd->client.netwm.name) title = bd->client.netwm.name;
else title = bd->client.icccm.title;
a = e_app_window_name_class_title_find(bd->client.icccm.name,
bd->client.icccm.class,
title);
if (a)
{
o = edje_object_add(evas);
@ -4891,12 +4895,15 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key)
if (ecore_file_app_installed("e_util_eapp_edit"))
{
char *title = "";
if (bd->client.netwm.name) title = bd->client.netwm.name;
else title = bd->client.icccm.title;
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
a = e_app_window_name_class_find(bd->client.icccm.name,
bd->client.icccm.class);
a = e_app_window_name_class_title_find(bd->client.icccm.name,
bd->client.icccm.class,
title);
if (a)
{
mi = e_menu_item_new(m);

View File

@ -23,6 +23,7 @@ main(int argc, char **argv)
int del_exe = 0;
int del_win_name = 0;
int del_win_class = 0;
int del_win_title = 0;
int del_startup_notify = 0;
int del_wait_exit = 0;
char *file = NULL;
@ -32,6 +33,7 @@ main(int argc, char **argv)
char *set_exe = NULL;
char *set_win_name = NULL;
char *set_win_class = NULL;
char *set_win_title = NULL;
int set_startup_notify = -1;
int set_wait_exit = -1;
@ -80,6 +82,12 @@ main(int argc, char **argv)
set_win_class = argv[i];
valid_args++;
}
else if ((!strcmp(argv[i], "-set-win-title")) && (i < (argc - 1)))
{
i++;
set_win_title = argv[i];
valid_args++;
}
else if ((!strcmp(argv[i], "-set-startup-notify")) && (i < (argc - 1)))
{
i++;
@ -100,6 +108,7 @@ main(int argc, char **argv)
del_exe = 1;
del_win_name = 1;
del_win_class = 1;
del_win_title = 1;
del_startup_notify = 1;
del_wait_exit = 1;
valid_args++;
@ -134,6 +143,11 @@ main(int argc, char **argv)
del_win_class = 1;
valid_args++;
}
else if ((!strcmp(argv[i], "-del-win-title")))
{
del_win_title = 1;
valid_args++;
}
else if ((!strcmp(argv[i], "-del-startup-notify")))
{
del_startup_notify = 1;
@ -199,6 +213,8 @@ main(int argc, char **argv)
eet_write(ef, "app/window/name", set_win_name, strlen(set_win_name), 0);
if (set_win_class)
eet_write(ef, "app/window/class", set_win_class, strlen(set_win_class), 0);
if (set_win_title)
eet_write(ef, "app/window/title", set_win_title, strlen(set_win_title), 0);
if (set_startup_notify >= 0)
{
unsigned char tmp[1];
@ -261,6 +277,8 @@ main(int argc, char **argv)
eet_delete(ef, "app/window/name");
if (del_win_class)
eet_delete(ef, "app/window/class");
if (del_win_title)
eet_delete(ef, "app/window/title");
if (del_startup_notify)
eet_delete(ef, "app/info/startup_notify");
if (del_wait_exit)
@ -283,14 +301,16 @@ _e_help(void)
" -set-exe EXE Set the application execute line\n"
" -set-win-name WIN_NAME Set the application window name\n"
" -set-win-class WIN_CLASS Set the application window class\n"
" -set-startup-notify [1/0] Set the application startup notify flag to on/off\n"
" -set-wait-exit [1/0] Set the application wait exit flag to on/off\n"
" -set-win-title WIN_TITLE Set the application window title glob\n"
" -set-startup-notify [1/0] Set the application startup notify flag\n"
" -set-wait-exit [1/0] Set the application wait exit flag\n"
" -del-name Delete the application name\n"
" -del-generic Delete the application generic name\n"
" -del-comment Delete the application comment\n"
" -del-exe Delete the application execute line\n"
" -del-win-name Delete the application window name\n"
" -del-win-class Delete the application window class\n"
" -del-win-title Delete the application window title glob\n"
" -del-startup-notify Delete the application startup notify flag\n"
" -del-wait-exit Delete the application wait exit flag\n"
);

View File

@ -553,7 +553,10 @@ _e_int_menus_clients_pre_cb(void *data, E_Menu *m)
{
E_Border *bd = l->data;
E_App *a;
char *title = "";
if (bd->client.netwm.name) title = bd->client.netwm.name;
else title = bd->client.icccm.title;
mi = e_menu_item_new(m);
e_menu_item_check_set(mi, 1);
if (bd->client.netwm.name)
@ -567,8 +570,9 @@ _e_int_menus_clients_pre_cb(void *data, E_Menu *m)
e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");
e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
a = e_app_window_name_class_find(bd->client.icccm.name,
bd->client.icccm.class);
a = e_app_window_name_class_title_find(bd->client.icccm.name,
bd->client.icccm.class,
title);
if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
}
mi = e_menu_item_new(m);
@ -807,7 +811,10 @@ _e_int_menus_lost_clients_pre_cb(void *data, E_Menu *m)
{
E_Border *bd = l->data;
E_App *a;
char *title = "";
if (bd->client.netwm.name) title = bd->client.netwm.name;
else title = bd->client.icccm.title;
mi = e_menu_item_new(m);
if (bd->client.netwm.name)
e_menu_item_label_set(mi, bd->client.netwm.name);
@ -819,8 +826,9 @@ _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 = e_app_window_name_class_find(bd->client.icccm.name,
bd->client.icccm.class);
a = e_app_window_name_class_title_find(bd->client.icccm.name,
bd->client.icccm.class,
title);
if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
}
e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_lost_clients_free_hook);

View File

@ -120,3 +120,15 @@ e_util_utils_installed(void)
return ecore_file_app_installed("emblem");
}
int
e_util_glob_match(char *str, char *glob)
{
if (glob[0] == 0)
{
if (str[0] == 0) return 1;
return 0;
}
if (!strcmp(glob, "*")) return 1;
if (!fnmatch(glob, str, 0)) return 1;
return 0;
}

View File

@ -6,13 +6,14 @@
#ifndef E_UTILS_H
#define E_UTILS_H
EAPI void e_util_container_fake_mouse_up_later(E_Container *con, int button);
EAPI void e_util_container_fake_mouse_up_all_later(E_Container *con);
EAPI void e_util_wakeup(void);
EAPI void e_util_env_set(const char *var, const char *val);
EAPI void e_util_container_fake_mouse_up_later(E_Container *con, int button);
EAPI void e_util_container_fake_mouse_up_all_later(E_Container *con);
EAPI void e_util_wakeup(void);
EAPI void e_util_env_set(const char *var, const char *val);
EAPI E_Zone *e_util_zone_current_get(E_Manager *man);
EAPI int e_util_utils_installed(void);
EAPI int e_util_app_installed(char *app);
EAPI int e_util_utils_installed(void);
EAPI int e_util_app_installed(char *app);
EAPI int e_util_glob_match(char *str, char *glob);
#endif
#endif

View File

@ -618,13 +618,10 @@ _pager_window_new(Pager_Desk *pd, E_Border *border)
if (visible) evas_object_show(o);
e_layout_pack(pd->layout_object, pw->window_object);
e_layout_child_raise(pw->window_object);
app = e_app_window_name_class_find(border->client.icccm.name,
border->client.icccm.class);
if (app)
o = e_border_icon_add(border, pd->face->evas);
if (o)
{
o = edje_object_add(pd->face->evas);
pw->icon_object = o;
edje_object_file_set(o, app->path, "icon");
evas_object_show(o);
edje_object_part_swallow(pw->window_object, "icon", o);
}
@ -1133,21 +1130,17 @@ _pager_face_cb_event_border_icon_change(void *data, int type, void *event)
if (pw)
{
E_App *app;
Evas_Object *o;
if (pw->icon_object)
{
evas_object_del(pw->icon_object);
pw->icon_object = NULL;
}
app = e_app_window_name_class_find(ev->border->client.icccm.name,
ev->border->client.icccm.class);
if (app)
o = e_border_icon_add(ev->border, pd->face->evas);
if (o)
{
Evas_Object *o;
o = edje_object_add(pd->face->evas);
pw->icon_object = o;
edje_object_file_set(o, app->path, "icon");
evas_object_show(o);
edje_object_part_swallow(pw->window_object, "icon", o);
}