Hi,

Am 13.03.2015 um 10:55 schrieb 于清:
> Hi,
> This is a help request rather than a bug report, so if you are kind enough 
> and have some spare time, pls help me find out why my xcb client won't work.
> All this xcb client trying to do is to create a system tray icon. I have read 
> the xembed and systemtray's freedesktop specification and followed their 
> instructions, but with awesome wm the tray icon is a seperate window on a 
> ridiculous position(It seems to work in KDE somehow).
> I have tried to read awesome's source, but still can't understand why my code 
> fails.

First of, your code fails here when trying to figure out the systray's depth.
However, the result of that calculation isn't used anyway, so an "#if 0" fixes 
this.

The next problem is that awesome registers your systray window as both a regular
client and as a systray window. Skipping the MapWindow request fixes this as 
well.

Patch is attached.

Cheers,
Uli
-- 
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.
--- xcbdemo.cpp.orig	2015-03-13 18:35:40.404285455 +0100
+++ xcbdemo.cpp	2015-03-13 22:53:52.958379071 +0100
@@ -153,6 +153,8 @@ int main(int argc, char* argv[])
     return 1;
   }
 
+  // All of this is not used
+#if 0
   uint8_t traywnd_depth = 0xff;
   auto tray_visualid_cookie = xcb_get_property_unchecked(connection, false, traywnd,
     ATOMS[_NET_SYSTEM_TRAY_VISUAL], XCB_ATOM_VISUALID, 0, 1);
@@ -174,10 +176,12 @@ int main(int argc, char* argv[])
   }
   xcb_free(tray_visualid_reply);
   if (traywnd_depth == 0xff) {
+    std::cerr << "can't figure out visual" << std::endl;
     xcb_disconnect(connection);
     return 1;
   }
   std::cerr << "traywnd_depth(32 means having alpha channel ): " << (int32_t)traywnd_depth << std::endl;
+#endif
 
   /* Create the window */
   uint32_t value_list[1] = {
@@ -273,7 +277,7 @@ int main(int argc, char* argv[])
   xcb_change_window_attributes(connection, traywnd, XCB_CW_EVENT_MASK, value_list);
 
   /* Map the window on the screen */
-  xcb_map_window(connection, window);
+  //xcb_map_window(connection, window);
   xcb_flush(connection);
 
   /* Dock the window to system tray */

Reply via email to