commit f05cef75105f6fc31c2fc5f46ccf950aa84e663e
parent 1d899e5b1a6f6b9c3b9c7718f81f4ff727ab52a3
Author: Lucas de Sena <lucas@seninha.org>
Date: Sat, 20 May 2023 15:09:16 -0300
do not detach tab when deleting it
also raise container on alt+tab
Diffstat:
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/xcontainer.c b/xcontainer.c
@@ -274,6 +274,21 @@ tabnew(Window win, Window leader, int ignoreunmap)
return tab;
}
+/* remove tab from row's tab queue */
+static void
+tabremove(struct Row *row, struct Tab *tab)
+{
+ if (row->seltab == tab) {
+ row->seltab = (struct Tab *)TAILQ_PREV((struct Object *)tab, Queue, entry);
+ if (row->seltab == NULL) {
+ row->seltab = (struct Tab *)TAILQ_NEXT((struct Object *)tab, entry);
+ }
+ }
+ row->ntabs--;
+ TAILQ_REMOVE(&row->tabq, (struct Object *)tab, entry);
+ tab->row = NULL;
+}
+
/* delete tab */
static void
tabdel(struct Tab *tab)
@@ -284,7 +299,7 @@ tabdel(struct Tab *tab)
XDestroyWindow(dpy, dial->obj.win);
unmanagedialog((struct Object *)dial, 0);
}
- tabdetach(tab, 0, 0);
+ tabremove(tab->row, tab);
if (tab->pixtitle != None)
XFreePixmap(dpy, tab->pixtitle);
if (tab->pix != None)
@@ -1617,24 +1632,16 @@ containerbacktoplace(struct Container *c, int restack)
XFlush(dpy);
}
-/* detach tab from row */
+/* detach tab from row, placing it at x,y */
void
tabdetach(struct Tab *tab, int x, int y)
{
struct Row *row;
row = tab->row;
- if (row->seltab == tab) {
- row->seltab = (struct Tab *)TAILQ_PREV((struct Object *)tab, Queue, entry);
- if (row->seltab == NULL) {
- row->seltab = (struct Tab *)TAILQ_NEXT((struct Object *)tab, entry);
- }
- }
- row->ntabs--;
+ tabremove(row, tab);
tab->ignoreunmap = IGNOREUNMAP;
XReparentWindow(dpy, tab->title, root, x, y);
- TAILQ_REMOVE(&row->tabq, (struct Object *)tab, entry);
- tab->row = NULL;
rowcalctabs(row);
}
diff --git a/xevents.c b/xevents.c
@@ -802,6 +802,7 @@ done:
containerbacktoplace(c, 1);
wm.focused = prevfocused;
tabfocus(c->selcol->selrow->seltab, 0);
+ containerraise(c, c->isfullscreen, c->abovebelow);
}
/* detach tab from window with mouse */