screen: Add sgeo for don't have to exec screen_get_geo at all times...
This commit is contained in:
parent
6a24974b7b
commit
588cdea544
@ -44,8 +44,12 @@
|
|||||||
*/
|
*/
|
||||||
BarWindow*
|
BarWindow*
|
||||||
barwin_create(Window parent,
|
barwin_create(Window parent,
|
||||||
int x, int y, uint w, uint h,
|
int x,
|
||||||
uint color, Bool entermask)
|
int y,
|
||||||
|
uint w,
|
||||||
|
uint h,
|
||||||
|
uint color,
|
||||||
|
Bool entermask)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes at;
|
XSetWindowAttributes at;
|
||||||
BarWindow *bw;
|
BarWindow *bw;
|
||||||
|
|||||||
@ -482,11 +482,10 @@ client_moveresize(Client *c, XRectangle geo, bool r)
|
|||||||
|
|
||||||
/* Set the client screen */
|
/* Set the client screen */
|
||||||
for(i = 0; i < screen_count(); ++i)
|
for(i = 0; i < screen_count(); ++i)
|
||||||
if(geo.x >= screen_get_geo(i).x
|
if(geo.x >= sgeo[i].x
|
||||||
&& geo.x < screen_get_geo(i).x + screen_get_geo(i).width
|
&& geo.x < sgeo[i].x + sgeo[i].width
|
||||||
&& geo.y >= screen_get_geo(i).y - INFOBARH - TBARH
|
&& geo.y >= sgeo[i].y - INFOBARH - TBARH
|
||||||
&& geo.y < screen_get_geo(i).y - INFOBARH - TBARH + screen_get_geo(i).height + INFOBARH)
|
&& geo.y < sgeo[i].y - INFOBARH - TBARH + sgeo[i].height + INFOBARH)
|
||||||
|
|
||||||
c->screen = i;
|
c->screen = i;
|
||||||
|
|
||||||
frame_moveresize(c, geo);
|
frame_moveresize(c, geo);
|
||||||
|
|||||||
@ -47,12 +47,12 @@ infobar_init(void)
|
|||||||
j = 0;
|
j = 0;
|
||||||
infobar[sc].geo.height = INFOBARH;
|
infobar[sc].geo.height = INFOBARH;
|
||||||
infobar[sc].geo.y = (conf.bartop)
|
infobar[sc].geo.y = (conf.bartop)
|
||||||
? screen_get_geo(sc).y - INFOBARH - TBARH
|
? sgeo[sc].y - INFOBARH - TBARH
|
||||||
: screen_get_geo(sc).height - INFOBARH;
|
: sgeo[sc].height - INFOBARH;
|
||||||
|
|
||||||
/* Create infobar barwindow */
|
/* Create infobar barwindow */
|
||||||
infobar[sc].bar = barwin_create(root, screen_get_geo(sc).x - BORDH, infobar[sc].geo.y,
|
infobar[sc].bar = barwin_create(root, sgeo[sc].x - BORDH, infobar[sc].geo.y,
|
||||||
screen_get_geo(sc).width, infobar[sc].geo.height, conf.colors.bar, False);
|
sgeo[sc].width, infobar[sc].geo.height, conf.colors.bar, False);
|
||||||
|
|
||||||
/* Create tags window */
|
/* Create tags window */
|
||||||
for(i = 1; i < conf.ntag[sc] + 1; ++i)
|
for(i = 1; i < conf.ntag[sc] + 1; ++i)
|
||||||
@ -93,7 +93,7 @@ infobar_draw(int sc)
|
|||||||
|
|
||||||
/* DRAW status text */
|
/* DRAW status text */
|
||||||
draw_text(infobar[sc].bar->dr,
|
draw_text(infobar[sc].bar->dr,
|
||||||
(screen_get_geo(sc).width - SHADH) - textw(statustext),
|
(sgeo[sc].width - SHADH) - textw(statustext),
|
||||||
font->height,
|
font->height,
|
||||||
conf.colors.text, 0,
|
conf.colors.text, 0,
|
||||||
statustext);
|
statustext);
|
||||||
@ -186,7 +186,7 @@ infobar_destroy(void)
|
|||||||
void
|
void
|
||||||
uicb_infobar_togglepos(uicb_t cmd)
|
uicb_infobar_togglepos(uicb_t cmd)
|
||||||
{
|
{
|
||||||
XRectangle sg = screen_get_geo(screen_get_sel());
|
XRectangle sg = sgeo[screen_get_sel()];
|
||||||
|
|
||||||
conf.bartop = !conf.bartop;
|
conf.bartop = !conf.bartop;
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ init(void)
|
|||||||
init_key();
|
init_key();
|
||||||
init_root();
|
init_root();
|
||||||
init_atom();
|
init_atom();
|
||||||
|
screen_init_geo();
|
||||||
infobar_init();
|
infobar_init();
|
||||||
grabkeys();
|
grabkeys();
|
||||||
|
|
||||||
|
|||||||
12
src/layout.c
12
src/layout.c
@ -140,7 +140,7 @@ maxlayout(void)
|
|||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XRectangle geo;
|
XRectangle geo;
|
||||||
XRectangle sg = screen_get_geo(screen_get_sel());
|
XRectangle sg = sgeo[selscreen];
|
||||||
|
|
||||||
for(c = nexttiled(clients); c; c = nexttiled(c->next))
|
for(c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ maxlayout(void)
|
|||||||
Client*
|
Client*
|
||||||
nexttiled(Client *c)
|
nexttiled(Client *c)
|
||||||
{
|
{
|
||||||
for(; c && (c->max || c->free || c->screen != screen_get_sel() || ishide(c)); c = c->next);
|
for(; c && (c->max || c->free || c->screen != selscreen || ishide(c)); c = c->next);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ void
|
|||||||
grid(void)
|
grid(void)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XRectangle sg = screen_get_geo(screen_get_sel());
|
XRectangle sg = sgeo[selscreen];
|
||||||
XRectangle cgeo = {sg.x, sg.y, 0, 0};
|
XRectangle cgeo = {sg.x, sg.y, 0, 0};
|
||||||
unsigned int i, n, cols, rows, cpcols = 0;
|
unsigned int i, n, cols, rows, cpcols = 0;
|
||||||
unsigned int border = BORDH * 2;
|
unsigned int border = BORDH * 2;
|
||||||
@ -285,7 +285,7 @@ void
|
|||||||
multi_tile(Position type)
|
multi_tile(Position type)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XRectangle sg = screen_get_geo(screen_get_sel());
|
XRectangle sg = sgeo[selscreen];
|
||||||
XRectangle mastergeo = {sg.x, sg.y, 0, 0};
|
XRectangle mastergeo = {sg.x, sg.y, 0, 0};
|
||||||
XRectangle cgeo = {sg.x, sg.y, 0, 0};
|
XRectangle cgeo = {sg.x, sg.y, 0, 0};
|
||||||
uint i , n, tilesize, mwfact, nmaster = tags[selscreen][seltag[selscreen]].nmaster;
|
uint i , n, tilesize, mwfact, nmaster = tags[selscreen][seltag[selscreen]].nmaster;
|
||||||
@ -481,8 +481,6 @@ uicb_togglefree(uicb_t cmd)
|
|||||||
{
|
{
|
||||||
CHECK(sel);
|
CHECK(sel);
|
||||||
|
|
||||||
screen_get_sel();
|
|
||||||
|
|
||||||
sel->free = !sel->free;
|
sel->free = !sel->free;
|
||||||
sel->tile = False;
|
sel->tile = False;
|
||||||
sel->max = False;
|
sel->max = False;
|
||||||
@ -500,7 +498,7 @@ void
|
|||||||
uicb_togglemax(uicb_t cmd)
|
uicb_togglemax(uicb_t cmd)
|
||||||
{
|
{
|
||||||
XRectangle geo;
|
XRectangle geo;
|
||||||
XRectangle sg = screen_get_geo(screen_get_sel());
|
XRectangle sg = sgeo[screen_get_sel()];
|
||||||
|
|
||||||
if(!sel || ishide(sel) || sel->hint)
|
if(!sel || ishide(sel) || sel->hint)
|
||||||
return;
|
return;
|
||||||
|
|||||||
17
src/screen.c
17
src/screen.c
@ -108,3 +108,20 @@ screen_get_sel(void)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Init screen geo
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
screen_init_geo(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sgeo = emalloc(screen_count(), sizeof(XRectangle));
|
||||||
|
|
||||||
|
for(i = 0; i < screen_count(); ++i)
|
||||||
|
sgeo[i] = screen_get_geo(i);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,6 @@ errorhandler(Display *d, XErrorEvent *event)
|
|||||||
* 42 = X_SetInputFocus
|
* 42 = X_SetInputFocus
|
||||||
* 28 = X_GrabButton
|
* 28 = X_GrabButton
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if((c = client_gb_win(event->resourceid)))
|
if((c = client_gb_win(event->resourceid)))
|
||||||
if(event->error_code == BadWindow
|
if(event->error_code == BadWindow
|
||||||
|| (event->error_code == BadMatch && event->request_code == 42)
|
|| (event->error_code == BadMatch && event->request_code == 42)
|
||||||
@ -104,6 +103,7 @@ quit(void)
|
|||||||
XFreeCursor(dpy, cursor[CurMove]);
|
XFreeCursor(dpy, cursor[CurMove]);
|
||||||
XFreeCursor(dpy, cursor[CurResize]);
|
XFreeCursor(dpy, cursor[CurResize]);
|
||||||
infobar_destroy();
|
infobar_destroy();
|
||||||
|
free(sgeo);
|
||||||
free(infobar);
|
free(infobar);
|
||||||
free(seltag);
|
free(seltag);
|
||||||
free(keys);
|
free(keys);
|
||||||
|
|||||||
@ -184,6 +184,7 @@ void uicb_tagtransfert(uicb_t);
|
|||||||
int screen_count(void);
|
int screen_count(void);
|
||||||
XRectangle screen_get_geo(int s);
|
XRectangle screen_get_geo(int s);
|
||||||
int screen_get_sel(void);
|
int screen_get_sel(void);
|
||||||
|
void screen_init_geo(void);
|
||||||
|
|
||||||
/* layout.c */
|
/* layout.c */
|
||||||
void arrange(void);
|
void arrange(void);
|
||||||
@ -237,6 +238,7 @@ Conf conf;
|
|||||||
Key *keys;
|
Key *keys;
|
||||||
Bool exiting;
|
Bool exiting;
|
||||||
char statustext[1024];
|
char statustext[1024];
|
||||||
|
XRectangle *sgeo;
|
||||||
|
|
||||||
/* Atoms / Cursors */
|
/* Atoms / Cursors */
|
||||||
Atom wm_atom[WMLast];
|
Atom wm_atom[WMLast];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user