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) 2012 Martin Gräßlin <mgraesslin@kde.org> |
8 | |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by |
11 | the Free Software Foundation; either version 2 of the License, or |
12 | (at your option) any later version. |
13 | |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | *********************************************************************/ |
22 | |
23 | #ifndef KWIN_KILLWINDOW_H |
24 | #define KWIN_KILLWINDOW_H |
25 | |
26 | #include <xcb/xcb.h> |
27 | |
28 | typedef union _XEvent XEvent; |
29 | |
30 | namespace KWin |
31 | { |
32 | |
33 | class KillWindow |
34 | { |
35 | public: |
36 | |
37 | KillWindow(); |
38 | ~KillWindow(); |
39 | |
40 | void start(); |
41 | bool isActive() const { |
42 | return m_active; |
43 | } |
44 | bool isResponsibleForEvent(int eventType) const; |
45 | // TODO: remove once event handling is ported to XCB |
46 | void processEvent(XEvent *event); |
47 | void processEvent(xcb_generic_event_t *event); |
48 | |
49 | private: |
50 | xcb_cursor_t createCursor(); |
51 | void release(); |
52 | void performKill(); |
53 | void handleKeyPress(xcb_keycode_t keycode, uint16_t state); |
54 | void handleButtonRelease(xcb_button_t button, xcb_window_t window); |
55 | void killWindowId(xcb_window_t window_to_kill); |
56 | bool m_active; |
57 | }; |
58 | |
59 | } // namespace |
60 | |
61 | #endif |
62 | |