Remove current tab support

We will add a real new one later.
This commit is contained in:
Julien Danjou 2007-11-10 10:45:32 +01:00
parent 602d92d8b2
commit 1004cefa2f
9 changed files with 5 additions and 241 deletions

View File

@ -3,7 +3,7 @@
include config.mk
SRC = client.c draw.c event.c layout.c awesome.c tag.c util.c config.c screen.c statusbar.c uicb.c tab.c window.c awesome-client-common.c
SRC = client.c draw.c event.c layout.c awesome.c tag.c util.c config.c screen.c statusbar.c uicb.c window.c awesome-client-common.c
OBJ = ${SRC:.c=.o} ${LAYOUTS:.c=.o}
SRCCLIENT = awesome-client.c awesome-client-common.c util.c

View File

@ -18,7 +18,6 @@ colors
focus_border = "#6666ff"
focus_bg = "#6666ff"
focus_fg = "#ffffff"
tab_border = "#ff0000"
}
screen 0
@ -555,28 +554,4 @@ keys
command = "toggletag"
arg = "9"
}
key
{
modkey = {"Mod4"}
key = "u"
command = "viewprevtab"
}
key
{
modkey = {"Mod4"}
key = "i"
command = "viewnexttab"
}
key
{
modkey = {"Mod4", "Control"}
key = "u"
command = "untab"
}
key
{
modkey = {"Mod4", "Control"}
key = "i"
command = "tab"
}
}

View File

@ -24,7 +24,6 @@
#include <X11/extensions/shape.h>
#include "screen.h"
#include "tab.h"
#include "awesome.h"
#include "layout.h"
#include "tag.h"
@ -199,14 +198,10 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
}
if(c)
{
if(c->tab.next || c->tab.prev)
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_tab[ColBorder].pixel);
else
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
}
if(c)
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
window_grabbuttons(c->display, c->phys_screen, c->win,
True, True, awesomeconf->modkey, awesomeconf->numlockmask);
}
if(!selscreen)
return;
tag->client_sel = c;
@ -280,8 +275,6 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
c->display = awesomeconf->display;
c->phys_screen = awesomeconf->phys_screen;
c->tab.isvisible = True;
/* if window request fullscreen mode */
if(c->w == screen_info[awesomeconf->screen].width && c->h == screen_info[awesomeconf->screen].height)
{
@ -493,7 +486,6 @@ client_unmanage(Client *c, long state, awesome_config *awesomeconf)
XWindowChanges wc;
int tag;
client_untab(c);
wc.border_width = c->oldborder;
/* The server grab construct avoids race conditions. */
XGrabServer(c->display);

View File

@ -34,7 +34,6 @@
#include "tag.h"
#include "statusbar.h"
#include "layout.h"
#include "tab.h"
#include "layouts/tile.h"
#include "layouts/floating.h"
#include "layouts/max.h"
@ -95,11 +94,6 @@ const NameFuncLink UicbList[] = {
/* config.c */
{"reloadconfig", uicb_reloadconfig},
{"setstatustext", uicb_setstatustext},
/* tab.c */
{"tab", uicb_tab},
{"untab", uicb_untab},
{"viewnexttab", uicb_viewnexttab},
{"viewprevtab", uicb_viewprevtab},
{NULL, NULL}
};
@ -313,7 +307,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
awesomeconf->colors_selected[ColBorder] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_border"));
awesomeconf->colors_selected[ColBG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_bg"));
awesomeconf->colors_selected[ColFG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_fg"));
awesomeconf->colors_tab[ColBorder] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "tab_border"));
/* Statusbar */
tmp = cfg_getstr(cfg_statusbar, "position");

View File

@ -109,17 +109,6 @@ struct Client
Client *next;
/** Previous client */
Client *prev;
/** Tabs support */
struct
{
/** Next client in tab */
Client *next;
/** Previous client in tab */
Client *prev;
/** True if client is the visible one */
Bool isvisible;
/** True if client is tabbed */
} tab;
/** Window of the client */
Window win;
/** Client display */
@ -204,8 +193,6 @@ struct awesome_config
XColor colors_normal[ColLast];
/** Selected colors */
XColor colors_selected[ColLast];
/** Tabbed colors */
XColor colors_tab[ColLast];
/** Cursors */
Cursor cursor[CurLast];
/** Font */

View File

@ -300,7 +300,7 @@ void
uicb_zoom(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
@ -308,10 +308,6 @@ uicb_zoom(awesome_config *awesomeconf,
client_detach(awesomeconf->clients, sel);
client_attach(awesomeconf->clients, sel);
/* reattach tabbed windows just after the master one */
for(c = sel->tab.next; c; c = c->tab.next)
client_reattach_after(sel, c);
focus(sel, True, awesomeconf);
arrange(awesomeconf);
}

142
tab.c
View File

@ -1,142 +0,0 @@
/*
* tab.c - tab management
*
* Copyright © 2007 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "tab.h"
#include "event.h"
#include "layout.h"
void
client_untab(Client *c)
{
Client *tmp;
if(c->tab.next)
c->tab.next->tab.isvisible = True;
else if(c->tab.prev)
c->tab.prev->tab.isvisible = True;
c->tab.isvisible = True;
if(c->tab.next)
c->tab.next->tab.prev = c->tab.prev;
tmp = c->tab.next;
c->tab.next = NULL;
if(c->tab.prev)
c->tab.prev->tab.next = tmp;
c->tab.prev = NULL;
}
void
uicb_tab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Window dummy, child;
int x1, y1, di;
unsigned int dui;
XEvent ev;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel, *c = NULL, *tmp;
if(XGrabPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None,
awesomeconf[awesomeconf->screen].cursor[CurMove], CurrentTime) != GrabSuccess)
return;
for(;;)
{
XMaskEvent(awesomeconf->display, ButtonPressMask, &ev);
if(ev.type == ButtonPress)
{
XUngrabPointer(awesomeconf->display, CurrentTime);
break;
}
}
XQueryPointer(awesomeconf->display,
RootWindow(awesomeconf->display, awesomeconf->phys_screen),
&dummy, &child, &x1, &y1, &di, &di, &dui);
if((c = get_client_bywin(*awesomeconf->clients, child))
&& c != sel && !c->isfloating)
{
/* take the last tabbed window */
for(tmp = sel; tmp->tab.next; tmp = tmp->tab.next);
tmp->tab.next = c;
if(c->tab.prev)
c->tab.prev->tab.next = tmp;
c->tab.prev = tmp;
c->tab.isvisible = False;
client_reattach_after(sel, c);
arrange(awesomeconf);
focus(sel, True, awesomeconf);
}
}
void
uicb_untab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
client_untab(sel);
arrange(awesomeconf);
focus(sel, True, awesomeconf);
}
void
uicb_viewnexttab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel || !sel->tab.next)
return;
sel->tab.isvisible = False;
sel->tab.next->tab.isvisible = True;
arrange(awesomeconf);
focus(sel->tab.next, True, awesomeconf);
}
void
uicb_viewprevtab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel || !sel->tab.prev)
return;
sel->tab.isvisible = False;
sel->tab.prev->tab.isvisible = True;
arrange(awesomeconf);
focus(sel->tab.prev, True, awesomeconf);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

35
tab.h
View File

@ -1,35 +0,0 @@
/*
* tab.h - tab management header
*
* Copyright © 2007 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef AWESOME_TAB_H
#define AWESOME_TAB_H
#include "common.h"
void client_untab(Client *);
UICB_PROTO(uicb_tab);
UICB_PROTO(uicb_untab);
UICB_PROTO(uicb_viewnexttab);
UICB_PROTO(uicb_viewprevtab);
#endif
// vim: filetype=c:expandtab:shiftwidth=6:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

4
tag.c
View File

@ -24,7 +24,6 @@
#include "layout.h"
#include "tag.h"
#include "tab.h"
#include "util.h"
/** This function returns the index of
@ -130,7 +129,7 @@ isvisible(Client * c, int screen, Tag * tags, int ntags)
{
int i;
if(c->screen != screen || !c->tab.isvisible)
if(c->screen != screen)
return False;
for(i = 0; i < ntags; i++)
@ -182,7 +181,6 @@ uicb_togglefloating(awesome_config * awesomeconf,
else
client_resize(sel, sel->x, sel->y, sel->w, sel->h, awesomeconf, True, True);
client_untab(sel);
saveprops(sel, awesomeconf->ntags);
arrange(awesomeconf);
}