]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/taskbar.cpp
1 /////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTaskBarIcon (src/unix/taskbarx11.cpp) helper for GTK2
4 // Author: Vaclav Slavik
8 // Copyright: (c) Vaclav Slavik, 2004
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "taskbarpriv.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #include "wx/gtk/taskbarpriv.h"
26 #include <gtk/gtkversion.h>
27 #if GTK_CHECK_VERSION(2, 1, 0)
29 #include "eggtrayicon.h"
31 wxTaskBarIconAreaBase::wxTaskBarIconAreaBase()
33 if (IsProtocolSupported())
35 m_widget
= GTK_WIDGET(egg_tray_icon_new("systray icon"));
36 gtk_window_set_resizable(GTK_WINDOW(m_widget
), false);
38 wxLogTrace(_T("systray"), _T("using freedesktop.org systray spec"));
41 wxTopLevelWindow::Create(
42 NULL
, wxID_ANY
, _T("systray icon"),
43 wxDefaultPosition
, wxDefaultSize
,
44 wxDEFAULT_FRAME_STYLE
| wxFRAME_NO_TASKBAR
| wxSIMPLE_BORDER
|
46 wxEmptyString
/*eggtray doesn't like setting wmclass*/);
49 bool wxTaskBarIconAreaBase::IsProtocolSupported()
51 static int s_supported
= -1;
52 if (s_supported
== -1)
54 Display
*display
= GDK_DISPLAY();
55 Screen
*screen
= DefaultScreenOfDisplay(display
);
58 name
.Printf(_T("_NET_SYSTEM_TRAY_S%d"), XScreenNumberOfScreen(screen
));
59 Atom atom
= XInternAtom(display
, name
.ToAscii(), False
);
61 Window manager
= XGetSelectionOwner(display
, atom
);
63 s_supported
= (manager
!= None
);
66 return (bool)s_supported
;
70 #endif // GTK_CHECK_VERSION(2, 1, 0)