summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authordranull <150595692+dranull@users.noreply.github.com>2023-12-29 23:38:12 +0000
committerGitHub <noreply@github.com>2023-12-30 00:38:12 +0100
commit5f8e4068e51480791dbccbe48e86910e9b3cc881 (patch)
treea3df348e7e1aa33237295504b17f63239cfda61a /src/render
parent78f9ba9fdd7e258747b862ca2ae7d4cf5335f4ed (diff)
groupbar: Middle click on groupbar to close tab (#4297)
* Prevent window swapping when the head is removed * Bring floating windows to top when selected * Allow clicks on gropubar in fullscreen 1 * Close window on groupbar with middle click
Diffstat (limited to 'src/render')
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index 9c785935..cbd7a73f 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -386,12 +386,28 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, CWindow
}
bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_pointer_button_event* e) {
- if (e->state != WLR_BUTTON_PRESSED)
- return false;
+ if (m_pWindow->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_FULL)
+ return true;
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
const int WINDOWINDEX = (BARRELATIVEX) / (m_fBarWidth + BAR_HORIZONTAL_PADDING);
+ // close window on middle click
+ if (e->button == 274) {
+ static Vector2D pressedCursorPos;
+
+ if (e->state == WLR_BUTTON_PRESSED)
+ pressedCursorPos = pos;
+ else if (e->state == WLR_BUTTON_RELEASED && pressedCursorPos == pos)
+ g_pXWaylandManager->sendCloseWindow(m_pWindow->getGroupWindowByIndex(WINDOWINDEX));
+
+ return true;
+ }
+
+ if (e->state != WLR_BUTTON_PRESSED)
+ return true;
+
+ // click on padding
if (BARRELATIVEX - (m_fBarWidth + BAR_HORIZONTAL_PADDING) * WINDOWINDEX > m_fBarWidth) {
if (!g_pCompositor->isWindowActive(m_pWindow))
g_pCompositor->focusWindow(m_pWindow);
@@ -403,8 +419,8 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
if (pWindow != m_pWindow)
pWindow->setGroupCurrent(pWindow);
- if (!g_pCompositor->isWindowActive(pWindow))
- g_pCompositor->focusWindow(pWindow);
+ if (pWindow->m_bIsFloating)
+ g_pCompositor->changeWindowZOrder(pWindow, 1);
return true;
}