Changeset View
Standalone View
input.cpp
Show All 36 Lines | |||||
37 | #include "screens.h" | 37 | #include "screens.h" | ||
38 | #include "workspace.h" | 38 | #include "workspace.h" | ||
39 | #include "libinput/connection.h" | 39 | #include "libinput/connection.h" | ||
40 | #include "libinput/device.h" | 40 | #include "libinput/device.h" | ||
41 | #include "platform.h" | 41 | #include "platform.h" | ||
42 | #include "popup_input_filter.h" | 42 | #include "popup_input_filter.h" | ||
43 | #include "shell_client.h" | 43 | #include "shell_client.h" | ||
44 | #include "wayland_server.h" | 44 | #include "wayland_server.h" | ||
45 | #include "xwl/xwayland_iface.h" | ||||
45 | #include <KWayland/Server/display.h> | 46 | #include <KWayland/Server/display.h> | ||
46 | #include <KWayland/Server/fakeinput_interface.h> | 47 | #include <KWayland/Server/fakeinput_interface.h> | ||
47 | #include <KWayland/Server/seat_interface.h> | 48 | #include <KWayland/Server/seat_interface.h> | ||
48 | #include <KWayland/Server/relativepointer_interface.h> | 49 | #include <KWayland/Server/relativepointer_interface.h> | ||
49 | #include <decorations/decoratedclient.h> | 50 | #include <decorations/decoratedclient.h> | ||
50 | #include <KDecoration2/Decoration> | 51 | #include <KDecoration2/Decoration> | ||
51 | #include <KGlobalAccel> | 52 | #include <KGlobalAccel> | ||
52 | 53 | | |||
▲ Show 20 Lines • Show All 1383 Lines • ▼ Show 20 Line(s) | 1436 | public: | |||
1436 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | 1437 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | ||
1437 | auto seat = waylandServer()->seat(); | 1438 | auto seat = waylandServer()->seat(); | ||
1438 | if (!seat->isDragPointer()) { | 1439 | if (!seat->isDragPointer()) { | ||
1439 | return false; | 1440 | return false; | ||
1440 | } | 1441 | } | ||
1441 | seat->setTimestamp(event->timestamp()); | 1442 | seat->setTimestamp(event->timestamp()); | ||
1442 | switch (event->type()) { | 1443 | switch (event->type()) { | ||
1443 | case QEvent::MouseMove: { | 1444 | case QEvent::MouseMove: { | ||
1444 | if (Toplevel *t = input()->findToplevel(event->globalPos())) { | 1445 | Toplevel *t = input()->findManagedToplevel(event->globalPos()); | ||
zzag: Unrelated whitespace change. | |||||
1446 | if (auto *xwl = xwayland()) { | ||||
1447 | const auto ret = xwl->dragMoveFilter(t, event); | ||||
1448 | if (ret == Xwl::DragEventReply::Ignore) { | ||||
zzag: Stupid question: why only managed? | |||||
It's an X workaround: a drag can have a Pixmap as drag icon. Then, if the drag icon is below the cursor, we would identify this one as target instead of the real window below it. With this workaround we solve this problem with the downside that we can't drop anymore on unmanaged windows. but there are probably not many / any X clients with unmanaged windows accepting drags anyway. romangg: It's an X workaround: a drag can have a Pixmap as drag icon. Then, if the drag icon is below… | |||||
1449 | return false; | ||||
1450 | } else if (ret == Xwl::DragEventReply::Take) { | ||||
1451 | break; | ||||
1452 | } | ||||
1453 | } | ||||
1454 | if (t) { | ||||
1445 | // TODO: consider decorations | 1455 | // TODO: consider decorations | ||
1446 | if (t->surface() != seat->dragSurface()) { | 1456 | if (t->surface() != seat->dragSurface()) { | ||
1447 | if (AbstractClient *c = qobject_cast<AbstractClient*>(t)) { | 1457 | if (AbstractClient *c = qobject_cast<AbstractClient*>(t)) { | ||
1448 | workspace()->activateClient(c); | 1458 | workspace()->activateClient(c); | ||
1449 | } | 1459 | } | ||
1450 | seat->setPointerPos(event->globalPos()); | 1460 | seat->setPointerPos(event->globalPos()); | ||
1451 | seat->setDragTarget(t->surface(), event->globalPos(), t->inputTransformation()); | 1461 | seat->setDragTarget(t->surface(), event->globalPos(), t->inputTransformation()); | ||
1452 | } | 1462 | } | ||
▲ Show 20 Lines • Show All 506 Lines • ▼ Show 20 Line(s) | 1965 | if (!isScreenLocked) { | |||
1959 | } | 1969 | } | ||
1960 | const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); | 1970 | const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); | ||
1961 | foreach (Unmanaged *u, unmanaged) { | 1971 | foreach (Unmanaged *u, unmanaged) { | ||
1962 | if (u->geometry().contains(pos) && acceptsInput(u, pos)) { | 1972 | if (u->geometry().contains(pos) && acceptsInput(u, pos)) { | ||
1963 | return u; | 1973 | return u; | ||
1964 | } | 1974 | } | ||
1965 | } | 1975 | } | ||
1966 | } | 1976 | } | ||
1977 | return findManagedToplevel(pos); | ||||
1978 | } | ||||
1979 | | ||||
1980 | Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos) | ||||
The name is confusing. Currently, it implies that this method looks for a managed client, which seams not the case. zzag: The name is confusing. Currently, it implies that this method looks for a managed client, which… | |||||
Why is it not the case? In the stacking_order only the managed ones are, not? romangg: Why is it not the case? In the stacking_order only the managed ones are, not? | |||||
zzag: Because we don't have concept of managed windows for wayland clients. | |||||
zzag: s/managed windows for wayland clients/managed clients on Wayland/ | |||||
We also want to find managed X windows by that, not only Wayland windows. And a Wayland window is always managed in a sense. Other way to say it would be findWindowsThatAreNotUnmanaged. ;) romangg: We also want to find managed X windows by that, not only Wayland windows. And a Wayland window… | |||||
I'd just use an enum, e.g. Toplevel *findToplevel(const QPoint &pos, FindToplevelOptions options); or something like that. zzag: I'd just use an enum, e.g.
```lang=cpp
Toplevel *findToplevel(const QPoint &pos… | |||||
1981 | { | ||||
1982 | if (!Workspace::self()) { | ||||
1983 | return nullptr; | ||||
1984 | } | ||||
1985 | const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); | ||||
1967 | const ToplevelList &stacking = Workspace::self()->stackingOrder(); | 1986 | const ToplevelList &stacking = Workspace::self()->stackingOrder(); | ||
1968 | if (stacking.isEmpty()) { | 1987 | if (stacking.isEmpty()) { | ||
1969 | return NULL; | 1988 | return NULL; | ||
1970 | } | 1989 | } | ||
1971 | auto it = stacking.end(); | 1990 | auto it = stacking.end(); | ||
1972 | do { | 1991 | do { | ||
1973 | --it; | 1992 | --it; | ||
1974 | Toplevel *t = (*it); | 1993 | Toplevel *t = (*it); | ||
▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines |
Unrelated whitespace change.