From 40fcce83ba61994c8bc899e1703bd834eaed8bc4 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 14 Dec 2023 12:56:48 +0100 Subject: [PATCH] screenedge: Allow certain actions during drag and drop Most actions do not handle drag and drop properly yet (e.g. entering the overview during drag and drop is just very broken), at least allow "show desktop" and "application launcher". This allows to easily drag a file onto the desktop by starting a drag, nudging the "show desktop" screen edge and dropping it on the desktop. --- src/screenedge.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/screenedge.cpp b/src/screenedge.cpp index ff4d07fbd1..323c5c6bb3 100644 --- a/src/screenedge.cpp +++ b/src/screenedge.cpp @@ -28,6 +28,8 @@ #include "pointer_input.h" #include "utils/common.h" #include "virtualdesktops.h" +#include "wayland/seat.h" +#include "wayland_server.h" #include #include // DBus generated @@ -221,10 +223,16 @@ bool Edge::activatesForPointer() const { bool isMovingWindow = false; - // Don't activate edge when a mouse button is pressed, except when - // moving a window. Dragging a scroll bar all the way to the edge - // shouldn't activate the edge. - if (input()->pointer()->areButtonsPressed()) { + // Most actions do not handle drag and drop properly yet + // but at least allow "show desktop" and "application launcher". + if (waylandServer() && waylandServer()->seat()->isDragPointer()) { + if (!m_edges->isDesktopSwitching() && m_action != ElectricActionShowDesktop && m_action != ElectricActionApplicationLauncher) { + return false; + } + // Don't activate edge when a mouse button is pressed, except when + // moving a window. Dragging a scroll bar all the way to the edge + // shouldn't activate the edge. + } else if (input()->pointer()->areButtonsPressed()) { auto c = Workspace::self()->moveResizeWindow(); if (!c || c->isInteractiveResize()) { return false;