9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] slide a window in acme
@ 2003-08-20  5:58 YAMANASHI Takeshi
  0 siblings, 0 replies; only message in thread
From: YAMANASHI Takeshi @ 2003-08-20  5:58 UTC (permalink / raw)
  To: 9fans

I changed coldragwin() in /sys/src/cmd/acme/cols.c so that
dragging with button 2 slides the window, instead of shuffle.
`slide' means changing the position of a window without
changing the order of windows in a column.

I would like to change rows.c as well so that I can slide
a column similarly.

Any suggestions are welcome.

-- cols.c
void
coldragwin(Column *c, Window *w, int but)
{

...  <snip> ...

	if(i==0 && c->nw==1)
		return;			/* can't do it */
	if((i>0 && p.y<c->w[i-1]->r.min.y) || (i<c->nw-1 && p.y>w->r.max.y)
	|| (i==0 && p.y>w->r.max.y)){
> 		/* slide along */
> 		if (but==2) {
> 			int j;
> 			Window *u;
>
> 			if (p.y < op.y) {
> 				for (j=i-1; j>=0 && p.y<c->w[j]->r.min.y; j--){
> 					u = c->w[j];
> 					colclose(c, u, FALSE);
> 					coladd(c, u, nil, p.y-(i-j)*Dy(u->tag.all));
> 				}
> 				u=coladd(c, nil, w, p.y);
> 				colclose(c, u, TRUE);
> 			} else {
> 				Window *wl[50];
> 				int n=0;
> 				for (j=i-1; j<c->nw && p.y>c->w[j]->r.min.y; j++)
> 					wl[n++] = c->w[j];
> 				for (j=0; j<n; j++)
> 					coladd(c, nil, wl[j], p.y+(j+1)*Dy(wl[j]->tag.all));
> 				for (j=0; j<n; j++)
> 					colclose(c, wl[j], TRUE);
> 				w=c->w[i];
> 			}
> 			winmousebut(w);
> 			return;
> 		}
>
> 		/* shuffle */
		colclose(c, w, FALSE);
		coladd(c, w, nil, p.y);
		winmousebut(w);
		return;
	}

... <snip> ...
--



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-20  5:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-20  5:58 [9fans] slide a window in acme YAMANASHI Takeshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).