Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/modules/itray Modified Files: e_mod_main.c Log Message: 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. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/itray/e_mod_main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_mod_main.c 1 Feb 2006 09:36:56 -0000 1.3 +++ e_mod_main.c 1 Feb 2006 10:25:17 -0000 1.4 @@ -734,7 +734,7 @@ itb->tray->wins = NULL; 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_resize_callback_add(itb->item_object, _itray_tray_cb_resize, itb); @@ -743,7 +743,7 @@ 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); 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->dst_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _itray_tray_cb_msg, itb); @@ -762,36 +762,42 @@ for (i = 0; i < wnum; i++) { Ecore_X_Window_Attributes att; - unsigned char *data = NULL; - int count; - ecore_x_window_attributes_get(windows[i], &att); - if (!ecore_x_window_prop_property_get(windows[i], - atom_xmbed, - atom_xmbed, 32, - &data, &count)) - data = NULL; - if (!data) + if (ecore_x_window_attributes_get(windows[i], &att)) { - if (!ecore_x_window_prop_property_get(windows[i], - atom_kde_netwm_systray, - atom_xmbed, 32, - &data, &count)) - data = NULL; - } - if (!data) - { - if (!ecore_x_window_prop_property_get(windows[i], - atom_kwm_dockwindow, - atom_kwm_dockwindow, 32, - &data, &count)) - data = NULL; - } - if (data) - { - _itray_tray_add(itb, windows[i]); - free(data); - data = NULL; + if (att.visible) + { + unsigned char *data = NULL; + int count; + + if (!ecore_x_window_prop_property_get(windows[i], + atom_xmbed, + atom_xmbed, 32, + &data, &count)) + data = NULL; + if (!data) + { + if (!ecore_x_window_prop_property_get(windows[i], + atom_kde_netwm_systray, + atom_xmbed, 32, + &data, &count)) + data = NULL; + } + if (!data) + { + if (!ecore_x_window_prop_property_get(windows[i], + atom_kwm_dockwindow, + atom_kwm_dockwindow, 32, + &data, &count)) + data = NULL; + } + if (data) + { + _itray_tray_add(itb, windows[i]); + free(data); + data = NULL; + } + } } } free(windows); @@ -806,6 +812,7 @@ while (itb->tray->wins) { Ecore_X_Window win; + Ecore_X_Window_Attributes att; win = (Ecore_X_Window)(itb->tray->wins->data); ecore_x_window_reparent(win, itb->con->manager->root, 0, 0); @@ -823,25 +830,24 @@ { Ecore_X_Window win; Display *display; - Window root; char buf[32]; - Atom selection_atom; + Ecore_X_Atom selection_atom; win = 0; if (active) win = itb->con->bg_win; display = ecore_x_display_get(); - root = RootWindow (display, DefaultScreen(display)); - - snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", DefaultScreen(display)); + snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", itb->con->manager->num); selection_atom = ecore_x_atom_get(buf); + /* FIXXME: nasty xlib snippets! */ XSetSelectionOwner(display, selection_atom, win, CurrentTime); - 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, CurrentTime, selection_atom, win, 0, 0); } @@ -966,22 +972,42 @@ Ecore_X_Event_Client_Message *ev; Ecore_X_Event_Window_Destroy *dst; 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; if (type == ECORE_X_EVENT_CLIENT_MESSAGE) { ev = event; - if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_OPCODE")) + if (ev->message_type == atom_opcode) { - _itray_tray_add(itb, (Ecore_X_Window)ev->data.l[2]); - /* Should proto be set according to clients _XEMBED_INFO? */ - ecore_x_client_message32_send(ev->data.l[2], - ecore_x_atom_get("_XEMBED"), - ECORE_X_EVENT_MASK_NONE, CurrentTime, - XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1); - + if (ev->data.l[1] == 0) + { + _itray_tray_add(itb, (Ecore_X_Window)ev->data.l[2]); + /* Should proto be set according to clients _XEMBED_INFO? */ + ecore_x_client_message32_send(ev->data.l[2], + atom_xmbed, + ECORE_X_EVENT_MASK_NONE, CurrentTime, + XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1); + + } + 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 == ecore_x_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA")) + else if (ev->message_type == atom_message) { printf("got message\n"); } ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs