]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/taskbar.cpp
Backed-out PNG8 patch (no time to look at why
[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
e1bf3ad3 19#include "wx/gtk/taskbarpriv.h"
33d4eef0
VS
20#include "wx/log.h"
21#include "wx/frame.h"
22
5dc22463 23#include <gdk/gdkx.h>
5dc22463 24
6376cdc3
RD
25#ifdef __WXGTK20__
26#include <gtk/gtkversion.h>
27#if GTK_CHECK_VERSION(2, 1, 0)
33d4eef0 28
33d4eef0
VS
29#include "eggtrayicon.h"
30
31wxTaskBarIconAreaBase::wxTaskBarIconAreaBase()
32{
33 if (IsProtocolSupported())
34 {
35 m_widget = GTK_WIDGET(egg_tray_icon_new("systray icon"));
36 gtk_window_set_resizable(GTK_WINDOW(m_widget), false);
37
38 wxLogTrace(_T("systray"), _T("using freedesktop.org systray spec"));
39 }
40
41 wxTopLevelWindow::Create(
42 NULL, wxID_ANY, _T("systray icon"),
43 wxDefaultPosition, wxDefaultSize,
44 wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR | wxSIMPLE_BORDER |
45 wxFRAME_SHAPED,
46 wxEmptyString /*eggtray doesn't like setting wmclass*/);
47}
48
49bool wxTaskBarIconAreaBase::IsProtocolSupported()
50{
51 static int s_supported = -1;
52 if (s_supported == -1)
53 {
54 Display *display = GDK_DISPLAY();
55 Screen *screen = DefaultScreenOfDisplay(display);
56
57 wxString name;
58 name.Printf(_T("_NET_SYSTEM_TRAY_S%d"), XScreenNumberOfScreen(screen));
59 Atom atom = XInternAtom(display, name.ToAscii(), False);
60
61 Window manager = XGetSelectionOwner(display, atom);
62
63 s_supported = (manager != None);
64 }
65
66 return (bool)s_supported;
67}
68
69#endif // __WXGTK20__
6376cdc3 70#endif // GTK_CHECK_VERSION(2, 1, 0)