Группа :: Графические оболочки/Прочее
Пакет: tabbed
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: 0003-Support-dragging-tabs-left-and-right-with-the-mouse.patch
Скачать
Скачать
From 9ee452401368609e553028caed1ab418b40a0d7a Mon Sep 17 00:00:00 2001
From: Casey Fitzpatrick <kcghost@gmail.com>
Date: Thu, 4 May 2023 17:19:02 +0300
Subject: [PATCH 3/5] Support dragging tabs left and right with the mouse
---
tabbed.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/tabbed.c b/tabbed.c
index c413b45..50a0f87 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -88,6 +88,7 @@ typedef struct {
/* function declarations */
static void buttonpress(const XEvent *e);
+static void motionnotify(const XEvent *e);
static void cleanup(void);
static void clientmessage(const XEvent *e);
static void configurenotify(const XEvent *e);
@@ -151,6 +152,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
[KeyPress] = keypress,
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
+ [MotionNotify] = motionnotify,
};
static int bh, obh, wx, wy, ww, wh, vbh;
static unsigned int numlockmask;
@@ -209,6 +211,41 @@ buttonpress(const XEvent *e)
}
}
+void
+motionnotify(const XEvent *e)
+{
+ const XMotionEvent *ev = &e->xmotion;
+ int i, fc;
+ Arg arg;
+
+ if (ev->y < 0 || ev->y > bh)
+ return;
+
+ if (! (ev->state & Button1Mask)) {
+ return;
+ }
+
+ if (((fc = getfirsttab()) > 0 && ev->x < TEXTW(before)) || ev->x < 0)
+ return;
+
+ if (sel < 0)
+ return;
+
+ for (i = fc; i < nclients; i++) {
+ if (clients[i]->tabx > ev->x) {
+ if (i == sel+1) {
+ arg.i = 1;
+ movetab(&arg);
+ }
+ if (i == sel-1) {
+ arg.i = -1;
+ movetab(&arg);
+ }
+ break;
+ }
+ }
+}
+
void
cleanup(void)
{
@@ -1058,7 +1095,7 @@ setup(void)
XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
ButtonPressMask | ExposureMask | KeyPressMask |
PropertyChangeMask | StructureNotifyMask |
- SubstructureRedirectMask);
+ SubstructureRedirectMask | ButtonMotionMask);
xerrorxlib = XSetErrorHandler(xerror);
class_hint.res_name = wmname;
--
2.33.8