]>
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"
24 #include "wx/gtk/taskbarpriv.h"
25 #include "eggtrayicon.h"
27 wxTaskBarIconAreaBase::wxTaskBarIconAreaBase()
29 if (IsProtocolSupported())
31 m_widget
= GTK_WIDGET(egg_tray_icon_new("systray icon"));
32 gtk_window_set_resizable(GTK_WINDOW(m_widget
), false);
34 wxLogTrace(_T("systray"), _T("using freedesktop.org systray spec"));
37 wxTopLevelWindow::Create(
38 NULL
, wxID_ANY
, _T("systray icon"),
39 wxDefaultPosition
, wxDefaultSize
,
40 wxDEFAULT_FRAME_STYLE
| wxFRAME_NO_TASKBAR
| wxSIMPLE_BORDER
|
42 wxEmptyString
/*eggtray doesn't like setting wmclass*/);
45 bool wxTaskBarIconAreaBase::IsProtocolSupported()
47 static int s_supported
= -1;
48 if (s_supported
== -1)
50 Display
*display
= GDK_DISPLAY();
51 Screen
*screen
= DefaultScreenOfDisplay(display
);
54 name
.Printf(_T("_NET_SYSTEM_TRAY_S%d"), XScreenNumberOfScreen(screen
));
55 Atom atom
= XInternAtom(display
, name
.ToAscii(), False
);
57 Window manager
= XGetSelectionOwner(display
, atom
);
59 s_supported
= (manager
!= None
);
62 return (bool)s_supported
;