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.
This commit is contained in:
Kai Uwe Broulik 2023-12-14 12:56:48 +01:00
parent b5fb9db369
commit 40fcce83ba

View file

@ -28,6 +28,8 @@
#include "pointer_input.h" #include "pointer_input.h"
#include "utils/common.h" #include "utils/common.h"
#include "virtualdesktops.h" #include "virtualdesktops.h"
#include "wayland/seat.h"
#include "wayland_server.h"
#include <workspace.h> #include <workspace.h>
#include <x11window.h> #include <x11window.h>
// DBus generated // DBus generated
@ -221,10 +223,16 @@ bool Edge::activatesForPointer() const
{ {
bool isMovingWindow = false; bool isMovingWindow = false;
// 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 // 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 // moving a window. Dragging a scroll bar all the way to the edge
// shouldn't activate the edge. // shouldn't activate the edge.
if (input()->pointer()->areButtonsPressed()) { } else if (input()->pointer()->areButtonsPressed()) {
auto c = Workspace::self()->moveResizeWindow(); auto c = Workspace::self()->moveResizeWindow();
if (!c || c->isInteractiveResize()) { if (!c || c->isInteractiveResize()) {
return false; return false;