Another netwm hint down!

SVN revision: 15083
This commit is contained in:
sebastid 2005-06-03 11:41:20 +00:00 committed by sebastid
parent bb2b0b3b55
commit 49cdf502fb
4 changed files with 83 additions and 79 deletions

View File

@ -1430,8 +1430,35 @@ e_border_act_kill_begin(E_Border *bd)
e_object_del(E_OBJECT(bd));
}
void e_border_icon_add(E_Border *bd, Evas *e)
/* FIXME: Prefer app icon or own icon? */
Evas_Object *
e_border_icon_add(E_Border *bd, Evas *evas)
{
Evas_Object *o;
o = NULL;
if (bd->client.netwm.icon.data)
{
printf("icon size: %d %d\n", bd->client.netwm.icon.width, bd->client.netwm.icon.height);
o = e_icon_add(evas);
e_icon_data_set(o, bd->client.netwm.icon.data,
bd->client.netwm.icon.width,
bd->client.netwm.icon.height);
e_icon_alpha_set(o, 1);
}
else 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);
if (a)
{
o = edje_object_add(evas);
edje_object_file_set(o, a->path, "icon");
}
}
return o;
}
void
@ -2889,44 +2916,7 @@ _e_border_eval(E_Border *bd)
if (pname) free(pname);
if (pclass) free(pclass);
if (nc_change)
{
E_App *a;
a = NULL;
if (bd->icon_object)
{
evas_object_del(bd->icon_object);
bd->icon_object = NULL;
}
if ((bd->client.icccm.name) && (bd->client.icccm.class))
{
printf("name: %s, class: %s\n", bd->client.icccm.name, bd->client.icccm.class);
a = e_app_window_name_class_find(bd->client.icccm.name,
bd->client.icccm.class);
if (a)
{
bd->icon_object = edje_object_add(bd->bg_evas);
edje_object_file_set(bd->icon_object, a->path, "icon");
if (bd->bg_object)
{
evas_object_show(bd->icon_object);
edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
}
else
{
evas_object_hide(bd->icon_object);
}
}
}
{
E_Event_Border_Icon_Change *ev;
ev = calloc(1, sizeof(E_Event_Border_Icon_Change));
ev->border = bd;
e_object_ref(E_OBJECT(bd));
ecore_event_add(E_EVENT_BORDER_ICON_CHANGE, ev, _e_border_event_border_icon_change_free, NULL);
}
}
bd->changes.icon = 1;
bd->client.icccm.fetch.name_class = 0;
}
if (bd->client.icccm.fetch.icon_name)
@ -2943,7 +2933,6 @@ _e_border_eval(E_Border *bd)
bd->client.netwm.fetch.icon_name = 0;
}
/*
if (bd->client.netwm.fetch.icon)
{
if (bd->client.netwm.icon.data) free(bd->client.netwm.icon.data);
@ -2952,30 +2941,38 @@ _e_border_eval(E_Border *bd)
&bd->client.netwm.icon.data, &bd->client.netwm.icon.size))
printf("ERROR: Fetch icon from client\n");
else
{
if (bd->icon_object)
{
evas_object_del(bd->icon_object);
bd->icon_object = NULL;
}
bd->icon_object = e_icon_add(bd->bg_evas);
e_icon_data_set(bd->icon_object, bd->client.netwm.icon.data,
bd->client.netwm.icon.width, bd->client.netwm.icon.height);
e_icon_alpha_set(bd->icon_object, 1);
if (bd->bg_object)
{
evas_object_show(bd->icon_object);
edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
}
else
{
evas_object_hide(bd->icon_object);
}
}
bd->changes.icon = 1;
bd->client.netwm.fetch.icon = 0;
}
*/
if (bd->changes.icon)
{
if (bd->icon_object)
{
evas_object_del(bd->icon_object);
bd->icon_object = NULL;
}
bd->icon_object = e_border_icon_add(bd, bd->bg_evas);
if (bd->bg_object)
{
evas_object_show(bd->icon_object);
edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
}
else
{
evas_object_hide(bd->icon_object);
}
{
E_Event_Border_Icon_Change *ev;
ev = calloc(1, sizeof(E_Event_Border_Icon_Change));
ev->border = bd;
e_object_ref(E_OBJECT(bd));
ecore_event_add(E_EVENT_BORDER_ICON_CHANGE, ev, _e_border_event_border_icon_change_free, NULL);
}
bd->changes.icon = 0;
}
if (bd->client.icccm.fetch.machine)
{
if (bd->client.icccm.machine) free(bd->client.icccm.machine);

View File

@ -252,16 +252,17 @@ struct _E_Border
Evas_List *pending_move_resize;
struct {
unsigned int visible : 1;
unsigned int pos : 1;
unsigned int size : 1;
unsigned int stack : 1;
unsigned int prop : 1;
unsigned int border : 1;
unsigned int reset_gravity : 1;
unsigned int shading : 1;
unsigned int shaded : 1;
unsigned int shape : 1;
unsigned char visible : 1;
unsigned char pos : 1;
unsigned char size : 1;
unsigned char stack : 1;
unsigned char prop : 1;
unsigned char border : 1;
unsigned char reset_gravity : 1;
unsigned char shading : 1;
unsigned char shaded : 1;
unsigned char shape : 1;
unsigned char icon : 1;
} changes;
struct {
@ -408,7 +409,7 @@ EAPI void e_border_act_menu_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down
EAPI void e_border_act_close_begin(E_Border *bd);
EAPI void e_border_act_kill_begin(E_Border *bd);
EAPI void e_border_icon_add(E_Border *bd, Evas *e);
EAPI Evas_Object *e_border_icon_add(E_Border *bd, Evas *evas);
EAPI void e_border_button_bindings_ungrab_all(void);
EAPI void e_border_button_bindings_grab_all(void);

View File

@ -208,7 +208,10 @@ e_container_current_get(E_Manager *man)
return con;
}
/* If noone is available, return the first */
return (E_Container *)man->containers->data;
if (!man->containers)
return NULL;
l = man->containers;
return (E_Container *)l->data;
}
void

View File

@ -474,7 +474,6 @@ _ibox_icon_new(IBox_Box *ibb, E_Border *bd)
char *str;
Evas_Object *o;
Evas_Coord bw, bh;
const char *file, *part;
/* FIXME: Add default icon! */
if (!bd->icon_object) return NULL;
@ -505,11 +504,11 @@ _ibox_icon_new(IBox_Box *ibb, E_Border *bd)
"modules/ibox/icon");
evas_object_show(o);
o = edje_object_add(ibb->evas);
ic->icon_object = o;
edje_object_file_get(ic->border->icon_object, &file, &part);
edje_object_file_set(o, file, part);
o = e_border_icon_add(ic->border, ibb->evas);
evas_object_resize(o, ibb->ibox->conf->iconsize, ibb->ibox->conf->iconsize);
/*
edje_extern_object_min_size_set(o, ibb->ibox->conf->iconsize, ibb->ibox->conf->iconsize);
*/
edje_object_part_swallow(ic->bg_object, "item", o);
edje_object_size_min_calc(ic->bg_object, &bw, &bh);
evas_object_pass_events_set(o, 1);
@ -534,11 +533,13 @@ _ibox_icon_new(IBox_Box *ibb, E_Border *bd)
bw, bh /* max */
);
/*
str = (char *)edje_object_data_get(ic->icon_object, "raise_on_hilight");
if (str)
{
if (atoi(str) == 1) ic->raise_on_hilight = 1;
}
*/
edje_object_signal_emit(ic->bg_object, "passive", "");
edje_object_signal_emit(ic->overlay_object, "passive", "");
@ -1233,7 +1234,9 @@ _ibox_box_iconsize_change(IBox_Box *ibb)
ic = l->data;
o = ic->icon_object;
/*
edje_extern_object_min_size_set(o, ibb->ibox->conf->iconsize, ibb->ibox->conf->iconsize);
*/
evas_object_resize(o, ibb->ibox->conf->iconsize, ibb->ibox->conf->iconsize);