1 | /******************************************************************** |
2 | KWin - the KDE window manager |
3 | This file is part of the KDE project. |
4 | |
5 | Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> |
6 | Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> |
7 | Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com> |
8 | Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org> |
9 | |
10 | This program is free software; you can redistribute it and/or modify |
11 | it under the terms of the GNU General Public License as published by |
12 | the Free Software Foundation; either version 2 of the License, or |
13 | (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along 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 | |
30 | namespace KWin |
31 | { |
32 | |
33 | class Client; |
34 | |
35 | /** |
36 | * NET WM Protocol handler class |
37 | */ |
38 | class RootInfo : public NETRootInfo |
39 | { |
40 | private: |
41 | typedef KWin::Client Client; // Because of NET::Client |
42 | |
43 | public: |
44 | static RootInfo *create(); |
45 | static void destroy(); |
46 | |
47 | protected: |
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 | |
59 | private: |
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 | |
66 | inline RootInfo *rootInfo() |
67 | { |
68 | return RootInfo::s_self; |
69 | } |
70 | |
71 | /** |
72 | * NET WM Protocol handler class |
73 | */ |
74 | class WinInfo : public NETWinInfo2 |
75 | { |
76 | private: |
77 | typedef KWin::Client Client; // Because of NET::Client |
78 | |
79 | public: |
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 | |
87 | private: |
88 | Client * m_client; |
89 | }; |
90 | |
91 | } // KWin |
92 | |
93 | #endif |
94 | |