KWin
Loading...
Searching...
No Matches
databridge.cpp
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: 2018 Roman Gilg <subdiff@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#include "databridge.h"
10#include "clipboard.h"
11#include "dnd.h"
12#include "primary.h"
13#include "selection.h"
14#include "xwayland.h"
15
16#include "atoms.h"
18#include "wayland/datadevice.h"
20#include "wayland/seat.h"
21#include "wayland_server.h"
22#include "window.h"
23#include "workspace.h"
24
25namespace KWin
26{
27namespace Xwl
28{
29
31{
32 init();
33}
34
35void DataBridge::init()
36{
37 m_clipboard = new Clipboard(atoms->clipboard, this);
38 m_dnd = new Dnd(atoms->xdnd_selection, this);
39 m_primary = new Primary(atoms->primary, this);
40 kwinApp()->installNativeEventFilter(this);
41}
42
43bool DataBridge::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *)
44{
45 if (eventType == "xcb_generic_event_t") {
46 xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);
47 return m_clipboard->filterEvent(event) || m_dnd->filterEvent(event) || m_primary->filterEvent(event);
48 }
49 return false;
50}
51
53{
54 return m_dnd->dragMoveFilter(target);
55}
56
57} // namespace Xwl
58} // namespace KWin
59
60#include "moc_databridge.cpp"
Xcb::Atom primary
Definition atoms.h:77
Xcb::Atom clipboard
Definition atoms.h:71
Xcb::Atom xdnd_selection
Definition atoms.h:42
DragEventReply dragMoveFilter(Window *target)
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override
DragEventReply dragMoveFilter(Window *target)
Definition dnd.cpp:137
bool filterEvent(xcb_generic_event_t *event)
KWIN_EXPORT Atoms * atoms
Definition main.cpp:74