KWin
Loading...
Searching...
No Matches
x11_standalone_windowselector.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
7 SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10*/
11
12#pragma once
13
14#include "x11eventfilter.h"
15
16#include <xcb/xcb.h>
17
18#include <functional>
19
20class QPointF;
21
22namespace KWin
23{
24class Window;
25
27{
28public:
30 ~WindowSelector() override;
31
32 void start(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName);
33 void start(std::function<void(const QPointF &)> callback);
34 bool isActive() const
35 {
36 return m_active;
37 }
38 void processEvent(xcb_generic_event_t *event);
39
40 bool event(xcb_generic_event_t *event) override;
41
42private:
43 xcb_cursor_t createCursor(const QByteArray &cursorName);
44 void release();
45 void selectWindowUnderPointer();
46 void handleKeyPress(xcb_keycode_t keycode, uint16_t state);
47 void handleButtonRelease(xcb_button_t button, xcb_window_t window);
48 void selectWindowId(xcb_window_t window_to_kill);
49 bool activate(const QByteArray &cursorName = QByteArray());
50 void cancelCallback();
51 bool m_active;
52 std::function<void(KWin::Window *)> m_callback;
53 std::function<void(const QPointF &)> m_pointSelectionFallback;
54};
55
56} // namespace
void start(std::function< void(KWin::Window *)> callback, const QByteArray &cursorName)
void processEvent(xcb_generic_event_t *event)
bool event(xcb_generic_event_t *event) override