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 typedef struct
{ {
const char *symbol; const char *symbol;
void (*arrange) (Display *, awesome_config *); void (*arrange) (Display *, int, awesome_config *);
} Layout; } Layout;
typedef struct typedef struct

View File

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

View File

@ -27,12 +27,12 @@
extern Client *clients; /* global client */ extern Client *clients; /* global client */
void void
floating(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf) floating(Display *disp __attribute__ ((unused)), int screen, awesome_config *awesomeconf)
{ /* default floating layout */ { /* default floating layout */
Client *c; Client *c;
for(c = clients; c; c = c->next) 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) if(c->ftview)
{ {

View File

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

View File

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

View File

@ -195,19 +195,13 @@ _tile(Display *disp, int screen, awesome_config *awesomeconf, const Bool right)
} }
void 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); _tile(disp, screen, awesomeconf, True);
} }
void 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); _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_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_setncols(Display *, int, DC *, awesome_config *, const char *);
void uicb_setmwfact(Display *, int, DC *, awesome_config *, const char *); /* sets master width factor */ void uicb_setmwfact(Display *, int, DC *, awesome_config *, const char *); /* sets master width factor */
void tile(Display *, awesome_config *); void tile(Display *, int, awesome_config *);
void tileleft(Display *, awesome_config *); void tileleft(Display *, int, awesome_config *);
#endif #endif

15
util.c
View File

@ -43,17 +43,30 @@ eprint(const char *fmt, ...)
void void
uicb_spawn(Display * disp, uicb_spawn(Display * disp,
int screen __attribute__ ((unused)), int screen,
DC *drawcontext __attribute__ ((unused)), DC *drawcontext __attribute__ ((unused)),
awesome_config * awesomeconf __attribute__ ((unused)), awesome_config * awesomeconf __attribute__ ((unused)),
const char *arg) const char *arg)
{ {
static char *shell = NULL; static char *shell = NULL;
char *display = NULL;
char *tmp, newdisplay[128];
if(!shell && !(shell = getenv("SHELL"))) if(!shell && !(shell = getenv("SHELL")))
shell = strdup("/bin/sh"); shell = strdup("/bin/sh");
if(!arg) if(!arg)
return; 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 /* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers. */ * clean from stupid signal handlers. */
if(fork() == 0) if(fork() == 0)