mirror of
https://github.com/0intro/wmii
synced 2025-03-19 13:13:57 +03:00
renamed several _tag functions into _view where it makes sense
This commit is contained in:
parent
04bba2a6c4
commit
b248569f4d
@ -127,7 +127,7 @@ attach_toarea(Area *a, Client *c)
|
||||
static unsigned short id = 1;
|
||||
Frame *f;
|
||||
|
||||
if(clientoftag(a->view, c))
|
||||
if(clientofview(a->view, c))
|
||||
return;
|
||||
f = cext_emallocz(sizeof(Frame));
|
||||
f->id = id++;
|
||||
|
@ -92,7 +92,7 @@ focus_client(Client *c)
|
||||
grab_mouse(c->win, Mod1Mask, Button1);
|
||||
grab_mouse(c->win, Mod1Mask, Button3);
|
||||
|
||||
restack_tag(f->area->view);
|
||||
restack_view(f->area->view);
|
||||
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
draw_client(c);
|
||||
@ -331,7 +331,7 @@ manage_client(Client *c)
|
||||
|
||||
reparent_client(c, c->framewin, c->rect.x, c->rect.y);
|
||||
|
||||
v = nview ? view[sel] : alloc_tag(def.tag);
|
||||
v = nview ? view[sel] : alloc_view(def.tag);
|
||||
if(!c->ntag) {
|
||||
for(i = 0; i < v->ntag; i++) {
|
||||
cext_strlcpy(c->tag[i], v->tag[i], sizeof(c->tag[i]));
|
||||
@ -364,7 +364,7 @@ destroy_client(Client *c)
|
||||
XSetErrorHandler(dummy_error_handler);
|
||||
|
||||
for(i = 0; i < nview; i++)
|
||||
detach_fromtag(view[i], c);
|
||||
detach_fromview(view[i], c);
|
||||
|
||||
unmap_client(c);
|
||||
|
||||
@ -381,7 +381,7 @@ destroy_client(Client *c)
|
||||
update_tags();
|
||||
free(c);
|
||||
|
||||
if((cl = sel_client_of_tag(view[sel])))
|
||||
if((cl = sel_client_of_view(view[sel])))
|
||||
focus_client(cl);
|
||||
|
||||
XSync(dpy, False);
|
||||
@ -392,7 +392,7 @@ destroy_client(Client *c)
|
||||
Client *
|
||||
sel_client()
|
||||
{
|
||||
return nview ? sel_client_of_tag(view[sel]) : nil;
|
||||
return nview ? sel_client_of_view(view[sel]) : nil;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -565,7 +565,7 @@ focus(Client *c)
|
||||
|
||||
v = f->area->view;
|
||||
if(view[sel] != v)
|
||||
focus_tag(v);
|
||||
focus_view(v);
|
||||
focus_client(c);
|
||||
}
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
if(!strncmp(buf, "quit", 5))
|
||||
srv.running = 0;
|
||||
else if(!strncmp(buf, "view", 5))
|
||||
select_tag(&buf[5]);
|
||||
select_view(&buf[5]);
|
||||
else
|
||||
return Enocommand;
|
||||
break;
|
||||
|
10
cmd/wm/tag.c
10
cmd/wm/tag.c
@ -33,15 +33,15 @@ organize_client(View *v, Client *c)
|
||||
}
|
||||
|
||||
if(hastag) {
|
||||
if(!clientoftag(v, c)) {
|
||||
if(!clientofview(v, c)) {
|
||||
/*fprintf(stderr, "org attach %s?\n", c->name);*/
|
||||
attach_totag(v, c);
|
||||
attach_toview(v, c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(clientoftag(v, c)) {
|
||||
if(clientofview(v, c)) {
|
||||
/*fprintf(stderr, "org detach %s?\n", c->name);*/
|
||||
detach_fromtag(v, c);
|
||||
detach_fromview(v, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ update_tags()
|
||||
}
|
||||
|
||||
if(!nview && nctag)
|
||||
select_tag(ctag[0]);
|
||||
select_view(ctag[0]);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "wm.h"
|
||||
|
||||
View *
|
||||
alloc_tag(char *name)
|
||||
alloc_view(char *name)
|
||||
{
|
||||
static unsigned short id = 1;
|
||||
View *v = cext_emallocz(sizeof(View));
|
||||
@ -22,12 +22,12 @@ alloc_tag(char *name)
|
||||
alloc_area(v);
|
||||
view = (View **)cext_array_attach((void **)view, v, sizeof(View *), &viewsz);
|
||||
nview++;
|
||||
focus_tag(v);
|
||||
focus_view(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_tag(View *v)
|
||||
destroy_view(View *v)
|
||||
{
|
||||
while(v->narea)
|
||||
destroy_area(v->area[0]);
|
||||
@ -41,7 +41,7 @@ destroy_tag(View *v)
|
||||
}
|
||||
|
||||
int
|
||||
tag2index(View *v)
|
||||
view2index(View *v)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < nview; i++)
|
||||
@ -63,7 +63,7 @@ update_frame_selectors(View *v)
|
||||
}
|
||||
|
||||
void
|
||||
focus_tag(View *v)
|
||||
focus_view(View *v)
|
||||
{
|
||||
char buf[256];
|
||||
char name[256];
|
||||
@ -73,7 +73,7 @@ focus_tag(View *v)
|
||||
return;
|
||||
|
||||
XGrabServer(dpy);
|
||||
sel = tag2index(v);
|
||||
sel = view2index(v);
|
||||
|
||||
update_frame_selectors(v);
|
||||
|
||||
@ -139,7 +139,7 @@ tid2index(unsigned short id)
|
||||
}
|
||||
|
||||
View *
|
||||
get_tag(char *name)
|
||||
get_view(char *name)
|
||||
{
|
||||
unsigned int i, j, ntags;
|
||||
View *v = nil;
|
||||
@ -157,15 +157,15 @@ get_tag(char *name)
|
||||
for(i = 0; i < nclient; i++)
|
||||
for(j = 0; j < ntags; j++)
|
||||
if(clienthastag(client[i], tags[j]))
|
||||
goto Createtag;
|
||||
goto Createview;
|
||||
return nil;
|
||||
|
||||
Createtag:
|
||||
v = alloc_tag(name);
|
||||
Createview:
|
||||
v = alloc_view(name);
|
||||
for(i = 0; i < nclient; i++)
|
||||
for(j = 0; j < ntags; j++)
|
||||
if(clienthastag(client[i], tags[j]) && !clientoftag(v, client[i]))
|
||||
attach_totag(v, client[i]);
|
||||
if(clienthastag(client[i], tags[j]) && !clientofview(v, client[i]))
|
||||
attach_toview(v, client[i]);
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -180,11 +180,11 @@ hasclient(View *v)
|
||||
}
|
||||
|
||||
void
|
||||
select_tag(char *arg)
|
||||
select_view(char *arg)
|
||||
{
|
||||
int i;
|
||||
Client *c;
|
||||
View *v = get_tag(arg);
|
||||
View *v = get_view(arg);
|
||||
|
||||
if(!v)
|
||||
return;
|
||||
@ -197,21 +197,21 @@ select_tag(char *arg)
|
||||
snprintf(buf, sizeof(buf), "NewTag %s\n", arg);
|
||||
write_event(buf, True);
|
||||
}
|
||||
focus_tag(v);
|
||||
focus_view(v);
|
||||
|
||||
/* cleanup on select */
|
||||
for(i = 0; i < nview; i++)
|
||||
if(!hasclient(view[i])) {
|
||||
destroy_tag(view[i]);
|
||||
destroy_view(view[i]);
|
||||
i--;
|
||||
}
|
||||
|
||||
if((c = sel_client_of_tag(v)))
|
||||
if((c = sel_client_of_view(v)))
|
||||
focus_client(c);
|
||||
}
|
||||
|
||||
Bool
|
||||
clientoftag(View *v, Client *c)
|
||||
clientofview(View *v, Client *c)
|
||||
{
|
||||
unsigned int i;
|
||||
for(i = 0; i < v->narea; i++)
|
||||
@ -221,7 +221,7 @@ clientoftag(View *v, Client *c)
|
||||
}
|
||||
|
||||
void
|
||||
detach_fromtag(View *v, Client *c)
|
||||
detach_fromview(View *v, Client *c)
|
||||
{
|
||||
int i;
|
||||
Client *cl;
|
||||
@ -231,12 +231,12 @@ detach_fromtag(View *v, Client *c)
|
||||
XMoveWindow(dpy, c->framewin, 2 * rect.width, 0);
|
||||
}
|
||||
}
|
||||
if((cl = sel_client_of_tag(v)))
|
||||
if((cl = sel_client_of_view(v)))
|
||||
focus_client(cl);
|
||||
}
|
||||
|
||||
void
|
||||
attach_totag(View *v, Client *c)
|
||||
attach_toview(View *v, Client *c)
|
||||
{
|
||||
Area *a;
|
||||
|
||||
@ -253,7 +253,7 @@ attach_totag(View *v, Client *c)
|
||||
}
|
||||
|
||||
Client *
|
||||
sel_client_of_tag(View *v)
|
||||
sel_client_of_view(View *v)
|
||||
{
|
||||
if(v) {
|
||||
Area *a = v->narea ? v->area[v->sel] : nil;
|
||||
@ -263,7 +263,7 @@ sel_client_of_tag(View *v)
|
||||
}
|
||||
|
||||
void
|
||||
restack_tag(View *v)
|
||||
restack_view(View *v)
|
||||
{
|
||||
unsigned int i, j, n = 0;
|
||||
static Window *wins = nil;
|
||||
|
20
cmd/wm/wm.h
20
cmd/wm/wm.h
@ -290,18 +290,18 @@ void tags2str(char *stags, unsigned int stagsz,
|
||||
Bool istag(char **tags, unsigned int ntags, char *tag);
|
||||
void update_tags();
|
||||
|
||||
/* view */
|
||||
View *alloc_tag(char *name);
|
||||
void focus_tag(View *v);
|
||||
/* view.c */
|
||||
View *alloc_view(char *name);
|
||||
void focus_view(View *v);
|
||||
XRectangle *rectangles(View *v, Bool isfloat, unsigned int *num);
|
||||
int tid2index(unsigned short id);
|
||||
void select_tag(char *arg);
|
||||
int tag2index(View *v);
|
||||
Bool clientoftag(View *v, Client *c);
|
||||
void detach_fromtag(View *v, Client *c);
|
||||
void attach_totag(View *v, Client *c);
|
||||
Client *sel_client_of_tag(View *v);
|
||||
void restack_tag(View *v);
|
||||
void select_view(char *arg);
|
||||
int view2index(View *v);
|
||||
Bool clientofview(View *v, Client *c);
|
||||
void detach_fromview(View *v, Client *c);
|
||||
void attach_toview(View *v, Client *c);
|
||||
Client *sel_client_of_view(View *v);
|
||||
void restack_view(View *v);
|
||||
Bool hasclient(View *v);
|
||||
|
||||
/* wm.c */
|
||||
|
Loading…
x
Reference in New Issue
Block a user