Augment /client/*/ctl Fullscreen command, make info available on read.

This commit is contained in:
Kris Maglione 2009-05-15 13:56:57 -04:00
parent 51808c1185
commit 91525a7b52
6 changed files with 41 additions and 22 deletions

View File

@ -24,7 +24,7 @@ Up History backward
Control-n History forward
Down History forward
BackSpace Kill char
Backspace Kill char
Control-h Kill char
Control-Backspace Kill word
Control-w Kill word

View File

@ -204,7 +204,7 @@ client_manage(Client *c) {
if(Dx(c->r) == Dx(screen->r))
if(Dy(c->r) == Dy(screen->r))
if(c->w.ewmh.type == 0)
fullscreen(c, true);
fullscreen(c, true, -1);
tags = getprop_string(&c->w, "_WMII_TAGS");
@ -590,7 +590,7 @@ client_kill(Client *c, bool nice) {
}
void
fullscreen(Client *c, int fullscreen) {
fullscreen(Client *c, int fullscreen, long screen) {
Frame *f;
bool wassel;
@ -620,7 +620,7 @@ fullscreen(Client *c, int fullscreen) {
}
}
else {
c->fullscreen = ownerscreen(c->r);
c->fullscreen = screen >= 0 ? screen : ownerscreen(c->r);
for(f=c->frame; f; f=f->cnext)
f->oldarea = -1;
if((f = c->sel))

View File

@ -323,7 +323,7 @@ ewmh_setstate(Client *c, Atom state, int action) {
return;
if(state == STATE("FULLSCREEN"))
fullscreen(c, action);
fullscreen(c, action, -1);
else
if(state == STATE("DEMANDS_ATTENTION"))
client_seturgent(c, action, UrgClient);

View File

@ -90,7 +90,7 @@ void client_unmap(Client*, int state);
Frame* client_viewframe(Client *c, View *v);
char* clientname(Client*);
void focus(Client*, bool restack);
void fullscreen(Client*, int);
void fullscreen(Client*, int, long);
Client* group_leader(Group*);
int map_frame(Client*);
Client* selclient(void);
@ -224,6 +224,7 @@ char* msg_getword(IxpMsg*);
char* msg_parsecolors(IxpMsg*, CTuple*);
char* msg_selectarea(Area*, IxpMsg*);
char* msg_sendclient(View*, IxpMsg*, bool swap);
char* readctl_client(Client*);
char* readctl_root(void);
char* readctl_view(View*);
Area* strarea(View*, int, const char*);

View File

@ -473,19 +473,13 @@ fs_read(Ixp9Req *r) {
respond(r, nil);
return;
case FsFCctl:
if(r->ifcall.io.offset) {
respond(r, nil);
return;
}
r->ofcall.io.data = smprint("%C", f->p.client);
/* Will (and should) die if result is nil */
r->ofcall.io.count = strlen(r->ofcall.io.data);
buf = readctl_client(f->p.client);
ixp_srv_readbuf(r, buf, strlen(buf));
respond(r, nil);
return;
case FsFTindex:
buf = view_index(f->p.view);
n = strlen(buf);
ixp_srv_readbuf(r, buf, n);
ixp_srv_readbuf(r, buf, strlen(buf));
respond(r, nil);
return;
case FsFTctl:

View File

@ -108,6 +108,11 @@ static char* incmodetab[] = {
"show",
"squeeze",
};
static char* toggletab[] = {
"off",
"on",
"toggle",
};
/* Edit ,y/^[a-zA-Z].*\n.* {\n/d
* Edit s/^([a-zA-Z].*)\n(.*) {\n/\1 \2;\n/
@ -154,8 +159,8 @@ setdef(int *ptr, char *s, char *tab[], int ntab) {
}
static int
gettoggle(IxpMsg *m) {
switch(getsym(msg_getword(m))) {
gettoggle(char *s) {
switch(getsym(s)) {
case LON: return On;
case LOFF: return Off;
case LTOGGLE: return Toggle;
@ -391,9 +396,22 @@ getframe(View *v, int scrn, IxpMsg *m) {
return f;
}
char*
readctl_client(Client *c) {
bufclear();
bufprint("%C\n", c);
if(c->fullscreen >= 0)
bufprint("Fullscreen %d\n", c->fullscreen);
else
bufprint("Fullscreen off\n");
bufprint("Urgent %s\n", toggletab[(int)c->urgent]);
return buffer;
}
char*
message_client(Client *c, IxpMsg *m) {
char *s;
long l;
int i;
s = msg_getword(m);
@ -402,6 +420,7 @@ message_client(Client *c, IxpMsg *m) {
* Toggle ::= on
* | off
* | toggle
* | <screen>
* Fullscreen <toggle>
* Urgent <toggle>
* kill
@ -410,10 +429,15 @@ message_client(Client *c, IxpMsg *m) {
switch(getsym(s)) {
case LFULLSCREEN:
i = gettoggle(m);
if(i == -1)
return Ebadusage;
fullscreen(c, i);
s = msg_getword(m);
if(getlong(s, &l))
fullscreen(c, On, l);
else {
i = gettoggle(s);
if(i == -1)
return Ebadusage;
fullscreen(c, i, -1);
}
break;
case LKILL:
client_kill(c, true);
@ -422,7 +446,7 @@ message_client(Client *c, IxpMsg *m) {
client_kill(c, false);
break;
case LURGENT:
i = gettoggle(m);
i = gettoggle(msg_getword(m));
if(i == -1)
return Ebadusage;
client_seturgent(c, i, UrgManager);