Changeset View
Standalone View
input.cpp
Show All 38 Lines | |||||
39 | #include "screens.h" | 39 | #include "screens.h" | ||
40 | #include "workspace.h" | 40 | #include "workspace.h" | ||
41 | #include "libinput/connection.h" | 41 | #include "libinput/connection.h" | ||
42 | #include "libinput/device.h" | 42 | #include "libinput/device.h" | ||
43 | #include "platform.h" | 43 | #include "platform.h" | ||
44 | #include "popup_input_filter.h" | 44 | #include "popup_input_filter.h" | ||
45 | #include "shell_client.h" | 45 | #include "shell_client.h" | ||
46 | #include "wayland_server.h" | 46 | #include "wayland_server.h" | ||
47 | #include "xwl/xwayland_interface.h" | ||||
47 | #include <KWayland/Server/display.h> | 48 | #include <KWayland/Server/display.h> | ||
48 | #include <KWayland/Server/fakeinput_interface.h> | 49 | #include <KWayland/Server/fakeinput_interface.h> | ||
49 | #include <KWayland/Server/seat_interface.h> | 50 | #include <KWayland/Server/seat_interface.h> | ||
50 | #include <KWayland/Server/relativepointer_interface.h> | 51 | #include <KWayland/Server/relativepointer_interface.h> | ||
51 | #include <decorations/decoratedclient.h> | 52 | #include <decorations/decoratedclient.h> | ||
52 | #include <KDecoration2/Decoration> | 53 | #include <KDecoration2/Decoration> | ||
53 | #include <KGlobalAccel> | 54 | #include <KGlobalAccel> | ||
54 | 55 | | |||
▲ Show 20 Lines • Show All 1411 Lines • ▼ Show 20 Line(s) | 1466 | if (!seat->isDragPointer()) { | |||
1466 | return false; | 1467 | return false; | ||
1467 | } | 1468 | } | ||
1468 | if (seat->isDragTouch()) { | 1469 | if (seat->isDragTouch()) { | ||
1469 | return true; | 1470 | return true; | ||
1470 | } | 1471 | } | ||
1471 | seat->setTimestamp(event->timestamp()); | 1472 | seat->setTimestamp(event->timestamp()); | ||
1472 | switch (event->type()) { | 1473 | switch (event->type()) { | ||
1473 | case QEvent::MouseMove: { | 1474 | case QEvent::MouseMove: { | ||
1474 | const auto pos = input()->globalPointer(); | 1475 | const auto pos = input()->globalPointer(); | ||
zzag: Unrelated whitespace change. | |||||
1475 | seat->setPointerPos(pos); | 1476 | seat->setPointerPos(pos); | ||
1476 | if (Toplevel *t = input()->pointer()->at()) { | 1477 | | ||
1478 | const auto eventPos = event->globalPos(); | ||||
1479 | // TODO: use InputDeviceHandler::at() here and check isClient()? | ||||
1480 | Toplevel *t = input()->findManagedToplevel(eventPos); | ||||
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… | |||||
1481 | if (auto *xwl = xwayland()) { | ||||
1482 | const auto ret = xwl->dragMoveFilter(t, eventPos); | ||||
1483 | if (ret == Xwl::DragEventReply::Ignore) { | ||||
1484 | return false; | ||||
1485 | } else if (ret == Xwl::DragEventReply::Take) { | ||||
1486 | break; | ||||
1487 | } | ||||
1488 | } | ||||
1489 | | ||||
1490 | if (t) { | ||||
1477 | // TODO: consider decorations | 1491 | // TODO: consider decorations | ||
1478 | if (t->surface() != seat->dragSurface()) { | 1492 | if (t->surface() != seat->dragSurface()) { | ||
1479 | if (AbstractClient *c = qobject_cast<AbstractClient*>(t)) { | 1493 | if (AbstractClient *c = qobject_cast<AbstractClient*>(t)) { | ||
1480 | workspace()->activateClient(c); | 1494 | workspace()->activateClient(c); | ||
1481 | } | 1495 | } | ||
1482 | seat->setDragTarget(t->surface(), t->inputTransformation()); | 1496 | seat->setDragTarget(t->surface(), t->inputTransformation()); | ||
1483 | } | 1497 | } | ||
1484 | } else { | 1498 | } else { | ||
▲ Show 20 Lines • Show All 592 Lines • ▼ Show 20 Line(s) | 2087 | if (!isScreenLocked) { | |||
2077 | } | 2091 | } | ||
2078 | const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); | 2092 | const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); | ||
2079 | foreach (Unmanaged *u, unmanaged) { | 2093 | foreach (Unmanaged *u, unmanaged) { | ||
2080 | if (u->geometry().contains(pos) && acceptsInput(u, pos)) { | 2094 | if (u->geometry().contains(pos) && acceptsInput(u, pos)) { | ||
2081 | return u; | 2095 | return u; | ||
2082 | } | 2096 | } | ||
2083 | } | 2097 | } | ||
2084 | } | 2098 | } | ||
2099 | return findManagedToplevel(pos); | ||||
2100 | } | ||||
2101 | | ||||
2102 | 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… | |||||
2103 | { | ||||
2104 | if (!Workspace::self()) { | ||||
2105 | return nullptr; | ||||
2106 | } | ||||
2107 | const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); | ||||
2085 | const ToplevelList &stacking = Workspace::self()->stackingOrder(); | 2108 | const ToplevelList &stacking = Workspace::self()->stackingOrder(); | ||
2086 | if (stacking.isEmpty()) { | 2109 | if (stacking.isEmpty()) { | ||
2087 | return NULL; | 2110 | return NULL; | ||
2088 | } | 2111 | } | ||
2089 | auto it = stacking.end(); | 2112 | auto it = stacking.end(); | ||
2090 | do { | 2113 | do { | ||
2091 | --it; | 2114 | --it; | ||
2092 | Toplevel *t = (*it); | 2115 | Toplevel *t = (*it); | ||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |
Unrelated whitespace change.