]>
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 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*/);
47 // WM frame extents are not useful for wxTaskBarIcon
49 gulong handler_id
= g_signal_handler_find(
51 GSignalMatchType(G_SIGNAL_MATCH_ID
| G_SIGNAL_MATCH_DATA
),
52 g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET
),
55 g_signal_handler_disconnect(m_widget
, handler_id
);
57 m_invokingWindow
= NULL
;
60 bool wxTaskBarIconAreaBase::IsProtocolSupported()
62 static int s_supported
= -1;
63 if (s_supported
== -1)
65 Display
*display
= GDK_DISPLAY();
66 Screen
*screen
= DefaultScreenOfDisplay(display
);
69 g_snprintf(name
, sizeof(name
), "_NET_SYSTEM_TRAY_S%d",
70 XScreenNumberOfScreen(screen
));
71 Atom atom
= XInternAtom(display
, name
, False
);
73 Window manager
= XGetSelectionOwner(display
, atom
);
75 s_supported
= (manager
!= None
);
78 return (bool)s_supported
;
81 //-----------------------------------------------------------------------------
83 //-----------------------------------------------------------------------------
85 #if wxUSE_MENUS_NATIVE
86 void wxTaskBarIconAreaBase::DoPopupMenuUpdateUI(wxMenu
* menu
)
88 menu
->UpdateUI(m_invokingWindow
);
90 #endif // wxUSE_MENUS_NATIVE
91 #endif // wxUSE_TASKBARICON