mirror of
https://github.com/0intro/wmii
synced 2024-11-25 07:09:38 +03:00
Allow specifying screen in area specs. Closes issue #133.
This commit is contained in:
parent
b75ccc7266
commit
fce61e7c6d
@ -234,9 +234,10 @@ class liveprop(object):
|
|||||||
setattr(area, self.attr, val)
|
setattr(area, self.attr, val)
|
||||||
|
|
||||||
class Area(object):
|
class Area(object):
|
||||||
def __init__(self, tag, ord, offset=None, width=None, height=None, frames=None):
|
def __init__(self, tag, ord, screen='sel', offset=None, width=None, height=None, frames=None):
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
self.ord = str(ord)
|
self.ord = str(ord)
|
||||||
|
self.screen = str(screen)
|
||||||
self.offset = offset
|
self.offset = offset
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
@ -254,6 +255,10 @@ class Area(object):
|
|||||||
height = prop('height')
|
height = prop('height')
|
||||||
frames = prop('frames')
|
frames = prop('frames')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def spec(self):
|
||||||
|
return '%s:%s' % (self.screen, self.ord)
|
||||||
|
|
||||||
def _get_mode(self):
|
def _get_mode(self):
|
||||||
for k, v in self.tag.iteritems():
|
for k, v in self.tag.iteritems():
|
||||||
if k == 'colmode':
|
if k == 'colmode':
|
||||||
@ -262,7 +267,7 @@ class Area(object):
|
|||||||
return v[1]
|
return v[1]
|
||||||
mode = property(
|
mode = property(
|
||||||
_get_mode,
|
_get_mode,
|
||||||
lambda self, val: self.tag.set('colmode %s' % self.ord, val))
|
lambda self, val: self.tag.set('colmode %s' % self.spec, val))
|
||||||
|
|
||||||
def grow(self, dir, amount=None):
|
def grow(self, dir, amount=None):
|
||||||
self.tag.grow(self, dir, amount)
|
self.tag.grow(self, dir, amount)
|
||||||
@ -353,7 +358,9 @@ class Tag(Dir):
|
|||||||
area = Area(tag=self, ord=l[1], width=l[2], height=l[3],
|
area = Area(tag=self, ord=l[1], width=l[2], height=l[3],
|
||||||
frames=[])
|
frames=[])
|
||||||
else:
|
else:
|
||||||
area = Area(tag=self, ord=l[1], offset=l[2], width=l[3],
|
m = re.match(l[1], '(?:(\d+):)?(\d+)')
|
||||||
|
area = Area(tag=self, screen=m.group(1) or 0,
|
||||||
|
ord=m.group(2), offset=l[2], width=l[3],
|
||||||
frames=[])
|
frames=[])
|
||||||
areas.append(area)
|
areas.append(area)
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -229,7 +229,7 @@ char* msg_sendclient(View*, IxpMsg*, bool swap);
|
|||||||
char* readctl_client(Client*);
|
char* readctl_client(Client*);
|
||||||
char* readctl_root(void);
|
char* readctl_root(void);
|
||||||
char* readctl_view(View*);
|
char* readctl_view(View*);
|
||||||
Area* strarea(View*, int, const char*);
|
Area* strarea(View*, ulong, const char*);
|
||||||
void warning(const char*, ...);
|
void warning(const char*, ...);
|
||||||
/* debug */
|
/* debug */
|
||||||
void debug(int, const char*, ...);
|
void debug(int, const char*, ...);
|
||||||
|
@ -329,8 +329,9 @@ strclient(View *v, char *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Area*
|
Area*
|
||||||
strarea(View *v, int scrn, const char *s) {
|
strarea(View *v, ulong scrn, const char *s) {
|
||||||
Area *a;
|
Area *a;
|
||||||
|
char *p;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -341,14 +342,26 @@ strarea(View *v, int scrn, const char *s) {
|
|||||||
|
|
||||||
if(s == nil)
|
if(s == nil)
|
||||||
return nil;
|
return nil;
|
||||||
if(!strcmp(s, "sel"))
|
|
||||||
|
if((p = strchr(s, ':'))) {
|
||||||
|
*p++ = '\0';
|
||||||
|
if(!strcmp(s, "sel"))
|
||||||
|
scrn = v->selscreen;
|
||||||
|
else if(!getulong(s, &scrn))
|
||||||
|
return nil;
|
||||||
|
s = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(s, "sel")) {
|
||||||
|
if(scrn != v->selscreen)
|
||||||
|
return nil;
|
||||||
return v->sel;
|
return v->sel;
|
||||||
|
}
|
||||||
if(!strcmp(s, "~"))
|
if(!strcmp(s, "~"))
|
||||||
return v->floating;
|
return v->floating;
|
||||||
if(!getlong(s, &i) || i == 0)
|
if(!getlong(s, &i) || i == 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
/* FIXME: Very broken! */
|
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
for(a = v->areas[scrn]; a; a = a->next)
|
for(a = v->areas[scrn]; a; a = a->next)
|
||||||
if(i-- == 1) break;
|
if(i-- == 1) break;
|
||||||
@ -643,7 +656,6 @@ message_view(View *v, IxpMsg *m) {
|
|||||||
switch(getsym(s)) {
|
switch(getsym(s)) {
|
||||||
case LCOLMODE:
|
case LCOLMODE:
|
||||||
s = msg_getword(m);
|
s = msg_getword(m);
|
||||||
/* XXX: Multihead */
|
|
||||||
a = strarea(v, screen->idx, s);
|
a = strarea(v, screen->idx, s);
|
||||||
if(a == nil) /* || a->floating) */
|
if(a == nil) /* || a->floating) */
|
||||||
return Ebadvalue;
|
return Ebadvalue;
|
||||||
@ -1003,7 +1015,6 @@ msg_sendclient(View *v, IxpMsg *m, bool swap) {
|
|||||||
Frame *f, *ff;
|
Frame *f, *ff;
|
||||||
Client *c;
|
Client *c;
|
||||||
char *s;
|
char *s;
|
||||||
ulong i, scrn;
|
|
||||||
int sym;
|
int sym;
|
||||||
|
|
||||||
s = msg_getword(m);
|
s = msg_getword(m);
|
||||||
@ -1051,13 +1062,8 @@ msg_sendclient(View *v, IxpMsg *m, bool swap) {
|
|||||||
to = v->floating;
|
to = v->floating;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
scrn = 0;
|
to = strarea(v, v->selscreen, s);
|
||||||
if(!getulong(s, &i))
|
// to = view_findarea(v, scrn, i, true);
|
||||||
if(2 != sscanf(s, "%lu:%lu", &scrn, &i))
|
|
||||||
return Ebadvalue;
|
|
||||||
if(i == 0 || scrn > nscreens)
|
|
||||||
return Ebadvalue;
|
|
||||||
to = view_findarea(v, scrn, i, true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user