]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/taskbar.cpp
1 /////////////////////////////////////////////////////////////////////////
2 // File: src/gtk/taskbar.cpp
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 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
17 #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 g_object_ref(m_widget
);
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*/);
48 // WM frame extents are not useful for wxTaskBarIcon
50 gulong handler_id
= g_signal_handler_find(
52 GSignalMatchType(G_SIGNAL_MATCH_ID
| G_SIGNAL_MATCH_DATA
),
53 g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET
),
56 g_signal_handler_disconnect(m_widget
, handler_id
);
58 m_invokingWindow
= NULL
;
61 bool wxTaskBarIconAreaBase::IsProtocolSupported()
63 static int s_supported
= -1;
64 if (s_supported
== -1)
66 Display
*display
= GDK_DISPLAY();
67 Screen
*screen
= DefaultScreenOfDisplay(display
);
70 g_snprintf(name
, sizeof(name
), "_NET_SYSTEM_TRAY_S%d",
71 XScreenNumberOfScreen(screen
));
72 Atom atom
= XInternAtom(display
, name
, False
);
74 Window manager
= XGetSelectionOwner(display
, atom
);
76 s_supported
= (manager
!= None
);
79 return (bool)s_supported
;
82 //-----------------------------------------------------------------------------
84 //-----------------------------------------------------------------------------
86 #if wxUSE_MENUS_NATIVE
87 void wxTaskBarIconAreaBase::DoPopupMenuUpdateUI(wxMenu
* menu
)
89 menu
->UpdateUI(m_invokingWindow
);
91 #endif // wxUSE_MENUS_NATIVE
92 #endif // wxUSE_TASKBARICON