spawn X client in the right head and add screen arg to layouts

This commit is contained in:
Julien Danjou 2007-09-16 01:35:44 +02:00
parent 933b0413ea
commit 58abf74d43
9 changed files with 37 additions and 26 deletions

View File

@ -65,7 +65,7 @@ typedef struct awesome_config awesome_config;
typedef struct
{
const char *symbol;
void (*arrange) (Display *, awesome_config *);
void (*arrange) (Display *, int, awesome_config *);
} Layout;
typedef struct

View File

@ -42,7 +42,7 @@ arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf
unban(c);
else
ban(c);
awesomeconf->current_layout->arrange(disp, awesomeconf);
awesomeconf->current_layout->arrange(disp, screen, awesomeconf);
focus(disp, screen, drawcontext, NULL, True, awesomeconf);
restack(disp, screen, drawcontext, awesomeconf);
}

View File

@ -27,12 +27,12 @@
extern Client *clients; /* global client */
void
floating(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
floating(Display *disp __attribute__ ((unused)), int screen, awesome_config *awesomeconf)
{ /* default floating layout */
Client *c;
for(c = clients; c; c = c->next)
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags) && c->screen == screen)
{
if(c->ftview)
{

View File

@ -23,6 +23,6 @@
#ifndef AWESOME_FLOATING_H
#define AWESOME_FLOATING_H
void floating(Display *, awesome_config *); /* floating layout */
void floating(Display *, int, awesome_config *); /* floating layout */
#endif

View File

@ -28,7 +28,7 @@
extern Client *clients; /* global client list */
static void
fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
fibonacci(Display *disp, int screen, awesome_config *awesomeconf, int shape)
{
int n, nx, ny, nh, nw, i;
Client *c;
@ -38,10 +38,14 @@ fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
nw = get_windows_area_width(disp, awesomeconf->statusbar);
nh = get_windows_area_height(disp, awesomeconf->statusbar);
for(n = 0, c = clients; c; c = c->next)
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags) && c->screen == screen)
n++;
for(i = 0, c = clients; c; c = c->next)
{
if(c->screen != screen)
continue;
c->ismax = False;
if((i % 2 && nh / 2 > 2 * c->border)
|| (!(i % 2) && nw / 2 > 2 * c->border))
@ -83,13 +87,13 @@ fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
void
dwindle(Display *disp, awesome_config *awesomeconf)
dwindle(Display *disp, int screen, awesome_config *awesomeconf)
{
fibonacci(disp, awesomeconf, 1);
fibonacci(disp, screen, awesomeconf, 1);
}
void
spiral(Display *disp, awesome_config *awesomeconf)
spiral(Display *disp, int screen, awesome_config *awesomeconf)
{
fibonacci(disp, awesomeconf, 0);
fibonacci(disp, screen, awesomeconf, 0);
}

View File

@ -23,7 +23,7 @@
#ifndef AWESOME_SPIRAL_H
#define AWESOME_SPIRAL_H
void dwindle(Display *, awesome_config *); /* dwindle windows */
void spiral(Display *, awesome_config *); /* spiral windows */
void dwindle(Display *, int, awesome_config *); /* dwindle windows */
void spiral(Display *, int, awesome_config *); /* spiral windows */
#endif

View File

@ -195,19 +195,13 @@ _tile(Display *disp, int screen, awesome_config *awesomeconf, const Bool right)
}
void
tile(Display *disp, awesome_config *awesomeconf)
tile(Display *disp, int screen, awesome_config *awesomeconf)
{
int screen;
for(screen = 0; screen < ScreenCount(disp); screen++)
_tile(disp, screen, awesomeconf, True);
}
void
tileleft(Display *disp, awesome_config *awesomeconf)
tileleft(Display *disp, int screen, awesome_config *awesomeconf)
{
int screen;
for(screen = 0; screen < ScreenCount(disp); screen++)
_tile(disp, screen, awesomeconf, False);
}

View File

@ -28,7 +28,7 @@
void uicb_setnmaster(Display *, int, DC *, awesome_config *, const char *); /* change number of master windows */
void uicb_setncols(Display *, int, DC *, awesome_config *, const char *);
void uicb_setmwfact(Display *, int, DC *, awesome_config *, const char *); /* sets master width factor */
void tile(Display *, awesome_config *);
void tileleft(Display *, awesome_config *);
void tile(Display *, int, awesome_config *);
void tileleft(Display *, int, awesome_config *);
#endif

15
util.c
View File

@ -43,17 +43,30 @@ eprint(const char *fmt, ...)
void
uicb_spawn(Display * disp,
int screen __attribute__ ((unused)),
int screen,
DC *drawcontext __attribute__ ((unused)),
awesome_config * awesomeconf __attribute__ ((unused)),
const char *arg)
{
static char *shell = NULL;
char *display = NULL;
char *tmp, newdisplay[128];
if(!shell && !(shell = getenv("SHELL")))
shell = strdup("/bin/sh");
if(!arg)
return;
if((tmp = getenv("DISPLAY")))
{
display = strdup(tmp);
if((tmp = strrchr(display, '.')))
*tmp = '\0';
snprintf(newdisplay, sizeof(newdisplay), "%s.%d", display, screen);
setenv("DISPLAY", newdisplay, 1);
}
/* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers. */
if(fork() == 0)