/** * If the window is not float * makes it float and move it * to the centre */ void centre() { Desktop *d = &desktops[currdeskidx]; XWindowAttributes wa; if (!d->curr || !XGetWindowAttributes(dis, d->curr->win, &wa)) return; if (!d->curr->isfloat && !d->curr->istrans) { d->curr->isfloat = True; tile(d); focus(d->curr, d); } XMoveResizeWindow(dis, d->curr->win, (ww-wa.width)/2 - BORDER_WIDTH, (wh + PANEL_HEIGHT -wa.height)/2 - BORDER_WIDTH, wa.width , wa.height ); } /** * Makes the window float and takes all * available space */ void fullscreen() { Desktop *d = &desktops[currdeskidx]; XWindowAttributes wa; if (!d->curr->isfloat) { d->curr->isfloat=True; tile(d); focus(d->curr, d); } wa.width=ww - (USELESSGAP + BORDER_WIDTH)*2; wa.height=wh + PANEL_HEIGHT - (USELESSGAP + BORDER_WIDTH)*2; XMoveResizeWindow(dis, d->curr->win, (ww-wa.width)/2 - BORDER_WIDTH, (wh + PANEL_HEIGHT -wa.height)/2 - BORDER_WIDTH, wa.width, wa.height); } /** * Makes the window float and back tiling */ void togglefloat() { Desktop *d = &desktops[currdeskidx]; if (!d->curr->isfloat) d->curr->isfloat=True; else d->curr->isfloat=False; tile(d); focus(d->curr, d); }