]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/taskbar.cpp
Removed tabs.
[wxWidgets.git] / src / gtk1 / taskbar.cpp
CommitLineData
33d4eef0
VS
1/////////////////////////////////////////////////////////////////////////
2// File: taskbar.cpp
3// Purpose: wxTaskBarIcon (src/unix/taskbarx11.cpp) helper for GTK2
4// Author: Vaclav Slavik
5// Modified by:
6// Created: 2004/05/29
7// RCS-ID: $Id$
8// Copyright: (c) Vaclav Slavik, 2004
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "taskbarpriv.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#include "wx/log.h"
20#include "wx/frame.h"
21
22#ifdef __WXGTK20__
23
24#include "wx/gtk/taskbarpriv.h"
25#include "eggtrayicon.h"
26
27wxTaskBarIconAreaBase::wxTaskBarIconAreaBase()
28{
29 if (IsProtocolSupported())
30 {
31 m_widget = GTK_WIDGET(egg_tray_icon_new("systray icon"));
32 gtk_window_set_resizable(GTK_WINDOW(m_widget), false);
33
34 wxLogTrace(_T("systray"), _T("using freedesktop.org systray spec"));
35 }
36
37 wxTopLevelWindow::Create(
38 NULL, wxID_ANY, _T("systray icon"),
39 wxDefaultPosition, wxDefaultSize,
40 wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR | wxSIMPLE_BORDER |
41 wxFRAME_SHAPED,
42 wxEmptyString /*eggtray doesn't like setting wmclass*/);
43}
44
45bool wxTaskBarIconAreaBase::IsProtocolSupported()
46{
47 static int s_supported = -1;
48 if (s_supported == -1)
49 {
50 Display *display = GDK_DISPLAY();
51 Screen *screen = DefaultScreenOfDisplay(display);
52
53 wxString name;
54 name.Printf(_T("_NET_SYSTEM_TRAY_S%d"), XScreenNumberOfScreen(screen));
55 Atom atom = XInternAtom(display, name.ToAscii(), False);
56
57 Window manager = XGetSelectionOwner(display, atom);
58
59 s_supported = (manager != None);
60 }
61
62 return (bool)s_supported;
63}
64
65#endif // __WXGTK20__