[C/C++] Show notification "balloon" on tray icon -- portable way?
for showing incoming phone calls on all desktops in my home network, I'm using two little perl scripts, one on the server that sends UDP broadcasts with all call info, one on the desktops listening for this broadcasts and showing a popup window.
Now I'd like to improve usability by rewriting the "client" side so it just sits in the tray and shows "balloon" notifications there. The result should work on Linux (opendesktop specs for tray) and windows. Windows has an API for that, see here: http://msdn.microsoft.com/en-us/magazine/cc188923.aspx.
For doing it in Linux, I found libnotify (see for example here: http://manishtech.wordpress.com/2009...ith-libnotify/). Looks nice, but as far as I understand (the documentation is POOR), it needs d-bus and is NOT portable to win32. Or maybe I'm wrong here? Does anybody know of a portable way to show these notifications, maybe using another library?
I'd prefer C, although C++ would do, too. I don't want to use Mono and Windows.Forms, which uses win32 native api and emulates it on linux, because I think it's ridiculous to carry a huge runtime around for such a little tool.
Libnotify is the only method I am aware of, and that is certainly not portable.
Displaying a system tray icon, which is the subject of your first link, is portable.
SWT Java library:
Listening on a socket to incoming UDP packets is portable too.
No, the icon itself is NOT subject of this article. I know GtkStatusIcon handles this portably, got the code for THAT working in 10 minutes ;)
It's really about the balloon notification and this particular article explains the "raw" C win32-api to do so.
Thanks MS3FGX, now I know at least ONE thing for sure. Do you have more info about libnotify? Is it possible to just use its "balloon drawing" capabilities, without the notification event communication through d-bus? Maybe I'm after all not to lazy to create separate code paths for win32 and *nix/opendesktop :o
The Qt and SWT tray icon widgets, which I've referred you to documentation on, support balloon tips.
look closer at the GtkStatusIcon interface ... it /doesn't/ have a balloon notification, only a tooltip (which can't be triggered actively but is shown for mouse-over). That's where I was coming from (although using the C binding).
But: Thanks a lot for pointing to the Qt interface. QSystemTrayIcon::showMessage() looks EXACTLY like what I've been looking for, and from the doxy description, it seems it IS portable, using native functionality of the different platforms -- great. Unfortunately it is C++ ... well then, byebye ISO-C for THIS project.
|All times are GMT -5. The time now is 08:33 PM.|