/** Draw all trays. */ void DrawTray() { TrayType *tp; if(shouldExit) { return; } for(tp = trays; tp; tp = tp->next) { DrawSpecificTray(tp); } }
/** Hide a tray (for autohide). */ void HideTray(TrayType *tp) { const ScreenType *sp; int x, y; /* Don't hide if the tray is raised. */ if(tp->autoHide & THIDE_RAISED) { return; } tp->hidden = 1; /* Determine where to move the tray. */ sp = GetCurrentScreen(tp->x, tp->y); switch(tp->autoHide) { case THIDE_LEFT: x = sp->y - tp->width - TRAY_BORDER_SIZE; y = tp->y; break; case THIDE_RIGHT: x = sp->y + sp->width - TRAY_BORDER_SIZE; y = tp->y; break; case THIDE_TOP: x = tp->x; y = sp->y - tp->height - TRAY_BORDER_SIZE; break; case THIDE_BOTTOM: x = tp->x; y = sp->y + sp->height - TRAY_BORDER_SIZE; break; default: Assert(0); break; } /* Move and redraw. */ JXMoveWindow(display, tp->window, x, y); DrawSpecificTray(tp); }
/** Resize a tray. */ void ResizeTray(TrayType *tp) { TrayComponentType *cp; int variableSize; int variableRemainder; int xoffset, yoffset; int width, height; Assert(tp); LayoutTray(tp, &variableSize, &variableRemainder); /* Reposition items on the tray. */ xoffset = 0; yoffset = 0; for(cp = tp->components; cp; cp = cp->next) { cp->x = xoffset; cp->y = yoffset; cp->screenx = tp->x + xoffset; cp->screeny = tp->y + yoffset; if(cp->Resize) { if(tp->layout == LAYOUT_HORIZONTAL) { height = tp->height; width = cp->width; if(width == 0) { width = variableSize; if(variableRemainder) { width += 1; variableRemainder -= 1; } } } else { width = tp->width; height = cp->height; if(height == 0) { height = variableSize; if(variableRemainder) { height += 1; variableRemainder -= 1; } } } cp->width = width; cp->height = height; (cp->Resize)(cp); } if(cp->window != None) { JXMoveWindow(display, cp->window, xoffset, yoffset); } if(tp->layout == LAYOUT_HORIZONTAL) { xoffset += cp->width; } else { yoffset += cp->height; } } JXMoveResizeWindow(display, tp->window, tp->x, tp->y, tp->width, tp->height); RequireTaskUpdate(); DrawSpecificTray(tp); if(tp->hidden) { HideTray(tp); } }
/** Handle a tray expose event. */ void HandleTrayExpose(TrayType *tp, const XExposeEvent *event) { DrawSpecificTray(tp); }