remove wa(x,y,h,w) from global vars, add functions to compute them
This commit is contained in:
parent
28df49c3cb
commit
d6c63bd086
41
awesome.c
41
awesome.c
|
@ -35,7 +35,6 @@
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
int wax, way, waw, wah;
|
|
||||||
Client *clients = NULL;
|
Client *clients = NULL;
|
||||||
Client *sel = NULL;
|
Client *sel = NULL;
|
||||||
Client *stack = NULL;
|
Client *stack = NULL;
|
||||||
|
@ -191,25 +190,49 @@ uicb_quit(Display *disp __attribute__ ((unused)),
|
||||||
readin = running = False;
|
readin = running = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
get_windows_area_x(Statusbar statusbar __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
get_windows_area_y(Statusbar statusbar)
|
||||||
|
{
|
||||||
|
if(statusbar.position == BarTop)
|
||||||
|
return statusbar.height;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
get_windows_area_height(Display *disp, Statusbar statusbar)
|
||||||
|
{
|
||||||
|
if(statusbar.position == BarTop || statusbar.position == BarBot)
|
||||||
|
return DisplayHeight(disp, DefaultScreen(disp)) - statusbar.height;
|
||||||
|
|
||||||
|
return DisplayHeight(disp, DefaultScreen(disp));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
get_windows_area_width(Display *disp,
|
||||||
|
Statusbar statusbar __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
return DisplayWidth(disp, DefaultScreen(disp));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatebarpos(Display *disp, Statusbar statusbar)
|
updatebarpos(Display *disp, Statusbar statusbar)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
wax = 0;
|
|
||||||
way = 0;
|
|
||||||
wah = DisplayHeight(disp, DefaultScreen(disp));
|
|
||||||
waw = DisplayWidth(disp, DefaultScreen(disp));
|
|
||||||
switch (statusbar.position)
|
switch (statusbar.position)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
wah -= statusbar.height;
|
|
||||||
way += statusbar.height;
|
|
||||||
XMoveWindow(disp, statusbar.window, 0, 0);
|
XMoveWindow(disp, statusbar.window, 0, 0);
|
||||||
break;
|
break;
|
||||||
case BarBot:
|
case BarBot:
|
||||||
wah -= statusbar.height;
|
XMoveWindow(disp, statusbar.window, 0, get_windows_area_width(disp, statusbar) - statusbar.height);
|
||||||
XMoveWindow(disp, statusbar.window, 0, wah);
|
|
||||||
break;
|
break;
|
||||||
case BarOff:
|
case BarOff:
|
||||||
XMoveWindow(disp, statusbar.window, 0, 0 - statusbar.height);
|
XMoveWindow(disp, statusbar.window, 0, 0 - statusbar.height);
|
||||||
|
|
|
@ -31,5 +31,9 @@ Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return tex
|
||||||
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
||||||
void uicb_quit(Display *, awesome_config *, const char *); /* quit awesome nicely */
|
void uicb_quit(Display *, awesome_config *, const char *); /* quit awesome nicely */
|
||||||
int xerror(Display *, XErrorEvent *); /* awesome's X error handler */
|
int xerror(Display *, XErrorEvent *); /* awesome's X error handler */
|
||||||
|
int get_windows_area_x(Statusbar);
|
||||||
|
int get_windows_area_y(Statusbar);
|
||||||
|
int get_windows_area_height(Display *, Statusbar);
|
||||||
|
int get_windows_area_width(Display *, Statusbar);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
6
client.c
6
client.c
|
@ -30,7 +30,6 @@
|
||||||
#include "layouts/floating.h"
|
#include "layouts/floating.h"
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
|
||||||
extern Client *clients, *sel, *stack; /* global client list and stack */
|
extern Client *clients, *sel, *stack; /* global client list and stack */
|
||||||
|
|
||||||
/** Attach client stack to clients stacks
|
/** Attach client stack to clients stacks
|
||||||
|
@ -370,6 +369,11 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, awesom
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int wax = get_windows_area_x(awesomeconf->statusbar);
|
||||||
|
int way = get_windows_area_y(awesomeconf->statusbar);
|
||||||
|
int waw = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||||
|
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||||
|
|
||||||
if(c->x + c->w + 2 * c->border > wax + waw)
|
if(c->x + c->w + 2 * c->border > wax + waw)
|
||||||
c->x = c->rx = wax + waw - c->w - 2 * c->border;
|
c->x = c->rx = wax + waw - c->w - 2 * c->border;
|
||||||
if(c->y + c->h + 2 * c->border > way + wah)
|
if(c->y + c->h + 2 * c->border > way + wah)
|
||||||
|
|
5
event.c
5
event.c
|
@ -31,7 +31,6 @@
|
||||||
#include "layouts/floating.h"
|
#include "layouts/floating.h"
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
|
||||||
extern DC dc; /* global draw context */
|
extern DC dc; /* global draw context */
|
||||||
extern Cursor cursor[CurLast];
|
extern Cursor cursor[CurLast];
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
|
@ -55,6 +54,10 @@ movemouse(Client * c, awesome_config *awesomeconf)
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
Window dummy;
|
Window dummy;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
int wax = get_windows_area_x(awesomeconf->statusbar);
|
||||||
|
int way = get_windows_area_y(awesomeconf->statusbar);
|
||||||
|
int waw = get_windows_area_width(c->display, awesomeconf->statusbar);
|
||||||
|
int wah = get_windows_area_height(c->display, awesomeconf->statusbar);
|
||||||
|
|
||||||
ocx = nx = c->x;
|
ocx = nx = c->x;
|
||||||
ocy = ny = c->y;
|
ocy = ny = c->y;
|
||||||
|
|
24
layout.c
24
layout.c
|
@ -28,7 +28,6 @@
|
||||||
#include "layouts/floating.h"
|
#include "layouts/floating.h"
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
|
@ -228,30 +227,41 @@ maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_togglemax(Display *disp __attribute__ ((unused)),
|
uicb_togglemax(Display *disp,
|
||||||
awesome_config *awesomeconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
maximize(wax, way, waw - 2 * awesomeconf->borderpx, wah - 2 * awesomeconf->borderpx, awesomeconf);
|
maximize(get_windows_area_x(awesomeconf->statusbar),
|
||||||
|
get_windows_area_y(awesomeconf->statusbar),
|
||||||
|
get_windows_area_width(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx,
|
||||||
|
get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_toggleverticalmax(Display *disp __attribute__ ((unused)),
|
uicb_toggleverticalmax(Display *disp,
|
||||||
awesome_config *awesomeconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(sel->x, way, sel->w, wah - 2 * awesomeconf->borderpx, awesomeconf);
|
maximize(sel->x,
|
||||||
|
get_windows_area_y(awesomeconf->statusbar),
|
||||||
|
sel->w,
|
||||||
|
get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx,
|
||||||
|
awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_togglehorizontalmax(Display *disp __attribute__ ((unused)),
|
uicb_togglehorizontalmax(Display *disp,
|
||||||
awesome_config *awesomeconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(wax, sel->y, waw - 2 * awesomeconf->borderpx, sel->h, awesomeconf);
|
maximize(get_windows_area_x(awesomeconf->statusbar),
|
||||||
|
sel->y,
|
||||||
|
get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx,
|
||||||
|
sel->h,
|
||||||
|
awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "awesome.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
extern int wah, waw; /* windowarea geometry */
|
|
||||||
extern Client *clients; /* global client list and stack */
|
extern Client *clients; /* global client list and stack */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ void
|
||||||
grid(Display *disp, awesome_config *awesomeconf)
|
grid(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
|
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
|
||||||
|
int waw = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||||
|
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
for(n = 0, c = clients; c; c = c->next)
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "awesome.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "spiral.h"
|
#include "spiral.h"
|
||||||
|
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
|
||||||
extern Client *clients; /* global client list */
|
extern Client *clients; /* global client list */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
|
||||||
int n, nx, ny, nh, nw, i;
|
int n, nx, ny, nh, nw, i;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
nx = wax;
|
nx = get_windows_area_x(awesomeconf->statusbar);
|
||||||
ny = 0;
|
ny = 0;
|
||||||
nw = waw;
|
nw = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||||
nh = wah;
|
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))
|
||||||
n++;
|
n++;
|
||||||
|
@ -75,7 +75,7 @@ fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
|
||||||
nx -= nw;
|
nx -= nw;
|
||||||
}
|
}
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
ny = way;
|
ny = get_windows_area_y(awesomeconf->statusbar);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
|
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
|
||||||
|
|
|
@ -22,18 +22,16 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "layouts/tile.h"
|
#include "awesome.h"
|
||||||
#include "layout.h"
|
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
#include "layout.h"
|
||||||
|
#include "layouts/tile.h"
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
|
||||||
extern Client *sel, *clients;
|
extern Client *sel, *clients;
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
static void _tile(awesome_config *, const Bool); /* arranges all windows tiled */
|
|
||||||
|
|
||||||
static double mwfact = 0.6;
|
static double mwfact = 0.6;
|
||||||
static int nmaster = 2;
|
static int nmaster = 2;
|
||||||
|
|
||||||
|
@ -43,6 +41,7 @@ uicb_setnmaster(Display *disp,
|
||||||
const char * arg)
|
const char * arg)
|
||||||
{
|
{
|
||||||
int delta;
|
int delta;
|
||||||
|
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||||
|
|
||||||
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
|
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
|
||||||
return;
|
return;
|
||||||
|
@ -92,8 +91,12 @@ uicb_setmwfact(Display *disp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tile(awesome_config *awesomeconf, const Bool right)
|
_tile(Display *disp, awesome_config *awesomeconf, const Bool right)
|
||||||
{
|
{
|
||||||
|
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||||
|
int waw = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||||
|
int wax = get_windows_area_x(awesomeconf->statusbar);
|
||||||
|
int way = get_windows_area_y(awesomeconf->statusbar);
|
||||||
unsigned int nx, ny, nw, nh, mw;
|
unsigned int nx, ny, nw, nh, mw;
|
||||||
int n, th, i, mh;
|
int n, th, i, mh;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -152,22 +155,24 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tile(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
tile(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_tile(awesomeconf, True);
|
_tile(disp, awesomeconf, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tileleft(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
tileleft(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_tile(awesomeconf, False);
|
_tile(disp, awesomeconf, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bstack(awesome_config *awesomeconf, Bool portrait)
|
_bstack(Display *disp, awesome_config *awesomeconf, Bool portrait)
|
||||||
{
|
{
|
||||||
int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
||||||
|
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||||
|
int waw = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
for(n = 0, c = clients; c; c = c->next)
|
||||||
|
@ -186,8 +191,8 @@ _bstack(awesome_config *awesomeconf, Bool portrait)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
nx = wax;
|
nx = get_windows_area_x(awesomeconf->statusbar);
|
||||||
ny = way;
|
ny = get_windows_area_y(awesomeconf->statusbar);
|
||||||
if(i < nmaster)
|
if(i < nmaster)
|
||||||
{
|
{
|
||||||
ny += i * mh;
|
ny += i * mh;
|
||||||
|
@ -221,13 +226,13 @@ _bstack(awesome_config *awesomeconf, Bool portrait)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bstack(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
bstack(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_bstack(awesomeconf, False);
|
_bstack(disp, awesomeconf, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bstackportrait(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
bstackportrait(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_bstack(awesomeconf, True);
|
_bstack(disp, awesomeconf, True);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue