fix bug with statusbar recovering each others (FS#37)
This commit is contained in:
parent
b5e5878c2f
commit
5180613fe5
|
@ -136,7 +136,10 @@ setup(int screen)
|
||||||
grabkeys(phys_screen);
|
grabkeys(phys_screen);
|
||||||
|
|
||||||
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
|
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
|
||||||
statusbar_init(statusbar, screen);
|
statusbar_preinit(statusbar, screen);
|
||||||
|
|
||||||
|
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
|
||||||
|
statusbar_init(statusbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Startup Error handler to check if another window manager
|
/** Startup Error handler to check if another window manager
|
||||||
|
|
70
statusbar.c
70
statusbar.c
|
@ -33,29 +33,38 @@ extern AwesomeConf globalconf;
|
||||||
static void
|
static void
|
||||||
statusbar_update_position(Statusbar *statusbar)
|
statusbar_update_position(Statusbar *statusbar)
|
||||||
{
|
{
|
||||||
Area area = get_screen_area(statusbar->screen,
|
Area area;
|
||||||
NULL,
|
|
||||||
&globalconf.screens[statusbar->screen].padding);
|
|
||||||
|
|
||||||
XMapRaised(globalconf.display, statusbar->window);
|
XMapRaised(globalconf.display, statusbar->window);
|
||||||
|
|
||||||
|
/* Top and Bottom Statusbar have prio */
|
||||||
|
if(statusbar->position == Top || statusbar->position == Bottom)
|
||||||
|
area = get_screen_area(statusbar->screen,
|
||||||
|
NULL,
|
||||||
|
&globalconf.screens[statusbar->screen].padding);
|
||||||
|
else
|
||||||
|
area = get_screen_area(statusbar->screen,
|
||||||
|
globalconf.screens[statusbar->screen].statusbar,
|
||||||
|
&globalconf.screens[statusbar->screen].padding);
|
||||||
|
|
||||||
switch(statusbar->position)
|
switch(statusbar->position)
|
||||||
{
|
{
|
||||||
default:
|
case Top:
|
||||||
XMoveWindow(globalconf.display, statusbar->window,
|
XMoveWindow(globalconf.display, statusbar->window,
|
||||||
area.x, area.y);
|
area.x, area.y);
|
||||||
break;
|
break;
|
||||||
case Left:
|
|
||||||
XMoveWindow(globalconf.display, statusbar->window,
|
|
||||||
area.x, (area.y + area.height) - statusbar->width);
|
|
||||||
break;
|
|
||||||
case Right:
|
|
||||||
XMoveWindow(globalconf.display, statusbar->window,
|
|
||||||
area.x + (area.width - statusbar->height), area.y);
|
|
||||||
break;
|
|
||||||
case Bottom:
|
case Bottom:
|
||||||
XMoveWindow(globalconf.display, statusbar->window,
|
XMoveWindow(globalconf.display, statusbar->window,
|
||||||
area.x, area.height - statusbar->height);
|
area.x, area.height - statusbar->height);
|
||||||
break;
|
break;
|
||||||
|
case Left:
|
||||||
|
XMoveWindow(globalconf.display, statusbar->window,
|
||||||
|
area.x - statusbar->height, (area.y + area.height) - statusbar->width);
|
||||||
|
break;
|
||||||
|
case Right:
|
||||||
|
XMoveWindow(globalconf.display, statusbar->window,
|
||||||
|
area.x + area.width, area.y);
|
||||||
|
break;
|
||||||
case Off:
|
case Off:
|
||||||
XUnmapWindow(globalconf.display, statusbar->window);
|
XUnmapWindow(globalconf.display, statusbar->window);
|
||||||
break;
|
break;
|
||||||
|
@ -153,24 +162,45 @@ statusbar_display(Statusbar *statusbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
statusbar_init(Statusbar *statusbar, int screen)
|
statusbar_preinit(Statusbar *statusbar, int screen)
|
||||||
{
|
{
|
||||||
Widget *widget;
|
Widget *widget;
|
||||||
XSetWindowAttributes wa;
|
|
||||||
int phys_screen = get_phys_screen(screen);
|
statusbar->screen = screen;
|
||||||
Area area = get_screen_area(screen,
|
|
||||||
globalconf.screens[screen].statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
|
|
||||||
if(statusbar->height <= 0)
|
if(statusbar->height <= 0)
|
||||||
{
|
{
|
||||||
/* 1.5 as default factor, it fits nice but no one know why */
|
/* 1.5 as default factor, it fits nice but no one know why */
|
||||||
statusbar->height = globalconf.screens[screen].font->height * 1.5;
|
statusbar->height = globalconf.screens[statusbar->screen].font->height * 1.5;
|
||||||
|
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(widget->font)
|
if(widget->font)
|
||||||
statusbar->height = MAX(statusbar->height, widget->font->height * 1.5);
|
statusbar->height = MAX(statusbar->height, widget->font->height * 1.5);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
statusbar_init(Statusbar *statusbar)
|
||||||
|
{
|
||||||
|
Statusbar *sb;
|
||||||
|
XSetWindowAttributes wa;
|
||||||
|
int phys_screen = get_phys_screen(statusbar->screen);
|
||||||
|
Area area = get_screen_area(statusbar->screen,
|
||||||
|
globalconf.screens[statusbar->screen].statusbar,
|
||||||
|
&globalconf.screens[statusbar->screen].padding);
|
||||||
|
|
||||||
|
|
||||||
|
/* Top and Bottom Statusbar have prio */
|
||||||
|
for(sb = globalconf.screens[statusbar->screen].statusbar; sb; sb = sb->next)
|
||||||
|
switch(sb->position)
|
||||||
|
{
|
||||||
|
case Left:
|
||||||
|
case Right:
|
||||||
|
area.width += sb->height;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(statusbar->width <= 0)
|
if(statusbar->width <= 0)
|
||||||
{
|
{
|
||||||
|
@ -180,8 +210,6 @@ statusbar_init(Statusbar *statusbar, int screen)
|
||||||
statusbar->width = area.width;
|
statusbar->width = area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
statusbar->screen = screen;
|
|
||||||
|
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||||
wa.cursor = globalconf.cursor[CurNormal];
|
wa.cursor = globalconf.cursor[CurNormal];
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
void statusbar_refresh(void);
|
void statusbar_refresh(void);
|
||||||
void statusbar_init(Statusbar *, int);
|
void statusbar_preinit(Statusbar *, int);
|
||||||
|
void statusbar_init(Statusbar *);
|
||||||
void statusbar_display(Statusbar *);
|
void statusbar_display(Statusbar *);
|
||||||
Position statusbar_get_position_from_str(const char *);
|
Position statusbar_get_position_from_str(const char *);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue