1/********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
8Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
9
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program. If not, see <http://www.gnu.org/licenses/>.
22*********************************************************************/
23#ifndef KWIN_NETINFO_H
24#define KWIN_NETINFO_H
25
26#include <KDE/NETRootInfo>
27
28#include <xcb/xcb.h>
29
30namespace KWin
31{
32
33class Client;
34
35/**
36 * NET WM Protocol handler class
37 */
38class RootInfo : public NETRootInfo
39{
40private:
41 typedef KWin::Client Client; // Because of NET::Client
42
43public:
44 static RootInfo *create();
45 static void destroy();
46
47protected:
48 virtual void changeNumberOfDesktops(int n);
49 virtual void changeCurrentDesktop(int d);
50 virtual void changeActiveWindow(Window w, NET::RequestSource src, Time timestamp, Window active_window);
51 virtual void closeWindow(Window w);
52 virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
53 virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height);
54 virtual void gotPing(Window w, Time timestamp);
55 virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
56 virtual void gotTakeActivity(Window w, Time timestamp, long flags);
57 virtual void changeShowingDesktop(bool showing);
58
59private:
60 RootInfo(xcb_window_t w, const char* name, unsigned long pr[],
61 int pr_num, int scr = -1);
62 static RootInfo *s_self;
63 friend RootInfo *rootInfo();
64};
65
66inline RootInfo *rootInfo()
67{
68 return RootInfo::s_self;
69}
70
71/**
72 * NET WM Protocol handler class
73 */
74class WinInfo : public NETWinInfo2
75{
76private:
77 typedef KWin::Client Client; // Because of NET::Client
78
79public:
80 WinInfo(Client* c, Display * display, Window window,
81 Window rwin, const unsigned long pr[], int pr_size);
82 virtual void changeDesktop(int desktop);
83 virtual void changeFullscreenMonitors(NETFullscreenMonitors topology);
84 virtual void changeState(unsigned long state, unsigned long mask);
85 void disable();
86
87private:
88 Client * m_client;
89};
90
91} // KWin
92
93#endif
94