Changeset View
Changeset View
Standalone View
Standalone View
xwl/clipboard.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include "xwayland.h" | 22 | #include "xwayland.h" | ||
23 | #include "databridge.h" | 23 | #include "databridge.h" | ||
24 | #include "selection_source.h" | 24 | #include "selection_source.h" | ||
25 | #include "transfer.h" | 25 | #include "transfer.h" | ||
26 | 26 | | |||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | #include "abstract_client.h" | 29 | #include "client.h" | ||
30 | 30 | | |||
31 | #include <KWayland/Client/connection_thread.h> | 31 | #include <KWayland/Client/connection_thread.h> | ||
32 | #include <KWayland/Client/datadevice.h> | 32 | #include <KWayland/Client/datadevice.h> | ||
33 | #include <KWayland/Client/datasource.h> | 33 | #include <KWayland/Client/datasource.h> | ||
34 | 34 | | |||
35 | #include <KWayland/Server/seat_interface.h> | 35 | #include <KWayland/Server/seat_interface.h> | ||
36 | #include <KWayland/Server/datadevice_interface.h> | 36 | #include <KWayland/Server/datadevice_interface.h> | ||
37 | #include <KWayland/Server/datasource_interface.h> | 37 | #include <KWayland/Server/datasource_interface.h> | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 90 | { | |||
130 | } | 130 | } | ||
131 | connect(ddi, &KWayland::Server::DataDeviceInterface::selectionChanged, | 131 | connect(ddi, &KWayland::Server::DataDeviceInterface::selectionChanged, | ||
132 | wls, &WlSource::setDataSourceIface); | 132 | wls, &WlSource::setDataSourceIface); | ||
133 | ownSelection(true); | 133 | ownSelection(true); | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) | 136 | void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) | ||
137 | { | 137 | { | ||
138 | createX11Source(NULL); | ||||
zzag: nullptr | |||||
It takes an xcb_xfixes_selection_notify_event_t struct pointer included from xcb/xfixes.h. When I reuse components from X libraries I use the legacy NULL, because I remember that it can lead to problem if one doesn't and then gives it back to a function from such a library. romangg: It takes an xcb_xfixes_selection_notify_event_t struct pointer included from xcb/xfixes.h. When… | |||||
When? Given that NULL has to evaluate to 0, I still suggest to use nullptr. zzag: > it can lead to problem if one doesn't
When?
Given that NULL has to evaluate to 0, I still… | |||||
139 | | ||||
140 | const auto *ac = workspace()->activeClient(); | ||||
141 | if (!qobject_cast<const KWin::Client *>(ac)) { | ||||
Isn't qobject_cast preferred over bool inherits(const char *className) const? zzag: Isn't qobject_cast preferred over bool inherits(const char *className) const? | |||||
romangg: Could be. Qt doc is not clear on it. I will change it though. | |||||
142 | // clipboard is only allowed to be acquired when Xwayland has focus | ||||
143 | // TODO: can we make this stronger (window id comparision)? | ||||
144 | return; | ||||
145 | } | ||||
138 | createX11Source(event); | 146 | createX11Source(event); | ||
139 | auto *xSrc = x11Source(); | 147 | auto *xSrc = x11Source(); | ||
140 | if (xSrc) { | 148 | if (xSrc) { | ||
141 | xSrc->getTargets(); | 149 | xSrc->getTargets(); | ||
142 | } | 150 | } | ||
143 | } | 151 | } | ||
144 | 152 | | |||
145 | void Clipboard::x11OffersChanged(const QVector<QString> &added, const QVector<QString> &removed) | 153 | void Clipboard::x11OffersChanged(const QVector<QString> &added, const QVector<QString> &removed) | ||
Show All 34 Lines |
nullptr