forked from enlightenment/enlightenment
itray is a bit better - but frankly - this whole system tray shit SUCKS. a
lot of tray clients are very unstable and die at things in the spec they should handle. they go deleting their windows for no reason etc. SVN revision: 20167
This commit is contained in:
parent
fb6d71ec9e
commit
81fb7e3201
|
@ -734,7 +734,7 @@ _itray_tray_init(ITray_Box *itb)
|
||||||
itb->tray->wins = NULL;
|
itb->tray->wins = NULL;
|
||||||
|
|
||||||
evas_object_resize(itb->item_object, itb->tray->w, itb->tray->h);
|
evas_object_resize(itb->item_object, itb->tray->w, itb->tray->h);
|
||||||
evas_object_color_set(itb->item_object, 180, 0, 0, 0);
|
evas_object_color_set(itb->item_object, 0, 0, 0, 0);
|
||||||
evas_object_intercept_move_callback_add(itb->item_object, _itray_tray_cb_move, itb);
|
evas_object_intercept_move_callback_add(itb->item_object, _itray_tray_cb_move, itb);
|
||||||
evas_object_intercept_resize_callback_add(itb->item_object, _itray_tray_cb_resize, itb);
|
evas_object_intercept_resize_callback_add(itb->item_object, _itray_tray_cb_resize, itb);
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ _itray_tray_init(ITray_Box *itb)
|
||||||
evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
|
evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
|
||||||
itb->tray->win = ecore_x_window_new(itb->con->bg_win, x, y, w, h);
|
itb->tray->win = ecore_x_window_new(itb->con->bg_win, x, y, w, h);
|
||||||
ecore_x_window_container_manage(itb->tray->win);
|
ecore_x_window_container_manage(itb->tray->win);
|
||||||
ecore_x_window_background_color_set(itb->tray->win, 255, 255, 255);
|
ecore_x_window_background_color_set(itb->tray->win, 255, 0, 0);
|
||||||
|
|
||||||
itb->tray->msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _itray_tray_cb_msg, itb);
|
itb->tray->msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _itray_tray_cb_msg, itb);
|
||||||
itb->tray->dst_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _itray_tray_cb_msg, itb);
|
itb->tray->dst_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _itray_tray_cb_msg, itb);
|
||||||
|
@ -762,10 +762,14 @@ _itray_tray_init(ITray_Box *itb)
|
||||||
for (i = 0; i < wnum; i++)
|
for (i = 0; i < wnum; i++)
|
||||||
{
|
{
|
||||||
Ecore_X_Window_Attributes att;
|
Ecore_X_Window_Attributes att;
|
||||||
|
|
||||||
|
if (ecore_x_window_attributes_get(windows[i], &att))
|
||||||
|
{
|
||||||
|
if (att.visible)
|
||||||
|
{
|
||||||
unsigned char *data = NULL;
|
unsigned char *data = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
ecore_x_window_attributes_get(windows[i], &att);
|
|
||||||
if (!ecore_x_window_prop_property_get(windows[i],
|
if (!ecore_x_window_prop_property_get(windows[i],
|
||||||
atom_xmbed,
|
atom_xmbed,
|
||||||
atom_xmbed, 32,
|
atom_xmbed, 32,
|
||||||
|
@ -794,6 +798,8 @@ _itray_tray_init(ITray_Box *itb)
|
||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
free(windows);
|
free(windows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,6 +812,7 @@ _itray_tray_shutdown(ITray_Box *itb)
|
||||||
while (itb->tray->wins)
|
while (itb->tray->wins)
|
||||||
{
|
{
|
||||||
Ecore_X_Window win;
|
Ecore_X_Window win;
|
||||||
|
Ecore_X_Window_Attributes att;
|
||||||
|
|
||||||
win = (Ecore_X_Window)(itb->tray->wins->data);
|
win = (Ecore_X_Window)(itb->tray->wins->data);
|
||||||
ecore_x_window_reparent(win, itb->con->manager->root, 0, 0);
|
ecore_x_window_reparent(win, itb->con->manager->root, 0, 0);
|
||||||
|
@ -823,25 +830,24 @@ _itray_tray_active_set(ITray_Box *itb, int active)
|
||||||
{
|
{
|
||||||
Ecore_X_Window win;
|
Ecore_X_Window win;
|
||||||
Display *display;
|
Display *display;
|
||||||
Window root;
|
|
||||||
char buf[32];
|
char buf[32];
|
||||||
Atom selection_atom;
|
Ecore_X_Atom selection_atom;
|
||||||
|
|
||||||
win = 0;
|
win = 0;
|
||||||
if (active)
|
if (active)
|
||||||
win = itb->con->bg_win;
|
win = itb->con->bg_win;
|
||||||
|
|
||||||
display = ecore_x_display_get();
|
display = ecore_x_display_get();
|
||||||
root = RootWindow (display, DefaultScreen(display));
|
snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", itb->con->manager->num);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", DefaultScreen(display));
|
|
||||||
selection_atom = ecore_x_atom_get(buf);
|
selection_atom = ecore_x_atom_get(buf);
|
||||||
|
/* FIXXME: nasty xlib snippets! */
|
||||||
XSetSelectionOwner(display, selection_atom, win, CurrentTime);
|
XSetSelectionOwner(display, selection_atom, win, CurrentTime);
|
||||||
|
|
||||||
if ((active) &&
|
if ((active) &&
|
||||||
(XGetSelectionOwner(display, selection_atom) == itb->con->bg_win))
|
(XGetSelectionOwner(display, selection_atom) == itb->con->bg_win))
|
||||||
{
|
{
|
||||||
ecore_x_client_message32_send(root, ecore_x_atom_get("MANAGER"),
|
printf("send message thast we own the tray now\n");
|
||||||
|
ecore_x_client_message32_send(itb->con->manager->root,
|
||||||
|
ecore_x_atom_get("MANAGER"),
|
||||||
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
|
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
|
||||||
CurrentTime, selection_atom, win, 0, 0);
|
CurrentTime, selection_atom, win, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -966,22 +972,42 @@ _itray_tray_cb_msg(void *data, int type, void *event)
|
||||||
Ecore_X_Event_Client_Message *ev;
|
Ecore_X_Event_Client_Message *ev;
|
||||||
Ecore_X_Event_Window_Destroy *dst;
|
Ecore_X_Event_Window_Destroy *dst;
|
||||||
ITray_Box *itb;
|
ITray_Box *itb;
|
||||||
|
static Ecore_X_Atom atom_opcode = 0;
|
||||||
|
static Ecore_X_Atom atom_message = 0;
|
||||||
|
static Ecore_X_Atom atom_xmbed = 0;
|
||||||
|
|
||||||
|
if (atom_opcode == 0)
|
||||||
|
atom_opcode = ecore_x_atom_get("_NET_SYSTEM_TRAY_OPCODE");
|
||||||
|
if (atom_message == 0)
|
||||||
|
atom_message = ecore_x_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA");
|
||||||
|
if (atom_xmbed == 0)
|
||||||
|
atom_xmbed = ecore_x_atom_get("_XEMBED");
|
||||||
itb = data;
|
itb = data;
|
||||||
if (type == ECORE_X_EVENT_CLIENT_MESSAGE)
|
if (type == ECORE_X_EVENT_CLIENT_MESSAGE)
|
||||||
{
|
{
|
||||||
ev = event;
|
ev = event;
|
||||||
if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_OPCODE"))
|
if (ev->message_type == atom_opcode)
|
||||||
|
{
|
||||||
|
if (ev->data.l[1] == 0)
|
||||||
{
|
{
|
||||||
_itray_tray_add(itb, (Ecore_X_Window)ev->data.l[2]);
|
_itray_tray_add(itb, (Ecore_X_Window)ev->data.l[2]);
|
||||||
/* Should proto be set according to clients _XEMBED_INFO? */
|
/* Should proto be set according to clients _XEMBED_INFO? */
|
||||||
ecore_x_client_message32_send(ev->data.l[2],
|
ecore_x_client_message32_send(ev->data.l[2],
|
||||||
ecore_x_atom_get("_XEMBED"),
|
atom_xmbed,
|
||||||
ECORE_X_EVENT_MASK_NONE, CurrentTime,
|
ECORE_X_EVENT_MASK_NONE, CurrentTime,
|
||||||
XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1);
|
XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA"))
|
else if (ev->data.l[1] == 1)
|
||||||
|
{
|
||||||
|
printf("begin message\n");
|
||||||
|
}
|
||||||
|
else if (ev->data.l[1] == 3)
|
||||||
|
{
|
||||||
|
printf("cacnel message\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ev->message_type == atom_message)
|
||||||
{
|
{
|
||||||
printf("got message\n");
|
printf("got message\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue