systray: fix visible attribute
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0ea4ce4980
commit
5b63807a15
|
@ -40,40 +40,56 @@ systray_draw(draw_context_t *ctx,
|
||||||
void *p,
|
void *p,
|
||||||
awesome_type_t type)
|
awesome_type_t type)
|
||||||
{
|
{
|
||||||
int i = 0, phys_screen;
|
int phys_screen;
|
||||||
xembed_window_t *em;
|
xembed_window_t *em;
|
||||||
uint32_t orient, config_win_vals[4];
|
uint32_t orient, config_win_vals[4];
|
||||||
/* p is always a statusbar, titlebars are forbidden */
|
/* p is always a statusbar, titlebars are forbidden */
|
||||||
statusbar_t *sb = (statusbar_t *) p;
|
statusbar_t *sb = (statusbar_t *) p;
|
||||||
|
|
||||||
|
/* we are on a statusbar */
|
||||||
|
assert(type == AWESOME_TYPE_STATUSBAR);
|
||||||
|
|
||||||
phys_screen = screen_virttophys(screen);
|
phys_screen = screen_virttophys(screen);
|
||||||
|
|
||||||
for(em = globalconf.embedded; em; em = em->next)
|
|
||||||
if(em->phys_screen == phys_screen)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if(ctx->width - used > 0)
|
|
||||||
w->area.width = MIN(i * ctx->height, ctx->width - used);
|
|
||||||
else
|
|
||||||
w->area.width = 0;
|
|
||||||
w->area.height = ctx->height;
|
w->area.height = ctx->height;
|
||||||
w->area.x = widget_calculate_offset(ctx->width,
|
|
||||||
w->area.width,
|
|
||||||
offset,
|
|
||||||
w->widget->align);
|
|
||||||
w->area.y = 0;
|
|
||||||
|
|
||||||
/* width */
|
/* width */
|
||||||
config_win_vals[2] = w->area.height;
|
config_win_vals[2] = w->area.height;
|
||||||
/* height */
|
/* height */
|
||||||
config_win_vals[3] = w->area.height;
|
config_win_vals[3] = w->area.height;
|
||||||
|
|
||||||
|
if(!w->widget->isvisible)
|
||||||
|
{
|
||||||
|
w->area.width = 0;
|
||||||
|
config_win_vals[0] = - config_win_vals[2];
|
||||||
|
config_win_vals[1] = - config_win_vals[3];
|
||||||
|
}
|
||||||
|
else if(ctx->width - used > 0)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(em = globalconf.embedded; em; em = em->next)
|
||||||
|
if(em->phys_screen == phys_screen)
|
||||||
|
i++;
|
||||||
|
w->area.width = MIN(i * ctx->height, ctx->width - used);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
w->area.width = 0;
|
||||||
|
|
||||||
|
w->area.x = widget_calculate_offset(ctx->width,
|
||||||
|
w->area.width,
|
||||||
|
offset,
|
||||||
|
w->widget->align);
|
||||||
|
w->area.y = 0;
|
||||||
|
|
||||||
switch(sb->position)
|
switch(sb->position)
|
||||||
{
|
{
|
||||||
case Left:
|
case Left:
|
||||||
|
if(w->widget->isvisible)
|
||||||
|
{
|
||||||
config_win_vals[0] = sb->sw->geometry.x + w->area.y;
|
config_win_vals[0] = sb->sw->geometry.x + w->area.y;
|
||||||
config_win_vals[1] = sb->sw->geometry.y + sb->sw->geometry.height
|
config_win_vals[1] = sb->sw->geometry.y + sb->sw->geometry.height
|
||||||
- w->area.x - config_win_vals[3];
|
- w->area.x - config_win_vals[3];
|
||||||
|
}
|
||||||
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
|
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
|
||||||
for(em = globalconf.embedded; em; em = em->next)
|
for(em = globalconf.embedded; em; em = em->next)
|
||||||
if(em->phys_screen == phys_screen)
|
if(em->phys_screen == phys_screen)
|
||||||
|
@ -94,9 +110,12 @@ systray_draw(draw_context_t *ctx,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
|
if(w->widget->isvisible)
|
||||||
|
{
|
||||||
config_win_vals[0] = sb->sw->geometry.x - w->area.y;
|
config_win_vals[0] = sb->sw->geometry.x - w->area.y;
|
||||||
config_win_vals[1] = sb->sw->geometry.y + w->area.x;
|
config_win_vals[1] = sb->sw->geometry.y + w->area.x;
|
||||||
|
}
|
||||||
|
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
|
||||||
for(em = globalconf.embedded; em; em = em->next)
|
for(em = globalconf.embedded; em; em = em->next)
|
||||||
if(em->phys_screen == phys_screen)
|
if(em->phys_screen == phys_screen)
|
||||||
{
|
{
|
||||||
|
@ -116,12 +135,12 @@ systray_draw(draw_context_t *ctx,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
|
if(w->widget->isvisible)
|
||||||
/* x */
|
{
|
||||||
config_win_vals[0] = sb->sw->geometry.x + w->area.x;
|
config_win_vals[0] = sb->sw->geometry.x + w->area.x;
|
||||||
/* y */
|
|
||||||
config_win_vals[1] = sb->sw->geometry.y + w->area.y;
|
config_win_vals[1] = sb->sw->geometry.y + w->area.y;
|
||||||
|
}
|
||||||
|
orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
|
||||||
for(em = globalconf.embedded; em; em = em->next)
|
for(em = globalconf.embedded; em; em = em->next)
|
||||||
if(em->phys_screen == phys_screen)
|
if(em->phys_screen == phys_screen)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue