Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions panels/dock/DockCompositor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Item {
function notifyXEmbedWindowMoveResult(wid, success) {
pluginManager.notifyXEmbedWindowMoveResult(wid, success)
}
function sendRightClickForSurface() {
pluginManager.sendRightClickForSurface()
}

property ListModel trayPluginSurfaces: ListModel {}
property ListModel quickPluginSurfaces: ListModel {}
Expand Down
14 changes: 14 additions & 0 deletions panels/dock/pluginmanagerextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,3 +1008,17 @@ void PluginManager::onTextInputSurfaceEnabled(QWaylandSurface *surface)
}
}
}

void PluginManager::sendRightClickForSurface()
{
QWaylandCompositor *compositor = qobject_cast<QWaylandCompositor *>(extensionContainer());
if (!compositor)
return;

QWaylandSeat *seat = compositor->defaultSeat();
if (!seat)
return;

seat->sendMousePressEvent(Qt::RightButton);
seat->sendMouseReleaseEvent(Qt::RightButton);
}
4 changes: 4 additions & 0 deletions panels/dock/pluginmanagerextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class PluginManager : public QWaylandCompositorExtensionTemplate<PluginManager>,
// result: true = success, false = error
Q_INVOKABLE void notifyXEmbedWindowMoveResult(uint32_t wid, bool result);

// Called from QML to synthesize a right-click (mouse press + release)
// on the given Wayland surface, e.g. on long press from touch input
Q_INVOKABLE void sendRightClickForSurface();

uint32_t dockPosition() const;
void setDockPosition(uint32_t dockPosition);

Expand Down
5 changes: 5 additions & 0 deletions panels/dock/tray/ShellSurfaceItemProxy.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Item {
}
TapHandler {
id: tapHandler
onLongPressed: {
if (tapHandler.point.device.type === PointerDevice.TouchScreen) {
DockCompositor.sendRightClickForSurface()
}
}
}

onVisibleChanged: function () {
Expand Down
20 changes: 19 additions & 1 deletion panels/dock/tray/quickpanel/PanelTrayItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ Control {
MouseArea {
id: mouseHandler
anchors.fill: parent
onClicked: root.clicked()
onPressed: function (mouse) {
longPressTriggered = false
isTouchSource = (mouse.source !== Qt.MouseEventNotSynthesized)
}
onPressAndHold: {
if (isTouchSource) {
longPressTriggered = true
DockCompositor.sendRightClickForSurface()
}
}
onClicked: {
if (!longPressTriggered) {
root.clicked()
}
longPressTriggered = false
}

property bool longPressTriggered: false
property bool isTouchSource: false
}
}
Loading