]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/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"
23 #include <gtk/gtkversion.h>
25 #if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 1, 0)
27 #include "wx/gtk/taskbarpriv.h"
28 #include "eggtrayicon.h"
30 wxTaskBarIconAreaBase::wxTaskBarIconAreaBase()
32 if (IsProtocolSupported())
34 m_widget
= GTK_WIDGET(egg_tray_icon_new("systray icon"));
35 gtk_window_set_resizable(GTK_WINDOW(m_widget
), false);
37 wxLogTrace(_T("systray"), _T("using freedesktop.org systray spec"));
40 wxTopLevelWindow::Create(
41 NULL
, wxID_ANY
, _T("systray icon"),
42 wxDefaultPosition
, wxDefaultSize
,
43 wxDEFAULT_FRAME_STYLE
| wxFRAME_NO_TASKBAR
| wxSIMPLE_BORDER
|
45 wxEmptyString
/*eggtray doesn't like setting wmclass*/);
48 bool wxTaskBarIconAreaBase::IsProtocolSupported()
50 static int s_supported
= -1;
51 if (s_supported
== -1)
53 Display
*display
= GDK_DISPLAY();
54 Screen
*screen
= DefaultScreenOfDisplay(display
);
57 name
.Printf(_T("_NET_SYSTEM_TRAY_S%d"), XScreenNumberOfScreen(screen
));
58 Atom atom
= XInternAtom(display
, name
.ToAscii(), False
);
60 Window manager
= XGetSelectionOwner(display
, atom
);
62 s_supported
= (manager
!= None
);
65 return (bool)s_supported
;