From 2f85b3c5e8546ff952bc97a9a4aed34d361dba39 Mon Sep 17 00:00:00 2001 From: Bert Gijsbers Date: Mon, 17 Jun 2024 19:48:58 +0200 Subject: [PATCH] Add support for _NET_WM_MOVERESIZE_CANCEL. --- src/movesize.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/movesize.cc b/src/movesize.cc index 0222ba49b..3048daf90 100644 --- a/src/movesize.cc +++ b/src/movesize.cc @@ -832,13 +832,17 @@ bool YFrameWindow::canSize(bool horiz, bool vert) { void YFrameWindow::netMoveSize(int x, int y, int direction) { - if (movingWindow || sizingWindow) + if (movingWindow || sizingWindow) { + if (direction == _NET_WM_MOVERESIZE_CANCEL) + endMoveSize(); return; + } - int sx[] = { -1, 0, 1, 1, 1, 0, -1, -1, }; - int sy[] = { -1, -1, -1, 0, 1, 1, 1, 0, }; + const int size = 8; + int sx[size] = { -1, 0, 1, 1, 1, 0, -1, -1, }; + int sy[size] = { -1, -1, -1, 0, 1, 1, 1, 0, }; - if (inrange(direction, 0, int ACOUNT(sx) - 1)) { + if (inrange(direction, 0, size - 1)) { MSG(("move size %d %d direction %d", x, y, direction)); startMoveSize(false, true, sx[direction], sy[direction], x, y); }