void move_resize_raise_window( window_item *wi, int x, int y, int w, int h) { static char msg[64]; if (resize) { const char *function = do_maximize? "ResizeMoveMaximize": "ResizeMove"; sprintf(msg, "%s %dp %dp %up %up", function, w, h, x, y); SendText(fd, msg, wi->frame); } else { const char *function = do_maximize? "ResizeMoveMaximize": do_animate ? "AnimatedMove" : "Move"; if (do_maximize) sprintf(msg, "%s keep keep %up %up", function, x, y); else sprintf(msg, "%s %up %up", function, x, y); SendText(fd, msg, wi->frame); } if (raise_window) SendText(fd, "Raise", wi->frame); wait_configure(wi); }
void cascade_windows(void) { char msg[128]; int cur_x = ofsx, cur_y = ofsy; window_item *w = reversed ? wins_tail : wins; while (w) { unsigned long nw = 0, nh = 0; if (raise_window) SendInfo(fd,"Raise",w->frame); sprintf(msg, "Move %up %up", cur_x, cur_y); SendInfo(fd,msg,w->frame); if (resize) { if (nostretch) { if (maxw && (w->width > maxw)) nw = maxw; if (maxh && (w->height > maxh)) nh = maxh; } else { nw = maxw; nh = maxh; } if (nw || nh) { sprintf(msg, "Resize %lup %lup", nw ? nw : w->width, nh ? nh : w->height); SendInfo(fd,msg,w->frame); } } wait_configure(w); if (!flatx) cur_x += w->bw; cur_x += incx; if (!flaty) cur_y += w->bw + w->th; cur_y += incy; w = reversed ? w->prev : w->next; } }
void tile_windows(void) { char msg[128]; int cur_x = ofsx, cur_y = ofsy; int wdiv, hdiv, i, j, count = 1; window_item *w = reversed ? wins_tail : wins; if (horizontal) { if ((maxnum > 0) && (maxnum < wins_count)) { count = wins_count / maxnum; if (wins_count % maxnum) ++count; hdiv = (maxy - ofsy + 1) / maxnum; } else { maxnum = wins_count; hdiv = (maxy - ofsy + 1) / wins_count; } wdiv = (maxx - ofsx + 1) / count; for (i = 0; w && (i < count); ++i) { for (j = 0; w && (j < maxnum); ++j) { int nw = wdiv - w->bw * 2; int nh = hdiv - w->bw * 2 - w->th; if (resize) { if (nostretch) { if (nw > w->width) nw = w->width; if (nh > w->height) nh = w->height; } sprintf(msg, "Resize %lup %lup", (nw > 0) ? nw : w->width, (nh > 0) ? nh : w->height); SendInfo(fd,msg,w->frame); } sprintf(msg, "Move %up %up", cur_x, cur_y); SendInfo(fd,msg,w->frame); if (raise_window) SendInfo(fd,"Raise",w->frame); cur_y += hdiv; wait_configure(w); w = reversed ? w->prev : w->next; } cur_x += wdiv; cur_y = ofsy; } } else { if ((maxnum > 0) && (maxnum < wins_count)) { count = wins_count / maxnum; if (wins_count % maxnum) ++count; wdiv = (maxx - ofsx + 1) / maxnum; } else { maxnum = wins_count; wdiv = (maxx - ofsx + 1) / wins_count; } hdiv = (maxy - ofsy + 1) / count; for (i = 0; w && (i < count); ++i) { for (j = 0; w && (j < maxnum); ++j) { int nw = wdiv - w->bw * 2; int nh = hdiv - w->bw * 2 - w->th; if (resize) { if (nostretch) { if (nw > w->width) nw = w->width; if (nh > w->height) nh = w->height; } sprintf(msg, "Resize %lup %lup", (nw > 0) ? nw : w->width, (nh > 0) ? nh : w->height); SendInfo(fd,msg,w->frame); } sprintf(msg, "Move %up %up", cur_x, cur_y); SendInfo(fd,msg,w->frame); if (raise_window) SendInfo(fd,"Raise",w->frame); cur_x += wdiv; wait_configure(w); w = reversed ? w->prev : w->next; } cur_x = ofsx; cur_y += hdiv; } } }