No need to duplicate this function.

SVN revision: 29907
This commit is contained in:
Sebastian Dransfeld 2007-05-07 18:01:43 +00:00
parent 2543573b2b
commit dca84398d8
5 changed files with 41 additions and 87 deletions

View File

@ -96,8 +96,6 @@ static void _e_border_move_update(E_Border *bd);
static int _e_border_cb_ping_timer(void *data);
static int _e_border_cb_kill_timer(void *data);
static char *_e_border_winid_str_get(Ecore_X_Window win);
static void _e_border_pointer_resize_begin(E_Border *bd);
static void _e_border_pointer_resize_end(E_Border *bd);
static void _e_border_pointer_move_begin(E_Border *bd);
@ -466,9 +464,9 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
bd->desk = e_desk_current_get(bd->zone);
e_container_border_add(bd);
borders = evas_list_append(borders, bd);
borders_hash = evas_hash_add(borders_hash, _e_border_winid_str_get(bd->client.win), bd);
borders_hash = evas_hash_add(borders_hash, _e_border_winid_str_get(bd->bg_win), bd);
borders_hash = evas_hash_add(borders_hash, _e_border_winid_str_get(bd->win), bd);
borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd);
borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd);
managed = 1;
ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1);
ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1);
@ -2278,7 +2276,7 @@ e_border_find_by_client_window(Ecore_X_Window win)
{
E_Border *bd;
bd = evas_hash_find(borders_hash, _e_border_winid_str_get(win));
bd = evas_hash_find(borders_hash, e_util_winid_str_get(win));
if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
(bd->client.win == win))
return bd;
@ -2290,7 +2288,7 @@ e_border_find_by_frame_window(Ecore_X_Window win)
{
E_Border *bd;
bd = evas_hash_find(borders_hash, _e_border_winid_str_get(win));
bd = evas_hash_find(borders_hash, e_util_winid_str_get(win));
if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
(bd->bg_win == win))
return bd;
@ -2302,7 +2300,7 @@ e_border_find_by_window(Ecore_X_Window win)
{
E_Border *bd;
bd = evas_hash_find(borders_hash, _e_border_winid_str_get(win));
bd = evas_hash_find(borders_hash, e_util_winid_str_get(win));
if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
(bd->win == win))
return bd;
@ -3170,9 +3168,9 @@ _e_border_free(E_Border *bd)
e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
ecore_x_window_del(bd->win);
borders_hash = evas_hash_del(borders_hash, _e_border_winid_str_get(bd->client.win), bd);
borders_hash = evas_hash_del(borders_hash, _e_border_winid_str_get(bd->bg_win), bd);
borders_hash = evas_hash_del(borders_hash, _e_border_winid_str_get(bd->win), bd);
borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd);
borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd);
borders = evas_list_remove(borders, bd);
focus_stack = evas_list_remove(focus_stack, bd);
@ -7255,26 +7253,6 @@ _e_border_cb_kill_timer(void *data)
return 0;
}
static char *
_e_border_winid_str_get(Ecore_X_Window win)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
unsigned int val;
val = (unsigned int)win;
id[0] = vals[(val >> 28) & 0xf];
id[1] = vals[(val >> 24) & 0xf];
id[2] = vals[(val >> 20) & 0xf];
id[3] = vals[(val >> 16) & 0xf];
id[4] = vals[(val >> 12) & 0xf];
id[5] = vals[(val >> 8) & 0xf];
id[6] = vals[(val >> 4) & 0xf];
id[7] = vals[(val ) & 0xf];
id[8] = 0;
return id;
}
static void
_e_border_pointer_resize_begin(E_Border *bd)
{

View File

@ -37,8 +37,6 @@ static int _e_dnd_cb_event_dnd_finished(void *data, int type, void *event);
static int _e_dnd_cb_event_dnd_drop(void *data, int type, void *event);
static int _e_dnd_cb_event_dnd_selection(void *data, int type, void *event);
static char *_e_dnd_winid_str_get(Ecore_X_Window win);
/* local subsystem globals */
typedef struct _XDnd XDnd;
@ -391,7 +389,7 @@ e_drop_xdnd_register_set(Ecore_X_Window win, int reg)
{
const char *id;
id = _e_dnd_winid_str_get(win);
id = e_util_winid_str_get(win);
if (reg)
{
if (!evas_hash_find(_drop_win_hash, id))
@ -945,7 +943,7 @@ _e_dnd_cb_event_dnd_enter(void *data, int type, void *event)
ev = event;
if (ev->source == _drag_win) return 1;
id = _e_dnd_winid_str_get(ev->win);
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
for (l = _drop_handlers; l; l = l->next)
{
@ -1018,7 +1016,7 @@ _e_dnd_cb_event_dnd_leave(void *data, int type, void *event)
ev = event;
if (ev->source == _drag_win) return 1;
id = _e_dnd_winid_str_get(ev->win);
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd leave\n");
@ -1066,7 +1064,7 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event)
ev = event;
if (ev->source == _drag_win) return 1;
id = _e_dnd_winid_str_get(ev->win);
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
rect.x = 0;
@ -1137,7 +1135,7 @@ _e_dnd_cb_event_dnd_drop(void *data, int type, void *event)
ev = event;
if (ev->source == _drag_win) return 1;
id = _e_dnd_winid_str_get(ev->win);
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd drop\n");
@ -1156,7 +1154,7 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
int i;
ev = event;
id = _e_dnd_winid_str_get(ev->win);
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
if (ev->selection != ECORE_X_SELECTION_XDND) return 1;
printf("Xdnd selection\n");
@ -1224,23 +1222,3 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
_xdnd = NULL;
return 1;
}
static char *
_e_dnd_winid_str_get(Ecore_X_Window win)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
unsigned int val;
val = (unsigned int)win;
id[0] = vals[(val >> 28) & 0xf];
id[1] = vals[(val >> 24) & 0xf];
id[2] = vals[(val >> 20) & 0xf];
id[3] = vals[(val >> 16) & 0xf];
id[4] = vals[(val >> 12) & 0xf];
id[5] = vals[(val >> 8) & 0xf];
id[6] = vals[(val >> 4) & 0xf];
id[7] = vals[(val ) & 0xf];
id[8] = 0;
return id;
}

View File

@ -3,8 +3,6 @@
*/
#include "e.h"
static char *_e_stolen_winid_str_get(Ecore_X_Window win);
typedef struct _E_Stolen_Window E_Stolen_Window;
struct _E_Stolen_Window
@ -21,7 +19,7 @@ e_stolen_win_get(Ecore_X_Window win)
{
E_Stolen_Window *esw;
esw = evas_hash_find(_e_stolen_windows, _e_stolen_winid_str_get(win));
esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
if (esw) return 1;
return 0;
}
@ -31,7 +29,7 @@ e_stolen_win_add(Ecore_X_Window win)
{
E_Stolen_Window *esw;
esw = evas_hash_find(_e_stolen_windows, _e_stolen_winid_str_get(win));
esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
if (esw)
{
esw->refcount++;
@ -41,7 +39,7 @@ e_stolen_win_add(Ecore_X_Window win)
esw = E_NEW(E_Stolen_Window, 1);
esw->win = win;
esw->refcount = 1;
_e_stolen_windows = evas_hash_add(_e_stolen_windows, _e_stolen_winid_str_get(win), esw);
_e_stolen_windows = evas_hash_add(_e_stolen_windows, e_util_winid_str_get(win), esw);
}
return;
}
@ -51,36 +49,15 @@ e_stolen_win_del(Ecore_X_Window win)
{
E_Stolen_Window *esw;
esw = evas_hash_find(_e_stolen_windows, _e_stolen_winid_str_get(win));
esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
if (esw)
{
esw->refcount--;
if (esw->refcount == 0)
{
_e_stolen_windows = evas_hash_del(_e_stolen_windows, _e_stolen_winid_str_get(win), esw);
_e_stolen_windows = evas_hash_del(_e_stolen_windows, e_util_winid_str_get(win), esw);
free(esw);
}
}
return;
}
/* local subsystem functions */
static char *
_e_stolen_winid_str_get(Ecore_X_Window win)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
unsigned int val;
val = (unsigned int)win;
id[0] = vals[(val >> 28) & 0xf];
id[1] = vals[(val >> 24) & 0xf];
id[2] = vals[(val >> 20) & 0xf];
id[3] = vals[(val >> 16) & 0xf];
id[4] = vals[(val >> 12) & 0xf];
id[5] = vals[(val >> 8) & 0xf];
id[6] = vals[(val >> 4) & 0xf];
id[7] = vals[(val ) & 0xf];
id[8] = 0;
return id;
}

View File

@ -913,6 +913,26 @@ e_util_defer_object_del(E_Object *obj)
ecore_idle_enterer_add(_e_util_cb_delayed_del, obj);
}
EAPI const char *
e_util_winid_str_get(Ecore_X_Window win)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
unsigned int val;
val = (unsigned int)win;
id[0] = vals[(val >> 28) & 0xf];
id[1] = vals[(val >> 24) & 0xf];
id[2] = vals[(val >> 20) & 0xf];
id[3] = vals[(val >> 16) & 0xf];
id[4] = vals[(val >> 12) & 0xf];
id[5] = vals[(val >> 8) & 0xf];
id[6] = vals[(val >> 4) & 0xf];
id[7] = vals[(val ) & 0xf];
id[8] = 0;
return id;
}
/* local subsystem functions */
static int
_e_util_cb_delayed_del(void *data)

View File

@ -53,6 +53,7 @@ EAPI Evas_Object *e_util_icon_theme_icon_add(const char *icon_name, const char *
EAPI void e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, const char *size, E_Menu_Item *mi);
EAPI int e_util_dir_check(const char *dir);
EAPI void e_util_defer_object_del(E_Object *obj);
EAPI const char *e_util_winid_str_get(Ecore_X_Window win);
#endif
#endif